summaryrefslogtreecommitdiff
path: root/Mac
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2012-08-11 11:08:04 +0200
committerGeorg Brandl <georg@python.org>2012-08-11 11:08:04 +0200
commit4685f4d9c496c4c6ade159d8f928df74a4fea71c (patch)
tree73b5cccf35265d4df7e4d5268c582f9593cbe039 /Mac
parentfbe968d10591720a5efb06e7948ca86c704bf1ab (diff)
parent8fbd4e4ee0d6ba4f0deb3163cc0ff7f5b2b4ee07 (diff)
downloadcpython-4685f4d9c496c4c6ade159d8f928df74a4fea71c.tar.gz
Graft a89d654adaa2 from 3.2 branch. Fixes #15620.
Diffstat (limited to 'Mac')
-rwxr-xr-xMac/BuildScript/build-installer.py4
-rw-r--r--Mac/BuildScript/resources/ReadMe.txt2
-rw-r--r--Mac/BuildScript/resources/Welcome.rtf6
-rwxr-xr-xMac/BuildScript/scripts/postflight.framework4
-rwxr-xr-xMac/BuildScript/scripts/postflight.patch-profile2
-rw-r--r--Mac/Demo/PICTbrowse/ICONbrowse.py161
-rw-r--r--Mac/Demo/PICTbrowse/PICTbrowse.py140
-rw-r--r--Mac/Demo/PICTbrowse/PICTbrowse.rsrcbin0 -> 785 bytes
-rw-r--r--Mac/Demo/PICTbrowse/PICTbrowse2.py162
-rw-r--r--Mac/Demo/PICTbrowse/cicnbrowse.py161
-rw-r--r--Mac/Demo/PICTbrowse/oldPICTbrowse.py158
-rw-r--r--Mac/Demo/PICTbrowse/oldPICTbrowse.rsrcbin0 -> 502 bytes
-rw-r--r--Mac/Demo/applescript.html362
-rw-r--r--Mac/Demo/applescript/Disk_Copy/Special_Events.py424
-rw-r--r--Mac/Demo/applescript/Disk_Copy/Standard_Suite.py477
-rw-r--r--Mac/Demo/applescript/Disk_Copy/Utility_Events.py213
-rw-r--r--Mac/Demo/applescript/Disk_Copy/__init__.py35
-rw-r--r--Mac/Demo/applescript/makedisk.py15
-rw-r--r--Mac/Demo/example0.html75
-rw-r--r--Mac/Demo/example0/checktext.py35
-rw-r--r--Mac/Demo/example1.html193
-rw-r--r--Mac/Demo/example1/dnslookup-1.gifbin0 -> 2570 bytes
-rw-r--r--Mac/Demo/example1/dnslookup-1.py55
-rw-r--r--Mac/Demo/example1/dnslookup-1.rsrcbin0 -> 604 bytes
-rw-r--r--Mac/Demo/example2.html162
-rw-r--r--Mac/Demo/example2/dnslookup-2.gifbin0 -> 2984 bytes
-rw-r--r--Mac/Demo/example2/dnslookup-2.py85
-rw-r--r--Mac/Demo/example2/dnslookup-2.rsrcbin0 -> 707 bytes
-rw-r--r--Mac/Demo/html.icons/createmake.pngbin0 -> 14212 bytes
-rw-r--r--Mac/Demo/html.icons/mkapplet.gifbin0 -> 1010 bytes
-rw-r--r--Mac/Demo/html.icons/options.gifbin0 -> 4231 bytes
-rw-r--r--Mac/Demo/html.icons/preferences.gifbin0 -> 5344 bytes
-rw-r--r--Mac/Demo/html.icons/python.gifbin0 -> 1004 bytes
-rw-r--r--Mac/Demo/imgbrowse/imgbrowse.py115
-rw-r--r--Mac/Demo/imgbrowse/mac_image.py55
-rw-r--r--Mac/Demo/index.html156
-rw-r--r--Mac/Demo/mlte/mlted.py374
-rw-r--r--Mac/Demo/quicktime/MovieInWindow.py70
-rw-r--r--Mac/Demo/quicktime/VerySimplePlayer.py92
-rw-r--r--Mac/Demo/resources/copyres.py57
-rw-r--r--Mac/Demo/resources/listres.py60
-rw-r--r--Mac/Demo/sound/morse.py180
-rw-r--r--Mac/Demo/sound/morselib.py188
-rw-r--r--Mac/Demo/sound/playaiff.py45
-rw-r--r--Mac/Demo/textedit.html150
-rw-r--r--Mac/Demo/textedit/ped.py359
-rw-r--r--Mac/Extras.ReadMe.txt5
-rw-r--r--Mac/Extras.install.py8
-rwxr-xr-xMac/IDLE/IDLE.app/Contents/MacOS/IDLE23
-rw-r--r--Mac/IDLE/IDLE.app/Contents/PkgInfo1
-rw-r--r--Mac/IDLE/IDLE.app/Contents/Resources/IDLE.icnsbin53456 -> 0 bytes
-rw-r--r--Mac/IDLE/IDLE.app/Contents/Resources/PythonCompiled.icnsbin60777 -> 0 bytes
-rw-r--r--Mac/IDLE/IDLE.app/Contents/Resources/PythonSource.icnsbin54522 -> 0 bytes
-rw-r--r--Mac/IDLE/Info.plist.in (renamed from Mac/IDLE/IDLE.app/Contents/Info.plist)17
-rw-r--r--Mac/IDLE/Makefile.in65
-rw-r--r--Mac/IDLE/config-extensions.def93
-rw-r--r--Mac/IDLE/config-main.def79
-rw-r--r--Mac/IDLE/idlemain.py (renamed from Mac/IDLE/IDLE.app/Contents/Resources/idlemain.py)4
-rw-r--r--Mac/Makefile.in180
-rw-r--r--Mac/Modules/ColorPickermodule.c90
-rw-r--r--Mac/Modules/MacOS.c739
-rw-r--r--Mac/Modules/Nav.c967
-rw-r--r--Mac/Modules/OSATerminology.c102
-rw-r--r--Mac/Modules/_scproxy.c231
-rw-r--r--Mac/Modules/ae/README24
-rw-r--r--Mac/Modules/ae/_AEmodule.c1459
-rw-r--r--Mac/Modules/ae/aescan.py97
-rw-r--r--Mac/Modules/ae/aesupport.py237
-rw-r--r--Mac/Modules/ah/_AHmodule.c144
-rw-r--r--Mac/Modules/ah/ahscan.py51
-rw-r--r--Mac/Modules/ah/ahsupport.py45
-rw-r--r--Mac/Modules/app/_Appmodule.c1832
-rw-r--r--Mac/Modules/app/appscan.py80
-rw-r--r--Mac/Modules/app/appsupport.py133
-rw-r--r--Mac/Modules/autoGIL.c152
-rw-r--r--Mac/Modules/carbonevt/CarbonEvtscan.py115
-rw-r--r--Mac/Modules/carbonevt/CarbonEvtsupport.py314
-rwxr-xr-xMac/Modules/carbonevt/_CarbonEvtmodule.c2219
-rw-r--r--Mac/Modules/cf/_CFmodule.c4996
-rw-r--r--Mac/Modules/cf/cfscan.py141
-rw-r--r--Mac/Modules/cf/cfsupport.py666
-rw-r--r--Mac/Modules/cf/pycfbridge.c303
-rw-r--r--Mac/Modules/cf/pycfbridge.h11
-rwxr-xr-xMac/Modules/cg/CFMLateImport.c1360
-rwxr-xr-xMac/Modules/cg/CFMLateImport.h272
-rwxr-xr-xMac/Modules/cg/CGStubLibbin0 -> 2776 bytes
-rwxr-xr-xMac/Modules/cg/CGStubLib.exp60
-rwxr-xr-xMac/Modules/cg/CGStubLib.readme3
-rwxr-xr-xMac/Modules/cg/_CGmodule.c1316
-rw-r--r--Mac/Modules/cg/cgscan.py83
-rw-r--r--Mac/Modules/cg/cgsupport.py192
-rw-r--r--Mac/Modules/cm/_Cmmodule.c955
-rw-r--r--Mac/Modules/cm/cmscan.py88
-rw-r--r--Mac/Modules/cm/cmsupport.py125
-rw-r--r--Mac/Modules/ctl/_Ctlmodule.c5815
-rw-r--r--Mac/Modules/ctl/ctledit.py45
-rw-r--r--Mac/Modules/ctl/ctlscan.py171
-rw-r--r--Mac/Modules/ctl/ctlsupport.py826
-rw-r--r--Mac/Modules/dlg/_Dlgmodule.c1609
-rw-r--r--Mac/Modules/dlg/dlgscan.py115
-rw-r--r--Mac/Modules/dlg/dlgsupport.py278
-rw-r--r--Mac/Modules/drag/_Dragmodule.c1158
-rw-r--r--Mac/Modules/drag/dragscan.py79
-rw-r--r--Mac/Modules/drag/dragsupport.py293
-rw-r--r--Mac/Modules/evt/_Evtmodule.c559
-rw-r--r--Mac/Modules/evt/evtedit.py9
-rw-r--r--Mac/Modules/evt/evtscan.py80
-rw-r--r--Mac/Modules/evt/evtsupport.py92
-rw-r--r--Mac/Modules/file/_Filemodule.c3410
-rw-r--r--Mac/Modules/file/filescan.py198
-rw-r--r--Mac/Modules/file/filesupport.py918
-rw-r--r--Mac/Modules/fm/_Fmmodule.c368
-rw-r--r--Mac/Modules/fm/fmscan.py71
-rw-r--r--Mac/Modules/fm/fmsupport.py81
-rw-r--r--Mac/Modules/folder/_Foldermodule.c342
-rw-r--r--Mac/Modules/folder/folderscan.py67
-rw-r--r--Mac/Modules/folder/foldersupport.py56
-rw-r--r--Mac/Modules/gestaltmodule.c55
-rw-r--r--Mac/Modules/help/_Helpmodule.c196
-rw-r--r--Mac/Modules/help/helpscan.py66
-rw-r--r--Mac/Modules/help/helpsupport.py78
-rw-r--r--Mac/Modules/ibcarbon/IBCarbonscan.py47
-rw-r--r--Mac/Modules/ibcarbon/IBCarbonsupport.py51
-rw-r--r--Mac/Modules/ibcarbon/_IBCarbon.c270
-rw-r--r--Mac/Modules/icgluemodule.c478
-rw-r--r--Mac/Modules/icn/_Icnmodule.c1607
-rw-r--r--Mac/Modules/icn/icnscan.py71
-rw-r--r--Mac/Modules/icn/icnsupport.py90
-rw-r--r--Mac/Modules/launch/_Launchmodule.c481
-rw-r--r--Mac/Modules/launch/launchscan.py85
-rw-r--r--Mac/Modules/launch/launchsupport.py101
-rw-r--r--Mac/Modules/launch/setup.py13
-rw-r--r--Mac/Modules/list/_Listmodule.c1140
-rw-r--r--Mac/Modules/list/listscan.py87
-rw-r--r--Mac/Modules/list/listsupport.py255
-rw-r--r--Mac/Modules/menu/_Menumodule.c3477
-rw-r--r--Mac/Modules/menu/menuedit.py123
-rw-r--r--Mac/Modules/menu/menuscan.py96
-rw-r--r--Mac/Modules/menu/menusupport.py108
-rw-r--r--Mac/Modules/mlte/_Mltemodule.c1690
-rw-r--r--Mac/Modules/mlte/mltescan.py142
-rw-r--r--Mac/Modules/mlte/mltesupport.py202
-rw-r--r--Mac/Modules/osa/_OSAmodule.c899
-rw-r--r--Mac/Modules/osa/osascan.py61
-rw-r--r--Mac/Modules/osa/osasupport.py105
-rw-r--r--Mac/Modules/osa/setup.py13
-rw-r--r--Mac/Modules/qd/_Qdmodule.c7154
-rw-r--r--Mac/Modules/qd/qdedit.py158
-rw-r--r--Mac/Modules/qd/qdscan.py234
-rw-r--r--Mac/Modules/qd/qdsupport.py377
-rw-r--r--Mac/Modules/qdoffs/_Qdoffsmodule.c722
-rw-r--r--Mac/Modules/qdoffs/qdoffsscan.py65
-rw-r--r--Mac/Modules/qdoffs/qdoffssupport.py139
-rw-r--r--Mac/Modules/qt/_Qtmodule.c28091
-rw-r--r--Mac/Modules/qt/qtscan.py318
-rw-r--r--Mac/Modules/qt/qtsupport.py382
-rw-r--r--Mac/Modules/qt/setup.py13
-rw-r--r--Mac/Modules/res/_Resmodule.c1760
-rw-r--r--Mac/Modules/res/resedit.py102
-rw-r--r--Mac/Modules/res/resscan.py83
-rw-r--r--Mac/Modules/res/ressupport.py221
-rw-r--r--Mac/Modules/scrap/_Scrapmodule.c365
-rw-r--r--Mac/Modules/scrap/scrapscan.py60
-rw-r--r--Mac/Modules/scrap/scrapsupport.py75
-rw-r--r--Mac/Modules/snd/_Sndihooks.c512
-rw-r--r--Mac/Modules/snd/_Sndmodule.c1163
-rw-r--r--Mac/Modules/snd/sndscan.py127
-rw-r--r--Mac/Modules/snd/sndsupport.py319
-rw-r--r--Mac/Modules/te/_TEmodule.c1339
-rw-r--r--Mac/Modules/te/tescan.py66
-rw-r--r--Mac/Modules/te/tesupport.py216
-rw-r--r--Mac/Modules/win/_Winmodule.c3265
-rw-r--r--Mac/Modules/win/winedit.py69
-rw-r--r--Mac/Modules/win/winscan.py129
-rw-r--r--Mac/Modules/win/winsupport.py226
-rw-r--r--Mac/PythonLauncher/Info.plist.in2
-rw-r--r--Mac/PythonLauncher/Makefile.in7
-rw-r--r--Mac/README65
-rw-r--r--Mac/Resources/app/Info.plist.in6
-rw-r--r--Mac/Resources/framework/Info.plist.in4
-rw-r--r--Mac/Resources/iconsrc/IDE.psdbin83876 -> 0 bytes
-rw-r--r--Mac/Resources/iconsrc/PackageManager.psdbin71056 -> 0 bytes
-rw-r--r--Mac/Resources/iconsrc/PythonApplet.psdbin41543 -> 0 bytes
-rwxr-xr-xMac/Resources/iconsrc/PythonCompiled.psdbin76118 -> 0 bytes
-rwxr-xr-xMac/Resources/iconsrc/PythonIcon.psdbin67236 -> 0 bytes
-rwxr-xr-xMac/Resources/iconsrc/PythonSource.psdbin62075 -> 0 bytes
-rw-r--r--Mac/Resources/iconsrc/PythonWSource.psdbin64185 -> 0 bytes
-rw-r--r--Mac/Tools/Doc/HelpIndexingTool/Help_Indexing_Tool_Suite.py110
-rw-r--r--Mac/Tools/Doc/HelpIndexingTool/Miscellaneous_Standards.py49
-rw-r--r--Mac/Tools/Doc/HelpIndexingTool/Required_Suite.py32
-rw-r--r--Mac/Tools/Doc/HelpIndexingTool/Standard_Suite.py343
-rw-r--r--Mac/Tools/Doc/HelpIndexingTool/__init__.py78
-rw-r--r--Mac/Tools/Doc/HelpIndexingTool/odds_and_ends.py49
-rw-r--r--Mac/Tools/Doc/README35
-rw-r--r--Mac/Tools/Doc/setup.py213
-rw-r--r--Mac/Tools/bundlebuilder.py934
-rw-r--r--Mac/Tools/fixapplepython23.py35
-rw-r--r--Mac/Tools/pythonw.c8
-rw-r--r--Mac/scripts/BuildApplet.icnsbin0 -> 120107 bytes
-rw-r--r--Mac/scripts/BuildApplet.plist55
-rw-r--r--Mac/scripts/BuildApplet.py156
-rw-r--r--Mac/scripts/BuildApplet.rsrcbin0 -> 3169 bytes
-rw-r--r--Mac/scripts/bgenall.py56
-rw-r--r--Mac/scripts/buildpkg.py484
-rw-r--r--Mac/scripts/cachersrc.py44
-rw-r--r--Mac/scripts/errors.txt1852
-rw-r--r--Mac/scripts/genallsuites.py52
-rw-r--r--Mac/scripts/mkestrres-errno.h7
-rwxr-xr-xMac/scripts/mkestrres-macerrors.h13
-rw-r--r--Mac/scripts/mkestrres.py157
-rw-r--r--Mac/scripts/zappycfiles.py29
211 files changed, 104272 insertions, 1989 deletions
diff --git a/Mac/BuildScript/build-installer.py b/Mac/BuildScript/build-installer.py
index f0b3f3ff5b..ba920127c4 100755
--- a/Mac/BuildScript/build-installer.py
+++ b/Mac/BuildScript/build-installer.py
@@ -100,7 +100,7 @@ UNIVERSALARCHS = '32-bit'
ARCHLIST = universal_opts_map[UNIVERSALARCHS]
-# Source directory (asume we're in Mac/BuildScript)
+# Source directory (assume we're in Mac/BuildScript)
SRCDIR = os.path.dirname(
os.path.dirname(
os.path.dirname(
@@ -362,7 +362,7 @@ def fileContents(fn):
def runCommand(commandline):
"""
- Run a command and raise RuntimeError if it fails. Output is surpressed
+ Run a command and raise RuntimeError if it fails. Output is suppressed
unless the command fails.
"""
fd = os.popen(commandline, 'r')
diff --git a/Mac/BuildScript/resources/ReadMe.txt b/Mac/BuildScript/resources/ReadMe.txt
index f1beda0fbe..761cffb06b 100644
--- a/Mac/BuildScript/resources/ReadMe.txt
+++ b/Mac/BuildScript/resources/ReadMe.txt
@@ -24,7 +24,7 @@ of Tcl/Tk for this version of Python and Mac OS X.
*******************
The installer puts applications, an "Update Shell Profile" command,
-and a link to the optionally installed Python Documentation into the
+and an Extras folder containing demo programs and tools into the
"Python $VERSION" subfolder of the system Applications folder,
and puts the underlying machinery into the folder
$PYTHONFRAMEWORKINSTALLDIR. It can
diff --git a/Mac/BuildScript/resources/Welcome.rtf b/Mac/BuildScript/resources/Welcome.rtf
index d209b10cf7..1fb7cd4831 100644
--- a/Mac/BuildScript/resources/Welcome.rtf
+++ b/Mac/BuildScript/resources/Welcome.rtf
@@ -19,12 +19,6 @@
See the ReadMe file and the Python documentation for more information.\
\
-\b NOTE:
-\b0 This package will by default not update your shell profile and will also not install files in /usr/local. Double-click
-\b Update Shell Profile
-\b0 at any time to make $FULL_VERSION the default Python.\
-\
-
\b IMPORTANT:
\b0
\b IDLE
diff --git a/Mac/BuildScript/scripts/postflight.framework b/Mac/BuildScript/scripts/postflight.framework
index 9fc91515c7..4c8f6d3aa3 100755
--- a/Mac/BuildScript/scripts/postflight.framework
+++ b/Mac/BuildScript/scripts/postflight.framework
@@ -6,12 +6,12 @@
PYVER="@PYVER@"
FWK="/Library/Frameworks/Python.framework/Versions/@PYVER@"
-"${FWK}/bin/python@PYVER@" -Wi \
+"${FWK}/bin/python@PYVER@" -Wi -tt \
"${FWK}/lib/python${PYVER}/compileall.py" \
-x badsyntax -x site-packages \
"${FWK}/lib/python${PYVER}"
-"${FWK}/bin/python@PYVER@" -Wi -O \
+"${FWK}/bin/python@PYVER@" -Wi -tt -O \
"${FWK}/lib/python${PYVER}/compileall.py" \
-x badsyntax -x site-packages \
"${FWK}/lib/python${PYVER}"
diff --git a/Mac/BuildScript/scripts/postflight.patch-profile b/Mac/BuildScript/scripts/postflight.patch-profile
index 36d0a3e40e..a66b8c787a 100755
--- a/Mac/BuildScript/scripts/postflight.patch-profile
+++ b/Mac/BuildScript/scripts/postflight.patch-profile
@@ -5,7 +5,7 @@ echo "of python is not early enough of the PATH of your shell."
echo "These changes will be effective only in shell windows that you open"
echo "after running this script."
-PYVER=@PYVER@
+PYVER="@PYVER@"
PYTHON_ROOT="/Library/Frameworks/Python.framework/Versions/@PYVER@"
if [ `id -ur` = 0 ]; then
diff --git a/Mac/Demo/PICTbrowse/ICONbrowse.py b/Mac/Demo/PICTbrowse/ICONbrowse.py
new file mode 100644
index 0000000000..f55070bf53
--- /dev/null
+++ b/Mac/Demo/PICTbrowse/ICONbrowse.py
@@ -0,0 +1,161 @@
+"""browsepict - Display all "ICON" resources found"""
+
+import FrameWork
+import EasyDialogs
+from Carbon import Res
+from Carbon import Qd
+from Carbon import Win
+from Carbon import Controls
+from Carbon import List
+from Carbon import Icn
+import macresource
+
+#
+# Resource definitions
+ID_MAIN=512
+MAIN_LIST=1
+MAIN_SHOW=2
+
+# Where is the picture window?
+LEFT=200
+TOP=64
+MINWIDTH=32
+MINHEIGHT=32
+MAXWIDTH=320
+MAXHEIGHT=320
+
+def main():
+ macresource.need('DLOG', ID_MAIN, "PICTbrowse.rsrc")
+ ICONbrowse()
+
+class ICONbrowse(FrameWork.Application):
+ def __init__(self):
+ # First init menus, etc.
+ FrameWork.Application.__init__(self)
+ # Next create our dialog
+ self.main_dialog = MyDialog(self)
+ # Now open the dialog
+ contents = self.findICONresources()
+ self.main_dialog.open(ID_MAIN, contents)
+ # Finally, go into the event loop
+ self.mainloop()
+
+ def makeusermenus(self):
+ self.filemenu = m = FrameWork.Menu(self.menubar, "File")
+ self.quititem = FrameWork.MenuItem(m, "Quit", "Q", self.quit)
+
+ def quit(self, *args):
+ self._quit()
+
+ def showICON(self, resid):
+ w = ICONwindow(self)
+ w.open(resid)
+ #EasyDialogs.Message('Show ICON %r' % (resid,))
+
+ def findICONresources(self):
+ num = Res.CountResources('ICON')
+ rv = []
+ for i in range(1, num+1):
+ Res.SetResLoad(0)
+ try:
+ r = Res.GetIndResource('ICON', i)
+ finally:
+ Res.SetResLoad(1)
+ id, type, name = r.GetResInfo()
+ rv.append((id, name))
+ return rv
+
+class ICONwindow(FrameWork.Window):
+ def open(self, (resid, resname)):
+ if not resname:
+ resname = '#%r' % (resid,)
+ self.resid = resid
+ self.picture = Icn.GetIcon(self.resid)
+ l, t, r, b = 0, 0, 32, 32
+ self.pictrect = (l, t, r, b)
+ width = r-l
+ height = b-t
+ if width < MINWIDTH: width = MINWIDTH
+ elif width > MAXWIDTH: width = MAXWIDTH
+ if height < MINHEIGHT: height = MINHEIGHT
+ elif height > MAXHEIGHT: height = MAXHEIGHT
+ bounds = (LEFT, TOP, LEFT+width, TOP+height)
+
+ self.wid = Win.NewWindow(bounds, resname, 1, 0, -1, 1, 0)
+ self.do_postopen()
+
+ def do_update(self, *args):
+ currect = self.fitrect()
+ Icn.PlotIcon(currect, self.picture)
+
+ def fitrect(self):
+ """Return self.pictrect scaled to fit in window"""
+ graf = self.wid.GetWindowPort()
+ screenrect = graf.GetPortBounds()
+ picwidth = self.pictrect[2] - self.pictrect[0]
+ picheight = self.pictrect[3] - self.pictrect[1]
+ if picwidth > screenrect[2] - screenrect[0]:
+ factor = float(picwidth) / float(screenrect[2]-screenrect[0])
+ picwidth = picwidth / factor
+ picheight = picheight / factor
+ if picheight > screenrect[3] - screenrect[1]:
+ factor = float(picheight) / float(screenrect[3]-screenrect[1])
+ picwidth = picwidth / factor
+ picheight = picheight / factor
+ return (screenrect[0], screenrect[1], screenrect[0]+int(picwidth),
+ screenrect[1]+int(picheight))
+
+class MyDialog(FrameWork.DialogWindow):
+ "Main dialog window for ICONbrowse"
+
+ def open(self, id, contents):
+ self.id = id
+ FrameWork.DialogWindow.open(self, ID_MAIN)
+ self.dlg.SetDialogDefaultItem(MAIN_SHOW)
+ self.contents = contents
+ self.ctl = self.dlg.GetDialogItemAsControl(MAIN_LIST)
+ h = self.ctl.GetControlData_Handle(Controls.kControlListBoxPart,
+ Controls.kControlListBoxListHandleTag)
+ self.list = List.as_List(h)
+ self.setlist()
+
+ def setlist(self):
+ self.list.LDelRow(0, 0)
+ self.list.LSetDrawingMode(0)
+ if self.contents:
+ self.list.LAddRow(len(self.contents), 0)
+ for i in range(len(self.contents)):
+ v = repr(self.contents[i][0])
+ if self.contents[i][1]:
+ v = v + '"' + self.contents[i][1] + '"'
+ self.list.LSetCell(v, (0, i))
+ self.list.LSetDrawingMode(1)
+ self.list.LUpdate(self.wid.GetWindowPort().visRgn)
+
+ def getselection(self):
+ items = []
+ point = (0,0)
+ while 1:
+ ok, point = self.list.LGetSelect(1, point)
+ if not ok:
+ break
+ items.append(point[1])
+ point = point[0], point[1]+1
+ values = []
+ for i in items:
+ values.append(self.contents[i])
+ return values
+
+ def do_show(self, *args):
+ selection = self.getselection()
+ for resid in selection:
+ self.parent.showICON(resid)
+
+ def do_close(self):
+ self.close()
+
+ def do_itemhit(self, item, event):
+ if item == MAIN_SHOW:
+ self.do_show()
+
+main()
diff --git a/Mac/Demo/PICTbrowse/PICTbrowse.py b/Mac/Demo/PICTbrowse/PICTbrowse.py
new file mode 100644
index 0000000000..f92bdd0117
--- /dev/null
+++ b/Mac/Demo/PICTbrowse/PICTbrowse.py
@@ -0,0 +1,140 @@
+"""browsepict - Display all "PICT" resources found"""
+
+import FrameWork
+import EasyDialogs
+from Carbon import Res
+from Carbon import Qd
+from Carbon import Win
+from Carbon import Controls
+from Carbon import List
+import struct
+import macresource
+
+#
+# Resource definitions
+ID_MAIN=512
+MAIN_LIST=1
+MAIN_SHOW=2
+
+# Where is the picture window?
+LEFT=200
+TOP=64
+
+def main():
+ macresource.need('DLOG', ID_MAIN, "PICTbrowse.rsrc")
+ PICTbrowse()
+
+class PICTbrowse(FrameWork.Application):
+ def __init__(self):
+ # First init menus, etc.
+ FrameWork.Application.__init__(self)
+ # Next create our dialog
+ self.main_dialog = MyDialog(self)
+ # Now open the dialog
+ contents = self.findPICTresources()
+ self.main_dialog.open(ID_MAIN, contents)
+ # Finally, go into the event loop
+ self.mainloop()
+
+ def makeusermenus(self):
+ self.filemenu = m = FrameWork.Menu(self.menubar, "File")
+ self.quititem = FrameWork.MenuItem(m, "Quit", "Q", self.quit)
+
+ def quit(self, *args):
+ self._quit()
+
+ def showPICT(self, resid):
+ w = PICTwindow(self)
+ w.open(resid)
+ #EasyDialogs.Message('Show PICT %r' % (resid,))
+
+ def findPICTresources(self):
+ num = Res.CountResources('PICT')
+ rv = []
+ for i in range(1, num+1):
+ Res.SetResLoad(0)
+ try:
+ r = Res.GetIndResource('PICT', i)
+ finally:
+ Res.SetResLoad(1)
+ id, type, name = r.GetResInfo()
+ rv.append((id, name))
+ return rv
+
+class PICTwindow(FrameWork.Window):
+ def open(self, (resid, resname)):
+ if not resname:
+ resname = '#%r' % (resid,)
+ self.resid = resid
+ picture = Qd.GetPicture(self.resid)
+ # Get rect for picture
+ print repr(picture.data[:16])
+ sz, t, l, b, r = struct.unpack('hhhhh', picture.data[:10])
+ print 'pict:', t, l, b, r
+ width = r-l
+ height = b-t
+ if width < 64: width = 64
+ elif width > 480: width = 480
+ if height < 64: height = 64
+ elif height > 320: height = 320
+ bounds = (LEFT, TOP, LEFT+width, TOP+height)
+ print 'bounds:', bounds
+
+ self.wid = Win.NewWindow(bounds, resname, 1, 0, -1, 1, 0)
+ self.wid.SetWindowPic(picture)
+ self.do_postopen()
+
+class MyDialog(FrameWork.DialogWindow):
+ "Main dialog window for PICTbrowse"
+
+ def open(self, id, contents):
+ self.id = id
+ FrameWork.DialogWindow.open(self, ID_MAIN)
+ self.dlg.SetDialogDefaultItem(MAIN_SHOW)
+ self.contents = contents
+ self.ctl = self.dlg.GetDialogItemAsControl(MAIN_LIST)
+ h = self.ctl.GetControlData_Handle(Controls.kControlListBoxPart,
+ Controls.kControlListBoxListHandleTag)
+ self.list = List.as_List(h)
+ self.setlist()
+
+ def setlist(self):
+ self.list.LDelRow(0, 0)
+ self.list.LSetDrawingMode(0)
+ if self.contents:
+ self.list.LAddRow(len(self.contents), 0)
+ for i in range(len(self.contents)):
+ v = repr(self.contents[i][0])
+ if self.contents[i][1]:
+ v = v + '"' + self.contents[i][1] + '"'
+ self.list.LSetCell(v, (0, i))
+ self.list.LSetDrawingMode(1)
+ self.list.LUpdate(self.wid.GetWindowPort().visRgn)
+
+ def getselection(self):
+ items = []
+ point = (0,0)
+ while 1:
+ ok, point = self.list.LGetSelect(1, point)
+ if not ok:
+ break
+ items.append(point[1])
+ point = point[0], point[1]+1
+ values = []
+ for i in items:
+ values.append(self.contents[i])
+ return values
+
+ def do_show(self, *args):
+ selection = self.getselection()
+ for resid in selection:
+ self.parent.showPICT(resid)
+
+ def do_close(self):
+ self.close()
+
+ def do_itemhit(self, item, event):
+ if item == MAIN_SHOW:
+ self.do_show()
+
+main()
diff --git a/Mac/Demo/PICTbrowse/PICTbrowse.rsrc b/Mac/Demo/PICTbrowse/PICTbrowse.rsrc
new file mode 100644
index 0000000000..526ff522aa
--- /dev/null
+++ b/Mac/Demo/PICTbrowse/PICTbrowse.rsrc
Binary files differ
diff --git a/Mac/Demo/PICTbrowse/PICTbrowse2.py b/Mac/Demo/PICTbrowse/PICTbrowse2.py
new file mode 100644
index 0000000000..211d09e602
--- /dev/null
+++ b/Mac/Demo/PICTbrowse/PICTbrowse2.py
@@ -0,0 +1,162 @@
+"""browsepict - Display all "PICT" resources found"""
+
+import FrameWork
+import EasyDialogs
+from Carbon import Res
+from Carbon import Qd
+from Carbon import Win
+from Carbon import Controls
+from Carbon import List
+import struct
+import macresource
+
+#
+# Resource definitions
+ID_MAIN=512
+MAIN_LIST=1
+MAIN_SHOW=2
+
+# Where is the picture window?
+LEFT=200
+TOP=64
+MINWIDTH=64
+MINHEIGHT=64
+MAXWIDTH=320
+MAXHEIGHT=320
+
+def main():
+ macresource.need('DLOG', ID_MAIN, "PICTbrowse.rsrc")
+ PICTbrowse()
+
+class PICTbrowse(FrameWork.Application):
+ def __init__(self):
+ # First init menus, etc.
+ FrameWork.Application.__init__(self)
+ # Next create our dialog
+ self.main_dialog = MyDialog(self)
+ # Now open the dialog
+ contents = self.findPICTresources()
+ self.main_dialog.open(ID_MAIN, contents)
+ # Finally, go into the event loop
+ self.mainloop()
+
+ def makeusermenus(self):
+ self.filemenu = m = FrameWork.Menu(self.menubar, "File")
+ self.quititem = FrameWork.MenuItem(m, "Quit", "Q", self.quit)
+
+ def quit(self, *args):
+ self._quit()
+
+ def showPICT(self, resid):
+ w = PICTwindow(self)
+ w.open(resid)
+ #EasyDialogs.Message('Show PICT %r' % (resid,))
+
+ def findPICTresources(self):
+ num = Res.CountResources('PICT')
+ rv = []
+ for i in range(1, num+1):
+ Res.SetResLoad(0)
+ try:
+ r = Res.GetIndResource('PICT', i)
+ finally:
+ Res.SetResLoad(1)
+ id, type, name = r.GetResInfo()
+ rv.append((id, name))
+ return rv
+
+class PICTwindow(FrameWork.Window):
+ def open(self, (resid, resname)):
+ if not resname:
+ resname = '#%r' % (resid,)
+ self.resid = resid
+ self.picture = Qd.GetPicture(self.resid)
+ # Get rect for picture
+ sz, t, l, b, r = struct.unpack('hhhhh', self.picture.data[:10])
+ self.pictrect = (l, t, r, b)
+ width = r-l
+ height = b-t
+ if width < MINWIDTH: width = MINWIDTH
+ elif width > MAXWIDTH: width = MAXWIDTH
+ if height < MINHEIGHT: height = MINHEIGHT
+ elif height > MAXHEIGHT: height = MAXHEIGHT
+ bounds = (LEFT, TOP, LEFT+width, TOP+height)
+
+ self.wid = Win.NewWindow(bounds, resname, 1, 0, -1, 1, 0)
+ self.do_postopen()
+
+ def do_update(self, *args):
+ currect = self.fitrect()
+ Qd.DrawPicture(self.picture, currect)
+
+ def fitrect(self):
+ """Return self.pictrect scaled to fit in window"""
+ graf = self.dlg.GetWindowPort()
+ screenrect = graf.GetPortBounds()
+ picwidth = self.pictrect[2] - self.pictrect[0]
+ picheight = self.pictrect[3] - self.pictrect[1]
+ if picwidth > screenrect[2] - screenrect[0]:
+ factor = float(picwidth) / float(screenrect[2]-screenrect[0])
+ picwidth = picwidth / factor
+ picheight = picheight / factor
+ if picheight > screenrect[3] - screenrect[1]:
+ factor = float(picheight) / float(screenrect[3]-screenrect[1])
+ picwidth = picwidth / factor
+ picheight = picheight / factor
+ return (screenrect[0], screenrect[1], screenrect[0]+int(picwidth),
+ screenrect[1]+int(picheight))
+
+class MyDialog(FrameWork.DialogWindow):
+ "Main dialog window for PICTbrowse"
+
+ def open(self, id, contents):
+ self.id = id
+ FrameWork.DialogWindow.open(self, ID_MAIN)
+ self.dlg.SetDialogDefaultItem(MAIN_SHOW)
+ self.contents = contents
+ self.ctl = self.dlg.GetDialogItemAsControl(MAIN_LIST)
+ h = self.ctl.GetControlData_Handle(Controls.kControlListBoxPart,
+ Controls.kControlListBoxListHandleTag)
+ self.list = List.as_List(h)
+ self.setlist()
+
+ def setlist(self):
+ self.list.LDelRow(0, 0)
+ self.list.LSetDrawingMode(0)
+ if self.contents:
+ self.list.LAddRow(len(self.contents), 0)
+ for i in range(len(self.contents)):
+ v = repr(self.contents[i][0])
+ if self.contents[i][1]:
+ v = v + '"' + self.contents[i][1] + '"'
+ self.list.LSetCell(v, (0, i))
+ self.list.LSetDrawingMode(1)
+ self.list.LUpdate(self.wid.GetWindowPort().visRgn)
+
+ def getselection(self):
+ items = []
+ point = (0,0)
+ while 1:
+ ok, point = self.list.LGetSelect(1, point)
+ if not ok:
+ break
+ items.append(point[1])
+ point = point[0], point[1]+1
+ values = []
+ for i in items:
+ values.append(self.contents[i])
+ return values
+
+ def do_show(self, *args):
+ selection = self.getselection()
+ for resid in selection:
+ self.parent.showPICT(resid)
+
+ def do_close(self):
+ self.close()
+
+ def do_itemhit(self, item, event):
+ if item == MAIN_SHOW:
+ self.do_show()
+
+main()
diff --git a/Mac/Demo/PICTbrowse/cicnbrowse.py b/Mac/Demo/PICTbrowse/cicnbrowse.py
new file mode 100644
index 0000000000..4bc7008ed4
--- /dev/null
+++ b/Mac/Demo/PICTbrowse/cicnbrowse.py
@@ -0,0 +1,161 @@
+"""browsepict - Display all "cicn" resources found"""
+
+import FrameWork
+import EasyDialogs
+from Carbon import Res
+from Carbon import Qd
+from Carbon import Win
+from Carbon import Controls
+from Carbon import List
+from Carbon import Icn
+import macresource
+
+#
+# Resource definitions
+ID_MAIN=512
+MAIN_LIST=1
+MAIN_SHOW=2
+
+# Where is the picture window?
+LEFT=200
+TOP=64
+MINWIDTH=32
+MINHEIGHT=32
+MAXWIDTH=320
+MAXHEIGHT=320
+
+def main():
+ macresource.need('DLOG', ID_MAIN, "PICTbrowse.rsrc")
+ CIconbrowse()
+
+class CIconbrowse(FrameWork.Application):
+ def __init__(self):
+ # First init menus, etc.
+ FrameWork.Application.__init__(self)
+ # Next create our dialog
+ self.main_dialog = MyDialog(self)
+ # Now open the dialog
+ contents = self.findcicnresources()
+ self.main_dialog.open(ID_MAIN, contents)
+ # Finally, go into the event loop
+ self.mainloop()
+
+ def makeusermenus(self):
+ self.filemenu = m = FrameWork.Menu(self.menubar, "File")
+ self.quititem = FrameWork.MenuItem(m, "Quit", "Q", self.quit)
+
+ def quit(self, *args):
+ self._quit()
+
+ def showCIcon(self, resid):
+ w = CIconwindow(self)
+ w.open(resid)
+ #EasyDialogs.Message('Show cicn %r' % (resid,))
+
+ def findcicnresources(self):
+ num = Res.CountResources('cicn')
+ rv = []
+ for i in range(1, num+1):
+ Res.SetResLoad(0)
+ try:
+ r = Res.GetIndResource('cicn', i)
+ finally:
+ Res.SetResLoad(1)
+ id, type, name = r.GetResInfo()
+ rv.append((id, name))
+ return rv
+
+class CIconwindow(FrameWork.Window):
+ def open(self, (resid, resname)):
+ if not resname:
+ resname = '#%r' % (resid,)
+ self.resid = resid
+ self.picture = Icn.GetCIcon(self.resid)
+ l, t, r, b = 0, 0, 32, 32
+ self.pictrect = (l, t, r, b)
+ width = r-l
+ height = b-t
+ if width < MINWIDTH: width = MINWIDTH
+ elif width > MAXWIDTH: width = MAXWIDTH
+ if height < MINHEIGHT: height = MINHEIGHT
+ elif height > MAXHEIGHT: height = MAXHEIGHT
+ bounds = (LEFT, TOP, LEFT+width, TOP+height)
+
+ self.wid = Win.NewWindow(bounds, resname, 1, 0, -1, 1, 0)
+ self.do_postopen()
+
+ def do_update(self, *args):
+ currect = self.fitrect()
+ Icn.PlotCIcon(currect, self.picture)
+
+ def fitrect(self):
+ """Return self.pictrect scaled to fit in window"""
+ graf = self.wid.GetWindowPort()
+ screenrect = graf.GetPortBounds()
+ picwidth = self.pictrect[2] - self.pictrect[0]
+ picheight = self.pictrect[3] - self.pictrect[1]
+ if picwidth > screenrect[2] - screenrect[0]:
+ factor = float(picwidth) / float(screenrect[2]-screenrect[0])
+ picwidth = picwidth / factor
+ picheight = picheight / factor
+ if picheight > screenrect[3] - screenrect[1]:
+ factor = float(picheight) / float(screenrect[3]-screenrect[1])
+ picwidth = picwidth / factor
+ picheight = picheight / factor
+ return (screenrect[0], screenrect[1], screenrect[0]+int(picwidth),
+ screenrect[1]+int(picheight))
+
+class MyDialog(FrameWork.DialogWindow):
+ "Main dialog window for cicnbrowse"
+
+ def open(self, id, contents):
+ self.id = id
+ FrameWork.DialogWindow.open(self, ID_MAIN)
+ self.dlg.SetDialogDefaultItem(MAIN_SHOW)
+ self.contents = contents
+ self.ctl = self.dlg.GetDialogItemAsControl(MAIN_LIST)
+ h = self.ctl.GetControlData_Handle(Controls.kControlListBoxPart,
+ Controls.kControlListBoxListHandleTag)
+ self.list = List.as_List(h)
+ self.setlist()
+
+ def setlist(self):
+ self.list.LDelRow(0, 0)
+ self.list.LSetDrawingMode(0)
+ if self.contents:
+ self.list.LAddRow(len(self.contents), 0)
+ for i in range(len(self.contents)):
+ v = repr(self.contents[i][0])
+ if self.contents[i][1]:
+ v = v + '"' + self.contents[i][1] + '"'
+ self.list.LSetCell(v, (0, i))
+ self.list.LSetDrawingMode(1)
+ self.list.LUpdate(self.wid.GetWindowPort().visRgn)
+
+ def getselection(self):
+ items = []
+ point = (0,0)
+ while 1:
+ ok, point = self.list.LGetSelect(1, point)
+ if not ok:
+ break
+ items.append(point[1])
+ point = point[0], point[1]+1
+ values = []
+ for i in items:
+ values.append(self.contents[i])
+ return values
+
+ def do_show(self, *args):
+ selection = self.getselection()
+ for resid in selection:
+ self.parent.showCIcon(resid)
+
+ def do_close(self):
+ self.close()
+
+ def do_itemhit(self, item, event):
+ if item == MAIN_SHOW:
+ self.do_show()
+
+main()
diff --git a/Mac/Demo/PICTbrowse/oldPICTbrowse.py b/Mac/Demo/PICTbrowse/oldPICTbrowse.py
new file mode 100644
index 0000000000..d15a27d570
--- /dev/null
+++ b/Mac/Demo/PICTbrowse/oldPICTbrowse.py
@@ -0,0 +1,158 @@
+"""browsepict - Display all "PICT" resources found"""
+
+import FrameWork
+import EasyDialogs
+from Carbon import Res
+from Carbon import Qd
+from Carbon import Win
+from Carbon import List
+import struct
+import macresource
+
+#
+# Resource definitions
+ID_MAIN=512
+MAIN_LIST=1
+MAIN_SHOW=2
+
+# Where is the picture window?
+LEFT=200
+TOP=64
+
+def main():
+ macresource.need('DLOG', ID_MAIN, "oldPICTbrowse.rsrc")
+ PICTbrowse()
+
+class PICTbrowse(FrameWork.Application):
+ def __init__(self):
+ # First init menus, etc.
+ FrameWork.Application.__init__(self)
+ # Next create our dialog
+ self.main_dialog = MyDialog(self)
+ # Now open the dialog
+ contents = self.findPICTresources()
+ self.main_dialog.open(ID_MAIN, contents)
+ # Finally, go into the event loop
+ self.mainloop()
+
+ def makeusermenus(self):
+ self.filemenu = m = FrameWork.Menu(self.menubar, "File")
+ self.quititem = FrameWork.MenuItem(m, "Quit", "Q", self.quit)
+
+ def quit(self, *args):
+ self._quit()
+
+ def showPICT(self, resid):
+ w = PICTwindow(self)
+ w.open(resid)
+ #EasyDialogs.Message('Show PICT %r' % (resid,))
+
+ def findPICTresources(self):
+ num = Res.CountResources('PICT')
+ rv = []
+ for i in range(1, num+1):
+ Res.SetResLoad(0)
+ try:
+ r = Res.GetIndResource('PICT', i)
+ finally:
+ Res.SetResLoad(1)
+ id, type, name = r.GetResInfo()
+ rv.append((id, name))
+ return rv
+
+class PICTwindow(FrameWork.Window):
+ def open(self, (resid, resname)):
+ if not resname:
+ resname = '#%r' % (resid,)
+ self.resid = resid
+ picture = Qd.GetPicture(self.resid)
+ # Get rect for picture
+ print repr(picture.data[:16])
+ sz, t, l, b, r = struct.unpack('hhhhh', picture.data[:10])
+ print 'pict:', t, l, b, r
+ width = r-l
+ height = b-t
+ if width < 64: width = 64
+ elif width > 480: width = 480
+ if height < 64: height = 64
+ elif height > 320: height = 320
+ bounds = (LEFT, TOP, LEFT+width, TOP+height)
+ print 'bounds:', bounds
+
+ self.wid = Win.NewWindow(bounds, resname, 1, 0, -1, 1, 0)
+ self.wid.SetWindowPic(picture)
+ self.do_postopen()
+
+class MyDialog(FrameWork.DialogWindow):
+ "Main dialog window for PICTbrowse"
+
+ def open(self, id, contents):
+ self.id = id
+ FrameWork.DialogWindow.open(self, ID_MAIN)
+ self.dlg.SetDialogDefaultItem(MAIN_SHOW)
+ tp, h, rect = self.dlg.GetDialogItem(MAIN_LIST)
+ rect2 = rect[0]+1, rect[1]+1, rect[2]-17, rect[3]-17 # Scroll bar space
+ self.list = List.LNew(rect2, (0, 0, 1, len(contents)), (0,0), 0, self.wid,
+ 0, 1, 1, 1)
+ self.contents = contents
+ self.setlist()
+
+ def setlist(self):
+ self.list.LDelRow(0, 0)
+ self.list.LSetDrawingMode(0)
+ if self.contents:
+ self.list.LAddRow(len(self.contents), 0)
+ for i in range(len(self.contents)):
+ v = repr(self.contents[i][0])
+ if self.contents[i][1]:
+ v = v + '"' + self.contents[i][1] + '"'
+ self.list.LSetCell(v, (0, i))
+ self.list.LSetDrawingMode(1)
+ self.list.LUpdate(self.wid.GetWindowPort().visRgn)
+
+ def do_listhit(self, event):
+ (what, message, when, where, modifiers) = event
+ Qd.SetPort(self.wid)
+ where = Qd.GlobalToLocal(where)
+ print 'LISTHIT', where
+ if self.list.LClick(where, modifiers):
+ self.do_show()
+
+ def getselection(self):
+ items = []
+ point = (0,0)
+ while 1:
+ ok, point = self.list.LGetSelect(1, point)
+ if not ok:
+ break
+ items.append(point[1])
+ point = point[0], point[1]+1
+ values = []
+ for i in items:
+ values.append(self.contents[i])
+ return values
+
+ def do_show(self, *args):
+ selection = self.getselection()
+ for resid in selection:
+ self.parent.showPICT(resid)
+
+ def do_rawupdate(self, window, event):
+ tp, h, rect = self.dlg.GetDialogItem(MAIN_LIST)
+ Qd.SetPort(self.wid)
+ Qd.FrameRect(rect)
+ self.list.LUpdate(self.wid.GetWindowPort().visRgn)
+
+ def do_activate(self, activate, event):
+ self.list.LActivate(activate)
+
+ def do_close(self):
+ self.close()
+
+ def do_itemhit(self, item, event):
+ if item == MAIN_LIST:
+ self.do_listhit(event)
+ if item == MAIN_SHOW:
+ self.do_show()
+
+main()
diff --git a/Mac/Demo/PICTbrowse/oldPICTbrowse.rsrc b/Mac/Demo/PICTbrowse/oldPICTbrowse.rsrc
new file mode 100644
index 0000000000..fb7a192df2
--- /dev/null
+++ b/Mac/Demo/PICTbrowse/oldPICTbrowse.rsrc
Binary files differ
diff --git a/Mac/Demo/applescript.html b/Mac/Demo/applescript.html
new file mode 100644
index 0000000000..5e4fac7e33
--- /dev/null
+++ b/Mac/Demo/applescript.html
@@ -0,0 +1,362 @@
+<!doctype HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html><head><title>Using the Open Scripting Architecture from Python</title></head>
+<body>
+<h1>Using the Open Scripting Architecture from Python</h1>
+<hr>
+
+<p><b>NOTE:</b> this document describes the OSA support that is shipped with
+the core python distribution. Most users are better of with the more
+userfriendly <a href="http://freespace.virgin.net/hamish.sanderson/appscript.html">appscript library</a>.
+
+<p>OSA support in Python is still not 100% complete, but
+there is already enough in place to allow you to do some nifty things
+with other programs from your python program. </p>
+
+
+<p>
+In this example, we will look at a scriptable application, extract its
+&#8220;AppleScript Dictionary,&#8221; generate a Python interface package from
+the dictionary, and use that package to control the application.
+The application we are going to script is Disk Copy, Apple's standard
+utility for making copies of floppies, creating files that are mountable
+as disk images, etc.
+Because we want
+to concentrate on the OSA details, we won&#8217;t bother with a real
+user-interface for our application. </p>
+
+
+<p>
+<em>When we say &#8220;AppleScript&#8221; in this document we actually mean
+&#8220;the Open Scripting Architecture.&#8221; There is nothing
+AppleScript-specific in the Python implementation. Most of this document
+focuses on the classic Mac OS; <a href="#osx">Mac OS X</a> users have some
+additional tools.</em>
+</p>
+
+<h2>Python OSA architecture</h2>
+
+<p>Open Scripting suites and inheritance can be modelled rather nicely
+with Python packages, so we generate
+a package for each application we want to script. Each suite defined in
+the application becomes a module in the
+package, and the package main module imports everything from all the
+submodules and glues together all the classes (in Python terminology&#8212;
+events in OSA terminology or verbs in AppleScript terminology). </p>
+
+<p>
+A suite in an OSA application can extend the functionality of a standard
+suite. This is implemented in Python by importing everything from the
+module that implements the standard suites and overriding anything that has
+been extended. The standard suites live in the StdSuite package. </p>
+
+<p>
+This all sounds complicated, but the good news is that basic
+scripting is actually pretty simple. You can do strange and wondrous things
+with OSA scripting once you fully understand it. </p>
+
+<h2>Creating the Python interface package</h2>
+
+
+<p>There is a tool in the standard distribution that can automatically
+generate the interface packages. This tool is called
+<code>gensuitemodule.py</code>, and lives in <code>Mac:scripts</code>.
+It looks through a file
+for an &#8216;AETE&#8217; or &#8216;AEUT&#8217; resource,
+the internal representation of the
+AppleScript dictionary, and parses the resource to generate the suite
+modules.
+When we start <code>gensuitemodule</code>, it asks us for an input file;
+for our example,
+we point it to the Disk Copy executable. </p>
+
+<p>
+Next, <code>gensuitemodule</code> wants a folder where it will store the
+package it is going to generate.
+Note that this is the package folder, not the parent folder, so we
+navigate to <code>Python:Mac:Demo:applescript</code>, create a folder
+<code>Disk_Copy</code>, and select that. </p>
+
+<p>
+We next specify the folder from which <code>gensuitemodule</code>
+should import the standard suites. Here,
+we always select <code>Python:Mac:Lib:lib-scriptpackages:StdSuites</code>. (There is
+one exception to this rule: when you are generating <code>StdSuites</code> itself
+you select <code>_builtinSuites</code>.)
+</p>
+
+<p>
+It starts parsing the AETE resource, and for
+each AppleEvent suite it finds, <code>gensuitemodule.py</code>
+prompts us for the filename of the
+resulting python module. Remember to change folders for the first
+module&#8212;you don't want to clutter up, say, the
+Disk Copy folder
+with your python
+interfaces. If you want to skip a suite, press <code>cancel</code> and the process
+continues with the next suite. </p>
+
+<h3>Summary</h3>
+
+<ol>
+
+ <li>Run <code>gensuitemodule</code>.</li>
+
+ <li>Select the application (or OSAX) for which you would like a Python interface.</li>
+
+ <li>Select the package folder where the interface modules should be
+ stored.</li>
+
+ <li>Specify the folder <code>Python:Mac:Lib:lib-scriptpackages:StdSuites</code>
+ to import the standard suites (or <code>_builtinSuites</code> if you are
+ generating <code>StdSuites</code> itself). </li>
+
+ <li>Save the generated suites (use <code>cancel</code> to skip a suite).</li>
+
+
+</ol>
+
+
+<h3>Notes</h3>
+
+
+<ul>
+
+ <li>The interface package may occasionally need some editing by hand. For example,
+ <code>gensuitemodule</code> does not handle all Python reserved words, so
+ if
+ one of the AppleScript verbs is a Python reserved word, a <code>SyntaxError</code>
+ may be raised when the package is imported.
+ Simply rename the class into something acceptable, if this happens;
+ take a look at how the
+ <code>print</code> verb is handled (automatically by <code>gensuitemodule</code>)
+ in the standard suites. But: f you need to edit your package this should be considered a
+ bug in gensuitemodule, so please report it so it can be fixed in future releases.
+ </li>
+
+
+ <li>If you want to re-create the StdSuite modules,
+you should look in one of two places. With versions of AppleScript older than 1.4.0
+(which first shipped with OS 9.0), you will find the
+AEUT resources in <code>System Folder:Extensions:Scripting
+Additions:Dialects:English Dialect</code>. For newer versions, you will
+find them in <code>System Folder:Extensions:Applescript</code>.
+</li>
+
+ <li>Since MacPython 2.0, this new structure, with packages
+per application and submodules per suite, is used. Older MacPythons had a
+single level of modules, with uncertain semantics. With the new structure,
+it is possible for programs to override standard suites, as programs often do.
+
+</li>
+
+<li><code>Gensuitemodule.py</code> may ask you questions
+like &#8220;Where is enum 'xyz ' declared?&#8221;.
+This is either due to a misunderstanding on my part or (rather too commonly)
+bugs in the AETE resources. Pressing <code>cancel</code> is usually the
+right choice: it will cause the specific enum not to be treated as an enum
+but as a &#8220;normal&#8221; type. As things like fsspecs and TEXT strings clearly are
+not enumerators, this is correct. If someone understands what is really going on
+here, please let me know.</li>
+
+</ul>
+
+
+
+<h2>The Python interface package contents</h2>
+
+<p>
+Let&#8217;s glance at the
+<a href="applescript/Disk_Copy">Disk_Copy</a> package just created. You
+may want to open Script Editor alongside to see how it
+interprets the dictionary.
+</p>
+
+
+<p>
+The main package module is in <code>__init__.py</code>.
+The only interesting bit is the <code>Disk_Copy</code> class, which
+includes the event handling classes from the individual suites. It also
+inherits <code>aetools.TalkTo</code>, which is a base class that handles all
+details on how to start the program and talk to it, and a class variable
+<code>_signature</code> which is the default application this class will talk
+to (you can override this in various ways when you instantiate your class, see
+<code>aetools.py</code> for details).
+</p>
+
+<p>
+The <a href="applescript/Disk_Copy/Special_Events.py">Special_Events</a>
+module is a nice example of a suite module.
+The <code>Special_Events_Events</code> class is the bulk of the code
+generated. For each verb, it contains a method. Each method knows what
+arguments the verb expects, and it makes use of keyword
+arguments to present a palatable
+interface to the python programmer.
+
+Notice that each method
+calls some routines from <code>aetools</code>, an auxiliary module
+living in <code>Mac:Lib</code>.
+The other thing to notice is that each method calls
+<code>self.send</code>. This comes from the <code>aetools.TalkTo</code>
+baseclass. </p>
+
+
+<p>
+After the big class, there are a number of little class declarations. These
+declarations are for the (AppleEvent) classes and properties in the suite.
+They allow you to create object IDs, which can then be passed to the verbs.
+For instance,
+when scripting the popular email program Eudora,
+you would use <code>mailbox("inbox").message(1).sender</code>
+to get the name of the sender of the first message in mailbox
+inbox. It is
+also possible to specify this as <code>sender(message(1, mailbox("inbox")))</code>,
+which is sometimes needed because these classes don&#8217;t always inherit correctly
+from baseclasses, so you may have to use a class or property from another
+suite. </p>
+
+<p>
+Next we get the enumeration dictionaries, which allow you to pass
+english names as arguments to verbs, so you don't have to bother with the 4-letter
+type code. So, you can say
+<code>
+ diskcopy.create(..., filesystem="Mac OS Standard")
+</code>
+as it is called in Script Editor, instead of the cryptic lowlevel
+<code>
+ diskcopy.create(..., filesystem="Fhfs")
+</code></p>
+
+<p>
+Finally, we get the &#8220;table of contents&#8221; of the module, listing all
+classes and such
+by code, which is used by <code>gensuitemodule</code> itself: if you use this
+suite as a base package in a later run this is how it knows what is defined in this
+suite, and what the Python names are.
+</p>
+
+<h3>Notes</h3>
+
+<ul>
+
+ <li>The <code>aetools</code> module contains some other nifty
+AppleEvent tools as well. Have a look at it sometime, there is (of
+course) no documentation yet.
+</li>
+
+ <li>There are also some older object specifiers for standard objects in aetools.
+You use these in the form <code>aetools.Word(10,
+aetools.Document(1))</code>, where the corresponding AppleScript
+terminology would be <code>word 10 of the first
+document</code>. Examine
+<code>aetools</code> and <code>aetools.TalkTo</code>
+along with
+the comments at the end of your suite module if you need to create
+more than the standard object specifiers.
+</li>
+
+</ul>
+
+
+
+
+<h2>Using a Python suite module</h2>
+
+<p>
+Now that we have created the suite module, we can use it in a Python script.
+In older MacPython distributions this used to be a rather
+complicated affair, but with the package scheme and with the application signature
+known by the package it is very simple: you import the package and instantiate
+the class, e.g.
+<code>
+ talker = Disk_Copy.Disk_Copy(start=1)
+</code>
+You will usually specify the <code>start=1</code>: it will run the application if it is
+not already running.
+You may want to omit it if you want to talk to the application
+only if it is already running, or if the application is something like the Finder.
+Another way to ensure that the application is running is to call <code>talker._start()</code>.
+</p>
+
+<p>
+Looking at the sourcefile <a
+href="applescript/makedisk.py">makedisk.py</a>, we see that it starts
+with some imports. Naturally, one of these is the Python interface to Disk
+Copy.</p>
+
+<p>
+The main program itself is a wonder of simplicity: we create the
+object (<code>talker</code>) that talks to Disk Copy,
+create a disk, and mount it. The bulk of
+the work is done by <code>talker</code> and the Python interface package we
+just created.</p>
+
+<p>
+The exception handling does warrant a few comments, though. Since
+AppleScript is basically a connectionless RPC protocol,
+nothing happens
+when we create the <code>talker</code> object. Hence, if the destination application
+is not running, we will not notice until we send our first
+command (avoid this as described above). There is another thing to note about errors returned by
+AppleScript calls: <code>MacOS.Error</code> is raised for
+all of the errors that are known to be <code>OSErr</code>-type errors,
+while
+server generated errors raise <code>aetools.Error</code>. </p>
+
+<h2>Scripting Additions</h2>
+
+<p>
+If you want to use any of the scripting additions (or OSAXen, in
+everyday speech) from a Python program, you can use the same method
+as for applications, i.e. run <code>gensuitemodule</code> on the
+OSAX (commonly found in <code>System Folder:Scripting Additions</code>
+or something similar). There is one minor gotcha: the application
+signature to use is <code>MACS</code>. You will need to edit the main class
+in the <code>__init__.py</code> file of the created package and change the value
+of <code>_signature</code> to <code>MACS</code>, or use a subclass to the
+same effect.
+</p>
+
+<p>
+There are two minor points to watch out for when using <code>gensuitemodule</code>
+on OSAXen: they appear all to define the class <code>System_Object_Suite</code>,
+and a lot of them have the command set in multiple dialects. You have to
+watch out for name conflicts and make sure you select a reasonable dialect
+(some of the non-English dialects cause <code>gensuitemodule</code> to generate incorrect
+Python code). </p>
+
+Despite these difficulties, OSAXen offer a lot of possibilities. Take a
+look at some of the OSAXen in the Scripting Additions folder, or
+<A HREF="http://www.osaxen.com/index.php">download</A> some from the net.
+
+<h2>Further Reading</h2>
+
+<p>
+If you want to look at more involved examples of applescripting, look at the standard
+modules <code>findertools</code> and <code>nsremote</code>, or (possibly better, as it
+is more involved) <code>fullbuild</code> from the <code>Mac:scripts</code> folder.
+</p>
+
+<h2><a name="alternatives">Alternatives</a></h2>
+
+<h3><a name="osx">Mac OS X</a></h3>
+
+<p>
+Under Mac OS X, the above still works, but with some new difficulties.
+The application package structure can hide the &#8216;AETE&#8217; or
+&#8216;AEUT&#8217; resource from <code>gensuitemodule</code>, so that,
+for example, it cannot generate an OSA interface to iTunes. Script
+Editor gets at the dictionary of such programs using a &#8216;Get
+AETE&#8217; AppleEvent, if someone wants to donate code to use the same
+method for gensuitemodule: by all means!
+</p>
+
+<p>
+One alternative is available through the Unix command line version of python.
+Apple has provided the <code>osacompile</code> and <code>osascript</code> tools,
+which can be used to compile and execute scripts written in OSA languages. See the
+man pages for more details.
+</p>
+
+
+</body>
+</html>
diff --git a/Mac/Demo/applescript/Disk_Copy/Special_Events.py b/Mac/Demo/applescript/Disk_Copy/Special_Events.py
new file mode 100644
index 0000000000..a2b09107dc
--- /dev/null
+++ b/Mac/Demo/applescript/Disk_Copy/Special_Events.py
@@ -0,0 +1,424 @@
+"""Suite Special Events: Commands for mounting Disk Copy images
+Level 1, version 1
+
+Generated from Macintosh HD:Hulpprogramma's:Disk Copy
+AETE/AEUT resource version 1/0, language 0, script 0
+"""
+
+import aetools
+import MacOS
+
+_code = 'ddsk'
+
+class Special_Events_Events:
+
+ _argmap_mount = {
+ 'access_mode' : 'Acss',
+ 'checksum_verification' : 'VChk',
+ 'signature_verification' : 'VSig',
+ 'RAM_caching' : 'Cach',
+ }
+
+ def mount(self, _object, _attributes={}, **_arguments):
+ """mount: Mounts an Disk Copy image as a disk volume
+ Required argument: a reference to the disk image to be mounted
+ Keyword argument access_mode: the access mode for mounted volume (default is "any", i.e. best possible)
+ Keyword argument checksum_verification: Verify the checksum before mounting?
+ Keyword argument signature_verification: Verify the DigiSignŽ signature before mounting?
+ Keyword argument RAM_caching: Cache the disk image in RAM? (if omitted, don't cache)
+ Keyword argument _attributes: AppleEvent attribute dictionary
+ Returns: a reference to mounted disk
+ """
+ _code = 'ddsk'
+ _subcode = 'Moun'
+
+ aetools.keysubst(_arguments, self._argmap_mount)
+ _arguments['----'] = _object
+
+ aetools.enumsubst(_arguments, 'Acss', _Enum_Acss)
+ aetools.enumsubst(_arguments, 'VChk', _Enum_bool)
+ aetools.enumsubst(_arguments, 'VSig', _Enum_bool)
+ aetools.enumsubst(_arguments, 'Cach', _Enum_bool)
+
+ _reply, _arguments, _attributes = self.send(_code, _subcode,
+ _arguments, _attributes)
+ if _arguments.has_key('errn'):
+ raise aetools.Error, aetools.decodeerror(_arguments)
+ # XXXX Optionally decode result
+ if _arguments.has_key('----'):
+ return _arguments['----']
+
+ _argmap_execute_DiskScript = {
+ 'checksum_verification' : 'VChk',
+ 'signature_verification' : 'VSig',
+ }
+
+ def execute_DiskScript(self, _object, _attributes={}, **_arguments):
+ """execute DiskScript: Executes a Disk Copy-specific DiskScript
+ Required argument: a reference to the DiskScript to execute
+ Keyword argument checksum_verification: Should checksums be verified when mounting images referenced in the DiskScript?
+ Keyword argument signature_verification: Should the DigiSignŽ signature of the DiskScript and the images it references be verified?
+ Keyword argument _attributes: AppleEvent attribute dictionary
+ """
+ _code = 'ddsk'
+ _subcode = 'XEQd'
+
+ aetools.keysubst(_arguments, self._argmap_execute_DiskScript)
+ _arguments['----'] = _object
+
+ aetools.enumsubst(_arguments, 'VChk', _Enum_bool)
+ aetools.enumsubst(_arguments, 'VSig', _Enum_bool)
+
+ _reply, _arguments, _attributes = self.send(_code, _subcode,
+ _arguments, _attributes)
+ if _arguments.has_key('errn'):
+ raise aetools.Error, aetools.decodeerror(_arguments)
+ # XXXX Optionally decode result
+ if _arguments.has_key('----'):
+ return _arguments['----']
+
+ def unmount(self, _object, _attributes={}, **_arguments):
+ """unmount: Unmount and eject (if necessary) a volume
+ Required argument: a reference to disk to be unmounted (and ejected)
+ Keyword argument _attributes: AppleEvent attribute dictionary
+ """
+ _code = 'ddsk'
+ _subcode = 'Umnt'
+
+ if _arguments: raise TypeError, 'No optional args expected'
+ _arguments['----'] = _object
+
+
+ _reply, _arguments, _attributes = self.send(_code, _subcode,
+ _arguments, _attributes)
+ if _arguments.has_key('errn'):
+ raise aetools.Error, aetools.decodeerror(_arguments)
+ # XXXX Optionally decode result
+ if _arguments.has_key('----'):
+ return _arguments['----']
+
+ _argmap_create = {
+ 'saving_as' : 'SvAs',
+ 'logical_blocks' : 'Blks',
+ 'zeroing' : 'Zero',
+ 'leave_image_mounted' : 'Moun',
+ 'filesystem' : 'Fsys',
+ }
+
+ def create(self, _object, _attributes={}, **_arguments):
+ """create: Create a new Disk Copy document
+ Required argument: the name of the volume to create
+ Keyword argument saving_as: the disk image to be created
+ Keyword argument logical_blocks: the number of logical blocks
+ Keyword argument zeroing: Should all blocks on the disk be set to zero?
+ Keyword argument leave_image_mounted: Should the image be mounted after it is created?
+ Keyword argument filesystem: file system to use (Mac OS Standard/compatible, Mac OS Enhanced)
+ Keyword argument _attributes: AppleEvent attribute dictionary
+ Returns: a reference to newly created disk image (or newly mounted disk)
+ """
+ _code = 'ddsk'
+ _subcode = 'Crea'
+
+ aetools.keysubst(_arguments, self._argmap_create)
+ _arguments['----'] = _object
+
+ aetools.enumsubst(_arguments, 'SvAs', _Enum_fss_)
+ aetools.enumsubst(_arguments, 'Blks', _Enum_long)
+ aetools.enumsubst(_arguments, 'Zero', _Enum_bool)
+ aetools.enumsubst(_arguments, 'Moun', _Enum_bool)
+ aetools.enumsubst(_arguments, 'Fsys', _Enum_Fsys)
+
+ _reply, _arguments, _attributes = self.send(_code, _subcode,
+ _arguments, _attributes)
+ if _arguments.has_key('errn'):
+ raise aetools.Error, aetools.decodeerror(_arguments)
+ # XXXX Optionally decode result
+ if _arguments.has_key('----'):
+ return _arguments['----']
+
+ def verify_checksum(self, _object, _attributes={}, **_arguments):
+ """verify checksum: Verify the checksum of a Disk Copy 4.2 or a Disk Copy 6.0 read-only document
+ Required argument: the disk image to be verified
+ Keyword argument _attributes: AppleEvent attribute dictionary
+ Returns: the result of the checksum verification
+ """
+ _code = 'ddsk'
+ _subcode = 'Vcrc'
+
+ if _arguments: raise TypeError, 'No optional args expected'
+ _arguments['----'] = _object
+
+
+ _reply, _arguments, _attributes = self.send(_code, _subcode,
+ _arguments, _attributes)
+ if _arguments.has_key('errn'):
+ raise aetools.Error, aetools.decodeerror(_arguments)
+ # XXXX Optionally decode result
+ if _arguments.has_key('----'):
+ return _arguments['----']
+
+ def verify_signature(self, _object, _attributes={}, **_arguments):
+ """verify signature: Verify the DigiSignŽ signature for a Disk Copy document
+ Required argument: the disk image to be verified
+ Keyword argument _attributes: AppleEvent attribute dictionary
+ Returns: Is the DigiSignŽ signature valid?
+ """
+ _code = 'ddsk'
+ _subcode = 'Vsig'
+
+ if _arguments: raise TypeError, 'No optional args expected'
+ _arguments['----'] = _object
+
+
+ _reply, _arguments, _attributes = self.send(_code, _subcode,
+ _arguments, _attributes)
+ if _arguments.has_key('errn'):
+ raise aetools.Error, aetools.decodeerror(_arguments)
+ # XXXX Optionally decode result
+ if _arguments.has_key('----'):
+ return _arguments['----']
+
+ _argmap_sign_image = {
+ 'using_signer' : 'Sinr',
+ }
+
+ def sign_image(self, _object, _attributes={}, **_arguments):
+ """sign image: Add a DigiSignŽ signature to a Disk Copy document
+ Required argument: the disk image to be signed
+ Keyword argument using_signer: a reference to signer file to use
+ Keyword argument _attributes: AppleEvent attribute dictionary
+ """
+ _code = 'ddsk'
+ _subcode = 'Asig'
+
+ aetools.keysubst(_arguments, self._argmap_sign_image)
+ _arguments['----'] = _object
+
+ aetools.enumsubst(_arguments, 'Sinr', _Enum_alis)
+
+ _reply, _arguments, _attributes = self.send(_code, _subcode,
+ _arguments, _attributes)
+ if _arguments.has_key('errn'):
+ raise aetools.Error, aetools.decodeerror(_arguments)
+ # XXXX Optionally decode result
+ if _arguments.has_key('----'):
+ return _arguments['----']
+
+ _argmap_create_a_floppy_from = {
+ 'signature_verification' : 'VSig',
+ 'erase_confirmation' : 'Cfrm',
+ 'make_multiple_floppies' : 'Mult',
+ }
+
+ def create_a_floppy_from(self, _object, _attributes={}, **_arguments):
+ """create a floppy from: create a floppy disk from a Disk Copy document
+ Required argument: the disk image to make a floppy from
+ Keyword argument signature_verification: Should the DigiSignŽ signature be verified before creating a floppy disk?
+ Keyword argument erase_confirmation: Should the user be asked to confirm the erasure of the previous contents of floppy disks?
+ Keyword argument make_multiple_floppies: Should the user be prompted to create multiple floppy disks?
+ Keyword argument _attributes: AppleEvent attribute dictionary
+ """
+ _code = 'ddsk'
+ _subcode = 'Bfpy'
+
+ aetools.keysubst(_arguments, self._argmap_create_a_floppy_from)
+ _arguments['----'] = _object
+
+ aetools.enumsubst(_arguments, 'VSig', _Enum_bool)
+ aetools.enumsubst(_arguments, 'Cfrm', _Enum_bool)
+ aetools.enumsubst(_arguments, 'Mult', _Enum_bool)
+
+ _reply, _arguments, _attributes = self.send(_code, _subcode,
+ _arguments, _attributes)
+ if _arguments.has_key('errn'):
+ raise aetools.Error, aetools.decodeerror(_arguments)
+ # XXXX Optionally decode result
+ if _arguments.has_key('----'):
+ return _arguments['----']
+
+ _argmap_check_image = {
+ 'details' : 'ChDe',
+ }
+
+ def check_image(self, _object, _attributes={}, **_arguments):
+ """check image: Check the disk imageÕs internal data structures for any inconsistencies. Works on NDIF, Disk Copy 4.2, DARTŽ, or DiskSet images.
+ Required argument: the disk image to be verified
+ Keyword argument details: Should the disk image details be displayed?
+ Keyword argument _attributes: AppleEvent attribute dictionary
+ Returns: a record containing a boolean (true/false) value if the image passes consistency tests, and the numbers of warnings and errors
+ """
+ _code = 'ddsk'
+ _subcode = 'Chek'
+
+ aetools.keysubst(_arguments, self._argmap_check_image)
+ _arguments['----'] = _object
+
+ aetools.enumsubst(_arguments, 'ChDe', _Enum_bool)
+
+ _reply, _arguments, _attributes = self.send(_code, _subcode,
+ _arguments, _attributes)
+ if _arguments.has_key('errn'):
+ raise aetools.Error, aetools.decodeerror(_arguments)
+ # XXXX Optionally decode result
+ if _arguments.has_key('----'):
+ return _arguments['----']
+
+ _argmap_segment_image = {
+ 'segment_count' : 'SGCT',
+ 'segment_size' : 'SGSZ',
+ 'segment_name' : 'SGNM',
+ 'image_ID' : 'SGID',
+ }
+
+ def segment_image(self, _object, _attributes={}, **_arguments):
+ """segment image: Segment a NDIF R/W or R/O image into smaller pieces
+ Required argument: the disk image to be segmented
+ Keyword argument segment_count: the number of image segments to create
+ Keyword argument segment_size: the size of image segments (in blocks) to create
+ Keyword argument segment_name: the root name for each image segment file
+ Keyword argument image_ID: string used to generate a unique image ID to group the segments
+ Keyword argument _attributes: AppleEvent attribute dictionary
+ Returns: a list of references to the image segments created
+ """
+ _code = 'ddsk'
+ _subcode = 'SGMT'
+
+ aetools.keysubst(_arguments, self._argmap_segment_image)
+ _arguments['----'] = _object
+
+
+ _reply, _arguments, _attributes = self.send(_code, _subcode,
+ _arguments, _attributes)
+ if _arguments.has_key('errn'):
+ raise aetools.Error, aetools.decodeerror(_arguments)
+ # XXXX Optionally decode result
+ if _arguments.has_key('----'):
+ return _arguments['----']
+
+ _argmap_create_SMI = {
+ 'source_images' : 'SMI1',
+ 'launching_application' : 'SMI2',
+ 'launching_document' : 'SMI3',
+ 'version_string' : 'SMI4',
+ 'checksum_verification' : 'VChk',
+ 'signature_verification' : 'VSig',
+ 'image_signing' : 'SImg',
+ }
+
+ def create_SMI(self, _object, _attributes={}, **_arguments):
+ """create SMI: Creates a self-mounting image (SMI) from a list of NDIF disk images
+ Required argument: the self-mounting image to create
+ Keyword argument source_images: a list of references to sources images
+ Keyword argument launching_application: the path to an application to launch
+ Keyword argument launching_document: the path to a document to open
+ Keyword argument version_string: sets the 'vers' 1 resource of the self-mounting image
+ Keyword argument checksum_verification: Should the checksum of the source images be verified before creating the SMI?
+ Keyword argument signature_verification: Should the DigiSignŽ signature of the source images be verified before creating the SMI?
+ Keyword argument image_signing: Should the SMI be given a digital signature when it is created?
+ Keyword argument _attributes: AppleEvent attribute dictionary
+ Returns: a reference to the self-mounting image created
+ """
+ _code = 'ddsk'
+ _subcode = 'MSMI'
+
+ aetools.keysubst(_arguments, self._argmap_create_SMI)
+ _arguments['----'] = _object
+
+ aetools.enumsubst(_arguments, 'VChk', _Enum_bool)
+ aetools.enumsubst(_arguments, 'VSig', _Enum_bool)
+ aetools.enumsubst(_arguments, 'SImg', _Enum_bool)
+
+ _reply, _arguments, _attributes = self.send(_code, _subcode,
+ _arguments, _attributes)
+ if _arguments.has_key('errn'):
+ raise aetools.Error, aetools.decodeerror(_arguments)
+ # XXXX Optionally decode result
+ if _arguments.has_key('----'):
+ return _arguments['----']
+
+
+class Verify_Checksum_reply_record(aetools.ComponentItem):
+ """Verify Checksum reply record - """
+ want = 'Rcrc'
+class validity(aetools.NProperty):
+ """validity - true if checksum is valid """
+ which = 'Vlid'
+ want = 'bool'
+class expected_checksum(aetools.NProperty):
+ """expected checksum - checksum value stored in the image header (in hexadecimal) """
+ which = 'crcE'
+ want = 'TEXT'
+class calculated_checksum(aetools.NProperty):
+ """calculated checksum - checksum value actually calculated (in hexadecimal) """
+ which = 'crcA'
+ want = 'TEXT'
+
+class Check_Image_reply_record(aetools.ComponentItem):
+ """Check Image reply record - """
+ want = 'Rchk'
+class consistency(aetools.NProperty):
+ """consistency - Does the image pass consistency checks? """
+ which = 'Rch1'
+ want = 'bool'
+class error_count(aetools.NProperty):
+ """error count - the number of errors recorded """
+ which = 'Rch2'
+ want = 'long'
+class warning_count(aetools.NProperty):
+ """warning count - the number of warnings recorded """
+ which = 'Rch3'
+ want = 'long'
+Verify_Checksum_reply_record._propdict = {
+ 'validity' : validity,
+ 'expected_checksum' : expected_checksum,
+ 'calculated_checksum' : calculated_checksum,
+}
+Verify_Checksum_reply_record._elemdict = {
+}
+Check_Image_reply_record._propdict = {
+ 'consistency' : consistency,
+ 'error_count' : error_count,
+ 'warning_count' : warning_count,
+}
+Check_Image_reply_record._elemdict = {
+}
+_Enum_Acss = {
+ 'read_and_write' : 'RdWr', # read/write access
+ 'read_only' : 'Rdxx', # read-only access
+ 'any' : 'Anyx', # best possible access
+}
+
+_Enum_Fsys = {
+ 'Mac_OS_Standard' : 'Fhfs', # classic HFS file system
+ 'compatible_Mac_OS_Extended' : 'Fhf+', # new HFS+ file system
+}
+
+_Enum_alis = None # XXXX enum alis not found!!
+_Enum_fss_ = None # XXXX enum fss not found!!
+_Enum_long = None # XXXX enum long not found!!
+_Enum_bool = None # XXXX enum bool not found!!
+
+#
+# Indices of types declared in this module
+#
+_classdeclarations = {
+ 'Rchk' : Check_Image_reply_record,
+ 'Rcrc' : Verify_Checksum_reply_record,
+}
+
+_propdeclarations = {
+ 'crcE' : expected_checksum,
+ 'Rch2' : error_count,
+ 'crcA' : calculated_checksum,
+ 'Rch3' : warning_count,
+ 'Vlid' : validity,
+ 'Rch1' : consistency,
+}
+
+_compdeclarations = {
+}
+
+_enumdeclarations = {
+ 'Acss' : _Enum_Acss,
+ 'Fsys' : _Enum_Fsys,
+}
diff --git a/Mac/Demo/applescript/Disk_Copy/Standard_Suite.py b/Mac/Demo/applescript/Disk_Copy/Standard_Suite.py
new file mode 100644
index 0000000000..455e78dfa9
--- /dev/null
+++ b/Mac/Demo/applescript/Disk_Copy/Standard_Suite.py
@@ -0,0 +1,477 @@
+"""Suite Standard Suite: Common terms for most applications
+Level 1, version 1
+
+Generated from Macintosh HD:Hulpprogramma's:Disk Copy
+AETE/AEUT resource version 1/0, language 0, script 0
+"""
+
+import aetools
+import MacOS
+
+_code = 'Core'
+
+class Standard_Suite_Events:
+
+ _argmap_save = {
+ '_in' : 'kfil',
+ 'using_format' : 'SvAs',
+ 'checksum_verification' : 'VChk',
+ 'signature_verification' : 'VSig',
+ 'image_signing' : 'SImg',
+ 'leave_image_mounted' : 'Moun',
+ 'percent_free_space' : 'Slop',
+ 'logical_blocks' : 'Blks',
+ 'zeroing' : 'Zero',
+ }
+
+ def save(self, _object, _attributes={}, **_arguments):
+ """save: Save an object
+ Required argument: the source object
+ Keyword argument _in: the target object
+ Keyword argument using_format: the format for the target
+ Keyword argument checksum_verification: Should the checksum be verified before saving?
+ Keyword argument signature_verification: Should the DigiSignŽ signature be verified before saving?
+ Keyword argument image_signing: Should the image be signed?
+ Keyword argument leave_image_mounted: Should the image be mounted after saving?
+ Keyword argument percent_free_space: percent free space to reserve (for image folder operation, 0-255%)
+ Keyword argument logical_blocks: number of logical blocks in the image (for image folder operation)
+ Keyword argument zeroing: Should all the blocks in the image be set to zeros? (for image folder operation)
+ Keyword argument _attributes: AppleEvent attribute dictionary
+ Returns: the result of the save operation
+ """
+ _code = 'core'
+ _subcode = 'save'
+
+ aetools.keysubst(_arguments, self._argmap_save)
+ _arguments['----'] = _object
+
+ aetools.enumsubst(_arguments, 'kfil', _Enum_obj_)
+ aetools.enumsubst(_arguments, 'SvAs', _Enum_SvAs)
+ aetools.enumsubst(_arguments, 'VChk', _Enum_bool)
+ aetools.enumsubst(_arguments, 'VSig', _Enum_bool)
+ aetools.enumsubst(_arguments, 'SImg', _Enum_bool)
+ aetools.enumsubst(_arguments, 'Moun', _Enum_bool)
+ aetools.enumsubst(_arguments, 'Slop', _Enum_long)
+ aetools.enumsubst(_arguments, 'Blks', _Enum_long)
+ aetools.enumsubst(_arguments, 'Zero', _Enum_bool)
+
+ _reply, _arguments, _attributes = self.send(_code, _subcode,
+ _arguments, _attributes)
+ if _arguments.has_key('errn'):
+ raise aetools.Error, aetools.decodeerror(_arguments)
+ # XXXX Optionally decode result
+ if _arguments.has_key('----'):
+ return _arguments['----']
+
+ def do_script(self, _object, _attributes={}, **_arguments):
+ """do script: Execute an attached script located in the folder "Scripts"
+ Required argument: the script to be executed
+ Keyword argument _attributes: AppleEvent attribute dictionary
+ """
+ _code = 'core'
+ _subcode = 'dosc'
+
+ if _arguments: raise TypeError, 'No optional args expected'
+ _arguments['----'] = _object
+
+
+ _reply, _arguments, _attributes = self.send(_code, _subcode,
+ _arguments, _attributes)
+ if _arguments.has_key('errn'):
+ raise aetools.Error, aetools.decodeerror(_arguments)
+ # XXXX Optionally decode result
+ if _arguments.has_key('----'):
+ return _arguments['----']
+
+
+class application(aetools.ComponentItem):
+ """application - The Disk Copy application """
+ want = 'capp'
+class version(aetools.NProperty):
+ """version - the version of this application """
+ which = 'vers'
+ want = 'vers'
+class name(aetools.NProperty):
+ """name - the name of this application """
+ which = 'pnam'
+ want = 'TEXT'
+class comment(aetools.NProperty):
+ """comment - the comment associated with the application """
+ which = 'comt'
+ want = 'TEXT'
+class driver_version(aetools.NProperty):
+ """driver version - the version of the disk image driver """
+ which = 'dVer'
+ want = 'vers'
+class nonejectable_mode(aetools.NProperty):
+ """nonejectable mode - Should mounted images be non-ejectable? """
+ which = 'otto'
+ want = 'bool'
+class save_log_file(aetools.NProperty):
+ """save log file - Should the log file be saved on disk? """
+ which = 'PSaL'
+ want = 'bool'
+class use_speech(aetools.NProperty):
+ """use speech - Should Disk Copy use spoken feedback? """
+ which = 'PTlk'
+ want = 'bool'
+class smart_Save_As(aetools.NProperty):
+ """smart Save As - Should the Save As... dialog box automatically go to the right folder? """
+ which = 'PSSP'
+ want = 'bool'
+class checksum_verification(aetools.NProperty):
+ """checksum verification - Should image checksums be verified? """
+ which = 'PVeC'
+ want = 'bool'
+class signature_verification(aetools.NProperty):
+ """signature verification - Should digital signatures be verified? """
+ which = 'PVeS'
+ want = 'bool'
+class exclude_DiskScripts(aetools.NProperty):
+ """exclude DiskScripts - Should images referenced in DiskScripts/DiskSets be excluded from verification? """
+ which = 'PExD'
+ want = 'bool'
+class exclude_remote_images(aetools.NProperty):
+ """exclude remote images - Should images that are located on network volumes be excluded from verification? """
+ which = 'PExR'
+ want = 'bool'
+class image_signing(aetools.NProperty):
+ """image signing - Should images be signed with a digital signature? """
+ which = 'PSiI'
+ want = 'bool'
+class leave_image_mounted(aetools.NProperty):
+ """leave image mounted - Should images be mounted after they are created? """
+ which = 'PMoA'
+ want = 'bool'
+class erase_confirmation(aetools.NProperty):
+ """erase confirmation - Should the user be required to confirm commands that erase disks? """
+ which = 'PCoE'
+ want = 'bool'
+class zeroing(aetools.NProperty):
+ """zeroing - Should all blocks of a new image be set to zero? """
+ which = 'PZeB'
+ want = 'bool'
+class default_create_size(aetools.NProperty):
+ """default create size - the default size for a new image, in blocks (512 bytes per block) """
+ which = 'PDeS'
+ want = 'long'
+class default_create_name(aetools.NProperty):
+ """default create name - the default volume name for a new image """
+ which = 'PDeN'
+ want = 'TEXT'
+class make_multiple_floppies(aetools.NProperty):
+ """make multiple floppies - Should the user be prompted to make multiple floppy disk images at a time? """
+ which = 'PBuM'
+ want = 'bool'
+class auto_image_upon_insert(aetools.NProperty):
+ """auto image upon insert - Should a newly-inserted disk automatically be processed into an image? """
+ which = 'Paim'
+ want = 'bool'
+class eject_after_auto_image(aetools.NProperty):
+ """eject after auto image - Should auto-imaged disks be ejected afterwards? """
+ which = 'Pejc'
+ want = 'bool'
+class auto_copy_upon_floppy_insert(aetools.NProperty):
+ """auto copy upon floppy insert - Instead of auto-imaging, should newly-inserted floppy disks be copied? """
+ which = 'Pcpf'
+ want = 'bool'
+class volume_suffix(aetools.NProperty):
+ """volume suffix - the default volume name suffix """
+ which = 'PDiE'
+ want = 'TEXT'
+class image_suffix(aetools.NProperty):
+ """image suffix - the default image name suffix """
+ which = 'PImE'
+ want = 'TEXT'
+class default_file_system(aetools.NProperty):
+ """default file system - the default file system type for new blank images """
+ which = 'Pfsy'
+ want = 'Fsys'
+class default_image_format(aetools.NProperty):
+ """default image format - the default image file format """
+ which = 'Pdfm'
+ want = 'SvAs'
+
+class disk(aetools.ComponentItem):
+ """disk - A mounted volume """
+ want = 'Disk'
+
+name = name
+
+comment = comment
+class locked(aetools.NProperty):
+ """locked - Is the disk locked? """
+ which = 'islk'
+ want = 'bool'
+class creation_date(aetools.NProperty):
+ """creation date - the creation date of disk """
+ which = 'ascd'
+ want = 'ldt '
+class modification_date(aetools.NProperty):
+ """modification date - the modification date of disk """
+ which = 'asmo'
+ want = 'ldt '
+class crc32_checksum(aetools.NProperty):
+ """crc32 checksum - the crc-32 checksum of the disk """
+ which = 'Xcrc'
+ want = 'TEXT'
+class disk_copy_4_2e_2_checksum(aetools.NProperty):
+ """disk copy 4.2 checksum - the Disk Copy 4.2 checksum of the disk """
+ which = 'Xc42'
+ want = 'TEXT'
+class block_count(aetools.NProperty):
+ """block count - the number of blocks on disk """
+ which = 'Xblk'
+ want = 'long'
+class file_system(aetools.NProperty):
+ """file system - the file system used on disk """
+ which = 'Xfsi'
+ want = 'TEXT'
+
+class folder(aetools.ComponentItem):
+ """folder - A folder or directory on a disk """
+ want = 'Fold'
+
+name = name
+
+comment = comment
+
+creation_date = creation_date
+
+modification_date = modification_date
+
+class disk_image(aetools.ComponentItem):
+ """disk image - A disk image file """
+ want = 'DImg'
+
+name = name
+
+comment = comment
+
+locked = locked
+
+creation_date = creation_date
+
+modification_date = modification_date
+class file_format(aetools.NProperty):
+ """file format - the format of the disk image file """
+ which = 'Ifmt'
+ want = 'TEXT'
+class signed(aetools.NProperty):
+ """signed - Does the disk image have a DigiSignŽ signature? """
+ which = 'Isin'
+ want = 'bool'
+class compressed(aetools.NProperty):
+ """compressed - Is the disk image compressed? """
+ which = 'Icom'
+ want = 'bool'
+class segmented(aetools.NProperty):
+ """segmented - Is the disk image segmented? """
+ which = 'Iseg'
+ want = 'bool'
+class segments(aetools.NProperty):
+ """segments - a list of references to other segments that make up a complete image """
+ which = 'Isg#'
+ want = 'fss '
+class disk_name(aetools.NProperty):
+ """disk name - the name of the disk this image represents """
+ which = 'Idnm'
+ want = 'TEXT'
+
+crc32_checksum = crc32_checksum
+
+disk_copy_4_2e_2_checksum = disk_copy_4_2e_2_checksum
+
+block_count = block_count
+
+file_system = file_system
+class data_fork_size(aetools.NProperty):
+ """data fork size - the size (in bytes) of the data fork of the disk image """
+ which = 'Idfk'
+ want = 'long'
+class resource_fork_size(aetools.NProperty):
+ """resource fork size - the size (in bytes) of the resource fork of the disk image """
+ which = 'Irfk'
+ want = 'long'
+
+class Save_reply_record(aetools.ComponentItem):
+ """Save reply record - Result from the save operation """
+ want = 'cpyR'
+class resulting_target_object(aetools.NProperty):
+ """resulting target object - a reference to the target object after it has been saved """
+ which = 'rcpO'
+ want = 'obj '
+class copy_type(aetools.NProperty):
+ """copy type - the way in which the target object was saved """
+ which = 'rcpT'
+ want = 'rcpT'
+application._propdict = {
+ 'version' : version,
+ 'name' : name,
+ 'comment' : comment,
+ 'driver_version' : driver_version,
+ 'nonejectable_mode' : nonejectable_mode,
+ 'save_log_file' : save_log_file,
+ 'use_speech' : use_speech,
+ 'smart_Save_As' : smart_Save_As,
+ 'checksum_verification' : checksum_verification,
+ 'signature_verification' : signature_verification,
+ 'exclude_DiskScripts' : exclude_DiskScripts,
+ 'exclude_remote_images' : exclude_remote_images,
+ 'image_signing' : image_signing,
+ 'leave_image_mounted' : leave_image_mounted,
+ 'erase_confirmation' : erase_confirmation,
+ 'zeroing' : zeroing,
+ 'default_create_size' : default_create_size,
+ 'default_create_name' : default_create_name,
+ 'make_multiple_floppies' : make_multiple_floppies,
+ 'auto_image_upon_insert' : auto_image_upon_insert,
+ 'eject_after_auto_image' : eject_after_auto_image,
+ 'auto_copy_upon_floppy_insert' : auto_copy_upon_floppy_insert,
+ 'volume_suffix' : volume_suffix,
+ 'image_suffix' : image_suffix,
+ 'default_file_system' : default_file_system,
+ 'default_image_format' : default_image_format,
+}
+application._elemdict = {
+}
+disk._propdict = {
+ 'name' : name,
+ 'comment' : comment,
+ 'locked' : locked,
+ 'creation_date' : creation_date,
+ 'modification_date' : modification_date,
+ 'crc32_checksum' : crc32_checksum,
+ 'disk_copy_4_2e_2_checksum' : disk_copy_4_2e_2_checksum,
+ 'block_count' : block_count,
+ 'file_system' : file_system,
+}
+disk._elemdict = {
+}
+folder._propdict = {
+ 'name' : name,
+ 'comment' : comment,
+ 'creation_date' : creation_date,
+ 'modification_date' : modification_date,
+}
+folder._elemdict = {
+}
+disk_image._propdict = {
+ 'name' : name,
+ 'comment' : comment,
+ 'locked' : locked,
+ 'creation_date' : creation_date,
+ 'modification_date' : modification_date,
+ 'file_format' : file_format,
+ 'signed' : signed,
+ 'compressed' : compressed,
+ 'segmented' : segmented,
+ 'segments' : segments,
+ 'disk_name' : disk_name,
+ 'crc32_checksum' : crc32_checksum,
+ 'disk_copy_4_2e_2_checksum' : disk_copy_4_2e_2_checksum,
+ 'block_count' : block_count,
+ 'file_system' : file_system,
+ 'data_fork_size' : data_fork_size,
+ 'resource_fork_size' : resource_fork_size,
+}
+disk_image._elemdict = {
+}
+Save_reply_record._propdict = {
+ 'resulting_target_object' : resulting_target_object,
+ 'copy_type' : copy_type,
+}
+Save_reply_record._elemdict = {
+}
+_Enum_UIAc = {
+ 'never_interact' : 'eNvr', # DonÕt allow any interaction at all
+ 'interact_with_self' : 'eInS', # Only allow interaction from internal events
+ 'interact_with_local' : 'eInL', # Allow interaction from any event originating on this machine
+ 'interact_with_all' : 'eInA', # Allow interaction from network events
+}
+
+_Enum_SvAs = {
+ 'NDIF_RW' : 'RdWr', # read/write NDIF disk image
+ 'NDIF_RO' : 'Rdxx', # read-only NDIF disk image
+ 'NDIF_Compressed' : 'ROCo', # compressed NDIF disk image
+ 'Disk_Copy_4_2e_2' : 'DC42', # Disk Copy 4.2 disk image
+}
+
+_Enum_rcpT = {
+ 'block_disk_copy' : 'cpBl', # block-by-block disk-level copy
+ 'files_and_file_ID_copy' : 'cpID', # all files including desktop databases and file IDÕs
+ 'files_and_desktop_info' : 'cpDT', # all files and most desktop information
+ 'files_only' : 'cpFI', # all files but no desktop information
+ 'disk_image_conversion' : 'cpCV', # disk image format conversion
+ 'disk_image_creation' : 'cpCR', # disk image creation
+}
+
+_Enum_long = None # XXXX enum long not found!!
+_Enum_bool = None # XXXX enum bool not found!!
+_Enum_obj_ = None # XXXX enum obj not found!!
+
+#
+# Indices of types declared in this module
+#
+_classdeclarations = {
+ 'DImg' : disk_image,
+ 'capp' : application,
+ 'Disk' : disk,
+ 'Fold' : folder,
+ 'cpyR' : Save_reply_record,
+}
+
+_propdeclarations = {
+ 'Xcrc' : crc32_checksum,
+ 'PDeS' : default_create_size,
+ 'Idnm' : disk_name,
+ 'PSSP' : smart_Save_As,
+ 'Pcpf' : auto_copy_upon_floppy_insert,
+ 'pnam' : name,
+ 'Isin' : signed,
+ 'otto' : nonejectable_mode,
+ 'PExD' : exclude_DiskScripts,
+ 'Iseg' : segmented,
+ 'islk' : locked,
+ 'asmo' : modification_date,
+ 'PTlk' : use_speech,
+ 'Pfsy' : default_file_system,
+ 'PVeC' : checksum_verification,
+ 'Xc42' : disk_copy_4_2e_2_checksum,
+ 'rcpO' : resulting_target_object,
+ 'Paim' : auto_image_upon_insert,
+ 'comt' : comment,
+ 'PCoE' : erase_confirmation,
+ 'dVer' : driver_version,
+ 'PDeN' : default_create_name,
+ 'PBuM' : make_multiple_floppies,
+ 'rcpT' : copy_type,
+ 'PDiE' : volume_suffix,
+ 'Ifmt' : file_format,
+ 'Pdfm' : default_image_format,
+ 'ascd' : creation_date,
+ 'Pejc' : eject_after_auto_image,
+ 'PZeB' : zeroing,
+ 'PExR' : exclude_remote_images,
+ 'PImE' : image_suffix,
+ 'PVeS' : signature_verification,
+ 'PSaL' : save_log_file,
+ 'Xblk' : block_count,
+ 'PMoA' : leave_image_mounted,
+ 'Isg#' : segments,
+ 'Irfk' : resource_fork_size,
+ 'Icom' : compressed,
+ 'Xfsi' : file_system,
+ 'Idfk' : data_fork_size,
+ 'vers' : version,
+ 'PSiI' : image_signing,
+}
+
+_compdeclarations = {
+}
+
+_enumdeclarations = {
+ 'SvAs' : _Enum_SvAs,
+ 'UIAc' : _Enum_UIAc,
+ 'rcpT' : _Enum_rcpT,
+}
diff --git a/Mac/Demo/applescript/Disk_Copy/Utility_Events.py b/Mac/Demo/applescript/Disk_Copy/Utility_Events.py
new file mode 100644
index 0000000000..383075337c
--- /dev/null
+++ b/Mac/Demo/applescript/Disk_Copy/Utility_Events.py
@@ -0,0 +1,213 @@
+"""Suite Utility Events: Commands that allow the user to select Disk Copy files
+Level 1, version 1
+
+Generated from Macintosh HD:Hulpprogramma's:Disk Copy
+AETE/AEUT resource version 1/0, language 0, script 0
+"""
+
+import aetools
+import MacOS
+
+_code = 'ddsk'
+
+class Utility_Events_Events:
+
+ _argmap_select_disk_image = {
+ 'with_prompt' : 'SELp',
+ }
+
+ def select_disk_image(self, _no_object=None, _attributes={}, **_arguments):
+ """select disk image: Prompt the user to select a disk image
+ Keyword argument with_prompt: the prompt string to be displayed
+ Keyword argument _attributes: AppleEvent attribute dictionary
+ Returns: a reference to a disk image
+ """
+ _code = 'UTIL'
+ _subcode = 'SEL1'
+
+ aetools.keysubst(_arguments, self._argmap_select_disk_image)
+ if _no_object is not None: raise TypeError, 'No direct arg expected'
+
+ aetools.enumsubst(_arguments, 'SELp', _Enum_TEXT)
+
+ _reply, _arguments, _attributes = self.send(_code, _subcode,
+ _arguments, _attributes)
+ if _arguments.has_key('errn'):
+ raise aetools.Error, aetools.decodeerror(_arguments)
+ # XXXX Optionally decode result
+ if _arguments.has_key('----'):
+ return _arguments['----']
+
+ _argmap_select_DiskScript = {
+ 'with_prompt' : 'SELp',
+ }
+
+ def select_DiskScript(self, _no_object=None, _attributes={}, **_arguments):
+ """select DiskScript: Prompt the user to select a DiskScript
+ Keyword argument with_prompt: the prompt string to be displayed
+ Keyword argument _attributes: AppleEvent attribute dictionary
+ Returns: a reference to a DiskScript
+ """
+ _code = 'UTIL'
+ _subcode = 'SEL2'
+
+ aetools.keysubst(_arguments, self._argmap_select_DiskScript)
+ if _no_object is not None: raise TypeError, 'No direct arg expected'
+
+ aetools.enumsubst(_arguments, 'SELp', _Enum_TEXT)
+
+ _reply, _arguments, _attributes = self.send(_code, _subcode,
+ _arguments, _attributes)
+ if _arguments.has_key('errn'):
+ raise aetools.Error, aetools.decodeerror(_arguments)
+ # XXXX Optionally decode result
+ if _arguments.has_key('----'):
+ return _arguments['----']
+
+ _argmap_select_disk_image_or_DiskScript = {
+ 'with_prompt' : 'SELp',
+ }
+
+ def select_disk_image_or_DiskScript(self, _no_object=None, _attributes={}, **_arguments):
+ """select disk image or DiskScript: Prompt the user to select a disk image or DiskScript
+ Keyword argument with_prompt: the prompt string to be displayed
+ Keyword argument _attributes: AppleEvent attribute dictionary
+ Returns: a reference to disk image or a DiskScript
+ """
+ _code = 'UTIL'
+ _subcode = 'SEL3'
+
+ aetools.keysubst(_arguments, self._argmap_select_disk_image_or_DiskScript)
+ if _no_object is not None: raise TypeError, 'No direct arg expected'
+
+ aetools.enumsubst(_arguments, 'SELp', _Enum_TEXT)
+
+ _reply, _arguments, _attributes = self.send(_code, _subcode,
+ _arguments, _attributes)
+ if _arguments.has_key('errn'):
+ raise aetools.Error, aetools.decodeerror(_arguments)
+ # XXXX Optionally decode result
+ if _arguments.has_key('----'):
+ return _arguments['----']
+
+ _argmap_select_floppy_disk_image = {
+ 'with_prompt' : 'SELp',
+ }
+
+ def select_floppy_disk_image(self, _no_object=None, _attributes={}, **_arguments):
+ """select floppy disk image: Prompt the user to select a floppy disk image
+ Keyword argument with_prompt: the prompt string to be displayed
+ Keyword argument _attributes: AppleEvent attribute dictionary
+ Returns: a reference to a floppy disk image
+ """
+ _code = 'UTIL'
+ _subcode = 'SEL4'
+
+ aetools.keysubst(_arguments, self._argmap_select_floppy_disk_image)
+ if _no_object is not None: raise TypeError, 'No direct arg expected'
+
+ aetools.enumsubst(_arguments, 'SELp', _Enum_TEXT)
+
+ _reply, _arguments, _attributes = self.send(_code, _subcode,
+ _arguments, _attributes)
+ if _arguments.has_key('errn'):
+ raise aetools.Error, aetools.decodeerror(_arguments)
+ # XXXX Optionally decode result
+ if _arguments.has_key('----'):
+ return _arguments['----']
+
+ _argmap_select_disk = {
+ 'with_prompt' : 'SELp',
+ }
+
+ def select_disk(self, _no_object=None, _attributes={}, **_arguments):
+ """select disk: Prompt the user to select a disk volume
+ Keyword argument with_prompt: the prompt string to be displayed
+ Keyword argument _attributes: AppleEvent attribute dictionary
+ Returns: a reference to the disk
+ """
+ _code = 'UTIL'
+ _subcode = 'SEL5'
+
+ aetools.keysubst(_arguments, self._argmap_select_disk)
+ if _no_object is not None: raise TypeError, 'No direct arg expected'
+
+ aetools.enumsubst(_arguments, 'SELp', _Enum_TEXT)
+
+ _reply, _arguments, _attributes = self.send(_code, _subcode,
+ _arguments, _attributes)
+ if _arguments.has_key('errn'):
+ raise aetools.Error, aetools.decodeerror(_arguments)
+ # XXXX Optionally decode result
+ if _arguments.has_key('----'):
+ return _arguments['----']
+
+ _argmap_select_folder = {
+ 'with_prompt' : 'SELp',
+ }
+
+ def select_folder(self, _no_object=None, _attributes={}, **_arguments):
+ """select folder: Prompt the user to select a folder
+ Keyword argument with_prompt: the prompt string to be displayed
+ Keyword argument _attributes: AppleEvent attribute dictionary
+ Returns: a reference to the folder
+ """
+ _code = 'UTIL'
+ _subcode = 'SEL6'
+
+ aetools.keysubst(_arguments, self._argmap_select_folder)
+ if _no_object is not None: raise TypeError, 'No direct arg expected'
+
+ aetools.enumsubst(_arguments, 'SELp', _Enum_TEXT)
+
+ _reply, _arguments, _attributes = self.send(_code, _subcode,
+ _arguments, _attributes)
+ if _arguments.has_key('errn'):
+ raise aetools.Error, aetools.decodeerror(_arguments)
+ # XXXX Optionally decode result
+ if _arguments.has_key('----'):
+ return _arguments['----']
+
+ _argmap_log = {
+ 'time_stamp' : 'TSMP',
+ }
+
+ def log(self, _object, _attributes={}, **_arguments):
+ """log: Add a string to the log window
+ Required argument: the string to add to the log window
+ Keyword argument time_stamp: Should the log entry be time-stamped? (false if not supplied)
+ Keyword argument _attributes: AppleEvent attribute dictionary
+ """
+ _code = 'UTIL'
+ _subcode = 'LOG '
+
+ aetools.keysubst(_arguments, self._argmap_log)
+ _arguments['----'] = _object
+
+ aetools.enumsubst(_arguments, 'TSMP', _Enum_bool)
+
+ _reply, _arguments, _attributes = self.send(_code, _subcode,
+ _arguments, _attributes)
+ if _arguments.has_key('errn'):
+ raise aetools.Error, aetools.decodeerror(_arguments)
+ # XXXX Optionally decode result
+ if _arguments.has_key('----'):
+ return _arguments['----']
+
+_Enum_TEXT = None # XXXX enum TEXT not found!!
+_Enum_bool = None # XXXX enum bool not found!!
+
+#
+# Indices of types declared in this module
+#
+_classdeclarations = {
+}
+
+_propdeclarations = {
+}
+
+_compdeclarations = {
+}
+
+_enumdeclarations = {
+}
diff --git a/Mac/Demo/applescript/Disk_Copy/__init__.py b/Mac/Demo/applescript/Disk_Copy/__init__.py
new file mode 100644
index 0000000000..ac5056161f
--- /dev/null
+++ b/Mac/Demo/applescript/Disk_Copy/__init__.py
@@ -0,0 +1,35 @@
+"""
+Package generated from Macintosh HD:Hulpprogramma's:Disk Copy
+Resource aete resid 0
+"""
+import aetools
+Error = aetools.Error
+import Standard_Suite
+import Special_Events
+import Utility_Events
+
+
+_code_to_module = {
+ 'Core' : Standard_Suite,
+ 'ddsk' : Special_Events,
+ 'ddsk' : Utility_Events,
+}
+
+
+
+_code_to_fullname = {
+ 'Core' : ('Disk_Copy.Standard_Suite', 'Standard_Suite'),
+ 'ddsk' : ('Disk_Copy.Special_Events', 'Special_Events'),
+ 'ddsk' : ('Disk_Copy.Utility_Events', 'Utility_Events'),
+}
+
+from Standard_Suite import *
+from Special_Events import *
+from Utility_Events import *
+
+
+class Disk_Copy(Standard_Suite_Events,
+ Special_Events_Events,
+ Utility_Events_Events,
+ aetools.TalkTo):
+ _signature = 'ddsk'
diff --git a/Mac/Demo/applescript/makedisk.py b/Mac/Demo/applescript/makedisk.py
new file mode 100644
index 0000000000..91210ee351
--- /dev/null
+++ b/Mac/Demo/applescript/makedisk.py
@@ -0,0 +1,15 @@
+import Disk_Copy
+import macfs
+import sys
+
+talker = Disk_Copy.Disk_Copy(start=1)
+talker.activate()
+filespec = macfs.FSSpec('my disk image.img')
+try:
+ objref = talker.create('my disk image', saving_as=filespec, leave_image_mounted=1)
+except Disk_Copy.Error, arg:
+ print "ERROR: my disk image:", arg
+else:
+ print 'objref=', objref
+print 'Type return to exit-'
+sys.stdin.readline()
diff --git a/Mac/Demo/example0.html b/Mac/Demo/example0.html
new file mode 100644
index 0000000000..4d78540406
--- /dev/null
+++ b/Mac/Demo/example0.html
@@ -0,0 +1,75 @@
+<HTML><HEAD><TITLE>Using python to create Macintosh applications, part zero</TITLE></HEAD>
+<BODY>
+<H1>Using python to create Macintosh applications, part zero</H1>
+<HR>
+
+This document will show you how to create a simple mac-style
+application using Python. We will glance at how to use file dialogs and
+messages. <p>
+
+Our example program <a href="example0/checktext.py">checktext.py</a> asks
+the user for a text file and checks what style end-of-lines the file has.
+This may need a little explanation: ASCII text files are almost identical
+on different machines, with one exception:
+<ul>
+<li> Unix systems terminate lines with the "linefeed" character, <code>0x0a</code>,
+<li> Macintoshes terminate lines with the "carriage return" character,
+<code>0x0d</code> and
+<li> MSDOS and Windows terminate lines with first a carriage return and then a linefeed.
+</ul>
+
+Let us have a look at the program. The first interesting statement in the main
+program is the call to <code>macfs.PromptGetFile</code>. This is one of the routines
+that allow you to ask the user to specify a file. You pass it one required
+argument, the prompt string. There are up to four optional MacOS <em>file type</em> arguments
+you can pass, as 4-byte strings. Specifying no file
+type will allow the user to select any file, specifying one or more types restricts
+the user to files of this type. File types are explained in most books on the Mac. <p>
+
+<code>PromptGetFile</code> returns two values: an <em>FSSpec</em> object and a
+success indicator. The FSSpec object is the "official" MacOS way of specifying a
+file, more on it later. The success indicator tells you whether the user clicked OK
+or Cancel. In the event of Cancel we simply exit back to the finder. <p>
+
+<code>PromptGetFile</code> has a number of friends that do similar things:
+<ul>
+<li> <code>StandardGetFile</code> is identical to <code>PromptGetFile</code> but
+without the prompt. It has up to four optional filetype arguments.
+<li> <code>StandardPutFile</code> asks the user for an output file. It will
+warn the user when she tries to overwrite an existing file. The routine has one
+mandatory argument: a prompt string. Pass the empty string if you do not want a prompt.
+<li> <code>GetDirectory</code> asks the user for a folder (or directory, in unix terms).
+It has one optional argument: a prompt string.
+</ul>
+All routines return an FSSpec and a success indicator. <p>
+
+There are many things you can do with FSSpec objects (see the
+<a href="http://www.python.org/doc/lib/macfs.html">macfs</a> section in the
+<a href="http://www.python.org/doc/lib/Top.html">Python Library Reference</a>
+for details), but passing them to <code>open</code> is not
+one of them. For this, we first have to convert the FSSpec object to a pathname, with
+the <code>as_pathname</code> method. This returns a standard MacOS-style pathname with
+colon-separated components. This can then be passed to <code>open</code>. Note that
+we call open with mode parameter <code>'rb'</code>: we want to read the file in binary
+mode. Python, like C and C++, uses unix-style line endings internally and opening a
+file in text mode (<code>'r'</code>) would result in conversion of carriage-returns to
+linefeeds upon reading. This is something that Mac and DOS programmers are usually aware
+of but that never ceases to amaze unix buffs. <p>
+
+After we open the file we attempt to read all data into memory. If this fails we use
+<code>EasyDialogs.Message</code> to display a message in a standard dialog box and exit.
+The EasyDialogs module has a few more useful simple dialog routines, more on that in
+<a href="example1.html">example 1</a>. <p>
+
+The rest of the code is pretty straightforward: we check that the file actually contains
+data, count the number of linefeeds and returns and display a message with our guess of the
+end-of-line convention used in the file. <p>
+
+The <a href="example0">example0</a> folder has three text files in Mac, Unix and DOS style
+for you to try the program on. After that, you can continue with <a href="example1.html">example 1</a>
+or go back to the <a href="index.html">index</a> to find another interesting topic. <p>
+
+<HR>
+<A HREF="http://www.cwi.nl/~jack">Jack Jansen</A>,
+<A HREF="mailto:jack@cwi.nl">jack@cwi.nl</A>, 18-July-1996.
+</BODY></HTML>
diff --git a/Mac/Demo/example0/checktext.py b/Mac/Demo/example0/checktext.py
new file mode 100644
index 0000000000..25f71e47cf
--- /dev/null
+++ b/Mac/Demo/example0/checktext.py
@@ -0,0 +1,35 @@
+"""checktext - Check that a text file has macintosh-style newlines"""
+
+import sys
+import EasyDialogs
+import string
+
+def main():
+ pathname = EasyDialogs.AskFileForOpen(message='File to check end-of-lines in:')
+ if not pathname:
+ sys.exit(0)
+ fp = open(pathname, 'rb')
+ try:
+ data = fp.read()
+ except MemoryError:
+ EasyDialogs.Message('Sorry, file is too big.')
+ sys.exit(0)
+ if len(data) == 0:
+ EasyDialogs.Message('File is empty.')
+ sys.exit(0)
+ number_cr = string.count(data, '\r')
+ number_lf = string.count(data, '\n')
+ if number_cr == number_lf == 0:
+ EasyDialogs.Message('File contains no lines.')
+ if number_cr == 0:
+ EasyDialogs.Message('File has unix-style line endings')
+ elif number_lf == 0:
+ EasyDialogs.Message('File has mac-style line endings')
+ elif number_cr == number_lf:
+ EasyDialogs.Message('File probably has MSDOS-style line endings')
+ else:
+ EasyDialogs.Message('File has no recognizable line endings (binary file?)')
+ sys.exit(0)
+
+if __name__ == '__main__':
+ main()
diff --git a/Mac/Demo/example1.html b/Mac/Demo/example1.html
new file mode 100644
index 0000000000..03c99789b8
--- /dev/null
+++ b/Mac/Demo/example1.html
@@ -0,0 +1,193 @@
+<HTML><HEAD><TITLE>Using python to create Macintosh applications, part one</TITLE></HEAD>
+<BODY>
+
+<H1>Using python to create Macintosh applications, part one</H1>
+<HR>
+
+This document will show you how to create a simple mac-style
+application using Python. We will glance at how to use dialogs and
+resources. <p>
+
+The example application we look at will be a simple program with a
+dialog that allows you to perform domain name lookups on IP addresses
+and hostnames.
+The <A HREF="example1/dnslookup-1.py">source code</A> and
+<A HREF="example1/dnslookup-1.rsrc">resource file</A>
+for this application are available in the <A
+HREF="example1">example1</A> folder (which you will have to download
+if you are reading this document over the net and if you want to look
+at the resources). <p>
+
+We will use the builtin module "socket" that allows a
+Python program to perform all sorts of networking functions, and we
+will create the user interface around that. You should be able to run
+the sample code with the standard Python distribution.<p>
+
+<CITE>
+If you are interested in building your own extensions to python you
+should check out the companion document <A
+HREF="plugins.html">Creating Macintosh Python C extensions</A>,
+which tells you how to build your own C extension.
+<p>
+</CITE>
+
+<H2><A NAME="dialog-resources">Creating dialog resources</A></H2>
+
+Let us start with the creative bit: building the dialogs and creating
+an icon for our program. For this you need ResEdit, and a reasonable
+working knowledge of how to use it. "Inside Mac" or various books on
+macintosh programming will help here. <p>
+
+There is one fine point that deserves to be mentioned here: <A
+NAME="resource-numbering">resource numbering</A>. Because often your
+resources will be combined with those that the Python interpreter and
+various standard modules need you should give your DLOG and DITL
+resources numbers above 512. 128 and below are reserved for Apple,
+128-228 are for extensions like Tk,
+228-255 for the Python interpreter and 256-511 for standard
+modules. If you are writing a module that you will be distributing for
+inclusion in other people's programs you may want to register a number
+in the 256-511 range, contact Guido or myself or whoever you think is
+"in charge" of Python for the Macintosh at the moment. Even though the
+application we are writing at the moment will keep its resources in a
+separate resource file it is still a good idea to make sure that no
+conflicts arise: once you have opened your resource file any attempt
+by the interpreter to open a dialog will also search your resource
+file. <p>
+
+Okay, let's have a look at dnslookup-1.rsrc, our resource file.
+The DLOG and accompanying DITL resource both have number 512. Since
+ResEdit creates both with default ID=128 you should take care to
+change the number on both. The dialog itself is pretty basic: two
+buttons (Lookup and Quit), two labels and
+two text entry areas, one of which is used for output only. Here's what
+the dialog will look like at run time<p>
+<div align=center>
+<img width=324 height=189 src="example1/dnslookup-1.gif" alt="dialog image">
+</div>
+<p>
+
+<H2><A NAME="modal-dialog">An application with a modal dialog</A></H2>
+
+Next, we will have to write the actual application. For this example,
+we will use a modal dialog. This means that we will put up the dialog
+and go into a loop asking the dialog manager for events (buttons
+pushed). We handle the actions requested by the user until the Quit
+button is pressed, upon which we exit our loop (and the program). This
+way of structuring your program is actually rather antisocial, since
+you force the user to do whatever you, the application writer, happen
+to want. A modal dialog leaves no way of escape whatsoever (except
+command-option-escape), and is usually not a good way to structure
+anything but the most simple questions. Even then: how often have you
+been confronted with a dialog asking a question that you could not
+answer because the data you needed was obscured by the dialog itself?
+In the next example we will look at an application that does pretty
+much the same as this one but in a more user-friendly way. <p>
+
+The code itself is contained in the file <A
+HREF="example1/dnslookup-1.py"> dnslookup-1.py</A>. Have
+a copy handy before you read on. The file starts off with a
+textstring giving a short description. Not many tools do anything with
+this as yet, but at some point in the future we <EM>will</EM> have all
+sorts of nifty class browser that will display this string, so just
+include it. Just put a short description at the start of each module,
+class, method and function. After the initial description and some
+comments, we import the modules we need. <p>
+
+<A NAME="easydialogs"><CODE>EasyDialogs</CODE></A> is a handy standard
+module that provides you with routines that put up common text-only
+modal dialogs:
+<UL>
+<LI> <CODE>Message(str)</CODE>
+displays the message "str" and an OK button,
+<LI> <CODE>AskString(prompt, default)</CODE>
+asks for a string, displays OK and Cancel buttons,
+<LI> <CODE>AskYesNoCancel(question, default)</CODE>
+displays a question and Yes, No and Cancel buttons.
+</UL>
+
+<A NAME="res"><CODE>Res</CODE></A> is a pretty complete interface to
+the MacOS Resource Manager, described fully in Inside Mac. There is
+currently no documentation of it, but the Apple documentation (or
+Think Ref) will help you on your way if you remember two points:
+<UL>
+<LI> Resources are implemented as Python objects, and each routine
+with a resource first argument is implemented as a python method.
+<LI> When in doubt about the arguments examine the routines docstring,
+as in <CODE>print Res.OpenResFile.__doc__</CODE>
+</UL>
+
+Similarly, <A NAME="dlg"><CODE>Dlg</CODE></A> is an interface to the
+Dialog manager (with Dialogs being implemented as python objects and
+routines with Dialog arguments being methods). The sys module you
+know, I hope. The string module is an often used module that enables
+you to perform many string related operations. In this case however, we
+are only using the "digits" constant from the string module. We could
+have simply defined "digits" as "0123456789". The socket module enables
+us to perform the domain name lookups. We
+use two calls from it:
+<UL>
+<LI> <CODE>gethostbyaddr()</CODE>
+returns the hostname associated with an IP address
+<LI> <CODE>gethostbyname()</CODE>
+returns the IP address associated with a hostname
+</UL>
+
+Next in the source file we get definitions for our dialog resource
+number and for the item numbers in our dialog. These should match the
+situation in our resource file dnslookup-1.rsrc,
+obviously.<p>
+
+On to the main program. We start off with opening our resource file,
+which should live in the same folder as the python source. If we
+cannot open it we use <CODE>EasyDialogs</CODE> to print a message and
+exit. You can try it: just move the resource file somewhere else for a
+moment. Then we call do_dialog() to do the real work. <p>
+
+<CODE>Do_dialog()</CODE> uses <CODE>Dlg.GetNewDialog()</CODE> to open
+a dialog window initialized from 'DLOG' resource ID_MAIN and putting
+it on screen in the frontmost position. Next, we go into a loop,
+calling <CODE>Dlg.ModalDialog()</CODE> to wait for the next user
+action. <CODE>ModalDialog()</CODE> will return us the item number that
+the user has clicked on (or otherwise activated). It will handle a few
+slightly more complicated things also, like the user typing into
+simple textfields, but it will <EM>not</EM> do things like updating
+the physical appearance of radio buttons, etc. See Inside Mac or
+another programming guide for how to handle this
+yourself. Fortunately, our simple application doesn't have to bother with this,
+since buttons and textfields are the only active elements we have. So, we do a
+simple switch on item number and call the appropriate routine to implement the
+action requested. Upon the user pressing "Quit" we simply leave the loop and,
+hence, <CODE>do_dialog()</CODE>. This will cause the python dialog object
+<CODE>my_dlg</CODE> to be deleted and the on-screen dialog to disappear. <p>
+
+<A NAME="dialog-warning">Time for a warning</A>: be very careful what
+you do as long as a dialog is on-screen. Printing something, for
+instance, may suddenly cause the standard output window to appear over
+the dialog, and since we took no measures to redraw the dialog it will
+become very difficult to get out of the dialog. Also, command-period
+may or may not work in this situation. I have also seen crashes in
+such a situation, probably due to the multiple event loops involved or
+some oversight in the interpreter. You have been warned. <p>
+
+The implementation of the "Lookup" command can use a bit more
+explaining: we get the necessary information with <CODE>dnslookup()</CODE>
+but now we have to update the on-screen dialog to present this
+information to the user. The <CODE>GetDialogItem()</CODE> method of
+the dialog returns three bits of information about the given item: its
+type, its data handle and its rect (the on-screen <CODE>x,y,w,h</CODE>
+coordinates). We are only interested in the data handle here, on which
+we call <CODE>SetDialogItemText()</CODE> to set our new text. Note
+here that python programmers need not bother with the C-string versus
+pascal-string controversy: the python glue module knows what is needed
+and converts the python string to the correct type. <p>
+
+And that concludes our first example of the use of resources and
+dialogs. Next, you could have a look at the source of EasyDialogs for
+some examples of using input fields and filterprocs. Or, go on with
+reading the <A HREF="example2.html">second part</A> of this document
+to see how to implement a better version of this application.<p>
+
+</BODY>
+</HTML>
+
diff --git a/Mac/Demo/example1/dnslookup-1.gif b/Mac/Demo/example1/dnslookup-1.gif
new file mode 100644
index 0000000000..3cd70b2a1d
--- /dev/null
+++ b/Mac/Demo/example1/dnslookup-1.gif
Binary files differ
diff --git a/Mac/Demo/example1/dnslookup-1.py b/Mac/Demo/example1/dnslookup-1.py
new file mode 100644
index 0000000000..6eb2c73f73
--- /dev/null
+++ b/Mac/Demo/example1/dnslookup-1.py
@@ -0,0 +1,55 @@
+"""Sample program performing domain name lookups and showing off EasyDialogs,
+Res and Dlg in the process"""
+
+import EasyDialogs
+from Carbon import Res
+from Carbon import Dlg
+import socket
+import string
+import macresource
+#
+# Definitions for our resources
+ID_MAIN=512
+
+ITEM_LOOKUP_ENTRY=1
+ITEM_RESULT=2
+ITEM_LOOKUP_BUTTON=3
+ITEM_QUIT_BUTTON=4
+
+def main():
+ """Main routine: open resource file, call dialog handler"""
+ macresource.need("DLOG", ID_MAIN, "dnslookup-1.rsrc")
+ do_dialog()
+
+def do_dialog():
+ """Post dialog and handle user interaction until quit"""
+ my_dlg = Dlg.GetNewDialog(ID_MAIN, -1)
+ while 1:
+ n = Dlg.ModalDialog(None)
+ if n == ITEM_LOOKUP_BUTTON:
+ tp, h, rect = my_dlg.GetDialogItem(ITEM_LOOKUP_ENTRY)
+ txt = Dlg.GetDialogItemText(h)
+
+ tp, h, rect = my_dlg.GetDialogItem(ITEM_RESULT)
+ Dlg.SetDialogItemText(h, dnslookup(txt))
+ elif n == ITEM_QUIT_BUTTON:
+ break
+
+def dnslookup(str):
+ """ Perform DNS lookup on str. If first character of digit is numeric,
+ assume that str contains an IP address. Otherwise, assume that str
+ contains a hostname."""
+ if str == '': str = ' '
+ if str[0] in string.digits:
+ try:
+ value = socket.gethostbyaddr(str)[0]
+ except:
+ value = 'Lookup failed'
+ else:
+ try:
+ value = socket.gethostbyname(str)
+ except:
+ value = 'Lookup failed'
+ return value
+
+main()
diff --git a/Mac/Demo/example1/dnslookup-1.rsrc b/Mac/Demo/example1/dnslookup-1.rsrc
new file mode 100644
index 0000000000..6cf9fe9888
--- /dev/null
+++ b/Mac/Demo/example1/dnslookup-1.rsrc
Binary files differ
diff --git a/Mac/Demo/example2.html b/Mac/Demo/example2.html
new file mode 100644
index 0000000000..2c3cd2272f
--- /dev/null
+++ b/Mac/Demo/example2.html
@@ -0,0 +1,162 @@
+<HTML><HEAD><TITLE>Using python to create Macintosh applications, part two</TITLE></HEAD>
+<BODY>
+<H1>Using python to create Macintosh applications, part two</H1>
+<HR>
+
+In this document we rewrite the application of the <A
+HREF="example1.html">previous example</A> to use modeless dialogs. We
+will use an application framework, and we will have a look at creating
+applets, standalone applications written in Python. The <A
+HREF="example2/dnslookup-2.py">source code</A> and
+<A HREF="example2/dnslookup-2.rsrc">resource file</A> are available in the folder
+<A HREF="example2">example2</A>. <p>
+
+Again, we start with ResEdit to create our dialogs. Not only do we
+want a main dialog this time but also an "About" dialog. This example is less
+than complete since we do not provide a <A NAME="bundle">BNDL resource</A>
+and related stuff that an application cannot be without. We are able to do this
+when building a python applet since BuildApplet will substitute default resources
+for BNDL, etc. when none are supplied (<A HREF="#no-bundle">See below</A>.)
+"Inside Mac" or various
+books on Macintosh programming will help here. Also, you can refer to
+the resource files provided in the Python source distribution for some
+of the python-specific points of BNDL programming: the
+"appletbundle.rsrc" file is what is used for creating applets if you
+don't provide your own resource file. <p>
+
+When creating your own BNDL resouorces, keep in mind that the Finder gets
+confused if you have more than one application with the same signature. This may be due
+to some incorrectness on the side of "BuildApplet", I am not sure. There is one
+case when you definitely need a unique signature: when you create an applet that
+has its own data files and you want the user to be able to start your
+applet by double-clicking one of the datafiles. <p>
+
+Let's have a look at dnslookup-2.rsrc, our resource file. Dialog 512 is the
+main window which has one button (Lookup), two labels and
+two text entry areas, one of which is used for output only. The "Quit"
+button has disappeared, because its function is handled by a menu choice. Here's
+what it will look like at run time:<p>
+<div align=center>
+<img width=324 height=205 src="example2/dnslookup-2.gif" alt="dialog image">
+</div>
+<p>
+
+<H2>A modeless dialog application using FrameWork</H2>
+
+On to the source code in <A
+HREF="example2/dnslookup-2.py">dnslookup-2.py</A>. The
+start is similar to our previous example program <A
+HREF="example1/dnslookup-1.py">dnslookup-1.py</A>, with
+one extra module being imported. To make life more simple we will use
+the <CODE>FrameWork</CODE> module, a nifty piece of code that handles
+all the gory Mac details of event loop programming, menubar
+installation and all the other code that is the same for every Mac
+program in the world. Like most standard modules, FrameWork will run
+some sample test code when you invoke it as a main program, so try it
+now. It will create a menu bar with an Apple menu with the about box
+and a "File" menu with some pythonesque choices (which do nothing
+interesting, by the way) and a "Quit" command that works. <p>
+
+<BLOCKQUOTE>
+If you have not used <code>FrameWork</code> before you may want to
+first take a look at the <A HREF="textedit.html">Pathetic EDitor</A>
+example, which builds a minimal text editor using FrameWork and TextEdit.
+On the other hand: we don't use many features of FrameWork, so you could
+also continue with this document.
+</BLOCKQUOTE>
+
+After the imports we get the definitions of resource-IDs in our
+resource file, slightly changed from the previous version of our
+program. The main program is also
+similar to our previous version, with one important exception: we
+first check to see whether our resource is available before opening
+the resource file. Why is this? Because later, when we will have
+converted the script to an applet, our resources will be available in
+the applet file and we don't need the separate resource file
+anymore. <p>
+
+Next comes the definition of our main class,
+<CODE>DNSLookup</CODE>, which inherits
+<CODE>FrameWork.Application</CODE>. The Application class handles the
+menu bar and the main event loop and event dispatching. In the
+<CODE>__init__</CODE> routine we first let the base class initialize
+itself, then we create our modeless dialog and finally we jump into
+the main loop. The main loop continues until we call <CODE>self._quit</CODE>,
+which we will do when the user selects "Quit". When we create
+the instance of <CODE>MyDialog</CODE> (which inherits
+<CODE>DialogWindow</CODE>, which inherits <CODE>Window</CODE>) we pass
+a reference to the application object, this reference is used to tell
+Application about our new window. This enables the event loop to keep
+track of all windows and dispatch things like update events and mouse
+clicks. <p>
+
+The <CODE>makeusermenus()</CODE> method (which is called sometime
+during the Application <CODE>__init__</CODE> routine) creates a File
+menu with a Quit command (shortcut command-Q), which will callback to
+our quit() method. <CODE>Quit()</CODE>, in turn, calls <CODE>_quit</CODE> which
+causes the mainloop to terminate at a convenient time. <p>
+
+Application provides a standard about box, but we override this by
+providing our own <CODE>do_about()</CODE> method which shows an about
+box from a resource as a modal dialog. This piece of code should look
+familiar to you from the previous example program. That do_about is
+called when the user selects About from the Apple menu is, again,
+taken care of by the __init__ routine of Application. <p>
+
+The <CODE>MyDialog</CODE> class is the container for our main
+window. Initialization is again done by first calling the base class
+<CODE>__init__</CODE> function and finally setting the local variable
+"parent." <p>
+
+<CODE>Do_itemhit()</CODE> is called when an item is selected in this
+dialog by the user. We are passed the item number (and the original
+event structure, which we normally ignore). The code is similar to the
+main loop of our previous example program: a switch depending on the
+item selected. <CODE>Dnslookup()</CODE> is quite similar to our previous
+example. <p>
+
+<H2><IMG SRC="html.icons/mkapplet.gif"><A NAME="applets">Creating applets</A></H2>
+
+Now let us try to turn the python script into an applet, a standalone
+application. This will <em>not</em> work if you have the "classic 68k"
+Python distribution, only if you have the cfm68k or PPC distribution.
+
+<blockquote>
+Actually, "standalone" is probably not the correct term here, since an
+applet does still depend on a lot of the python environment: the
+PythonCore shared library, the Python Preferences file, the python Lib
+folder and any other modules that the main module depends on. It is
+possible to get rid of all these dependencies and create true standalone
+applications in Python, but this is a bit difficult. See <a href="freezing.html">
+Standalone Applications in Python</a> for details. For this
+document, by standalone we mean here that
+the script has the look-and-feel of an application, including the
+ability to have its own document types, be droppable, etc.
+</blockquote>
+
+The easiest way to create an applet is to take your source file and
+drop it onto "BuildApplet", located in the Python home
+folder. This will create an applet with the same name as your python
+source with the ".py" stripped. Also, if a resource file with the same
+name as your source but with ".rsrc" extension is available the
+resources from that file will be copied to your applet too. If there
+is no resource file for your script a set of default resources will be
+used, and the applet will have the default creator 'Pyt0'. The latter
+also happens if you do have a resource file but without the BNDL
+combo. <A NAME="no-bundle">Actually</A>, as in the present example.
+<p>
+
+If you need slightly more control over the BuildApplet process you can
+double-click it, and you will get dialogs for source and
+destination of the applet. The rest of the process, including locating
+the resource file, remains the same. <p>
+
+Note that though our example application completely bypasses the
+normal python user interface this is by no means necessary. Any python
+script can be turned into an applet, and all the usual features of the
+interpreter still work. <p>
+
+That's all for this example, you may now return to the <A HREF="index.html">
+table of contents</A> to pick another topic. <p>
+</BODY>
+</HTML>
diff --git a/Mac/Demo/example2/dnslookup-2.gif b/Mac/Demo/example2/dnslookup-2.gif
new file mode 100644
index 0000000000..cd5fe5f55f
--- /dev/null
+++ b/Mac/Demo/example2/dnslookup-2.gif
Binary files differ
diff --git a/Mac/Demo/example2/dnslookup-2.py b/Mac/Demo/example2/dnslookup-2.py
new file mode 100644
index 0000000000..fc3db668cc
--- /dev/null
+++ b/Mac/Demo/example2/dnslookup-2.py
@@ -0,0 +1,85 @@
+import FrameWork
+import EasyDialogs
+from Carbon import Res
+from Carbon import Dlg
+import socket
+import string
+import macresource
+#
+# Definitions for our resources
+ID_MAIN=512
+ID_ABOUT=513
+
+ITEM_LOOKUP_ENTRY=1
+ITEM_RESULT=2
+ITEM_LOOKUP_BUTTON=3
+
+def main():
+ macresource.need("DLOG", ID_MAIN, "dnslookup-2.rsrc")
+ DNSLookup()
+
+class DNSLookup(FrameWork.Application):
+ "Application class for DNS Lookup"
+
+ def __init__(self):
+ # First init menus, etc.
+ FrameWork.Application.__init__(self)
+ # Next create our dialog
+ self.main_dialog = MyDialog(self)
+ # Now open the dialog
+ self.main_dialog.open(ID_MAIN)
+ # Finally, go into the event loop
+ self.mainloop()
+
+ def makeusermenus(self):
+ self.filemenu = m = FrameWork.Menu(self.menubar, "File")
+ self.quititem = FrameWork.MenuItem(m, "Quit", "Q", self.quit)
+
+ def quit(self, *args):
+ self._quit()
+
+ def do_about(self, *args):
+ f = Dlg.GetNewDialog(ID_ABOUT, -1)
+ while 1:
+ n = Dlg.ModalDialog(None)
+ if n == 1:
+ return
+
+class MyDialog(FrameWork.DialogWindow):
+ "Main dialog window for DNSLookup"
+ def __init__(self, parent):
+ FrameWork.DialogWindow.__init__(self, parent)
+ self.parent = parent
+
+ def do_itemhit(self, item, event):
+ if item == ITEM_LOOKUP_BUTTON:
+ self.dolookup()
+
+ def dolookup(self):
+ """Get text entered in the lookup entry area. Place result of the
+ call to dnslookup in the result entry area."""
+ tp, h, rect = self.dlg.GetDialogItem(ITEM_LOOKUP_ENTRY)
+ txt = Dlg.GetDialogItemText(h)
+
+ tp, h, rect = self.dlg.GetDialogItem(ITEM_RESULT)
+ Dlg.SetDialogItemText(h, self.dnslookup(txt))
+
+ def dnslookup(self, str):
+ """ Perform DNS lookup on str. If first character of digit is numeric,
+ assume that str contains an IP address. Otherwise, assume that str
+ contains a hostname."""
+ if str == '': str = ' '
+ if str[0] in string.digits:
+ try:
+ value = socket.gethostbyaddr(str)[0]
+ except:
+ value = 'Lookup failed'
+ else:
+ try:
+ value = socket.gethostbyname(str)
+ except:
+ value = 'Lookup failed'
+ return value
+
+
+main()
diff --git a/Mac/Demo/example2/dnslookup-2.rsrc b/Mac/Demo/example2/dnslookup-2.rsrc
new file mode 100644
index 0000000000..17b22d94c5
--- /dev/null
+++ b/Mac/Demo/example2/dnslookup-2.rsrc
Binary files differ
diff --git a/Mac/Demo/html.icons/createmake.png b/Mac/Demo/html.icons/createmake.png
new file mode 100644
index 0000000000..50d6fa550e
--- /dev/null
+++ b/Mac/Demo/html.icons/createmake.png
Binary files differ
diff --git a/Mac/Demo/html.icons/mkapplet.gif b/Mac/Demo/html.icons/mkapplet.gif
new file mode 100644
index 0000000000..cb80496f22
--- /dev/null
+++ b/Mac/Demo/html.icons/mkapplet.gif
Binary files differ
diff --git a/Mac/Demo/html.icons/options.gif b/Mac/Demo/html.icons/options.gif
new file mode 100644
index 0000000000..d2f3c8ccc1
--- /dev/null
+++ b/Mac/Demo/html.icons/options.gif
Binary files differ
diff --git a/Mac/Demo/html.icons/preferences.gif b/Mac/Demo/html.icons/preferences.gif
new file mode 100644
index 0000000000..d06eeb3f5b
--- /dev/null
+++ b/Mac/Demo/html.icons/preferences.gif
Binary files differ
diff --git a/Mac/Demo/html.icons/python.gif b/Mac/Demo/html.icons/python.gif
new file mode 100644
index 0000000000..c73f9306a3
--- /dev/null
+++ b/Mac/Demo/html.icons/python.gif
Binary files differ
diff --git a/Mac/Demo/imgbrowse/imgbrowse.py b/Mac/Demo/imgbrowse/imgbrowse.py
new file mode 100644
index 0000000000..e38e5d8633
--- /dev/null
+++ b/Mac/Demo/imgbrowse/imgbrowse.py
@@ -0,0 +1,115 @@
+"""imgbrowse - Display pictures using img"""
+
+import FrameWork
+import EasyDialogs
+from Carbon import Res
+from Carbon import Qd
+from Carbon import QuickDraw
+from Carbon import Win
+#ifrom Carbon mport List
+import struct
+import img
+import imgformat
+import mac_image
+
+
+# Where is the picture window?
+LEFT=200
+TOP=64
+MINWIDTH=64
+MINHEIGHT=64
+MAXWIDTH=320
+MAXHEIGHT=320
+
+
+def main():
+ print 'hello world'
+ imgbrowse()
+
+class imgbrowse(FrameWork.Application):
+ def __init__(self):
+ # First init menus, etc.
+ FrameWork.Application.__init__(self)
+ self.lastwin = None
+ # Finally, go into the event loop
+ self.mainloop()
+
+ def makeusermenus(self):
+ self.filemenu = m = FrameWork.Menu(self.menubar, "File")
+ self.openitem = FrameWork.MenuItem(m, "Open...", "O", self.opendoc)
+ self.infoitem = FrameWork.MenuItem(m, "Info", "I", self.info)
+ self.quititem = FrameWork.MenuItem(m, "Quit", "Q", self.quit)
+
+ def quit(self, *args):
+ self._quit()
+
+ def opendoc(self, *args):
+ pathname = EasyDialogs.AskFileForOpen() # Any file type
+ if not pathname:
+ return
+ bar = EasyDialogs.ProgressBar('Reading and converting...')
+ try:
+ rdr = img.reader(imgformat.macrgb16, pathname)
+ except img.error, arg:
+ EasyDialogs.Message(repr(arg))
+ return
+ w, h = rdr.width, rdr.height
+ bar.set(10)
+ data = rdr.read()
+ del bar
+ pixmap = mac_image.mkpixmap(w, h, imgformat.macrgb16, data)
+ self.showimg(w, h, pixmap, data)
+
+ def showimg(self, w, h, pixmap, data):
+ win = imgwindow(self)
+ win.open(w, h, pixmap, data)
+ self.lastwin = win
+
+ def info(self, *args):
+ if self.lastwin:
+ self.lastwin.info()
+
+class imgwindow(FrameWork.Window):
+ def open(self, width, height, pixmap, data):
+ self.pixmap = pixmap
+ self.data = data
+ self.pictrect = (0, 0, width, height)
+ bounds = (LEFT, TOP, LEFT+width, TOP+height)
+
+ self.wid = Win.NewCWindow(bounds, "Picture", 1, 0, -1, 1, 0)
+ self.do_postopen()
+
+ def do_update(self, *args):
+ pass
+ currect = self.fitrect()
+ print 'PICT:', self.pictrect
+ print 'WIND:', currect
+ print 'ARGS:', (self.pixmap, self.wid.GetWindowPort().GetPortBitMapForCopyBits(), self.pictrect,
+ currect, QuickDraw.srcCopy, None)
+ self.info()
+ Qd.CopyBits(self.pixmap, self.wid.GetWindowPort().GetPortBitMapForCopyBits(), self.pictrect,
+ currect, QuickDraw.srcCopy, None)
+
+ def fitrect(self):
+ """Return self.pictrect scaled to fit in window"""
+ graf = self.wid.GetWindowPort()
+ screenrect = graf.GetPortBounds()
+ picwidth = self.pictrect[2] - self.pictrect[0]
+ picheight = self.pictrect[3] - self.pictrect[1]
+ if picwidth > screenrect[2] - screenrect[0]:
+ factor = float(picwidth) / float(screenrect[2]-screenrect[0])
+ picwidth = picwidth / factor
+ picheight = picheight / factor
+ if picheight > screenrect[3] - screenrect[1]:
+ factor = float(picheight) / float(screenrect[3]-screenrect[1])
+ picwidth = picwidth / factor
+ picheight = picheight / factor
+ return (screenrect[0], screenrect[1], screenrect[0]+int(picwidth),
+ screenrect[1]+int(picheight))
+
+ def info(self):
+ graf = self.wid.GetWindowPort()
+ bits = graf.GetPortBitMapForCopyBits()
+ mac_image.dumppixmap(bits.pixmap_data)
+
+main()
diff --git a/Mac/Demo/imgbrowse/mac_image.py b/Mac/Demo/imgbrowse/mac_image.py
new file mode 100644
index 0000000000..b6fb274427
--- /dev/null
+++ b/Mac/Demo/imgbrowse/mac_image.py
@@ -0,0 +1,55 @@
+"""mac_image - Helper routines (hacks) for images"""
+import imgformat
+from Carbon import Qd
+import struct
+import MacOS
+
+_fmt_to_mac = {
+ imgformat.macrgb16 : (16, 16, 3, 5),
+}
+
+def mkpixmap(w, h, fmt, data):
+ """kludge a pixmap together"""
+ fmtinfo = _fmt_to_mac[fmt]
+
+ rv = struct.pack("lHhhhhhhlllhhhhlll",
+ id(data)+MacOS.string_id_to_buffer, # HACK HACK!!
+ w*2 + 0x8000,
+ 0, 0, h, w,
+ 0,
+ 0, 0, # XXXX?
+ 72<<16, 72<<16,
+ fmtinfo[0], fmtinfo[1],
+ fmtinfo[2], fmtinfo[3],
+ 0, 0, 0)
+## print 'Our pixmap, size %d:'%len(rv)
+## dumppixmap(rv)
+ return Qd.RawBitMap(rv)
+
+def dumppixmap(data):
+ baseAddr, \
+ rowBytes, \
+ t, l, b, r, \
+ pmVersion, \
+ packType, packSize, \
+ hRes, vRes, \
+ pixelType, pixelSize, \
+ cmpCount, cmpSize, \
+ planeBytes, pmTable, pmReserved \
+ = struct.unpack("lhhhhhhhlllhhhhlll", data)
+ print 'Base: 0x%x'%baseAddr
+ print 'rowBytes: %d (0x%x)'%(rowBytes&0x3fff, rowBytes)
+ print 'rect: %d, %d, %d, %d'%(t, l, b, r)
+ print 'pmVersion: 0x%x'%pmVersion
+ print 'packing: %d %d'%(packType, packSize)
+ print 'resolution: %f x %f'%(float(hRes)/0x10000, float(vRes)/0x10000)
+ print 'pixeltype: %d, size %d'%(pixelType, pixelSize)
+ print 'components: %d, size %d'%(cmpCount, cmpSize)
+ print 'planeBytes: %d (0x%x)'%(planeBytes, planeBytes)
+ print 'pmTable: 0x%x'%pmTable
+ print 'pmReserved: 0x%x'%pmReserved
+ for i in range(0, len(data), 16):
+ for j in range(16):
+ if i + j < len(data):
+ print '%02.2x'%ord(data[i+j]),
+ print
diff --git a/Mac/Demo/index.html b/Mac/Demo/index.html
new file mode 100644
index 0000000000..9e01e9f832
--- /dev/null
+++ b/Mac/Demo/index.html
@@ -0,0 +1,156 @@
+<HTML><HEAD><TITLE>Macintosh Python crash course</TITLE></HEAD>
+<BODY>
+<H1><IMG SRC="html.icons/python.gif">Macintosh Python crash course</H1>
+<HR>
+
+<p>This set of documents provides an introduction to various aspects of
+Python programming on the Mac. It is assumed that the reader is
+already familiar with Python and, to some extent, with MacOS Toolbox
+programming. Other readers may find something interesting here too,
+your mileage may vary. </p>
+
+<p>As the previous paragraph reveals to the careful observer these examples
+are dated, most of them were writting before OSX and haven't been updated
+afterwards. They still show how to use the Carbon wrappers but aren't
+necessarily the best way to use the Carbon API's in OSX.</p>
+
+Another set of Macintosh-savvy examples, more aimed at beginners, is
+maintained by Joseph Strout, at Python Tidbits in <A
+HREF="http://www.strout.net/python/">
+http://www.strout.net/python/</A>.
+<P>
+
+The <a href="http://www.python.org/doc/lib/Top.html">Python Library
+Reference</a> contains a section on <a
+href="http://www.python.org/doc/lib/Macintosh-Specific-Services.html">Macintosh-specific
+modules</a> that you should also read. Documentation is also available
+in PostScript and other forms, see the <a
+href="http://www.python.org/doc/">documentation</a> section on the
+webserver. <p>
+
+<p>The W widget set by Just van Rossum, does not have complete documentation as
+of this writing, but Corran Webster has documented most of it on his
+<A HREF="http://www.nevada.edu/~cwebster/Python/">Python Page</A>.</p>
+
+There are also some documentation links, as well as other MacPython-related
+pages, in the
+<A HREF="http://dmoz.org/Computers/Systems/Macintosh/Development/Scripting/Python/">
+Open Directory</A>.
+
+
+<H2>Table of contents</H2>
+
+<blockquote><B>Note:</B>
+Some of these documents were actually written a long time ago and have seen
+little maintainance, so use with care. </blockquote>
+<UL>
+<LI>
+<A HREF="example0.html">Using python to create Macintosh applications,
+part zero</A> whets your appetite by showing you how to ask the user
+for a filename, and how to display a message. It explains about end-of-line
+confusion while doing so.
+
+<LI>
+<A HREF="example1.html">Using python to create Macintosh applications,
+part one</A> explains how to create a simple modal-dialog application
+in Python. It also takes a glance at using the toolbox modules Res and
+Dlg, and EasyDialogs for simple question-dialogs.
+
+<LI>
+<A HREF="example2.html">Using python to create Macintosh applications,
+part two</A> turns the previous example program into a more complete
+mac application, using a modeless dialog, menus, etc. It also explains
+how to create applets, standalone applications written in Python.
+
+<LI>
+<A HREF="freezing.html">Freezing Python programs</A> extends on this concept,
+and shows you how to create applications that can be used on machines without
+a full Python installed. This one is probably best skipped on first contact
+with MacPython.
+
+<LI>
+<A HREF="textedit.html">Using FrameWork and TextEdit</A> shows you
+how to use <code>FrameWork</code> application framework and the
+<code>TextEdit</code> toolbox to build a text editor.
+
+<LI>
+<A HREF="plugins.html">Creating a C extension module on the Macintosh</A>
+is meant for the hardcore programmer, and shows how to create an
+extension module in C. It also handles using Modulator to create the
+boilerplate for your module, and creating dynamically-loadable modules
+on PowerPC Macs. It assumes you use CodeWarrior for you development.
+
+<LI>
+<A HREF="mpwextensions.html">Creating C extension modules using MPW</A>
+is a companion document, written by Corran Webster, which explains how you
+can develop Python extensions using Apple's free MPW compiler environment.
+
+<LI>
+<A HREF="applescript.html">Using Open Scripting Architecture from Python</A> explains
+how to create a Python module interfacing to a scriptable application,
+and how to use that module in your python program.
+
+<LI>
+<A HREF="cgi.html">Using python to create CGI scripts</A> is a preliminary
+introduction to writing CGI scripts in Python and to writing scriptable applications
+in Python.
+
+<LI>
+<A HREF="building.html">Building Mac Python from source</A> explains
+how to build a PPC or 68K interpreter from a source distribution.
+
+<LI>
+<A HREF="embed.html">Embedding Python on the Mac</A> is a minimal example of
+how to embed Python in other Mac applications.
+
+</UL>
+
+The Python distribution contains a few more examples, all unexplained:
+<UL>
+<LI>
+<I>PICTbrowse</I> is an application that locates PICT
+resources and displays them, it demonstrates some quickdraw and the
+resource and list managers. In the same folder you will find the very
+similar scripts ICONbrowse and cicnbrowse. oldPICTbrowse is the same program
+but form the pre-Appearance era, it uses a dialog with a user item and
+creates and manages its own List object.
+
+<LI>
+<I>Imgbrowse</I> displays image files in
+many different formats (gif, tiff, pbm, etc). It shows how to use the
+img modules on the mac.
+
+<LI>
+<I>Quicktime</I> has the standard <code>MovieInWindow</code> and
+<code>VerySimplePlayer</code> examples, re-coded in Python.
+
+<LI>
+<I>Resources</I>, <I>Sound</I> and <I>Speech</I> have some examples
+on using the respective managers. In the <i>Mac:Lib</i> folder you
+will also find modules that do useful things with the Communications
+Toolbox, the Finder interface, etc.
+
+<LI>
+<I>Printing</I> has an example on using the Printing module to, you guessed
+it, print from Python. The code is somewhat self-documenting. Donated
+by Just van Rossum, who also donated the Printing module itself.
+</UL>
+
+At some point in the (possibly distant) future, I will add chapters on
+how to use bgen to create modules completely automatic and how to make
+your Python program scriptable, but that will have to wait. <p>
+
+<HR>
+
+Please let me know if you miss critical information in this
+document. I am quite sure that I will never find the time to turn it
+into a complete MacPython programmers guide (which would probably be a
+400-page book instead of 10 lousy html-files), but it should contain
+at least the information that is neither in the standard Python
+documentation nor in Inside Mac or other Mac programmers
+documentation. <p>
+
+<HR>
+<A HREF="http://www.cwi.nl/~jack">Jack Jansen</A>,
+<A HREF="mailto:jack@cwi.nl">jack@cwi.nl</A>, 22-Apr-00.
+</BODY></HTML>
diff --git a/Mac/Demo/mlte/mlted.py b/Mac/Demo/mlte/mlted.py
new file mode 100644
index 0000000000..323ea6249a
--- /dev/null
+++ b/Mac/Demo/mlte/mlted.py
@@ -0,0 +1,374 @@
+# A minimal text editor using MLTE. Based on wed.py.
+#
+# To be done:
+# - Functionality: find, etc.
+
+from Menu import DrawMenuBar
+from FrameWork import *
+from Carbon import Win
+from Carbon import Ctl
+from Carbon import Qd
+from Carbon import Res
+from Carbon import Scrap
+import os
+from Carbon import MacTextEditor
+from Carbon import Mlte
+
+UNDOLABELS = [ # Indexed by MLTECanUndo() value
+ "Typing", "Cut", "Paste", "Clear", "Font Change", "Color Change", "Size Change",
+ "Style Change", "Align Left", "Align Center", "Align Right", "Drop", "Move"]
+
+class MlteWindow(Window):
+ def open(self, path, name, data):
+ self.path = path
+ self.name = name
+ r = windowbounds(400, 400)
+ w = Win.NewWindow(r, name, 1, 0, -1, 1, 0)
+ self.wid = w
+ flags = MacTextEditor.kTXNDrawGrowIconMask|MacTextEditor.kTXNWantHScrollBarMask| \
+ MacTextEditor.kTXNWantVScrollBarMask
+ self.ted, self.frameid = Mlte.TXNNewObject(None, w, None, flags, MacTextEditor.kTXNTextEditStyleFrameType,
+ MacTextEditor.kTXNTextFile, MacTextEditor.kTXNMacOSEncoding)
+ self.ted.TXNSetData(MacTextEditor.kTXNTextData, data, 0, 0x7fffffff)
+ self.changed = 0
+ self.do_postopen()
+ self.do_activate(1, None)
+
+ def do_idle(self, event):
+ self.ted.TXNIdle()
+ self.ted.TXNAdjustCursor(None)
+
+
+
+ def do_activate(self, onoff, evt):
+ if onoff:
+## self.ted.TXNActivate(self.frameid, 0)
+ self.ted.TXNFocus(1)
+ self.parent.active = self
+ else:
+ self.ted.TXNFocus(0)
+ self.parent.active = None
+ self.parent.updatemenubar()
+
+ def do_update(self, wid, event):
+ self.ted.TXNDraw(None)
+
+ def do_postresize(self, width, height, window):
+ self.ted.TXNResizeFrame(width, height, self.frameid)
+
+ def do_contentclick(self, local, modifiers, evt):
+ self.ted.TXNClick(evt)
+ self.parent.updatemenubar()
+
+ def do_char(self, ch, event):
+ self.ted.TXNKeyDown(event)
+ self.parent.updatemenubar()
+
+ def close(self):
+ if self.changed:
+ save = EasyDialogs.AskYesNoCancel('Save window "%s" before closing?'%self.name, 1)
+ if save > 0:
+ self.menu_save()
+ elif save < 0:
+ return
+ if self.parent.active == self:
+ self.parent.active = None
+ self.ted.TXNDeleteObject()
+ del self.ted
+## del self.tedtexthandle
+ self.do_postclose()
+
+ def menu_save(self):
+ if not self.path:
+ self.menu_save_as()
+ return # Will call us recursively
+ dhandle = self.ted.TXNGetData(0, 0x7fffffff)
+ data = dhandle.data
+ fp = open(self.path, 'wb') # NOTE: wb, because data has CR for end-of-line
+ fp.write(data)
+ if data[-1] <> '\r': fp.write('\r')
+ fp.close()
+ self.changed = 0
+
+ def menu_save_as(self):
+ path = EasyDialogs.AskFileForSave(message='Save as:')
+ if not path: return
+ self.path = path
+ self.name = os.path.split(self.path)[-1]
+ self.wid.SetWTitle(self.name)
+ self.menu_save()
+
+ def menu_cut(self):
+## self.ted.WESelView()
+ self.ted.TXNCut()
+### Mlte.ConvertToPublicScrap()
+## Scrap.ZeroScrap()
+## self.ted.WECut()
+## self.updatescrollbars()
+ self.parent.updatemenubar()
+ self.changed = 1
+
+ def menu_copy(self):
+## Scrap.ZeroScrap()
+ self.ted.TXNCopy()
+### Mlte.ConvertToPublicScrap()
+## self.updatescrollbars()
+ self.parent.updatemenubar()
+
+ def menu_paste(self):
+### Mlte.ConvertFromPublicScrap()
+ self.ted.TXNPaste()
+## self.updatescrollbars()
+ self.parent.updatemenubar()
+ self.changed = 1
+
+ def menu_clear(self):
+## self.ted.WESelView()
+ self.ted.TXNClear()
+## self.updatescrollbars()
+ self.parent.updatemenubar()
+ self.changed = 1
+
+ def menu_undo(self):
+ self.ted.TXNUndo()
+## self.updatescrollbars()
+ self.parent.updatemenubar()
+
+ def menu_redo(self):
+ self.ted.TXNRedo()
+## self.updatescrollbars()
+ self.parent.updatemenubar()
+
+ def have_selection(self):
+ start, stop = self.ted.TXNGetSelection()
+ return start < stop
+
+ def can_paste(self):
+ return Mlte.TXNIsScrapPastable()
+
+ def can_undo(self):
+ can, which = self.ted.TXNCanUndo()
+ if not can:
+ return None
+ if which >= len(UNDOLABELS):
+ # Unspecified undo
+ return "Undo"
+ which = UNDOLABELS[which]
+
+ return "Undo "+which
+
+ def can_redo(self):
+ can, which = self.ted.TXNCanRedo()
+ if not can:
+ return None
+ if which >= len(UNDOLABELS):
+ # Unspecified undo
+ return "Redo"
+ which = UNDOLABELS[which]
+
+ return "Redo "+which
+
+class Mlted(Application):
+ def __init__(self):
+ Application.__init__(self)
+ self.num = 0
+ self.active = None
+ self.updatemenubar()
+
+ def makeusermenus(self):
+ self.filemenu = m = Menu(self.menubar, "File")
+ self.newitem = MenuItem(m, "New window", "N", self.open)
+ self.openitem = MenuItem(m, "Open...", "O", self.openfile)
+ self.closeitem = MenuItem(m, "Close", "W", self.closewin)
+ m.addseparator()
+ self.saveitem = MenuItem(m, "Save", "S", self.save)
+ self.saveasitem = MenuItem(m, "Save as...", "", self.saveas)
+ m.addseparator()
+ self.quititem = MenuItem(m, "Quit", "Q", self.quit)
+
+ self.editmenu = m = Menu(self.menubar, "Edit")
+ self.undoitem = MenuItem(m, "Undo", "Z", self.undo)
+ self.redoitem = MenuItem(m, "Redo", None, self.redo)
+ m.addseparator()
+ self.cutitem = MenuItem(m, "Cut", "X", self.cut)
+ self.copyitem = MenuItem(m, "Copy", "C", self.copy)
+ self.pasteitem = MenuItem(m, "Paste", "V", self.paste)
+ self.clearitem = MenuItem(m, "Clear", "", self.clear)
+
+ # Groups of items enabled together:
+ self.windowgroup = [self.closeitem, self.saveitem, self.saveasitem, self.editmenu]
+ self.focusgroup = [self.cutitem, self.copyitem, self.clearitem]
+ self.windowgroup_on = -1
+ self.focusgroup_on = -1
+ self.pastegroup_on = -1
+ self.undo_label = "never"
+ self.redo_label = "never"
+
+ def updatemenubar(self):
+ changed = 0
+ on = (self.active <> None)
+ if on <> self.windowgroup_on:
+ for m in self.windowgroup:
+ m.enable(on)
+ self.windowgroup_on = on
+ changed = 1
+ if on:
+ # only if we have an edit menu
+ on = self.active.have_selection()
+ if on <> self.focusgroup_on:
+ for m in self.focusgroup:
+ m.enable(on)
+ self.focusgroup_on = on
+ changed = 1
+ on = self.active.can_paste()
+ if on <> self.pastegroup_on:
+ self.pasteitem.enable(on)
+ self.pastegroup_on = on
+ changed = 1
+ on = self.active.can_undo()
+ if on <> self.undo_label:
+ if on:
+ self.undoitem.enable(1)
+ self.undoitem.settext(on)
+ self.undo_label = on
+ else:
+ self.undoitem.settext("Nothing to undo")
+ self.undoitem.enable(0)
+ changed = 1
+ on = self.active.can_redo()
+ if on <> self.redo_label:
+ if on:
+ self.redoitem.enable(1)
+ self.redoitem.settext(on)
+ self.redo_label = on
+ else:
+ self.redoitem.settext("Nothing to redo")
+ self.redoitem.enable(0)
+ changed = 1
+ if changed:
+ DrawMenuBar()
+
+ #
+ # Apple menu
+ #
+
+ def do_about(self, id, item, window, event):
+ EasyDialogs.Message("A simple single-font text editor based on MacTextEditor")
+
+ #
+ # File menu
+ #
+
+ def open(self, *args):
+ self._open(0)
+
+ def openfile(self, *args):
+ self._open(1)
+
+ def _open(self, askfile):
+ if askfile:
+ path = EasyDialogs.AskFileForOpen(typeList=('TEXT',))
+ if not path:
+ return
+ name = os.path.split(path)[-1]
+ try:
+ fp = open(path, 'rb') # NOTE binary, we need cr as end-of-line
+ data = fp.read()
+ fp.close()
+ except IOError, arg:
+ EasyDialogs.Message("IOERROR: %r" % (arg,))
+ return
+ else:
+ path = None
+ name = "Untitled %d"%self.num
+ data = ''
+ w = MlteWindow(self)
+ w.open(path, name, data)
+ self.num = self.num + 1
+
+ def closewin(self, *args):
+ if self.active:
+ self.active.close()
+ else:
+ EasyDialogs.Message("No active window?")
+
+ def save(self, *args):
+ if self.active:
+ self.active.menu_save()
+ else:
+ EasyDialogs.Message("No active window?")
+
+ def saveas(self, *args):
+ if self.active:
+ self.active.menu_save_as()
+ else:
+ EasyDialogs.Message("No active window?")
+
+
+ def quit(self, *args):
+ for w in self._windows.values():
+ w.close()
+ if self._windows:
+ return
+ self._quit()
+
+ #
+ # Edit menu
+ #
+
+ def undo(self, *args):
+ if self.active:
+ self.active.menu_undo()
+ else:
+ EasyDialogs.Message("No active window?")
+
+ def redo(self, *args):
+ if self.active:
+ self.active.menu_redo()
+ else:
+ EasyDialogs.Message("No active window?")
+
+ def cut(self, *args):
+ if self.active:
+ self.active.menu_cut()
+ else:
+ EasyDialogs.Message("No active window?")
+
+ def copy(self, *args):
+ if self.active:
+ self.active.menu_copy()
+ else:
+ EasyDialogs.Message("No active window?")
+
+ def paste(self, *args):
+ if self.active:
+ self.active.menu_paste()
+ else:
+ EasyDialogs.Message("No active window?")
+
+ def clear(self, *args):
+ if self.active:
+ self.active.menu_clear()
+ else:
+ EasyDialogs.Message("No active window?")
+
+ #
+ # Other stuff
+ #
+
+ def idle(self, event):
+ if self.active:
+ self.active.do_idle(event)
+ else:
+ Qd.SetCursor(Qd.GetQDGlobalsArrow())
+
+def main():
+ Mlte.TXNInitTextension(0)
+ try:
+ App = Mlted()
+ App.mainloop()
+ finally:
+ Mlte.TXNTerminateTextension()
+
+if __name__ == '__main__':
+ main()
diff --git a/Mac/Demo/quicktime/MovieInWindow.py b/Mac/Demo/quicktime/MovieInWindow.py
new file mode 100644
index 0000000000..00f596e472
--- /dev/null
+++ b/Mac/Demo/quicktime/MovieInWindow.py
@@ -0,0 +1,70 @@
+"""MovieInWindow converted to python
+
+Jack Jansen, CWI, December 1995
+"""
+
+from Carbon import Qt
+from Carbon import QuickTime
+from Carbon import Qd
+from Carbon import QuickDraw
+from Carbon import Evt
+from Carbon import Events
+from Carbon import Win
+from Carbon import Windows
+from Carbon import File
+import EasyDialogs
+import sys
+import os
+
+
+def main():
+ # skip the toolbox initializations, already done
+ # XXXX Should use gestalt here to check for quicktime version
+ Qt.EnterMovies()
+
+ # Get the movie file
+ if len(sys.argv) > 1:
+ filename = sys.argv[1]
+ else:
+ filename = EasyDialogs.AskFileForOpen() # Was: QuickTime.MovieFileType
+ if not filename:
+ sys.exit(0)
+
+ # Open the window
+ bounds = (175, 75, 175+160, 75+120)
+ theWindow = Win.NewCWindow(bounds, os.path.split(filename)[1], 1, 0, -1, 0, 0)
+ Qd.SetPort(theWindow)
+ # XXXX Needed? SetGWorld((CGrafPtr)theWindow, nil)
+
+ playMovieInWindow(theWindow, filename, theWindow.GetWindowPort().GetPortBounds())
+
+def playMovieInWindow(theWindow, theFile, movieBox):
+ """Play a movie in a window"""
+ # XXXX Needed? SetGWorld((CGrafPtr)theWindow, nil);
+
+ # Get the movie
+ theMovie = loadMovie(theFile)
+
+ # Set where we want it
+ theMovie.SetMovieBox(movieBox)
+
+ # Start at the beginning
+ theMovie.GoToBeginningOfMovie()
+
+ # Give a little time to preroll
+ theMovie.MoviesTask(0)
+
+ # Start playing
+ theMovie.StartMovie()
+
+ while not theMovie.IsMovieDone() and not Evt.Button():
+ theMovie.MoviesTask(0)
+
+def loadMovie(theFile):
+ """Load a movie given an fsspec. Return the movie object"""
+ movieResRef = Qt.OpenMovieFile(theFile, 1)
+ movie, d1, d2 = Qt.NewMovieFromFile(movieResRef, 0, QuickTime.newMovieActive)
+ return movie
+
+if __name__ == '__main__':
+ main()
diff --git a/Mac/Demo/quicktime/VerySimplePlayer.py b/Mac/Demo/quicktime/VerySimplePlayer.py
new file mode 100644
index 0000000000..2930eac778
--- /dev/null
+++ b/Mac/Demo/quicktime/VerySimplePlayer.py
@@ -0,0 +1,92 @@
+"""VerySimplePlayer converted to python
+
+Jack Jansen, CWI, December 1995
+"""
+
+from Carbon import Qt
+from Carbon import QuickTime
+from Carbon import Qd
+from Carbon import QuickDraw
+from Carbon import Evt
+from Carbon import Events
+from Carbon import Win
+from Carbon import Windows
+from Carbon import File
+import EasyDialogs
+import sys
+
+# XXXX maxbounds = (40, 40, 1000, 1000)
+
+def main():
+ print 'hello world' # XXXX
+ # skip the toolbox initializations, already done
+ # XXXX Should use gestalt here to check for quicktime version
+ Qt.EnterMovies()
+
+ # Get the movie file
+ fss = EasyDialogs.AskFileForOpen(wanted=File.FSSpec) # Was: QuickTime.MovieFileType
+ if not fss:
+ sys.exit(0)
+
+ # Open the window
+ bounds = (175, 75, 175+160, 75+120)
+ theWindow = Win.NewCWindow(bounds, fss.as_tuple()[2], 0, 0, -1, 1, 0)
+ # XXXX Needed? SetGWorld((CGrafPtr)theWindow, nil)
+ Qd.SetPort(theWindow)
+
+ # Get the movie
+ theMovie = loadMovie(fss)
+
+ # Relocate to (0, 0)
+ bounds = theMovie.GetMovieBox()
+ bounds = 0, 0, bounds[2]-bounds[0], bounds[3]-bounds[1]
+ theMovie.SetMovieBox(bounds)
+
+ # Create a controller
+ theController = theMovie.NewMovieController(bounds, QuickTime.mcTopLeftMovie)
+
+ # Get movie size and update window parameters
+ rv, bounds = theController.MCGetControllerBoundsRect()
+ theWindow.SizeWindow(bounds[2], bounds[3], 0) # XXXX or [3] [2]?
+ Qt.AlignWindow(theWindow, 0)
+ theWindow.ShowWindow()
+
+ # XXXX MCDoAction(theController, mcActionSetGrowBoxBounds, &maxBounds)
+ theController.MCDoAction(QuickTime.mcActionSetKeysEnabled, '1')
+
+ # XXXX MCSetActionFilterWithRefCon(theController, movieControllerEventFilter, (long)theWindow)
+
+ done = 0
+ while not done:
+ gotone, evt = Evt.WaitNextEvent(0xffff, 0)
+ (what, message, when, where, modifiers) = evt
+## print what, message, when, where, modifiers # XXXX
+
+ if theController.MCIsPlayerEvent(evt):
+ continue
+
+ if what == Events.mouseDown:
+ part, whichWindow = Win.FindWindow(where)
+ if part == Windows.inGoAway:
+ done = whichWindow.TrackGoAway(where)
+ elif part == Windows.inDrag:
+ Qt.DragAlignedWindow(whichWindow, where, (0, 0, 4000, 4000))
+ elif what == Events.updateEvt:
+ whichWindow = Win.WhichWindow(message)
+ if not whichWindow:
+ # Probably the console window. Print something, hope it helps.
+ print 'update'
+ else:
+ Qd.SetPort(whichWindow)
+ whichWindow.BeginUpdate()
+ Qd.EraseRect(whichWindow.GetWindowPort().GetPortBounds())
+ whichWindow.EndUpdate()
+
+def loadMovie(theFile):
+ """Load a movie given an fsspec. Return the movie object"""
+ movieResRef = Qt.OpenMovieFile(theFile, 1)
+ movie, d1, d2 = Qt.NewMovieFromFile(movieResRef, 0, QuickTime.newMovieActive)
+ return movie
+
+if __name__ == '__main__':
+ main()
diff --git a/Mac/Demo/resources/copyres.py b/Mac/Demo/resources/copyres.py
new file mode 100644
index 0000000000..528ff16794
--- /dev/null
+++ b/Mac/Demo/resources/copyres.py
@@ -0,0 +1,57 @@
+from Carbon.Res import *
+from Carbon.Resources import *
+import MacOS
+
+READ = 1
+WRITE = 2
+smAllScripts = -3
+
+def copyres(src, dst):
+ """Copy resource from src file to dst file."""
+
+ cur = CurResFile()
+ ctor, type = MacOS.GetCreatorAndType(src)
+ input = FSpOpenResFile(src, READ)
+ try:
+ FSpCreateResFile(dst, ctor, type, smAllScripts)
+ except:
+ raw_input("%s already exists... CR to write anyway! " % dst)
+ output = FSpOpenResFile(dst, WRITE)
+ UseResFile(input)
+ ntypes = Count1Types()
+ for itype in range(1, 1+ntypes):
+ type = Get1IndType(itype)
+ nresources = Count1Resources(type)
+ for ires in range(1, 1+nresources):
+ res = Get1IndResource(type, ires)
+ res.LoadResource()
+ id, type, name = res.GetResInfo()
+ size = res.SizeResource()
+ attrs = res.GetResAttrs()
+ print id, type, name, size, hex(attrs)
+ res.DetachResource()
+ UseResFile(output)
+ try:
+ res2 = Get1Resource(type, id)
+ except (RuntimeError, Res.Error), msg:
+ res2 = None
+ if res2:
+ print "Duplicate type+id, not copied"
+ print (res2.size, res2.data)
+ print res2.GetResInfo()
+ if res2.HomeResFile() == output:
+ 'OK'
+ elif res2.HomeResFile() == input:
+ 'BAD!'
+ else:
+ print 'Home:', res2.HomeResFile()
+ else:
+ res.AddResource(type, id, name)
+ #res.SetResAttrs(attrs)
+ res.WriteResource()
+ UseResFile(input)
+ UseResFile(cur)
+ CloseResFile(output)
+ CloseResFile(input)
+
+copyres('::python.¹.rsrc', '::foo.rsrc')
diff --git a/Mac/Demo/resources/listres.py b/Mac/Demo/resources/listres.py
new file mode 100644
index 0000000000..6ce5779216
--- /dev/null
+++ b/Mac/Demo/resources/listres.py
@@ -0,0 +1,60 @@
+# List all resources
+
+from Carbon import Res
+from Carbon.Resources import *
+
+def list1resources():
+ ntypes = Res.Count1Types()
+ for itype in range(1, 1+ntypes):
+ type = Res.Get1IndType(itype)
+ print "Type:", repr(type)
+ nresources = Res.Count1Resources(type)
+ for i in range(1, 1 + nresources):
+ Res.SetResLoad(0)
+ res = Res.Get1IndResource(type, i)
+ Res.SetResLoad(1)
+ info(res)
+
+def listresources():
+ ntypes = Res.CountTypes()
+ for itype in range(1, 1+ntypes):
+ type = Res.GetIndType(itype)
+ print "Type:", repr(type)
+ nresources = Res.CountResources(type)
+ for i in range(1, 1 + nresources):
+ Res.SetResLoad(0)
+ res = Res.GetIndResource(type, i)
+ Res.SetResLoad(1)
+ info(res)
+
+def info(res):
+ print res.GetResInfo(), res.SizeResource(), decodeattrs(res.GetResAttrs())
+
+attrnames = {
+ resChanged: 'Changed',
+ resPreload: 'Preload',
+ resProtected: 'Protected',
+ resLocked: 'Locked',
+ resPurgeable: 'Purgeable',
+ resSysHeap: 'SysHeap',
+}
+
+def decodeattrs(attrs):
+ names = []
+ for bit in range(16):
+ mask = 1<<bit
+ if attrs & mask:
+ if attrnames.has_key(mask):
+ names.append(attrnames[mask])
+ else:
+ names.append(hex(mask))
+ return names
+
+def test():
+ print "=== Local resourcess ==="
+ list1resources()
+ print "=== All resources ==="
+ listresources()
+
+if __name__ == '__main__':
+ test()
diff --git a/Mac/Demo/sound/morse.py b/Mac/Demo/sound/morse.py
new file mode 100644
index 0000000000..b6919c5fb1
--- /dev/null
+++ b/Mac/Demo/sound/morse.py
@@ -0,0 +1,180 @@
+import sys, math
+
+DOT = 30
+DAH = 80
+OCTAVE = 2 # 1 == 441 Hz, 2 == 882 Hz, ...
+SAMPWIDTH = 2
+FRAMERATE = 44100
+BASEFREQ = 441
+QSIZE = 20000
+
+morsetab = {
+ 'A': '.-', 'a': '.-',
+ 'B': '-...', 'b': '-...',
+ 'C': '-.-.', 'c': '-.-.',
+ 'D': '-..', 'd': '-..',
+ 'E': '.', 'e': '.',
+ 'F': '..-.', 'f': '..-.',
+ 'G': '--.', 'g': '--.',
+ 'H': '....', 'h': '....',
+ 'I': '..', 'i': '..',
+ 'J': '.---', 'j': '.---',
+ 'K': '-.-', 'k': '-.-',
+ 'L': '.-..', 'l': '.-..',
+ 'M': '--', 'm': '--',
+ 'N': '-.', 'n': '-.',
+ 'O': '---', 'o': '---',
+ 'P': '.--.', 'p': '.--.',
+ 'Q': '--.-', 'q': '--.-',
+ 'R': '.-.', 'r': '.-.',
+ 'S': '...', 's': '...',
+ 'T': '-', 't': '-',
+ 'U': '..-', 'u': '..-',
+ 'V': '...-', 'v': '...-',
+ 'W': '.--', 'w': '.--',
+ 'X': '-..-', 'x': '-..-',
+ 'Y': '-.--', 'y': '-.--',
+ 'Z': '--..', 'z': '--..',
+ '0': '-----',
+ '1': '.----',
+ '2': '..---',
+ '3': '...--',
+ '4': '....-',
+ '5': '.....',
+ '6': '-....',
+ '7': '--...',
+ '8': '---..',
+ '9': '----.',
+ ',': '--..--',
+ '.': '.-.-.-',
+ '?': '..--..',
+ ';': '-.-.-.',
+ ':': '---...',
+ "'": '.----.',
+ '-': '-....-',
+ '/': '-..-.',
+ '(': '-.--.-',
+ ')': '-.--.-',
+ '_': '..--.-',
+ ' ': ' '
+}
+
+# If we play at 44.1 kHz (which we do), then if we produce one sine
+# wave in 100 samples, we get a tone of 441 Hz. If we produce two
+# sine waves in these 100 samples, we get a tone of 882 Hz. 882 Hz
+# appears to be a nice one for playing morse code.
+def mkwave(octave):
+ global sinewave, nowave
+ sinewave = ''
+ n = int(FRAMERATE / BASEFREQ)
+ for i in range(n):
+ val = int(math.sin(2 * math.pi * i * octave / n) * 0x7fff)
+ sample = chr((val >> 8) & 255) + chr(val & 255)
+ sinewave = sinewave + sample[:SAMPWIDTH]
+ nowave = '\0' * (n*SAMPWIDTH)
+
+mkwave(OCTAVE)
+
+class BufferedAudioDev:
+ def __init__(self, *args):
+ import audiodev
+ self._base = apply(audiodev.AudioDev, args)
+ self._buffer = []
+ self._filled = 0
+ self._addmethods(self._base, self._base.__class__)
+ def _addmethods(self, inst, cls):
+ for name in cls.__dict__.keys():
+ if not hasattr(self, name):
+ try:
+ setattr(self, name, getattr(inst, name))
+ except:
+ pass
+ for basecls in cls.__bases__:
+ self._addmethods(self, inst, basecls)
+ def writeframesraw(self, frames):
+ self._buffer.append(frames)
+ self._filled = self._filled + len(frames)
+ if self._filled >= QSIZE:
+ self.flush()
+ def wait(self):
+ self.flush()
+ self._base.wait()
+ def flush(self):
+ print 'flush: %d blocks, %d bytes' % (len(self._buffer), self._filled)
+ if self._buffer:
+ import string
+ self._base.writeframes(string.joinfields(self._buffer, ''))
+ self._buffer = []
+ self._filled = 0
+
+def main(args = sys.argv[1:]):
+ import getopt, string
+ try:
+ opts, args = getopt.getopt(args, 'o:p:')
+ except getopt.error:
+ sys.stderr.write('Usage ' + sys.argv[0] +
+ ' [ -o outfile ] [ args ] ...\n')
+ sys.exit(1)
+ dev = None
+ for o, a in opts:
+ if o == '-o':
+ import aifc
+ dev = aifc.open(a, 'w')
+ dev.setframerate(FRAMERATE)
+ dev.setsampwidth(SAMPWIDTH)
+ dev.setnchannels(1)
+ if o == '-p':
+ mkwave(string.atoi(a))
+ if not dev:
+ dev = BufferedAudioDev()
+ dev.setoutrate(FRAMERATE)
+ dev.setsampwidth(SAMPWIDTH)
+ dev.setnchannels(1)
+ dev.close = dev.stop
+ if args:
+ line = string.join(args)
+ else:
+ line = sys.stdin.readline()
+ while line:
+ print line
+ mline = morse(line)
+ print mline
+ play(mline, dev)
+ if hasattr(dev, 'wait'):
+ dev.wait()
+ if not args:
+ line = sys.stdin.readline()
+ else:
+ line = ''
+ dev.close()
+
+# Convert a string to morse code with \001 between the characters in
+# the string.
+def morse(line):
+ res = ''
+ for c in line:
+ try:
+ res = res + morsetab[c] + '\001'
+ except KeyError:
+ pass
+ return res
+
+# Play a line of morse code.
+def play(line, dev):
+ for c in line:
+ if c == '.':
+ sine(dev, DOT)
+ elif c == '-':
+ sine(dev, DAH)
+ else:
+ pause(dev, DAH)
+ pause(dev, DOT)
+
+def sine(dev, length):
+ dev.writeframesraw(sinewave*length)
+
+def pause(dev, length):
+ dev.writeframesraw(nowave*length)
+
+if __name__ == '__main__' or sys.argv[0] == __name__:
+ main()
diff --git a/Mac/Demo/sound/morselib.py b/Mac/Demo/sound/morselib.py
new file mode 100644
index 0000000000..98e259059a
--- /dev/null
+++ b/Mac/Demo/sound/morselib.py
@@ -0,0 +1,188 @@
+"""Translate text strings to Morse code"""
+
+FRAMERATE = 22050
+SAMPWIDTH = 2
+
+BASEFREQ = 441
+OCTAVE = 2
+
+DOT = 30
+DAH = 80
+
+morsetab = {
+ 'a': '.-',
+ 'b': '-...',
+ 'c': '-.-.',
+ 'd': '-..',
+ 'e': '.',
+ 'f': '..-.',
+ 'g': '--.',
+ 'h': '....',
+ 'i': '..',
+ 'j': '.---',
+ 'k': '-.-',
+ 'l': '.-..',
+ 'm': '--',
+ 'n': '-.',
+ 'o': '---',
+ 'p': '.--.',
+ 'q': '--.-',
+ 'r': '.-.',
+ 's': '...',
+ 't': '-',
+ 'u': '..-',
+ 'v': '...-',
+ 'w': '.--',
+ 'x': '-..-',
+ 'y': '-.--',
+ 'z': '--..',
+ '0': '-----',
+ '1': '.----',
+ '2': '..---',
+ '3': '...--',
+ '4': '....-',
+ '5': '.....',
+ '6': '-....',
+ '7': '--...',
+ '8': '---..',
+ '9': '----.',
+ ',': '--..--',
+ '.': '.-.-.-',
+ '?': '..--..',
+ ';': '-.-.-.',
+ ':': '---...',
+ "'": '.----.',
+ '-': '-....-',
+ '/': '-..-.',
+ '(': '-.--.-',
+ ')': '-.--.-', # XXX same as code for '(' ???
+ '_': '..--.-',
+ ' ': ' '
+}
+
+def morsecode(s):
+ from string import lower
+ m = ''
+ for c in s:
+ c = lower(c)
+ if morsetab.has_key(c):
+ c = morsetab[c] + ' '
+ else:
+ c = '? '
+ m = m + c
+ return m
+
+
+class BaseMorse:
+ "base class for morse transmissions"
+
+ def __init__(self):
+ "constructor"
+ self.dots = DOT
+ self.dahs = DAH
+
+ def noise(self, duration):
+ "beep for given duration"
+ pass
+
+ def pause(self, duration):
+ "pause for given duration"
+ pass
+
+ def dot(self):
+ "short beep"
+ self.noise(self.dots)
+
+ def dah(self):
+ "long beep"
+ self.noise(self.dahs)
+
+ def pdot(self):
+ "pause as long as a dot"
+ self.pause(self.dots)
+
+ def pdah(self):
+ "pause as long as a dah"
+ self.pause(self.dahs)
+
+ def sendmorse(self, s):
+ for c in s:
+ if c == '.': self.dot()
+ elif c == '-': self.dah()
+ else: self.pdah()
+ self.pdot()
+
+ def sendascii(self, s):
+ self.sendmorse(morsecode(s))
+
+ def send(self, s):
+ self.sendascii(s)
+
+
+import Audio_mac
+class MyAudio(Audio_mac.Play_Audio_mac):
+ def _callback(self, *args):
+ if hasattr(self, 'usercallback'): self.usercallback()
+ apply(Audio_mac.Play_Audio_mac._callback, (self,) + args)
+
+
+class MacMorse(BaseMorse):
+ "Mac specific class to play Morse code"
+
+ def __init__(self):
+ BaseMorse.__init__(self)
+ self.dev = MyAudio()
+ self.dev.setoutrate(FRAMERATE)
+ self.dev.setsampwidth(SAMPWIDTH)
+ self.dev.setnchannels(1)
+ self.dev.usercallback = self.usercallback
+ sinewave = ''
+ n = int(FRAMERATE / BASEFREQ)
+ octave = OCTAVE
+ from math import sin, pi
+ for i in range(n):
+ val = int(sin(2 * pi * i * octave / n) * 0x7fff)
+ sample = chr((val >> 8) & 255) + chr(val & 255)
+ sinewave = sinewave + sample[:SAMPWIDTH]
+ self.sinewave = sinewave
+ self.silence = '\0' * (n*SAMPWIDTH)
+ self.morsequeue = ''
+
+ def __del__(self):
+ self.close()
+
+ def close(self):
+ self.dev = None
+
+ def pause(self, duration):
+ self.dev.writeframes(self.silence * duration)
+
+ def noise(self, duration):
+ self.dev.writeframes(self.sinewave * duration)
+
+ def sendmorse(self, s):
+ self.morsequeue = self.morsequeue + s
+ self.dev.usercallback()
+ self.dev.usercallback()
+ self.dev.usercallback()
+
+ def usercallback(self):
+ if self.morsequeue:
+ c, self.morsequeue = self.morsequeue[0], self.morsequeue[1:]
+ if c == '.': self.dot()
+ elif c == '-': self.dah()
+ else: self.pdah()
+ self.pdot()
+
+
+def test():
+ m = MacMorse()
+ while 1:
+ try:
+ line = raw_input('Morse line: ')
+ except (EOFError, KeyboardInterrupt):
+ break
+ m.send(line)
+ while m.morsequeue: pass
+
+test()
diff --git a/Mac/Demo/sound/playaiff.py b/Mac/Demo/sound/playaiff.py
new file mode 100644
index 0000000000..8237895250
--- /dev/null
+++ b/Mac/Demo/sound/playaiff.py
@@ -0,0 +1,45 @@
+from Carbon.Sound import *
+from Carbon import Snd
+
+import aifc, audioop
+
+fn = 'f:just samples:2ndbeat.aif'
+af = aifc.open(fn, 'r')
+print af.getparams()
+print 'nframes =', af.getnframes()
+print 'nchannels =', af.getnchannels()
+print 'framerate =', af.getframerate()
+nframes = min(af.getnframes(), 100000)
+frames = af.readframes(nframes)
+print 'len(frames) =', len(frames)
+print repr(frames[:100])
+frames = audioop.add(frames, '\x80'*len(frames), 1)
+print repr(frames[:100])
+
+import struct
+
+header1 = struct.pack('llhhllbbl',
+ 0,
+ af.getnchannels(),
+ af.getframerate(),0,
+ 0,
+ 0,
+ 0xFF,
+ 60,
+ nframes)
+print repr(header1)
+header2 = struct.pack('llhlll', 0, 0, 0, 0, 0, 0)
+header3 = struct.pack('hhlll',
+ af.getsampwidth()*8,
+ 0,
+ 0,
+ 0,
+ 0)
+print repr(header3)
+header = header1 + header2 + header3
+
+buffer = header + frames
+
+chan = Snd.SndNewChannel(5,0x00C0)
+
+Snd.SndDoCommand(chan, (bufferCmd, 0, buffer), 0)
diff --git a/Mac/Demo/textedit.html b/Mac/Demo/textedit.html
new file mode 100644
index 0000000000..fcd8c973df
--- /dev/null
+++ b/Mac/Demo/textedit.html
@@ -0,0 +1,150 @@
+<HTML><HEAD><TITLE>Using FrameWork and TextEdit</TITLE></HEAD>
+<BODY>
+<H1>Using FrameWork and TextEdit</H1>
+<HR>
+
+In this document we use the <CODE>FrameWork</CODE> and <CODE>TextEdit</CODE>
+modules to create a simple text editor. The functionality
+of the editor is very basic: you can open multiple files, type text and use
+cut/copy/paste. The main intention is to explain the use of FrameWork, really. <p>
+
+<H2>FrameWork</H2>
+
+The FrameWork module provides you with a skeleton application. It declares a
+number of classes suitable for subclassing in your application, thereby
+releaving you of the burden of doing all event handling, etc. yourself. For a
+real understanding you will have to browse the source. Here is a short overview
+of the classes and what functionality they provide.
+
+<dl>
+<dt> <CODE>Application</CODE>
+<dd>
+This is the toplevel class you will override. It maintains the menu bar and contains
+the main event handling code. Normal use is to override the <code>__init__</code> routine
+to do your own initializations and override <code>makeusermenus</code> to create your menus
+(your menu callback routines may be here too, but this is by no means necessary).
+The event handling code can be overridden at various levels, from very low-level (the
+<code>dispatch</code> method) to intermedeate level (<code>do_keyDown</code>, for instance)
+to high-level (<code>do_key</code>). The application class knows about the <code>Window</code>
+objects you create, and will forward events to the appropriate window (So, normally you
+would have a <code>do_key</code> method in your window object, not your application object).
+
+<dt> <CODE>MenuBar</CODE>, <CODE>Menu</CODE> and <CODE>MenuItem</CODE>
+<dd>
+These classes (and a few friends like <CODE>SubMenu</CODE>) handle your menus. You would not
+normally override them but use them as-is. The idiom for creating menus is a bit strange,
+see the test code at the bottom of FrameWork for sample use. The apple menu is handled for you
+by <CODE>MenuBar</CODE> and <CODE>Application</CODE>.
+
+<dt> <CODE>Window</CODE>
+<dd>
+The basic window. Again, a class that you normally subclass in your application, possibly
+multiple times if you have different types of windows. The init call instantiates the data
+structure but actually opening the window is delayed until you call <code>open</code>. Your
+open method should call <code>do_postopen</code> to let the base class handle linking in to
+the application object. Similarly with <code>close</code> and <code>do_postclose</code>. The
+rest of the code is mainly event-oriented: you override <code>do_postresize</code>,
+<code>do_contentclick</code>, <code>do_update</code>, <code>do_activate</code>
+and <code>do_key</code> to "do your thing". When these methods are called the relevant environment
+has been setup (like <code>BeginDrawing</code> has been called for updates, etc).
+
+<dt> <CODE>windowbounds</CODE>
+<dd>
+Not a class but a function: you pass it a width and height and it will return you a rectangle
+you can use to create your window. It will take care of staggering windows and it will try
+to fit the window on the screen (but the resulting rect will <em>always</em> have the size you
+specify).
+
+<dt> <CODE>ControlsWindow</CODE>
+<dd>
+A subclass of Window which automatically handles drawing and clicking for controls. You override
+the same methods as for Window (if you need to: control-related things are done automatically) and
+<code>do_controlhit</code>.
+
+<dt> <CODE>ScrolledWindow</CODE>
+<dd>
+A subclass of ControlsWindow, a window with optional scrollbars. If you override <code>do_activate</code>
+or <code>do_postresize</code> you must call the ScrolledWindow methods at the end of your override.
+You call <code>scrollbars</code> to enable/disable scrollbars and <code>updatescrollbars</code> to
+update them. You provide <code>getscrollbarvalues</code> to return the current x/y values (a helper
+method <code>scalebarvalues</code> is available) and <code>scrollbarcallback</code> to update your
+display after the user has used the scrollbars.
+
+<dt> <CODE>DialogWindow</CODE>
+<dd>
+A modeless dialog window initialized from a DLOG resource. See the
+<A HREF="example2.html">second Interslip example</A> for its useage.
+</dl>
+
+<H2>A sample text editor</H2>
+
+Let us have a look at <A HREF="textedit/ped.py">ped.py</A> (in the Demo:textedit folder), the Pathetic
+EDitor. It has multiple windows, cut/copy/paste and keyboard input, but that is about all. It looks
+as if you can resize the window but it does not work. Still, it serves as an example.
+
+Ped creates two classes, <code>TEWindow</code> and <code>Ped</code>. Let us start with the latter one,
+which is a subclass of <code>FrameWork.Application</code> and our main application. The init function
+has little to do aside from the standard init: it remembers a window sequence number (for untitled windows),
+and sets things up for menu disable to work. Remember, the <code>makeusermenus</code> is called
+automatically. <p>
+
+<code>Makeusermenus</code> creates the <code>File</code> and <code>Edit</code> menus. It also initializes
+a couple of lists that are used later to correctly enable and disable menu items (and complete menus) depending
+on whether a window is open, text is selected, etc. The callback functions for the menu items are
+all methods of this class. <p>
+
+<code>Updatemenubar</code> handles greying out (and re-enabling) of menu items depending on whether there
+is a current window and its state. <p>
+
+The rest of the methods are all callbacks and simple to understand. They check whether there is an active
+window (and complain loudly if there is none: the corresponding menu entry should have been disabled
+in that case!) and call the appropriate window method. Only the <code>_open</code> method (the common code
+for <code>Open</code> and <code>New</code>) deserves some mention. It instantiates a <code>TEWindow</code>
+object and opens it with the title, filename and contents of the file to edit. Note that FrameWork takes
+care of remembering the window object. A minor note on opening the file in binary mode: this is because
+TextEdit expects MacOS style carriage-return terminated lines, not python/unix/C style newline-terminated
+lines. <p>
+
+Oh yes: the <code>quit</code> callback does a little magic too. It closes all windows, and only if this
+succeeds it actually quits. This gives the user a chance to cancel the operation if some files are unsaved.
+<p>
+
+Lastly, there is the <code>idle</code> method, called by the Application base class when no event
+is available. It is forwarded to the active window, so it can blink the text caret. <p>
+
+The <code>TEWindow</code> object handles a single window. Due to this structuring it is absolutely no
+problem to have multiple windows open at the same time (although a real application should exercise care when
+two windows refer to the same document). TEWindow uses the standard init code inherited from
+<code>ScrolledWindow</code>, and sets itself up at the time of the <code>open</code> call. It obtains screen
+coordinates, opens the window, creates rectangles for TextEdit to work in (the magical number <code>15</code>
+here is the size of a normal scroll bar: unfortunately there is no symbolic constant for it),
+creates the TextEdit object and initializes it with our data. Finally, the scroll bars are created (the
+initial values will be obtained automatically through <code>getscrollbarvalues</code>) and we activate
+ourselves (this is unfortunately not done automatically by the MacOS event handling code). <p>
+
+<code>Do_idle</code> simply calls the TextEdit routine that blinks the cursor. <code>Getscrollbarvalues</code>
+returns the current X and Y scrollbar values, scaled to <code>0..32767</code>. For X we return <code>None</code>,
+which means "no scrollbar, please", for Y we use the scaler provided by <code>ScrolledWindow</code>. <p>
+
+<code>Scrollbar_callback</code> is called when the user uses the scrollbar. It is passed a string <code>'x'</code>
+or <code>'y'</code>, one of <code>'set', '-', '--', '+', '++'</code> and (for <code>set</code>) an absolute
+value. Note that the sign of the value passed to <code>TEPinScroll</code> is counter-intuitive. <p>
+
+<code>do_activate</code> (de)activates the scrollbars and calls the relevant TextEdit routine. Moreover, it
+tells the application object if we are now the active window, and updates the menubar. The next few methods
+are update and menu callbacks, and pretty straightforward. Note that <code>do_close</code> can
+return without closing the window (if the document is changed and the users cancels out of the operation).
+Also note the "magic" in <code>menu_save_as</code>
+that set the correct window title. <p>
+
+Things get moderately interesting again at the cut/copy/paste handling, since the TextEdit scrap is
+separate from the desktop scrap. For that reason there are various calls to routines that move the scrap
+back and forth. <code>Have_selection</code> is called by the menubar update code to determine whether cut and
+copy should be enabled. <p>
+
+Understanding the main program is left as an exercise to the reader. <p>
+
+<hr>
+That's all for this example, you could now continue with the <A HREF="waste.html">next example</A>, where we use WASTE, a more-or-less
+TextEdit compatible library with more functionality, to rebuild our editor. Or you can
+return to the <A HREF="index.html">table of contents</A> to pick another topic. <p>
diff --git a/Mac/Demo/textedit/ped.py b/Mac/Demo/textedit/ped.py
new file mode 100644
index 0000000000..3e91b32a65
--- /dev/null
+++ b/Mac/Demo/textedit/ped.py
@@ -0,0 +1,359 @@
+# A minimal text editor.
+#
+# To be done:
+# - Update viewrect after resize
+# - Handle horizontal scrollbar correctly
+# - Functionality: find, etc.
+
+from Carbon.Menu import DrawMenuBar
+from FrameWork import *
+from Carbon import Win
+from Carbon import Qd
+from Carbon import TE
+from Carbon import Scrap
+import os
+import macfs
+
+class TEWindow(ScrolledWindow):
+ def open(self, path, name, data):
+ self.path = path
+ self.name = name
+ r = windowbounds(400, 400)
+ w = Win.NewWindow(r, name, 1, 0, -1, 1, 0)
+ self.wid = w
+ x0, y0, x1, y1 = self.wid.GetWindowPort().GetPortBounds()
+ x0 = x0 + 4
+ y0 = y0 + 4
+ x1 = x1 - 20
+ y1 = y1 - 20
+ vr = dr = x0, y0, x1, y1
+ ##vr = 4, 0, r[2]-r[0]-15, r[3]-r[1]-15
+ ##dr = (0, 0, vr[2], 0)
+ Qd.SetPort(w)
+ Qd.TextFont(4)
+ Qd.TextSize(9)
+ self.ted = TE.TENew(dr, vr)
+ self.ted.TEAutoView(1)
+ self.ted.TESetText(data)
+ w.DrawGrowIcon()
+ self.scrollbars()
+ self.changed = 0
+ self.do_postopen()
+ self.do_activate(1, None)
+
+ def do_idle(self):
+ self.ted.TEIdle()
+
+ def getscrollbarvalues(self):
+ dr = self.ted.destRect
+ vr = self.ted.viewRect
+ height = self.ted.nLines * self.ted.lineHeight
+ vx = self.scalebarvalue(dr[0], dr[2]-dr[0], vr[0], vr[2])
+ vy = self.scalebarvalue(dr[1], dr[1]+height, vr[1], vr[3])
+ print dr, vr, height, vx, vy
+ return None, vy
+
+ def scrollbar_callback(self, which, what, value):
+ if which == 'y':
+ if what == 'set':
+ height = self.ted.nLines * self.ted.lineHeight
+ cur = self.getscrollbarvalues()[1]
+ delta = (cur-value)*height/32767
+ if what == '-':
+ delta = self.ted.lineHeight
+ elif what == '--':
+ delta = (self.ted.viewRect[3]-self.ted.lineHeight)
+ if delta <= 0:
+ delta = self.ted.lineHeight
+ elif what == '+':
+ delta = -self.ted.lineHeight
+ elif what == '++':
+ delta = -(self.ted.viewRect[3]-self.ted.lineHeight)
+ if delta >= 0:
+ delta = -self.ted.lineHeight
+ self.ted.TEPinScroll(0, delta)
+ print 'SCROLL Y', delta
+ else:
+ pass # No horizontal scrolling
+
+ def do_activate(self, onoff, evt):
+ print "ACTIVATE", onoff
+ ScrolledWindow.do_activate(self, onoff, evt)
+ if onoff:
+ self.ted.TEActivate()
+ self.parent.active = self
+ self.parent.updatemenubar()
+ else:
+ self.ted.TEDeactivate()
+
+ def do_update(self, wid, event):
+ Qd.EraseRect(wid.GetWindowPort().GetPortBounds())
+ self.ted.TEUpdate(wid.GetWindowPort().GetPortBounds())
+ self.updatescrollbars()
+
+ def do_contentclick(self, local, modifiers, evt):
+ shifted = (modifiers & 0x200)
+ self.ted.TEClick(local, shifted)
+ self.updatescrollbars()
+ self.parent.updatemenubar()
+
+ def do_char(self, ch, event):
+ self.ted.TESelView()
+ self.ted.TEKey(ord(ch))
+ self.changed = 1
+ self.updatescrollbars()
+ self.parent.updatemenubar()
+
+ def close(self):
+ if self.changed:
+ save = EasyDialogs.AskYesNoCancel('Save window "%s" before closing?'%self.name, 1)
+ if save > 0:
+ self.menu_save()
+ elif save < 0:
+ return
+ if self.parent.active == self:
+ self.parent.active = None
+ self.parent.updatemenubar()
+ del self.ted
+ self.do_postclose()
+
+ def menu_save(self):
+ if not self.path:
+ self.menu_save_as()
+ return # Will call us recursively
+ print 'Saving to ', self.path
+ dhandle = self.ted.TEGetText()
+ data = dhandle.data
+ fp = open(self.path, 'wb') # NOTE: wb, because data has CR for end-of-line
+ fp.write(data)
+ if data[-1] <> '\r': fp.write('\r')
+ fp.close()
+ self.changed = 0
+
+ def menu_save_as(self):
+ path = EasyDialogs.AskFileForSave(message='Save as:')
+ if not path: return
+ self.path = path
+ self.name = os.path.split(self.path)[-1]
+ self.wid.SetWTitle(self.name)
+ self.menu_save()
+
+ def menu_cut(self):
+ self.ted.TESelView()
+ self.ted.TECut()
+ if hasattr(Scrap, 'ZeroScrap'):
+ Scrap.ZeroScrap()
+ else:
+ Scrap.ClearCurrentScrap()
+ TE.TEToScrap()
+ self.updatescrollbars()
+ self.parent.updatemenubar()
+ self.changed = 1
+
+ def menu_copy(self):
+ self.ted.TECopy()
+ if hasattr(Scrap, 'ZeroScrap'):
+ Scrap.ZeroScrap()
+ else:
+ Scrap.ClearCurrentScrap()
+ TE.TEToScrap()
+ self.updatescrollbars()
+ self.parent.updatemenubar()
+
+ def menu_paste(self):
+ TE.TEFromScrap()
+ self.ted.TESelView()
+ self.ted.TEPaste()
+ self.updatescrollbars()
+ self.parent.updatemenubar()
+ self.changed = 1
+
+ def menu_clear(self):
+ self.ted.TESelView()
+ self.ted.TEDelete()
+ self.updatescrollbars()
+ self.parent.updatemenubar()
+ self.changed = 1
+
+ def have_selection(self):
+ return (self.ted.selStart < self.ted.selEnd)
+
+class Ped(Application):
+ def __init__(self):
+ Application.__init__(self)
+ self.num = 0
+ self.active = None
+ self.updatemenubar()
+
+ def makeusermenus(self):
+ self.filemenu = m = Menu(self.menubar, "File")
+ self.newitem = MenuItem(m, "New window", "N", self.open)
+ self.openitem = MenuItem(m, "Open...", "O", self.openfile)
+ self.closeitem = MenuItem(m, "Close", "W", self.closewin)
+ m.addseparator()
+ self.saveitem = MenuItem(m, "Save", "S", self.save)
+ self.saveasitem = MenuItem(m, "Save as...", "", self.saveas)
+ m.addseparator()
+ self.quititem = MenuItem(m, "Quit", "Q", self.quit)
+
+ self.editmenu = m = Menu(self.menubar, "Edit")
+ self.undoitem = MenuItem(m, "Undo", "Z", self.undo)
+ self.cutitem = MenuItem(m, "Cut", "X", self.cut)
+ self.copyitem = MenuItem(m, "Copy", "C", self.copy)
+ self.pasteitem = MenuItem(m, "Paste", "V", self.paste)
+ self.clearitem = MenuItem(m, "Clear", "", self.clear)
+
+ # Not yet implemented:
+ self.undoitem.enable(0)
+
+ # Groups of items enabled together:
+ self.windowgroup = [self.closeitem, self.saveitem, self.saveasitem, self.editmenu]
+ self.focusgroup = [self.cutitem, self.copyitem, self.clearitem]
+ self.windowgroup_on = -1
+ self.focusgroup_on = -1
+ self.pastegroup_on = -1
+
+ def updatemenubar(self):
+ changed = 0
+ on = (self.active <> None)
+ if on <> self.windowgroup_on:
+ for m in self.windowgroup:
+ m.enable(on)
+ self.windowgroup_on = on
+ changed = 1
+ if on:
+ # only if we have an edit menu
+ on = self.active.have_selection()
+ if on <> self.focusgroup_on:
+ for m in self.focusgroup:
+ m.enable(on)
+ self.focusgroup_on = on
+ changed = 1
+ if hasattr(Scrap, 'InfoScrap'):
+ on = (Scrap.InfoScrap()[0] <> 0)
+ else:
+ flavors = Scrap.GetCurrentScrap().GetScrapFlavorInfoList()
+ for tp, info in flavors:
+ if tp == 'TEXT':
+ on = 1
+ break
+ else:
+ on = 0
+ if on <> self.pastegroup_on:
+ self.pasteitem.enable(on)
+ self.pastegroup_on = on
+ changed = 1
+ if changed:
+ DrawMenuBar()
+
+ #
+ # Apple menu
+ #
+
+ def do_about(self, id, item, window, event):
+ EasyDialogs.Message("A simple single-font text editor")
+
+ #
+ # File menu
+ #
+
+ def open(self, *args):
+ self._open(0)
+
+ def openfile(self, *args):
+ self._open(1)
+
+ def _open(self, askfile):
+ if askfile:
+ path = EasyDialogs.AskFileForOpen(typeList=('TEXT',))
+ if not path:
+ return
+ name = os.path.split(path)[-1]
+ try:
+ fp = open(path, 'rb') # NOTE binary, we need cr as end-of-line
+ data = fp.read()
+ fp.close()
+ except IOError, arg:
+ EasyDialogs.Message("IOERROR: %r" % (arg,))
+ return
+ else:
+ path = None
+ name = "Untitled %d"%self.num
+ data = ''
+ w = TEWindow(self)
+ w.open(path, name, data)
+ self.num = self.num + 1
+
+ def closewin(self, *args):
+ if self.active:
+ self.active.close()
+ else:
+ EasyDialogs.Message("No active window?")
+
+ def save(self, *args):
+ if self.active:
+ self.active.menu_save()
+ else:
+ EasyDialogs.Message("No active window?")
+
+ def saveas(self, *args):
+ if self.active:
+ self.active.menu_save_as()
+ else:
+ EasyDialogs.Message("No active window?")
+
+
+ def quit(self, *args):
+ for w in self._windows.values():
+ w.close()
+ if self._windows:
+ return
+ self._quit()
+
+ #
+ # Edit menu
+ #
+
+ def undo(self, *args):
+ pass
+
+ def cut(self, *args):
+ if self.active:
+ self.active.menu_cut()
+ else:
+ EasyDialogs.Message("No active window?")
+
+ def copy(self, *args):
+ if self.active:
+ self.active.menu_copy()
+ else:
+ EasyDialogs.Message("No active window?")
+
+ def paste(self, *args):
+ if self.active:
+ self.active.menu_paste()
+ else:
+ EasyDialogs.Message("No active window?")
+
+ def clear(self, *args):
+ if self.active:
+ self.active.menu_clear()
+ else:
+ EasyDialogs.Message("No active window?")
+
+ #
+ # Other stuff
+ #
+
+ def idle(self, *args):
+ if self.active:
+ self.active.do_idle()
+ else:
+ Qd.SetCursor(Qd.GetQDGlobalsArrow())
+
+def main():
+ App = Ped()
+ App.mainloop()
+
+if __name__ == '__main__':
+ main()
diff --git a/Mac/Extras.ReadMe.txt b/Mac/Extras.ReadMe.txt
new file mode 100644
index 0000000000..2d7fd42ac6
--- /dev/null
+++ b/Mac/Extras.ReadMe.txt
@@ -0,0 +1,5 @@
+This folder contains examples of Python usage and useful scripts and tools.
+
+You should be aware that these are not Macintosh-specific but are shared
+among Python on all platforms, so there are some that only run on Windows
+or Unix or another platform, and/or make little sense on a Macintosh.
diff --git a/Mac/Extras.install.py b/Mac/Extras.install.py
index ab1af71dfd..ce00af3821 100644
--- a/Mac/Extras.install.py
+++ b/Mac/Extras.install.py
@@ -25,23 +25,23 @@ def copycleandir(src, dst):
assert cursrc.startswith(src)
curdst = dst + cursrc[len(src):]
if verbose:
- print("mkdir", curdst)
+ print "mkdir", curdst
if not debug:
if not os.path.exists(curdst):
os.makedirs(curdst)
for fn in files:
if isclean(fn):
if verbose:
- print("copy", os.path.join(cursrc, fn), os.path.join(curdst, fn))
+ print "copy", os.path.join(cursrc, fn), os.path.join(curdst, fn)
if not debug:
shutil.copy2(os.path.join(cursrc, fn), os.path.join(curdst, fn))
else:
if verbose:
- print("skipfile", os.path.join(cursrc, fn))
+ print "skipfile", os.path.join(cursrc, fn)
for i in range(len(dirs)-1, -1, -1):
if not isclean(dirs[i]):
if verbose:
- print("skipdir", os.path.join(cursrc, dirs[i]))
+ print "skipdir", os.path.join(cursrc, dirs[i])
del dirs[i]
def main():
diff --git a/Mac/IDLE/IDLE.app/Contents/MacOS/IDLE b/Mac/IDLE/IDLE.app/Contents/MacOS/IDLE
deleted file mode 100755
index 61b02fff6b..0000000000
--- a/Mac/IDLE/IDLE.app/Contents/MacOS/IDLE
+++ /dev/null
@@ -1,23 +0,0 @@
-#!%prefix%/Resources/Python.app/Contents/MacOS/%exe%
-
-import sys, os
-execdir = os.path.dirname(sys.argv[0])
-executable = os.path.join(execdir, "Python")
-resdir = os.path.join(os.path.dirname(execdir), "Resources")
-libdir = os.path.join(os.path.dirname(execdir), "Frameworks")
-mainprogram = os.path.join(resdir, "idlemain.py")
-
-sys.argv.insert(1, mainprogram)
-if 0 or 0:
- os.environ["PYTHONPATH"] = resdir
- if 0:
- os.environ["PYTHONHOME"] = resdir
-else:
- pypath = os.getenv("PYTHONPATH", "")
- if pypath:
- pypath = ":" + pypath
- os.environ["PYTHONPATH"] = resdir + pypath
-os.environ["PYTHONEXECUTABLE"] = executable
-os.environ["DYLD_LIBRARY_PATH"] = libdir
-os.environ["DYLD_FRAMEWORK_PATH"] = libdir
-os.execve(executable, sys.argv, os.environ)
diff --git a/Mac/IDLE/IDLE.app/Contents/PkgInfo b/Mac/IDLE/IDLE.app/Contents/PkgInfo
deleted file mode 100644
index bd04210fb4..0000000000
--- a/Mac/IDLE/IDLE.app/Contents/PkgInfo
+++ /dev/null
@@ -1 +0,0 @@
-APPL???? \ No newline at end of file
diff --git a/Mac/IDLE/IDLE.app/Contents/Resources/IDLE.icns b/Mac/IDLE/IDLE.app/Contents/Resources/IDLE.icns
deleted file mode 100644
index c12c9da52a..0000000000
--- a/Mac/IDLE/IDLE.app/Contents/Resources/IDLE.icns
+++ /dev/null
Binary files differ
diff --git a/Mac/IDLE/IDLE.app/Contents/Resources/PythonCompiled.icns b/Mac/IDLE/IDLE.app/Contents/Resources/PythonCompiled.icns
deleted file mode 100644
index 7d9f3202c7..0000000000
--- a/Mac/IDLE/IDLE.app/Contents/Resources/PythonCompiled.icns
+++ /dev/null
Binary files differ
diff --git a/Mac/IDLE/IDLE.app/Contents/Resources/PythonSource.icns b/Mac/IDLE/IDLE.app/Contents/Resources/PythonSource.icns
deleted file mode 100644
index 9e35c1ecbe..0000000000
--- a/Mac/IDLE/IDLE.app/Contents/Resources/PythonSource.icns
+++ /dev/null
Binary files differ
diff --git a/Mac/IDLE/IDLE.app/Contents/Info.plist b/Mac/IDLE/Info.plist.in
index 15922c8798..b1fc459902 100644
--- a/Mac/IDLE/IDLE.app/Contents/Info.plist
+++ b/Mac/IDLE/Info.plist.in
@@ -36,7 +36,7 @@
<key>CFBundleExecutable</key>
<string>IDLE</string>
<key>CFBundleGetInfoString</key>
- <string>%version%, © 2001-2011 Python Software Foundation</string>
+ <string>%VERSION%, © 2001-2012 Python Software Foundation</string>
<key>CFBundleIconFile</key>
<string>IDLE.icns</string>
<key>CFBundleIdentifier</key>
@@ -48,10 +48,17 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
- <string>%version%</string>
- <key>CFBundleSignature</key>
- <string>????</string>
+ <string>%VERSION%</string>
<key>CFBundleVersion</key>
- <string>%version%</string>
+ <string>%VERSION%</string>
+<!--
+ <key>LSMinimumSystemVersionByArchitecture</key>
+ <dict>
+ <key>x86_64</key>
+ <string>10.6.0</string>
+ <key>ppc64</key>
+ <string>10.6.0</string>
+ </dict>
+-->
</dict>
</plist>
diff --git a/Mac/IDLE/Makefile.in b/Mac/IDLE/Makefile.in
new file mode 100644
index 0000000000..6ae360c61c
--- /dev/null
+++ b/Mac/IDLE/Makefile.in
@@ -0,0 +1,65 @@
+prefix=@prefix@
+CC=@CC@
+LD=@CC@
+BASECFLAGS=@BASECFLAGS@
+OPT=@OPT@
+CFLAGS=$(BASECFLAGS) $(OPT)
+LDFLAGS=@LDFLAGS@
+srcdir= @srcdir@
+VERSION= @VERSION@
+UNIVERSALSDK=@UNIVERSALSDK@
+builddir= ../..
+PYTHONFRAMEWORK=@PYTHONFRAMEWORK@
+LIPO_32BIT_FLAGS=@LIPO_32BIT_FLAGS@
+
+
+RUNSHARED= @RUNSHARED@
+BUILDEXE= @BUILDEXEEXT@
+BUILDPYTHON= $(builddir)/python$(BUILDEXE)
+
+# Deployment target selected during configure, to be checked
+# by distutils
+MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
+@EXPORT_MACOSX_DEPLOYMENT_TARGET@export MACOSX_DEPLOYMENT_TARGET
+
+BUNDLEBULDER=$(srcdir)/../../Lib/plat-mac/bundlebuilder.py
+
+PYTHONAPPSDIR=@FRAMEWORKINSTALLAPPSPREFIX@/$(PYTHONFRAMEWORK) $(VERSION)
+
+all: IDLE.app
+
+install: IDLE.app $(srcdir)/config-main.def $(srcdir)/config-extensions.def
+ test -d "$(DESTDIR)$(PYTHONAPPSDIR)" || mkdir -p "$(DESTDIR)$(PYTHONAPPSDIR)"
+ -test -d "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app" && rm -r "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app"
+ /bin/cp -PR IDLE.app "$(DESTDIR)$(PYTHONAPPSDIR)"
+ touch "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app"
+ /bin/cp $(srcdir)/config-main.def "$(DESTDIR)$(prefix)/lib/python$(VERSION)/idlelib/config-main.def"
+ /bin/cp $(srcdir)/config-extensions.def "$(DESTDIR)$(prefix)/lib/python$(VERSION)/idlelib/config-extensions.def"
+
+clean:
+ rm -rf IDLE.app
+
+IDLE.app: \
+ $(srcdir)/../Icons/IDLE.icns $(srcdir)/idlemain.py \
+ $(srcdir)/../Icons/PythonSource.icns \
+ $(srcdir)/../Icons/PythonCompiled.icns Info.plist
+ rm -fr IDLE.app
+ $(RUNSHARED) @ARCH_RUN_32BIT@ $(BUILDPYTHON) $(BUNDLEBULDER) \
+ --builddir=. \
+ --name=IDLE \
+ --link-exec \
+ --plist=Info.plist \
+ --mainprogram=$(srcdir)/idlemain.py \
+ --iconfile=$(srcdir)/../Icons/IDLE.icns \
+ --resource=$(srcdir)/../Icons/PythonSource.icns \
+ --resource=$(srcdir)/../Icons/PythonCompiled.icns \
+ --python=$(prefix)/Resources/Python.app/Contents/MacOS/Python \
+ build
+ifneq ($(LIPO_32BIT_FLAGS),)
+ rm "IDLE.app/Contents/MacOS/Python"
+ lipo $(LIPO_32BIT_FLAGS) -output "IDLE.app/Contents/MacOS/Python" "$(BUILDPYTHON)"
+endif
+
+Info.plist: $(srcdir)/Info.plist.in
+ sed 's/%VERSION%/'"`$(RUNSHARED) $(BUILDPYTHON) -c 'import platform; print platform.python_version()'`"'/g' < $(srcdir)/Info.plist.in > Info.plist
+
diff --git a/Mac/IDLE/config-extensions.def b/Mac/IDLE/config-extensions.def
new file mode 100644
index 0000000000..1791b9c0ae
--- /dev/null
+++ b/Mac/IDLE/config-extensions.def
@@ -0,0 +1,93 @@
+# config-extensions.def
+#
+# IDLE reads several config files to determine user preferences. This
+# file is the default configuration file for IDLE extensions settings.
+#
+# Each extension must have at least one section, named after the extension
+# module. This section must contain an 'enable' item (=1 to enable the
+# extension, =0 to disable it), it may contain 'enable_editor' or 'enable_shell'
+# items, to apply it only to editor/shell windows, and may also contain any
+# other general configuration items for the extension.
+#
+# Each extension must define at least one section named ExtensionName_bindings
+# or ExtensionName_cfgBindings. If present, ExtensionName_bindings defines
+# virtual event bindings for the extension that are not user re-configurable.
+# If present, ExtensionName_cfgBindings defines virtual event bindings for the
+# extension that may be sensibly re-configured.
+#
+# If there are no keybindings for a menus' virtual events, include lines like
+# <<toggle-code-context>>= (See [CodeContext], below.)
+#
+# Currently it is necessary to manually modify this file to change extension
+# key bindings and default values. To customize, create
+# ~/.idlerc/config-extensions.cfg and append the appropriate customized
+# section(s). Those sections will override the defaults in this file.
+#
+# Note: If a keybinding is already in use when the extension is
+# loaded, the extension's virtual event's keybinding will be set to ''.
+#
+# See config-keys.def for notes on specifying keys and extend.txt for
+# information on creating IDLE extensions.
+
+[FormatParagraph]
+enable=1
+[FormatParagraph_cfgBindings]
+format-paragraph=<Option-Key-q>
+
+[AutoExpand]
+enable=1
+[AutoExpand_cfgBindings]
+expand-word=<Option-Key-slash>
+
+[ZoomHeight]
+enable=1
+[ZoomHeight_cfgBindings]
+zoom-height=<Option-Key-0>
+
+[ScriptBinding]
+enable=1
+[ScriptBinding_cfgBindings]
+run-module=<Key-F5>
+check-module=<Option-Key-x>
+
+[CallTips]
+enable=1
+[CallTips_cfgBindings]
+force-open-calltip=<Control-Key-backslash>
+[CallTips_bindings]
+try-open-calltip=<KeyRelease-parenleft>
+refresh-calltip=<KeyRelease-parenright> <KeyRelease-0>
+
+[ParenMatch]
+enable=1
+style= expression
+flash-delay= 500
+bell= 1
+[ParenMatch_cfgBindings]
+flash-paren=<Control-Key-0>
+[ParenMatch_bindings]
+paren-closed=<KeyRelease-parenright> <KeyRelease-bracketright> <KeyRelease-braceright>
+
+[AutoComplete]
+enable=1
+popupwait=2000
+[AutoComplete_cfgBindings]
+force-open-completions=<Control-Key-space>
+[AutoComplete_bindings]
+autocomplete=<Key-Tab>
+try-open-completions=<KeyRelease-period> <KeyRelease-slash> <KeyRelease-backslash>
+
+[CodeContext]
+enable=1
+enable_shell=0
+numlines=3
+visible=0
+bgcolor=LightGray
+fgcolor=Black
+[CodeContext_bindings]
+toggle-code-context=
+
+[RstripExtension]
+enable=1
+enable_shell=0
+enable_editor=1
diff --git a/Mac/IDLE/config-main.def b/Mac/IDLE/config-main.def
new file mode 100644
index 0000000000..4691a85290
--- /dev/null
+++ b/Mac/IDLE/config-main.def
@@ -0,0 +1,79 @@
+# IDLE reads several config files to determine user preferences. This
+# file is the default config file for general idle settings.
+#
+# When IDLE starts, it will look in
+# the following two sets of files, in order:
+#
+# default configuration
+# ---------------------
+# config-main.def the default general config file
+# config-extensions.def the default extension config file
+# config-highlight.def the default highlighting config file
+# config-keys.def the default keybinding config file
+#
+# user configuration
+# -------------------
+# ~/.idlerc/config-main.cfg the user general config file
+# ~/.idlerc/config-extensions.cfg the user extension config file
+# ~/.idlerc/config-highlight.cfg the user highlighting config file
+# ~/.idlerc/config-keys.cfg the user keybinding config file
+#
+# On Windows2000 and Windows XP the .idlerc directory is at
+# Documents and Settings\<username>\.idlerc
+#
+# On Windows98 it is at c:\.idlerc
+#
+# Any options the user saves through the config dialog will be saved to
+# the relevant user config file. Reverting any general setting to the
+# default causes that entry to be wiped from the user file and re-read
+# from the default file. User highlighting themes or keybinding sets are
+# retained unless specifically deleted within the config dialog. Choosing
+# one of the default themes or keysets just applies the relevant settings
+# from the default file.
+#
+# Additional help sources are listed in the [HelpFiles] section and must be
+# viewable by a web browser (or the Windows Help viewer in the case of .chm
+# files). These sources will be listed on the Help menu. The pattern is
+# <sequence_number = menu item;/path/to/help/source>
+# You can't use a semi-colon in a menu item or path. The path will be platform
+# specific because of path separators, drive specs etc.
+#
+# It is best to use the Configuration GUI to set up additional help sources!
+# Example:
+#1 = My Extra Help Source;/usr/share/doc/foo/index.html
+#2 = Another Help Source;/path/to/another.pdf
+
+[General]
+editor-on-startup= 0
+autosave= 0
+print-command-posix=lpr %s
+print-command-win=start /min notepad /p %s
+delete-exitfunc= 1
+
+[EditorWindow]
+width= 80
+height= 40
+font= courier
+font-size= 10
+font-bold= 0
+encoding= none
+
+[FormatParagraph]
+paragraph=70
+
+[Indent]
+use-spaces= 1
+num-spaces= 4
+
+[Theme]
+default= 1
+name= IDLE Classic
+
+[Keys]
+default= 1
+name= IDLE Classic OSX
+
+[History]
+cyclic=1
+
+[HelpFiles]
diff --git a/Mac/IDLE/IDLE.app/Contents/Resources/idlemain.py b/Mac/IDLE/idlemain.py
index d6803ba832..8b8beb93d0 100644
--- a/Mac/IDLE/IDLE.app/Contents/Resources/idlemain.py
+++ b/Mac/IDLE/idlemain.py
@@ -48,7 +48,7 @@ os.chdir(os.path.expanduser('~/Documents'))
# the interpreter in the framework, by following the symlink
# exported in PYTHONEXECUTABLE.
pyex = os.environ['PYTHONEXECUTABLE']
-sys.executable = os.path.join(os.path.dirname(pyex), os.readlink(pyex))
+sys.executable = os.path.join(sys.prefix, 'bin', 'python%d.%d'%(sys.version_info[:2]))
# Remove any sys.path entries for the Resources dir in the IDLE.app bundle.
p = pyex.partition('.app')
@@ -68,6 +68,8 @@ for idx, value in enumerate(sys.argv):
break
# Now it is safe to import idlelib.
+from idlelib import macosxSupport
+macosxSupport._appbundle = True
from idlelib.PyShell import main
if __name__ == '__main__':
main()
diff --git a/Mac/Makefile.in b/Mac/Makefile.in
index 5e57b57942..a6d78fbd44 100644
--- a/Mac/Makefile.in
+++ b/Mac/Makefile.in
@@ -20,8 +20,6 @@ CC=@CC@
MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
export MACOSX_DEPLOYMENT_TARGET
-
-
# These are normally glimpsed from the previous set
bindir=$(prefix)/bin
PYTHONAPPSDIR=@FRAMEWORKINSTALLAPPSPREFIX@/$(PYTHONFRAMEWORK) $(VERSION)
@@ -44,23 +42,30 @@ CPMAC=/Developer/Tools/CpMac
APPTEMPLATE=$(srcdir)/Resources/app
APPSUBDIRS=MacOS Resources
+CACHERSRC=$(srcdir)/scripts/cachersrc.py
compileall=$(srcdir)/../Lib/compileall.py
-installapps: install_Python install_pythonw install_PythonLauncher install_IDLE \
- checkapplepython
+installapps: install_Python install_pythonw install_BuildApplet install_PythonLauncher \
+ install_IDLE checkapplepython 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/python3"
- ln -sf pythonw$(VERSION) "$(DESTDIR)$(prefix)/bin/pythonw3"
+ ln -sf python$(VERSION) "$(DESTDIR)$(prefix)/bin/python2"
+ ln -sf python2 "$(DESTDIR)$(prefix)/bin/python"
+ ln -sf pythonw$(VERSION) "$(DESTDIR)$(prefix)/bin/pythonw2"
+ ln -sf pythonw2 "$(DESTDIR)$(prefix)/bin/pythonw"
ifneq ($(LIPO_32BIT_FLAGS),)
lipo $(LIPO_32BIT_FLAGS) -output $(DESTDIR)$(prefix)/bin/python$(VERSION)-32 pythonw
lipo $(LIPO_32BIT_FLAGS) -output $(DESTDIR)$(prefix)/bin/pythonw$(VERSION)-32 pythonw
- ln -sf pythonw$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/pythonw3-32"
- ln -sf python$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/python3-32"
+ ln -sf python$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/python2-32"
+ ln -sf python2-32 "$(DESTDIR)$(prefix)/bin/python-32"
+ ln -sf pythonw$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/pythonw2-32"
+ ln -sf pythonw2-32 "$(DESTDIR)$(prefix)/bin/pythonw-32"
endif
+
#
# Install unix tools in /usr/local/bin. These are just aliases for the
# actual installation inside the framework.
@@ -69,13 +74,24 @@ installunixtools:
if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then \
$(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\
fi
- for fn in python3 pythonw3 idle3 pydoc3 python3-config \
+ for fn in python pythonw idle pydoc python-config smtpd.py 2to3 \
+ python2 pythonw2 idle2 \
+ pydoc2 python2-config smtpd2.py \
+ 2to3-2 \
python$(VERSION) pythonw$(VERSION) idle$(VERSION) \
- pydoc$(VERSION) python$(VERSION)-config 2to3 \
+ pydoc$(VERSION) python$(VERSION)-config smtpd$(VERSION).py \
2to3-$(VERSION) ;\
do \
ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
done
+ifneq ($(LIPO_32BIT_FLAGS),)
+ for fn in python-32 pythonw-32 \
+ python2-32 pythonw2-32 \
+ python$(VERSION)-32 pythonw$(VERSION)-32 ;\
+ do \
+ ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
+ done
+endif
#
@@ -86,10 +102,43 @@ altinstallunixtools:
$(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\
fi
for fn in python$(VERSION) pythonw$(VERSION) idle$(VERSION) \
- pydoc$(VERSION) python$(VERSION)-config 2to3-$(VERSION);\
+ pydoc$(VERSION) python$(VERSION)-config smtpd$(VERSION).py ;\
do \
ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
done
+ifneq ($(LIPO_32BIT_FLAGS),)
+ for fn in python$(VERSION)-32 pythonw$(VERSION)-32 ;\
+ do \
+ ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
+ done
+endif
+ ln -fs "$(prefix)/bin/2to3-$(VERSION)" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/2to3-$(VERSION)" ;\
+
+# 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 ;\
+ do \
+ if [ -h "$(DESTDIR)$(prefix)/bin/$${fn}" ]; then \
+ continue ;\
+ fi ;\
+ mv "$(DESTDIR)$(prefix)/bin/$${fn}" "$(DESTDIR)$(prefix)/bin/$${fn}$(VERSION)" ;\
+ ln -sf "$${fn}$(VERSION)" "$(DESTDIR)$(prefix)/bin/$${fn}2" ;\
+ ln -sf "$${fn}2" "$(DESTDIR)$(prefix)/bin/$${fn}" ;\
+ done
+ 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/smtpd2.py" ;\
+ ln -sf "smtpd2.py" "$(DESTDIR)$(prefix)/bin/smtpd.py" ;\
+ fi
+ if [ ! -h "$(DESTDIR)$(prefix)/bin/2to3" ]; then \
+ mv "$(DESTDIR)$(prefix)/bin/2to3" "$(DESTDIR)$(prefix)/bin/2to3-$(VERSION)" ;\
+ ln -sf "2to3-$(VERSION)" "$(DESTDIR)$(prefix)/bin/2to3-2" ;\
+ ln -sf "2to3-2" "$(DESTDIR)$(prefix)/bin/2to3" ;\
+ fi
+
pythonw: $(srcdir)/Tools/pythonw.c Makefile
$(CC) $(LDFLAGS) -DPYTHONFRAMEWORK='"$(PYTHONFRAMEWORK)"' -o $@ $(srcdir)/Tools/pythonw.c -I.. -I$(srcdir)/../Include ../$(PYTHONFRAMEWORK).framework/Versions/$(VERSION)/$(PYTHONFRAMEWORK)
@@ -150,38 +199,88 @@ install_Python:
install_IDLE:
- test -d "$(DESTDIR)$(PYTHONAPPSDIR)" || mkdir -p "$(DESTDIR)$(PYTHONAPPSDIR)"
- -test -d "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app" && rm -rf "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app"
- /bin/cp -PR "$(srcdir)/IDLE/IDLE.app" "$(DESTDIR)$(PYTHONAPPSDIR)"
- ln -sf "$(INSTALLED_PYTHONAPP)" "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app/Contents/MacOS/Python"
- sed -e "s!%prefix%!$(prefix)!g" -e 's!%exe%!$(PYTHONFRAMEWORK)!g' < "$(srcdir)/IDLE/IDLE.app/Contents/MacOS/IDLE" > "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app/Contents/MacOS/IDLE"
- sed "s!%version%!`$(RUNSHARED) $(BUILDPYTHON) -c 'import platform; print(platform.python_version())'`!g" < "$(srcdir)/IDLE/IDLE.app/Contents/Info.plist" > "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app/Contents/Info.plist"
- if [ -f "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def" ]; then \
- /bin/cp -p "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def" \
- "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def~" ; \
- sed -e 's!name= IDLE Classic Windows!name= IDLE Classic OSX!g' \
- < "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def~" \
- > "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def" ; \
- rm "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def~" ; \
- fi
- if [ -f "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def" ]; then \
- /bin/cp -p "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def" \
- "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def~" ; \
- sed -e 's!zoom-height=<Alt-Key-2>!zoom-height=<Option-Key-0>!g' \
- -e 's!<Alt-Key-!<Option-Key-!g' \
- < "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def~" \
- > "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def" ; \
- rm "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def~" ; \
- fi
- touch "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app"
+ cd IDLE && make install
+
+install_BuildApplet:
+ $(RUNSHARED) @ARCH_RUN_32BIT@ $(BUILDPYTHON) $(srcdir)/scripts/BuildApplet.py \
+ --destroot "$(DESTDIR)" \
+ --python=$(prefix)/Resources/Python.app/Contents/MacOS/Python \
+ --output "$(DESTDIR)$(PYTHONAPPSDIR)/Build Applet.app" \
+ $(srcdir)/scripts/BuildApplet.py
+ifneq ($(LIPO_32BIT_FLAGS),)
+ rm "$(DESTDIR)$(PYTHONAPPSDIR)/Build Applet.app/Contents/MacOS/Python"
+ lipo $(LIPO_32BIT_FLAGS) -output "$(DESTDIR)$(PYTHONAPPSDIR)/Build Applet.app/Contents/MacOS/Python" $(BUILDPYTHON)
+endif
+
+MACLIBDEST=$(LIBDEST)/plat-mac
+MACTOOLSDEST=$(prefix)/Mac/Tools
+MACTOOLSSRC=$(srcdir)/Mac/Tools
+MACTOOLSSUBDIRS=IDE
+
+installmacsubtree:
+ @for i in $(MACTOOLSDEST); \
+ do \
+ if test ! -d $(DESTDIR)$$i; then \
+ echo "Creating directory $(DESTDIR)$$i"; \
+ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
+ else true; \
+ fi; \
+ done
+ @for d in $(MACTOOLSSUBDIRS); \
+ do \
+ a=$(MACTOOLSSRC)/$$d; \
+ if test ! -d $$a; then continue; else true; fi; \
+ b=$(DESTDIR)$(MACTOOLSDEST)/$$d; \
+ if test ! -d $$b; then \
+ echo "Creating directory $$b"; \
+ $(INSTALL) -d -m $(DIRMODE) $$b; \
+ else true; \
+ fi; \
+ done
+ @for d in $(MACTOOLSSUBDIRS); \
+ do \
+ a=$(MACTOOLSSRC)/$$d; \
+ if test ! -d $$a; then continue; else true; fi; \
+ b=$(DESTDIR)$(MACTOOLSDEST)/$$d; \
+ for i in $$a/*; \
+ do \
+ case $$i in \
+ *CVS) ;; \
+ *.svn) ;; \
+ *.py[co]) ;; \
+ *.orig) ;; \
+ *~) ;; \
+ *.rsrc) \
+ echo $(CPMAC) $$i $$b ; \
+ $(CPMAC) $$i $$b ; \
+ ;; \
+ *) \
+ if test -d $$i; then continue; fi; \
+ if test -x $$i; then \
+ echo $(INSTALL_SCRIPT) $$i $$b; \
+ $(INSTALL_SCRIPT) $$i $$b; \
+ else \
+ echo $(INSTALL_DATA) $$i $$b; \
+ $(INSTALL_DATA) $$i $$b; \
+ fi;; \
+ esac; \
+ done; \
+ done
+
+
+ $(RUNSHARED) @ARCH_RUN_32BIT@ $(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)
$(INSTALLED_PYTHONAPP): install_Python
-installextras: $(srcdir)/Extras.install.py
- $(INSTALL) -d "$(DESTDIR)$(prefix)/share/doc/python$(VERSION)/examples"
- $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/../Tools \
- "$(DESTDIR)$(prefix)/share/doc/python$(VERSION)/examples/Tools" ; \
- chmod -R ugo+rX,go-w "$(DESTDIR)$(prefix)/share/doc/python$(VERSION)/examples/Tools"
+installextras: $(srcdir)/Extras.ReadMe.txt $(srcdir)/Extras.install.py
+ $(INSTALL) -d "$(DESTDIR)$(PYTHONAPPSDIR)/Extras"
+ $(INSTALL) $(srcdir)/Extras.ReadMe.txt "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/ReadMe.txt"
+ $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/../Demo \
+ "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo"
+ $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/Demo \
+ "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo.Mac"
checkapplepython: $(srcdir)/Tools/fixapplepython23.py
@@ -194,6 +293,7 @@ checkapplepython: $(srcdir)/Tools/fixapplepython23.py
clean:
rm pythonw
cd PythonLauncher && make clean
+ cd IDLE && make clean
Makefile: $(srcdir)/Makefile.in ../config.status
cd .. && CONFIG_FILES=Mac/Makefile CONFIG_HEADERS= $(SHELL) ./config.status
diff --git a/Mac/Modules/ColorPickermodule.c b/Mac/Modules/ColorPickermodule.c
new file mode 100644
index 0000000000..688c46846e
--- /dev/null
+++ b/Mac/Modules/ColorPickermodule.c
@@ -0,0 +1,90 @@
+/******************************************************************
+Copyright 1998 by Just van Rossum, Den Haag, The Netherlands.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Just van Rossum not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+JUST VAN ROSSUM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+EVENT SHALL JUST VAN ROSSUM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+
+******************************************************************/
+
+#include <Carbon/Carbon.h>
+#include "Python.h"
+#include "pymactoolbox.h"
+
+/* ----------------------------------------------------- */
+
+
+#ifndef __LP64__
+
+static char cp_GetColor__doc__[] =
+"GetColor(prompt, (r, g, b)) -> (r, g, b), ok"
+;
+
+static PyObject *
+cp_GetColor(PyObject *self, PyObject *args)
+{
+ RGBColor inColor, outColor;
+ Boolean ok;
+ Point where = {0, 0};
+ Str255 prompt;
+
+ if (!PyArg_ParseTuple(args, "O&O&", PyMac_GetStr255, prompt, QdRGB_Convert, &inColor))
+ return NULL;
+
+ ok = GetColor(where, prompt, &inColor, &outColor);
+
+ 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 */
+};
+
+
+/* Initialization function for the module (*must* be called initColorPicker) */
+
+static char cp_module_documentation[] =
+""
+;
+
+void initColorPicker(void)
+{
+ PyObject *m;
+
+ if (PyErr_WarnPy3k("In 3.x, the ColorPicker module is removed.", 1) < 0)
+ return;
+
+ /* Create the module and add the functions */
+ m = Py_InitModule4("ColorPicker", cp_methods,
+ cp_module_documentation,
+ (PyObject*)NULL,PYTHON_API_VERSION);
+
+ /* Add symbolic constants to the module here */
+
+ /* XXXX Add constants here */
+
+ /* Check for errors */
+ if (PyErr_Occurred())
+ Py_FatalError("can't initialize module ColorPicker");
+}
+
diff --git a/Mac/Modules/MacOS.c b/Mac/Modules/MacOS.c
new file mode 100644
index 0000000000..28de4f5772
--- /dev/null
+++ b/Mac/Modules/MacOS.c
@@ -0,0 +1,739 @@
+/***********************************************************
+Copyright 1991-1997 by Stichting Mathematisch Centrum, Amsterdam,
+The Netherlands.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of Stichting Mathematisch
+Centrum or CWI not be used in advertising or publicity pertaining to
+distribution of the software without specific, written prior permission.
+
+STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
+THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
+FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+******************************************************************/
+
+/* Macintosh OS-specific interface */
+
+#include "Python.h"
+#include "pymactoolbox.h"
+
+#include <Carbon/Carbon.h>
+#include <ApplicationServices/ApplicationServices.h>
+
+#include <arpa/inet.h> /* for ntohl, htonl */
+
+
+#ifndef HAVE_OSX105_SDK
+typedef SInt16 FSIORefNum;
+#endif
+
+static PyObject *MacOS_Error; /* Exception MacOS.Error */
+
+#define PATHNAMELEN 1024
+
+/* ----------------------------------------------------- */
+
+/* Declarations for objects of type Resource fork */
+
+typedef struct {
+ PyObject_HEAD
+ FSIORefNum fRefNum;
+ int isclosed;
+} rfobject;
+
+static PyTypeObject Rftype;
+
+
+
+/* ---------------------------------------------------------------- */
+
+static void
+do_close(rfobject *self)
+{
+ if (self->isclosed ) return;
+ (void)FSCloseFork(self->fRefNum);
+ self->isclosed = 1;
+}
+
+static char rf_read__doc__[] =
+"Read data from resource fork"
+;
+
+static PyObject *
+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");
+ return NULL;
+ }
+
+ if (!PyArg_ParseTuple(args, "l", &n))
+ return NULL;
+
+ v = PyBytes_FromStringAndSize((char *)NULL, n);
+ if (v == NULL)
+ return NULL;
+
+ err = FSReadFork(self->fRefNum, fsAtMark, 0, n, PyString_AsString(v), &n2);
+ if (err && err != eofErr) {
+ PyMac_Error(err);
+ Py_DECREF(v);
+ return NULL;
+ }
+ _PyString_Resize(&v, n2);
+ return v;
+}
+
+
+static char rf_write__doc__[] =
+"Write to resource fork"
+;
+
+static PyObject *
+rf_write(rfobject *self, PyObject *args)
+{
+ char *buffer;
+ long size;
+ OSErr err;
+
+ if (self->isclosed) {
+ PyErr_SetString(PyExc_ValueError, "Operation on closed file");
+ return NULL;
+ }
+ if (!PyArg_ParseTuple(args, "s#", &buffer, &size))
+ return NULL;
+ err = FSWriteFork(self->fRefNum, fsAtMark, 0, size, buffer, NULL);
+ if (err) {
+ PyMac_Error(err);
+ return NULL;
+ }
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+
+static char rf_seek__doc__[] =
+"Set file position"
+;
+
+static PyObject *
+rf_seek(rfobject *self, PyObject *args)
+{
+ long amount;
+ int whence = SEEK_SET;
+ 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)) {
+ return NULL;
+ }
+
+ switch (whence) {
+ case SEEK_CUR:
+ mode = fsFromMark;
+ break;
+ case SEEK_END:
+ mode = fsFromLEOF;
+ break;
+ case SEEK_SET:
+ mode = fsFromStart;
+ break;
+ default:
+ PyErr_BadArgument();
+ return NULL;
+ }
+
+ err = FSSetForkPosition(self->fRefNum, mode, amount);
+ if (err != noErr) {
+ PyMac_Error(err);
+ return NULL;
+ }
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+
+static char rf_tell__doc__[] =
+"Get file position"
+;
+
+static PyObject *
+rf_tell(rfobject *self, PyObject *args)
+{
+ long long where;
+ OSErr err;
+
+ if (self->isclosed) {
+ PyErr_SetString(PyExc_ValueError, "Operation on closed file");
+ return NULL;
+ }
+ if (!PyArg_ParseTuple(args, ""))
+ return NULL;
+
+ err = FSGetForkPosition(self->fRefNum, &where);
+ if (err != noErr) {
+ PyMac_Error(err);
+ return NULL;
+ }
+ return PyLong_FromLongLong(where);
+}
+
+static char rf_close__doc__[] =
+"Close resource fork"
+;
+
+static PyObject *
+rf_close(rfobject *self, PyObject *args)
+{
+ if (!PyArg_ParseTuple(args, ""))
+ return NULL;
+ do_close(self);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+
+static struct PyMethodDef rf_methods[] = {
+ {"read", (PyCFunction)rf_read, 1, rf_read__doc__},
+ {"write", (PyCFunction)rf_write, 1, rf_write__doc__},
+ {"seek", (PyCFunction)rf_seek, 1, rf_seek__doc__},
+ {"tell", (PyCFunction)rf_tell, 1, rf_tell__doc__},
+ {"close", (PyCFunction)rf_close, 1, rf_close__doc__},
+
+ {NULL, NULL} /* sentinel */
+};
+
+/* ---------- */
+
+
+static rfobject *
+newrfobject(void)
+{
+ rfobject *self;
+
+ self = PyObject_NEW(rfobject, &Rftype);
+ if (self == NULL)
+ return NULL;
+ self->isclosed = 1;
+ return self;
+}
+
+
+static void
+rf_dealloc(rfobject *self)
+{
+ do_close(self);
+ PyObject_DEL(self);
+}
+
+static PyObject *
+rf_getattr(rfobject *self, char *name)
+{
+ return Py_FindMethod(rf_methods, (PyObject *)self, name);
+}
+
+static char Rftype__doc__[] =
+"Resource fork file object"
+;
+
+static PyTypeObject Rftype = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "MacOS.ResourceFork", /*tp_name*/
+ sizeof(rfobject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor)rf_dealloc, /*tp_dealloc*/
+ (printfunc)0, /*tp_print*/
+ (getattrfunc)rf_getattr, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc)0, /*tp_compare*/
+ (reprfunc)0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ (hashfunc)0, /*tp_hash*/
+ (ternaryfunc)0, /*tp_call*/
+ (reprfunc)0, /*tp_str*/
+
+ /* Space for future expansion */
+ 0L,0L,0L,0L,
+ Rftype__doc__ /* Documentation string */
+};
+
+
+/* End of code for Resource fork objects */
+/* -------------------------------------------------------- */
+
+/*----------------------------------------------------------------------*/
+/* Miscellaneous File System Operations */
+
+static char getcrtp_doc[] = "Get MacOS 4-char creator and type for a file";
+
+static PyObject *
+MacOS_GetCreatorAndType(PyObject *self, PyObject *args)
+{
+ PyObject *creator, *type, *res;
+ OSErr err;
+ FSRef ref;
+ FSCatalogInfo cataloginfo;
+ FileInfo* finfo;
+
+ 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);
+ }
+
+ info.fdCreator = ntohl(info.fdCreator);
+ info.fdType = ntohl(info.fdType);
+
+ 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;
+#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 = ntohl(finfo->fileCreator);
+ finfo->fileType = ntohl(finfo->fileType);
+ 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);
+ return res;
+}
+
+static char setcrtp_doc[] = "Set MacOS 4-char creator and type for a file";
+
+static PyObject *
+MacOS_SetCreatorAndType(PyObject *self, PyObject *args)
+{
+ ResType creator, type;
+ 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;
+#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;
+}
+
+
+static char geterr_doc[] = "Convert OSErr number to string";
+
+static PyObject *
+MacOS_GetErrorString(PyObject *self, PyObject *args)
+{
+ int err;
+ char buf[256];
+ Handle h;
+ char *str;
+ static int errors_loaded;
+
+ if (!PyArg_ParseTuple(args, "i", &err))
+ return NULL;
+
+ h = GetResource('Estr', err);
+ if (!h && !errors_loaded) {
+ /*
+ ** Attempt to open the resource file containing the
+ ** Estr resources. We ignore all errors. We also try
+ ** this only once.
+ */
+ PyObject *m, *rv;
+ errors_loaded = 1;
+
+ m = PyImport_ImportModuleNoBlock("macresource");
+ if (!m) {
+ if (Py_VerboseFlag)
+ PyErr_Print();
+ PyErr_Clear();
+ }
+ else {
+ rv = PyObject_CallMethod(m, "open_error_resource", "");
+ if (!rv) {
+ if (Py_VerboseFlag)
+ PyErr_Print();
+ PyErr_Clear();
+ }
+ else {
+ Py_DECREF(rv);
+ /* And try again... */
+ h = GetResource('Estr', err);
+ }
+ Py_DECREF(m);
+ }
+ }
+ /*
+ ** Whether the code above succeeded or not, we won't try
+ ** again.
+ */
+ errors_loaded = 1;
+
+ if (h) {
+ HLock(h);
+ str = (char *)*h;
+ memcpy(buf, str+1, (unsigned char)str[0]);
+ buf[(unsigned char)str[0]] = '\0';
+ HUnlock(h);
+ ReleaseResource(h);
+ }
+ else {
+ PyOS_snprintf(buf, sizeof(buf), "Mac OS error code %d", err);
+ }
+
+ return Py_BuildValue("s", buf);
+}
+
+
+#ifndef __LP64__
+
+static char splash_doc[] = "Open a splash-screen dialog by resource-id (0=close)";
+
+static PyObject *
+MacOS_splash(PyObject *self, PyObject *args)
+{
+ int resid = -1;
+ static DialogPtr curdialog = NULL;
+ DialogPtr olddialog;
+ WindowRef theWindow;
+ CGrafPtr thePort;
+#if 0
+ short xpos, ypos, width, height, swidth, sheight;
+#endif
+
+ if (!PyArg_ParseTuple(args, "|i", &resid))
+ return NULL;
+ olddialog = curdialog;
+ curdialog = NULL;
+
+ if ( resid != -1 ) {
+ curdialog = GetNewDialog(resid, NULL, (WindowPtr)-1);
+ if ( curdialog ) {
+ theWindow = GetDialogWindow(curdialog);
+ thePort = GetWindowPort(theWindow);
+#if 0
+ width = thePort->portRect.right - thePort->portRect.left;
+ height = thePort->portRect.bottom - thePort->portRect.top;
+ swidth = qd.screenBits.bounds.right - qd.screenBits.bounds.left;
+ sheight = qd.screenBits.bounds.bottom - qd.screenBits.bounds.top - LMGetMBarHeight();
+ xpos = (swidth-width)/2;
+ ypos = (sheight-height)/5 + LMGetMBarHeight();
+ MoveWindow(theWindow, xpos, ypos, 0);
+ ShowWindow(theWindow);
+#endif
+ DrawDialog(curdialog);
+ }
+ }
+ if (olddialog)
+ DisposeDialog(olddialog);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static char DebugStr_doc[] = "Switch to low-level debugger with a message";
+
+static PyObject *
+MacOS_DebugStr(PyObject *self, PyObject *args)
+{
+ Str255 message;
+ PyObject *object = 0;
+
+ 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 *
+MacOS_SysBeep(PyObject *self, PyObject *args)
+{
+ int duration = 6;
+
+ if (!PyArg_ParseTuple(args, "|i", &duration))
+ return NULL;
+ SysBeep(duration);
+ Py_INCREF(Py_None);
+ 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."
+ ;
+
+static PyObject *
+MacOS_WMAvailable(PyObject *self, PyObject *args)
+{
+ static PyObject *rv = NULL;
+
+ if (!PyArg_ParseTuple(args, ""))
+ return NULL;
+ if (!rv) {
+ ProcessSerialNumber psn;
+
+ /*
+ ** This is a fairly innocuous call to make if we don't have a window
+ ** manager, or if we have no permission to talk to it. It will print
+ ** a message on stderr, but at least it won't abort the process.
+ ** It appears the function caches the result itself, and it's cheap, so
+ ** no need for us to cache.
+ */
+#ifdef kCGNullDirectDisplay
+ /* On 10.1 CGMainDisplayID() isn't available, and
+ ** kCGNullDirectDisplay isn't defined.
+ */
+ if (CGMainDisplayID() == 0) {
+ rv = Py_False;
+ } else {
+#else
+ {
+#endif
+ if (GetCurrentProcess(&psn) < 0 ||
+ SetFrontProcess(&psn) < 0) {
+ rv = Py_False;
+ } else {
+ rv = Py_True;
+ }
+ }
+ }
+ Py_INCREF(rv);
+ return rv;
+}
+
+static char GetTicks_doc[] = "Return number of ticks since bootup";
+
+static PyObject *
+MacOS_GetTicks(PyObject *self, PyObject *args)
+{
+ return Py_BuildValue("i", (int)TickCount());
+}
+
+static char openrf_doc[] = "Open resource fork of a file";
+
+static PyObject *
+MacOS_openrf(PyObject *self, PyObject *args)
+{
+ OSErr err;
+ char *mode = "r";
+ FSRef ref;
+ SInt8 permission = fsRdPerm;
+ rfobject *fp;
+ HFSUniStr255 name;
+
+ if (!PyArg_ParseTuple(args, "O&|s", PyMac_GetFSRef, &ref, &mode))
+ return NULL;
+ while (*mode) {
+ switch (*mode++) {
+ case '*': break;
+ case 'r': permission = fsRdPerm; break;
+ case 'w': permission = fsWrPerm; break;
+ case 'b': break;
+ default:
+ PyErr_BadArgument();
+ return NULL;
+ }
+ }
+
+ err = FSGetResourceForkName(&name);
+ if (err != noErr) {
+ PyMac_Error(err);
+ return NULL;
+ }
+
+ if ( (fp = newrfobject()) == NULL )
+ return NULL;
+
+
+ err = FSOpenFork(&ref, name.length, name.unicode, permission, &fp->fRefNum);
+ if (err != noErr) {
+ Py_DECREF(fp);
+ PyMac_Error(err);
+ return NULL;
+ }
+ fp->isclosed = 0;
+ return (PyObject *)fp;
+}
+
+
+
+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},
+ {"SysBeep", MacOS_SysBeep, 1, SysBeep_doc},
+#endif /* __LP64__ */
+ {"GetTicks", MacOS_GetTicks, 1, GetTicks_doc},
+ {"WMAvailable", MacOS_WMAvailable, 1, WMAvailable_doc},
+ {NULL, NULL} /* Sentinel */
+};
+
+
+void
+initMacOS(void)
+{
+ PyObject *m, *d;
+
+ if (PyErr_WarnPy3k("In 3.x, the MacOS module is removed.", 1))
+ return;
+
+ m = Py_InitModule("MacOS", MacOS_Methods);
+ d = PyModule_GetDict(m);
+
+ /* Initialize MacOS.Error exception */
+ MacOS_Error = PyMac_GetOSErrException();
+ if (MacOS_Error == NULL || PyDict_SetItemString(d, "Error", MacOS_Error) != 0)
+ return;
+ Rftype.ob_type = &PyType_Type;
+ Py_INCREF(&Rftype);
+ if (PyDict_SetItemString(d, "ResourceForkType", (PyObject *)&Rftype) != 0)
+ return;
+ /*
+ ** This is a hack: the following constant added to the id() of a string
+ ** object gives you the address of the data. Unfortunately, it is needed for
+ ** some of the image and sound processing interfaces on the mac:-(
+ */
+ {
+ PyStringObject *p = 0;
+ long off = (long)&(p->ob_sval[0]);
+
+ if( PyDict_SetItemString(d, "string_id_to_buffer", Py_BuildValue("i", off)) != 0)
+ return;
+ }
+#define PY_RUNTIMEMODEL "macho"
+ if (PyDict_SetItemString(d, "runtimemodel",
+ Py_BuildValue("s", PY_RUNTIMEMODEL)) != 0)
+ return;
+#if defined(WITH_NEXT_FRAMEWORK)
+#define PY_LINKMODEL "framework"
+#elif defined(Py_ENABLE_SHARED)
+#define PY_LINKMODEL "shared"
+#else
+#define PY_LINKMODEL "static"
+#endif
+ if (PyDict_SetItemString(d, "linkmodel",
+ Py_BuildValue("s", PY_LINKMODEL)) != 0)
+ return;
+
+}
diff --git a/Mac/Modules/Nav.c b/Mac/Modules/Nav.c
new file mode 100644
index 0000000000..d2aa7dbe93
--- /dev/null
+++ b/Mac/Modules/Nav.c
@@ -0,0 +1,967 @@
+/***********************************************************
+Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
+The Netherlands.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of Stichting Mathematisch
+Centrum or CWI or Corporation for National Research Initiatives or
+CNRI not be used in advertising or publicity pertaining to
+distribution of the software without specific, written prior
+permission.
+
+While CWI is the initial source for this software, a modified version
+is made available by the Corporation for National Research Initiatives
+(CNRI) at the Internet address ftp://ftp.python.org.
+
+STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
+REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
+CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+
+******************************************************************/
+
+#include "Python.h"
+#include "pymactoolbox.h"
+#include <Carbon/Carbon.h>
+
+#ifndef __LP64__
+
+static PyObject *ErrorObject;
+
+static NavEventUPP my_eventProcUPP;
+static NavPreviewUPP my_previewProcUPP;
+static NavObjectFilterUPP my_filterProcUPP;
+
+/* Callback functions */
+static pascal void
+my_eventProc(NavEventCallbackMessage callBackSelector,
+ NavCBRecPtr callBackParms,
+ NavCallBackUserData callbackUD)
+{
+ PyObject *dict = (PyObject *)callbackUD;
+ PyObject *pyfunc;
+ PyObject *rv;
+
+ if (!dict) return;
+ if ( (pyfunc = PyDict_GetItemString(dict, "eventProc")) == NULL ) {
+ PyErr_Print();
+ return;
+ }
+ if ( pyfunc == Py_None ) {
+ return;
+ }
+ rv = PyObject_CallFunction(pyfunc, "ls#", (long)callBackSelector,
+ (void *)callBackParms, sizeof(NavCBRec));
+ if ( rv )
+ Py_DECREF(rv);
+ else {
+ PySys_WriteStderr("Nav: exception in eventProc callback\n");
+ PyErr_Print();
+ }
+}
+
+static pascal Boolean
+my_previewProc(NavCBRecPtr callBackParms,
+ NavCallBackUserData callbackUD)
+{
+ PyObject *dict = (PyObject *)callbackUD;
+ PyObject *pyfunc;
+ PyObject *rv;
+ Boolean c_rv = false;
+
+ if (!dict) return false;
+ if ( (pyfunc = PyDict_GetItemString(dict, "previewProc")) == NULL ) {
+ PyErr_Print();
+ return false;
+ }
+ rv = PyObject_CallFunction(pyfunc, "s#", (void *)callBackParms, sizeof(NavCBRec));
+ if ( rv ) {
+ c_rv = PyObject_IsTrue(rv);
+ Py_DECREF(rv);
+ } else {
+ PySys_WriteStderr("Nav: exception in previewProc callback\n");
+ PyErr_Print();
+ }
+ return c_rv;
+}
+
+static pascal Boolean
+my_filterProc(AEDesc *theItem, void *info,
+ NavCallBackUserData callbackUD,
+ NavFilterModes filterMode)
+{
+ PyObject *dict = (PyObject *)callbackUD;
+ PyObject *pyfunc;
+ PyObject *rv;
+ Boolean c_rv = false;
+
+ if (!dict) return false;
+ if ( (pyfunc = PyDict_GetItemString(dict, "filterProc")) == NULL ) {
+ PyErr_Print();
+ return false;
+ }
+ rv = PyObject_CallFunction(pyfunc, "O&s#h",
+ AEDesc_NewBorrowed, theItem, info, sizeof(NavFileOrFolderInfo), (short)filterMode);
+ if ( rv ) {
+ c_rv = PyObject_IsTrue(rv);
+ Py_DECREF(rv);
+ } else {
+ PySys_WriteStderr("Nav: exception in filterProc callback\n");
+ PyErr_Print();
+ }
+ return c_rv;
+}
+
+/* ----------------------------------------------------- */
+static int
+filldialogoptions(PyObject *d,
+ AEDesc **defaultLocationP,
+ NavDialogOptions *opt,
+ NavEventUPP *eventProcP,
+ NavPreviewUPP *previewProcP,
+ NavObjectFilterUPP *filterProcP,
+ NavTypeListHandle *typeListP,
+ OSType *fileTypeP,
+ OSType *fileCreatorP)
+{
+ Py_ssize_t pos = 0;
+ PyObject *key, *value;
+ char *keystr;
+ AEDesc *defaultLocation_storage;
+
+ NavGetDefaultDialogOptions(opt);
+
+ while ( PyDict_Next(d, &pos, &key, &value) ) {
+ if ( !key || !value || !PyString_Check(key) ) {
+ PyErr_SetString(ErrorObject, "DialogOption has non-string key");
+ return 0;
+ }
+ keystr = PyString_AsString(key);
+ if( strcmp(keystr, "defaultLocation") == 0 ) {
+ if ( (defaultLocation_storage = PyMem_NEW(AEDesc, 1)) == NULL ) {
+ PyErr_NoMemory();
+ return 0;
+ }
+ if ( !PyArg_Parse(value, "O&", AEDesc_Convert, defaultLocation_storage) ) {
+ PyMem_DEL(defaultLocation_storage);
+ return 0;
+ }
+ *defaultLocationP = defaultLocation_storage;
+ } else if( strcmp(keystr, "version") == 0 ) {
+ if ( !PyArg_Parse(value, "H", &opt->version) )
+ return 0;
+ } else if( strcmp(keystr, "dialogOptionFlags") == 0 ) {
+ if ( !PyArg_Parse(value, "k", &opt->dialogOptionFlags) )
+ return 0;
+ } else if( strcmp(keystr, "location") == 0 ) {
+ if ( !PyArg_Parse(value, "O&", PyMac_GetPoint, &opt->location) )
+ return 0;
+ } else if( strcmp(keystr, "clientName") == 0 ) {
+ if ( !PyArg_Parse(value, "O&", PyMac_GetStr255, &opt->clientName) )
+ return 0;
+ } else if( strcmp(keystr, "windowTitle") == 0 ) {
+ if ( !PyArg_Parse(value, "O&", PyMac_GetStr255, &opt->windowTitle) )
+ return 0;
+ } else if( strcmp(keystr, "actionButtonLabel") == 0 ) {
+ if ( !PyArg_Parse(value, "O&", PyMac_GetStr255, &opt->actionButtonLabel) )
+ return 0;
+ } else if( strcmp(keystr, "cancelButtonLabel") == 0 ) {
+ if ( !PyArg_Parse(value, "O&", PyMac_GetStr255, &opt->cancelButtonLabel) )
+ return 0;
+ } else if( strcmp(keystr, "savedFileName") == 0 ) {
+ if ( !PyArg_Parse(value, "O&", PyMac_GetStr255, &opt->savedFileName) )
+ return 0;
+ } else if( strcmp(keystr, "message") == 0 ) {
+ if ( !PyArg_Parse(value, "O&", PyMac_GetStr255, &opt->message) )
+ return 0;
+ } else if( strcmp(keystr, "preferenceKey") == 0 ) {
+ if ( !PyArg_Parse(value, "O&", PyMac_GetOSType, &opt->preferenceKey) )
+ return 0;
+ } else if( strcmp(keystr, "popupExtension") == 0 ) {
+ if ( !PyArg_Parse(value, "O&", ResObj_Convert, &opt->popupExtension) )
+ return 0;
+ } 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;
+ } else if( typeListP && strcmp(keystr, "typeList") == 0 ) {
+ if ( !PyArg_Parse(value, "O&", ResObj_Convert, typeListP) )
+ return 0;
+ } else if( fileTypeP && strcmp(keystr, "fileType") == 0 ) {
+ if ( !PyArg_Parse(value, "O&", PyMac_GetOSType, fileTypeP) )
+ return 0;
+ } else if( fileCreatorP && strcmp(keystr, "fileCreator") == 0 ) {
+ if ( !PyArg_Parse(value, "O&", PyMac_GetOSType, fileCreatorP) )
+ return 0;
+ } else {
+ PyErr_Format(ErrorObject, "Unknown DialogOption key: %s", keystr);
+ return 0;
+ }
+ }
+ return 1;
+}
+
+/* ----------------------------------------------------- */
+
+/* Declarations for objects of type NavReplyRecord */
+
+typedef struct {
+ PyObject_HEAD
+ NavReplyRecord itself;
+} navrrobject;
+
+static PyTypeObject Navrrtype;
+
+
+
+/* ---------------------------------------------------------------- */
+
+static char nav_NavTranslateFile__doc__[] =
+"(NavTranslationOptions)->None"
+;
+
+static PyObject *
+nav_NavTranslateFile(navrrobject *self, PyObject *args)
+{
+ NavTranslationOptions howToTranslate;
+ OSErr err;
+
+ if (!PyArg_ParseTuple(args, "k", &howToTranslate))
+ return NULL;
+ err = NavTranslateFile(&self->itself, howToTranslate);
+ if ( err ) {
+ PyErr_Mac(ErrorObject, err);
+ return NULL;
+ }
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static char nav_NavCompleteSave__doc__[] =
+"(NavTranslationOptions)->None"
+;
+
+static PyObject *
+nav_NavCompleteSave(navrrobject *self, PyObject *args)
+{
+ NavTranslationOptions howToTranslate;
+ OSErr err;
+
+ if (!PyArg_ParseTuple(args, "k", &howToTranslate))
+ return NULL;
+ err = NavCompleteSave(&self->itself, howToTranslate);
+ if ( err ) {
+ PyErr_Mac(ErrorObject, err);
+ return NULL;
+ }
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+
+static struct PyMethodDef navrr_methods[] = {
+ {"NavTranslateFile", (PyCFunction)nav_NavTranslateFile, METH_VARARGS, nav_NavTranslateFile__doc__},
+ {"NavCompleteSave", (PyCFunction)nav_NavCompleteSave, METH_VARARGS, nav_NavCompleteSave__doc__},
+
+ {NULL, NULL} /* sentinel */
+};
+
+/* ---------- */
+
+
+static navrrobject *
+newnavrrobject(NavReplyRecord *itself)
+{
+ navrrobject *self;
+
+ self = PyObject_NEW(navrrobject, &Navrrtype);
+ if (self == NULL)
+ return NULL;
+ self->itself = *itself;
+ return self;
+}
+
+
+static void
+navrr_dealloc(navrrobject *self)
+{
+ NavDisposeReply(&self->itself);
+ PyObject_DEL(self);
+}
+
+static PyObject *
+navrr_getattr(navrrobject *self, char *name)
+{
+ FSRef fsr;
+ FSSpec fss;
+
+ if( strcmp(name, "__members__") == 0 )
+ return Py_BuildValue(
+ "ssssssssss",
+ "version", "validRecord", "replacing",
+ "isStationery", "translationNeeded",
+ "selection",
+ "selection_fsr",
+ "fileTranslation", "keyScript", "saveFileName");
+
+ if( strcmp(name, "version") == 0 )
+ return Py_BuildValue("h", self->itself.version);
+ if( strcmp(name, "validRecord") == 0 )
+ return Py_BuildValue("l", (long)self->itself.validRecord);
+ if( strcmp(name, "replacing") == 0 )
+ return Py_BuildValue("l", (long)self->itself.replacing);
+ if( strcmp(name, "isStationery") == 0 )
+ return Py_BuildValue("l", (long)self->itself.isStationery);
+ if( strcmp(name, "translationNeeded") == 0 )
+ return Py_BuildValue("l", (long)self->itself.translationNeeded);
+ if( strcmp(name, "selection") == 0 ) {
+ SInt32 i;
+ long count;
+ OSErr err;
+ PyObject *rv, *rvitem;
+ AEDesc desc;
+
+ if ((err=AECountItems(&self->itself.selection, &count))) {
+ PyErr_Mac(ErrorObject, err);
+ return NULL;
+ }
+ if ( (rv=PyList_New(count)) == NULL )
+ return NULL;
+ for(i=0; i<count; i++) {
+ desc.dataHandle = NULL;
+ if ((err=AEGetNthDesc(&self->itself.selection, i+1, typeFSS, NULL, &desc))) {
+ Py_DECREF(rv);
+ PyErr_Mac(ErrorObject, err);
+ return NULL;
+ }
+ if ((err=AEGetDescData(&desc, &fss, sizeof(FSSpec)))) {
+ Py_DECREF(rv);
+ PyErr_Mac(ErrorObject, err);
+ return NULL;
+ }
+ rvitem = PyMac_BuildFSSpec(&fss);
+ PyList_SetItem(rv, i, rvitem);
+ AEDisposeDesc(&desc);
+ }
+ return rv;
+ }
+ if( strcmp(name, "selection_fsr") == 0 ) {
+ SInt32 i;
+ long count;
+ OSErr err;
+ PyObject *rv, *rvitem;
+ AEDesc desc;
+
+ if ((err=AECountItems(&self->itself.selection, &count))) {
+ PyErr_Mac(ErrorObject, err);
+ return NULL;
+ }
+ if ( (rv=PyList_New(count)) == NULL )
+ return NULL;
+ for(i=0; i<count; i++) {
+ desc.dataHandle = NULL;
+ if ((err=AEGetNthDesc(&self->itself.selection, i+1, typeFSRef, NULL, &desc))) {
+ Py_DECREF(rv);
+ PyErr_Mac(ErrorObject, err);
+ return NULL;
+ }
+ if ((err=AEGetDescData(&desc, &fsr, sizeof(FSRef)))) {
+ Py_DECREF(rv);
+ PyErr_Mac(ErrorObject, err);
+ return NULL;
+ }
+ rvitem = PyMac_BuildFSRef(&fsr);
+ PyList_SetItem(rv, i, rvitem);
+ AEDisposeDesc(&desc);
+ }
+ return rv;
+ }
+ if( strcmp(name, "fileTranslation") == 0 )
+ return ResObj_New((Handle)self->itself.fileTranslation);
+ if( strcmp(name, "keyScript") == 0 )
+ return Py_BuildValue("h", (short)self->itself.keyScript);
+ if( strcmp(name, "saveFileName") == 0 )
+ return Py_BuildValue("O&", CFStringRefObj_New, self->itself.saveFileName);
+
+
+ return Py_FindMethod(navrr_methods, (PyObject *)self, name);
+}
+
+static int
+navrr_setattr(navrrobject *self, char *name, PyObject *v)
+{
+ /* Set attribute 'name' to value 'v'. v==NULL means delete */
+
+ /* XXXX Add your own setattr code here */
+ return -1;
+}
+
+static char Navrrtype__doc__[] =
+"Record containing result of a Nav file selection call. Use dir() for member names."
+;
+
+static PyTypeObject Navrrtype = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "Nav.NavReplyRecord", /*tp_name*/
+ sizeof(navrrobject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor)navrr_dealloc, /*tp_dealloc*/
+ (printfunc)0, /*tp_print*/
+ (getattrfunc)navrr_getattr, /*tp_getattr*/
+ (setattrfunc)navrr_setattr, /*tp_setattr*/
+ (cmpfunc)0, /*tp_compare*/
+ (reprfunc)0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ (hashfunc)0, /*tp_hash*/
+ (ternaryfunc)0, /*tp_call*/
+ (reprfunc)0, /*tp_str*/
+
+ /* Space for future expansion */
+ 0L,0L,0L,0L,
+ Navrrtype__doc__ /* Documentation string */
+};
+
+/* End of code for NavReplyRecord objects */
+
+/* ----------------------------------------------------- */
+
+static char nav_NavGetFile__doc__[] =
+"(DialogOptions dict or kwargs+defaultLocation,eventProc,previewProc,filterProc,typeList) -> NavReplyRecord"
+;
+
+static PyObject *
+nav_NavGetFile(PyObject *self, PyObject *args, PyObject *kw)
+{
+ PyObject *dict;
+ AEDesc *defaultLocation = NULL;
+ NavReplyRecord reply;
+ NavDialogOptions dialogOptions;
+ NavEventUPP eventProc = NULL;
+ NavPreviewUPP previewProc = NULL;
+ NavObjectFilterUPP filterProc = NULL;
+ NavTypeListHandle typeList = NULL;
+ OSErr err;
+
+ if ( kw && PyObject_IsTrue(kw) ) {
+ if (!PyArg_ParseTuple(args, ";either keyword arguments or dictionary expected"))
+ return NULL;
+ dict = kw;
+ } else if (!PyArg_ParseTuple(args, "O!", &PyDict_Type, &dict))
+ return NULL;
+ if (!filldialogoptions(dict, &defaultLocation, &dialogOptions, &eventProc, &previewProc, &filterProc, &typeList, NULL, NULL))
+ return NULL;
+ err = NavGetFile(defaultLocation, &reply, &dialogOptions,
+ eventProc, previewProc, filterProc, typeList, (void *)dict);
+ PyMem_DEL(defaultLocation);
+ if ( err ) {
+ PyErr_Mac(ErrorObject, err);
+ return NULL;
+ }
+ return (PyObject *)newnavrrobject(&reply);
+}
+
+static char nav_NavPutFile__doc__[] =
+"(DialogOptions dict or kwargs+defaultLocation,eventProc,fileCreator,fileType) -> NavReplyRecord"
+;
+
+static PyObject *
+nav_NavPutFile(PyObject *self, PyObject *args, PyObject *kw)
+{
+ PyObject *dict;
+ AEDesc *defaultLocation = NULL;
+ NavReplyRecord reply;
+ NavDialogOptions dialogOptions;
+ NavEventUPP eventProc = NULL;
+ OSType fileType;
+ OSType fileCreator;
+ OSErr err;
+
+ if ( kw && PyObject_IsTrue(kw) ) {
+ if (!PyArg_ParseTuple(args, ";either keyword arguments or dictionary expected"))
+ return NULL;
+ dict = kw;
+ } else if (!PyArg_ParseTuple(args, "O!", &PyDict_Type, &dict))
+ return NULL;
+ if (!filldialogoptions(dict, &defaultLocation, &dialogOptions, &eventProc, NULL, NULL, NULL, &fileType, &fileCreator))
+ return NULL;
+ err = NavPutFile(defaultLocation, &reply, &dialogOptions,
+ eventProc, fileType, fileCreator, (void *)dict);
+ PyMem_DEL(defaultLocation);
+ if ( err ) {
+ PyErr_Mac(ErrorObject, err);
+ return NULL;
+ }
+ return (PyObject *)newnavrrobject(&reply);
+}
+
+static char nav_NavAskSaveChanges__doc__[] =
+"(NavAskSaveChangesAction, DialogOptions dict or kwargs+eventProc) -> NavAskSaveChangesResult"
+
+;
+
+static PyObject *
+nav_NavAskSaveChanges(PyObject *self, PyObject *args, PyObject *kw)
+{
+ PyObject *dict;
+ NavDialogOptions dialogOptions;
+ NavAskSaveChangesAction action;
+ NavAskSaveChangesResult reply;
+ NavEventUPP eventProc = NULL;
+ OSErr err;
+
+ if ( kw && PyObject_IsTrue(kw) ) {
+ if (!PyArg_ParseTuple(args, "k", &action))
+ return NULL;
+ dict = kw;
+ } else if (!PyArg_ParseTuple(args, "lO!", &action, &PyDict_Type, &dict))
+ return NULL;
+ if (!filldialogoptions(dict, NULL, &dialogOptions, &eventProc, NULL, NULL, NULL, NULL, NULL))
+ return NULL;
+ err = NavAskSaveChanges(&dialogOptions, action, &reply, eventProc, (void *)dict);
+ if ( err ) {
+ PyErr_Mac(ErrorObject, err);
+ return NULL;
+ }
+ return Py_BuildValue("l", (long)reply);
+}
+
+static char nav_NavCustomAskSaveChanges__doc__[] =
+"(DialogOptions dict or kwargs+eventProc) -> NavAskSaveChangesResult"
+;
+
+static PyObject *
+nav_NavCustomAskSaveChanges(PyObject *self, PyObject *args, PyObject *kw)
+{
+ PyObject *dict;
+ NavDialogOptions dialogOptions;
+ NavAskSaveChangesResult reply;
+ NavEventUPP eventProc = NULL;
+ OSErr err;
+
+ if ( kw && PyObject_IsTrue(kw) ) {
+ if (!PyArg_ParseTuple(args, ";either keyword arguments or dictionary expected"))
+ return NULL;
+ dict = kw;
+ } else if (!PyArg_ParseTuple(args, "O!", &PyDict_Type, &dict))
+ return NULL;
+ if (!filldialogoptions(dict, NULL, &dialogOptions, &eventProc, NULL, NULL, NULL, NULL, NULL))
+ return NULL;
+ err = NavCustomAskSaveChanges(&dialogOptions, &reply, eventProc, (void *)dict);
+ if ( err ) {
+ PyErr_Mac(ErrorObject, err);
+ return NULL;
+ }
+ return Py_BuildValue("l", (long)reply);
+}
+
+static char nav_NavAskDiscardChanges__doc__[] =
+"(DialogOptions dict or kwargs+eventProc) -> NavAskSaveChangesResult"
+;
+
+static PyObject *
+nav_NavAskDiscardChanges(PyObject *self, PyObject *args, PyObject *kw)
+{
+ PyObject *dict;
+ NavDialogOptions dialogOptions;
+ NavAskSaveChangesResult reply;
+ NavEventUPP eventProc = NULL;
+ OSErr err;
+
+ if ( kw && PyObject_IsTrue(kw) ) {
+ if (!PyArg_ParseTuple(args, ";either keyword arguments or dictionary expected"))
+ return NULL;
+ dict = kw;
+ } else if (!PyArg_ParseTuple(args, "O!", &PyDict_Type, &dict))
+ return NULL;
+ if (!filldialogoptions(dict, NULL, &dialogOptions, &eventProc, NULL, NULL, NULL, NULL, NULL))
+ return NULL;
+ err = NavAskDiscardChanges(&dialogOptions, &reply, eventProc, (void *)dict);
+ if ( err ) {
+ PyErr_Mac(ErrorObject, err);
+ return NULL;
+ }
+ return Py_BuildValue("l", (long)reply);
+}
+
+static char nav_NavChooseFile__doc__[] =
+"(DialogOptions dict or kwargs+defaultLocation,eventProc,previewProc,filterProc,typeList) -> NavReplyRecord"
+;
+
+static PyObject *
+nav_NavChooseFile(PyObject *self, PyObject *args, PyObject *kw)
+{
+ PyObject *dict;
+ AEDesc *defaultLocation = NULL;
+ NavReplyRecord reply;
+ NavDialogOptions dialogOptions;
+ NavEventUPP eventProc = NULL;
+ NavPreviewUPP previewProc = NULL;
+ NavObjectFilterUPP filterProc = NULL;
+ NavTypeListHandle typeList = NULL;
+ OSErr err;
+
+ if ( kw && PyObject_IsTrue(kw) ) {
+ if (!PyArg_ParseTuple(args, ";either keyword arguments or dictionary expected"))
+ return NULL;
+ dict = kw;
+ } else if (!PyArg_ParseTuple(args, "O!", &PyDict_Type, &dict))
+ return NULL;
+ if (!filldialogoptions(dict, &defaultLocation, &dialogOptions, &eventProc, &previewProc, &filterProc, &typeList, NULL, NULL))
+ return NULL;
+ err = NavChooseFile(defaultLocation, &reply, &dialogOptions,
+ eventProc, previewProc, filterProc, typeList, (void *)dict);
+ PyMem_DEL(defaultLocation);
+ if ( err ) {
+ PyErr_Mac(ErrorObject, err);
+ return NULL;
+ }
+ return (PyObject *)newnavrrobject(&reply);
+}
+
+static char nav_NavChooseFolder__doc__[] =
+"(DialogOptions dict or kwargs+defaultLocation,eventProc,filterProc) -> NavReplyRecord"
+;
+
+static PyObject *
+nav_NavChooseFolder(PyObject *self, PyObject *args, PyObject *kw)
+{
+ PyObject *dict;
+ AEDesc *defaultLocation = NULL;
+ NavReplyRecord reply;
+ NavDialogOptions dialogOptions;
+ NavEventUPP eventProc = NULL;
+ NavObjectFilterUPP filterProc = NULL;
+ OSErr err;
+
+ if ( kw && PyObject_IsTrue(kw) ) {
+ if (!PyArg_ParseTuple(args, ";either keyword arguments or dictionary expected"))
+ return NULL;
+ dict = kw;
+ } else if (!PyArg_ParseTuple(args, "O!", &PyDict_Type, &dict))
+ return NULL;
+ if (!filldialogoptions(dict, &defaultLocation, &dialogOptions, &eventProc, NULL, &filterProc, NULL, NULL, NULL))
+ return NULL;
+ err = NavChooseFolder(defaultLocation, &reply, &dialogOptions,
+ eventProc, filterProc, (void *)dict);
+ PyMem_DEL(defaultLocation);
+ if ( err ) {
+ PyErr_Mac(ErrorObject, err);
+ return NULL;
+ }
+ return (PyObject *)newnavrrobject(&reply);
+}
+
+static char nav_NavChooseVolume__doc__[] =
+"(DialogOptions dict or kwargs+defaultLocation,eventProc,filterProc) -> NavReplyRecord"
+;
+
+static PyObject *
+nav_NavChooseVolume(PyObject *self, PyObject *args, PyObject *kw)
+{
+ PyObject *dict;
+ AEDesc *defaultLocation = NULL;
+ NavReplyRecord reply;
+ NavDialogOptions dialogOptions;
+ NavEventUPP eventProc = NULL;
+ NavObjectFilterUPP filterProc = NULL;
+ OSErr err;
+
+ if ( kw && PyObject_IsTrue(kw) ) {
+ if (!PyArg_ParseTuple(args, ";either keyword arguments or dictionary expected"))
+ return NULL;
+ dict = kw;
+ } else if (!PyArg_ParseTuple(args, "O!", &PyDict_Type, &dict))
+ return NULL;
+ if (!filldialogoptions(dict, &defaultLocation, &dialogOptions, &eventProc, NULL, &filterProc, NULL, NULL, NULL))
+ return NULL;
+ err = NavChooseVolume(defaultLocation, &reply, &dialogOptions,
+ eventProc, filterProc, (void *)dict);
+ PyMem_DEL(defaultLocation);
+ if ( err ) {
+ PyErr_Mac(ErrorObject, err);
+ return NULL;
+ }
+ return (PyObject *)newnavrrobject(&reply);
+}
+
+static char nav_NavChooseObject__doc__[] =
+"(DialogOptions dict or kwargs+defaultLocation,eventProc,filterProc) -> NavReplyRecord"
+;
+
+static PyObject *
+nav_NavChooseObject(PyObject *self, PyObject *args, PyObject *kw)
+{
+ PyObject *dict;
+ AEDesc *defaultLocation = NULL;
+ NavReplyRecord reply;
+ NavDialogOptions dialogOptions;
+ NavEventUPP eventProc = NULL;
+ NavObjectFilterUPP filterProc = NULL;
+ OSErr err;
+
+ if ( kw && PyObject_IsTrue(kw) ) {
+ if (!PyArg_ParseTuple(args, ";either keyword arguments or dictionary expected"))
+ return NULL;
+ dict = kw;
+ } else if (!PyArg_ParseTuple(args, "O!", &PyDict_Type, &dict))
+ return NULL;
+ if (!filldialogoptions(dict, &defaultLocation, &dialogOptions, &eventProc, NULL, &filterProc, NULL, NULL, NULL))
+ return NULL;
+ err = NavChooseObject(defaultLocation, &reply, &dialogOptions,
+ eventProc, filterProc, (void *)dict);
+ PyMem_DEL(defaultLocation);
+ if ( err ) {
+ PyErr_Mac(ErrorObject, err);
+ return NULL;
+ }
+ return (PyObject *)newnavrrobject(&reply);
+}
+
+static char nav_NavNewFolder__doc__[] =
+"(DialogOptions dict or kwargs+defaultLocation,eventProc) -> NavReplyRecord"
+;
+
+static PyObject *
+nav_NavNewFolder(PyObject *self, PyObject *args, PyObject *kw)
+{
+ PyObject *dict;
+ AEDesc *defaultLocation = NULL;
+ NavReplyRecord reply;
+ NavDialogOptions dialogOptions;
+ NavEventUPP eventProc = NULL;
+ OSErr err;
+
+ if ( kw && PyObject_IsTrue(kw) ) {
+ if (!PyArg_ParseTuple(args, ";either keyword arguments or dictionary expected"))
+ return NULL;
+ dict = kw;
+ } else if (!PyArg_ParseTuple(args, "O!", &PyDict_Type, &dict))
+ return NULL;
+ if (!filldialogoptions(dict, &defaultLocation, &dialogOptions, &eventProc, NULL, NULL, NULL, NULL, NULL))
+ return NULL;
+ err = NavNewFolder(defaultLocation, &reply, &dialogOptions, eventProc, (void *)dict);
+ PyMem_DEL(defaultLocation);
+ if ( err ) {
+ PyErr_Mac(ErrorObject, err);
+ return NULL;
+ }
+ return (PyObject *)newnavrrobject(&reply);
+}
+
+#if 0
+/* XXXX I don't know what to do with the void * argument */
+static char nav_NavCustomControl__doc__[] =
+""
+;
+
+
+static PyObject *
+nav_NavCustomControl(PyObject *self, PyObject *args)
+{
+
+ if (!PyArg_ParseTuple(args, ""))
+ return NULL;
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+#endif
+
+static char nav_NavServicesCanRun__doc__[] =
+"()->int"
+;
+
+static PyObject *
+nav_NavServicesCanRun(PyObject *self, PyObject *args)
+{
+ Boolean rv;
+ if (!PyArg_ParseTuple(args, ""))
+ return NULL;
+ rv = NavServicesCanRun();
+ return Py_BuildValue("l", (long)rv);
+}
+
+static char nav_NavServicesAvailable__doc__[] =
+"()->int"
+;
+
+static PyObject *
+nav_NavServicesAvailable(PyObject *self, PyObject *args)
+{
+ Boolean rv;
+
+ if (!PyArg_ParseTuple(args, ""))
+ return NULL;
+ rv = NavServicesAvailable();
+ return Py_BuildValue("l", (long)rv);
+}
+/* XX */
+static char nav_NavLoad__doc__[] =
+"()->None"
+;
+
+static PyObject *
+nav_NavLoad(PyObject *self, PyObject *args)
+{
+
+ if (!PyArg_ParseTuple(args, ""))
+ return NULL;
+ NavLoad();
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static char nav_NavUnload__doc__[] =
+"()->None"
+;
+
+static PyObject *
+nav_NavUnload(PyObject *self, PyObject *args)
+{
+
+ if (!PyArg_ParseTuple(args, ""))
+ return NULL;
+ NavUnload();
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static char nav_NavLibraryVersion__doc__[] =
+"()->int"
+;
+
+static PyObject *
+nav_NavLibraryVersion(PyObject *self, PyObject *args)
+{
+ UInt32 rv;
+
+ if (!PyArg_ParseTuple(args, ""))
+ return NULL;
+ rv = NavLibraryVersion();
+ return Py_BuildValue("l", (long)rv);
+}
+
+static char nav_NavGetDefaultDialogOptions__doc__[] =
+"()->dict\nPass dict or keyword args with same names to other calls."
+;
+
+static PyObject *
+nav_NavGetDefaultDialogOptions(PyObject *self, PyObject *args)
+{
+ NavDialogOptions dialogOptions;
+ OSErr err;
+
+ err = NavGetDefaultDialogOptions(&dialogOptions);
+ if ( err ) {
+ 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&}",
+ "version", dialogOptions.version,
+ "dialogOptionFlags", dialogOptions.dialogOptionFlags,
+ "location", PyMac_BuildPoint, dialogOptions.location,
+ "clientName", PyMac_BuildStr255, &dialogOptions.clientName,
+ "windowTitle", PyMac_BuildStr255, &dialogOptions.windowTitle,
+ "actionButtonLabel", PyMac_BuildStr255, &dialogOptions.actionButtonLabel,
+ "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
+ );
+}
+
+/* List of methods defined in the module */
+
+static struct PyMethodDef nav_methods[] = {
+ {"NavGetFile", (PyCFunction)nav_NavGetFile, METH_VARARGS|METH_KEYWORDS, nav_NavGetFile__doc__},
+ {"NavPutFile", (PyCFunction)nav_NavPutFile, METH_VARARGS|METH_KEYWORDS, nav_NavPutFile__doc__},
+ {"NavAskSaveChanges", (PyCFunction)nav_NavAskSaveChanges, METH_VARARGS|METH_KEYWORDS, nav_NavAskSaveChanges__doc__},
+ {"NavCustomAskSaveChanges", (PyCFunction)nav_NavCustomAskSaveChanges, METH_VARARGS|METH_KEYWORDS, nav_NavCustomAskSaveChanges__doc__},
+ {"NavAskDiscardChanges", (PyCFunction)nav_NavAskDiscardChanges, METH_VARARGS|METH_KEYWORDS, nav_NavAskDiscardChanges__doc__},
+ {"NavChooseFile", (PyCFunction)nav_NavChooseFile, METH_VARARGS|METH_KEYWORDS, nav_NavChooseFile__doc__},
+ {"NavChooseFolder", (PyCFunction)nav_NavChooseFolder, METH_VARARGS|METH_KEYWORDS, nav_NavChooseFolder__doc__},
+ {"NavChooseVolume", (PyCFunction)nav_NavChooseVolume, METH_VARARGS|METH_KEYWORDS, nav_NavChooseVolume__doc__},
+ {"NavChooseObject", (PyCFunction)nav_NavChooseObject, METH_VARARGS|METH_KEYWORDS, nav_NavChooseObject__doc__},
+ {"NavNewFolder", (PyCFunction)nav_NavNewFolder, METH_VARARGS|METH_KEYWORDS, nav_NavNewFolder__doc__},
+#if 0
+ {"NavCustomControl", (PyCFunction)nav_NavCustomControl, METH_VARARGS, nav_NavCustomControl__doc__},
+#endif
+ {"NavServicesCanRun", (PyCFunction)nav_NavServicesCanRun, METH_VARARGS, nav_NavServicesCanRun__doc__},
+ {"NavServicesAvailable", (PyCFunction)nav_NavServicesAvailable, METH_VARARGS, nav_NavServicesAvailable__doc__},
+ {"NavLoad", (PyCFunction)nav_NavLoad, METH_VARARGS, nav_NavLoad__doc__},
+ {"NavUnload", (PyCFunction)nav_NavUnload, METH_VARARGS, nav_NavUnload__doc__},
+ {"NavLibraryVersion", (PyCFunction)nav_NavLibraryVersion, METH_VARARGS, nav_NavLibraryVersion__doc__},
+ {"NavGetDefaultDialogOptions", (PyCFunction)nav_NavGetDefaultDialogOptions, METH_VARARGS, nav_NavGetDefaultDialogOptions__doc__},
+ {NULL, (PyCFunction)NULL, 0, NULL} /* sentinel */
+};
+
+
+/* Initialization function for the module (*must* be called initNav) */
+
+static char Nav_module_documentation[] =
+"Interface to Navigation Services\n"
+"Most calls accept a NavDialogOptions dictionary or keywords with the same names, pass {}\n"
+"if you want the default options.\n"
+"Use NavGetDefaultDialogOptions() to find out common option names.\n"
+"See individual docstrings for additional keyword args/dictentries supported by each call.\n"
+"Pass None as eventProc to get movable-modal dialogs that process updates through the standard Python mechanism."
+;
+
+
+#endif /* !__LP64__ */
+
+
+void
+initNav(void)
+{
+#ifdef __LP64__
+ PyErr_SetString(PyExc_ImportError, "Navigation Services not available in 64-bit mode");
+ return;
+
+#else /* !__LP64__ */
+ PyObject *m, *d;
+
+ if (PyErr_WarnPy3k("In 3.x, the Nav module is removed.", 1))
+ return;
+
+ /* Test that we have NavServices */
+ if ( !NavServicesAvailable() ) {
+ PyErr_SetString(PyExc_ImportError, "Navigation Services not available");
+ return;
+ }
+ /* Create the module and add the functions */
+ m = Py_InitModule4("Nav", nav_methods,
+ Nav_module_documentation,
+ (PyObject*)NULL,PYTHON_API_VERSION);
+
+ /* Add some symbolic constants to the module */
+ d = PyModule_GetDict(m);
+ ErrorObject = PyString_FromString("Nav.error");
+ PyDict_SetItemString(d, "error", ErrorObject);
+
+ /* XXXX Add constants here */
+
+ /* Set UPPs */
+ my_eventProcUPP = NewNavEventUPP(my_eventProc);
+ my_previewProcUPP = NewNavPreviewUPP(my_previewProc);
+ my_filterProcUPP = NewNavObjectFilterUPP(my_filterProc);
+#endif /* !__LP64__ */
+
+}
+
diff --git a/Mac/Modules/OSATerminology.c b/Mac/Modules/OSATerminology.c
new file mode 100644
index 0000000000..2114d07059
--- /dev/null
+++ b/Mac/Modules/OSATerminology.c
@@ -0,0 +1,102 @@
+/*
+** An interface to the application scripting related functions of the OSA API.
+**
+** GetAppTerminology - given an FSSpec/posix path to an application,
+** returns its aevt (scripting terminology) resource(s)
+**
+** GetSysTerminology - returns the AppleScript language component's
+** aeut (scripting terminology) resource
+**
+** Written by Donovan Preston and slightly modified by Jack and HAS.
+*/
+#include "Python.h"
+#include "pymactoolbox.h"
+
+#include <Carbon/Carbon.h>
+
+#ifndef __LP64__
+static PyObject *
+PyOSA_GetAppTerminology(PyObject* self, PyObject* args)
+{
+ AEDesc theDesc = {0,0};
+ FSSpec fss;
+ ComponentInstance defaultComponent = NULL;
+ SInt16 defaultTerminology = 0;
+ Boolean didLaunch = 0;
+ OSAError err;
+ long modeFlags = 0;
+
+ if (!PyArg_ParseTuple(args, "O&|i", PyMac_GetFSSpec, &fss, &modeFlags))
+ return NULL;
+
+ /*
+ ** Note that we have to use the AppleScript component here. Who knows why
+ ** OSAGetAppTerminology should require a scripting component in the
+ ** first place, but it does. Note: doesn't work with the generic scripting
+ ** component, which is unfortunate as the AS component is currently very
+ ** slow (~1 sec?) to load, but we just have to live with this.
+ */
+ defaultComponent = OpenDefaultComponent (kOSAComponentType, 'ascr');
+ err = GetComponentInstanceError (defaultComponent);
+ if (err) return PyMac_Error(err);
+ err = OSAGetAppTerminology (
+ defaultComponent,
+ kOSAModeNull,
+ &fss,
+ defaultTerminology,
+ &didLaunch,
+ &theDesc
+ );
+ if (err) return PyMac_Error(err);
+ return Py_BuildValue("O&i", AEDesc_New, &theDesc, didLaunch);
+}
+
+static PyObject *
+PyOSA_GetSysTerminology(PyObject* self, PyObject* args)
+{
+ AEDesc theDesc = {0,0};
+ ComponentInstance defaultComponent = NULL;
+ SInt16 defaultTerminology = 0;
+ OSAError err;
+
+ /* Accept any args for sake of backwards compatibility, then ignore them. */
+
+ defaultComponent = OpenDefaultComponent (kOSAComponentType, 'ascr');
+ err = GetComponentInstanceError (defaultComponent);
+ if (err) return PyMac_Error(err);
+ err = OSAGetSysTerminology (
+ defaultComponent,
+ kOSAModeNull,
+ defaultTerminology,
+ &theDesc
+ );
+ if (err) return PyMac_Error(err);
+ return Py_BuildValue("O&", AEDesc_New, &theDesc);
+}
+#endif /* !__LP64__ */
+
+/*
+ * List of methods defined in the module
+ */
+static struct PyMethodDef OSATerminology_methods[] =
+{
+#ifndef __LP64__
+ {"GetAppTerminology",
+ (PyCFunction) PyOSA_GetAppTerminology,
+ METH_VARARGS,
+ "Get an application's terminology. GetAppTerminology(path) --> AEDesc"},
+ {"GetSysTerminology",
+ (PyCFunction) PyOSA_GetSysTerminology,
+ METH_VARARGS,
+ "Get the AppleScript language's terminology. GetSysTerminology() --> AEDesc"},
+#endif /* !__LP64__ */
+ {NULL, (PyCFunction) NULL, 0, NULL}
+};
+
+void
+initOSATerminology(void)
+{
+ if (PyErr_WarnPy3k("In 3.x, the OSATerminology module is removed.", 1) < 0)
+ return;
+ Py_InitModule("OSATerminology", OSATerminology_methods);
+}
diff --git a/Mac/Modules/_scproxy.c b/Mac/Modules/_scproxy.c
new file mode 100644
index 0000000000..4aa6665d13
--- /dev/null
+++ b/Mac/Modules/_scproxy.c
@@ -0,0 +1,231 @@
+/*
+ * Helper method for urllib to fetch the proxy configuration settings
+ * using the SystemConfiguration framework.
+ */
+#include <Python.h>
+#include <SystemConfiguration/SystemConfiguration.h>
+
+static int32_t
+cfnum_to_int32(CFNumberRef num)
+{
+ int32_t result;
+
+ CFNumberGetValue(num, kCFNumberSInt32Type, &result);
+ return result;
+}
+
+static PyObject*
+cfstring_to_pystring(CFStringRef ref)
+{
+ const char* s;
+
+ s = CFStringGetCStringPtr(ref, kCFStringEncodingUTF8);
+ if (s) {
+ return PyString_FromString(s);
+
+ } else {
+ CFIndex len = CFStringGetLength(ref);
+ Boolean ok;
+ PyObject* result;
+ result = PyString_FromStringAndSize(NULL, len*4);
+
+ ok = CFStringGetCString(ref,
+ PyString_AS_STRING(result),
+ PyString_GET_SIZE(result),
+ kCFStringEncodingUTF8);
+ if (!ok) {
+ Py_DECREF(result);
+ return NULL;
+ } else {
+ _PyString_Resize(&result,
+ strlen(PyString_AS_STRING(result)));
+ }
+ return result;
+ }
+}
+
+
+static PyObject*
+get_proxy_settings(PyObject* mod __attribute__((__unused__)))
+{
+ CFDictionaryRef proxyDict = NULL;
+ CFNumberRef aNum = NULL;
+ CFArrayRef anArray = NULL;
+ PyObject* result = NULL;
+ PyObject* v;
+ int r;
+
+ proxyDict = SCDynamicStoreCopyProxies(NULL);
+ if (!proxyDict) {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+
+ result = PyDict_New();
+ if (result == NULL) goto error;
+
+ if (&kSCPropNetProxiesExcludeSimpleHostnames != NULL) {
+ aNum = CFDictionaryGetValue(proxyDict,
+ kSCPropNetProxiesExcludeSimpleHostnames);
+ if (aNum == NULL) {
+ v = PyBool_FromLong(0);
+ } else {
+ v = PyBool_FromLong(cfnum_to_int32(aNum));
+ }
+ } else {
+ v = PyBool_FromLong(0);
+ }
+
+ if (v == NULL) goto error;
+
+ r = PyDict_SetItemString(result, "exclude_simple", v);
+ Py_DECREF(v); v = NULL;
+ if (r == -1) goto error;
+
+ anArray = CFDictionaryGetValue(proxyDict,
+ kSCPropNetProxiesExceptionsList);
+ if (anArray != NULL) {
+ CFIndex len = CFArrayGetCount(anArray);
+ CFIndex i;
+ v = PyTuple_New(len);
+ if (v == NULL) goto error;
+
+ r = PyDict_SetItemString(result, "exceptions", v);
+ Py_DECREF(v);
+ if (r == -1) goto error;
+
+ for (i = 0; i < len; i++) {
+ CFStringRef aString = NULL;
+
+ aString = CFArrayGetValueAtIndex(anArray, i);
+ if (aString == NULL) {
+ PyTuple_SetItem(v, i, Py_None);
+ Py_INCREF(Py_None);
+ } else {
+ PyObject* t = cfstring_to_pystring(aString);
+ if (!t) {
+ PyTuple_SetItem(v, i, Py_None);
+ Py_INCREF(Py_None);
+ } else {
+ PyTuple_SetItem(v, i, t);
+ }
+ }
+ }
+ }
+
+ CFRelease(proxyDict);
+ return result;
+
+error:
+ if (proxyDict) CFRelease(proxyDict);
+ Py_XDECREF(result);
+ return NULL;
+}
+
+static int
+set_proxy(PyObject* proxies, char* proto, CFDictionaryRef proxyDict,
+ CFStringRef enabledKey,
+ CFStringRef hostKey, CFStringRef portKey)
+{
+ CFNumberRef aNum;
+
+ aNum = CFDictionaryGetValue(proxyDict, enabledKey);
+ if (aNum && cfnum_to_int32(aNum)) {
+ CFStringRef hostString;
+
+ hostString = CFDictionaryGetValue(proxyDict, hostKey);
+ aNum = CFDictionaryGetValue(proxyDict, portKey);
+
+ if (hostString) {
+ int r;
+ PyObject* h = cfstring_to_pystring(hostString);
+ PyObject* v;
+ if (h) {
+ if (aNum) {
+ int32_t port = cfnum_to_int32(aNum);
+ v = PyString_FromFormat("http://%s:%ld",
+ PyString_AS_STRING(h),
+ (long)port);
+ } else {
+ v = PyString_FromFormat("http://%s",
+ PyString_AS_STRING(h));
+ }
+ Py_DECREF(h);
+ if (!v) return -1;
+ r = PyDict_SetItemString(proxies, proto,
+ v);
+ Py_DECREF(v);
+ return r;
+ }
+ }
+
+ }
+ return 0;
+}
+
+
+
+static PyObject*
+get_proxies(PyObject* mod __attribute__((__unused__)))
+{
+ PyObject* result = NULL;
+ int r;
+ CFDictionaryRef proxyDict = NULL;
+
+ proxyDict = SCDynamicStoreCopyProxies(NULL);
+ if (proxyDict == NULL) {
+ return PyDict_New();
+ }
+
+ result = PyDict_New();
+ if (result == NULL) goto error;
+
+ r = set_proxy(result, "http", proxyDict,
+ kSCPropNetProxiesHTTPEnable,
+ kSCPropNetProxiesHTTPProxy,
+ kSCPropNetProxiesHTTPPort);
+ if (r == -1) goto error;
+ r = set_proxy(result, "https", proxyDict,
+ kSCPropNetProxiesHTTPSEnable,
+ kSCPropNetProxiesHTTPSProxy,
+ kSCPropNetProxiesHTTPSPort);
+ if (r == -1) goto error;
+ r = set_proxy(result, "ftp", proxyDict,
+ kSCPropNetProxiesFTPEnable,
+ kSCPropNetProxiesFTPProxy,
+ kSCPropNetProxiesFTPPort);
+ if (r == -1) goto error;
+ r = set_proxy(result, "gopher", proxyDict,
+ kSCPropNetProxiesGopherEnable,
+ kSCPropNetProxiesGopherProxy,
+ kSCPropNetProxiesGopherPort);
+ if (r == -1) goto error;
+
+ CFRelease(proxyDict);
+ return result;
+error:
+ if (proxyDict) CFRelease(proxyDict);
+ Py_XDECREF(result);
+ return NULL;
+}
+
+static PyMethodDef mod_methods[] = {
+ {
+ "_get_proxy_settings",
+ (PyCFunction)get_proxy_settings,
+ METH_NOARGS,
+ NULL,
+ },
+ {
+ "_get_proxies",
+ (PyCFunction)get_proxies,
+ METH_NOARGS,
+ NULL,
+ },
+ { 0, 0, 0, 0 }
+};
+
+void init_scproxy(void)
+{
+ (void)Py_InitModule4("_scproxy", mod_methods, NULL, NULL, PYTHON_API_VERSION);
+}
diff --git a/Mac/Modules/ae/README b/Mac/Modules/ae/README
new file mode 100644
index 0000000000..f91c44f671
--- /dev/null
+++ b/Mac/Modules/ae/README
@@ -0,0 +1,24 @@
+A quick note on what all the files here are, currently (16-7-95),
+and whether they really are source or generated.
+
+aegen.py Generated by aescan, temporary file
+AEModule.c Generated by aescan, from AppleEvents.h
+AEObjects.py Generated by aescan, from AEObjects.h
+aepack.py Routines to convert python objects <-> AEDesc record
+ (formerly part of aetools, now imported there)
+AERegistry.py Generated by aescan, from AERegistry.h
+aescan.py Program to scan headers and generate AE modules
+aesupport.py Helper code for aescan
+aetools.py Routines/classes to create and send appleevents
+aetypes.py Classes for python objects corresponding to AEDesc types
+ (formerly part of aetools, now imported there)
+AppleEvents.py Generated by aescan, from AppleEvents.h
+AppleScript_Suite.py Generated by gensuitemodule
+echo.py Old test program (may still work) to echo events back to sender
+gensuitemodule.py Program to scan aete/aeut resources and generate python
+ interface modules
+Required_Suite.py Generated by gensuitemodule
+Standard_Suite.py Generated by gensuitemodule
+tae.py Old test program (may still work) to send an appleevent
+tell.py Old test program (may still work) to send an appleevent
+test_suite.py Test program to test bits of the _Suite modules and aetools/etc
diff --git a/Mac/Modules/ae/_AEmodule.c b/Mac/Modules/ae/_AEmodule.c
new file mode 100644
index 0000000000..21a2d40461
--- /dev/null
+++ b/Mac/Modules/ae/_AEmodule.c
@@ -0,0 +1,1459 @@
+
+/* =========================== Module _AE =========================== */
+
+#include "Python.h"
+
+
+
+#include "pymactoolbox.h"
+
+#ifndef HAVE_OSX105_SDK
+typedef SInt32 SRefCon;
+#endif
+
+/* Macro to test whether a weak-loaded CFM function exists */
+#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
+ PyErr_SetString(PyExc_NotImplementedError, \
+ "Not available in this shared library/OS version"); \
+ return NULL; \
+ }} while(0)
+
+
+#include <Carbon/Carbon.h>
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_AEDesc_New(AEDesc *);
+extern int _AEDesc_Convert(PyObject *, AEDesc *);
+
+#define AEDesc_New _AEDesc_New
+#define AEDesc_NewBorrowed _AEDesc_NewBorrowed
+#define AEDesc_Convert _AEDesc_Convert
+#endif
+
+typedef long refcontype;
+
+static pascal OSErr GenericEventHandler(const AppleEvent *request, AppleEvent *reply, refcontype refcon); /* Forward */
+
+AEEventHandlerUPP upp_GenericEventHandler;
+
+static pascal Boolean AEIdleProc(EventRecord *theEvent, long *sleepTime, RgnHandle *mouseRgn)
+{
+ if ( PyOS_InterruptOccurred() )
+ return 1;
+ return 0;
+}
+
+AEIdleUPP upp_AEIdleProc;
+
+static PyObject *AE_Error;
+
+/* ----------------------- Object type AEDesc ----------------------- */
+
+PyTypeObject AEDesc_Type;
+
+#define AEDesc_Check(x) ((x)->ob_type == &AEDesc_Type || PyObject_TypeCheck((x), &AEDesc_Type))
+
+typedef struct AEDescObject {
+ PyObject_HEAD
+ AEDesc ob_itself;
+ int ob_owned;
+} AEDescObject;
+
+PyObject *AEDesc_New(AEDesc *itself)
+{
+ AEDescObject *it;
+ it = PyObject_NEW(AEDescObject, &AEDesc_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = *itself;
+ it->ob_owned = 1;
+ return (PyObject *)it;
+}
+
+int AEDesc_Convert(PyObject *v, AEDesc *p_itself)
+{
+ if (!AEDesc_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "AEDesc required");
+ return 0;
+ }
+ *p_itself = ((AEDescObject *)v)->ob_itself;
+ return 1;
+}
+
+static void AEDesc_dealloc(AEDescObject *self)
+{
+ if (self->ob_owned) AEDisposeDesc(&self->ob_itself);
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *AEDesc_AECoerceDesc(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ DescType toType;
+ AEDesc result;
+#ifndef AECoerceDesc
+ PyMac_PRECHECK(AECoerceDesc);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &toType))
+ return NULL;
+ _err = AECoerceDesc(&_self->ob_itself,
+ toType,
+ &result);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &result);
+ return _res;
+}
+
+static PyObject *AEDesc_AEDuplicateDesc(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEDesc result;
+#ifndef AEDuplicateDesc
+ PyMac_PRECHECK(AEDuplicateDesc);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = AEDuplicateDesc(&_self->ob_itself,
+ &result);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &result);
+ return _res;
+}
+
+static PyObject *AEDesc_AECountItems(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long theCount;
+#ifndef AECountItems
+ PyMac_PRECHECK(AECountItems);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = AECountItems(&_self->ob_itself,
+ &theCount);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ theCount);
+ return _res;
+}
+
+static PyObject *AEDesc_AEPutPtr(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long index;
+ DescType typeCode;
+ char *dataPtr__in__;
+ long dataPtr__len__;
+ int dataPtr__in_len__;
+#ifndef AEPutPtr
+ PyMac_PRECHECK(AEPutPtr);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&s#",
+ &index,
+ PyMac_GetOSType, &typeCode,
+ &dataPtr__in__, &dataPtr__in_len__))
+ return NULL;
+ dataPtr__len__ = dataPtr__in_len__;
+ _err = AEPutPtr(&_self->ob_itself,
+ index,
+ typeCode,
+ dataPtr__in__, dataPtr__len__);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *AEDesc_AEPutDesc(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long index;
+ AEDesc theAEDesc;
+#ifndef AEPutDesc
+ PyMac_PRECHECK(AEPutDesc);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&",
+ &index,
+ AEDesc_Convert, &theAEDesc))
+ return NULL;
+ _err = AEPutDesc(&_self->ob_itself,
+ index,
+ &theAEDesc);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *AEDesc_AEGetNthPtr(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long index;
+ DescType desiredType;
+ AEKeyword theAEKeyword;
+ DescType typeCode;
+ char *dataPtr__out__;
+ long dataPtr__len__;
+ int dataPtr__in_len__;
+#ifndef AEGetNthPtr
+ PyMac_PRECHECK(AEGetNthPtr);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&i",
+ &index,
+ PyMac_GetOSType, &desiredType,
+ &dataPtr__in_len__))
+ return NULL;
+ if ((dataPtr__out__ = malloc(dataPtr__in_len__)) == NULL)
+ {
+ PyErr_NoMemory();
+ goto dataPtr__error__;
+ }
+ dataPtr__len__ = dataPtr__in_len__;
+ _err = AEGetNthPtr(&_self->ob_itself,
+ index,
+ desiredType,
+ &theAEKeyword,
+ &typeCode,
+ dataPtr__out__, dataPtr__len__, &dataPtr__len__);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&O&s#",
+ PyMac_BuildOSType, theAEKeyword,
+ PyMac_BuildOSType, typeCode,
+ dataPtr__out__, (int)dataPtr__len__);
+ free(dataPtr__out__);
+ dataPtr__error__: ;
+ return _res;
+}
+
+static PyObject *AEDesc_AEGetNthDesc(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long index;
+ DescType desiredType;
+ AEKeyword theAEKeyword;
+ AEDesc result;
+#ifndef AEGetNthDesc
+ PyMac_PRECHECK(AEGetNthDesc);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&",
+ &index,
+ PyMac_GetOSType, &desiredType))
+ return NULL;
+ _err = AEGetNthDesc(&_self->ob_itself,
+ index,
+ desiredType,
+ &theAEKeyword,
+ &result);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&O&",
+ PyMac_BuildOSType, theAEKeyword,
+ AEDesc_New, &result);
+ return _res;
+}
+
+static PyObject *AEDesc_AESizeOfNthItem(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long index;
+ DescType typeCode;
+ Size dataSize;
+#ifndef AESizeOfNthItem
+ PyMac_PRECHECK(AESizeOfNthItem);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &index))
+ return NULL;
+ _err = AESizeOfNthItem(&_self->ob_itself,
+ index,
+ &typeCode,
+ &dataSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&l",
+ PyMac_BuildOSType, typeCode,
+ dataSize);
+ return _res;
+}
+
+static PyObject *AEDesc_AEDeleteItem(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long index;
+#ifndef AEDeleteItem
+ PyMac_PRECHECK(AEDeleteItem);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &index))
+ return NULL;
+ _err = AEDeleteItem(&_self->ob_itself,
+ index);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *AEDesc_AEPutParamPtr(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEKeyword theAEKeyword;
+ DescType typeCode;
+ char *dataPtr__in__;
+ long dataPtr__len__;
+ int dataPtr__in_len__;
+#ifndef AEPutParamPtr
+ PyMac_PRECHECK(AEPutParamPtr);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&s#",
+ PyMac_GetOSType, &theAEKeyword,
+ PyMac_GetOSType, &typeCode,
+ &dataPtr__in__, &dataPtr__in_len__))
+ return NULL;
+ dataPtr__len__ = dataPtr__in_len__;
+ _err = AEPutParamPtr(&_self->ob_itself,
+ theAEKeyword,
+ typeCode,
+ dataPtr__in__, dataPtr__len__);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *AEDesc_AEPutParamDesc(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEKeyword theAEKeyword;
+ AEDesc theAEDesc;
+#ifndef AEPutParamDesc
+ PyMac_PRECHECK(AEPutParamDesc);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &theAEKeyword,
+ AEDesc_Convert, &theAEDesc))
+ return NULL;
+ _err = AEPutParamDesc(&_self->ob_itself,
+ theAEKeyword,
+ &theAEDesc);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *AEDesc_AEGetParamPtr(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEKeyword theAEKeyword;
+ DescType desiredType;
+ DescType typeCode;
+ char *dataPtr__out__;
+ long dataPtr__len__;
+ int dataPtr__in_len__;
+#ifndef AEGetParamPtr
+ PyMac_PRECHECK(AEGetParamPtr);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&i",
+ PyMac_GetOSType, &theAEKeyword,
+ PyMac_GetOSType, &desiredType,
+ &dataPtr__in_len__))
+ return NULL;
+ if ((dataPtr__out__ = malloc(dataPtr__in_len__)) == NULL)
+ {
+ PyErr_NoMemory();
+ goto dataPtr__error__;
+ }
+ dataPtr__len__ = dataPtr__in_len__;
+ _err = AEGetParamPtr(&_self->ob_itself,
+ theAEKeyword,
+ desiredType,
+ &typeCode,
+ dataPtr__out__, dataPtr__len__, &dataPtr__len__);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&s#",
+ PyMac_BuildOSType, typeCode,
+ dataPtr__out__, (int)dataPtr__len__);
+ free(dataPtr__out__);
+ dataPtr__error__: ;
+ return _res;
+}
+
+static PyObject *AEDesc_AEGetParamDesc(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEKeyword theAEKeyword;
+ DescType desiredType;
+ AEDesc result;
+#ifndef AEGetParamDesc
+ PyMac_PRECHECK(AEGetParamDesc);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &theAEKeyword,
+ PyMac_GetOSType, &desiredType))
+ return NULL;
+ _err = AEGetParamDesc(&_self->ob_itself,
+ theAEKeyword,
+ desiredType,
+ &result);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &result);
+ return _res;
+}
+
+static PyObject *AEDesc_AESizeOfParam(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEKeyword theAEKeyword;
+ DescType typeCode;
+ Size dataSize;
+#ifndef AESizeOfParam
+ PyMac_PRECHECK(AESizeOfParam);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &theAEKeyword))
+ return NULL;
+ _err = AESizeOfParam(&_self->ob_itself,
+ theAEKeyword,
+ &typeCode,
+ &dataSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&l",
+ PyMac_BuildOSType, typeCode,
+ dataSize);
+ return _res;
+}
+
+static PyObject *AEDesc_AEDeleteParam(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEKeyword theAEKeyword;
+#ifndef AEDeleteParam
+ PyMac_PRECHECK(AEDeleteParam);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &theAEKeyword))
+ return NULL;
+ _err = AEDeleteParam(&_self->ob_itself,
+ theAEKeyword);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *AEDesc_AEGetAttributePtr(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEKeyword theAEKeyword;
+ DescType desiredType;
+ DescType typeCode;
+ char *dataPtr__out__;
+ long dataPtr__len__;
+ int dataPtr__in_len__;
+#ifndef AEGetAttributePtr
+ PyMac_PRECHECK(AEGetAttributePtr);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&i",
+ PyMac_GetOSType, &theAEKeyword,
+ PyMac_GetOSType, &desiredType,
+ &dataPtr__in_len__))
+ return NULL;
+ if ((dataPtr__out__ = malloc(dataPtr__in_len__)) == NULL)
+ {
+ PyErr_NoMemory();
+ goto dataPtr__error__;
+ }
+ dataPtr__len__ = dataPtr__in_len__;
+ _err = AEGetAttributePtr(&_self->ob_itself,
+ theAEKeyword,
+ desiredType,
+ &typeCode,
+ dataPtr__out__, dataPtr__len__, &dataPtr__len__);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&s#",
+ PyMac_BuildOSType, typeCode,
+ dataPtr__out__, (int)dataPtr__len__);
+ free(dataPtr__out__);
+ dataPtr__error__: ;
+ return _res;
+}
+
+static PyObject *AEDesc_AEGetAttributeDesc(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEKeyword theAEKeyword;
+ DescType desiredType;
+ AEDesc result;
+#ifndef AEGetAttributeDesc
+ PyMac_PRECHECK(AEGetAttributeDesc);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &theAEKeyword,
+ PyMac_GetOSType, &desiredType))
+ return NULL;
+ _err = AEGetAttributeDesc(&_self->ob_itself,
+ theAEKeyword,
+ desiredType,
+ &result);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &result);
+ return _res;
+}
+
+static PyObject *AEDesc_AESizeOfAttribute(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEKeyword theAEKeyword;
+ DescType typeCode;
+ Size dataSize;
+#ifndef AESizeOfAttribute
+ PyMac_PRECHECK(AESizeOfAttribute);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &theAEKeyword))
+ return NULL;
+ _err = AESizeOfAttribute(&_self->ob_itself,
+ theAEKeyword,
+ &typeCode,
+ &dataSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&l",
+ PyMac_BuildOSType, typeCode,
+ dataSize);
+ return _res;
+}
+
+static PyObject *AEDesc_AEPutAttributePtr(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEKeyword theAEKeyword;
+ DescType typeCode;
+ char *dataPtr__in__;
+ long dataPtr__len__;
+ int dataPtr__in_len__;
+#ifndef AEPutAttributePtr
+ PyMac_PRECHECK(AEPutAttributePtr);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&s#",
+ PyMac_GetOSType, &theAEKeyword,
+ PyMac_GetOSType, &typeCode,
+ &dataPtr__in__, &dataPtr__in_len__))
+ return NULL;
+ dataPtr__len__ = dataPtr__in_len__;
+ _err = AEPutAttributePtr(&_self->ob_itself,
+ theAEKeyword,
+ typeCode,
+ dataPtr__in__, dataPtr__len__);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *AEDesc_AEPutAttributeDesc(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEKeyword theAEKeyword;
+ AEDesc theAEDesc;
+#ifndef AEPutAttributeDesc
+ PyMac_PRECHECK(AEPutAttributeDesc);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &theAEKeyword,
+ AEDesc_Convert, &theAEDesc))
+ return NULL;
+ _err = AEPutAttributeDesc(&_self->ob_itself,
+ theAEKeyword,
+ &theAEDesc);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *AEDesc_AEGetDescDataSize(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Size _rv;
+#ifndef AEGetDescDataSize
+ PyMac_PRECHECK(AEGetDescDataSize);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = AEGetDescDataSize(&_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *AEDesc_AESend(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AppleEvent reply;
+ AESendMode sendMode;
+ AESendPriority sendPriority;
+ long timeOutInTicks;
+#ifndef AESend
+ PyMac_PRECHECK(AESend);
+#endif
+ if (!PyArg_ParseTuple(_args, "lhl",
+ &sendMode,
+ &sendPriority,
+ &timeOutInTicks))
+ return NULL;
+ _err = AESend(&_self->ob_itself,
+ &reply,
+ sendMode,
+ sendPriority,
+ timeOutInTicks,
+ upp_AEIdleProc,
+ (AEFilterUPP)0);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &reply);
+ return _res;
+}
+
+static PyObject *AEDesc_AEResetTimer(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+#ifndef AEResetTimer
+ PyMac_PRECHECK(AEResetTimer);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = AEResetTimer(&_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *AEDesc_AESuspendTheCurrentEvent(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+#ifndef AESuspendTheCurrentEvent
+ PyMac_PRECHECK(AESuspendTheCurrentEvent);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = AESuspendTheCurrentEvent(&_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *AEDesc_AEResumeTheCurrentEvent(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AppleEvent reply;
+ AEEventHandlerUPP dispatcher__proc__ = upp_GenericEventHandler;
+ PyObject *dispatcher;
+#ifndef AEResumeTheCurrentEvent
+ PyMac_PRECHECK(AEResumeTheCurrentEvent);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O",
+ AEDesc_Convert, &reply,
+ &dispatcher))
+ return NULL;
+ _err = AEResumeTheCurrentEvent(&_self->ob_itself,
+ &reply,
+ dispatcher__proc__,
+ (SRefCon)dispatcher);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ Py_INCREF(dispatcher); /* XXX leak, but needed */
+ return _res;
+}
+
+static PyObject *AEDesc_AEGetTheCurrentEvent(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+#ifndef AEGetTheCurrentEvent
+ PyMac_PRECHECK(AEGetTheCurrentEvent);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = AEGetTheCurrentEvent(&_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *AEDesc_AESetTheCurrentEvent(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+#ifndef AESetTheCurrentEvent
+ PyMac_PRECHECK(AESetTheCurrentEvent);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = AESetTheCurrentEvent(&_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *AEDesc_AEResolve(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short callbackFlags;
+ AEDesc theToken;
+#ifndef AEResolve
+ PyMac_PRECHECK(AEResolve);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &callbackFlags))
+ return NULL;
+ _err = AEResolve(&_self->ob_itself,
+ callbackFlags,
+ &theToken);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &theToken);
+ return _res;
+}
+
+static PyObject *AEDesc_AutoDispose(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ int onoff, old;
+ if (!PyArg_ParseTuple(_args, "i", &onoff))
+ return NULL;
+ old = _self->ob_owned;
+ _self->ob_owned = onoff;
+ _res = Py_BuildValue("i", old);
+ return _res;
+
+}
+
+static PyMethodDef AEDesc_methods[] = {
+ {"AECoerceDesc", (PyCFunction)AEDesc_AECoerceDesc, 1,
+ PyDoc_STR("(DescType toType) -> (AEDesc result)")},
+ {"AEDuplicateDesc", (PyCFunction)AEDesc_AEDuplicateDesc, 1,
+ PyDoc_STR("() -> (AEDesc result)")},
+ {"AECountItems", (PyCFunction)AEDesc_AECountItems, 1,
+ PyDoc_STR("() -> (long theCount)")},
+ {"AEPutPtr", (PyCFunction)AEDesc_AEPutPtr, 1,
+ PyDoc_STR("(long index, DescType typeCode, Buffer dataPtr) -> None")},
+ {"AEPutDesc", (PyCFunction)AEDesc_AEPutDesc, 1,
+ PyDoc_STR("(long index, AEDesc theAEDesc) -> None")},
+ {"AEGetNthPtr", (PyCFunction)AEDesc_AEGetNthPtr, 1,
+ PyDoc_STR("(long index, DescType desiredType, Buffer dataPtr) -> (AEKeyword theAEKeyword, DescType typeCode, Buffer dataPtr)")},
+ {"AEGetNthDesc", (PyCFunction)AEDesc_AEGetNthDesc, 1,
+ PyDoc_STR("(long index, DescType desiredType) -> (AEKeyword theAEKeyword, AEDesc result)")},
+ {"AESizeOfNthItem", (PyCFunction)AEDesc_AESizeOfNthItem, 1,
+ PyDoc_STR("(long index) -> (DescType typeCode, Size dataSize)")},
+ {"AEDeleteItem", (PyCFunction)AEDesc_AEDeleteItem, 1,
+ PyDoc_STR("(long index) -> None")},
+ {"AEPutParamPtr", (PyCFunction)AEDesc_AEPutParamPtr, 1,
+ PyDoc_STR("(AEKeyword theAEKeyword, DescType typeCode, Buffer dataPtr) -> None")},
+ {"AEPutParamDesc", (PyCFunction)AEDesc_AEPutParamDesc, 1,
+ PyDoc_STR("(AEKeyword theAEKeyword, AEDesc theAEDesc) -> None")},
+ {"AEGetParamPtr", (PyCFunction)AEDesc_AEGetParamPtr, 1,
+ PyDoc_STR("(AEKeyword theAEKeyword, DescType desiredType, Buffer dataPtr) -> (DescType typeCode, Buffer dataPtr)")},
+ {"AEGetParamDesc", (PyCFunction)AEDesc_AEGetParamDesc, 1,
+ PyDoc_STR("(AEKeyword theAEKeyword, DescType desiredType) -> (AEDesc result)")},
+ {"AESizeOfParam", (PyCFunction)AEDesc_AESizeOfParam, 1,
+ PyDoc_STR("(AEKeyword theAEKeyword) -> (DescType typeCode, Size dataSize)")},
+ {"AEDeleteParam", (PyCFunction)AEDesc_AEDeleteParam, 1,
+ PyDoc_STR("(AEKeyword theAEKeyword) -> None")},
+ {"AEGetAttributePtr", (PyCFunction)AEDesc_AEGetAttributePtr, 1,
+ PyDoc_STR("(AEKeyword theAEKeyword, DescType desiredType, Buffer dataPtr) -> (DescType typeCode, Buffer dataPtr)")},
+ {"AEGetAttributeDesc", (PyCFunction)AEDesc_AEGetAttributeDesc, 1,
+ PyDoc_STR("(AEKeyword theAEKeyword, DescType desiredType) -> (AEDesc result)")},
+ {"AESizeOfAttribute", (PyCFunction)AEDesc_AESizeOfAttribute, 1,
+ PyDoc_STR("(AEKeyword theAEKeyword) -> (DescType typeCode, Size dataSize)")},
+ {"AEPutAttributePtr", (PyCFunction)AEDesc_AEPutAttributePtr, 1,
+ PyDoc_STR("(AEKeyword theAEKeyword, DescType typeCode, Buffer dataPtr) -> None")},
+ {"AEPutAttributeDesc", (PyCFunction)AEDesc_AEPutAttributeDesc, 1,
+ PyDoc_STR("(AEKeyword theAEKeyword, AEDesc theAEDesc) -> None")},
+ {"AEGetDescDataSize", (PyCFunction)AEDesc_AEGetDescDataSize, 1,
+ PyDoc_STR("() -> (Size _rv)")},
+ {"AESend", (PyCFunction)AEDesc_AESend, 1,
+ PyDoc_STR("(AESendMode sendMode, AESendPriority sendPriority, long timeOutInTicks) -> (AppleEvent reply)")},
+ {"AEResetTimer", (PyCFunction)AEDesc_AEResetTimer, 1,
+ PyDoc_STR("() -> None")},
+ {"AESuspendTheCurrentEvent", (PyCFunction)AEDesc_AESuspendTheCurrentEvent, 1,
+ PyDoc_STR("() -> None")},
+ {"AEResumeTheCurrentEvent", (PyCFunction)AEDesc_AEResumeTheCurrentEvent, 1,
+ PyDoc_STR("(AppleEvent reply, EventHandler dispatcher) -> None")},
+ {"AEGetTheCurrentEvent", (PyCFunction)AEDesc_AEGetTheCurrentEvent, 1,
+ PyDoc_STR("() -> None")},
+ {"AESetTheCurrentEvent", (PyCFunction)AEDesc_AESetTheCurrentEvent, 1,
+ PyDoc_STR("() -> None")},
+ {"AEResolve", (PyCFunction)AEDesc_AEResolve, 1,
+ PyDoc_STR("(short callbackFlags) -> (AEDesc theToken)")},
+ {"AutoDispose", (PyCFunction)AEDesc_AutoDispose, 1,
+ PyDoc_STR("(int)->int. Automatically AEDisposeDesc the object on Python object cleanup")},
+ {NULL, NULL, 0}
+};
+
+static PyObject *AEDesc_get_type(AEDescObject *self, void *closure)
+{
+ return PyMac_BuildOSType(self->ob_itself.descriptorType);
+}
+
+#define AEDesc_set_type NULL
+
+static PyObject *AEDesc_get_data(AEDescObject *self, void *closure)
+{
+ PyObject *res;
+ Size size;
+ char *ptr;
+ OSErr err;
+
+ size = AEGetDescDataSize(&self->ob_itself);
+ if ( (res = PyString_FromStringAndSize(NULL, size)) == NULL )
+ return NULL;
+ if ( (ptr = PyString_AsString(res)) == NULL )
+ return NULL;
+ if ( (err=AEGetDescData(&self->ob_itself, ptr, size)) < 0 )
+ return PyMac_Error(err);
+ return res;
+}
+
+#define AEDesc_set_data NULL
+
+static PyGetSetDef AEDesc_getsetlist[] = {
+ {"type", (getter)AEDesc_get_type, (setter)AEDesc_set_type, "Type of this AEDesc"},
+ {"data", (getter)AEDesc_get_data, (setter)AEDesc_set_data, "The raw data in this AEDesc"},
+ {NULL, NULL, NULL, NULL},
+};
+
+
+#define AEDesc_compare NULL
+
+#define AEDesc_repr NULL
+
+#define AEDesc_hash NULL
+#define AEDesc_tp_init 0
+
+#define AEDesc_tp_alloc PyType_GenericAlloc
+
+static PyObject *AEDesc_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *_self;
+ AEDesc itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, AEDesc_Convert, &itself)) return NULL;
+ if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((AEDescObject *)_self)->ob_itself = itself;
+ return _self;
+}
+
+#define AEDesc_tp_free PyObject_Del
+
+
+PyTypeObject AEDesc_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_AE.AEDesc", /*tp_name*/
+ sizeof(AEDescObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) AEDesc_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) AEDesc_compare, /*tp_compare*/
+ (reprfunc) AEDesc_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) AEDesc_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ AEDesc_methods, /* tp_methods */
+ 0, /*tp_members*/
+ AEDesc_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ AEDesc_tp_init, /* tp_init */
+ AEDesc_tp_alloc, /* tp_alloc */
+ AEDesc_tp_new, /* tp_new */
+ AEDesc_tp_free, /* tp_free */
+};
+
+/* --------------------- End object type AEDesc --------------------- */
+
+
+static PyObject *AE_AECoercePtr(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ DescType typeCode;
+ char *dataPtr__in__;
+ long dataPtr__len__;
+ int dataPtr__in_len__;
+ DescType toType;
+ AEDesc result;
+#ifndef AECoercePtr
+ PyMac_PRECHECK(AECoercePtr);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&s#O&",
+ PyMac_GetOSType, &typeCode,
+ &dataPtr__in__, &dataPtr__in_len__,
+ PyMac_GetOSType, &toType))
+ return NULL;
+ dataPtr__len__ = dataPtr__in_len__;
+ _err = AECoercePtr(typeCode,
+ dataPtr__in__, dataPtr__len__,
+ toType,
+ &result);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &result);
+ return _res;
+}
+
+static PyObject *AE_AECreateDesc(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ DescType typeCode;
+ char *dataPtr__in__;
+ long dataPtr__len__;
+ int dataPtr__in_len__;
+ AEDesc result;
+#ifndef AECreateDesc
+ PyMac_PRECHECK(AECreateDesc);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&s#",
+ PyMac_GetOSType, &typeCode,
+ &dataPtr__in__, &dataPtr__in_len__))
+ return NULL;
+ dataPtr__len__ = dataPtr__in_len__;
+ _err = AECreateDesc(typeCode,
+ dataPtr__in__, dataPtr__len__,
+ &result);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &result);
+ return _res;
+}
+
+static PyObject *AE_AECreateList(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ char *factoringPtr__in__;
+ long factoringPtr__len__;
+ int factoringPtr__in_len__;
+ Boolean isRecord;
+ AEDescList resultList;
+#ifndef AECreateList
+ PyMac_PRECHECK(AECreateList);
+#endif
+ if (!PyArg_ParseTuple(_args, "s#b",
+ &factoringPtr__in__, &factoringPtr__in_len__,
+ &isRecord))
+ return NULL;
+ factoringPtr__len__ = factoringPtr__in_len__;
+ _err = AECreateList(factoringPtr__in__, factoringPtr__len__,
+ isRecord,
+ &resultList);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &resultList);
+ return _res;
+}
+
+static PyObject *AE_AECreateAppleEvent(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEEventClass theAEEventClass;
+ AEEventID theAEEventID;
+ AEAddressDesc target;
+ AEReturnID returnID;
+ AETransactionID transactionID;
+ AppleEvent result;
+#ifndef AECreateAppleEvent
+ PyMac_PRECHECK(AECreateAppleEvent);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&hl",
+ PyMac_GetOSType, &theAEEventClass,
+ PyMac_GetOSType, &theAEEventID,
+ AEDesc_Convert, &target,
+ &returnID,
+ &transactionID))
+ return NULL;
+ _err = AECreateAppleEvent(theAEEventClass,
+ theAEEventID,
+ &target,
+ returnID,
+ transactionID,
+ &result);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &result);
+ return _res;
+}
+
+static PyObject *AE_AEReplaceDescData(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ DescType typeCode;
+ char *dataPtr__in__;
+ long dataPtr__len__;
+ int dataPtr__in_len__;
+ AEDesc theAEDesc;
+#ifndef AEReplaceDescData
+ PyMac_PRECHECK(AEReplaceDescData);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&s#",
+ PyMac_GetOSType, &typeCode,
+ &dataPtr__in__, &dataPtr__in_len__))
+ return NULL;
+ dataPtr__len__ = dataPtr__in_len__;
+ _err = AEReplaceDescData(typeCode,
+ dataPtr__in__, dataPtr__len__,
+ &theAEDesc);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &theAEDesc);
+ return _res;
+}
+
+static PyObject *AE_AEProcessAppleEvent(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ EventRecord theEventRecord;
+#ifndef AEProcessAppleEvent
+ PyMac_PRECHECK(AEProcessAppleEvent);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetEventRecord, &theEventRecord))
+ return NULL;
+ _err = AEProcessAppleEvent(&theEventRecord);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *AE_AEGetInteractionAllowed(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEInteractAllowed level;
+#ifndef AEGetInteractionAllowed
+ PyMac_PRECHECK(AEGetInteractionAllowed);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = AEGetInteractionAllowed(&level);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("b",
+ level);
+ return _res;
+}
+
+static PyObject *AE_AESetInteractionAllowed(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEInteractAllowed level;
+#ifndef AESetInteractionAllowed
+ PyMac_PRECHECK(AESetInteractionAllowed);
+#endif
+ if (!PyArg_ParseTuple(_args, "b",
+ &level))
+ return NULL;
+ _err = AESetInteractionAllowed(level);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *AE_AEInteractWithUser(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long timeOutInTicks;
+#ifndef AEInteractWithUser
+ PyMac_PRECHECK(AEInteractWithUser);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &timeOutInTicks))
+ return NULL;
+ _err = AEInteractWithUser(timeOutInTicks,
+ (NMRecPtr)0,
+ upp_AEIdleProc);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *AE_AEInstallEventHandler(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEEventClass theAEEventClass;
+ AEEventID theAEEventID;
+ AEEventHandlerUPP handler__proc__ = upp_GenericEventHandler;
+ PyObject *handler;
+#ifndef AEInstallEventHandler
+ PyMac_PRECHECK(AEInstallEventHandler);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O",
+ PyMac_GetOSType, &theAEEventClass,
+ PyMac_GetOSType, &theAEEventID,
+ &handler))
+ return NULL;
+ _err = AEInstallEventHandler(theAEEventClass,
+ theAEEventID,
+ handler__proc__, (SRefCon)handler,
+ 0);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ Py_INCREF(handler); /* XXX leak, but needed */
+ return _res;
+}
+
+static PyObject *AE_AERemoveEventHandler(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEEventClass theAEEventClass;
+ AEEventID theAEEventID;
+#ifndef AERemoveEventHandler
+ PyMac_PRECHECK(AERemoveEventHandler);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &theAEEventClass,
+ PyMac_GetOSType, &theAEEventID))
+ return NULL;
+ _err = AERemoveEventHandler(theAEEventClass,
+ theAEEventID,
+ upp_GenericEventHandler,
+ 0);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *AE_AEGetEventHandler(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEEventClass theAEEventClass;
+ AEEventID theAEEventID;
+ AEEventHandlerUPP handler__proc__ = upp_GenericEventHandler;
+ PyObject *handler;
+#ifndef AEGetEventHandler
+ PyMac_PRECHECK(AEGetEventHandler);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &theAEEventClass,
+ PyMac_GetOSType, &theAEEventID))
+ return NULL;
+ _err = AEGetEventHandler(theAEEventClass,
+ theAEEventID,
+ &handler__proc__, (SRefCon *)&handler,
+ 0);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O",
+ handler);
+ Py_INCREF(handler); /* XXX leak, but needed */
+ return _res;
+}
+
+static PyObject *AE_AEInstallSpecialHandler(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEKeyword functionClass;
+#ifndef AEInstallSpecialHandler
+ PyMac_PRECHECK(AEInstallSpecialHandler);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &functionClass))
+ return NULL;
+ _err = AEInstallSpecialHandler(functionClass,
+ upp_GenericEventHandler,
+ 0);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *AE_AERemoveSpecialHandler(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEKeyword functionClass;
+#ifndef AERemoveSpecialHandler
+ PyMac_PRECHECK(AERemoveSpecialHandler);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &functionClass))
+ return NULL;
+ _err = AERemoveSpecialHandler(functionClass,
+ upp_GenericEventHandler,
+ 0);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *AE_AEManagerInfo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEKeyword keyWord;
+ long result;
+#ifndef AEManagerInfo
+ PyMac_PRECHECK(AEManagerInfo);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &keyWord))
+ return NULL;
+ _err = AEManagerInfo(keyWord,
+ &result);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ result);
+ return _res;
+}
+
+static PyObject *AE_AEObjectInit(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+#ifndef AEObjectInit
+ PyMac_PRECHECK(AEObjectInit);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = AEObjectInit();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *AE_AEDisposeToken(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEDesc theToken;
+#ifndef AEDisposeToken
+ PyMac_PRECHECK(AEDisposeToken);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = AEDisposeToken(&theToken);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &theToken);
+ return _res;
+}
+
+static PyObject *AE_AECallObjectAccessor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ DescType desiredClass;
+ AEDesc containerToken;
+ DescType containerClass;
+ DescType keyForm;
+ AEDesc keyData;
+ AEDesc token;
+#ifndef AECallObjectAccessor
+ PyMac_PRECHECK(AECallObjectAccessor);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&O&",
+ PyMac_GetOSType, &desiredClass,
+ AEDesc_Convert, &containerToken,
+ PyMac_GetOSType, &containerClass,
+ PyMac_GetOSType, &keyForm,
+ AEDesc_Convert, &keyData))
+ return NULL;
+ _err = AECallObjectAccessor(desiredClass,
+ &containerToken,
+ containerClass,
+ keyForm,
+ &keyData,
+ &token);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &token);
+ return _res;
+}
+
+static PyMethodDef AE_methods[] = {
+ {"AECoercePtr", (PyCFunction)AE_AECoercePtr, 1,
+ PyDoc_STR("(DescType typeCode, Buffer dataPtr, DescType toType) -> (AEDesc result)")},
+ {"AECreateDesc", (PyCFunction)AE_AECreateDesc, 1,
+ PyDoc_STR("(DescType typeCode, Buffer dataPtr) -> (AEDesc result)")},
+ {"AECreateList", (PyCFunction)AE_AECreateList, 1,
+ PyDoc_STR("(Buffer factoringPtr, Boolean isRecord) -> (AEDescList resultList)")},
+ {"AECreateAppleEvent", (PyCFunction)AE_AECreateAppleEvent, 1,
+ PyDoc_STR("(AEEventClass theAEEventClass, AEEventID theAEEventID, AEAddressDesc target, AEReturnID returnID, AETransactionID transactionID) -> (AppleEvent result)")},
+ {"AEReplaceDescData", (PyCFunction)AE_AEReplaceDescData, 1,
+ PyDoc_STR("(DescType typeCode, Buffer dataPtr) -> (AEDesc theAEDesc)")},
+ {"AEProcessAppleEvent", (PyCFunction)AE_AEProcessAppleEvent, 1,
+ PyDoc_STR("(EventRecord theEventRecord) -> None")},
+ {"AEGetInteractionAllowed", (PyCFunction)AE_AEGetInteractionAllowed, 1,
+ PyDoc_STR("() -> (AEInteractAllowed level)")},
+ {"AESetInteractionAllowed", (PyCFunction)AE_AESetInteractionAllowed, 1,
+ PyDoc_STR("(AEInteractAllowed level) -> None")},
+ {"AEInteractWithUser", (PyCFunction)AE_AEInteractWithUser, 1,
+ PyDoc_STR("(long timeOutInTicks) -> None")},
+ {"AEInstallEventHandler", (PyCFunction)AE_AEInstallEventHandler, 1,
+ PyDoc_STR("(AEEventClass theAEEventClass, AEEventID theAEEventID, EventHandler handler) -> None")},
+ {"AERemoveEventHandler", (PyCFunction)AE_AERemoveEventHandler, 1,
+ PyDoc_STR("(AEEventClass theAEEventClass, AEEventID theAEEventID) -> None")},
+ {"AEGetEventHandler", (PyCFunction)AE_AEGetEventHandler, 1,
+ PyDoc_STR("(AEEventClass theAEEventClass, AEEventID theAEEventID) -> (EventHandler handler)")},
+ {"AEInstallSpecialHandler", (PyCFunction)AE_AEInstallSpecialHandler, 1,
+ PyDoc_STR("(AEKeyword functionClass) -> None")},
+ {"AERemoveSpecialHandler", (PyCFunction)AE_AERemoveSpecialHandler, 1,
+ PyDoc_STR("(AEKeyword functionClass) -> None")},
+ {"AEManagerInfo", (PyCFunction)AE_AEManagerInfo, 1,
+ PyDoc_STR("(AEKeyword keyWord) -> (long result)")},
+ {"AEObjectInit", (PyCFunction)AE_AEObjectInit, 1,
+ PyDoc_STR("() -> None")},
+ {"AEDisposeToken", (PyCFunction)AE_AEDisposeToken, 1,
+ PyDoc_STR("() -> (AEDesc theToken)")},
+ {"AECallObjectAccessor", (PyCFunction)AE_AECallObjectAccessor, 1,
+ PyDoc_STR("(DescType desiredClass, AEDesc containerToken, DescType containerClass, DescType keyForm, AEDesc keyData) -> (AEDesc token)")},
+ {NULL, NULL, 0}
+};
+
+
+
+static pascal OSErr
+GenericEventHandler(const AppleEvent *request, AppleEvent *reply, refcontype refcon)
+{
+ PyObject *handler = (PyObject *)refcon;
+ AEDescObject *requestObject, *replyObject;
+ PyObject *args, *res;
+ if ((requestObject = (AEDescObject *)AEDesc_New((AppleEvent *)request)) == NULL) {
+ return -1;
+ }
+ if ((replyObject = (AEDescObject *)AEDesc_New(reply)) == NULL) {
+ Py_DECREF(requestObject);
+ return -1;
+ }
+ if ((args = Py_BuildValue("OO", requestObject, replyObject)) == NULL) {
+ Py_DECREF(requestObject);
+ Py_DECREF(replyObject);
+ return -1;
+ }
+ res = PyEval_CallObject(handler, args);
+ requestObject->ob_itself.descriptorType = 'null';
+ requestObject->ob_itself.dataHandle = NULL;
+ replyObject->ob_itself.descriptorType = 'null';
+ replyObject->ob_itself.dataHandle = NULL;
+ Py_DECREF(args);
+ if (res == NULL) {
+ PySys_WriteStderr("Exception in AE event handler function\n");
+ PyErr_Print();
+ return -1;
+ }
+ Py_DECREF(res);
+ return noErr;
+}
+
+PyObject *AEDesc_NewBorrowed(AEDesc *itself)
+{
+ PyObject *it;
+
+ it = AEDesc_New(itself);
+ if (it)
+ ((AEDescObject *)it)->ob_owned = 0;
+ return (PyObject *)it;
+}
+
+
+
+void init_AE(void)
+{
+ PyObject *m;
+ PyObject *d;
+
+ upp_AEIdleProc = NewAEIdleUPP(AEIdleProc);
+ upp_GenericEventHandler = NewAEEventHandlerUPP(GenericEventHandler);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(AEDesc *, AEDesc_New);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(AEDesc *, AEDesc_NewBorrowed);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(AEDesc, AEDesc_Convert);
+
+ m = Py_InitModule("_AE", AE_methods);
+ d = PyModule_GetDict(m);
+ AE_Error = PyMac_GetOSErrException();
+ if (AE_Error == NULL ||
+ PyDict_SetItemString(d, "Error", AE_Error) != 0)
+ return;
+ AEDesc_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&AEDesc_Type) < 0) return;
+ Py_INCREF(&AEDesc_Type);
+ PyModule_AddObject(m, "AEDesc", (PyObject *)&AEDesc_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&AEDesc_Type);
+ PyModule_AddObject(m, "AEDescType", (PyObject *)&AEDesc_Type);
+}
+
+/* ========================= End module _AE ========================= */
+
diff --git a/Mac/Modules/ae/aescan.py b/Mac/Modules/ae/aescan.py
new file mode 100644
index 0000000000..ce19a5e25c
--- /dev/null
+++ b/Mac/Modules/ae/aescan.py
@@ -0,0 +1,97 @@
+# Scan AppleEvents.h header file, generate aegen.py and AppleEvents.py files.
+# Then run aesupport to generate AEmodule.c.
+# (Should learn how to tell the compiler to compile it as well.)
+
+import sys
+import MacOS
+
+from bgenlocations import TOOLBOXDIR, BGENDIR
+sys.path.append(BGENDIR)
+
+from scantools import Scanner
+
+def main():
+ print "=== Scanning AEDataModel.h, AppleEvents.h, AERegistry.h, AEObjects.h ==="
+ input = ["AEDataModel.h", "AEInteraction.h", "AppleEvents.h", "AERegistry.h", "AEObjects.h"]
+ output = "aegen.py"
+ defsoutput = TOOLBOXDIR + "AppleEvents.py"
+ scanner = AppleEventsScanner(input, output, defsoutput)
+ scanner.scan()
+ scanner.close()
+ print "=== Testing definitions output code ==="
+ execfile(defsoutput, {}, {})
+ print "=== Done Scanning and Generating, now doing 'import aesupport' ==="
+ import aesupport
+ print "=== Done 'import aesupport'. It's up to you to compile AEmodule.c ==="
+
+class AppleEventsScanner(Scanner):
+
+ def destination(self, type, name, arglist):
+ classname = "AEFunction"
+ listname = "functions"
+ if arglist:
+ t, n, m = arglist[0]
+ if t[-4:] == "_ptr" and m == "InMode" and \
+ t[:-4] in ("AEDesc", "AEAddressDesc", "AEDescList",
+ "AERecord", "AppleEvent"):
+ classname = "AEMethod"
+ listname = "aedescmethods"
+ return classname, listname
+
+ def makeblacklistnames(self):
+ return [
+ "AEDisposeDesc",
+# "AEGetEventHandler",
+ "AEGetDescData", # Use object.data
+ "AEGetSpecialHandler",
+ # Constants with funny definitions
+ "kAEDontDisposeOnResume",
+ "kAEUseStandardDispatch",
+ ]
+
+ def makeblacklisttypes(self):
+ return [
+ "ProcPtr",
+ "AEArrayType",
+ "AECoercionHandlerUPP",
+ "UniversalProcPtr",
+ "OSLCompareUPP",
+ "OSLAccessorUPP",
+ ]
+
+ def makerepairinstructions(self):
+ return [
+ ([("Boolean", "isSysHandler", "InMode")],
+ [("AlwaysFalse", "*", "*")]),
+
+ ([("void_ptr", "*", "InMode"), ("Size", "*", "InMode")],
+ [("InBuffer", "*", "*")]),
+
+ ([("EventHandlerProcPtr", "*", "InMode"), ("long", "*", "InMode")],
+ [("EventHandler", "*", "*")]),
+
+ ([("EventHandlerProcPtr", "*", "OutMode"), ("long", "*", "OutMode")],
+ [("EventHandler", "*", "*")]),
+
+ ([("AEEventHandlerUPP", "*", "InMode"), ("long", "*", "InMode")],
+ [("EventHandler", "*", "*")]),
+
+ ([("AEEventHandlerUPP", "*", "OutMode"), ("long", "*", "OutMode")],
+ [("EventHandler", "*", "*")]),
+
+ ([("void", "*", "OutMode"), ("Size", "*", "InMode"),
+ ("Size", "*", "OutMode")],
+ [("VarVarOutBuffer", "*", "InOutMode")]),
+
+ ([("AppleEvent", "theAppleEvent", "OutMode")],
+ [("AppleEvent_ptr", "*", "InMode")]),
+
+ ([("AEDescList", "theAEDescList", "OutMode")],
+ [("AEDescList_ptr", "*", "InMode")]),
+ ]
+
+ def writeinitialdefs(self):
+ self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
+
+if __name__ == "__main__":
+ main()
diff --git a/Mac/Modules/ae/aesupport.py b/Mac/Modules/ae/aesupport.py
new file mode 100644
index 0000000000..91c5b82efe
--- /dev/null
+++ b/Mac/Modules/ae/aesupport.py
@@ -0,0 +1,237 @@
+# This script will generate the AppleEvents interface for Python.
+# It uses the "bgen" package to generate C code.
+# It execs the file aegen.py which contain the function definitions
+# (aegen.py was generated by aescan.py, scanning the <AppleEvents.h> header file).
+
+
+from macsupport import *
+
+
+AEArrayType = Type("AEArrayType", "c")
+AESendMode = Type("AESendMode", "l")
+AESendPriority = Type("AESendPriority", "h")
+AEInteractAllowed = Type("AEInteractAllowed", "b")
+AEReturnID = Type("AEReturnID", "h")
+AETransactionID = Type("AETransactionID", "l")
+
+
+
+AEEventClass = OSTypeType('AEEventClass')
+AEEventID = OSTypeType('AEEventID')
+AEKeyword = OSTypeType('AEKeyword')
+DescType = OSTypeType('DescType')
+
+
+AEDesc = OpaqueType('AEDesc')
+AEDesc_ptr = OpaqueType('AEDesc')
+
+AEAddressDesc = OpaqueType('AEAddressDesc', 'AEDesc')
+AEAddressDesc_ptr = OpaqueType('AEAddressDesc', 'AEDesc')
+
+AEDescList = OpaqueType('AEDescList', 'AEDesc')
+AEDescList_ptr = OpaqueType('AEDescList', 'AEDesc')
+
+AERecord = OpaqueType('AERecord', 'AEDesc')
+AERecord_ptr = OpaqueType('AERecord', 'AEDesc')
+
+AppleEvent = OpaqueType('AppleEvent', 'AEDesc')
+AppleEvent_ptr = OpaqueType('AppleEvent', 'AEDesc')
+
+
+class EHType(Type):
+ def __init__(self, name = 'EventHandler', format = ''):
+ Type.__init__(self, name, format)
+ def declare(self, name):
+ Output("AEEventHandlerUPP %s__proc__ = upp_GenericEventHandler;", name)
+ Output("PyObject *%s;", name)
+ def getargsFormat(self):
+ return "O"
+ def getargsArgs(self, name):
+ return "&%s" % name
+ def passInput(self, name):
+ return "%s__proc__, (long)%s" % (name, name)
+ def passOutput(self, name):
+ return "&%s__proc__, (long *)&%s" % (name, name)
+ def mkvalueFormat(self):
+ return "O"
+ def mkvalueArgs(self, name):
+ return name
+ def cleanup(self, name):
+ Output("Py_INCREF(%s); /* XXX leak, but needed */", name)
+
+class EHNoRefConType(EHType):
+ def passInput(self, name):
+ return "upp_GenericEventHandler"
+
+EventHandler = EHType()
+EventHandlerNoRefCon = EHNoRefConType()
+
+
+IdleProcPtr = FakeType("upp_AEIdleProc")
+AEIdleUPP = IdleProcPtr
+EventFilterProcPtr = FakeType("(AEFilterUPP)0")
+AEFilterUPP = EventFilterProcPtr
+NMRecPtr = FakeType("(NMRecPtr)0")
+EventHandlerProcPtr = FakeType("upp_GenericEventHandler")
+AEEventHandlerUPP = EventHandlerProcPtr
+AlwaysFalse = FakeType("0")
+
+
+AEFunction = OSErrWeakLinkFunctionGenerator
+AEMethod = OSErrWeakLinkMethodGenerator
+
+
+includestuff = includestuff + """
+#include <Carbon/Carbon.h>
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_AEDesc_New(AEDesc *);
+extern int _AEDesc_Convert(PyObject *, AEDesc *);
+
+#define AEDesc_New _AEDesc_New
+#define AEDesc_NewBorrowed _AEDesc_NewBorrowed
+#define AEDesc_Convert _AEDesc_Convert
+#endif
+
+typedef long refcontype;
+
+static pascal OSErr GenericEventHandler(const AppleEvent *request, AppleEvent *reply, refcontype refcon); /* Forward */
+
+AEEventHandlerUPP upp_GenericEventHandler;
+
+static pascal Boolean AEIdleProc(EventRecord *theEvent, long *sleepTime, RgnHandle *mouseRgn)
+{
+ if ( PyOS_InterruptOccurred() )
+ return 1;
+ return 0;
+}
+
+AEIdleUPP upp_AEIdleProc;
+"""
+
+finalstuff = finalstuff + """
+static pascal OSErr
+GenericEventHandler(const AppleEvent *request, AppleEvent *reply, refcontype refcon)
+{
+ PyObject *handler = (PyObject *)refcon;
+ AEDescObject *requestObject, *replyObject;
+ PyObject *args, *res;
+ if ((requestObject = (AEDescObject *)AEDesc_New((AppleEvent *)request)) == NULL) {
+ return -1;
+ }
+ if ((replyObject = (AEDescObject *)AEDesc_New(reply)) == NULL) {
+ Py_DECREF(requestObject);
+ return -1;
+ }
+ if ((args = Py_BuildValue("OO", requestObject, replyObject)) == NULL) {
+ Py_DECREF(requestObject);
+ Py_DECREF(replyObject);
+ return -1;
+ }
+ res = PyEval_CallObject(handler, args);
+ requestObject->ob_itself.descriptorType = 'null';
+ requestObject->ob_itself.dataHandle = NULL;
+ replyObject->ob_itself.descriptorType = 'null';
+ replyObject->ob_itself.dataHandle = NULL;
+ Py_DECREF(args);
+ if (res == NULL) {
+ PySys_WriteStderr("Exception in AE event handler function\\n");
+ PyErr_Print();
+ return -1;
+ }
+ Py_DECREF(res);
+ return noErr;
+}
+
+PyObject *AEDesc_NewBorrowed(AEDesc *itself)
+{
+ PyObject *it;
+
+ it = AEDesc_New(itself);
+ if (it)
+ ((AEDescObject *)it)->ob_owned = 0;
+ return (PyObject *)it;
+}
+
+"""
+
+initstuff = initstuff + """
+ upp_AEIdleProc = NewAEIdleUPP(AEIdleProc);
+ upp_GenericEventHandler = NewAEEventHandlerUPP(GenericEventHandler);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(AEDesc *, AEDesc_New);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(AEDesc *, AEDesc_NewBorrowed);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(AEDesc, AEDesc_Convert);
+"""
+
+module = MacModule('_AE', 'AE', includestuff, finalstuff, initstuff)
+
+class AEDescDefinition(PEP253Mixin, GlobalObjectDefinition):
+ getsetlist = [(
+ 'type',
+ 'return PyMac_BuildOSType(self->ob_itself.descriptorType);',
+ None,
+ 'Type of this AEDesc'
+ ), (
+ 'data',
+ """
+ PyObject *res;
+ Size size;
+ char *ptr;
+ OSErr err;
+
+ size = AEGetDescDataSize(&self->ob_itself);
+ if ( (res = PyString_FromStringAndSize(NULL, size)) == NULL )
+ return NULL;
+ if ( (ptr = PyString_AsString(res)) == NULL )
+ return NULL;
+ if ( (err=AEGetDescData(&self->ob_itself, ptr, size)) < 0 )
+ return PyMac_Error(err);
+ return res;
+ """,
+ None,
+ 'The raw data in this AEDesc'
+ )]
+
+ def __init__(self, name, prefix = None, itselftype = None):
+ GlobalObjectDefinition.__init__(self, name, prefix or name, itselftype or name)
+ self.argref = "*"
+
+ def outputStructMembers(self):
+ GlobalObjectDefinition.outputStructMembers(self)
+ Output("int ob_owned;")
+
+ def outputInitStructMembers(self):
+ GlobalObjectDefinition.outputInitStructMembers(self)
+ Output("it->ob_owned = 1;")
+
+ def outputCleanupStructMembers(self):
+ Output("if (self->ob_owned) AEDisposeDesc(&self->ob_itself);")
+
+aedescobject = AEDescDefinition('AEDesc')
+module.addobject(aedescobject)
+
+functions = []
+aedescmethods = []
+
+execfile('aegen.py')
+##execfile('aedatamodelgen.py')
+
+# Manual generator
+AutoDispose_body = """
+int onoff, old;
+if (!PyArg_ParseTuple(_args, "i", &onoff))
+ return NULL;
+old = _self->ob_owned;
+_self->ob_owned = onoff;
+_res = Py_BuildValue("i", old);
+return _res;
+"""
+f = ManualGenerator("AutoDispose", AutoDispose_body)
+f.docstring = lambda: "(int)->int. Automatically AEDisposeDesc the object on Python object cleanup"
+aedescmethods.append(f)
+
+for f in functions: module.add(f)
+for f in aedescmethods: aedescobject.add(f)
+
+SetOutputFileName('_AEmodule.c')
+module.generate()
diff --git a/Mac/Modules/ah/_AHmodule.c b/Mac/Modules/ah/_AHmodule.c
new file mode 100644
index 0000000000..73ab43794a
--- /dev/null
+++ b/Mac/Modules/ah/_AHmodule.c
@@ -0,0 +1,144 @@
+
+/* =========================== Module _AH =========================== */
+
+#include "Python.h"
+
+
+
+#include "pymactoolbox.h"
+
+/* Macro to test whether a weak-loaded CFM function exists */
+#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
+ PyErr_SetString(PyExc_NotImplementedError, \
+ "Not available in this shared library/OS version"); \
+ return NULL; \
+ }} while(0)
+
+
+#include <Carbon/Carbon.h>
+
+
+static PyObject *Ah_Error;
+
+static PyObject *Ah_AHSearch(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ CFStringRef bookname;
+ CFStringRef query;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CFStringRefObj_Convert, &bookname,
+ CFStringRefObj_Convert, &query))
+ return NULL;
+ _err = AHSearch(bookname,
+ query);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Ah_AHGotoMainTOC(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ AHTOCType toctype;
+ if (!PyArg_ParseTuple(_args, "h",
+ &toctype))
+ return NULL;
+ _err = AHGotoMainTOC(toctype);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Ah_AHGotoPage(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ CFStringRef bookname;
+ CFStringRef path;
+ CFStringRef anchor;
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CFStringRefObj_Convert, &bookname,
+ CFStringRefObj_Convert, &path,
+ CFStringRefObj_Convert, &anchor))
+ return NULL;
+ _err = AHGotoPage(bookname,
+ path,
+ anchor);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Ah_AHLookupAnchor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ CFStringRef bookname;
+ CFStringRef anchor;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CFStringRefObj_Convert, &bookname,
+ CFStringRefObj_Convert, &anchor))
+ return NULL;
+ _err = AHLookupAnchor(bookname,
+ anchor);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Ah_AHRegisterHelpBook(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ FSRef appBundleRef;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetFSRef, &appBundleRef))
+ return NULL;
+ _err = AHRegisterHelpBook(&appBundleRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyMethodDef Ah_methods[] = {
+ {"AHSearch", (PyCFunction)Ah_AHSearch, 1,
+ PyDoc_STR("(CFStringRef bookname, CFStringRef query) -> None")},
+ {"AHGotoMainTOC", (PyCFunction)Ah_AHGotoMainTOC, 1,
+ PyDoc_STR("(AHTOCType toctype) -> None")},
+ {"AHGotoPage", (PyCFunction)Ah_AHGotoPage, 1,
+ PyDoc_STR("(CFStringRef bookname, CFStringRef path, CFStringRef anchor) -> None")},
+ {"AHLookupAnchor", (PyCFunction)Ah_AHLookupAnchor, 1,
+ PyDoc_STR("(CFStringRef bookname, CFStringRef anchor) -> None")},
+ {"AHRegisterHelpBook", (PyCFunction)Ah_AHRegisterHelpBook, 1,
+ PyDoc_STR("(FSRef appBundleRef) -> None")},
+ {NULL, NULL, 0}
+};
+
+
+
+
+void init_AH(void)
+{
+ PyObject *m;
+ PyObject *d;
+
+
+
+
+ m = Py_InitModule("_AH", Ah_methods);
+ d = PyModule_GetDict(m);
+ Ah_Error = PyMac_GetOSErrException();
+ if (Ah_Error == NULL ||
+ PyDict_SetItemString(d, "Error", Ah_Error) != 0)
+ return;
+}
+
+/* ========================= End module _AH ========================= */
+
diff --git a/Mac/Modules/ah/ahscan.py b/Mac/Modules/ah/ahscan.py
new file mode 100644
index 0000000000..b993427728
--- /dev/null
+++ b/Mac/Modules/ah/ahscan.py
@@ -0,0 +1,51 @@
+# Scan an Apple header file, generating a Python file of generator calls.
+
+import sys
+from bgenlocations import TOOLBOXDIR, BGENDIR
+sys.path.append(BGENDIR)
+from scantools import Scanner_OSX
+
+LONG = "AppleHelp"
+SHORT = "ah"
+OBJECT = "NOTUSED"
+
+def main():
+ input = LONG + ".h"
+ output = SHORT + "gen.py"
+ defsoutput = TOOLBOXDIR + LONG + ".py"
+ scanner = MyScanner(input, output, defsoutput)
+ scanner.scan()
+ scanner.close()
+ print "=== Testing definitions output code ==="
+ execfile(defsoutput, {}, {})
+ print "=== Done scanning and generating, now importing the generated code... ==="
+ exec "import " + SHORT + "support"
+ print "=== Done. It's up to you to compile it now! ==="
+
+class MyScanner(Scanner_OSX):
+
+ def destination(self, type, name, arglist):
+ classname = "Function"
+ listname = "functions"
+ if arglist:
+ t, n, m = arglist[0]
+ # This is non-functional today
+ if t == OBJECT and m == "InMode":
+ classname = "Method"
+ listname = "methods"
+ return classname, listname
+
+ def makeblacklistnames(self):
+ return [
+ ]
+
+ def makeblacklisttypes(self):
+ return [
+ ]
+
+ def makerepairinstructions(self):
+ return [
+ ]
+
+if __name__ == "__main__":
+ main()
diff --git a/Mac/Modules/ah/ahsupport.py b/Mac/Modules/ah/ahsupport.py
new file mode 100644
index 0000000000..c5f24beeea
--- /dev/null
+++ b/Mac/Modules/ah/ahsupport.py
@@ -0,0 +1,45 @@
+# This script generates a Python interface for an Apple Macintosh Manager.
+# It uses the "bgen" package to generate C code.
+# The function specifications are generated by scanning the mamager's header file,
+# using the "scantools" package (customized for this particular manager).
+
+import string
+
+# Declarations that change for each manager
+MACHEADERFILE = 'AppleHelp.h' # The Apple header file
+MODNAME = '_AH' # The name of the module
+
+# The following is *usually* unchanged but may still require tuning
+MODPREFIX = 'Ah' # The prefix for module-wide routines
+INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner
+OUTPUTFILE = MODNAME + "module.c" # The file generated by this program
+
+from macsupport import *
+
+# Create the type objects
+AHTOCType = Type("AHTOCType", "h")
+
+includestuff = includestuff + """
+#include <Carbon/Carbon.h>
+
+"""
+
+# From here on it's basically all boiler plate...
+
+# Create the generator groups and link them
+module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff)
+
+# Create the generator classes used to populate the lists
+Function = OSErrFunctionGenerator
+
+# Create and populate the lists
+functions = []
+execfile(INPUTFILE)
+
+# add the populated lists to the generator groups
+# (in a different wordl the scan program would generate this)
+for f in functions: module.add(f)
+
+# generate output (open the output file as late as possible)
+SetOutputFileName(OUTPUTFILE)
+module.generate()
diff --git a/Mac/Modules/app/_Appmodule.c b/Mac/Modules/app/_Appmodule.c
new file mode 100644
index 0000000000..c791807f93
--- /dev/null
+++ b/Mac/Modules/app/_Appmodule.c
@@ -0,0 +1,1832 @@
+
+/* ========================== Module _App =========================== */
+
+#include "Python.h"
+
+#ifndef __LP64__
+ /* Carbon GUI stuff, not available in 64-bit mode */
+
+
+#include "pymactoolbox.h"
+
+/* Macro to test whether a weak-loaded CFM function exists */
+#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
+ PyErr_SetString(PyExc_NotImplementedError, \
+ "Not available in this shared library/OS version"); \
+ return NULL; \
+ }} while(0)
+
+
+#include <Carbon/Carbon.h>
+
+
+static int ThemeButtonDrawInfo_Convert(PyObject *v, ThemeButtonDrawInfo *p_itself)
+{
+ return PyArg_Parse(v, "(iHH)", &p_itself->state, &p_itself->value, &p_itself->adornment);
+}
+
+
+static PyObject *App_Error;
+
+/* ----------------- Object type ThemeDrawingState ------------------ */
+
+PyTypeObject ThemeDrawingState_Type;
+
+#define ThemeDrawingStateObj_Check(x) ((x)->ob_type == &ThemeDrawingState_Type || PyObject_TypeCheck((x), &ThemeDrawingState_Type))
+
+typedef struct ThemeDrawingStateObject {
+ PyObject_HEAD
+ ThemeDrawingState ob_itself;
+} ThemeDrawingStateObject;
+
+PyObject *ThemeDrawingStateObj_New(ThemeDrawingState itself)
+{
+ ThemeDrawingStateObject *it;
+ it = PyObject_NEW(ThemeDrawingStateObject, &ThemeDrawingState_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+
+int ThemeDrawingStateObj_Convert(PyObject *v, ThemeDrawingState *p_itself)
+{
+ if (!ThemeDrawingStateObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "ThemeDrawingState required");
+ return 0;
+ }
+ *p_itself = ((ThemeDrawingStateObject *)v)->ob_itself;
+ return 1;
+}
+
+static void ThemeDrawingStateObj_dealloc(ThemeDrawingStateObject *self)
+{
+ /* Cleanup of self->ob_itself goes here */
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *ThemeDrawingStateObj_SetThemeDrawingState(ThemeDrawingStateObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _rv;
+ Boolean inDisposeNow;
+#ifndef SetThemeDrawingState
+ PyMac_PRECHECK(SetThemeDrawingState);
+#endif
+ if (!PyArg_ParseTuple(_args, "b",
+ &inDisposeNow))
+ return NULL;
+ _rv = SetThemeDrawingState(_self->ob_itself,
+ inDisposeNow);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *ThemeDrawingStateObj_DisposeThemeDrawingState(ThemeDrawingStateObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _rv;
+#ifndef DisposeThemeDrawingState
+ PyMac_PRECHECK(DisposeThemeDrawingState);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = DisposeThemeDrawingState(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyMethodDef ThemeDrawingStateObj_methods[] = {
+ {"SetThemeDrawingState", (PyCFunction)ThemeDrawingStateObj_SetThemeDrawingState, 1,
+ PyDoc_STR("(Boolean inDisposeNow) -> (OSStatus _rv)")},
+ {"DisposeThemeDrawingState", (PyCFunction)ThemeDrawingStateObj_DisposeThemeDrawingState, 1,
+ PyDoc_STR("() -> (OSStatus _rv)")},
+ {NULL, NULL, 0}
+};
+
+#define ThemeDrawingStateObj_getsetlist NULL
+
+
+#define ThemeDrawingStateObj_compare NULL
+
+#define ThemeDrawingStateObj_repr NULL
+
+#define ThemeDrawingStateObj_hash NULL
+#define ThemeDrawingStateObj_tp_init 0
+
+#define ThemeDrawingStateObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *ThemeDrawingStateObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *_self;
+ ThemeDrawingState itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, ThemeDrawingStateObj_Convert, &itself)) return NULL;
+ if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((ThemeDrawingStateObject *)_self)->ob_itself = itself;
+ return _self;
+}
+
+#define ThemeDrawingStateObj_tp_free PyObject_Del
+
+
+PyTypeObject ThemeDrawingState_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_App.ThemeDrawingState", /*tp_name*/
+ sizeof(ThemeDrawingStateObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) ThemeDrawingStateObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) ThemeDrawingStateObj_compare, /*tp_compare*/
+ (reprfunc) ThemeDrawingStateObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) ThemeDrawingStateObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ ThemeDrawingStateObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ ThemeDrawingStateObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ ThemeDrawingStateObj_tp_init, /* tp_init */
+ ThemeDrawingStateObj_tp_alloc, /* tp_alloc */
+ ThemeDrawingStateObj_tp_new, /* tp_new */
+ ThemeDrawingStateObj_tp_free, /* tp_free */
+};
+
+/* --------------- End object type ThemeDrawingState ---------------- */
+
+
+static PyObject *App_RegisterAppearanceClient(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+#ifndef RegisterAppearanceClient
+ PyMac_PRECHECK(RegisterAppearanceClient);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = RegisterAppearanceClient();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_UnregisterAppearanceClient(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+#ifndef UnregisterAppearanceClient
+ PyMac_PRECHECK(UnregisterAppearanceClient);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = UnregisterAppearanceClient();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_SetThemePen(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ThemeBrush inBrush;
+ SInt16 inDepth;
+ Boolean inIsColorDevice;
+#ifndef SetThemePen
+ PyMac_PRECHECK(SetThemePen);
+#endif
+ if (!PyArg_ParseTuple(_args, "hhb",
+ &inBrush,
+ &inDepth,
+ &inIsColorDevice))
+ return NULL;
+ _err = SetThemePen(inBrush,
+ inDepth,
+ inIsColorDevice);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_SetThemeBackground(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ThemeBrush inBrush;
+ SInt16 inDepth;
+ Boolean inIsColorDevice;
+#ifndef SetThemeBackground
+ PyMac_PRECHECK(SetThemeBackground);
+#endif
+ if (!PyArg_ParseTuple(_args, "hhb",
+ &inBrush,
+ &inDepth,
+ &inIsColorDevice))
+ return NULL;
+ _err = SetThemeBackground(inBrush,
+ inDepth,
+ inIsColorDevice);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_SetThemeTextColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ThemeTextColor inColor;
+ SInt16 inDepth;
+ Boolean inIsColorDevice;
+#ifndef SetThemeTextColor
+ PyMac_PRECHECK(SetThemeTextColor);
+#endif
+ if (!PyArg_ParseTuple(_args, "hhb",
+ &inColor,
+ &inDepth,
+ &inIsColorDevice))
+ return NULL;
+ _err = SetThemeTextColor(inColor,
+ inDepth,
+ inIsColorDevice);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_SetThemeWindowBackground(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr inWindow;
+ ThemeBrush inBrush;
+ Boolean inUpdate;
+#ifndef SetThemeWindowBackground
+ PyMac_PRECHECK(SetThemeWindowBackground);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hb",
+ WinObj_Convert, &inWindow,
+ &inBrush,
+ &inUpdate))
+ return NULL;
+ _err = SetThemeWindowBackground(inWindow,
+ inBrush,
+ inUpdate);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemeWindowHeader(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inRect;
+ ThemeDrawState inState;
+#ifndef DrawThemeWindowHeader
+ PyMac_PRECHECK(DrawThemeWindowHeader);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetRect, &inRect,
+ &inState))
+ return NULL;
+ _err = DrawThemeWindowHeader(&inRect,
+ inState);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemeWindowListViewHeader(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inRect;
+ ThemeDrawState inState;
+#ifndef DrawThemeWindowListViewHeader
+ PyMac_PRECHECK(DrawThemeWindowListViewHeader);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetRect, &inRect,
+ &inState))
+ return NULL;
+ _err = DrawThemeWindowListViewHeader(&inRect,
+ inState);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemePlacard(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inRect;
+ ThemeDrawState inState;
+#ifndef DrawThemePlacard
+ PyMac_PRECHECK(DrawThemePlacard);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetRect, &inRect,
+ &inState))
+ return NULL;
+ _err = DrawThemePlacard(&inRect,
+ inState);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemeEditTextFrame(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inRect;
+ ThemeDrawState inState;
+#ifndef DrawThemeEditTextFrame
+ PyMac_PRECHECK(DrawThemeEditTextFrame);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetRect, &inRect,
+ &inState))
+ return NULL;
+ _err = DrawThemeEditTextFrame(&inRect,
+ inState);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemeListBoxFrame(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inRect;
+ ThemeDrawState inState;
+#ifndef DrawThemeListBoxFrame
+ PyMac_PRECHECK(DrawThemeListBoxFrame);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetRect, &inRect,
+ &inState))
+ return NULL;
+ _err = DrawThemeListBoxFrame(&inRect,
+ inState);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemeFocusRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inRect;
+ Boolean inHasFocus;
+#ifndef DrawThemeFocusRect
+ PyMac_PRECHECK(DrawThemeFocusRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&b",
+ PyMac_GetRect, &inRect,
+ &inHasFocus))
+ return NULL;
+ _err = DrawThemeFocusRect(&inRect,
+ inHasFocus);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemePrimaryGroup(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inRect;
+ ThemeDrawState inState;
+#ifndef DrawThemePrimaryGroup
+ PyMac_PRECHECK(DrawThemePrimaryGroup);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetRect, &inRect,
+ &inState))
+ return NULL;
+ _err = DrawThemePrimaryGroup(&inRect,
+ inState);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemeSecondaryGroup(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inRect;
+ ThemeDrawState inState;
+#ifndef DrawThemeSecondaryGroup
+ PyMac_PRECHECK(DrawThemeSecondaryGroup);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetRect, &inRect,
+ &inState))
+ return NULL;
+ _err = DrawThemeSecondaryGroup(&inRect,
+ inState);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemeSeparator(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inRect;
+ ThemeDrawState inState;
+#ifndef DrawThemeSeparator
+ PyMac_PRECHECK(DrawThemeSeparator);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetRect, &inRect,
+ &inState))
+ return NULL;
+ _err = DrawThemeSeparator(&inRect,
+ inState);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemeModelessDialogFrame(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inRect;
+ ThemeDrawState inState;
+#ifndef DrawThemeModelessDialogFrame
+ PyMac_PRECHECK(DrawThemeModelessDialogFrame);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetRect, &inRect,
+ &inState))
+ return NULL;
+ _err = DrawThemeModelessDialogFrame(&inRect,
+ inState);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemeGenericWell(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inRect;
+ ThemeDrawState inState;
+ Boolean inFillCenter;
+#ifndef DrawThemeGenericWell
+ PyMac_PRECHECK(DrawThemeGenericWell);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lb",
+ PyMac_GetRect, &inRect,
+ &inState,
+ &inFillCenter))
+ return NULL;
+ _err = DrawThemeGenericWell(&inRect,
+ inState,
+ inFillCenter);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemeFocusRegion(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Boolean inHasFocus;
+#ifndef DrawThemeFocusRegion
+ PyMac_PRECHECK(DrawThemeFocusRegion);
+#endif
+ if (!PyArg_ParseTuple(_args, "b",
+ &inHasFocus))
+ return NULL;
+ _err = DrawThemeFocusRegion((RgnHandle)0,
+ inHasFocus);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_IsThemeInColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ SInt16 inDepth;
+ Boolean inIsColorDevice;
+#ifndef IsThemeInColor
+ PyMac_PRECHECK(IsThemeInColor);
+#endif
+ if (!PyArg_ParseTuple(_args, "hb",
+ &inDepth,
+ &inIsColorDevice))
+ return NULL;
+ _rv = IsThemeInColor(inDepth,
+ inIsColorDevice);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *App_GetThemeAccentColors(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ CTabHandle outColors;
+#ifndef GetThemeAccentColors
+ PyMac_PRECHECK(GetThemeAccentColors);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetThemeAccentColors(&outColors);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, outColors);
+ return _res;
+}
+
+static PyObject *App_DrawThemeMenuBarBackground(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inBounds;
+ ThemeMenuBarState inState;
+ UInt32 inAttributes;
+#ifndef DrawThemeMenuBarBackground
+ PyMac_PRECHECK(DrawThemeMenuBarBackground);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&Hl",
+ PyMac_GetRect, &inBounds,
+ &inState,
+ &inAttributes))
+ return NULL;
+ _err = DrawThemeMenuBarBackground(&inBounds,
+ inState,
+ inAttributes);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_GetThemeMenuBarHeight(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ SInt16 outHeight;
+#ifndef GetThemeMenuBarHeight
+ PyMac_PRECHECK(GetThemeMenuBarHeight);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetThemeMenuBarHeight(&outHeight);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ outHeight);
+ return _res;
+}
+
+static PyObject *App_DrawThemeMenuBackground(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inMenuRect;
+ ThemeMenuType inMenuType;
+#ifndef DrawThemeMenuBackground
+ PyMac_PRECHECK(DrawThemeMenuBackground);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&H",
+ PyMac_GetRect, &inMenuRect,
+ &inMenuType))
+ return NULL;
+ _err = DrawThemeMenuBackground(&inMenuRect,
+ inMenuType);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_GetThemeMenuBackgroundRegion(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inMenuRect;
+ ThemeMenuType menuType;
+#ifndef GetThemeMenuBackgroundRegion
+ PyMac_PRECHECK(GetThemeMenuBackgroundRegion);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&H",
+ PyMac_GetRect, &inMenuRect,
+ &menuType))
+ return NULL;
+ _err = GetThemeMenuBackgroundRegion(&inMenuRect,
+ menuType,
+ (RgnHandle)0);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemeMenuSeparator(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inItemRect;
+#ifndef DrawThemeMenuSeparator
+ PyMac_PRECHECK(DrawThemeMenuSeparator);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &inItemRect))
+ return NULL;
+ _err = DrawThemeMenuSeparator(&inItemRect);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_GetThemeMenuSeparatorHeight(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ SInt16 outHeight;
+#ifndef GetThemeMenuSeparatorHeight
+ PyMac_PRECHECK(GetThemeMenuSeparatorHeight);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetThemeMenuSeparatorHeight(&outHeight);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ outHeight);
+ return _res;
+}
+
+static PyObject *App_GetThemeMenuItemExtra(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ThemeMenuItemType inItemType;
+ SInt16 outHeight;
+ SInt16 outWidth;
+#ifndef GetThemeMenuItemExtra
+ PyMac_PRECHECK(GetThemeMenuItemExtra);
+#endif
+ if (!PyArg_ParseTuple(_args, "H",
+ &inItemType))
+ return NULL;
+ _err = GetThemeMenuItemExtra(inItemType,
+ &outHeight,
+ &outWidth);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("hh",
+ outHeight,
+ outWidth);
+ return _res;
+}
+
+static PyObject *App_GetThemeMenuTitleExtra(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ SInt16 outWidth;
+ Boolean inIsSquished;
+#ifndef GetThemeMenuTitleExtra
+ PyMac_PRECHECK(GetThemeMenuTitleExtra);
+#endif
+ if (!PyArg_ParseTuple(_args, "b",
+ &inIsSquished))
+ return NULL;
+ _err = GetThemeMenuTitleExtra(&outWidth,
+ inIsSquished);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ outWidth);
+ return _res;
+}
+
+static PyObject *App_DrawThemeTabPane(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inRect;
+ ThemeDrawState inState;
+#ifndef DrawThemeTabPane
+ PyMac_PRECHECK(DrawThemeTabPane);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetRect, &inRect,
+ &inState))
+ return NULL;
+ _err = DrawThemeTabPane(&inRect,
+ inState);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_GetThemeTabRegion(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inRect;
+ ThemeTabStyle inStyle;
+ ThemeTabDirection inDirection;
+#ifndef GetThemeTabRegion
+ PyMac_PRECHECK(GetThemeTabRegion);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&HH",
+ PyMac_GetRect, &inRect,
+ &inStyle,
+ &inDirection))
+ return NULL;
+ _err = GetThemeTabRegion(&inRect,
+ inStyle,
+ inDirection,
+ (RgnHandle)0);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_SetThemeCursor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ThemeCursor inCursor;
+#ifndef SetThemeCursor
+ PyMac_PRECHECK(SetThemeCursor);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &inCursor))
+ return NULL;
+ _err = SetThemeCursor(inCursor);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_SetAnimatedThemeCursor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ThemeCursor inCursor;
+ UInt32 inAnimationStep;
+#ifndef SetAnimatedThemeCursor
+ PyMac_PRECHECK(SetAnimatedThemeCursor);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &inCursor,
+ &inAnimationStep))
+ return NULL;
+ _err = SetAnimatedThemeCursor(inCursor,
+ inAnimationStep);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_GetThemeScrollBarThumbStyle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ThemeScrollBarThumbStyle outStyle;
+#ifndef GetThemeScrollBarThumbStyle
+ PyMac_PRECHECK(GetThemeScrollBarThumbStyle);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetThemeScrollBarThumbStyle(&outStyle);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("H",
+ outStyle);
+ return _res;
+}
+
+static PyObject *App_GetThemeScrollBarArrowStyle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ThemeScrollBarArrowStyle outStyle;
+#ifndef GetThemeScrollBarArrowStyle
+ PyMac_PRECHECK(GetThemeScrollBarArrowStyle);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetThemeScrollBarArrowStyle(&outStyle);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("H",
+ outStyle);
+ return _res;
+}
+
+static PyObject *App_GetThemeCheckBoxStyle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ThemeCheckBoxStyle outStyle;
+#ifndef GetThemeCheckBoxStyle
+ PyMac_PRECHECK(GetThemeCheckBoxStyle);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetThemeCheckBoxStyle(&outStyle);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("H",
+ outStyle);
+ return _res;
+}
+
+static PyObject *App_UseThemeFont(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ThemeFontID inFontID;
+ ScriptCode inScript;
+#ifndef UseThemeFont
+ PyMac_PRECHECK(UseThemeFont);
+#endif
+ if (!PyArg_ParseTuple(_args, "Hh",
+ &inFontID,
+ &inScript))
+ return NULL;
+ _err = UseThemeFont(inFontID,
+ inScript);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemeTextBox(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ CFStringRef inString;
+ ThemeFontID inFontID;
+ ThemeDrawState inState;
+ Boolean inWrapToWidth;
+ Rect inBoundingBox;
+ SInt16 inJust;
+#ifndef DrawThemeTextBox
+ PyMac_PRECHECK(DrawThemeTextBox);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&HlbO&h",
+ CFStringRefObj_Convert, &inString,
+ &inFontID,
+ &inState,
+ &inWrapToWidth,
+ PyMac_GetRect, &inBoundingBox,
+ &inJust))
+ return NULL;
+ _err = DrawThemeTextBox(inString,
+ inFontID,
+ inState,
+ inWrapToWidth,
+ &inBoundingBox,
+ inJust,
+ NULL);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_TruncateThemeText(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ CFMutableStringRef inString;
+ ThemeFontID inFontID;
+ ThemeDrawState inState;
+ SInt16 inPixelWidthLimit;
+ TruncCode inTruncWhere;
+ Boolean outTruncated;
+#ifndef TruncateThemeText
+ PyMac_PRECHECK(TruncateThemeText);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&Hlhh",
+ CFMutableStringRefObj_Convert, &inString,
+ &inFontID,
+ &inState,
+ &inPixelWidthLimit,
+ &inTruncWhere))
+ return NULL;
+ _err = TruncateThemeText(inString,
+ inFontID,
+ inState,
+ inPixelWidthLimit,
+ inTruncWhere,
+ &outTruncated);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("b",
+ outTruncated);
+ return _res;
+}
+
+static PyObject *App_GetThemeTextDimensions(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ CFStringRef inString;
+ ThemeFontID inFontID;
+ ThemeDrawState inState;
+ Boolean inWrapToWidth;
+ Point ioBounds;
+ SInt16 outBaseline;
+#ifndef GetThemeTextDimensions
+ PyMac_PRECHECK(GetThemeTextDimensions);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&HlbO&",
+ CFStringRefObj_Convert, &inString,
+ &inFontID,
+ &inState,
+ &inWrapToWidth,
+ PyMac_GetPoint, &ioBounds))
+ return NULL;
+ _err = GetThemeTextDimensions(inString,
+ inFontID,
+ inState,
+ inWrapToWidth,
+ &ioBounds,
+ &outBaseline);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&h",
+ PyMac_BuildPoint, ioBounds,
+ outBaseline);
+ return _res;
+}
+
+static PyObject *App_GetThemeTextShadowOutset(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ThemeFontID inFontID;
+ ThemeDrawState inState;
+ Rect outOutset;
+#ifndef GetThemeTextShadowOutset
+ PyMac_PRECHECK(GetThemeTextShadowOutset);
+#endif
+ if (!PyArg_ParseTuple(_args, "Hl",
+ &inFontID,
+ &inState))
+ return NULL;
+ _err = GetThemeTextShadowOutset(inFontID,
+ inState,
+ &outOutset);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &outOutset);
+ return _res;
+}
+
+static PyObject *App_DrawThemeScrollBarArrows(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect bounds;
+ ThemeTrackEnableState enableState;
+ ThemeTrackPressState pressState;
+ Boolean isHoriz;
+ Rect trackBounds;
+#ifndef DrawThemeScrollBarArrows
+ PyMac_PRECHECK(DrawThemeScrollBarArrows);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&bbb",
+ PyMac_GetRect, &bounds,
+ &enableState,
+ &pressState,
+ &isHoriz))
+ return NULL;
+ _err = DrawThemeScrollBarArrows(&bounds,
+ enableState,
+ pressState,
+ isHoriz,
+ &trackBounds);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &trackBounds);
+ return _res;
+}
+
+static PyObject *App_GetThemeScrollBarTrackRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect bounds;
+ ThemeTrackEnableState enableState;
+ ThemeTrackPressState pressState;
+ Boolean isHoriz;
+ Rect trackBounds;
+#ifndef GetThemeScrollBarTrackRect
+ PyMac_PRECHECK(GetThemeScrollBarTrackRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&bbb",
+ PyMac_GetRect, &bounds,
+ &enableState,
+ &pressState,
+ &isHoriz))
+ return NULL;
+ _err = GetThemeScrollBarTrackRect(&bounds,
+ enableState,
+ pressState,
+ isHoriz,
+ &trackBounds);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &trackBounds);
+ return _res;
+}
+
+static PyObject *App_HitTestThemeScrollBarArrows(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Rect scrollBarBounds;
+ ThemeTrackEnableState enableState;
+ ThemeTrackPressState pressState;
+ Boolean isHoriz;
+ Point ptHit;
+ Rect trackBounds;
+ ControlPartCode partcode;
+#ifndef HitTestThemeScrollBarArrows
+ PyMac_PRECHECK(HitTestThemeScrollBarArrows);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&bbbO&",
+ PyMac_GetRect, &scrollBarBounds,
+ &enableState,
+ &pressState,
+ &isHoriz,
+ PyMac_GetPoint, &ptHit))
+ return NULL;
+ _rv = HitTestThemeScrollBarArrows(&scrollBarBounds,
+ enableState,
+ pressState,
+ isHoriz,
+ ptHit,
+ &trackBounds,
+ &partcode);
+ _res = Py_BuildValue("bO&h",
+ _rv,
+ PyMac_BuildRect, &trackBounds,
+ partcode);
+ return _res;
+}
+
+static PyObject *App_DrawThemeScrollBarDelimiters(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ThemeWindowType flavor;
+ Rect inContRect;
+ ThemeDrawState state;
+ ThemeWindowAttributes attributes;
+#ifndef DrawThemeScrollBarDelimiters
+ PyMac_PRECHECK(DrawThemeScrollBarDelimiters);
+#endif
+ if (!PyArg_ParseTuple(_args, "HO&ll",
+ &flavor,
+ PyMac_GetRect, &inContRect,
+ &state,
+ &attributes))
+ return NULL;
+ _err = DrawThemeScrollBarDelimiters(flavor,
+ &inContRect,
+ state,
+ attributes);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemeButton(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inBounds;
+ UInt16 inKind;
+ ThemeButtonDrawInfo inNewInfo;
+ ThemeButtonDrawInfo inPrevInfo;
+ UInt32 inUserData;
+#ifndef DrawThemeButton
+ PyMac_PRECHECK(DrawThemeButton);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&HO&O&l",
+ PyMac_GetRect, &inBounds,
+ &inKind,
+ ThemeButtonDrawInfo_Convert, &inNewInfo,
+ ThemeButtonDrawInfo_Convert, &inPrevInfo,
+ &inUserData))
+ return NULL;
+ _err = DrawThemeButton(&inBounds,
+ inKind,
+ &inNewInfo,
+ &inPrevInfo,
+ NULL,
+ NULL,
+ inUserData);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_GetThemeButtonRegion(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inBounds;
+ UInt16 inKind;
+ ThemeButtonDrawInfo inNewInfo;
+#ifndef GetThemeButtonRegion
+ PyMac_PRECHECK(GetThemeButtonRegion);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&HO&",
+ PyMac_GetRect, &inBounds,
+ &inKind,
+ ThemeButtonDrawInfo_Convert, &inNewInfo))
+ return NULL;
+ _err = GetThemeButtonRegion(&inBounds,
+ inKind,
+ &inNewInfo,
+ (RgnHandle)0);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_GetThemeButtonContentBounds(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inBounds;
+ UInt16 inKind;
+ ThemeButtonDrawInfo inDrawInfo;
+ Rect outBounds;
+#ifndef GetThemeButtonContentBounds
+ PyMac_PRECHECK(GetThemeButtonContentBounds);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&HO&",
+ PyMac_GetRect, &inBounds,
+ &inKind,
+ ThemeButtonDrawInfo_Convert, &inDrawInfo))
+ return NULL;
+ _err = GetThemeButtonContentBounds(&inBounds,
+ inKind,
+ &inDrawInfo,
+ &outBounds);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &outBounds);
+ return _res;
+}
+
+static PyObject *App_GetThemeButtonBackgroundBounds(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inBounds;
+ UInt16 inKind;
+ ThemeButtonDrawInfo inDrawInfo;
+ Rect outBounds;
+#ifndef GetThemeButtonBackgroundBounds
+ PyMac_PRECHECK(GetThemeButtonBackgroundBounds);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&HO&",
+ PyMac_GetRect, &inBounds,
+ &inKind,
+ ThemeButtonDrawInfo_Convert, &inDrawInfo))
+ return NULL;
+ _err = GetThemeButtonBackgroundBounds(&inBounds,
+ inKind,
+ &inDrawInfo,
+ &outBounds);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &outBounds);
+ return _res;
+}
+
+static PyObject *App_PlayThemeSound(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ThemeSoundKind kind;
+#ifndef PlayThemeSound
+ PyMac_PRECHECK(PlayThemeSound);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &kind))
+ return NULL;
+ _err = PlayThemeSound(kind);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_BeginThemeDragSound(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ThemeDragSoundKind kind;
+#ifndef BeginThemeDragSound
+ PyMac_PRECHECK(BeginThemeDragSound);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &kind))
+ return NULL;
+ _err = BeginThemeDragSound(kind);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_EndThemeDragSound(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+#ifndef EndThemeDragSound
+ PyMac_PRECHECK(EndThemeDragSound);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = EndThemeDragSound();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemeTickMark(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect bounds;
+ ThemeDrawState state;
+#ifndef DrawThemeTickMark
+ PyMac_PRECHECK(DrawThemeTickMark);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetRect, &bounds,
+ &state))
+ return NULL;
+ _err = DrawThemeTickMark(&bounds,
+ state);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemeChasingArrows(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect bounds;
+ UInt32 index;
+ ThemeDrawState state;
+ UInt32 eraseData;
+#ifndef DrawThemeChasingArrows
+ PyMac_PRECHECK(DrawThemeChasingArrows);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lll",
+ PyMac_GetRect, &bounds,
+ &index,
+ &state,
+ &eraseData))
+ return NULL;
+ _err = DrawThemeChasingArrows(&bounds,
+ index,
+ state,
+ NULL,
+ eraseData);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemePopupArrow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect bounds;
+ ThemeArrowOrientation orientation;
+ ThemePopupArrowSize size;
+ ThemeDrawState state;
+ UInt32 eraseData;
+#ifndef DrawThemePopupArrow
+ PyMac_PRECHECK(DrawThemePopupArrow);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&HHll",
+ PyMac_GetRect, &bounds,
+ &orientation,
+ &size,
+ &state,
+ &eraseData))
+ return NULL;
+ _err = DrawThemePopupArrow(&bounds,
+ orientation,
+ size,
+ state,
+ NULL,
+ eraseData);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemeStandaloneGrowBox(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Point origin;
+ ThemeGrowDirection growDirection;
+ Boolean isSmall;
+ ThemeDrawState state;
+#ifndef DrawThemeStandaloneGrowBox
+ PyMac_PRECHECK(DrawThemeStandaloneGrowBox);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&Hbl",
+ PyMac_GetPoint, &origin,
+ &growDirection,
+ &isSmall,
+ &state))
+ return NULL;
+ _err = DrawThemeStandaloneGrowBox(origin,
+ growDirection,
+ isSmall,
+ state);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemeStandaloneNoGrowBox(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Point origin;
+ ThemeGrowDirection growDirection;
+ Boolean isSmall;
+ ThemeDrawState state;
+#ifndef DrawThemeStandaloneNoGrowBox
+ PyMac_PRECHECK(DrawThemeStandaloneNoGrowBox);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&Hbl",
+ PyMac_GetPoint, &origin,
+ &growDirection,
+ &isSmall,
+ &state))
+ return NULL;
+ _err = DrawThemeStandaloneNoGrowBox(origin,
+ growDirection,
+ isSmall,
+ state);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_GetThemeStandaloneGrowBoxBounds(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Point origin;
+ ThemeGrowDirection growDirection;
+ Boolean isSmall;
+ Rect bounds;
+#ifndef GetThemeStandaloneGrowBoxBounds
+ PyMac_PRECHECK(GetThemeStandaloneGrowBoxBounds);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&Hb",
+ PyMac_GetPoint, &origin,
+ &growDirection,
+ &isSmall))
+ return NULL;
+ _err = GetThemeStandaloneGrowBoxBounds(origin,
+ growDirection,
+ isSmall,
+ &bounds);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &bounds);
+ return _res;
+}
+
+static PyObject *App_NormalizeThemeDrawingState(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+#ifndef NormalizeThemeDrawingState
+ PyMac_PRECHECK(NormalizeThemeDrawingState);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = NormalizeThemeDrawingState();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_GetThemeDrawingState(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ThemeDrawingState outState;
+#ifndef GetThemeDrawingState
+ PyMac_PRECHECK(GetThemeDrawingState);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetThemeDrawingState(&outState);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ThemeDrawingStateObj_New, outState);
+ return _res;
+}
+
+static PyObject *App_ApplyThemeBackground(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ThemeBackgroundKind inKind;
+ Rect bounds;
+ ThemeDrawState inState;
+ SInt16 inDepth;
+ Boolean inColorDev;
+#ifndef ApplyThemeBackground
+ PyMac_PRECHECK(ApplyThemeBackground);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&lhb",
+ &inKind,
+ PyMac_GetRect, &bounds,
+ &inState,
+ &inDepth,
+ &inColorDev))
+ return NULL;
+ _err = ApplyThemeBackground(inKind,
+ &bounds,
+ inState,
+ inDepth,
+ inColorDev);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_SetThemeTextColorForWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Boolean isActive;
+ SInt16 depth;
+ Boolean isColorDev;
+#ifndef SetThemeTextColorForWindow
+ PyMac_PRECHECK(SetThemeTextColorForWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&bhb",
+ WinObj_Convert, &window,
+ &isActive,
+ &depth,
+ &isColorDev))
+ return NULL;
+ _err = SetThemeTextColorForWindow(window,
+ isActive,
+ depth,
+ isColorDev);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_IsValidAppearanceFileType(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ OSType fileType;
+#ifndef IsValidAppearanceFileType
+ PyMac_PRECHECK(IsValidAppearanceFileType);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &fileType))
+ return NULL;
+ _rv = IsValidAppearanceFileType(fileType);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *App_GetThemeBrushAsColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ThemeBrush inBrush;
+ SInt16 inDepth;
+ Boolean inColorDev;
+ RGBColor outColor;
+#ifndef GetThemeBrushAsColor
+ PyMac_PRECHECK(GetThemeBrushAsColor);
+#endif
+ if (!PyArg_ParseTuple(_args, "hhb",
+ &inBrush,
+ &inDepth,
+ &inColorDev))
+ return NULL;
+ _err = GetThemeBrushAsColor(inBrush,
+ inDepth,
+ inColorDev,
+ &outColor);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ QdRGB_New, &outColor);
+ return _res;
+}
+
+static PyObject *App_GetThemeTextColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ThemeTextColor inColor;
+ SInt16 inDepth;
+ Boolean inColorDev;
+ RGBColor outColor;
+#ifndef GetThemeTextColor
+ PyMac_PRECHECK(GetThemeTextColor);
+#endif
+ if (!PyArg_ParseTuple(_args, "hhb",
+ &inColor,
+ &inDepth,
+ &inColorDev))
+ return NULL;
+ _err = GetThemeTextColor(inColor,
+ inDepth,
+ inColorDev,
+ &outColor);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ QdRGB_New, &outColor);
+ return _res;
+}
+
+static PyObject *App_GetThemeMetric(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ThemeMetric inMetric;
+ SInt32 outMetric;
+#ifndef GetThemeMetric
+ PyMac_PRECHECK(GetThemeMetric);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &inMetric))
+ return NULL;
+ _err = GetThemeMetric(inMetric,
+ &outMetric);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outMetric);
+ return _res;
+}
+
+static PyMethodDef App_methods[] = {
+ {"RegisterAppearanceClient", (PyCFunction)App_RegisterAppearanceClient, 1,
+ PyDoc_STR("() -> None")},
+ {"UnregisterAppearanceClient", (PyCFunction)App_UnregisterAppearanceClient, 1,
+ PyDoc_STR("() -> None")},
+ {"SetThemePen", (PyCFunction)App_SetThemePen, 1,
+ PyDoc_STR("(ThemeBrush inBrush, SInt16 inDepth, Boolean inIsColorDevice) -> None")},
+ {"SetThemeBackground", (PyCFunction)App_SetThemeBackground, 1,
+ PyDoc_STR("(ThemeBrush inBrush, SInt16 inDepth, Boolean inIsColorDevice) -> None")},
+ {"SetThemeTextColor", (PyCFunction)App_SetThemeTextColor, 1,
+ PyDoc_STR("(ThemeTextColor inColor, SInt16 inDepth, Boolean inIsColorDevice) -> None")},
+ {"SetThemeWindowBackground", (PyCFunction)App_SetThemeWindowBackground, 1,
+ PyDoc_STR("(WindowPtr inWindow, ThemeBrush inBrush, Boolean inUpdate) -> None")},
+ {"DrawThemeWindowHeader", (PyCFunction)App_DrawThemeWindowHeader, 1,
+ PyDoc_STR("(Rect inRect, ThemeDrawState inState) -> None")},
+ {"DrawThemeWindowListViewHeader", (PyCFunction)App_DrawThemeWindowListViewHeader, 1,
+ PyDoc_STR("(Rect inRect, ThemeDrawState inState) -> None")},
+ {"DrawThemePlacard", (PyCFunction)App_DrawThemePlacard, 1,
+ PyDoc_STR("(Rect inRect, ThemeDrawState inState) -> None")},
+ {"DrawThemeEditTextFrame", (PyCFunction)App_DrawThemeEditTextFrame, 1,
+ PyDoc_STR("(Rect inRect, ThemeDrawState inState) -> None")},
+ {"DrawThemeListBoxFrame", (PyCFunction)App_DrawThemeListBoxFrame, 1,
+ PyDoc_STR("(Rect inRect, ThemeDrawState inState) -> None")},
+ {"DrawThemeFocusRect", (PyCFunction)App_DrawThemeFocusRect, 1,
+ PyDoc_STR("(Rect inRect, Boolean inHasFocus) -> None")},
+ {"DrawThemePrimaryGroup", (PyCFunction)App_DrawThemePrimaryGroup, 1,
+ PyDoc_STR("(Rect inRect, ThemeDrawState inState) -> None")},
+ {"DrawThemeSecondaryGroup", (PyCFunction)App_DrawThemeSecondaryGroup, 1,
+ PyDoc_STR("(Rect inRect, ThemeDrawState inState) -> None")},
+ {"DrawThemeSeparator", (PyCFunction)App_DrawThemeSeparator, 1,
+ PyDoc_STR("(Rect inRect, ThemeDrawState inState) -> None")},
+ {"DrawThemeModelessDialogFrame", (PyCFunction)App_DrawThemeModelessDialogFrame, 1,
+ PyDoc_STR("(Rect inRect, ThemeDrawState inState) -> None")},
+ {"DrawThemeGenericWell", (PyCFunction)App_DrawThemeGenericWell, 1,
+ PyDoc_STR("(Rect inRect, ThemeDrawState inState, Boolean inFillCenter) -> None")},
+ {"DrawThemeFocusRegion", (PyCFunction)App_DrawThemeFocusRegion, 1,
+ PyDoc_STR("(Boolean inHasFocus) -> None")},
+ {"IsThemeInColor", (PyCFunction)App_IsThemeInColor, 1,
+ PyDoc_STR("(SInt16 inDepth, Boolean inIsColorDevice) -> (Boolean _rv)")},
+ {"GetThemeAccentColors", (PyCFunction)App_GetThemeAccentColors, 1,
+ PyDoc_STR("() -> (CTabHandle outColors)")},
+ {"DrawThemeMenuBarBackground", (PyCFunction)App_DrawThemeMenuBarBackground, 1,
+ PyDoc_STR("(Rect inBounds, ThemeMenuBarState inState, UInt32 inAttributes) -> None")},
+ {"GetThemeMenuBarHeight", (PyCFunction)App_GetThemeMenuBarHeight, 1,
+ PyDoc_STR("() -> (SInt16 outHeight)")},
+ {"DrawThemeMenuBackground", (PyCFunction)App_DrawThemeMenuBackground, 1,
+ PyDoc_STR("(Rect inMenuRect, ThemeMenuType inMenuType) -> None")},
+ {"GetThemeMenuBackgroundRegion", (PyCFunction)App_GetThemeMenuBackgroundRegion, 1,
+ PyDoc_STR("(Rect inMenuRect, ThemeMenuType menuType) -> None")},
+ {"DrawThemeMenuSeparator", (PyCFunction)App_DrawThemeMenuSeparator, 1,
+ PyDoc_STR("(Rect inItemRect) -> None")},
+ {"GetThemeMenuSeparatorHeight", (PyCFunction)App_GetThemeMenuSeparatorHeight, 1,
+ PyDoc_STR("() -> (SInt16 outHeight)")},
+ {"GetThemeMenuItemExtra", (PyCFunction)App_GetThemeMenuItemExtra, 1,
+ PyDoc_STR("(ThemeMenuItemType inItemType) -> (SInt16 outHeight, SInt16 outWidth)")},
+ {"GetThemeMenuTitleExtra", (PyCFunction)App_GetThemeMenuTitleExtra, 1,
+ PyDoc_STR("(Boolean inIsSquished) -> (SInt16 outWidth)")},
+ {"DrawThemeTabPane", (PyCFunction)App_DrawThemeTabPane, 1,
+ PyDoc_STR("(Rect inRect, ThemeDrawState inState) -> None")},
+ {"GetThemeTabRegion", (PyCFunction)App_GetThemeTabRegion, 1,
+ PyDoc_STR("(Rect inRect, ThemeTabStyle inStyle, ThemeTabDirection inDirection) -> None")},
+ {"SetThemeCursor", (PyCFunction)App_SetThemeCursor, 1,
+ PyDoc_STR("(ThemeCursor inCursor) -> None")},
+ {"SetAnimatedThemeCursor", (PyCFunction)App_SetAnimatedThemeCursor, 1,
+ PyDoc_STR("(ThemeCursor inCursor, UInt32 inAnimationStep) -> None")},
+ {"GetThemeScrollBarThumbStyle", (PyCFunction)App_GetThemeScrollBarThumbStyle, 1,
+ PyDoc_STR("() -> (ThemeScrollBarThumbStyle outStyle)")},
+ {"GetThemeScrollBarArrowStyle", (PyCFunction)App_GetThemeScrollBarArrowStyle, 1,
+ PyDoc_STR("() -> (ThemeScrollBarArrowStyle outStyle)")},
+ {"GetThemeCheckBoxStyle", (PyCFunction)App_GetThemeCheckBoxStyle, 1,
+ PyDoc_STR("() -> (ThemeCheckBoxStyle outStyle)")},
+ {"UseThemeFont", (PyCFunction)App_UseThemeFont, 1,
+ PyDoc_STR("(ThemeFontID inFontID, ScriptCode inScript) -> None")},
+ {"DrawThemeTextBox", (PyCFunction)App_DrawThemeTextBox, 1,
+ PyDoc_STR("(CFStringRef inString, ThemeFontID inFontID, ThemeDrawState inState, Boolean inWrapToWidth, Rect inBoundingBox, SInt16 inJust) -> None")},
+ {"TruncateThemeText", (PyCFunction)App_TruncateThemeText, 1,
+ PyDoc_STR("(CFMutableStringRef inString, ThemeFontID inFontID, ThemeDrawState inState, SInt16 inPixelWidthLimit, TruncCode inTruncWhere) -> (Boolean outTruncated)")},
+ {"GetThemeTextDimensions", (PyCFunction)App_GetThemeTextDimensions, 1,
+ PyDoc_STR("(CFStringRef inString, ThemeFontID inFontID, ThemeDrawState inState, Boolean inWrapToWidth, Point ioBounds) -> (Point ioBounds, SInt16 outBaseline)")},
+ {"GetThemeTextShadowOutset", (PyCFunction)App_GetThemeTextShadowOutset, 1,
+ PyDoc_STR("(ThemeFontID inFontID, ThemeDrawState inState) -> (Rect outOutset)")},
+ {"DrawThemeScrollBarArrows", (PyCFunction)App_DrawThemeScrollBarArrows, 1,
+ PyDoc_STR("(Rect bounds, ThemeTrackEnableState enableState, ThemeTrackPressState pressState, Boolean isHoriz) -> (Rect trackBounds)")},
+ {"GetThemeScrollBarTrackRect", (PyCFunction)App_GetThemeScrollBarTrackRect, 1,
+ PyDoc_STR("(Rect bounds, ThemeTrackEnableState enableState, ThemeTrackPressState pressState, Boolean isHoriz) -> (Rect trackBounds)")},
+ {"HitTestThemeScrollBarArrows", (PyCFunction)App_HitTestThemeScrollBarArrows, 1,
+ PyDoc_STR("(Rect scrollBarBounds, ThemeTrackEnableState enableState, ThemeTrackPressState pressState, Boolean isHoriz, Point ptHit) -> (Boolean _rv, Rect trackBounds, ControlPartCode partcode)")},
+ {"DrawThemeScrollBarDelimiters", (PyCFunction)App_DrawThemeScrollBarDelimiters, 1,
+ PyDoc_STR("(ThemeWindowType flavor, Rect inContRect, ThemeDrawState state, ThemeWindowAttributes attributes) -> None")},
+ {"DrawThemeButton", (PyCFunction)App_DrawThemeButton, 1,
+ PyDoc_STR("(Rect inBounds, UInt16 inKind, ThemeButtonDrawInfo inNewInfo, ThemeButtonDrawInfo inPrevInfo, UInt32 inUserData) -> None")},
+ {"GetThemeButtonRegion", (PyCFunction)App_GetThemeButtonRegion, 1,
+ PyDoc_STR("(Rect inBounds, UInt16 inKind, ThemeButtonDrawInfo inNewInfo) -> None")},
+ {"GetThemeButtonContentBounds", (PyCFunction)App_GetThemeButtonContentBounds, 1,
+ PyDoc_STR("(Rect inBounds, UInt16 inKind, ThemeButtonDrawInfo inDrawInfo) -> (Rect outBounds)")},
+ {"GetThemeButtonBackgroundBounds", (PyCFunction)App_GetThemeButtonBackgroundBounds, 1,
+ PyDoc_STR("(Rect inBounds, UInt16 inKind, ThemeButtonDrawInfo inDrawInfo) -> (Rect outBounds)")},
+ {"PlayThemeSound", (PyCFunction)App_PlayThemeSound, 1,
+ PyDoc_STR("(ThemeSoundKind kind) -> None")},
+ {"BeginThemeDragSound", (PyCFunction)App_BeginThemeDragSound, 1,
+ PyDoc_STR("(ThemeDragSoundKind kind) -> None")},
+ {"EndThemeDragSound", (PyCFunction)App_EndThemeDragSound, 1,
+ PyDoc_STR("() -> None")},
+ {"DrawThemeTickMark", (PyCFunction)App_DrawThemeTickMark, 1,
+ PyDoc_STR("(Rect bounds, ThemeDrawState state) -> None")},
+ {"DrawThemeChasingArrows", (PyCFunction)App_DrawThemeChasingArrows, 1,
+ PyDoc_STR("(Rect bounds, UInt32 index, ThemeDrawState state, UInt32 eraseData) -> None")},
+ {"DrawThemePopupArrow", (PyCFunction)App_DrawThemePopupArrow, 1,
+ PyDoc_STR("(Rect bounds, ThemeArrowOrientation orientation, ThemePopupArrowSize size, ThemeDrawState state, UInt32 eraseData) -> None")},
+ {"DrawThemeStandaloneGrowBox", (PyCFunction)App_DrawThemeStandaloneGrowBox, 1,
+ PyDoc_STR("(Point origin, ThemeGrowDirection growDirection, Boolean isSmall, ThemeDrawState state) -> None")},
+ {"DrawThemeStandaloneNoGrowBox", (PyCFunction)App_DrawThemeStandaloneNoGrowBox, 1,
+ PyDoc_STR("(Point origin, ThemeGrowDirection growDirection, Boolean isSmall, ThemeDrawState state) -> None")},
+ {"GetThemeStandaloneGrowBoxBounds", (PyCFunction)App_GetThemeStandaloneGrowBoxBounds, 1,
+ PyDoc_STR("(Point origin, ThemeGrowDirection growDirection, Boolean isSmall) -> (Rect bounds)")},
+ {"NormalizeThemeDrawingState", (PyCFunction)App_NormalizeThemeDrawingState, 1,
+ PyDoc_STR("() -> None")},
+ {"GetThemeDrawingState", (PyCFunction)App_GetThemeDrawingState, 1,
+ PyDoc_STR("() -> (ThemeDrawingState outState)")},
+ {"ApplyThemeBackground", (PyCFunction)App_ApplyThemeBackground, 1,
+ PyDoc_STR("(ThemeBackgroundKind inKind, Rect bounds, ThemeDrawState inState, SInt16 inDepth, Boolean inColorDev) -> None")},
+ {"SetThemeTextColorForWindow", (PyCFunction)App_SetThemeTextColorForWindow, 1,
+ PyDoc_STR("(WindowPtr window, Boolean isActive, SInt16 depth, Boolean isColorDev) -> None")},
+ {"IsValidAppearanceFileType", (PyCFunction)App_IsValidAppearanceFileType, 1,
+ PyDoc_STR("(OSType fileType) -> (Boolean _rv)")},
+ {"GetThemeBrushAsColor", (PyCFunction)App_GetThemeBrushAsColor, 1,
+ PyDoc_STR("(ThemeBrush inBrush, SInt16 inDepth, Boolean inColorDev) -> (RGBColor outColor)")},
+ {"GetThemeTextColor", (PyCFunction)App_GetThemeTextColor, 1,
+ PyDoc_STR("(ThemeTextColor inColor, SInt16 inDepth, Boolean inColorDev) -> (RGBColor outColor)")},
+ {"GetThemeMetric", (PyCFunction)App_GetThemeMetric, 1,
+ PyDoc_STR("(ThemeMetric inMetric) -> (SInt32 outMetric)")},
+ {NULL, NULL, 0}
+};
+
+
+#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 ||
+ PyDict_SetItemString(d, "Error", App_Error) != 0)
+ return;
+ ThemeDrawingState_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&ThemeDrawingState_Type) < 0) return;
+ Py_INCREF(&ThemeDrawingState_Type);
+ PyModule_AddObject(m, "ThemeDrawingState", (PyObject *)&ThemeDrawingState_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&ThemeDrawingState_Type);
+ PyModule_AddObject(m, "ThemeDrawingStateType", (PyObject *)&ThemeDrawingState_Type);
+#endif /* __LP64__ */
+}
+
+/* ======================== End module _App ========================= */
+
diff --git a/Mac/Modules/app/appscan.py b/Mac/Modules/app/appscan.py
new file mode 100644
index 0000000000..94eee474c1
--- /dev/null
+++ b/Mac/Modules/app/appscan.py
@@ -0,0 +1,80 @@
+# Scan an Apple header file, generating a Python file of generator calls.
+
+import sys
+from bgenlocations import TOOLBOXDIR, BGENDIR
+sys.path.append(BGENDIR)
+from scantools import Scanner
+
+LONG = "Appearance"
+SHORT = "app"
+OBJECT = "ThemeDrawingState"
+
+def main():
+ input = LONG + ".h"
+ output = SHORT + "gen.py"
+ defsoutput = TOOLBOXDIR + LONG + ".py"
+ scanner = MyScanner(input, output, defsoutput)
+ scanner.scan()
+ scanner.close()
+ print "=== Testing definitions output code ==="
+ execfile(defsoutput, {}, {})
+ print "=== Done scanning and generating, now importing the generated code... ==="
+ exec "import " + SHORT + "support"
+ print "=== Done. It's up to you to compile it now! ==="
+
+class MyScanner(Scanner):
+
+ def destination(self, type, name, arglist):
+ classname = "Function"
+ listname = "functions"
+ if arglist:
+ t, n, m = arglist[0]
+ # This is non-functional today
+ if t == OBJECT and m == "InMode":
+ classname = "Method"
+ listname = "methods"
+ return classname, listname
+
+ def writeinitialdefs(self):
+ self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
+
+ def makeblacklistnames(self):
+ return [
+ "GetThemeFont", # Funny stringbuffer in/out parameter, I think...
+ # Constants with funny definitions
+ "appearanceBadBrushIndexErr",
+ "appearanceProcessRegisteredErr",
+ "appearanceProcessNotRegisteredErr",
+ "appearanceBadTextColorIndexErr",
+ "appearanceThemeHasNoAccents",
+ "appearanceBadCursorIndexErr",
+ ]
+
+ def makeblacklisttypes(self):
+ return [
+ "MenuTitleDrawingUPP",
+ "MenuItemDrawingUPP",
+ "ThemeIteratorUPP",
+ "ThemeTabTitleDrawUPP",
+# "ThemeEraseUPP",
+# "ThemeButtonDrawUPP",
+ "WindowTitleDrawingUPP",
+ "ProcessSerialNumber_ptr", # Too much work for now.
+ "ThemeTrackDrawInfo_ptr", # Too much work
+# "ThemeButtonDrawInfo_ptr", # ditto
+ "ThemeWindowMetrics_ptr", # ditto
+# "ThemeDrawingState", # This is an opaque pointer, so it should be simple. Later.
+ "Collection", # No interface to collection mgr yet.
+ "BytePtr", # Not yet.
+ ]
+
+ def makerepairinstructions(self):
+ return [
+ ([("void", 'inContext', "OutMode")],
+ [("NULL", 'inContext', "InMode")]),
+ ([("Point", 'ioBounds', "OutMode")],
+ [("Point", 'ioBounds', "InOutMode")]),
+ ]
+
+if __name__ == "__main__":
+ main()
diff --git a/Mac/Modules/app/appsupport.py b/Mac/Modules/app/appsupport.py
new file mode 100644
index 0000000000..177dfd55f5
--- /dev/null
+++ b/Mac/Modules/app/appsupport.py
@@ -0,0 +1,133 @@
+# This script generates a Python interface for an Apple Macintosh Manager.
+# It uses the "bgen" package to generate C code.
+# The function specifications are generated by scanning the mamager's header file,
+# using the "scantools" package (customized for this particular manager).
+
+import string
+
+# Declarations that change for each manager
+MACHEADERFILE = 'Appearance.h' # The Apple header file
+MODNAME = '_App' # The name of the module
+OBJECTNAME = 'ThemeDrawingState' # The basic name of the objects used here
+KIND = '' # Usually 'Ptr' or 'Handle'
+
+# The following is *usually* unchanged but may still require tuning
+MODPREFIX = 'App' # The prefix for module-wide routines
+OBJECTTYPE = OBJECTNAME + KIND # The C type used to represent them
+OBJECTPREFIX = OBJECTNAME + 'Obj' # The prefix for object methods
+INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner
+OUTPUTFILE = MODNAME + "module.c" # The file generated by this program
+
+from macsupport import *
+
+# Create the type objects
+#MenuRef = OpaqueByValueType("MenuRef", "MenuObj")
+
+
+#WindowPeek = OpaqueByValueType("WindowPeek", OBJECTPREFIX)
+
+RgnHandle = FakeType("(RgnHandle)0")
+NULL = FakeType("NULL")
+
+# XXXX Should be next, but this will break a lot of code...
+# RgnHandle = OpaqueByValueType("RgnHandle", "OptResObj")
+
+#KeyMap = ArrayOutputBufferType("KeyMap")
+#MacOSEventKind = Type("MacOSEventKind", "h") # Old-style
+#MacOSEventMask = Type("MacOSEventMask", "h") # Old-style
+#EventMask = Type("EventMask", "h")
+#EventKind = Type("EventKind", "h")
+ThemeBrush = Type("ThemeBrush", "h")
+ThemeColor = Type("ThemeColor", "h")
+ThemeTextColor = Type("ThemeTextColor", "h")
+ThemeMenuBarState = Type("ThemeMenuBarState", "H")
+ThemeMenuState = Type("ThemeMenuState", "H")
+ThemeMenuType = Type("ThemeMenuType", "H")
+ThemeMenuItemType = Type("ThemeMenuItemType", "H")
+ThemeFontID = Type("ThemeFontID", "H")
+ThemeTabStyle = Type("ThemeTabStyle", "H")
+ThemeTabDirection = Type("ThemeTabDirection", "H")
+ThemeDrawState = Type("ThemeDrawState", "l")
+ThemeCursor = Type("ThemeCursor", "l")
+ThemeCheckBoxStyle = Type("ThemeCheckBoxStyle", "H")
+ThemeScrollBarArrowStyle = Type("ThemeScrollBarArrowStyle", "H")
+ThemeScrollBarThumbStyle = Type("ThemeScrollBarThumbStyle", "H")
+CTabHandle = OpaqueByValueType("CTabHandle", "ResObj")
+ThemeTrackEnableState = Type("ThemeTrackEnableState", "b")
+ThemeTrackPressState = Type("ThemeTrackPressState", "b")
+ThemeThumbDirection = Type("ThemeThumbDirection", "b")
+ThemeTrackAttributes = Type("ThemeTrackAttributes", "H")
+ControlPartCode = Type("ControlPartCode", "h")
+ThemeWindowAttributes = Type("ThemeWindowAttributes", "l")
+ThemeWindowType = Type("ThemeWindowType", "H")
+ThemeTitleBarWidget = Type("ThemeTitleBarWidget", "H")
+ThemeArrowOrientation = Type("ThemeArrowOrientation", "H")
+ThemePopupArrowSize = Type("ThemePopupArrowSize", "H")
+ThemeGrowDirection = Type("ThemeGrowDirection", "H")
+ThemeSoundKind = OSTypeType("ThemeSoundKind")
+ThemeDragSoundKind = OSTypeType("ThemeDragSoundKind")
+ThemeBackgroundKind = Type("ThemeBackgroundKind", "l")
+ThemeMetric = Type("ThemeMetric", "l")
+RGBColor = OpaqueType("RGBColor", "QdRGB")
+TruncCode = Type("TruncCode", "h")
+
+
+ThemeButtonKind = UInt16
+ThemeButtonDrawInfo_ptr = OpaqueType("ThemeButtonDrawInfo", "ThemeButtonDrawInfo")
+ThemeEraseUPP = FakeType("NULL")
+ThemeButtonDrawUPP = FakeType("NULL")
+
+
+includestuff = includestuff + """
+#include <Carbon/Carbon.h>
+
+
+int ThemeButtonDrawInfo_Convert(PyObject *v, ThemeButtonDrawInfo *p_itself)
+{
+ return PyArg_Parse(v, "(iHH)", &p_itself->state, &p_itself->value, &p_itself->adornment);
+}
+
+"""
+
+class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
+ pass
+## def outputCheckNewArg(self):
+## Output("if (itself == NULL) return PyMac_Error(resNotFound);")
+## def outputCheckConvertArg(self):
+## OutLbrace("if (DlgObj_Check(v))")
+## Output("*p_itself = ((WindowObject *)v)->ob_itself;")
+## Output("return 1;")
+## OutRbrace()
+## Out("""
+## if (v == Py_None) { *p_itself = NULL; return 1; }
+## if (PyInt_Check(v)) { *p_itself = (WindowPtr)PyInt_AsLong(v); return 1; }
+## """)
+
+# From here on it's basically all boiler plate...
+
+# Create the generator groups and link them
+module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff)
+object = MyObjectDefinition(OBJECTNAME, OBJECTPREFIX, OBJECTTYPE)
+module.addobject(object)
+
+ThemeDrawingState = OpaqueByValueType("ThemeDrawingState", "ThemeDrawingStateObj")
+Method = WeakLinkMethodGenerator
+
+
+# Create the generator classes used to populate the lists
+Function = OSErrWeakLinkFunctionGenerator
+##Method = OSErrWeakLinkMethodGenerator
+
+# Create and populate the lists
+functions = []
+methods = []
+execfile(INPUTFILE)
+
+# add the populated lists to the generator groups
+# (in a different wordl the scan program would generate this)
+for f in functions: module.add(f)
+for f in methods: object.add(f)
+
+# generate output (open the output file as late as possible)
+SetOutputFileName(OUTPUTFILE)
+module.generate()
diff --git a/Mac/Modules/autoGIL.c b/Mac/Modules/autoGIL.c
new file mode 100644
index 0000000000..3bc1593151
--- /dev/null
+++ b/Mac/Modules/autoGIL.c
@@ -0,0 +1,152 @@
+#include "Python.h"
+#include <CoreFoundation/CFRunLoop.h>
+
+/* These macros are defined in Python 2.3 but not 2.2 */
+#ifndef PyMODINIT_FUNC
+#define PyMODINIT_FUNC void
+#endif
+#ifndef PyDoc_STRVAR
+#define PyDoc_STRVAR(Var,Str) static char Var[] = Str
+#endif
+
+
+#undef AUTOGIL_DEBUG
+
+static PyObject *AutoGILError;
+
+
+static void autoGILCallback(CFRunLoopObserverRef observer,
+ CFRunLoopActivity activity,
+ void *info) {
+ PyThreadState **p_tstate = (PyThreadState **)info;
+
+ switch (activity) {
+ case kCFRunLoopBeforeWaiting:
+ /* going to sleep, release GIL */
+#ifdef AUTOGIL_DEBUG
+ fprintf(stderr, "going to sleep, release GIL\n");
+#endif
+ *p_tstate = PyEval_SaveThread();
+ break;
+ case kCFRunLoopAfterWaiting:
+ /* waking up, acquire GIL */
+#ifdef AUTOGIL_DEBUG
+ fprintf(stderr, "waking up, acquire GIL\n");
+#endif
+ PyEval_RestoreThread(*p_tstate);
+ *p_tstate = NULL;
+ break;
+ default:
+ break;
+ }
+}
+
+static void infoRelease(const void *info) {
+ /* XXX This should get called when the run loop is deallocated,
+ but this doesn't seem to happen. So for now: leak. */
+ PyMem_Free((void *)info);
+}
+
+static PyObject *
+autoGIL_installAutoGIL(PyObject *self)
+{
+ PyObject *tstate_dict = PyThreadState_GetDict();
+ PyObject *v;
+ CFRunLoopRef rl;
+ PyThreadState **p_tstate; /* for use in the info field */
+ CFRunLoopObserverContext context = {0, NULL, NULL, NULL, NULL};
+ CFRunLoopObserverRef observer;
+
+ if (tstate_dict == NULL)
+ return NULL;
+ v = PyDict_GetItemString(tstate_dict, "autoGIL.InstalledAutoGIL");
+ if (v != NULL) {
+ /* we've already installed a callback for this thread */
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+
+ rl = CFRunLoopGetCurrent();
+ if (rl == NULL) {
+ PyErr_SetString(AutoGILError,
+ "can't get run loop for current thread");
+ return NULL;
+ }
+
+ p_tstate = PyMem_Malloc(sizeof(PyThreadState *));
+ if (p_tstate == NULL) {
+ PyErr_SetString(PyExc_MemoryError,
+ "not enough memory to allocate "
+ "tstate pointer");
+ return NULL;
+ }
+ *p_tstate = NULL;
+ context.info = (void *)p_tstate;
+ context.release = infoRelease;
+
+ observer = CFRunLoopObserverCreate(
+ NULL,
+ kCFRunLoopBeforeWaiting | kCFRunLoopAfterWaiting,
+ 1, 0, autoGILCallback, &context);
+ if (observer == NULL) {
+ PyErr_SetString(AutoGILError,
+ "can't create event loop observer");
+ return NULL;
+ }
+ CFRunLoopAddObserver(rl, observer, kCFRunLoopDefaultMode);
+ /* XXX how to check for errors? */
+
+ /* register that we have installed a callback for this thread */
+ if (PyDict_SetItemString(tstate_dict, "autoGIL.InstalledAutoGIL",
+ Py_None) < 0)
+ return NULL;
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+PyDoc_STRVAR(autoGIL_installAutoGIL_doc,
+"installAutoGIL() -> None\n\
+Install an observer callback in the event loop (CFRunLoop) for the\n\
+current thread, that will lock and unlock the Global Interpreter Lock\n\
+(GIL) at appropriate times, allowing other Python threads to run while\n\
+the event loop is idle."
+);
+
+static PyMethodDef autoGIL_methods[] = {
+ {
+ "installAutoGIL",
+ (PyCFunction)autoGIL_installAutoGIL,
+ METH_NOARGS,
+ autoGIL_installAutoGIL_doc
+ },
+ { 0, 0, 0, 0 } /* sentinel */
+};
+
+PyDoc_STRVAR(autoGIL_docs,
+"The autoGIL module provides a function (installAutoGIL) that\n\
+automatically locks and unlocks Python's Global Interpreter Lock\n\
+when running an event loop."
+);
+
+PyMODINIT_FUNC
+initautoGIL(void)
+{
+ PyObject *mod;
+
+ if (PyErr_WarnPy3k("In 3.x, the autoGIL module is removed.", 1) < 0)
+ return;
+
+ mod = Py_InitModule4("autoGIL", autoGIL_methods, autoGIL_docs,
+ NULL, PYTHON_API_VERSION);
+ if (mod == NULL)
+ return;
+ AutoGILError = PyErr_NewException("autoGIL.AutoGILError",
+ PyExc_Exception, NULL);
+ if (AutoGILError == NULL)
+ return;
+ Py_INCREF(AutoGILError);
+ if (PyModule_AddObject(mod, "AutoGILError",
+ AutoGILError) < 0)
+ return;
+}
diff --git a/Mac/Modules/carbonevt/CarbonEvtscan.py b/Mac/Modules/carbonevt/CarbonEvtscan.py
new file mode 100644
index 0000000000..31e2336b1d
--- /dev/null
+++ b/Mac/Modules/carbonevt/CarbonEvtscan.py
@@ -0,0 +1,115 @@
+# IBCarbonscan.py
+
+import sys
+import MacOS
+import sys
+
+from bgenlocations import TOOLBOXDIR, BGENDIR
+sys.path.append(BGENDIR)
+
+from scantools import Scanner, Scanner_OSX
+
+def main():
+ print "---Scanning CarbonEvents.h---"
+ input = ["CarbonEvents.h"]
+ output = "CarbonEventsgen.py"
+ defsoutput = TOOLBOXDIR + "CarbonEvents.py"
+ scanner = CarbonEvents_Scanner(input, output, defsoutput)
+ scanner.scan()
+ scanner.close()
+ print "=== Testing definitions output code ==="
+ execfile(defsoutput, {}, {})
+ print "--done scanning, importing--"
+ import CarbonEvtsupport
+ print "done"
+
+RefObjectTypes = ["EventRef",
+ "EventQueueRef",
+ "EventLoopRef",
+ "EventLoopTimerRef",
+ "EventHandlerRef",
+ "EventHandlerCallRef",
+ "EventTargetRef",
+ "EventHotKeyRef",
+ ]
+
+class CarbonEvents_Scanner(Scanner_OSX):
+ def destination(self, type, name, arglist):
+ classname = "CarbonEventsFunction"
+ listname = "functions"
+ if arglist:
+ t, n, m = arglist[0]
+ if t in RefObjectTypes and m == "InMode":
+ if t == "EventHandlerRef":
+ classname = "EventHandlerRefMethod"
+ else:
+ classname = "CarbonEventsMethod"
+ listname = t + "methods"
+ #else:
+ # print "not method"
+ return classname, listname
+
+ def writeinitialdefs(self):
+ self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
+ self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
+ self.defsfile.write("false = 0\n")
+ self.defsfile.write("true = 1\n")
+ self.defsfile.write("keyAEEventClass = FOUR_CHAR_CODE('evcl')\n")
+ self.defsfile.write("keyAEEventID = FOUR_CHAR_CODE('evti')\n")
+
+ def makeblacklistnames(self):
+ return [
+ "sHandler",
+ "MacCreateEvent",
+# "TrackMouseLocationWithOptions",
+# "TrackMouseLocation",
+# "TrackMouseRegion",
+ "RegisterToolboxObjectClass",
+ "UnregisterToolboxObjectClass",
+ "ProcessHICommand",
+ "GetCFRunLoopFromEventLoop",
+
+ "InvokeEventHandlerUPP",
+ "InvokeEventComparatorUPP",
+ "InvokeEventLoopTimerUPP",
+ "NewEventComparatorUPP",
+ "NewEventLoopTimerUPP",
+ "NewEventHandlerUPP",
+ "DisposeEventComparatorUPP",
+ "DisposeEventLoopTimerUPP",
+ "DisposeEventHandlerUPP",
+
+ # Wrote by hand
+ "InstallEventHandler",
+ "RemoveEventHandler",
+
+ # Write by hand?
+ "GetEventParameter",
+ "FlushSpecificEventsFromQueue",
+ "FindSpecificEventInQueue",
+ "InstallEventLoopTimer",
+
+ # Don't do these because they require a CFRelease
+ "CreateTypeStringWithOSType",
+ "CopyEvent",
+ ]
+
+# def makeblacklisttypes(self):
+# return ["EventComparatorUPP",
+# "EventLoopTimerUPP",
+# #"EventHandlerUPP",
+# "EventComparatorProcPtr",
+# "EventLoopTimerProcPtr",
+# "EventHandlerProcPtr",
+# ]
+
+ def makerepairinstructions(self):
+ return [
+ ([("UInt32", 'inSize', "InMode"), ("void_ptr", 'inDataPtr', "InMode")],
+ [("MyInBuffer", 'inDataPtr', "InMode")]),
+ ([("Boolean", 'ioWasInRgn', "OutMode")],
+ [("Boolean", 'ioWasInRgn', "InOutMode")]),
+ ]
+
+if __name__ == "__main__":
+ main()
diff --git a/Mac/Modules/carbonevt/CarbonEvtsupport.py b/Mac/Modules/carbonevt/CarbonEvtsupport.py
new file mode 100644
index 0000000000..77d12b6299
--- /dev/null
+++ b/Mac/Modules/carbonevt/CarbonEvtsupport.py
@@ -0,0 +1,314 @@
+# IBCarbonsupport.py
+
+from macsupport import *
+
+from CarbonEvtscan import RefObjectTypes
+
+# where should this go? macsupport.py?
+CFStringRef = OpaqueByValueType('CFStringRef')
+
+for typ in RefObjectTypes:
+ execstr = "%(name)s = OpaqueByValueType('%(name)s')" % {"name": typ}
+ exec execstr
+
+
+if 0:
+ # these types will have no methods and will merely be opaque blobs
+ # should write getattr and setattr for them?
+
+ StructObjectTypes = ["EventTypeSpec",
+ "HIPoint",
+ "HICommand",
+ "EventHotKeyID",
+ ]
+
+ for typ in StructObjectTypes:
+ execstr = "%(name)s = OpaqueType('%(name)s')" % {"name": typ}
+ exec execstr
+
+EventHotKeyID = OpaqueByValueType("EventHotKeyID", "EventHotKeyID")
+EventTypeSpec_ptr = OpaqueType("EventTypeSpec", "EventTypeSpec")
+
+# is this the right type for the void * in GetEventParameter
+#void_ptr = FixedInputBufferType(1024)
+void_ptr = stringptr
+# here are some types that are really other types
+
+class MyVarInputBufferType(VarInputBufferType):
+ def passInput(self, name):
+ return "%s__len__, %s__in__" % (name, name)
+
+MyInBuffer = MyVarInputBufferType('char', 'long', 'l') # (buf, len)
+
+EventTime = double
+EventTimeout = EventTime
+EventTimerInterval = EventTime
+EventAttributes = UInt32
+EventParamName = OSType
+EventParamType = OSType
+EventPriority = SInt16
+EventMask = UInt16
+
+EventComparatorUPP = FakeType("(EventComparatorUPP)0")
+EventLoopTimerUPP = FakeType("(EventLoopTimerUPP)0")
+EventHandlerUPP = FakeType("(EventHandlerUPP)0")
+EventHandlerUPP = FakeType("(EventHandlerUPP)0")
+EventComparatorProcPtr = FakeType("(EventComparatorProcPtr)0")
+EventLoopTimerProcPtr = FakeType("(EventLoopTimerProcPtr)0")
+EventHandlerProcPtr = FakeType("(EventHandlerProcPtr)0")
+
+CarbonEventsFunction = OSErrFunctionGenerator
+CarbonEventsMethod = OSErrMethodGenerator
+
+class EventHandlerRefMethod(OSErrMethodGenerator):
+ def precheck(self):
+ OutLbrace('if (_self->ob_itself == NULL)')
+ Output('PyErr_SetString(CarbonEvents_Error, "Handler has been removed");')
+ Output('return NULL;')
+ OutRbrace()
+
+
+RgnHandle = OpaqueByValueType("RgnHandle", "ResObj")
+GrafPtr = OpaqueByValueType("GrafPtr", "GrafObj")
+MouseTrackingResult = UInt16
+
+
+includestuff = includestuff + r"""
+#include <Carbon/Carbon.h>
+
+extern int CFStringRef_New(CFStringRef *);
+
+extern int CFStringRef_Convert(PyObject *, CFStringRef *);
+extern int CFBundleRef_Convert(PyObject *, CFBundleRef *);
+
+int EventTargetRef_Convert(PyObject *, EventTargetRef *);
+PyObject *EventHandlerCallRef_New(EventHandlerCallRef itself);
+PyObject *EventRef_New(EventRef itself);
+
+/********** EventTypeSpec *******/
+static PyObject*
+EventTypeSpec_New(EventTypeSpec *in)
+{
+ return Py_BuildValue("ll", in->eventClass, in->eventKind);
+}
+
+static int
+EventTypeSpec_Convert(PyObject *v, EventTypeSpec *out)
+{
+ if (PyArg_Parse(v, "(O&l)",
+ PyMac_GetOSType, &(out->eventClass),
+ &(out->eventKind)))
+ return 1;
+ return NULL;
+}
+
+/********** end EventTypeSpec *******/
+
+/********** HIPoint *******/
+
+#if 0 /* XXX doesn't compile */
+static PyObject*
+HIPoint_New(HIPoint *in)
+{
+ return Py_BuildValue("ff", in->x, in->y);
+}
+
+static int
+HIPoint_Convert(PyObject *v, HIPoint *out)
+{
+ if (PyArg_ParseTuple(v, "ff", &(out->x), &(out->y)))
+ return 1;
+ return NULL;
+}
+#endif
+
+/********** end HIPoint *******/
+
+/********** EventHotKeyID *******/
+
+static PyObject*
+EventHotKeyID_New(EventHotKeyID *in)
+{
+ return Py_BuildValue("ll", in->signature, in->id);
+}
+
+static int
+EventHotKeyID_Convert(PyObject *v, EventHotKeyID *out)
+{
+ if (PyArg_ParseTuple(v, "ll", &out->signature, &out->id))
+ return 1;
+ return NULL;
+}
+
+/********** end EventHotKeyID *******/
+
+/******** myEventHandler ***********/
+
+static EventHandlerUPP myEventHandlerUPP;
+
+static pascal OSStatus
+myEventHandler(EventHandlerCallRef handlerRef, EventRef event, void *outPyObject) {
+ PyObject *retValue;
+ int status;
+
+ retValue = PyObject_CallFunction((PyObject *)outPyObject, "O&O&",
+ EventHandlerCallRef_New, handlerRef,
+ EventRef_New, event);
+ if (retValue == NULL) {
+ PySys_WriteStderr("Error in event handler callback:\n");
+ PyErr_Print(); /* this also clears the error */
+ status = noErr; /* complain? how? */
+ } else {
+ if (retValue == Py_None)
+ status = noErr;
+ else if (PyInt_Check(retValue)) {
+ status = PyInt_AsLong(retValue);
+ } else
+ status = noErr; /* wrong object type, complain? */
+ Py_DECREF(retValue);
+ }
+
+ return status;
+}
+
+/******** end myEventHandler ***********/
+
+"""
+
+initstuff = initstuff + """
+myEventHandlerUPP = NewEventHandlerUPP(myEventHandler);
+"""
+module = MacModule('_CarbonEvt', 'CarbonEvents', includestuff, finalstuff, initstuff)
+
+
+
+
+class EventHandlerRefObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
+ def outputStructMembers(self):
+ Output("%s ob_itself;", self.itselftype)
+ Output("PyObject *ob_callback;")
+ def outputInitStructMembers(self):
+ Output("it->ob_itself = %sitself;", self.argref)
+ Output("it->ob_callback = NULL;")
+ def outputFreeIt(self, name):
+ OutLbrace("if (self->ob_itself != NULL)")
+ Output("RemoveEventHandler(self->ob_itself);")
+ Output("Py_DECREF(self->ob_callback);")
+ OutRbrace()
+
+class MyGlobalObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
+ pass
+
+for typ in RefObjectTypes:
+ if typ == 'EventHandlerRef':
+ EventHandlerRefobject = EventHandlerRefObjectDefinition('EventHandlerRef')
+ else:
+ execstr = typ + 'object = MyGlobalObjectDefinition(typ)'
+ exec execstr
+ module.addobject(eval(typ + 'object'))
+
+
+functions = []
+for typ in RefObjectTypes: ## go thru all ObjectTypes as defined in CarbonEventsscan.py
+ # initialize the lists for carbongen to fill
+ execstr = typ + 'methods = []'
+ exec execstr
+
+execfile('CarbonEventsgen.py')
+
+
+
+for f in functions: module.add(f) # add all the functions carboneventsgen put in the list
+
+for typ in RefObjectTypes: ## go thru all ObjectTypes as defined in CarbonEventsscan.py
+ methods = eval(typ + 'methods') ## get a reference to the method list from the main namespace
+ obj = eval(typ + 'object') ## get a reference to the object
+ for m in methods: obj.add(m) ## add each method in the list to the object
+
+
+removeeventhandler = """
+OSStatus _err;
+if (_self->ob_itself == NULL) {
+ PyErr_SetString(CarbonEvents_Error, "Handler has been removed");
+ return NULL;
+}
+if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+_err = RemoveEventHandler(_self->ob_itself);
+if (_err != noErr) return PyMac_Error(_err);
+_self->ob_itself = NULL;
+Py_DECREF(_self->ob_callback);
+_self->ob_callback = NULL;
+Py_INCREF(Py_None);
+_res = Py_None;
+return _res;"""
+
+f = ManualGenerator("RemoveEventHandler", removeeventhandler);
+f.docstring = lambda: "() -> None"
+EventHandlerRefobject.add(f)
+
+
+installeventhandler = """
+EventTypeSpec inSpec;
+PyObject *callback;
+EventHandlerRef outRef;
+OSStatus _err;
+
+if (!PyArg_ParseTuple(_args, "O&O", EventTypeSpec_Convert, &inSpec, &callback))
+ return NULL;
+
+_err = InstallEventHandler(_self->ob_itself, myEventHandlerUPP, 1, &inSpec, (void *)callback, &outRef);
+if (_err != noErr) return PyMac_Error(_err);
+
+_res = EventHandlerRef_New(outRef);
+if (_res != NULL) {
+ ((EventHandlerRefObject*)_res)->ob_callback = callback;
+ Py_INCREF(callback);
+}
+return _res;"""
+
+f = ManualGenerator("InstallEventHandler", installeventhandler);
+f.docstring = lambda: "(EventTypeSpec inSpec, Method callback) -> (EventHandlerRef outRef)"
+EventTargetRefobject.add(f)
+
+# This may not be the best, but at least it lets you get the raw data back into python as a string. You'll have to cut it up yourself and parse the result.
+
+geteventparameter = """
+UInt32 bufferSize;
+EventParamName inName;
+EventParamType inType;
+OSErr _err;
+void * buffer;
+
+if (!PyArg_ParseTuple(_args, "O&O&", PyMac_GetOSType, &inName, PyMac_GetOSType, &inType))
+ return NULL;
+
+/* Figure out the size by passing a null buffer to GetEventParameter */
+_err = GetEventParameter(_self->ob_itself, inName, inType, NULL, 0, &bufferSize, NULL);
+
+if (_err != noErr)
+ return PyMac_Error(_err);
+buffer = PyMem_NEW(char, bufferSize);
+if (buffer == NULL)
+ return PyErr_NoMemory();
+
+_err = GetEventParameter(_self->ob_itself, inName, inType, NULL, bufferSize, NULL, buffer);
+
+if (_err != noErr) {
+ PyMem_DEL(buffer);
+ return PyMac_Error(_err);
+}
+_res = Py_BuildValue("s#", buffer, bufferSize);
+PyMem_DEL(buffer);
+return _res;
+"""
+
+f = ManualGenerator("GetEventParameter", geteventparameter);
+f.docstring = lambda: "(EventParamName eventName, EventParamType eventType) -> (String eventParamData)"
+EventRefobject.add(f)
+
+SetOutputFileName('_CarbonEvtmodule.c')
+module.generate()
+
+##import os
+##os.system("python setup.py build")
diff --git a/Mac/Modules/carbonevt/_CarbonEvtmodule.c b/Mac/Modules/carbonevt/_CarbonEvtmodule.c
new file mode 100755
index 0000000000..623a3e5a6b
--- /dev/null
+++ b/Mac/Modules/carbonevt/_CarbonEvtmodule.c
@@ -0,0 +1,2219 @@
+
+/* ======================= Module _CarbonEvt ======================== */
+
+#include "Python.h"
+
+#ifndef __LP64__
+
+#include "pymactoolbox.h"
+
+/* Macro to test whether a weak-loaded CFM function exists */
+#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
+ PyErr_SetString(PyExc_NotImplementedError, \
+ "Not available in this shared library/OS version"); \
+ return NULL; \
+ }} while(0)
+
+
+#include <Carbon/Carbon.h>
+
+extern int CFStringRef_New(CFStringRef *);
+
+extern int CFStringRef_Convert(PyObject *, CFStringRef *);
+extern int CFBundleRef_Convert(PyObject *, CFBundleRef *);
+
+int EventTargetRef_Convert(PyObject *, EventTargetRef *);
+PyObject *EventHandlerCallRef_New(EventHandlerCallRef itself);
+PyObject *EventRef_New(EventRef itself);
+
+/********** EventTypeSpec *******/
+static int
+EventTypeSpec_Convert(PyObject *v, EventTypeSpec *out)
+{
+ if (PyArg_Parse(v, "(O&l)",
+ PyMac_GetOSType, &(out->eventClass),
+ &(out->eventKind)))
+ return 1;
+ return 0;
+}
+
+/********** end EventTypeSpec *******/
+
+/********** HIPoint *******/
+
+#if 0 /* XXX doesn't compile */
+static PyObject*
+HIPoint_New(HIPoint *in)
+{
+ return Py_BuildValue("ff", in->x, in->y);
+}
+
+static int
+HIPoint_Convert(PyObject *v, HIPoint *out)
+{
+ if (PyArg_ParseTuple(v, "ff", &(out->x), &(out->y)))
+ return 1;
+ return NULL;
+}
+#endif
+
+/********** end HIPoint *******/
+
+/********** EventHotKeyID *******/
+
+static int
+EventHotKeyID_Convert(PyObject *v, EventHotKeyID *out)
+{
+ if (PyArg_ParseTuple(v, "ll", &out->signature, &out->id))
+ return 1;
+ return 0;
+}
+
+/********** end EventHotKeyID *******/
+
+/******** myEventHandler ***********/
+
+static EventHandlerUPP myEventHandlerUPP;
+
+static pascal OSStatus
+myEventHandler(EventHandlerCallRef handlerRef, EventRef event, void *outPyObject) {
+ PyObject *retValue;
+ int status;
+
+ retValue = PyObject_CallFunction((PyObject *)outPyObject, "O&O&",
+ EventHandlerCallRef_New, handlerRef,
+ EventRef_New, event);
+ if (retValue == NULL) {
+ PySys_WriteStderr("Error in event handler callback:\n");
+ PyErr_Print(); /* this also clears the error */
+ status = noErr; /* complain? how? */
+ } else {
+ if (retValue == Py_None)
+ status = noErr;
+ else if (PyInt_Check(retValue)) {
+ status = PyInt_AsLong(retValue);
+ } else
+ status = noErr; /* wrong object type, complain? */
+ Py_DECREF(retValue);
+ }
+
+ return status;
+}
+
+/******** end myEventHandler ***********/
+
+
+static PyObject *CarbonEvents_Error;
+
+/* ---------------------- Object type EventRef ---------------------- */
+
+PyTypeObject EventRef_Type;
+
+#define EventRef_Check(x) ((x)->ob_type == &EventRef_Type || PyObject_TypeCheck((x), &EventRef_Type))
+
+typedef struct EventRefObject {
+ PyObject_HEAD
+ EventRef ob_itself;
+} EventRefObject;
+
+PyObject *EventRef_New(EventRef itself)
+{
+ EventRefObject *it;
+ it = PyObject_NEW(EventRefObject, &EventRef_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+
+int EventRef_Convert(PyObject *v, EventRef *p_itself)
+{
+ if (!EventRef_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "EventRef required");
+ return 0;
+ }
+ *p_itself = ((EventRefObject *)v)->ob_itself;
+ return 1;
+}
+
+static void EventRef_dealloc(EventRefObject *self)
+{
+ /* Cleanup of self->ob_itself goes here */
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *EventRef_RetainEvent(EventRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ EventRef _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = RetainEvent(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ EventRef_New, _rv);
+ return _res;
+}
+
+static PyObject *EventRef_GetEventRetainCount(EventRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UInt32 _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetEventRetainCount(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *EventRef_ReleaseEvent(EventRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ReleaseEvent(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *EventRef_SetEventParameter(EventRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ OSType inName;
+ OSType inType;
+ char *inDataPtr__in__;
+ long inDataPtr__len__;
+ int inDataPtr__in_len__;
+ if (!PyArg_ParseTuple(_args, "O&O&s#",
+ PyMac_GetOSType, &inName,
+ PyMac_GetOSType, &inType,
+ &inDataPtr__in__, &inDataPtr__in_len__))
+ return NULL;
+ inDataPtr__len__ = inDataPtr__in_len__;
+ _err = SetEventParameter(_self->ob_itself,
+ inName,
+ inType,
+ inDataPtr__len__, inDataPtr__in__);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *EventRef_GetEventClass(EventRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UInt32 _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetEventClass(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *EventRef_GetEventKind(EventRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UInt32 _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetEventKind(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *EventRef_GetEventTime(EventRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ double _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetEventTime(_self->ob_itself);
+ _res = Py_BuildValue("d",
+ _rv);
+ return _res;
+}
+
+static PyObject *EventRef_SetEventTime(EventRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ double inTime;
+ if (!PyArg_ParseTuple(_args, "d",
+ &inTime))
+ return NULL;
+ _err = SetEventTime(_self->ob_itself,
+ inTime);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *EventRef_IsUserCancelEventRef(EventRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsUserCancelEventRef(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *EventRef_ConvertEventRefToEventRecord(EventRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ EventRecord outEvent;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = ConvertEventRefToEventRecord(_self->ob_itself,
+ &outEvent);
+ _res = Py_BuildValue("bO&",
+ _rv,
+ PyMac_BuildEventRecord, &outEvent);
+ return _res;
+}
+
+static PyObject *EventRef_IsEventInMask(EventRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ UInt16 inMask;
+ if (!PyArg_ParseTuple(_args, "H",
+ &inMask))
+ return NULL;
+ _rv = IsEventInMask(_self->ob_itself,
+ inMask);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *EventRef_SendEventToEventTarget(EventRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ EventTargetRef inTarget;
+ if (!PyArg_ParseTuple(_args, "O&",
+ EventTargetRef_Convert, &inTarget))
+ return NULL;
+ _err = SendEventToEventTarget(_self->ob_itself,
+ inTarget);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *EventRef_GetEventParameter(EventRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ UInt32 bufferSize;
+ EventParamName inName;
+ EventParamType inType;
+ OSErr _err;
+ void * buffer;
+
+ if (!PyArg_ParseTuple(_args, "O&O&", PyMac_GetOSType, &inName, PyMac_GetOSType, &inType))
+ return NULL;
+
+ /* Figure out the size by passing a null buffer to GetEventParameter */
+ _err = GetEventParameter(_self->ob_itself, inName, inType, NULL, 0, &bufferSize, NULL);
+
+ if (_err != noErr)
+ return PyMac_Error(_err);
+ buffer = PyMem_NEW(char, bufferSize);
+ if (buffer == NULL)
+ return PyErr_NoMemory();
+
+ _err = GetEventParameter(_self->ob_itself, inName, inType, NULL, bufferSize, NULL, buffer);
+
+ if (_err != noErr) {
+ PyMem_DEL(buffer);
+ return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("s#", buffer, bufferSize);
+ PyMem_DEL(buffer);
+ return _res;
+
+}
+
+static PyMethodDef EventRef_methods[] = {
+ {"RetainEvent", (PyCFunction)EventRef_RetainEvent, 1,
+ PyDoc_STR("() -> (EventRef _rv)")},
+ {"GetEventRetainCount", (PyCFunction)EventRef_GetEventRetainCount, 1,
+ PyDoc_STR("() -> (UInt32 _rv)")},
+ {"ReleaseEvent", (PyCFunction)EventRef_ReleaseEvent, 1,
+ PyDoc_STR("() -> None")},
+ {"SetEventParameter", (PyCFunction)EventRef_SetEventParameter, 1,
+ PyDoc_STR("(OSType inName, OSType inType, Buffer inDataPtr) -> None")},
+ {"GetEventClass", (PyCFunction)EventRef_GetEventClass, 1,
+ PyDoc_STR("() -> (UInt32 _rv)")},
+ {"GetEventKind", (PyCFunction)EventRef_GetEventKind, 1,
+ PyDoc_STR("() -> (UInt32 _rv)")},
+ {"GetEventTime", (PyCFunction)EventRef_GetEventTime, 1,
+ PyDoc_STR("() -> (double _rv)")},
+ {"SetEventTime", (PyCFunction)EventRef_SetEventTime, 1,
+ PyDoc_STR("(double inTime) -> None")},
+ {"IsUserCancelEventRef", (PyCFunction)EventRef_IsUserCancelEventRef, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"ConvertEventRefToEventRecord", (PyCFunction)EventRef_ConvertEventRefToEventRecord, 1,
+ PyDoc_STR("() -> (Boolean _rv, EventRecord outEvent)")},
+ {"IsEventInMask", (PyCFunction)EventRef_IsEventInMask, 1,
+ PyDoc_STR("(UInt16 inMask) -> (Boolean _rv)")},
+ {"SendEventToEventTarget", (PyCFunction)EventRef_SendEventToEventTarget, 1,
+ PyDoc_STR("(EventTargetRef inTarget) -> None")},
+ {"GetEventParameter", (PyCFunction)EventRef_GetEventParameter, 1,
+ PyDoc_STR("(EventParamName eventName, EventParamType eventType) -> (String eventParamData)")},
+ {NULL, NULL, 0}
+};
+
+#define EventRef_getsetlist NULL
+
+
+#define EventRef_compare NULL
+
+#define EventRef_repr NULL
+
+#define EventRef_hash NULL
+#define EventRef_tp_init 0
+
+#define EventRef_tp_alloc PyType_GenericAlloc
+
+static PyObject *EventRef_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *_self;
+ EventRef itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, EventRef_Convert, &itself)) return NULL;
+ if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((EventRefObject *)_self)->ob_itself = itself;
+ return _self;
+}
+
+#define EventRef_tp_free PyObject_Del
+
+
+PyTypeObject EventRef_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_CarbonEvt.EventRef", /*tp_name*/
+ sizeof(EventRefObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) EventRef_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) EventRef_compare, /*tp_compare*/
+ (reprfunc) EventRef_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) EventRef_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ EventRef_methods, /* tp_methods */
+ 0, /*tp_members*/
+ EventRef_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ EventRef_tp_init, /* tp_init */
+ EventRef_tp_alloc, /* tp_alloc */
+ EventRef_tp_new, /* tp_new */
+ EventRef_tp_free, /* tp_free */
+};
+
+/* -------------------- End object type EventRef -------------------- */
+
+
+/* ------------------- Object type EventQueueRef -------------------- */
+
+PyTypeObject EventQueueRef_Type;
+
+#define EventQueueRef_Check(x) ((x)->ob_type == &EventQueueRef_Type || PyObject_TypeCheck((x), &EventQueueRef_Type))
+
+typedef struct EventQueueRefObject {
+ PyObject_HEAD
+ EventQueueRef ob_itself;
+} EventQueueRefObject;
+
+PyObject *EventQueueRef_New(EventQueueRef itself)
+{
+ EventQueueRefObject *it;
+ it = PyObject_NEW(EventQueueRefObject, &EventQueueRef_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+
+int EventQueueRef_Convert(PyObject *v, EventQueueRef *p_itself)
+{
+ if (!EventQueueRef_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "EventQueueRef required");
+ return 0;
+ }
+ *p_itself = ((EventQueueRefObject *)v)->ob_itself;
+ return 1;
+}
+
+static void EventQueueRef_dealloc(EventQueueRefObject *self)
+{
+ /* Cleanup of self->ob_itself goes here */
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *EventQueueRef_PostEventToQueue(EventQueueRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ EventRef inEvent;
+ SInt16 inPriority;
+ if (!PyArg_ParseTuple(_args, "O&h",
+ EventRef_Convert, &inEvent,
+ &inPriority))
+ return NULL;
+ _err = PostEventToQueue(_self->ob_itself,
+ inEvent,
+ inPriority);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *EventQueueRef_FlushEventsMatchingListFromQueue(EventQueueRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 inNumTypes;
+ EventTypeSpec inList;
+ if (!PyArg_ParseTuple(_args, "lO&",
+ &inNumTypes,
+ EventTypeSpec_Convert, &inList))
+ return NULL;
+ _err = FlushEventsMatchingListFromQueue(_self->ob_itself,
+ inNumTypes,
+ &inList);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *EventQueueRef_FlushEventQueue(EventQueueRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = FlushEventQueue(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *EventQueueRef_GetNumEventsInQueue(EventQueueRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UInt32 _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetNumEventsInQueue(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *EventQueueRef_RemoveEventFromQueue(EventQueueRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ EventRef inEvent;
+ if (!PyArg_ParseTuple(_args, "O&",
+ EventRef_Convert, &inEvent))
+ return NULL;
+ _err = RemoveEventFromQueue(_self->ob_itself,
+ inEvent);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *EventQueueRef_IsEventInQueue(EventQueueRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ EventRef inEvent;
+ if (!PyArg_ParseTuple(_args, "O&",
+ EventRef_Convert, &inEvent))
+ return NULL;
+ _rv = IsEventInQueue(_self->ob_itself,
+ inEvent);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyMethodDef EventQueueRef_methods[] = {
+ {"PostEventToQueue", (PyCFunction)EventQueueRef_PostEventToQueue, 1,
+ PyDoc_STR("(EventRef inEvent, SInt16 inPriority) -> None")},
+ {"FlushEventsMatchingListFromQueue", (PyCFunction)EventQueueRef_FlushEventsMatchingListFromQueue, 1,
+ PyDoc_STR("(UInt32 inNumTypes, EventTypeSpec inList) -> None")},
+ {"FlushEventQueue", (PyCFunction)EventQueueRef_FlushEventQueue, 1,
+ PyDoc_STR("() -> None")},
+ {"GetNumEventsInQueue", (PyCFunction)EventQueueRef_GetNumEventsInQueue, 1,
+ PyDoc_STR("() -> (UInt32 _rv)")},
+ {"RemoveEventFromQueue", (PyCFunction)EventQueueRef_RemoveEventFromQueue, 1,
+ PyDoc_STR("(EventRef inEvent) -> None")},
+ {"IsEventInQueue", (PyCFunction)EventQueueRef_IsEventInQueue, 1,
+ PyDoc_STR("(EventRef inEvent) -> (Boolean _rv)")},
+ {NULL, NULL, 0}
+};
+
+#define EventQueueRef_getsetlist NULL
+
+
+#define EventQueueRef_compare NULL
+
+#define EventQueueRef_repr NULL
+
+#define EventQueueRef_hash NULL
+#define EventQueueRef_tp_init 0
+
+#define EventQueueRef_tp_alloc PyType_GenericAlloc
+
+static PyObject *EventQueueRef_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *_self;
+ EventQueueRef itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, EventQueueRef_Convert, &itself)) return NULL;
+ if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((EventQueueRefObject *)_self)->ob_itself = itself;
+ return _self;
+}
+
+#define EventQueueRef_tp_free PyObject_Del
+
+
+PyTypeObject EventQueueRef_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_CarbonEvt.EventQueueRef", /*tp_name*/
+ sizeof(EventQueueRefObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) EventQueueRef_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) EventQueueRef_compare, /*tp_compare*/
+ (reprfunc) EventQueueRef_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) EventQueueRef_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ EventQueueRef_methods, /* tp_methods */
+ 0, /*tp_members*/
+ EventQueueRef_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ EventQueueRef_tp_init, /* tp_init */
+ EventQueueRef_tp_alloc, /* tp_alloc */
+ EventQueueRef_tp_new, /* tp_new */
+ EventQueueRef_tp_free, /* tp_free */
+};
+
+/* ----------------- End object type EventQueueRef ------------------ */
+
+
+/* -------------------- Object type EventLoopRef -------------------- */
+
+PyTypeObject EventLoopRef_Type;
+
+#define EventLoopRef_Check(x) ((x)->ob_type == &EventLoopRef_Type || PyObject_TypeCheck((x), &EventLoopRef_Type))
+
+typedef struct EventLoopRefObject {
+ PyObject_HEAD
+ EventLoopRef ob_itself;
+} EventLoopRefObject;
+
+PyObject *EventLoopRef_New(EventLoopRef itself)
+{
+ EventLoopRefObject *it;
+ it = PyObject_NEW(EventLoopRefObject, &EventLoopRef_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+
+int EventLoopRef_Convert(PyObject *v, EventLoopRef *p_itself)
+{
+ if (!EventLoopRef_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "EventLoopRef required");
+ return 0;
+ }
+ *p_itself = ((EventLoopRefObject *)v)->ob_itself;
+ return 1;
+}
+
+static void EventLoopRef_dealloc(EventLoopRefObject *self)
+{
+ /* Cleanup of self->ob_itself goes here */
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *EventLoopRef_QuitEventLoop(EventLoopRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = QuitEventLoop(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyMethodDef EventLoopRef_methods[] = {
+ {"QuitEventLoop", (PyCFunction)EventLoopRef_QuitEventLoop, 1,
+ PyDoc_STR("() -> None")},
+ {NULL, NULL, 0}
+};
+
+#define EventLoopRef_getsetlist NULL
+
+
+#define EventLoopRef_compare NULL
+
+#define EventLoopRef_repr NULL
+
+#define EventLoopRef_hash NULL
+#define EventLoopRef_tp_init 0
+
+#define EventLoopRef_tp_alloc PyType_GenericAlloc
+
+static PyObject *EventLoopRef_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *_self;
+ EventLoopRef itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, EventLoopRef_Convert, &itself)) return NULL;
+ if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((EventLoopRefObject *)_self)->ob_itself = itself;
+ return _self;
+}
+
+#define EventLoopRef_tp_free PyObject_Del
+
+
+PyTypeObject EventLoopRef_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_CarbonEvt.EventLoopRef", /*tp_name*/
+ sizeof(EventLoopRefObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) EventLoopRef_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) EventLoopRef_compare, /*tp_compare*/
+ (reprfunc) EventLoopRef_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) EventLoopRef_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ EventLoopRef_methods, /* tp_methods */
+ 0, /*tp_members*/
+ EventLoopRef_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ EventLoopRef_tp_init, /* tp_init */
+ EventLoopRef_tp_alloc, /* tp_alloc */
+ EventLoopRef_tp_new, /* tp_new */
+ EventLoopRef_tp_free, /* tp_free */
+};
+
+/* ------------------ End object type EventLoopRef ------------------ */
+
+
+/* ----------------- Object type EventLoopTimerRef ------------------ */
+
+PyTypeObject EventLoopTimerRef_Type;
+
+#define EventLoopTimerRef_Check(x) ((x)->ob_type == &EventLoopTimerRef_Type || PyObject_TypeCheck((x), &EventLoopTimerRef_Type))
+
+typedef struct EventLoopTimerRefObject {
+ PyObject_HEAD
+ EventLoopTimerRef ob_itself;
+} EventLoopTimerRefObject;
+
+PyObject *EventLoopTimerRef_New(EventLoopTimerRef itself)
+{
+ EventLoopTimerRefObject *it;
+ it = PyObject_NEW(EventLoopTimerRefObject, &EventLoopTimerRef_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+
+int EventLoopTimerRef_Convert(PyObject *v, EventLoopTimerRef *p_itself)
+{
+ if (!EventLoopTimerRef_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "EventLoopTimerRef required");
+ return 0;
+ }
+ *p_itself = ((EventLoopTimerRefObject *)v)->ob_itself;
+ return 1;
+}
+
+static void EventLoopTimerRef_dealloc(EventLoopTimerRefObject *self)
+{
+ /* Cleanup of self->ob_itself goes here */
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *EventLoopTimerRef_RemoveEventLoopTimer(EventLoopTimerRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = RemoveEventLoopTimer(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *EventLoopTimerRef_SetEventLoopTimerNextFireTime(EventLoopTimerRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ double inNextFire;
+ if (!PyArg_ParseTuple(_args, "d",
+ &inNextFire))
+ return NULL;
+ _err = SetEventLoopTimerNextFireTime(_self->ob_itself,
+ inNextFire);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyMethodDef EventLoopTimerRef_methods[] = {
+ {"RemoveEventLoopTimer", (PyCFunction)EventLoopTimerRef_RemoveEventLoopTimer, 1,
+ PyDoc_STR("() -> None")},
+ {"SetEventLoopTimerNextFireTime", (PyCFunction)EventLoopTimerRef_SetEventLoopTimerNextFireTime, 1,
+ PyDoc_STR("(double inNextFire) -> None")},
+ {NULL, NULL, 0}
+};
+
+#define EventLoopTimerRef_getsetlist NULL
+
+
+#define EventLoopTimerRef_compare NULL
+
+#define EventLoopTimerRef_repr NULL
+
+#define EventLoopTimerRef_hash NULL
+#define EventLoopTimerRef_tp_init 0
+
+#define EventLoopTimerRef_tp_alloc PyType_GenericAlloc
+
+static PyObject *EventLoopTimerRef_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *_self;
+ EventLoopTimerRef itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, EventLoopTimerRef_Convert, &itself)) return NULL;
+ if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((EventLoopTimerRefObject *)_self)->ob_itself = itself;
+ return _self;
+}
+
+#define EventLoopTimerRef_tp_free PyObject_Del
+
+
+PyTypeObject EventLoopTimerRef_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_CarbonEvt.EventLoopTimerRef", /*tp_name*/
+ sizeof(EventLoopTimerRefObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) EventLoopTimerRef_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) EventLoopTimerRef_compare, /*tp_compare*/
+ (reprfunc) EventLoopTimerRef_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) EventLoopTimerRef_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ EventLoopTimerRef_methods, /* tp_methods */
+ 0, /*tp_members*/
+ EventLoopTimerRef_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ EventLoopTimerRef_tp_init, /* tp_init */
+ EventLoopTimerRef_tp_alloc, /* tp_alloc */
+ EventLoopTimerRef_tp_new, /* tp_new */
+ EventLoopTimerRef_tp_free, /* tp_free */
+};
+
+/* --------------- End object type EventLoopTimerRef ---------------- */
+
+
+/* ------------------ Object type EventHandlerRef ------------------- */
+
+PyTypeObject EventHandlerRef_Type;
+
+#define EventHandlerRef_Check(x) ((x)->ob_type == &EventHandlerRef_Type || PyObject_TypeCheck((x), &EventHandlerRef_Type))
+
+typedef struct EventHandlerRefObject {
+ PyObject_HEAD
+ EventHandlerRef ob_itself;
+ PyObject *ob_callback;
+} EventHandlerRefObject;
+
+PyObject *EventHandlerRef_New(EventHandlerRef itself)
+{
+ EventHandlerRefObject *it;
+ it = PyObject_NEW(EventHandlerRefObject, &EventHandlerRef_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ it->ob_callback = NULL;
+ return (PyObject *)it;
+}
+
+int EventHandlerRef_Convert(PyObject *v, EventHandlerRef *p_itself)
+{
+ if (!EventHandlerRef_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "EventHandlerRef required");
+ return 0;
+ }
+ *p_itself = ((EventHandlerRefObject *)v)->ob_itself;
+ return 1;
+}
+
+static void EventHandlerRef_dealloc(EventHandlerRefObject *self)
+{
+ if (self->ob_itself != NULL) {
+ RemoveEventHandler(self->ob_itself);
+ Py_DECREF(self->ob_callback);
+ }
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *EventHandlerRef_AddEventTypesToHandler(EventHandlerRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 inNumTypes;
+ EventTypeSpec inList;
+ if (_self->ob_itself == NULL) {
+ PyErr_SetString(CarbonEvents_Error, "Handler has been removed");
+ return NULL;
+ }
+ if (!PyArg_ParseTuple(_args, "lO&",
+ &inNumTypes,
+ EventTypeSpec_Convert, &inList))
+ return NULL;
+ _err = AddEventTypesToHandler(_self->ob_itself,
+ inNumTypes,
+ &inList);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *EventHandlerRef_RemoveEventTypesFromHandler(EventHandlerRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 inNumTypes;
+ EventTypeSpec inList;
+ if (_self->ob_itself == NULL) {
+ PyErr_SetString(CarbonEvents_Error, "Handler has been removed");
+ return NULL;
+ }
+ if (!PyArg_ParseTuple(_args, "lO&",
+ &inNumTypes,
+ EventTypeSpec_Convert, &inList))
+ return NULL;
+ _err = RemoveEventTypesFromHandler(_self->ob_itself,
+ inNumTypes,
+ &inList);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *EventHandlerRef_RemoveEventHandler(EventHandlerRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ OSStatus _err;
+ if (_self->ob_itself == NULL) {
+ PyErr_SetString(CarbonEvents_Error, "Handler has been removed");
+ return NULL;
+ }
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = RemoveEventHandler(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ _self->ob_itself = NULL;
+ Py_DECREF(_self->ob_callback);
+ _self->ob_callback = NULL;
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyMethodDef EventHandlerRef_methods[] = {
+ {"AddEventTypesToHandler", (PyCFunction)EventHandlerRef_AddEventTypesToHandler, 1,
+ PyDoc_STR("(UInt32 inNumTypes, EventTypeSpec inList) -> None")},
+ {"RemoveEventTypesFromHandler", (PyCFunction)EventHandlerRef_RemoveEventTypesFromHandler, 1,
+ PyDoc_STR("(UInt32 inNumTypes, EventTypeSpec inList) -> None")},
+ {"RemoveEventHandler", (PyCFunction)EventHandlerRef_RemoveEventHandler, 1,
+ PyDoc_STR("() -> None")},
+ {NULL, NULL, 0}
+};
+
+#define EventHandlerRef_getsetlist NULL
+
+
+#define EventHandlerRef_compare NULL
+
+#define EventHandlerRef_repr NULL
+
+#define EventHandlerRef_hash NULL
+#define EventHandlerRef_tp_init 0
+
+#define EventHandlerRef_tp_alloc PyType_GenericAlloc
+
+static PyObject *EventHandlerRef_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *_self;
+ EventHandlerRef itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, EventHandlerRef_Convert, &itself)) return NULL;
+ if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((EventHandlerRefObject *)_self)->ob_itself = itself;
+ return _self;
+}
+
+#define EventHandlerRef_tp_free PyObject_Del
+
+
+PyTypeObject EventHandlerRef_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_CarbonEvt.EventHandlerRef", /*tp_name*/
+ sizeof(EventHandlerRefObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) EventHandlerRef_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) EventHandlerRef_compare, /*tp_compare*/
+ (reprfunc) EventHandlerRef_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) EventHandlerRef_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ EventHandlerRef_methods, /* tp_methods */
+ 0, /*tp_members*/
+ EventHandlerRef_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ EventHandlerRef_tp_init, /* tp_init */
+ EventHandlerRef_tp_alloc, /* tp_alloc */
+ EventHandlerRef_tp_new, /* tp_new */
+ EventHandlerRef_tp_free, /* tp_free */
+};
+
+/* ---------------- End object type EventHandlerRef ----------------- */
+
+
+/* ---------------- Object type EventHandlerCallRef ----------------- */
+
+PyTypeObject EventHandlerCallRef_Type;
+
+#define EventHandlerCallRef_Check(x) ((x)->ob_type == &EventHandlerCallRef_Type || PyObject_TypeCheck((x), &EventHandlerCallRef_Type))
+
+typedef struct EventHandlerCallRefObject {
+ PyObject_HEAD
+ EventHandlerCallRef ob_itself;
+} EventHandlerCallRefObject;
+
+PyObject *EventHandlerCallRef_New(EventHandlerCallRef itself)
+{
+ EventHandlerCallRefObject *it;
+ it = PyObject_NEW(EventHandlerCallRefObject, &EventHandlerCallRef_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+
+int EventHandlerCallRef_Convert(PyObject *v, EventHandlerCallRef *p_itself)
+{
+ if (!EventHandlerCallRef_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "EventHandlerCallRef required");
+ return 0;
+ }
+ *p_itself = ((EventHandlerCallRefObject *)v)->ob_itself;
+ return 1;
+}
+
+static void EventHandlerCallRef_dealloc(EventHandlerCallRefObject *self)
+{
+ /* Cleanup of self->ob_itself goes here */
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *EventHandlerCallRef_CallNextEventHandler(EventHandlerCallRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ EventRef inEvent;
+ if (!PyArg_ParseTuple(_args, "O&",
+ EventRef_Convert, &inEvent))
+ return NULL;
+ _err = CallNextEventHandler(_self->ob_itself,
+ inEvent);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyMethodDef EventHandlerCallRef_methods[] = {
+ {"CallNextEventHandler", (PyCFunction)EventHandlerCallRef_CallNextEventHandler, 1,
+ PyDoc_STR("(EventRef inEvent) -> None")},
+ {NULL, NULL, 0}
+};
+
+#define EventHandlerCallRef_getsetlist NULL
+
+
+#define EventHandlerCallRef_compare NULL
+
+#define EventHandlerCallRef_repr NULL
+
+#define EventHandlerCallRef_hash NULL
+#define EventHandlerCallRef_tp_init 0
+
+#define EventHandlerCallRef_tp_alloc PyType_GenericAlloc
+
+static PyObject *EventHandlerCallRef_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *_self;
+ EventHandlerCallRef itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, EventHandlerCallRef_Convert, &itself)) return NULL;
+ if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((EventHandlerCallRefObject *)_self)->ob_itself = itself;
+ return _self;
+}
+
+#define EventHandlerCallRef_tp_free PyObject_Del
+
+
+PyTypeObject EventHandlerCallRef_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_CarbonEvt.EventHandlerCallRef", /*tp_name*/
+ sizeof(EventHandlerCallRefObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) EventHandlerCallRef_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) EventHandlerCallRef_compare, /*tp_compare*/
+ (reprfunc) EventHandlerCallRef_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) EventHandlerCallRef_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ EventHandlerCallRef_methods, /* tp_methods */
+ 0, /*tp_members*/
+ EventHandlerCallRef_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ EventHandlerCallRef_tp_init, /* tp_init */
+ EventHandlerCallRef_tp_alloc, /* tp_alloc */
+ EventHandlerCallRef_tp_new, /* tp_new */
+ EventHandlerCallRef_tp_free, /* tp_free */
+};
+
+/* -------------- End object type EventHandlerCallRef --------------- */
+
+
+/* ------------------- Object type EventTargetRef ------------------- */
+
+PyTypeObject EventTargetRef_Type;
+
+#define EventTargetRef_Check(x) ((x)->ob_type == &EventTargetRef_Type || PyObject_TypeCheck((x), &EventTargetRef_Type))
+
+typedef struct EventTargetRefObject {
+ PyObject_HEAD
+ EventTargetRef ob_itself;
+} EventTargetRefObject;
+
+PyObject *EventTargetRef_New(EventTargetRef itself)
+{
+ EventTargetRefObject *it;
+ it = PyObject_NEW(EventTargetRefObject, &EventTargetRef_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+
+int EventTargetRef_Convert(PyObject *v, EventTargetRef *p_itself)
+{
+ if (!EventTargetRef_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "EventTargetRef required");
+ return 0;
+ }
+ *p_itself = ((EventTargetRefObject *)v)->ob_itself;
+ return 1;
+}
+
+static void EventTargetRef_dealloc(EventTargetRefObject *self)
+{
+ /* Cleanup of self->ob_itself goes here */
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *EventTargetRef_InstallStandardEventHandler(EventTargetRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = InstallStandardEventHandler(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *EventTargetRef_InstallEventHandler(EventTargetRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ EventTypeSpec inSpec;
+ PyObject *callback;
+ EventHandlerRef outRef;
+ OSStatus _err;
+
+ if (!PyArg_ParseTuple(_args, "O&O", EventTypeSpec_Convert, &inSpec, &callback))
+ return NULL;
+
+ _err = InstallEventHandler(_self->ob_itself, myEventHandlerUPP, 1, &inSpec, (void *)callback, &outRef);
+ if (_err != noErr) return PyMac_Error(_err);
+
+ _res = EventHandlerRef_New(outRef);
+ if (_res != NULL) {
+ ((EventHandlerRefObject*)_res)->ob_callback = callback;
+ Py_INCREF(callback);
+ }
+ return _res;
+}
+
+static PyMethodDef EventTargetRef_methods[] = {
+ {"InstallStandardEventHandler", (PyCFunction)EventTargetRef_InstallStandardEventHandler, 1,
+ PyDoc_STR("() -> None")},
+ {"InstallEventHandler", (PyCFunction)EventTargetRef_InstallEventHandler, 1,
+ PyDoc_STR("(EventTypeSpec inSpec, Method callback) -> (EventHandlerRef outRef)")},
+ {NULL, NULL, 0}
+};
+
+#define EventTargetRef_getsetlist NULL
+
+
+#define EventTargetRef_compare NULL
+
+#define EventTargetRef_repr NULL
+
+#define EventTargetRef_hash NULL
+#define EventTargetRef_tp_init 0
+
+#define EventTargetRef_tp_alloc PyType_GenericAlloc
+
+static PyObject *EventTargetRef_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *_self;
+ EventTargetRef itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, EventTargetRef_Convert, &itself)) return NULL;
+ if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((EventTargetRefObject *)_self)->ob_itself = itself;
+ return _self;
+}
+
+#define EventTargetRef_tp_free PyObject_Del
+
+
+PyTypeObject EventTargetRef_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_CarbonEvt.EventTargetRef", /*tp_name*/
+ sizeof(EventTargetRefObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) EventTargetRef_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) EventTargetRef_compare, /*tp_compare*/
+ (reprfunc) EventTargetRef_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) EventTargetRef_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ EventTargetRef_methods, /* tp_methods */
+ 0, /*tp_members*/
+ EventTargetRef_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ EventTargetRef_tp_init, /* tp_init */
+ EventTargetRef_tp_alloc, /* tp_alloc */
+ EventTargetRef_tp_new, /* tp_new */
+ EventTargetRef_tp_free, /* tp_free */
+};
+
+/* ----------------- End object type EventTargetRef ----------------- */
+
+
+/* ------------------- Object type EventHotKeyRef ------------------- */
+
+PyTypeObject EventHotKeyRef_Type;
+
+#define EventHotKeyRef_Check(x) ((x)->ob_type == &EventHotKeyRef_Type || PyObject_TypeCheck((x), &EventHotKeyRef_Type))
+
+typedef struct EventHotKeyRefObject {
+ PyObject_HEAD
+ EventHotKeyRef ob_itself;
+} EventHotKeyRefObject;
+
+PyObject *EventHotKeyRef_New(EventHotKeyRef itself)
+{
+ EventHotKeyRefObject *it;
+ it = PyObject_NEW(EventHotKeyRefObject, &EventHotKeyRef_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+
+int EventHotKeyRef_Convert(PyObject *v, EventHotKeyRef *p_itself)
+{
+ if (!EventHotKeyRef_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "EventHotKeyRef required");
+ return 0;
+ }
+ *p_itself = ((EventHotKeyRefObject *)v)->ob_itself;
+ return 1;
+}
+
+static void EventHotKeyRef_dealloc(EventHotKeyRefObject *self)
+{
+ /* Cleanup of self->ob_itself goes here */
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *EventHotKeyRef_UnregisterEventHotKey(EventHotKeyRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = UnregisterEventHotKey(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyMethodDef EventHotKeyRef_methods[] = {
+ {"UnregisterEventHotKey", (PyCFunction)EventHotKeyRef_UnregisterEventHotKey, 1,
+ PyDoc_STR("() -> None")},
+ {NULL, NULL, 0}
+};
+
+#define EventHotKeyRef_getsetlist NULL
+
+
+#define EventHotKeyRef_compare NULL
+
+#define EventHotKeyRef_repr NULL
+
+#define EventHotKeyRef_hash NULL
+#define EventHotKeyRef_tp_init 0
+
+#define EventHotKeyRef_tp_alloc PyType_GenericAlloc
+
+static PyObject *EventHotKeyRef_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *_self;
+ EventHotKeyRef itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, EventHotKeyRef_Convert, &itself)) return NULL;
+ if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((EventHotKeyRefObject *)_self)->ob_itself = itself;
+ return _self;
+}
+
+#define EventHotKeyRef_tp_free PyObject_Del
+
+
+PyTypeObject EventHotKeyRef_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_CarbonEvt.EventHotKeyRef", /*tp_name*/
+ sizeof(EventHotKeyRefObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) EventHotKeyRef_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) EventHotKeyRef_compare, /*tp_compare*/
+ (reprfunc) EventHotKeyRef_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) EventHotKeyRef_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ EventHotKeyRef_methods, /* tp_methods */
+ 0, /*tp_members*/
+ EventHotKeyRef_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ EventHotKeyRef_tp_init, /* tp_init */
+ EventHotKeyRef_tp_alloc, /* tp_alloc */
+ EventHotKeyRef_tp_new, /* tp_new */
+ EventHotKeyRef_tp_free, /* tp_free */
+};
+
+/* ----------------- End object type EventHotKeyRef ----------------- */
+
+
+static PyObject *CarbonEvents_GetCurrentEventLoop(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ EventLoopRef _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetCurrentEventLoop();
+ _res = Py_BuildValue("O&",
+ EventLoopRef_New, _rv);
+ return _res;
+}
+
+static PyObject *CarbonEvents_GetMainEventLoop(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ EventLoopRef _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMainEventLoop();
+ _res = Py_BuildValue("O&",
+ EventLoopRef_New, _rv);
+ return _res;
+}
+
+static PyObject *CarbonEvents_RunCurrentEventLoop(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ double inTimeout;
+ if (!PyArg_ParseTuple(_args, "d",
+ &inTimeout))
+ return NULL;
+ _err = RunCurrentEventLoop(inTimeout);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CarbonEvents_ReceiveNextEvent(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 inNumTypes;
+ EventTypeSpec inList;
+ double inTimeout;
+ Boolean inPullEvent;
+ EventRef outEvent;
+ if (!PyArg_ParseTuple(_args, "lO&db",
+ &inNumTypes,
+ EventTypeSpec_Convert, &inList,
+ &inTimeout,
+ &inPullEvent))
+ return NULL;
+ _err = ReceiveNextEvent(inNumTypes,
+ &inList,
+ inTimeout,
+ inPullEvent,
+ &outEvent);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ EventRef_New, outEvent);
+ return _res;
+}
+
+static PyObject *CarbonEvents_GetCurrentEventQueue(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ EventQueueRef _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetCurrentEventQueue();
+ _res = Py_BuildValue("O&",
+ EventQueueRef_New, _rv);
+ return _res;
+}
+
+static PyObject *CarbonEvents_GetMainEventQueue(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ EventQueueRef _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMainEventQueue();
+ _res = Py_BuildValue("O&",
+ EventQueueRef_New, _rv);
+ return _res;
+}
+
+static PyObject *CarbonEvents_GetCurrentEventTime(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ double _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetCurrentEventTime();
+ _res = Py_BuildValue("d",
+ _rv);
+ return _res;
+}
+
+static PyObject *CarbonEvents_TrackMouseLocation(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ GrafPtr inPort;
+ Point outPt;
+ UInt16 outResult;
+ if (!PyArg_ParseTuple(_args, "O&",
+ GrafObj_Convert, &inPort))
+ return NULL;
+ _err = TrackMouseLocation(inPort,
+ &outPt,
+ &outResult);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&H",
+ PyMac_BuildPoint, outPt,
+ outResult);
+ return _res;
+}
+
+static PyObject *CarbonEvents_TrackMouseLocationWithOptions(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ GrafPtr inPort;
+ OptionBits inOptions;
+ double inTimeout;
+ Point outPt;
+ UInt32 outModifiers;
+ UInt16 outResult;
+ if (!PyArg_ParseTuple(_args, "O&ld",
+ GrafObj_Convert, &inPort,
+ &inOptions,
+ &inTimeout))
+ return NULL;
+ _err = TrackMouseLocationWithOptions(inPort,
+ inOptions,
+ inTimeout,
+ &outPt,
+ &outModifiers,
+ &outResult);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&lH",
+ PyMac_BuildPoint, outPt,
+ outModifiers,
+ outResult);
+ return _res;
+}
+
+static PyObject *CarbonEvents_TrackMouseRegion(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ GrafPtr inPort;
+ RgnHandle inRegion;
+ Boolean ioWasInRgn;
+ UInt16 outResult;
+ if (!PyArg_ParseTuple(_args, "O&O&b",
+ GrafObj_Convert, &inPort,
+ ResObj_Convert, &inRegion,
+ &ioWasInRgn))
+ return NULL;
+ _err = TrackMouseRegion(inPort,
+ inRegion,
+ &ioWasInRgn,
+ &outResult);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("bH",
+ ioWasInRgn,
+ outResult);
+ return _res;
+}
+
+static PyObject *CarbonEvents_GetLastUserEventTime(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ double _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetLastUserEventTime();
+ _res = Py_BuildValue("d",
+ _rv);
+ return _res;
+}
+
+static PyObject *CarbonEvents_IsMouseCoalescingEnabled(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsMouseCoalescingEnabled();
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *CarbonEvents_SetMouseCoalescingEnabled(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Boolean inNewState;
+ Boolean outOldState;
+ if (!PyArg_ParseTuple(_args, "b",
+ &inNewState))
+ return NULL;
+ _err = SetMouseCoalescingEnabled(inNewState,
+ &outOldState);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("b",
+ outOldState);
+ return _res;
+}
+
+static PyObject *CarbonEvents_GetWindowEventTarget(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ EventTargetRef _rv;
+ WindowPtr inWindow;
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &inWindow))
+ return NULL;
+ _rv = GetWindowEventTarget(inWindow);
+ _res = Py_BuildValue("O&",
+ EventTargetRef_New, _rv);
+ return _res;
+}
+
+static PyObject *CarbonEvents_GetControlEventTarget(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ EventTargetRef _rv;
+ ControlHandle inControl;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CtlObj_Convert, &inControl))
+ return NULL;
+ _rv = GetControlEventTarget(inControl);
+ _res = Py_BuildValue("O&",
+ EventTargetRef_New, _rv);
+ return _res;
+}
+
+static PyObject *CarbonEvents_GetMenuEventTarget(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ EventTargetRef _rv;
+ MenuHandle inMenu;
+ if (!PyArg_ParseTuple(_args, "O&",
+ MenuObj_Convert, &inMenu))
+ return NULL;
+ _rv = GetMenuEventTarget(inMenu);
+ _res = Py_BuildValue("O&",
+ EventTargetRef_New, _rv);
+ return _res;
+}
+
+static PyObject *CarbonEvents_GetApplicationEventTarget(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ EventTargetRef _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetApplicationEventTarget();
+ _res = Py_BuildValue("O&",
+ EventTargetRef_New, _rv);
+ return _res;
+}
+
+static PyObject *CarbonEvents_GetUserFocusEventTarget(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ EventTargetRef _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetUserFocusEventTarget();
+ _res = Py_BuildValue("O&",
+ EventTargetRef_New, _rv);
+ return _res;
+}
+
+static PyObject *CarbonEvents_GetEventDispatcherTarget(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ EventTargetRef _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetEventDispatcherTarget();
+ _res = Py_BuildValue("O&",
+ EventTargetRef_New, _rv);
+ return _res;
+}
+
+static PyObject *CarbonEvents_RunApplicationEventLoop(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ RunApplicationEventLoop();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CarbonEvents_QuitApplicationEventLoop(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ QuitApplicationEventLoop();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CarbonEvents_RunAppModalLoopForWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr inWindow;
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &inWindow))
+ return NULL;
+ _err = RunAppModalLoopForWindow(inWindow);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CarbonEvents_QuitAppModalLoopForWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr inWindow;
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &inWindow))
+ return NULL;
+ _err = QuitAppModalLoopForWindow(inWindow);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CarbonEvents_BeginAppModalStateForWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr inWindow;
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &inWindow))
+ return NULL;
+ _err = BeginAppModalStateForWindow(inWindow);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CarbonEvents_EndAppModalStateForWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr inWindow;
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &inWindow))
+ return NULL;
+ _err = EndAppModalStateForWindow(inWindow);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CarbonEvents_SetUserFocusWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr inWindow;
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &inWindow))
+ return NULL;
+ _err = SetUserFocusWindow(inWindow);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CarbonEvents_GetUserFocusWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetUserFocusWindow();
+ _res = Py_BuildValue("O&",
+ WinObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CarbonEvents_SetWindowDefaultButton(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr inWindow;
+ ControlHandle inControl;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ WinObj_Convert, &inWindow,
+ CtlObj_Convert, &inControl))
+ return NULL;
+ _err = SetWindowDefaultButton(inWindow,
+ inControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CarbonEvents_SetWindowCancelButton(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr inWindow;
+ ControlHandle inControl;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ WinObj_Convert, &inWindow,
+ CtlObj_Convert, &inControl))
+ return NULL;
+ _err = SetWindowCancelButton(inWindow,
+ inControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CarbonEvents_GetWindowDefaultButton(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr inWindow;
+ ControlHandle outControl;
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &inWindow))
+ return NULL;
+ _err = GetWindowDefaultButton(inWindow,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+
+static PyObject *CarbonEvents_GetWindowCancelButton(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr inWindow;
+ ControlHandle outControl;
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &inWindow))
+ return NULL;
+ _err = GetWindowCancelButton(inWindow,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+
+static PyObject *CarbonEvents_RegisterEventHotKey(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 inHotKeyCode;
+ UInt32 inHotKeyModifiers;
+ EventHotKeyID inHotKeyID;
+ EventTargetRef inTarget;
+ OptionBits inOptions;
+ EventHotKeyRef outRef;
+ if (!PyArg_ParseTuple(_args, "llO&O&l",
+ &inHotKeyCode,
+ &inHotKeyModifiers,
+ EventHotKeyID_Convert, &inHotKeyID,
+ EventTargetRef_Convert, &inTarget,
+ &inOptions))
+ return NULL;
+ _err = RegisterEventHotKey(inHotKeyCode,
+ inHotKeyModifiers,
+ inHotKeyID,
+ inTarget,
+ inOptions,
+ &outRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ EventHotKeyRef_New, outRef);
+ return _res;
+}
+
+static PyMethodDef CarbonEvents_methods[] = {
+ {"GetCurrentEventLoop", (PyCFunction)CarbonEvents_GetCurrentEventLoop, 1,
+ PyDoc_STR("() -> (EventLoopRef _rv)")},
+ {"GetMainEventLoop", (PyCFunction)CarbonEvents_GetMainEventLoop, 1,
+ PyDoc_STR("() -> (EventLoopRef _rv)")},
+ {"RunCurrentEventLoop", (PyCFunction)CarbonEvents_RunCurrentEventLoop, 1,
+ PyDoc_STR("(double inTimeout) -> None")},
+ {"ReceiveNextEvent", (PyCFunction)CarbonEvents_ReceiveNextEvent, 1,
+ PyDoc_STR("(UInt32 inNumTypes, EventTypeSpec inList, double inTimeout, Boolean inPullEvent) -> (EventRef outEvent)")},
+ {"GetCurrentEventQueue", (PyCFunction)CarbonEvents_GetCurrentEventQueue, 1,
+ PyDoc_STR("() -> (EventQueueRef _rv)")},
+ {"GetMainEventQueue", (PyCFunction)CarbonEvents_GetMainEventQueue, 1,
+ PyDoc_STR("() -> (EventQueueRef _rv)")},
+ {"GetCurrentEventTime", (PyCFunction)CarbonEvents_GetCurrentEventTime, 1,
+ PyDoc_STR("() -> (double _rv)")},
+ {"TrackMouseLocation", (PyCFunction)CarbonEvents_TrackMouseLocation, 1,
+ PyDoc_STR("(GrafPtr inPort) -> (Point outPt, UInt16 outResult)")},
+ {"TrackMouseLocationWithOptions", (PyCFunction)CarbonEvents_TrackMouseLocationWithOptions, 1,
+ PyDoc_STR("(GrafPtr inPort, OptionBits inOptions, double inTimeout) -> (Point outPt, UInt32 outModifiers, UInt16 outResult)")},
+ {"TrackMouseRegion", (PyCFunction)CarbonEvents_TrackMouseRegion, 1,
+ PyDoc_STR("(GrafPtr inPort, RgnHandle inRegion, Boolean ioWasInRgn) -> (Boolean ioWasInRgn, UInt16 outResult)")},
+ {"GetLastUserEventTime", (PyCFunction)CarbonEvents_GetLastUserEventTime, 1,
+ PyDoc_STR("() -> (double _rv)")},
+ {"IsMouseCoalescingEnabled", (PyCFunction)CarbonEvents_IsMouseCoalescingEnabled, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"SetMouseCoalescingEnabled", (PyCFunction)CarbonEvents_SetMouseCoalescingEnabled, 1,
+ PyDoc_STR("(Boolean inNewState) -> (Boolean outOldState)")},
+ {"GetWindowEventTarget", (PyCFunction)CarbonEvents_GetWindowEventTarget, 1,
+ PyDoc_STR("(WindowPtr inWindow) -> (EventTargetRef _rv)")},
+ {"GetControlEventTarget", (PyCFunction)CarbonEvents_GetControlEventTarget, 1,
+ PyDoc_STR("(ControlHandle inControl) -> (EventTargetRef _rv)")},
+ {"GetMenuEventTarget", (PyCFunction)CarbonEvents_GetMenuEventTarget, 1,
+ PyDoc_STR("(MenuHandle inMenu) -> (EventTargetRef _rv)")},
+ {"GetApplicationEventTarget", (PyCFunction)CarbonEvents_GetApplicationEventTarget, 1,
+ PyDoc_STR("() -> (EventTargetRef _rv)")},
+ {"GetUserFocusEventTarget", (PyCFunction)CarbonEvents_GetUserFocusEventTarget, 1,
+ PyDoc_STR("() -> (EventTargetRef _rv)")},
+ {"GetEventDispatcherTarget", (PyCFunction)CarbonEvents_GetEventDispatcherTarget, 1,
+ PyDoc_STR("() -> (EventTargetRef _rv)")},
+ {"RunApplicationEventLoop", (PyCFunction)CarbonEvents_RunApplicationEventLoop, 1,
+ PyDoc_STR("() -> None")},
+ {"QuitApplicationEventLoop", (PyCFunction)CarbonEvents_QuitApplicationEventLoop, 1,
+ PyDoc_STR("() -> None")},
+ {"RunAppModalLoopForWindow", (PyCFunction)CarbonEvents_RunAppModalLoopForWindow, 1,
+ PyDoc_STR("(WindowPtr inWindow) -> None")},
+ {"QuitAppModalLoopForWindow", (PyCFunction)CarbonEvents_QuitAppModalLoopForWindow, 1,
+ PyDoc_STR("(WindowPtr inWindow) -> None")},
+ {"BeginAppModalStateForWindow", (PyCFunction)CarbonEvents_BeginAppModalStateForWindow, 1,
+ PyDoc_STR("(WindowPtr inWindow) -> None")},
+ {"EndAppModalStateForWindow", (PyCFunction)CarbonEvents_EndAppModalStateForWindow, 1,
+ PyDoc_STR("(WindowPtr inWindow) -> None")},
+ {"SetUserFocusWindow", (PyCFunction)CarbonEvents_SetUserFocusWindow, 1,
+ PyDoc_STR("(WindowPtr inWindow) -> None")},
+ {"GetUserFocusWindow", (PyCFunction)CarbonEvents_GetUserFocusWindow, 1,
+ PyDoc_STR("() -> (WindowPtr _rv)")},
+ {"SetWindowDefaultButton", (PyCFunction)CarbonEvents_SetWindowDefaultButton, 1,
+ PyDoc_STR("(WindowPtr inWindow, ControlHandle inControl) -> None")},
+ {"SetWindowCancelButton", (PyCFunction)CarbonEvents_SetWindowCancelButton, 1,
+ PyDoc_STR("(WindowPtr inWindow, ControlHandle inControl) -> None")},
+ {"GetWindowDefaultButton", (PyCFunction)CarbonEvents_GetWindowDefaultButton, 1,
+ PyDoc_STR("(WindowPtr inWindow) -> (ControlHandle outControl)")},
+ {"GetWindowCancelButton", (PyCFunction)CarbonEvents_GetWindowCancelButton, 1,
+ PyDoc_STR("(WindowPtr inWindow) -> (ControlHandle outControl)")},
+ {"RegisterEventHotKey", (PyCFunction)CarbonEvents_RegisterEventHotKey, 1,
+ PyDoc_STR("(UInt32 inHotKeyCode, UInt32 inHotKeyModifiers, EventHotKeyID inHotKeyID, EventTargetRef inTarget, OptionBits inOptions) -> (EventHotKeyRef outRef)")},
+ {NULL, NULL, 0}
+};
+
+#else /* __LP64__ */
+
+static PyMethodDef CarbonEvents_methods[] = {
+ {NULL, NULL, 0}
+};
+
+#endif /* __LP64__ */
+
+
+
+void init_CarbonEvt(void)
+{
+ PyObject *m;
+#ifndef __LP64__
+ PyObject *d;
+#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 ||
+ PyDict_SetItemString(d, "Error", CarbonEvents_Error) != 0)
+ return;
+ EventRef_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&EventRef_Type) < 0) return;
+ Py_INCREF(&EventRef_Type);
+ PyModule_AddObject(m, "EventRef", (PyObject *)&EventRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&EventRef_Type);
+ PyModule_AddObject(m, "EventRefType", (PyObject *)&EventRef_Type);
+ EventQueueRef_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&EventQueueRef_Type) < 0) return;
+ Py_INCREF(&EventQueueRef_Type);
+ PyModule_AddObject(m, "EventQueueRef", (PyObject *)&EventQueueRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&EventQueueRef_Type);
+ PyModule_AddObject(m, "EventQueueRefType", (PyObject *)&EventQueueRef_Type);
+ EventLoopRef_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&EventLoopRef_Type) < 0) return;
+ Py_INCREF(&EventLoopRef_Type);
+ PyModule_AddObject(m, "EventLoopRef", (PyObject *)&EventLoopRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&EventLoopRef_Type);
+ PyModule_AddObject(m, "EventLoopRefType", (PyObject *)&EventLoopRef_Type);
+ EventLoopTimerRef_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&EventLoopTimerRef_Type) < 0) return;
+ Py_INCREF(&EventLoopTimerRef_Type);
+ PyModule_AddObject(m, "EventLoopTimerRef", (PyObject *)&EventLoopTimerRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&EventLoopTimerRef_Type);
+ PyModule_AddObject(m, "EventLoopTimerRefType", (PyObject *)&EventLoopTimerRef_Type);
+ EventHandlerRef_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&EventHandlerRef_Type) < 0) return;
+ Py_INCREF(&EventHandlerRef_Type);
+ PyModule_AddObject(m, "EventHandlerRef", (PyObject *)&EventHandlerRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&EventHandlerRef_Type);
+ PyModule_AddObject(m, "EventHandlerRefType", (PyObject *)&EventHandlerRef_Type);
+ EventHandlerCallRef_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&EventHandlerCallRef_Type) < 0) return;
+ Py_INCREF(&EventHandlerCallRef_Type);
+ PyModule_AddObject(m, "EventHandlerCallRef", (PyObject *)&EventHandlerCallRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&EventHandlerCallRef_Type);
+ PyModule_AddObject(m, "EventHandlerCallRefType", (PyObject *)&EventHandlerCallRef_Type);
+ EventTargetRef_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&EventTargetRef_Type) < 0) return;
+ Py_INCREF(&EventTargetRef_Type);
+ PyModule_AddObject(m, "EventTargetRef", (PyObject *)&EventTargetRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&EventTargetRef_Type);
+ PyModule_AddObject(m, "EventTargetRefType", (PyObject *)&EventTargetRef_Type);
+ EventHotKeyRef_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&EventHotKeyRef_Type) < 0) return;
+ Py_INCREF(&EventHotKeyRef_Type);
+ PyModule_AddObject(m, "EventHotKeyRef", (PyObject *)&EventHotKeyRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&EventHotKeyRef_Type);
+ PyModule_AddObject(m, "EventHotKeyRefType", (PyObject *)&EventHotKeyRef_Type);
+#endif /* !__LP64__ */
+}
+
+/* ===================== End module _CarbonEvt ====================== */
+
diff --git a/Mac/Modules/cf/_CFmodule.c b/Mac/Modules/cf/_CFmodule.c
new file mode 100644
index 0000000000..ee67c706ec
--- /dev/null
+++ b/Mac/Modules/cf/_CFmodule.c
@@ -0,0 +1,4996 @@
+
+/* =========================== Module _CF =========================== */
+
+#include "Python.h"
+
+
+
+#include "pymactoolbox.h"
+
+/* Macro to test whether a weak-loaded CFM function exists */
+#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
+ PyErr_SetString(PyExc_NotImplementedError, \
+ "Not available in this shared library/OS version"); \
+ return NULL; \
+ }} while(0)
+
+
+#include <CoreServices/CoreServices.h>
+
+#include "pycfbridge.h"
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_CFObj_New(CFTypeRef);
+extern int _CFObj_Convert(PyObject *, CFTypeRef *);
+#define CFObj_New _CFObj_New
+#define CFObj_Convert _CFObj_Convert
+
+extern PyObject *_CFTypeRefObj_New(CFTypeRef);
+extern int _CFTypeRefObj_Convert(PyObject *, CFTypeRef *);
+#define CFTypeRefObj_New _CFTypeRefObj_New
+#define CFTypeRefObj_Convert _CFTypeRefObj_Convert
+
+extern PyObject *_CFStringRefObj_New(CFStringRef);
+extern int _CFStringRefObj_Convert(PyObject *, CFStringRef *);
+#define CFStringRefObj_New _CFStringRefObj_New
+#define CFStringRefObj_Convert _CFStringRefObj_Convert
+
+extern PyObject *_CFMutableStringRefObj_New(CFMutableStringRef);
+extern int _CFMutableStringRefObj_Convert(PyObject *, CFMutableStringRef *);
+#define CFMutableStringRefObj_New _CFMutableStringRefObj_New
+#define CFMutableStringRefObj_Convert _CFMutableStringRefObj_Convert
+
+extern PyObject *_CFArrayRefObj_New(CFArrayRef);
+extern int _CFArrayRefObj_Convert(PyObject *, CFArrayRef *);
+#define CFArrayRefObj_New _CFArrayRefObj_New
+#define CFArrayRefObj_Convert _CFArrayRefObj_Convert
+
+extern PyObject *_CFMutableArrayRefObj_New(CFMutableArrayRef);
+extern int _CFMutableArrayRefObj_Convert(PyObject *, CFMutableArrayRef *);
+#define CFMutableArrayRefObj_New _CFMutableArrayRefObj_New
+#define CFMutableArrayRefObj_Convert _CFMutableArrayRefObj_Convert
+
+extern PyObject *_CFDataRefObj_New(CFDataRef);
+extern int _CFDataRefObj_Convert(PyObject *, CFDataRef *);
+#define CFDataRefObj_New _CFDataRefObj_New
+#define CFDataRefObj_Convert _CFDataRefObj_Convert
+
+extern PyObject *_CFMutableDataRefObj_New(CFMutableDataRef);
+extern int _CFMutableDataRefObj_Convert(PyObject *, CFMutableDataRef *);
+#define CFMutableDataRefObj_New _CFMutableDataRefObj_New
+#define CFMutableDataRefObj_Convert _CFMutableDataRefObj_Convert
+
+extern PyObject *_CFDictionaryRefObj_New(CFDictionaryRef);
+extern int _CFDictionaryRefObj_Convert(PyObject *, CFDictionaryRef *);
+#define CFDictionaryRefObj_New _CFDictionaryRefObj_New
+#define CFDictionaryRefObj_Convert _CFDictionaryRefObj_Convert
+
+extern PyObject *_CFMutableDictionaryRefObj_New(CFMutableDictionaryRef);
+extern int _CFMutableDictionaryRefObj_Convert(PyObject *, CFMutableDictionaryRef *);
+#define CFMutableDictionaryRefObj_New _CFMutableDictionaryRefObj_New
+#define CFMutableDictionaryRefObj_Convert _CFMutableDictionaryRefObj_Convert
+
+extern PyObject *_CFURLRefObj_New(CFURLRef);
+extern int _CFURLRefObj_Convert(PyObject *, CFURLRef *);
+extern int _OptionalCFURLRefObj_Convert(PyObject *, CFURLRef *);
+#define CFURLRefObj_New _CFURLRefObj_New
+#define CFURLRefObj_Convert _CFURLRefObj_Convert
+#define OptionalCFURLRefObj_Convert _OptionalCFURLRefObj_Convert
+#endif
+
+/*
+** Parse/generate CFRange records
+*/
+PyObject *CFRange_New(CFRange *itself)
+{
+
+ return Py_BuildValue("ll", (long)itself->location, (long)itself->length);
+}
+
+int
+CFRange_Convert(PyObject *v, CFRange *p_itself)
+{
+ long location, length;
+
+ if( !PyArg_ParseTuple(v, "ll", &location, &length) )
+ return 0;
+ p_itself->location = (CFIndex)location;
+ p_itself->length = (CFIndex)length;
+ return 1;
+}
+
+/* Optional CFURL argument or None (passed as NULL) */
+int
+OptionalCFURLRefObj_Convert(PyObject *v, CFURLRef *p_itself)
+{
+ if ( v == Py_None ) {
+ p_itself = NULL;
+ return 1;
+ }
+ return CFURLRefObj_Convert(v, p_itself);
+}
+
+static PyObject *CF_Error;
+
+/* --------------------- Object type CFTypeRef ---------------------- */
+
+PyTypeObject CFTypeRef_Type;
+
+#define CFTypeRefObj_Check(x) ((x)->ob_type == &CFTypeRef_Type || PyObject_TypeCheck((x), &CFTypeRef_Type))
+
+typedef struct CFTypeRefObject {
+ PyObject_HEAD
+ CFTypeRef ob_itself;
+ void (*ob_freeit)(CFTypeRef ptr);
+} CFTypeRefObject;
+
+PyObject *CFTypeRefObj_New(CFTypeRef itself)
+{
+ CFTypeRefObject *it;
+ if (itself == NULL)
+ {
+ PyErr_SetString(PyExc_RuntimeError, "cannot wrap NULL");
+ return NULL;
+ }
+ it = PyObject_NEW(CFTypeRefObject, &CFTypeRef_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ it->ob_freeit = CFRelease;
+ return (PyObject *)it;
+}
+
+int CFTypeRefObj_Convert(PyObject *v, CFTypeRef *p_itself)
+{
+
+ if (v == Py_None) { *p_itself = NULL; return 1; }
+ /* Check for other CF objects here */
+
+ if (!CFTypeRefObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "CFTypeRef required");
+ return 0;
+ }
+ *p_itself = ((CFTypeRefObject *)v)->ob_itself;
+ return 1;
+}
+
+static void CFTypeRefObj_dealloc(CFTypeRefObject *self)
+{
+ if (self->ob_freeit && self->ob_itself)
+ {
+ self->ob_freeit((CFTypeRef)self->ob_itself);
+ self->ob_itself = NULL;
+ }
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *CFTypeRefObj_CFGetTypeID(CFTypeRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFTypeID _rv;
+#ifndef CFGetTypeID
+ PyMac_PRECHECK(CFGetTypeID);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFGetTypeID(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFTypeRefObj_CFRetain(CFTypeRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFTypeRef _rv;
+#ifndef CFRetain
+ PyMac_PRECHECK(CFRetain);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFRetain(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CFTypeRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFTypeRefObj_CFRelease(CFTypeRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef CFRelease
+ PyMac_PRECHECK(CFRelease);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ CFRelease(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CFTypeRefObj_CFGetRetainCount(CFTypeRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFIndex _rv;
+#ifndef CFGetRetainCount
+ PyMac_PRECHECK(CFGetRetainCount);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFGetRetainCount(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFTypeRefObj_CFEqual(CFTypeRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ CFTypeRef cf2;
+#ifndef CFEqual
+ PyMac_PRECHECK(CFEqual);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFTypeRefObj_Convert, &cf2))
+ return NULL;
+ _rv = CFEqual(_self->ob_itself,
+ cf2);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFTypeRefObj_CFHash(CFTypeRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFHashCode _rv;
+#ifndef CFHash
+ PyMac_PRECHECK(CFHash);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFHash(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFTypeRefObj_CFCopyDescription(CFTypeRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+#ifndef CFCopyDescription
+ PyMac_PRECHECK(CFCopyDescription);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFCopyDescription(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFTypeRefObj_CFPropertyListCreateXMLData(CFTypeRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFDataRef _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFPropertyListCreateXMLData((CFAllocatorRef)NULL,
+ _self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CFDataRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFTypeRefObj_CFPropertyListCreateDeepCopy(CFTypeRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFTypeRef _rv;
+ CFOptionFlags mutabilityOption;
+ if (!PyArg_ParseTuple(_args, "l",
+ &mutabilityOption))
+ return NULL;
+ _rv = CFPropertyListCreateDeepCopy((CFAllocatorRef)NULL,
+ _self->ob_itself,
+ mutabilityOption);
+ _res = Py_BuildValue("O&",
+ CFTypeRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFTypeRefObj_CFShow(CFTypeRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef CFShow
+ PyMac_PRECHECK(CFShow);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ CFShow(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CFTypeRefObj_CFPropertyListCreateFromXMLData(CFTypeRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ CFTypeRef _rv;
+ CFOptionFlags mutabilityOption;
+ CFStringRef errorString;
+ if (!PyArg_ParseTuple(_args, "l",
+ &mutabilityOption))
+ return NULL;
+ _rv = CFPropertyListCreateFromXMLData((CFAllocatorRef)NULL,
+ _self->ob_itself,
+ mutabilityOption,
+ &errorString);
+ if (errorString)
+ CFRelease(errorString);
+ if (_rv == NULL) {
+ PyErr_SetString(PyExc_RuntimeError, "Parse error in XML data");
+ return NULL;
+ }
+ _res = Py_BuildValue("O&",
+ CFTypeRefObj_New, _rv);
+ return _res;
+
+}
+
+static PyObject *CFTypeRefObj_toPython(CFTypeRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ _res = PyCF_CF2Python(_self->ob_itself);
+ return _res;
+
+}
+
+static PyMethodDef CFTypeRefObj_methods[] = {
+ {"CFGetTypeID", (PyCFunction)CFTypeRefObj_CFGetTypeID, 1,
+ PyDoc_STR("() -> (CFTypeID _rv)")},
+ {"CFRetain", (PyCFunction)CFTypeRefObj_CFRetain, 1,
+ PyDoc_STR("() -> (CFTypeRef _rv)")},
+ {"CFRelease", (PyCFunction)CFTypeRefObj_CFRelease, 1,
+ PyDoc_STR("() -> None")},
+ {"CFGetRetainCount", (PyCFunction)CFTypeRefObj_CFGetRetainCount, 1,
+ PyDoc_STR("() -> (CFIndex _rv)")},
+ {"CFEqual", (PyCFunction)CFTypeRefObj_CFEqual, 1,
+ PyDoc_STR("(CFTypeRef cf2) -> (Boolean _rv)")},
+ {"CFHash", (PyCFunction)CFTypeRefObj_CFHash, 1,
+ PyDoc_STR("() -> (CFHashCode _rv)")},
+ {"CFCopyDescription", (PyCFunction)CFTypeRefObj_CFCopyDescription, 1,
+ PyDoc_STR("() -> (CFStringRef _rv)")},
+ {"CFPropertyListCreateXMLData", (PyCFunction)CFTypeRefObj_CFPropertyListCreateXMLData, 1,
+ PyDoc_STR("() -> (CFDataRef _rv)")},
+ {"CFPropertyListCreateDeepCopy", (PyCFunction)CFTypeRefObj_CFPropertyListCreateDeepCopy, 1,
+ PyDoc_STR("(CFOptionFlags mutabilityOption) -> (CFTypeRef _rv)")},
+ {"CFShow", (PyCFunction)CFTypeRefObj_CFShow, 1,
+ PyDoc_STR("() -> None")},
+ {"CFPropertyListCreateFromXMLData", (PyCFunction)CFTypeRefObj_CFPropertyListCreateFromXMLData, 1,
+ PyDoc_STR("(CFOptionFlags mutabilityOption) -> (CFTypeRefObj)")},
+ {"toPython", (PyCFunction)CFTypeRefObj_toPython, 1,
+ PyDoc_STR("() -> (python_object)")},
+ {NULL, NULL, 0}
+};
+
+#define CFTypeRefObj_getsetlist NULL
+
+
+static int CFTypeRefObj_compare(CFTypeRefObject *self, CFTypeRefObject *other)
+{
+ /* XXXX Or should we use CFEqual?? */
+ if ( self->ob_itself > other->ob_itself ) return 1;
+ if ( self->ob_itself < other->ob_itself ) return -1;
+ return 0;
+}
+
+static PyObject * CFTypeRefObj_repr(CFTypeRefObject *self)
+{
+ char buf[100];
+ sprintf(buf, "<CFTypeRef type-%d object at 0x%8.8x for 0x%8.8x>", (int)CFGetTypeID(self->ob_itself), (unsigned)self, (unsigned)self->ob_itself);
+ return PyString_FromString(buf);
+}
+
+static int CFTypeRefObj_hash(CFTypeRefObject *self)
+{
+ /* XXXX Or should we use CFHash?? */
+ return (int)self->ob_itself;
+}
+static int CFTypeRefObj_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds)
+{
+ CFTypeRef itself;
+ char *kw[] = {"itself", 0};
+
+ if (PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, CFTypeRefObj_Convert, &itself))
+ {
+ ((CFTypeRefObject *)_self)->ob_itself = itself;
+ return 0;
+ }
+ return -1;
+}
+
+#define CFTypeRefObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *CFTypeRefObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *self;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((CFTypeRefObject *)self)->ob_itself = NULL;
+ ((CFTypeRefObject *)self)->ob_freeit = CFRelease;
+ return self;
+}
+
+#define CFTypeRefObj_tp_free PyObject_Del
+
+
+PyTypeObject CFTypeRef_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_CF.CFTypeRef", /*tp_name*/
+ sizeof(CFTypeRefObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) CFTypeRefObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) CFTypeRefObj_compare, /*tp_compare*/
+ (reprfunc) CFTypeRefObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) CFTypeRefObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ CFTypeRefObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ CFTypeRefObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ CFTypeRefObj_tp_init, /* tp_init */
+ CFTypeRefObj_tp_alloc, /* tp_alloc */
+ CFTypeRefObj_tp_new, /* tp_new */
+ CFTypeRefObj_tp_free, /* tp_free */
+};
+
+/* ------------------- End object type CFTypeRef -------------------- */
+
+
+/* --------------------- Object type CFArrayRef --------------------- */
+
+PyTypeObject CFArrayRef_Type;
+
+#define CFArrayRefObj_Check(x) ((x)->ob_type == &CFArrayRef_Type || PyObject_TypeCheck((x), &CFArrayRef_Type))
+
+typedef struct CFArrayRefObject {
+ PyObject_HEAD
+ CFArrayRef ob_itself;
+ void (*ob_freeit)(CFTypeRef ptr);
+} CFArrayRefObject;
+
+PyObject *CFArrayRefObj_New(CFArrayRef itself)
+{
+ CFArrayRefObject *it;
+ if (itself == NULL)
+ {
+ PyErr_SetString(PyExc_RuntimeError, "cannot wrap NULL");
+ return NULL;
+ }
+ it = PyObject_NEW(CFArrayRefObject, &CFArrayRef_Type);
+ if (it == NULL) return NULL;
+ /* XXXX Should we tp_init or tp_new our basetype? */
+ it->ob_itself = itself;
+ it->ob_freeit = CFRelease;
+ return (PyObject *)it;
+}
+
+int CFArrayRefObj_Convert(PyObject *v, CFArrayRef *p_itself)
+{
+
+ if (v == Py_None) { *p_itself = NULL; return 1; }
+ /* Check for other CF objects here */
+
+ if (!CFArrayRefObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "CFArrayRef required");
+ return 0;
+ }
+ *p_itself = ((CFArrayRefObject *)v)->ob_itself;
+ return 1;
+}
+
+static void CFArrayRefObj_dealloc(CFArrayRefObject *self)
+{
+ if (self->ob_freeit && self->ob_itself)
+ {
+ self->ob_freeit((CFTypeRef)self->ob_itself);
+ self->ob_itself = NULL;
+ }
+ CFTypeRef_Type.tp_dealloc((PyObject *)self);
+}
+
+static PyObject *CFArrayRefObj_CFArrayCreateCopy(CFArrayRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFArrayRef _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFArrayCreateCopy((CFAllocatorRef)NULL,
+ _self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CFArrayRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFArrayRefObj_CFArrayGetCount(CFArrayRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFIndex _rv;
+#ifndef CFArrayGetCount
+ PyMac_PRECHECK(CFArrayGetCount);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFArrayGetCount(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFArrayRefObj_CFStringCreateByCombiningStrings(CFArrayRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ CFStringRef separatorString;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFStringRefObj_Convert, &separatorString))
+ return NULL;
+ _rv = CFStringCreateByCombiningStrings((CFAllocatorRef)NULL,
+ _self->ob_itself,
+ separatorString);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyMethodDef CFArrayRefObj_methods[] = {
+ {"CFArrayCreateCopy", (PyCFunction)CFArrayRefObj_CFArrayCreateCopy, 1,
+ PyDoc_STR("() -> (CFArrayRef _rv)")},
+ {"CFArrayGetCount", (PyCFunction)CFArrayRefObj_CFArrayGetCount, 1,
+ PyDoc_STR("() -> (CFIndex _rv)")},
+ {"CFStringCreateByCombiningStrings", (PyCFunction)CFArrayRefObj_CFStringCreateByCombiningStrings, 1,
+ PyDoc_STR("(CFStringRef separatorString) -> (CFStringRef _rv)")},
+ {NULL, NULL, 0}
+};
+
+#define CFArrayRefObj_getsetlist NULL
+
+
+static int CFArrayRefObj_compare(CFArrayRefObject *self, CFArrayRefObject *other)
+{
+ /* XXXX Or should we use CFEqual?? */
+ if ( self->ob_itself > other->ob_itself ) return 1;
+ if ( self->ob_itself < other->ob_itself ) return -1;
+ return 0;
+}
+
+static PyObject * CFArrayRefObj_repr(CFArrayRefObject *self)
+{
+ char buf[100];
+ sprintf(buf, "<CFArrayRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
+ return PyString_FromString(buf);
+}
+
+static int CFArrayRefObj_hash(CFArrayRefObject *self)
+{
+ /* XXXX Or should we use CFHash?? */
+ return (int)self->ob_itself;
+}
+static int CFArrayRefObj_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds)
+{
+ CFArrayRef itself;
+ char *kw[] = {"itself", 0};
+
+ if (PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, CFArrayRefObj_Convert, &itself))
+ {
+ ((CFArrayRefObject *)_self)->ob_itself = itself;
+ return 0;
+ }
+
+ /* Any CFTypeRef descendent is allowed as initializer too */
+ if (PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, CFTypeRefObj_Convert, &itself))
+ {
+ ((CFArrayRefObject *)_self)->ob_itself = itself;
+ return 0;
+ }
+ return -1;
+}
+
+#define CFArrayRefObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *CFArrayRefObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *self;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((CFArrayRefObject *)self)->ob_itself = NULL;
+ ((CFArrayRefObject *)self)->ob_freeit = CFRelease;
+ return self;
+}
+
+#define CFArrayRefObj_tp_free PyObject_Del
+
+
+PyTypeObject CFArrayRef_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_CF.CFArrayRef", /*tp_name*/
+ sizeof(CFArrayRefObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) CFArrayRefObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) CFArrayRefObj_compare, /*tp_compare*/
+ (reprfunc) CFArrayRefObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) CFArrayRefObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ CFArrayRefObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ CFArrayRefObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ CFArrayRefObj_tp_init, /* tp_init */
+ CFArrayRefObj_tp_alloc, /* tp_alloc */
+ CFArrayRefObj_tp_new, /* tp_new */
+ CFArrayRefObj_tp_free, /* tp_free */
+};
+
+/* ------------------- End object type CFArrayRef ------------------- */
+
+
+/* ----------------- Object type CFMutableArrayRef ------------------ */
+
+PyTypeObject CFMutableArrayRef_Type;
+
+#define CFMutableArrayRefObj_Check(x) ((x)->ob_type == &CFMutableArrayRef_Type || PyObject_TypeCheck((x), &CFMutableArrayRef_Type))
+
+typedef struct CFMutableArrayRefObject {
+ PyObject_HEAD
+ CFMutableArrayRef ob_itself;
+ void (*ob_freeit)(CFTypeRef ptr);
+} CFMutableArrayRefObject;
+
+PyObject *CFMutableArrayRefObj_New(CFMutableArrayRef itself)
+{
+ CFMutableArrayRefObject *it;
+ if (itself == NULL)
+ {
+ PyErr_SetString(PyExc_RuntimeError, "cannot wrap NULL");
+ return NULL;
+ }
+ it = PyObject_NEW(CFMutableArrayRefObject, &CFMutableArrayRef_Type);
+ if (it == NULL) return NULL;
+ /* XXXX Should we tp_init or tp_new our basetype? */
+ it->ob_itself = itself;
+ it->ob_freeit = CFRelease;
+ return (PyObject *)it;
+}
+
+int CFMutableArrayRefObj_Convert(PyObject *v, CFMutableArrayRef *p_itself)
+{
+
+ if (v == Py_None) { *p_itself = NULL; return 1; }
+ /* Check for other CF objects here */
+
+ if (!CFMutableArrayRefObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "CFMutableArrayRef required");
+ return 0;
+ }
+ *p_itself = ((CFMutableArrayRefObject *)v)->ob_itself;
+ return 1;
+}
+
+static void CFMutableArrayRefObj_dealloc(CFMutableArrayRefObject *self)
+{
+ if (self->ob_freeit && self->ob_itself)
+ {
+ self->ob_freeit((CFTypeRef)self->ob_itself);
+ self->ob_itself = NULL;
+ }
+ CFArrayRef_Type.tp_dealloc((PyObject *)self);
+}
+
+static PyObject *CFMutableArrayRefObj_CFArrayRemoveValueAtIndex(CFMutableArrayRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFIndex idx;
+#ifndef CFArrayRemoveValueAtIndex
+ PyMac_PRECHECK(CFArrayRemoveValueAtIndex);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &idx))
+ return NULL;
+ CFArrayRemoveValueAtIndex(_self->ob_itself,
+ idx);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CFMutableArrayRefObj_CFArrayRemoveAllValues(CFMutableArrayRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef CFArrayRemoveAllValues
+ PyMac_PRECHECK(CFArrayRemoveAllValues);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ CFArrayRemoveAllValues(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CFMutableArrayRefObj_CFArrayExchangeValuesAtIndices(CFMutableArrayRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFIndex idx1;
+ CFIndex idx2;
+#ifndef CFArrayExchangeValuesAtIndices
+ PyMac_PRECHECK(CFArrayExchangeValuesAtIndices);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &idx1,
+ &idx2))
+ return NULL;
+ CFArrayExchangeValuesAtIndices(_self->ob_itself,
+ idx1,
+ idx2);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CFMutableArrayRefObj_CFArrayAppendArray(CFMutableArrayRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFArrayRef otherArray;
+ CFRange otherRange;
+#ifndef CFArrayAppendArray
+ PyMac_PRECHECK(CFArrayAppendArray);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CFArrayRefObj_Convert, &otherArray,
+ CFRange_Convert, &otherRange))
+ return NULL;
+ CFArrayAppendArray(_self->ob_itself,
+ otherArray,
+ otherRange);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyMethodDef CFMutableArrayRefObj_methods[] = {
+ {"CFArrayRemoveValueAtIndex", (PyCFunction)CFMutableArrayRefObj_CFArrayRemoveValueAtIndex, 1,
+ PyDoc_STR("(CFIndex idx) -> None")},
+ {"CFArrayRemoveAllValues", (PyCFunction)CFMutableArrayRefObj_CFArrayRemoveAllValues, 1,
+ PyDoc_STR("() -> None")},
+ {"CFArrayExchangeValuesAtIndices", (PyCFunction)CFMutableArrayRefObj_CFArrayExchangeValuesAtIndices, 1,
+ PyDoc_STR("(CFIndex idx1, CFIndex idx2) -> None")},
+ {"CFArrayAppendArray", (PyCFunction)CFMutableArrayRefObj_CFArrayAppendArray, 1,
+ PyDoc_STR("(CFArrayRef otherArray, CFRange otherRange) -> None")},
+ {NULL, NULL, 0}
+};
+
+#define CFMutableArrayRefObj_getsetlist NULL
+
+
+static int CFMutableArrayRefObj_compare(CFMutableArrayRefObject *self, CFMutableArrayRefObject *other)
+{
+ /* XXXX Or should we use CFEqual?? */
+ if ( self->ob_itself > other->ob_itself ) return 1;
+ if ( self->ob_itself < other->ob_itself ) return -1;
+ return 0;
+}
+
+static PyObject * CFMutableArrayRefObj_repr(CFMutableArrayRefObject *self)
+{
+ char buf[100];
+ sprintf(buf, "<CFMutableArrayRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
+ return PyString_FromString(buf);
+}
+
+static int CFMutableArrayRefObj_hash(CFMutableArrayRefObject *self)
+{
+ /* XXXX Or should we use CFHash?? */
+ return (int)self->ob_itself;
+}
+static int CFMutableArrayRefObj_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds)
+{
+ CFMutableArrayRef itself;
+ char *kw[] = {"itself", 0};
+
+ if (PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, CFMutableArrayRefObj_Convert, &itself))
+ {
+ ((CFMutableArrayRefObject *)_self)->ob_itself = itself;
+ return 0;
+ }
+
+ /* Any CFTypeRef descendent is allowed as initializer too */
+ if (PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, CFTypeRefObj_Convert, &itself))
+ {
+ ((CFMutableArrayRefObject *)_self)->ob_itself = itself;
+ return 0;
+ }
+ return -1;
+}
+
+#define CFMutableArrayRefObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *CFMutableArrayRefObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *self;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((CFMutableArrayRefObject *)self)->ob_itself = NULL;
+ ((CFMutableArrayRefObject *)self)->ob_freeit = CFRelease;
+ return self;
+}
+
+#define CFMutableArrayRefObj_tp_free PyObject_Del
+
+
+PyTypeObject CFMutableArrayRef_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_CF.CFMutableArrayRef", /*tp_name*/
+ sizeof(CFMutableArrayRefObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) CFMutableArrayRefObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) CFMutableArrayRefObj_compare, /*tp_compare*/
+ (reprfunc) CFMutableArrayRefObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) CFMutableArrayRefObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ CFMutableArrayRefObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ CFMutableArrayRefObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ CFMutableArrayRefObj_tp_init, /* tp_init */
+ CFMutableArrayRefObj_tp_alloc, /* tp_alloc */
+ CFMutableArrayRefObj_tp_new, /* tp_new */
+ CFMutableArrayRefObj_tp_free, /* tp_free */
+};
+
+/* --------------- End object type CFMutableArrayRef ---------------- */
+
+
+/* ------------------ Object type CFDictionaryRef ------------------- */
+
+PyTypeObject CFDictionaryRef_Type;
+
+#define CFDictionaryRefObj_Check(x) ((x)->ob_type == &CFDictionaryRef_Type || PyObject_TypeCheck((x), &CFDictionaryRef_Type))
+
+typedef struct CFDictionaryRefObject {
+ PyObject_HEAD
+ CFDictionaryRef ob_itself;
+ void (*ob_freeit)(CFTypeRef ptr);
+} CFDictionaryRefObject;
+
+PyObject *CFDictionaryRefObj_New(CFDictionaryRef itself)
+{
+ CFDictionaryRefObject *it;
+ if (itself == NULL)
+ {
+ PyErr_SetString(PyExc_RuntimeError, "cannot wrap NULL");
+ return NULL;
+ }
+ it = PyObject_NEW(CFDictionaryRefObject, &CFDictionaryRef_Type);
+ if (it == NULL) return NULL;
+ /* XXXX Should we tp_init or tp_new our basetype? */
+ it->ob_itself = itself;
+ it->ob_freeit = CFRelease;
+ return (PyObject *)it;
+}
+
+int CFDictionaryRefObj_Convert(PyObject *v, CFDictionaryRef *p_itself)
+{
+
+ if (v == Py_None) { *p_itself = NULL; return 1; }
+ /* Check for other CF objects here */
+
+ if (!CFDictionaryRefObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "CFDictionaryRef required");
+ return 0;
+ }
+ *p_itself = ((CFDictionaryRefObject *)v)->ob_itself;
+ return 1;
+}
+
+static void CFDictionaryRefObj_dealloc(CFDictionaryRefObject *self)
+{
+ if (self->ob_freeit && self->ob_itself)
+ {
+ self->ob_freeit((CFTypeRef)self->ob_itself);
+ self->ob_itself = NULL;
+ }
+ CFTypeRef_Type.tp_dealloc((PyObject *)self);
+}
+
+static PyObject *CFDictionaryRefObj_CFDictionaryCreateCopy(CFDictionaryRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFDictionaryRef _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFDictionaryCreateCopy((CFAllocatorRef)NULL,
+ _self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CFDictionaryRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFDictionaryRefObj_CFDictionaryGetCount(CFDictionaryRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFIndex _rv;
+#ifndef CFDictionaryGetCount
+ PyMac_PRECHECK(CFDictionaryGetCount);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFDictionaryGetCount(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyMethodDef CFDictionaryRefObj_methods[] = {
+ {"CFDictionaryCreateCopy", (PyCFunction)CFDictionaryRefObj_CFDictionaryCreateCopy, 1,
+ PyDoc_STR("() -> (CFDictionaryRef _rv)")},
+ {"CFDictionaryGetCount", (PyCFunction)CFDictionaryRefObj_CFDictionaryGetCount, 1,
+ PyDoc_STR("() -> (CFIndex _rv)")},
+ {NULL, NULL, 0}
+};
+
+#define CFDictionaryRefObj_getsetlist NULL
+
+
+static int CFDictionaryRefObj_compare(CFDictionaryRefObject *self, CFDictionaryRefObject *other)
+{
+ /* XXXX Or should we use CFEqual?? */
+ if ( self->ob_itself > other->ob_itself ) return 1;
+ if ( self->ob_itself < other->ob_itself ) return -1;
+ return 0;
+}
+
+static PyObject * CFDictionaryRefObj_repr(CFDictionaryRefObject *self)
+{
+ char buf[100];
+ sprintf(buf, "<CFDictionaryRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
+ return PyString_FromString(buf);
+}
+
+static int CFDictionaryRefObj_hash(CFDictionaryRefObject *self)
+{
+ /* XXXX Or should we use CFHash?? */
+ return (int)self->ob_itself;
+}
+static int CFDictionaryRefObj_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds)
+{
+ CFDictionaryRef itself;
+ char *kw[] = {"itself", 0};
+
+ if (PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, CFDictionaryRefObj_Convert, &itself))
+ {
+ ((CFDictionaryRefObject *)_self)->ob_itself = itself;
+ return 0;
+ }
+
+ /* Any CFTypeRef descendent is allowed as initializer too */
+ if (PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, CFTypeRefObj_Convert, &itself))
+ {
+ ((CFDictionaryRefObject *)_self)->ob_itself = itself;
+ return 0;
+ }
+ return -1;
+}
+
+#define CFDictionaryRefObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *CFDictionaryRefObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *self;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((CFDictionaryRefObject *)self)->ob_itself = NULL;
+ ((CFDictionaryRefObject *)self)->ob_freeit = CFRelease;
+ return self;
+}
+
+#define CFDictionaryRefObj_tp_free PyObject_Del
+
+
+PyTypeObject CFDictionaryRef_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_CF.CFDictionaryRef", /*tp_name*/
+ sizeof(CFDictionaryRefObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) CFDictionaryRefObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) CFDictionaryRefObj_compare, /*tp_compare*/
+ (reprfunc) CFDictionaryRefObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) CFDictionaryRefObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ CFDictionaryRefObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ CFDictionaryRefObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ CFDictionaryRefObj_tp_init, /* tp_init */
+ CFDictionaryRefObj_tp_alloc, /* tp_alloc */
+ CFDictionaryRefObj_tp_new, /* tp_new */
+ CFDictionaryRefObj_tp_free, /* tp_free */
+};
+
+/* ---------------- End object type CFDictionaryRef ----------------- */
+
+
+/* --------------- Object type CFMutableDictionaryRef --------------- */
+
+PyTypeObject CFMutableDictionaryRef_Type;
+
+#define CFMutableDictionaryRefObj_Check(x) ((x)->ob_type == &CFMutableDictionaryRef_Type || PyObject_TypeCheck((x), &CFMutableDictionaryRef_Type))
+
+typedef struct CFMutableDictionaryRefObject {
+ PyObject_HEAD
+ CFMutableDictionaryRef ob_itself;
+ void (*ob_freeit)(CFTypeRef ptr);
+} CFMutableDictionaryRefObject;
+
+PyObject *CFMutableDictionaryRefObj_New(CFMutableDictionaryRef itself)
+{
+ CFMutableDictionaryRefObject *it;
+ if (itself == NULL)
+ {
+ PyErr_SetString(PyExc_RuntimeError, "cannot wrap NULL");
+ return NULL;
+ }
+ it = PyObject_NEW(CFMutableDictionaryRefObject, &CFMutableDictionaryRef_Type);
+ if (it == NULL) return NULL;
+ /* XXXX Should we tp_init or tp_new our basetype? */
+ it->ob_itself = itself;
+ it->ob_freeit = CFRelease;
+ return (PyObject *)it;
+}
+
+int CFMutableDictionaryRefObj_Convert(PyObject *v, CFMutableDictionaryRef *p_itself)
+{
+
+ if (v == Py_None) { *p_itself = NULL; return 1; }
+ /* Check for other CF objects here */
+
+ if (!CFMutableDictionaryRefObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "CFMutableDictionaryRef required");
+ return 0;
+ }
+ *p_itself = ((CFMutableDictionaryRefObject *)v)->ob_itself;
+ return 1;
+}
+
+static void CFMutableDictionaryRefObj_dealloc(CFMutableDictionaryRefObject *self)
+{
+ if (self->ob_freeit && self->ob_itself)
+ {
+ self->ob_freeit((CFTypeRef)self->ob_itself);
+ self->ob_itself = NULL;
+ }
+ CFDictionaryRef_Type.tp_dealloc((PyObject *)self);
+}
+
+static PyObject *CFMutableDictionaryRefObj_CFDictionaryRemoveAllValues(CFMutableDictionaryRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef CFDictionaryRemoveAllValues
+ PyMac_PRECHECK(CFDictionaryRemoveAllValues);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ CFDictionaryRemoveAllValues(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyMethodDef CFMutableDictionaryRefObj_methods[] = {
+ {"CFDictionaryRemoveAllValues", (PyCFunction)CFMutableDictionaryRefObj_CFDictionaryRemoveAllValues, 1,
+ PyDoc_STR("() -> None")},
+ {NULL, NULL, 0}
+};
+
+#define CFMutableDictionaryRefObj_getsetlist NULL
+
+
+static int CFMutableDictionaryRefObj_compare(CFMutableDictionaryRefObject *self, CFMutableDictionaryRefObject *other)
+{
+ /* XXXX Or should we use CFEqual?? */
+ if ( self->ob_itself > other->ob_itself ) return 1;
+ if ( self->ob_itself < other->ob_itself ) return -1;
+ return 0;
+}
+
+static PyObject * CFMutableDictionaryRefObj_repr(CFMutableDictionaryRefObject *self)
+{
+ char buf[100];
+ sprintf(buf, "<CFMutableDictionaryRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
+ return PyString_FromString(buf);
+}
+
+static int CFMutableDictionaryRefObj_hash(CFMutableDictionaryRefObject *self)
+{
+ /* XXXX Or should we use CFHash?? */
+ return (int)self->ob_itself;
+}
+static int CFMutableDictionaryRefObj_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds)
+{
+ CFMutableDictionaryRef itself;
+ char *kw[] = {"itself", 0};
+
+ if (PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, CFMutableDictionaryRefObj_Convert, &itself))
+ {
+ ((CFMutableDictionaryRefObject *)_self)->ob_itself = itself;
+ return 0;
+ }
+
+ /* Any CFTypeRef descendent is allowed as initializer too */
+ if (PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, CFTypeRefObj_Convert, &itself))
+ {
+ ((CFMutableDictionaryRefObject *)_self)->ob_itself = itself;
+ return 0;
+ }
+ return -1;
+}
+
+#define CFMutableDictionaryRefObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *CFMutableDictionaryRefObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *self;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((CFMutableDictionaryRefObject *)self)->ob_itself = NULL;
+ ((CFMutableDictionaryRefObject *)self)->ob_freeit = CFRelease;
+ return self;
+}
+
+#define CFMutableDictionaryRefObj_tp_free PyObject_Del
+
+
+PyTypeObject CFMutableDictionaryRef_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_CF.CFMutableDictionaryRef", /*tp_name*/
+ sizeof(CFMutableDictionaryRefObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) CFMutableDictionaryRefObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) CFMutableDictionaryRefObj_compare, /*tp_compare*/
+ (reprfunc) CFMutableDictionaryRefObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) CFMutableDictionaryRefObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ CFMutableDictionaryRefObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ CFMutableDictionaryRefObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ CFMutableDictionaryRefObj_tp_init, /* tp_init */
+ CFMutableDictionaryRefObj_tp_alloc, /* tp_alloc */
+ CFMutableDictionaryRefObj_tp_new, /* tp_new */
+ CFMutableDictionaryRefObj_tp_free, /* tp_free */
+};
+
+/* ------------- End object type CFMutableDictionaryRef ------------- */
+
+
+/* --------------------- Object type CFDataRef ---------------------- */
+
+PyTypeObject CFDataRef_Type;
+
+#define CFDataRefObj_Check(x) ((x)->ob_type == &CFDataRef_Type || PyObject_TypeCheck((x), &CFDataRef_Type))
+
+typedef struct CFDataRefObject {
+ PyObject_HEAD
+ CFDataRef ob_itself;
+ void (*ob_freeit)(CFTypeRef ptr);
+} CFDataRefObject;
+
+PyObject *CFDataRefObj_New(CFDataRef itself)
+{
+ CFDataRefObject *it;
+ if (itself == NULL)
+ {
+ PyErr_SetString(PyExc_RuntimeError, "cannot wrap NULL");
+ return NULL;
+ }
+ it = PyObject_NEW(CFDataRefObject, &CFDataRef_Type);
+ if (it == NULL) return NULL;
+ /* XXXX Should we tp_init or tp_new our basetype? */
+ it->ob_itself = itself;
+ it->ob_freeit = CFRelease;
+ return (PyObject *)it;
+}
+
+int CFDataRefObj_Convert(PyObject *v, CFDataRef *p_itself)
+{
+
+ if (v == Py_None) { *p_itself = NULL; return 1; }
+ if (PyString_Check(v)) {
+ char *cStr;
+ Py_ssize_t cLen;
+ if( PyString_AsStringAndSize(v, &cStr, &cLen) < 0 ) return 0;
+ *p_itself = CFDataCreate((CFAllocatorRef)NULL, (unsigned char *)cStr, cLen);
+ return 1;
+ }
+
+ if (!CFDataRefObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "CFDataRef required");
+ return 0;
+ }
+ *p_itself = ((CFDataRefObject *)v)->ob_itself;
+ return 1;
+}
+
+static void CFDataRefObj_dealloc(CFDataRefObject *self)
+{
+ if (self->ob_freeit && self->ob_itself)
+ {
+ self->ob_freeit((CFTypeRef)self->ob_itself);
+ self->ob_itself = NULL;
+ }
+ CFTypeRef_Type.tp_dealloc((PyObject *)self);
+}
+
+static PyObject *CFDataRefObj_CFDataCreateCopy(CFDataRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFDataRef _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFDataCreateCopy((CFAllocatorRef)NULL,
+ _self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CFDataRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFDataRefObj_CFDataGetLength(CFDataRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFIndex _rv;
+#ifndef CFDataGetLength
+ PyMac_PRECHECK(CFDataGetLength);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFDataGetLength(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFDataRefObj_CFStringCreateFromExternalRepresentation(CFDataRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ CFStringEncoding encoding;
+ if (!PyArg_ParseTuple(_args, "l",
+ &encoding))
+ return NULL;
+ _rv = CFStringCreateFromExternalRepresentation((CFAllocatorRef)NULL,
+ _self->ob_itself,
+ encoding);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFDataRefObj_CFDataGetData(CFDataRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ int size = CFDataGetLength(_self->ob_itself);
+ char *data = (char *)CFDataGetBytePtr(_self->ob_itself);
+
+ _res = (PyObject *)PyString_FromStringAndSize(data, size);
+ return _res;
+
+}
+
+static PyMethodDef CFDataRefObj_methods[] = {
+ {"CFDataCreateCopy", (PyCFunction)CFDataRefObj_CFDataCreateCopy, 1,
+ PyDoc_STR("() -> (CFDataRef _rv)")},
+ {"CFDataGetLength", (PyCFunction)CFDataRefObj_CFDataGetLength, 1,
+ PyDoc_STR("() -> (CFIndex _rv)")},
+ {"CFStringCreateFromExternalRepresentation", (PyCFunction)CFDataRefObj_CFStringCreateFromExternalRepresentation, 1,
+ PyDoc_STR("(CFStringEncoding encoding) -> (CFStringRef _rv)")},
+ {"CFDataGetData", (PyCFunction)CFDataRefObj_CFDataGetData, 1,
+ PyDoc_STR("() -> (string _rv)")},
+ {NULL, NULL, 0}
+};
+
+#define CFDataRefObj_getsetlist NULL
+
+
+static int CFDataRefObj_compare(CFDataRefObject *self, CFDataRefObject *other)
+{
+ /* XXXX Or should we use CFEqual?? */
+ if ( self->ob_itself > other->ob_itself ) return 1;
+ if ( self->ob_itself < other->ob_itself ) return -1;
+ return 0;
+}
+
+static PyObject * CFDataRefObj_repr(CFDataRefObject *self)
+{
+ char buf[100];
+ sprintf(buf, "<CFDataRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
+ return PyString_FromString(buf);
+}
+
+static int CFDataRefObj_hash(CFDataRefObject *self)
+{
+ /* XXXX Or should we use CFHash?? */
+ return (int)self->ob_itself;
+}
+static int CFDataRefObj_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds)
+{
+ CFDataRef itself;
+ char *kw[] = {"itself", 0};
+
+ if (PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, CFDataRefObj_Convert, &itself))
+ {
+ ((CFDataRefObject *)_self)->ob_itself = itself;
+ return 0;
+ }
+
+ /* Any CFTypeRef descendent is allowed as initializer too */
+ if (PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, CFTypeRefObj_Convert, &itself))
+ {
+ ((CFDataRefObject *)_self)->ob_itself = itself;
+ return 0;
+ }
+ return -1;
+}
+
+#define CFDataRefObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *CFDataRefObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *self;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((CFDataRefObject *)self)->ob_itself = NULL;
+ ((CFDataRefObject *)self)->ob_freeit = CFRelease;
+ return self;
+}
+
+#define CFDataRefObj_tp_free PyObject_Del
+
+
+PyTypeObject CFDataRef_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_CF.CFDataRef", /*tp_name*/
+ sizeof(CFDataRefObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) CFDataRefObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) CFDataRefObj_compare, /*tp_compare*/
+ (reprfunc) CFDataRefObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) CFDataRefObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ CFDataRefObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ CFDataRefObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ CFDataRefObj_tp_init, /* tp_init */
+ CFDataRefObj_tp_alloc, /* tp_alloc */
+ CFDataRefObj_tp_new, /* tp_new */
+ CFDataRefObj_tp_free, /* tp_free */
+};
+
+/* ------------------- End object type CFDataRef -------------------- */
+
+
+/* ------------------ Object type CFMutableDataRef ------------------ */
+
+PyTypeObject CFMutableDataRef_Type;
+
+#define CFMutableDataRefObj_Check(x) ((x)->ob_type == &CFMutableDataRef_Type || PyObject_TypeCheck((x), &CFMutableDataRef_Type))
+
+typedef struct CFMutableDataRefObject {
+ PyObject_HEAD
+ CFMutableDataRef ob_itself;
+ void (*ob_freeit)(CFTypeRef ptr);
+} CFMutableDataRefObject;
+
+PyObject *CFMutableDataRefObj_New(CFMutableDataRef itself)
+{
+ CFMutableDataRefObject *it;
+ if (itself == NULL)
+ {
+ PyErr_SetString(PyExc_RuntimeError, "cannot wrap NULL");
+ return NULL;
+ }
+ it = PyObject_NEW(CFMutableDataRefObject, &CFMutableDataRef_Type);
+ if (it == NULL) return NULL;
+ /* XXXX Should we tp_init or tp_new our basetype? */
+ it->ob_itself = itself;
+ it->ob_freeit = CFRelease;
+ return (PyObject *)it;
+}
+
+int CFMutableDataRefObj_Convert(PyObject *v, CFMutableDataRef *p_itself)
+{
+
+ if (v == Py_None) { *p_itself = NULL; return 1; }
+ /* Check for other CF objects here */
+
+ if (!CFMutableDataRefObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "CFMutableDataRef required");
+ return 0;
+ }
+ *p_itself = ((CFMutableDataRefObject *)v)->ob_itself;
+ return 1;
+}
+
+static void CFMutableDataRefObj_dealloc(CFMutableDataRefObject *self)
+{
+ if (self->ob_freeit && self->ob_itself)
+ {
+ self->ob_freeit((CFTypeRef)self->ob_itself);
+ self->ob_itself = NULL;
+ }
+ CFDataRef_Type.tp_dealloc((PyObject *)self);
+}
+
+static PyObject *CFMutableDataRefObj_CFDataSetLength(CFMutableDataRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFIndex length;
+#ifndef CFDataSetLength
+ PyMac_PRECHECK(CFDataSetLength);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &length))
+ return NULL;
+ CFDataSetLength(_self->ob_itself,
+ length);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CFMutableDataRefObj_CFDataIncreaseLength(CFMutableDataRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFIndex extraLength;
+#ifndef CFDataIncreaseLength
+ PyMac_PRECHECK(CFDataIncreaseLength);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &extraLength))
+ return NULL;
+ CFDataIncreaseLength(_self->ob_itself,
+ extraLength);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CFMutableDataRefObj_CFDataAppendBytes(CFMutableDataRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ unsigned char *bytes__in__;
+ long bytes__len__;
+ int bytes__in_len__;
+#ifndef CFDataAppendBytes
+ PyMac_PRECHECK(CFDataAppendBytes);
+#endif
+ if (!PyArg_ParseTuple(_args, "s#",
+ &bytes__in__, &bytes__in_len__))
+ return NULL;
+ bytes__len__ = bytes__in_len__;
+ CFDataAppendBytes(_self->ob_itself,
+ bytes__in__, bytes__len__);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CFMutableDataRefObj_CFDataReplaceBytes(CFMutableDataRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFRange range;
+ unsigned char *newBytes__in__;
+ long newBytes__len__;
+ int newBytes__in_len__;
+#ifndef CFDataReplaceBytes
+ PyMac_PRECHECK(CFDataReplaceBytes);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&s#",
+ CFRange_Convert, &range,
+ &newBytes__in__, &newBytes__in_len__))
+ return NULL;
+ newBytes__len__ = newBytes__in_len__;
+ CFDataReplaceBytes(_self->ob_itself,
+ range,
+ newBytes__in__, newBytes__len__);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CFMutableDataRefObj_CFDataDeleteBytes(CFMutableDataRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFRange range;
+#ifndef CFDataDeleteBytes
+ PyMac_PRECHECK(CFDataDeleteBytes);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFRange_Convert, &range))
+ return NULL;
+ CFDataDeleteBytes(_self->ob_itself,
+ range);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyMethodDef CFMutableDataRefObj_methods[] = {
+ {"CFDataSetLength", (PyCFunction)CFMutableDataRefObj_CFDataSetLength, 1,
+ PyDoc_STR("(CFIndex length) -> None")},
+ {"CFDataIncreaseLength", (PyCFunction)CFMutableDataRefObj_CFDataIncreaseLength, 1,
+ PyDoc_STR("(CFIndex extraLength) -> None")},
+ {"CFDataAppendBytes", (PyCFunction)CFMutableDataRefObj_CFDataAppendBytes, 1,
+ PyDoc_STR("(Buffer bytes) -> None")},
+ {"CFDataReplaceBytes", (PyCFunction)CFMutableDataRefObj_CFDataReplaceBytes, 1,
+ PyDoc_STR("(CFRange range, Buffer newBytes) -> None")},
+ {"CFDataDeleteBytes", (PyCFunction)CFMutableDataRefObj_CFDataDeleteBytes, 1,
+ PyDoc_STR("(CFRange range) -> None")},
+ {NULL, NULL, 0}
+};
+
+#define CFMutableDataRefObj_getsetlist NULL
+
+
+static int CFMutableDataRefObj_compare(CFMutableDataRefObject *self, CFMutableDataRefObject *other)
+{
+ /* XXXX Or should we use CFEqual?? */
+ if ( self->ob_itself > other->ob_itself ) return 1;
+ if ( self->ob_itself < other->ob_itself ) return -1;
+ return 0;
+}
+
+static PyObject * CFMutableDataRefObj_repr(CFMutableDataRefObject *self)
+{
+ char buf[100];
+ sprintf(buf, "<CFMutableDataRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
+ return PyString_FromString(buf);
+}
+
+static int CFMutableDataRefObj_hash(CFMutableDataRefObject *self)
+{
+ /* XXXX Or should we use CFHash?? */
+ return (int)self->ob_itself;
+}
+static int CFMutableDataRefObj_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds)
+{
+ CFMutableDataRef itself;
+ char *kw[] = {"itself", 0};
+
+ if (PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, CFMutableDataRefObj_Convert, &itself))
+ {
+ ((CFMutableDataRefObject *)_self)->ob_itself = itself;
+ return 0;
+ }
+
+ /* Any CFTypeRef descendent is allowed as initializer too */
+ if (PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, CFTypeRefObj_Convert, &itself))
+ {
+ ((CFMutableDataRefObject *)_self)->ob_itself = itself;
+ return 0;
+ }
+ return -1;
+}
+
+#define CFMutableDataRefObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *CFMutableDataRefObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *self;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((CFMutableDataRefObject *)self)->ob_itself = NULL;
+ ((CFMutableDataRefObject *)self)->ob_freeit = CFRelease;
+ return self;
+}
+
+#define CFMutableDataRefObj_tp_free PyObject_Del
+
+
+PyTypeObject CFMutableDataRef_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_CF.CFMutableDataRef", /*tp_name*/
+ sizeof(CFMutableDataRefObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) CFMutableDataRefObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) CFMutableDataRefObj_compare, /*tp_compare*/
+ (reprfunc) CFMutableDataRefObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) CFMutableDataRefObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ CFMutableDataRefObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ CFMutableDataRefObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ CFMutableDataRefObj_tp_init, /* tp_init */
+ CFMutableDataRefObj_tp_alloc, /* tp_alloc */
+ CFMutableDataRefObj_tp_new, /* tp_new */
+ CFMutableDataRefObj_tp_free, /* tp_free */
+};
+
+/* ---------------- End object type CFMutableDataRef ---------------- */
+
+
+/* -------------------- Object type CFStringRef --------------------- */
+
+PyTypeObject CFStringRef_Type;
+
+#define CFStringRefObj_Check(x) ((x)->ob_type == &CFStringRef_Type || PyObject_TypeCheck((x), &CFStringRef_Type))
+
+typedef struct CFStringRefObject {
+ PyObject_HEAD
+ CFStringRef ob_itself;
+ void (*ob_freeit)(CFTypeRef ptr);
+} CFStringRefObject;
+
+PyObject *CFStringRefObj_New(CFStringRef itself)
+{
+ CFStringRefObject *it;
+ if (itself == NULL)
+ {
+ PyErr_SetString(PyExc_RuntimeError, "cannot wrap NULL");
+ return NULL;
+ }
+ it = PyObject_NEW(CFStringRefObject, &CFStringRef_Type);
+ if (it == NULL) return NULL;
+ /* XXXX Should we tp_init or tp_new our basetype? */
+ it->ob_itself = itself;
+ it->ob_freeit = CFRelease;
+ return (PyObject *)it;
+}
+
+int CFStringRefObj_Convert(PyObject *v, CFStringRef *p_itself)
+{
+
+ if (v == Py_None) { *p_itself = NULL; return 1; }
+ if (PyString_Check(v)) {
+ char *cStr;
+ if (!PyArg_Parse(v, "es", "ascii", &cStr))
+ return 0;
+ *p_itself = CFStringCreateWithCString((CFAllocatorRef)NULL, cStr, kCFStringEncodingASCII);
+ PyMem_Free(cStr);
+ return 1;
+ }
+ if (PyUnicode_Check(v)) {
+ /* We use the CF types here, if Python was configured differently that will give an error */
+ CFIndex size = PyUnicode_GetSize(v);
+ UniChar *unichars = PyUnicode_AsUnicode(v);
+ if (!unichars) return 0;
+ *p_itself = CFStringCreateWithCharacters((CFAllocatorRef)NULL, unichars, size);
+ return 1;
+ }
+
+
+ if (!CFStringRefObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "CFStringRef required");
+ return 0;
+ }
+ *p_itself = ((CFStringRefObject *)v)->ob_itself;
+ return 1;
+}
+
+static void CFStringRefObj_dealloc(CFStringRefObject *self)
+{
+ if (self->ob_freeit && self->ob_itself)
+ {
+ self->ob_freeit((CFTypeRef)self->ob_itself);
+ self->ob_itself = NULL;
+ }
+ CFTypeRef_Type.tp_dealloc((PyObject *)self);
+}
+
+static PyObject *CFStringRefObj_CFStringCreateWithSubstring(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ CFRange range;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFRange_Convert, &range))
+ return NULL;
+ _rv = CFStringCreateWithSubstring((CFAllocatorRef)NULL,
+ _self->ob_itself,
+ range);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringCreateCopy(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFStringCreateCopy((CFAllocatorRef)NULL,
+ _self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringGetLength(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFIndex _rv;
+#ifndef CFStringGetLength
+ PyMac_PRECHECK(CFStringGetLength);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFStringGetLength(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringGetBytes(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFIndex _rv;
+ CFRange range;
+ CFStringEncoding encoding;
+ UInt8 lossByte;
+ Boolean isExternalRepresentation;
+ UInt8 buffer;
+ CFIndex maxBufLen;
+ CFIndex usedBufLen;
+#ifndef CFStringGetBytes
+ PyMac_PRECHECK(CFStringGetBytes);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lbll",
+ CFRange_Convert, &range,
+ &encoding,
+ &lossByte,
+ &isExternalRepresentation,
+ &maxBufLen))
+ return NULL;
+ _rv = CFStringGetBytes(_self->ob_itself,
+ range,
+ encoding,
+ lossByte,
+ isExternalRepresentation,
+ &buffer,
+ maxBufLen,
+ &usedBufLen);
+ _res = Py_BuildValue("lbl",
+ _rv,
+ buffer,
+ usedBufLen);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringCreateExternalRepresentation(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFDataRef _rv;
+ CFStringEncoding encoding;
+ UInt8 lossByte;
+ if (!PyArg_ParseTuple(_args, "lb",
+ &encoding,
+ &lossByte))
+ return NULL;
+ _rv = CFStringCreateExternalRepresentation((CFAllocatorRef)NULL,
+ _self->ob_itself,
+ encoding,
+ lossByte);
+ _res = Py_BuildValue("O&",
+ CFDataRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringGetSmallestEncoding(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringEncoding _rv;
+#ifndef CFStringGetSmallestEncoding
+ PyMac_PRECHECK(CFStringGetSmallestEncoding);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFStringGetSmallestEncoding(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringGetFastestEncoding(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringEncoding _rv;
+#ifndef CFStringGetFastestEncoding
+ PyMac_PRECHECK(CFStringGetFastestEncoding);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFStringGetFastestEncoding(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringCompareWithOptions(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFComparisonResult _rv;
+ CFStringRef theString2;
+ CFRange rangeToCompare;
+ CFOptionFlags compareOptions;
+#ifndef CFStringCompareWithOptions
+ PyMac_PRECHECK(CFStringCompareWithOptions);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&l",
+ CFStringRefObj_Convert, &theString2,
+ CFRange_Convert, &rangeToCompare,
+ &compareOptions))
+ return NULL;
+ _rv = CFStringCompareWithOptions(_self->ob_itself,
+ theString2,
+ rangeToCompare,
+ compareOptions);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringCompare(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFComparisonResult _rv;
+ CFStringRef theString2;
+ CFOptionFlags compareOptions;
+#ifndef CFStringCompare
+ PyMac_PRECHECK(CFStringCompare);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CFStringRefObj_Convert, &theString2,
+ &compareOptions))
+ return NULL;
+ _rv = CFStringCompare(_self->ob_itself,
+ theString2,
+ compareOptions);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringFindWithOptions(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ CFStringRef stringToFind;
+ CFRange rangeToSearch;
+ CFOptionFlags searchOptions;
+ CFRange result;
+#ifndef CFStringFindWithOptions
+ PyMac_PRECHECK(CFStringFindWithOptions);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&l",
+ CFStringRefObj_Convert, &stringToFind,
+ CFRange_Convert, &rangeToSearch,
+ &searchOptions))
+ return NULL;
+ _rv = CFStringFindWithOptions(_self->ob_itself,
+ stringToFind,
+ rangeToSearch,
+ searchOptions,
+ &result);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ CFRange_New, result);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringCreateArrayWithFindResults(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFArrayRef _rv;
+ CFStringRef stringToFind;
+ CFRange rangeToSearch;
+ CFOptionFlags compareOptions;
+ if (!PyArg_ParseTuple(_args, "O&O&l",
+ CFStringRefObj_Convert, &stringToFind,
+ CFRange_Convert, &rangeToSearch,
+ &compareOptions))
+ return NULL;
+ _rv = CFStringCreateArrayWithFindResults((CFAllocatorRef)NULL,
+ _self->ob_itself,
+ stringToFind,
+ rangeToSearch,
+ compareOptions);
+ _res = Py_BuildValue("O&",
+ CFArrayRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringFind(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFRange _rv;
+ CFStringRef stringToFind;
+ CFOptionFlags compareOptions;
+#ifndef CFStringFind
+ PyMac_PRECHECK(CFStringFind);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CFStringRefObj_Convert, &stringToFind,
+ &compareOptions))
+ return NULL;
+ _rv = CFStringFind(_self->ob_itself,
+ stringToFind,
+ compareOptions);
+ _res = Py_BuildValue("O&",
+ CFRange_New, _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringHasPrefix(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ CFStringRef prefix;
+#ifndef CFStringHasPrefix
+ PyMac_PRECHECK(CFStringHasPrefix);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFStringRefObj_Convert, &prefix))
+ return NULL;
+ _rv = CFStringHasPrefix(_self->ob_itself,
+ prefix);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringHasSuffix(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ CFStringRef suffix;
+#ifndef CFStringHasSuffix
+ PyMac_PRECHECK(CFStringHasSuffix);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFStringRefObj_Convert, &suffix))
+ return NULL;
+ _rv = CFStringHasSuffix(_self->ob_itself,
+ suffix);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringGetLineBounds(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFRange range;
+ CFIndex lineBeginIndex;
+ CFIndex lineEndIndex;
+ CFIndex contentsEndIndex;
+#ifndef CFStringGetLineBounds
+ PyMac_PRECHECK(CFStringGetLineBounds);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFRange_Convert, &range))
+ return NULL;
+ CFStringGetLineBounds(_self->ob_itself,
+ range,
+ &lineBeginIndex,
+ &lineEndIndex,
+ &contentsEndIndex);
+ _res = Py_BuildValue("lll",
+ lineBeginIndex,
+ lineEndIndex,
+ contentsEndIndex);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringCreateArrayBySeparatingStrings(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFArrayRef _rv;
+ CFStringRef separatorString;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFStringRefObj_Convert, &separatorString))
+ return NULL;
+ _rv = CFStringCreateArrayBySeparatingStrings((CFAllocatorRef)NULL,
+ _self->ob_itself,
+ separatorString);
+ _res = Py_BuildValue("O&",
+ CFArrayRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringGetIntValue(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 _rv;
+#ifndef CFStringGetIntValue
+ PyMac_PRECHECK(CFStringGetIntValue);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFStringGetIntValue(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringGetDoubleValue(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ double _rv;
+#ifndef CFStringGetDoubleValue
+ PyMac_PRECHECK(CFStringGetDoubleValue);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFStringGetDoubleValue(_self->ob_itself);
+ _res = Py_BuildValue("d",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringConvertIANACharSetNameToEncoding(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringEncoding _rv;
+#ifndef CFStringConvertIANACharSetNameToEncoding
+ PyMac_PRECHECK(CFStringConvertIANACharSetNameToEncoding);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFStringConvertIANACharSetNameToEncoding(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFShowStr(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef CFShowStr
+ PyMac_PRECHECK(CFShowStr);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ CFShowStr(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFURLCreateWithString(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFURLRef _rv;
+ CFURLRef baseURL;
+ if (!PyArg_ParseTuple(_args, "O&",
+ OptionalCFURLRefObj_Convert, &baseURL))
+ return NULL;
+ _rv = CFURLCreateWithString((CFAllocatorRef)NULL,
+ _self->ob_itself,
+ baseURL);
+ _res = Py_BuildValue("O&",
+ CFURLRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFURLCreateWithFileSystemPath(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFURLRef _rv;
+ CFURLPathStyle pathStyle;
+ Boolean isDirectory;
+ if (!PyArg_ParseTuple(_args, "ll",
+ &pathStyle,
+ &isDirectory))
+ return NULL;
+ _rv = CFURLCreateWithFileSystemPath((CFAllocatorRef)NULL,
+ _self->ob_itself,
+ pathStyle,
+ isDirectory);
+ _res = Py_BuildValue("O&",
+ CFURLRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFURLCreateWithFileSystemPathRelativeToBase(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFURLRef _rv;
+ CFURLPathStyle pathStyle;
+ Boolean isDirectory;
+ CFURLRef baseURL;
+ if (!PyArg_ParseTuple(_args, "llO&",
+ &pathStyle,
+ &isDirectory,
+ OptionalCFURLRefObj_Convert, &baseURL))
+ return NULL;
+ _rv = CFURLCreateWithFileSystemPathRelativeToBase((CFAllocatorRef)NULL,
+ _self->ob_itself,
+ pathStyle,
+ isDirectory,
+ baseURL);
+ _res = Py_BuildValue("O&",
+ CFURLRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFURLCreateStringByReplacingPercentEscapes(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ CFStringRef charactersToLeaveEscaped;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFStringRefObj_Convert, &charactersToLeaveEscaped))
+ return NULL;
+ _rv = CFURLCreateStringByReplacingPercentEscapes((CFAllocatorRef)NULL,
+ _self->ob_itself,
+ charactersToLeaveEscaped);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFURLCreateStringByAddingPercentEscapes(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ CFStringRef charactersToLeaveUnescaped;
+ CFStringRef legalURLCharactersToBeEscaped;
+ CFStringEncoding encoding;
+ if (!PyArg_ParseTuple(_args, "O&O&l",
+ CFStringRefObj_Convert, &charactersToLeaveUnescaped,
+ CFStringRefObj_Convert, &legalURLCharactersToBeEscaped,
+ &encoding))
+ return NULL;
+ _rv = CFURLCreateStringByAddingPercentEscapes((CFAllocatorRef)NULL,
+ _self->ob_itself,
+ charactersToLeaveUnescaped,
+ legalURLCharactersToBeEscaped,
+ encoding);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringGetString(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ int size = CFStringGetLength(_self->ob_itself)+1;
+ char *data = malloc(size);
+
+ if( data == NULL ) return PyErr_NoMemory();
+ if ( CFStringGetCString(_self->ob_itself, data, size, 0) ) {
+ _res = (PyObject *)PyString_FromString(data);
+ } else {
+ PyErr_SetString(PyExc_RuntimeError, "CFStringGetCString could not fit the string");
+ _res = NULL;
+ }
+ free(data);
+ return _res;
+
+}
+
+static PyObject *CFStringRefObj_CFStringGetUnicode(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ int size = CFStringGetLength(_self->ob_itself)+1;
+ Py_UNICODE *data = malloc(size*sizeof(Py_UNICODE));
+ CFRange range;
+
+ range.location = 0;
+ range.length = size;
+ if( data == NULL ) return PyErr_NoMemory();
+ CFStringGetCharacters(_self->ob_itself, range, data);
+ _res = (PyObject *)PyUnicode_FromUnicode(data, size-1);
+ free(data);
+ return _res;
+
+}
+
+static PyMethodDef CFStringRefObj_methods[] = {
+ {"CFStringCreateWithSubstring", (PyCFunction)CFStringRefObj_CFStringCreateWithSubstring, 1,
+ PyDoc_STR("(CFRange range) -> (CFStringRef _rv)")},
+ {"CFStringCreateCopy", (PyCFunction)CFStringRefObj_CFStringCreateCopy, 1,
+ PyDoc_STR("() -> (CFStringRef _rv)")},
+ {"CFStringGetLength", (PyCFunction)CFStringRefObj_CFStringGetLength, 1,
+ PyDoc_STR("() -> (CFIndex _rv)")},
+ {"CFStringGetBytes", (PyCFunction)CFStringRefObj_CFStringGetBytes, 1,
+ PyDoc_STR("(CFRange range, CFStringEncoding encoding, UInt8 lossByte, Boolean isExternalRepresentation, CFIndex maxBufLen) -> (CFIndex _rv, UInt8 buffer, CFIndex usedBufLen)")},
+ {"CFStringCreateExternalRepresentation", (PyCFunction)CFStringRefObj_CFStringCreateExternalRepresentation, 1,
+ PyDoc_STR("(CFStringEncoding encoding, UInt8 lossByte) -> (CFDataRef _rv)")},
+ {"CFStringGetSmallestEncoding", (PyCFunction)CFStringRefObj_CFStringGetSmallestEncoding, 1,
+ PyDoc_STR("() -> (CFStringEncoding _rv)")},
+ {"CFStringGetFastestEncoding", (PyCFunction)CFStringRefObj_CFStringGetFastestEncoding, 1,
+ PyDoc_STR("() -> (CFStringEncoding _rv)")},
+ {"CFStringCompareWithOptions", (PyCFunction)CFStringRefObj_CFStringCompareWithOptions, 1,
+ PyDoc_STR("(CFStringRef theString2, CFRange rangeToCompare, CFOptionFlags compareOptions) -> (CFComparisonResult _rv)")},
+ {"CFStringCompare", (PyCFunction)CFStringRefObj_CFStringCompare, 1,
+ PyDoc_STR("(CFStringRef theString2, CFOptionFlags compareOptions) -> (CFComparisonResult _rv)")},
+ {"CFStringFindWithOptions", (PyCFunction)CFStringRefObj_CFStringFindWithOptions, 1,
+ PyDoc_STR("(CFStringRef stringToFind, CFRange rangeToSearch, CFOptionFlags searchOptions) -> (Boolean _rv, CFRange result)")},
+ {"CFStringCreateArrayWithFindResults", (PyCFunction)CFStringRefObj_CFStringCreateArrayWithFindResults, 1,
+ PyDoc_STR("(CFStringRef stringToFind, CFRange rangeToSearch, CFOptionFlags compareOptions) -> (CFArrayRef _rv)")},
+ {"CFStringFind", (PyCFunction)CFStringRefObj_CFStringFind, 1,
+ PyDoc_STR("(CFStringRef stringToFind, CFOptionFlags compareOptions) -> (CFRange _rv)")},
+ {"CFStringHasPrefix", (PyCFunction)CFStringRefObj_CFStringHasPrefix, 1,
+ PyDoc_STR("(CFStringRef prefix) -> (Boolean _rv)")},
+ {"CFStringHasSuffix", (PyCFunction)CFStringRefObj_CFStringHasSuffix, 1,
+ PyDoc_STR("(CFStringRef suffix) -> (Boolean _rv)")},
+ {"CFStringGetLineBounds", (PyCFunction)CFStringRefObj_CFStringGetLineBounds, 1,
+ PyDoc_STR("(CFRange range) -> (CFIndex lineBeginIndex, CFIndex lineEndIndex, CFIndex contentsEndIndex)")},
+ {"CFStringCreateArrayBySeparatingStrings", (PyCFunction)CFStringRefObj_CFStringCreateArrayBySeparatingStrings, 1,
+ PyDoc_STR("(CFStringRef separatorString) -> (CFArrayRef _rv)")},
+ {"CFStringGetIntValue", (PyCFunction)CFStringRefObj_CFStringGetIntValue, 1,
+ PyDoc_STR("() -> (SInt32 _rv)")},
+ {"CFStringGetDoubleValue", (PyCFunction)CFStringRefObj_CFStringGetDoubleValue, 1,
+ PyDoc_STR("() -> (double _rv)")},
+ {"CFStringConvertIANACharSetNameToEncoding", (PyCFunction)CFStringRefObj_CFStringConvertIANACharSetNameToEncoding, 1,
+ PyDoc_STR("() -> (CFStringEncoding _rv)")},
+ {"CFShowStr", (PyCFunction)CFStringRefObj_CFShowStr, 1,
+ PyDoc_STR("() -> None")},
+ {"CFURLCreateWithString", (PyCFunction)CFStringRefObj_CFURLCreateWithString, 1,
+ PyDoc_STR("(CFURLRef baseURL) -> (CFURLRef _rv)")},
+ {"CFURLCreateWithFileSystemPath", (PyCFunction)CFStringRefObj_CFURLCreateWithFileSystemPath, 1,
+ PyDoc_STR("(CFURLPathStyle pathStyle, Boolean isDirectory) -> (CFURLRef _rv)")},
+ {"CFURLCreateWithFileSystemPathRelativeToBase", (PyCFunction)CFStringRefObj_CFURLCreateWithFileSystemPathRelativeToBase, 1,
+ PyDoc_STR("(CFURLPathStyle pathStyle, Boolean isDirectory, CFURLRef baseURL) -> (CFURLRef _rv)")},
+ {"CFURLCreateStringByReplacingPercentEscapes", (PyCFunction)CFStringRefObj_CFURLCreateStringByReplacingPercentEscapes, 1,
+ PyDoc_STR("(CFStringRef charactersToLeaveEscaped) -> (CFStringRef _rv)")},
+ {"CFURLCreateStringByAddingPercentEscapes", (PyCFunction)CFStringRefObj_CFURLCreateStringByAddingPercentEscapes, 1,
+ PyDoc_STR("(CFStringRef charactersToLeaveUnescaped, CFStringRef legalURLCharactersToBeEscaped, CFStringEncoding encoding) -> (CFStringRef _rv)")},
+ {"CFStringGetString", (PyCFunction)CFStringRefObj_CFStringGetString, 1,
+ PyDoc_STR("() -> (string _rv)")},
+ {"CFStringGetUnicode", (PyCFunction)CFStringRefObj_CFStringGetUnicode, 1,
+ PyDoc_STR("() -> (unicode _rv)")},
+ {NULL, NULL, 0}
+};
+
+#define CFStringRefObj_getsetlist NULL
+
+
+static int CFStringRefObj_compare(CFStringRefObject *self, CFStringRefObject *other)
+{
+ /* XXXX Or should we use CFEqual?? */
+ if ( self->ob_itself > other->ob_itself ) return 1;
+ if ( self->ob_itself < other->ob_itself ) return -1;
+ return 0;
+}
+
+static PyObject * CFStringRefObj_repr(CFStringRefObject *self)
+{
+ char buf[100];
+ sprintf(buf, "<CFStringRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
+ return PyString_FromString(buf);
+}
+
+static int CFStringRefObj_hash(CFStringRefObject *self)
+{
+ /* XXXX Or should we use CFHash?? */
+ return (int)self->ob_itself;
+}
+static int CFStringRefObj_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds)
+{
+ CFStringRef itself;
+ char *kw[] = {"itself", 0};
+
+ if (PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, CFStringRefObj_Convert, &itself))
+ {
+ ((CFStringRefObject *)_self)->ob_itself = itself;
+ return 0;
+ }
+
+ /* Any CFTypeRef descendent is allowed as initializer too */
+ if (PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, CFTypeRefObj_Convert, &itself))
+ {
+ ((CFStringRefObject *)_self)->ob_itself = itself;
+ return 0;
+ }
+ return -1;
+}
+
+#define CFStringRefObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *CFStringRefObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *self;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((CFStringRefObject *)self)->ob_itself = NULL;
+ ((CFStringRefObject *)self)->ob_freeit = CFRelease;
+ return self;
+}
+
+#define CFStringRefObj_tp_free PyObject_Del
+
+
+PyTypeObject CFStringRef_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_CF.CFStringRef", /*tp_name*/
+ sizeof(CFStringRefObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) CFStringRefObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) CFStringRefObj_compare, /*tp_compare*/
+ (reprfunc) CFStringRefObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) CFStringRefObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ CFStringRefObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ CFStringRefObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ CFStringRefObj_tp_init, /* tp_init */
+ CFStringRefObj_tp_alloc, /* tp_alloc */
+ CFStringRefObj_tp_new, /* tp_new */
+ CFStringRefObj_tp_free, /* tp_free */
+};
+
+/* ------------------ End object type CFStringRef ------------------- */
+
+
+/* ----------------- Object type CFMutableStringRef ----------------- */
+
+PyTypeObject CFMutableStringRef_Type;
+
+#define CFMutableStringRefObj_Check(x) ((x)->ob_type == &CFMutableStringRef_Type || PyObject_TypeCheck((x), &CFMutableStringRef_Type))
+
+typedef struct CFMutableStringRefObject {
+ PyObject_HEAD
+ CFMutableStringRef ob_itself;
+ void (*ob_freeit)(CFTypeRef ptr);
+} CFMutableStringRefObject;
+
+PyObject *CFMutableStringRefObj_New(CFMutableStringRef itself)
+{
+ CFMutableStringRefObject *it;
+ if (itself == NULL)
+ {
+ PyErr_SetString(PyExc_RuntimeError, "cannot wrap NULL");
+ return NULL;
+ }
+ it = PyObject_NEW(CFMutableStringRefObject, &CFMutableStringRef_Type);
+ if (it == NULL) return NULL;
+ /* XXXX Should we tp_init or tp_new our basetype? */
+ it->ob_itself = itself;
+ it->ob_freeit = CFRelease;
+ return (PyObject *)it;
+}
+
+int CFMutableStringRefObj_Convert(PyObject *v, CFMutableStringRef *p_itself)
+{
+
+ if (v == Py_None) { *p_itself = NULL; return 1; }
+ /* Check for other CF objects here */
+
+ if (!CFMutableStringRefObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "CFMutableStringRef required");
+ return 0;
+ }
+ *p_itself = ((CFMutableStringRefObject *)v)->ob_itself;
+ return 1;
+}
+
+static void CFMutableStringRefObj_dealloc(CFMutableStringRefObject *self)
+{
+ if (self->ob_freeit && self->ob_itself)
+ {
+ self->ob_freeit((CFTypeRef)self->ob_itself);
+ self->ob_itself = NULL;
+ }
+ CFStringRef_Type.tp_dealloc((PyObject *)self);
+}
+
+static PyObject *CFMutableStringRefObj_CFStringAppend(CFMutableStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef appendedString;
+#ifndef CFStringAppend
+ PyMac_PRECHECK(CFStringAppend);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFStringRefObj_Convert, &appendedString))
+ return NULL;
+ CFStringAppend(_self->ob_itself,
+ appendedString);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CFMutableStringRefObj_CFStringAppendCharacters(CFMutableStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UniChar *chars__in__;
+ UniCharCount chars__len__;
+ int chars__in_len__;
+#ifndef CFStringAppendCharacters
+ PyMac_PRECHECK(CFStringAppendCharacters);
+#endif
+ if (!PyArg_ParseTuple(_args, "u#",
+ &chars__in__, &chars__in_len__))
+ return NULL;
+ chars__len__ = chars__in_len__;
+ CFStringAppendCharacters(_self->ob_itself,
+ chars__in__, chars__len__);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CFMutableStringRefObj_CFStringAppendPascalString(CFMutableStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Str255 pStr;
+ CFStringEncoding encoding;
+#ifndef CFStringAppendPascalString
+ PyMac_PRECHECK(CFStringAppendPascalString);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetStr255, pStr,
+ &encoding))
+ return NULL;
+ CFStringAppendPascalString(_self->ob_itself,
+ pStr,
+ encoding);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CFMutableStringRefObj_CFStringAppendCString(CFMutableStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ char* cStr;
+ CFStringEncoding encoding;
+#ifndef CFStringAppendCString
+ PyMac_PRECHECK(CFStringAppendCString);
+#endif
+ if (!PyArg_ParseTuple(_args, "sl",
+ &cStr,
+ &encoding))
+ return NULL;
+ CFStringAppendCString(_self->ob_itself,
+ cStr,
+ encoding);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CFMutableStringRefObj_CFStringInsert(CFMutableStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFIndex idx;
+ CFStringRef insertedStr;
+#ifndef CFStringInsert
+ PyMac_PRECHECK(CFStringInsert);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&",
+ &idx,
+ CFStringRefObj_Convert, &insertedStr))
+ return NULL;
+ CFStringInsert(_self->ob_itself,
+ idx,
+ insertedStr);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CFMutableStringRefObj_CFStringDelete(CFMutableStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFRange range;
+#ifndef CFStringDelete
+ PyMac_PRECHECK(CFStringDelete);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFRange_Convert, &range))
+ return NULL;
+ CFStringDelete(_self->ob_itself,
+ range);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CFMutableStringRefObj_CFStringReplace(CFMutableStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFRange range;
+ CFStringRef replacement;
+#ifndef CFStringReplace
+ PyMac_PRECHECK(CFStringReplace);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CFRange_Convert, &range,
+ CFStringRefObj_Convert, &replacement))
+ return NULL;
+ CFStringReplace(_self->ob_itself,
+ range,
+ replacement);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CFMutableStringRefObj_CFStringReplaceAll(CFMutableStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef replacement;
+#ifndef CFStringReplaceAll
+ PyMac_PRECHECK(CFStringReplaceAll);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFStringRefObj_Convert, &replacement))
+ return NULL;
+ CFStringReplaceAll(_self->ob_itself,
+ replacement);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CFMutableStringRefObj_CFStringPad(CFMutableStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef padString;
+ CFIndex length;
+ CFIndex indexIntoPad;
+#ifndef CFStringPad
+ PyMac_PRECHECK(CFStringPad);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ CFStringRefObj_Convert, &padString,
+ &length,
+ &indexIntoPad))
+ return NULL;
+ CFStringPad(_self->ob_itself,
+ padString,
+ length,
+ indexIntoPad);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CFMutableStringRefObj_CFStringTrim(CFMutableStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef trimString;
+#ifndef CFStringTrim
+ PyMac_PRECHECK(CFStringTrim);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFStringRefObj_Convert, &trimString))
+ return NULL;
+ CFStringTrim(_self->ob_itself,
+ trimString);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CFMutableStringRefObj_CFStringTrimWhitespace(CFMutableStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef CFStringTrimWhitespace
+ PyMac_PRECHECK(CFStringTrimWhitespace);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ CFStringTrimWhitespace(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyMethodDef CFMutableStringRefObj_methods[] = {
+ {"CFStringAppend", (PyCFunction)CFMutableStringRefObj_CFStringAppend, 1,
+ PyDoc_STR("(CFStringRef appendedString) -> None")},
+ {"CFStringAppendCharacters", (PyCFunction)CFMutableStringRefObj_CFStringAppendCharacters, 1,
+ PyDoc_STR("(Buffer chars) -> None")},
+ {"CFStringAppendPascalString", (PyCFunction)CFMutableStringRefObj_CFStringAppendPascalString, 1,
+ PyDoc_STR("(Str255 pStr, CFStringEncoding encoding) -> None")},
+ {"CFStringAppendCString", (PyCFunction)CFMutableStringRefObj_CFStringAppendCString, 1,
+ PyDoc_STR("(char* cStr, CFStringEncoding encoding) -> None")},
+ {"CFStringInsert", (PyCFunction)CFMutableStringRefObj_CFStringInsert, 1,
+ PyDoc_STR("(CFIndex idx, CFStringRef insertedStr) -> None")},
+ {"CFStringDelete", (PyCFunction)CFMutableStringRefObj_CFStringDelete, 1,
+ PyDoc_STR("(CFRange range) -> None")},
+ {"CFStringReplace", (PyCFunction)CFMutableStringRefObj_CFStringReplace, 1,
+ PyDoc_STR("(CFRange range, CFStringRef replacement) -> None")},
+ {"CFStringReplaceAll", (PyCFunction)CFMutableStringRefObj_CFStringReplaceAll, 1,
+ PyDoc_STR("(CFStringRef replacement) -> None")},
+ {"CFStringPad", (PyCFunction)CFMutableStringRefObj_CFStringPad, 1,
+ PyDoc_STR("(CFStringRef padString, CFIndex length, CFIndex indexIntoPad) -> None")},
+ {"CFStringTrim", (PyCFunction)CFMutableStringRefObj_CFStringTrim, 1,
+ PyDoc_STR("(CFStringRef trimString) -> None")},
+ {"CFStringTrimWhitespace", (PyCFunction)CFMutableStringRefObj_CFStringTrimWhitespace, 1,
+ PyDoc_STR("() -> None")},
+ {NULL, NULL, 0}
+};
+
+#define CFMutableStringRefObj_getsetlist NULL
+
+
+static int CFMutableStringRefObj_compare(CFMutableStringRefObject *self, CFMutableStringRefObject *other)
+{
+ /* XXXX Or should we use CFEqual?? */
+ if ( self->ob_itself > other->ob_itself ) return 1;
+ if ( self->ob_itself < other->ob_itself ) return -1;
+ return 0;
+}
+
+static PyObject * CFMutableStringRefObj_repr(CFMutableStringRefObject *self)
+{
+ char buf[100];
+ sprintf(buf, "<CFMutableStringRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
+ return PyString_FromString(buf);
+}
+
+static int CFMutableStringRefObj_hash(CFMutableStringRefObject *self)
+{
+ /* XXXX Or should we use CFHash?? */
+ return (int)self->ob_itself;
+}
+static int CFMutableStringRefObj_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds)
+{
+ CFMutableStringRef itself;
+ char *kw[] = {"itself", 0};
+
+ if (PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, CFMutableStringRefObj_Convert, &itself))
+ {
+ ((CFMutableStringRefObject *)_self)->ob_itself = itself;
+ return 0;
+ }
+
+ /* Any CFTypeRef descendent is allowed as initializer too */
+ if (PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, CFTypeRefObj_Convert, &itself))
+ {
+ ((CFMutableStringRefObject *)_self)->ob_itself = itself;
+ return 0;
+ }
+ return -1;
+}
+
+#define CFMutableStringRefObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *CFMutableStringRefObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *self;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((CFMutableStringRefObject *)self)->ob_itself = NULL;
+ ((CFMutableStringRefObject *)self)->ob_freeit = CFRelease;
+ return self;
+}
+
+#define CFMutableStringRefObj_tp_free PyObject_Del
+
+
+PyTypeObject CFMutableStringRef_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_CF.CFMutableStringRef", /*tp_name*/
+ sizeof(CFMutableStringRefObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) CFMutableStringRefObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) CFMutableStringRefObj_compare, /*tp_compare*/
+ (reprfunc) CFMutableStringRefObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) CFMutableStringRefObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ CFMutableStringRefObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ CFMutableStringRefObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ CFMutableStringRefObj_tp_init, /* tp_init */
+ CFMutableStringRefObj_tp_alloc, /* tp_alloc */
+ CFMutableStringRefObj_tp_new, /* tp_new */
+ CFMutableStringRefObj_tp_free, /* tp_free */
+};
+
+/* --------------- End object type CFMutableStringRef --------------- */
+
+
+/* ---------------------- Object type CFURLRef ---------------------- */
+
+PyTypeObject CFURLRef_Type;
+
+#define CFURLRefObj_Check(x) ((x)->ob_type == &CFURLRef_Type || PyObject_TypeCheck((x), &CFURLRef_Type))
+
+typedef struct CFURLRefObject {
+ PyObject_HEAD
+ CFURLRef ob_itself;
+ void (*ob_freeit)(CFTypeRef ptr);
+} CFURLRefObject;
+
+PyObject *CFURLRefObj_New(CFURLRef itself)
+{
+ CFURLRefObject *it;
+ if (itself == NULL)
+ {
+ PyErr_SetString(PyExc_RuntimeError, "cannot wrap NULL");
+ return NULL;
+ }
+ it = PyObject_NEW(CFURLRefObject, &CFURLRef_Type);
+ if (it == NULL) return NULL;
+ /* XXXX Should we tp_init or tp_new our basetype? */
+ it->ob_itself = itself;
+ it->ob_freeit = CFRelease;
+ return (PyObject *)it;
+}
+
+int CFURLRefObj_Convert(PyObject *v, CFURLRef *p_itself)
+{
+
+ if (v == Py_None) { *p_itself = NULL; return 1; }
+ /* Check for other CF objects here */
+
+ if (!CFURLRefObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "CFURLRef required");
+ return 0;
+ }
+ *p_itself = ((CFURLRefObject *)v)->ob_itself;
+ return 1;
+}
+
+static void CFURLRefObj_dealloc(CFURLRefObject *self)
+{
+ if (self->ob_freeit && self->ob_itself)
+ {
+ self->ob_freeit((CFTypeRef)self->ob_itself);
+ self->ob_itself = NULL;
+ }
+ CFTypeRef_Type.tp_dealloc((PyObject *)self);
+}
+
+static PyObject *CFURLRefObj_CFURLCreateData(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFDataRef _rv;
+ CFStringEncoding encoding;
+ Boolean escapeWhitespace;
+ if (!PyArg_ParseTuple(_args, "ll",
+ &encoding,
+ &escapeWhitespace))
+ return NULL;
+ _rv = CFURLCreateData((CFAllocatorRef)NULL,
+ _self->ob_itself,
+ encoding,
+ escapeWhitespace);
+ _res = Py_BuildValue("O&",
+ CFDataRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLGetFileSystemRepresentation(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Boolean resolveAgainstBase;
+ UInt8 buffer;
+ CFIndex maxBufLen;
+#ifndef CFURLGetFileSystemRepresentation
+ PyMac_PRECHECK(CFURLGetFileSystemRepresentation);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &resolveAgainstBase,
+ &maxBufLen))
+ return NULL;
+ _rv = CFURLGetFileSystemRepresentation(_self->ob_itself,
+ resolveAgainstBase,
+ &buffer,
+ maxBufLen);
+ _res = Py_BuildValue("lb",
+ _rv,
+ buffer);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLCopyAbsoluteURL(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFURLRef _rv;
+#ifndef CFURLCopyAbsoluteURL
+ PyMac_PRECHECK(CFURLCopyAbsoluteURL);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFURLCopyAbsoluteURL(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CFURLRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLGetString(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+#ifndef CFURLGetString
+ PyMac_PRECHECK(CFURLGetString);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFURLGetString(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLGetBaseURL(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFURLRef _rv;
+#ifndef CFURLGetBaseURL
+ PyMac_PRECHECK(CFURLGetBaseURL);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFURLGetBaseURL(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CFURLRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLCanBeDecomposed(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef CFURLCanBeDecomposed
+ PyMac_PRECHECK(CFURLCanBeDecomposed);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFURLCanBeDecomposed(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLCopyScheme(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+#ifndef CFURLCopyScheme
+ PyMac_PRECHECK(CFURLCopyScheme);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFURLCopyScheme(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLCopyNetLocation(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+#ifndef CFURLCopyNetLocation
+ PyMac_PRECHECK(CFURLCopyNetLocation);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFURLCopyNetLocation(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLCopyPath(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+#ifndef CFURLCopyPath
+ PyMac_PRECHECK(CFURLCopyPath);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFURLCopyPath(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLCopyStrictPath(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ Boolean isAbsolute;
+#ifndef CFURLCopyStrictPath
+ PyMac_PRECHECK(CFURLCopyStrictPath);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFURLCopyStrictPath(_self->ob_itself,
+ &isAbsolute);
+ _res = Py_BuildValue("O&l",
+ CFStringRefObj_New, _rv,
+ isAbsolute);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLCopyFileSystemPath(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ CFURLPathStyle pathStyle;
+#ifndef CFURLCopyFileSystemPath
+ PyMac_PRECHECK(CFURLCopyFileSystemPath);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &pathStyle))
+ return NULL;
+ _rv = CFURLCopyFileSystemPath(_self->ob_itself,
+ pathStyle);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLHasDirectoryPath(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef CFURLHasDirectoryPath
+ PyMac_PRECHECK(CFURLHasDirectoryPath);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFURLHasDirectoryPath(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLCopyResourceSpecifier(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+#ifndef CFURLCopyResourceSpecifier
+ PyMac_PRECHECK(CFURLCopyResourceSpecifier);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFURLCopyResourceSpecifier(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLCopyHostName(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+#ifndef CFURLCopyHostName
+ PyMac_PRECHECK(CFURLCopyHostName);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFURLCopyHostName(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLGetPortNumber(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 _rv;
+#ifndef CFURLGetPortNumber
+ PyMac_PRECHECK(CFURLGetPortNumber);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFURLGetPortNumber(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLCopyUserName(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+#ifndef CFURLCopyUserName
+ PyMac_PRECHECK(CFURLCopyUserName);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFURLCopyUserName(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLCopyPassword(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+#ifndef CFURLCopyPassword
+ PyMac_PRECHECK(CFURLCopyPassword);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFURLCopyPassword(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLCopyParameterString(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ CFStringRef charactersToLeaveEscaped;
+#ifndef CFURLCopyParameterString
+ PyMac_PRECHECK(CFURLCopyParameterString);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFStringRefObj_Convert, &charactersToLeaveEscaped))
+ return NULL;
+ _rv = CFURLCopyParameterString(_self->ob_itself,
+ charactersToLeaveEscaped);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLCopyQueryString(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ CFStringRef charactersToLeaveEscaped;
+#ifndef CFURLCopyQueryString
+ PyMac_PRECHECK(CFURLCopyQueryString);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFStringRefObj_Convert, &charactersToLeaveEscaped))
+ return NULL;
+ _rv = CFURLCopyQueryString(_self->ob_itself,
+ charactersToLeaveEscaped);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLCopyFragment(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ CFStringRef charactersToLeaveEscaped;
+#ifndef CFURLCopyFragment
+ PyMac_PRECHECK(CFURLCopyFragment);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFStringRefObj_Convert, &charactersToLeaveEscaped))
+ return NULL;
+ _rv = CFURLCopyFragment(_self->ob_itself,
+ charactersToLeaveEscaped);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLCopyLastPathComponent(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+#ifndef CFURLCopyLastPathComponent
+ PyMac_PRECHECK(CFURLCopyLastPathComponent);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFURLCopyLastPathComponent(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLCopyPathExtension(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+#ifndef CFURLCopyPathExtension
+ PyMac_PRECHECK(CFURLCopyPathExtension);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFURLCopyPathExtension(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLCreateCopyAppendingPathComponent(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFURLRef _rv;
+ CFStringRef pathComponent;
+ Boolean isDirectory;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CFStringRefObj_Convert, &pathComponent,
+ &isDirectory))
+ return NULL;
+ _rv = CFURLCreateCopyAppendingPathComponent((CFAllocatorRef)NULL,
+ _self->ob_itself,
+ pathComponent,
+ isDirectory);
+ _res = Py_BuildValue("O&",
+ CFURLRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLCreateCopyDeletingLastPathComponent(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFURLRef _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFURLCreateCopyDeletingLastPathComponent((CFAllocatorRef)NULL,
+ _self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CFURLRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLCreateCopyAppendingPathExtension(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFURLRef _rv;
+ CFStringRef extension;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFStringRefObj_Convert, &extension))
+ return NULL;
+ _rv = CFURLCreateCopyAppendingPathExtension((CFAllocatorRef)NULL,
+ _self->ob_itself,
+ extension);
+ _res = Py_BuildValue("O&",
+ CFURLRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLCreateCopyDeletingPathExtension(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFURLRef _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFURLCreateCopyDeletingPathExtension((CFAllocatorRef)NULL,
+ _self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CFURLRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLGetFSRef(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ FSRef fsRef;
+#ifndef CFURLGetFSRef
+ PyMac_PRECHECK(CFURLGetFSRef);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFURLGetFSRef(_self->ob_itself,
+ &fsRef);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildFSRef, &fsRef);
+ return _res;
+}
+
+static PyMethodDef CFURLRefObj_methods[] = {
+ {"CFURLCreateData", (PyCFunction)CFURLRefObj_CFURLCreateData, 1,
+ PyDoc_STR("(CFStringEncoding encoding, Boolean escapeWhitespace) -> (CFDataRef _rv)")},
+ {"CFURLGetFileSystemRepresentation", (PyCFunction)CFURLRefObj_CFURLGetFileSystemRepresentation, 1,
+ PyDoc_STR("(Boolean resolveAgainstBase, CFIndex maxBufLen) -> (Boolean _rv, UInt8 buffer)")},
+ {"CFURLCopyAbsoluteURL", (PyCFunction)CFURLRefObj_CFURLCopyAbsoluteURL, 1,
+ PyDoc_STR("() -> (CFURLRef _rv)")},
+ {"CFURLGetString", (PyCFunction)CFURLRefObj_CFURLGetString, 1,
+ PyDoc_STR("() -> (CFStringRef _rv)")},
+ {"CFURLGetBaseURL", (PyCFunction)CFURLRefObj_CFURLGetBaseURL, 1,
+ PyDoc_STR("() -> (CFURLRef _rv)")},
+ {"CFURLCanBeDecomposed", (PyCFunction)CFURLRefObj_CFURLCanBeDecomposed, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"CFURLCopyScheme", (PyCFunction)CFURLRefObj_CFURLCopyScheme, 1,
+ PyDoc_STR("() -> (CFStringRef _rv)")},
+ {"CFURLCopyNetLocation", (PyCFunction)CFURLRefObj_CFURLCopyNetLocation, 1,
+ PyDoc_STR("() -> (CFStringRef _rv)")},
+ {"CFURLCopyPath", (PyCFunction)CFURLRefObj_CFURLCopyPath, 1,
+ PyDoc_STR("() -> (CFStringRef _rv)")},
+ {"CFURLCopyStrictPath", (PyCFunction)CFURLRefObj_CFURLCopyStrictPath, 1,
+ PyDoc_STR("() -> (CFStringRef _rv, Boolean isAbsolute)")},
+ {"CFURLCopyFileSystemPath", (PyCFunction)CFURLRefObj_CFURLCopyFileSystemPath, 1,
+ PyDoc_STR("(CFURLPathStyle pathStyle) -> (CFStringRef _rv)")},
+ {"CFURLHasDirectoryPath", (PyCFunction)CFURLRefObj_CFURLHasDirectoryPath, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"CFURLCopyResourceSpecifier", (PyCFunction)CFURLRefObj_CFURLCopyResourceSpecifier, 1,
+ PyDoc_STR("() -> (CFStringRef _rv)")},
+ {"CFURLCopyHostName", (PyCFunction)CFURLRefObj_CFURLCopyHostName, 1,
+ PyDoc_STR("() -> (CFStringRef _rv)")},
+ {"CFURLGetPortNumber", (PyCFunction)CFURLRefObj_CFURLGetPortNumber, 1,
+ PyDoc_STR("() -> (SInt32 _rv)")},
+ {"CFURLCopyUserName", (PyCFunction)CFURLRefObj_CFURLCopyUserName, 1,
+ PyDoc_STR("() -> (CFStringRef _rv)")},
+ {"CFURLCopyPassword", (PyCFunction)CFURLRefObj_CFURLCopyPassword, 1,
+ PyDoc_STR("() -> (CFStringRef _rv)")},
+ {"CFURLCopyParameterString", (PyCFunction)CFURLRefObj_CFURLCopyParameterString, 1,
+ PyDoc_STR("(CFStringRef charactersToLeaveEscaped) -> (CFStringRef _rv)")},
+ {"CFURLCopyQueryString", (PyCFunction)CFURLRefObj_CFURLCopyQueryString, 1,
+ PyDoc_STR("(CFStringRef charactersToLeaveEscaped) -> (CFStringRef _rv)")},
+ {"CFURLCopyFragment", (PyCFunction)CFURLRefObj_CFURLCopyFragment, 1,
+ PyDoc_STR("(CFStringRef charactersToLeaveEscaped) -> (CFStringRef _rv)")},
+ {"CFURLCopyLastPathComponent", (PyCFunction)CFURLRefObj_CFURLCopyLastPathComponent, 1,
+ PyDoc_STR("() -> (CFStringRef _rv)")},
+ {"CFURLCopyPathExtension", (PyCFunction)CFURLRefObj_CFURLCopyPathExtension, 1,
+ PyDoc_STR("() -> (CFStringRef _rv)")},
+ {"CFURLCreateCopyAppendingPathComponent", (PyCFunction)CFURLRefObj_CFURLCreateCopyAppendingPathComponent, 1,
+ PyDoc_STR("(CFStringRef pathComponent, Boolean isDirectory) -> (CFURLRef _rv)")},
+ {"CFURLCreateCopyDeletingLastPathComponent", (PyCFunction)CFURLRefObj_CFURLCreateCopyDeletingLastPathComponent, 1,
+ PyDoc_STR("() -> (CFURLRef _rv)")},
+ {"CFURLCreateCopyAppendingPathExtension", (PyCFunction)CFURLRefObj_CFURLCreateCopyAppendingPathExtension, 1,
+ PyDoc_STR("(CFStringRef extension) -> (CFURLRef _rv)")},
+ {"CFURLCreateCopyDeletingPathExtension", (PyCFunction)CFURLRefObj_CFURLCreateCopyDeletingPathExtension, 1,
+ PyDoc_STR("() -> (CFURLRef _rv)")},
+ {"CFURLGetFSRef", (PyCFunction)CFURLRefObj_CFURLGetFSRef, 1,
+ PyDoc_STR("() -> (Boolean _rv, FSRef fsRef)")},
+ {NULL, NULL, 0}
+};
+
+#define CFURLRefObj_getsetlist NULL
+
+
+static int CFURLRefObj_compare(CFURLRefObject *self, CFURLRefObject *other)
+{
+ /* XXXX Or should we use CFEqual?? */
+ if ( self->ob_itself > other->ob_itself ) return 1;
+ if ( self->ob_itself < other->ob_itself ) return -1;
+ return 0;
+}
+
+static PyObject * CFURLRefObj_repr(CFURLRefObject *self)
+{
+ char buf[100];
+ sprintf(buf, "<CFURL object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
+ return PyString_FromString(buf);
+}
+
+static int CFURLRefObj_hash(CFURLRefObject *self)
+{
+ /* XXXX Or should we use CFHash?? */
+ return (int)self->ob_itself;
+}
+static int CFURLRefObj_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds)
+{
+ CFURLRef itself;
+ char *kw[] = {"itself", 0};
+
+ if (PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, CFURLRefObj_Convert, &itself))
+ {
+ ((CFURLRefObject *)_self)->ob_itself = itself;
+ return 0;
+ }
+
+ /* Any CFTypeRef descendent is allowed as initializer too */
+ if (PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, CFTypeRefObj_Convert, &itself))
+ {
+ ((CFURLRefObject *)_self)->ob_itself = itself;
+ return 0;
+ }
+ return -1;
+}
+
+#define CFURLRefObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *CFURLRefObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *self;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((CFURLRefObject *)self)->ob_itself = NULL;
+ ((CFURLRefObject *)self)->ob_freeit = CFRelease;
+ return self;
+}
+
+#define CFURLRefObj_tp_free PyObject_Del
+
+
+PyTypeObject CFURLRef_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_CF.CFURLRef", /*tp_name*/
+ sizeof(CFURLRefObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) CFURLRefObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) CFURLRefObj_compare, /*tp_compare*/
+ (reprfunc) CFURLRefObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) CFURLRefObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ CFURLRefObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ CFURLRefObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ CFURLRefObj_tp_init, /* tp_init */
+ CFURLRefObj_tp_alloc, /* tp_alloc */
+ CFURLRefObj_tp_new, /* tp_new */
+ CFURLRefObj_tp_free, /* tp_free */
+};
+
+/* -------------------- End object type CFURLRef -------------------- */
+
+
+static PyObject *CF___CFRangeMake(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFRange _rv;
+ CFIndex loc;
+ CFIndex len;
+#ifndef __CFRangeMake
+ PyMac_PRECHECK(__CFRangeMake);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &loc,
+ &len))
+ return NULL;
+ _rv = __CFRangeMake(loc,
+ len);
+ _res = Py_BuildValue("O&",
+ CFRange_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFAllocatorGetTypeID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFTypeID _rv;
+#ifndef CFAllocatorGetTypeID
+ PyMac_PRECHECK(CFAllocatorGetTypeID);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFAllocatorGetTypeID();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CF_CFAllocatorGetPreferredSizeForSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFIndex _rv;
+ CFIndex size;
+ CFOptionFlags hint;
+#ifndef CFAllocatorGetPreferredSizeForSize
+ PyMac_PRECHECK(CFAllocatorGetPreferredSizeForSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &size,
+ &hint))
+ return NULL;
+ _rv = CFAllocatorGetPreferredSizeForSize((CFAllocatorRef)NULL,
+ size,
+ hint);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CF_CFCopyTypeIDDescription(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ CFTypeID type_id;
+#ifndef CFCopyTypeIDDescription
+ PyMac_PRECHECK(CFCopyTypeIDDescription);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &type_id))
+ return NULL;
+ _rv = CFCopyTypeIDDescription(type_id);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFArrayGetTypeID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFTypeID _rv;
+#ifndef CFArrayGetTypeID
+ PyMac_PRECHECK(CFArrayGetTypeID);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFArrayGetTypeID();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CF_CFArrayCreateMutable(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFMutableArrayRef _rv;
+ CFIndex capacity;
+#ifndef CFArrayCreateMutable
+ PyMac_PRECHECK(CFArrayCreateMutable);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &capacity))
+ return NULL;
+ _rv = CFArrayCreateMutable((CFAllocatorRef)NULL,
+ capacity,
+ &kCFTypeArrayCallBacks);
+ _res = Py_BuildValue("O&",
+ CFMutableArrayRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFArrayCreateMutableCopy(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFMutableArrayRef _rv;
+ CFIndex capacity;
+ CFArrayRef theArray;
+#ifndef CFArrayCreateMutableCopy
+ PyMac_PRECHECK(CFArrayCreateMutableCopy);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&",
+ &capacity,
+ CFArrayRefObj_Convert, &theArray))
+ return NULL;
+ _rv = CFArrayCreateMutableCopy((CFAllocatorRef)NULL,
+ capacity,
+ theArray);
+ _res = Py_BuildValue("O&",
+ CFMutableArrayRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFDataGetTypeID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFTypeID _rv;
+#ifndef CFDataGetTypeID
+ PyMac_PRECHECK(CFDataGetTypeID);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFDataGetTypeID();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CF_CFDataCreate(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFDataRef _rv;
+ unsigned char *bytes__in__;
+ long bytes__len__;
+ int bytes__in_len__;
+#ifndef CFDataCreate
+ PyMac_PRECHECK(CFDataCreate);
+#endif
+ if (!PyArg_ParseTuple(_args, "s#",
+ &bytes__in__, &bytes__in_len__))
+ return NULL;
+ bytes__len__ = bytes__in_len__;
+ _rv = CFDataCreate((CFAllocatorRef)NULL,
+ bytes__in__, bytes__len__);
+ _res = Py_BuildValue("O&",
+ CFDataRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFDataCreateWithBytesNoCopy(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFDataRef _rv;
+ unsigned char *bytes__in__;
+ long bytes__len__;
+ int bytes__in_len__;
+#ifndef CFDataCreateWithBytesNoCopy
+ PyMac_PRECHECK(CFDataCreateWithBytesNoCopy);
+#endif
+ if (!PyArg_ParseTuple(_args, "s#",
+ &bytes__in__, &bytes__in_len__))
+ return NULL;
+ bytes__len__ = bytes__in_len__;
+ _rv = CFDataCreateWithBytesNoCopy((CFAllocatorRef)NULL,
+ bytes__in__, bytes__len__,
+ (CFAllocatorRef)NULL);
+ _res = Py_BuildValue("O&",
+ CFDataRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFDataCreateMutable(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFMutableDataRef _rv;
+ CFIndex capacity;
+#ifndef CFDataCreateMutable
+ PyMac_PRECHECK(CFDataCreateMutable);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &capacity))
+ return NULL;
+ _rv = CFDataCreateMutable((CFAllocatorRef)NULL,
+ capacity);
+ _res = Py_BuildValue("O&",
+ CFMutableDataRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFDataCreateMutableCopy(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFMutableDataRef _rv;
+ CFIndex capacity;
+ CFDataRef theData;
+#ifndef CFDataCreateMutableCopy
+ PyMac_PRECHECK(CFDataCreateMutableCopy);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&",
+ &capacity,
+ CFDataRefObj_Convert, &theData))
+ return NULL;
+ _rv = CFDataCreateMutableCopy((CFAllocatorRef)NULL,
+ capacity,
+ theData);
+ _res = Py_BuildValue("O&",
+ CFMutableDataRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFDictionaryGetTypeID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFTypeID _rv;
+#ifndef CFDictionaryGetTypeID
+ PyMac_PRECHECK(CFDictionaryGetTypeID);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFDictionaryGetTypeID();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CF_CFDictionaryCreateMutable(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFMutableDictionaryRef _rv;
+ CFIndex capacity;
+#ifndef CFDictionaryCreateMutable
+ PyMac_PRECHECK(CFDictionaryCreateMutable);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &capacity))
+ return NULL;
+ _rv = CFDictionaryCreateMutable((CFAllocatorRef)NULL,
+ capacity,
+ &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
+ _res = Py_BuildValue("O&",
+ CFMutableDictionaryRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFDictionaryCreateMutableCopy(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFMutableDictionaryRef _rv;
+ CFIndex capacity;
+ CFDictionaryRef theDict;
+#ifndef CFDictionaryCreateMutableCopy
+ PyMac_PRECHECK(CFDictionaryCreateMutableCopy);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&",
+ &capacity,
+ CFDictionaryRefObj_Convert, &theDict))
+ return NULL;
+ _rv = CFDictionaryCreateMutableCopy((CFAllocatorRef)NULL,
+ capacity,
+ theDict);
+ _res = Py_BuildValue("O&",
+ CFMutableDictionaryRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFPreferencesCopyAppValue(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFTypeRef _rv;
+ CFStringRef key;
+ CFStringRef applicationID;
+#ifndef CFPreferencesCopyAppValue
+ PyMac_PRECHECK(CFPreferencesCopyAppValue);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CFStringRefObj_Convert, &key,
+ CFStringRefObj_Convert, &applicationID))
+ return NULL;
+ _rv = CFPreferencesCopyAppValue(key,
+ applicationID);
+ _res = Py_BuildValue("O&",
+ CFTypeRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFPreferencesGetAppBooleanValue(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ CFStringRef key;
+ CFStringRef applicationID;
+ Boolean keyExistsAndHasValidFormat;
+#ifndef CFPreferencesGetAppBooleanValue
+ PyMac_PRECHECK(CFPreferencesGetAppBooleanValue);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CFStringRefObj_Convert, &key,
+ CFStringRefObj_Convert, &applicationID))
+ return NULL;
+ _rv = CFPreferencesGetAppBooleanValue(key,
+ applicationID,
+ &keyExistsAndHasValidFormat);
+ _res = Py_BuildValue("ll",
+ _rv,
+ keyExistsAndHasValidFormat);
+ return _res;
+}
+
+static PyObject *CF_CFPreferencesGetAppIntegerValue(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFIndex _rv;
+ CFStringRef key;
+ CFStringRef applicationID;
+ Boolean keyExistsAndHasValidFormat;
+#ifndef CFPreferencesGetAppIntegerValue
+ PyMac_PRECHECK(CFPreferencesGetAppIntegerValue);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CFStringRefObj_Convert, &key,
+ CFStringRefObj_Convert, &applicationID))
+ return NULL;
+ _rv = CFPreferencesGetAppIntegerValue(key,
+ applicationID,
+ &keyExistsAndHasValidFormat);
+ _res = Py_BuildValue("ll",
+ _rv,
+ keyExistsAndHasValidFormat);
+ return _res;
+}
+
+static PyObject *CF_CFPreferencesSetAppValue(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef key;
+ CFTypeRef value;
+ CFStringRef applicationID;
+#ifndef CFPreferencesSetAppValue
+ PyMac_PRECHECK(CFPreferencesSetAppValue);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CFStringRefObj_Convert, &key,
+ CFTypeRefObj_Convert, &value,
+ CFStringRefObj_Convert, &applicationID))
+ return NULL;
+ CFPreferencesSetAppValue(key,
+ value,
+ applicationID);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CF_CFPreferencesAddSuitePreferencesToApp(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef applicationID;
+ CFStringRef suiteID;
+#ifndef CFPreferencesAddSuitePreferencesToApp
+ PyMac_PRECHECK(CFPreferencesAddSuitePreferencesToApp);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CFStringRefObj_Convert, &applicationID,
+ CFStringRefObj_Convert, &suiteID))
+ return NULL;
+ CFPreferencesAddSuitePreferencesToApp(applicationID,
+ suiteID);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CF_CFPreferencesRemoveSuitePreferencesFromApp(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef applicationID;
+ CFStringRef suiteID;
+#ifndef CFPreferencesRemoveSuitePreferencesFromApp
+ PyMac_PRECHECK(CFPreferencesRemoveSuitePreferencesFromApp);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CFStringRefObj_Convert, &applicationID,
+ CFStringRefObj_Convert, &suiteID))
+ return NULL;
+ CFPreferencesRemoveSuitePreferencesFromApp(applicationID,
+ suiteID);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CF_CFPreferencesAppSynchronize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ CFStringRef applicationID;
+#ifndef CFPreferencesAppSynchronize
+ PyMac_PRECHECK(CFPreferencesAppSynchronize);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFStringRefObj_Convert, &applicationID))
+ return NULL;
+ _rv = CFPreferencesAppSynchronize(applicationID);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CF_CFPreferencesCopyValue(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFTypeRef _rv;
+ CFStringRef key;
+ CFStringRef applicationID;
+ CFStringRef userName;
+ CFStringRef hostName;
+#ifndef CFPreferencesCopyValue
+ PyMac_PRECHECK(CFPreferencesCopyValue);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&",
+ CFStringRefObj_Convert, &key,
+ CFStringRefObj_Convert, &applicationID,
+ CFStringRefObj_Convert, &userName,
+ CFStringRefObj_Convert, &hostName))
+ return NULL;
+ _rv = CFPreferencesCopyValue(key,
+ applicationID,
+ userName,
+ hostName);
+ _res = Py_BuildValue("O&",
+ CFTypeRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFPreferencesCopyMultiple(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFDictionaryRef _rv;
+ CFArrayRef keysToFetch;
+ CFStringRef applicationID;
+ CFStringRef userName;
+ CFStringRef hostName;
+#ifndef CFPreferencesCopyMultiple
+ PyMac_PRECHECK(CFPreferencesCopyMultiple);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&",
+ CFArrayRefObj_Convert, &keysToFetch,
+ CFStringRefObj_Convert, &applicationID,
+ CFStringRefObj_Convert, &userName,
+ CFStringRefObj_Convert, &hostName))
+ return NULL;
+ _rv = CFPreferencesCopyMultiple(keysToFetch,
+ applicationID,
+ userName,
+ hostName);
+ _res = Py_BuildValue("O&",
+ CFDictionaryRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFPreferencesSetValue(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef key;
+ CFTypeRef value;
+ CFStringRef applicationID;
+ CFStringRef userName;
+ CFStringRef hostName;
+#ifndef CFPreferencesSetValue
+ PyMac_PRECHECK(CFPreferencesSetValue);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&O&",
+ CFStringRefObj_Convert, &key,
+ CFTypeRefObj_Convert, &value,
+ CFStringRefObj_Convert, &applicationID,
+ CFStringRefObj_Convert, &userName,
+ CFStringRefObj_Convert, &hostName))
+ return NULL;
+ CFPreferencesSetValue(key,
+ value,
+ applicationID,
+ userName,
+ hostName);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CF_CFPreferencesSetMultiple(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFDictionaryRef keysToSet;
+ CFArrayRef keysToRemove;
+ CFStringRef applicationID;
+ CFStringRef userName;
+ CFStringRef hostName;
+#ifndef CFPreferencesSetMultiple
+ PyMac_PRECHECK(CFPreferencesSetMultiple);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&O&",
+ CFDictionaryRefObj_Convert, &keysToSet,
+ CFArrayRefObj_Convert, &keysToRemove,
+ CFStringRefObj_Convert, &applicationID,
+ CFStringRefObj_Convert, &userName,
+ CFStringRefObj_Convert, &hostName))
+ return NULL;
+ CFPreferencesSetMultiple(keysToSet,
+ keysToRemove,
+ applicationID,
+ userName,
+ hostName);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CF_CFPreferencesSynchronize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ CFStringRef applicationID;
+ CFStringRef userName;
+ CFStringRef hostName;
+#ifndef CFPreferencesSynchronize
+ PyMac_PRECHECK(CFPreferencesSynchronize);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CFStringRefObj_Convert, &applicationID,
+ CFStringRefObj_Convert, &userName,
+ CFStringRefObj_Convert, &hostName))
+ return NULL;
+ _rv = CFPreferencesSynchronize(applicationID,
+ userName,
+ hostName);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CF_CFPreferencesCopyApplicationList(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFArrayRef _rv;
+ CFStringRef userName;
+ CFStringRef hostName;
+#ifndef CFPreferencesCopyApplicationList
+ PyMac_PRECHECK(CFPreferencesCopyApplicationList);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CFStringRefObj_Convert, &userName,
+ CFStringRefObj_Convert, &hostName))
+ return NULL;
+ _rv = CFPreferencesCopyApplicationList(userName,
+ hostName);
+ _res = Py_BuildValue("O&",
+ CFArrayRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFPreferencesCopyKeyList(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFArrayRef _rv;
+ CFStringRef applicationID;
+ CFStringRef userName;
+ CFStringRef hostName;
+#ifndef CFPreferencesCopyKeyList
+ PyMac_PRECHECK(CFPreferencesCopyKeyList);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CFStringRefObj_Convert, &applicationID,
+ CFStringRefObj_Convert, &userName,
+ CFStringRefObj_Convert, &hostName))
+ return NULL;
+ _rv = CFPreferencesCopyKeyList(applicationID,
+ userName,
+ hostName);
+ _res = Py_BuildValue("O&",
+ CFArrayRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFStringGetTypeID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFTypeID _rv;
+#ifndef CFStringGetTypeID
+ PyMac_PRECHECK(CFStringGetTypeID);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFStringGetTypeID();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CF_CFStringCreateWithPascalString(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ Str255 pStr;
+ CFStringEncoding encoding;
+#ifndef CFStringCreateWithPascalString
+ PyMac_PRECHECK(CFStringCreateWithPascalString);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetStr255, pStr,
+ &encoding))
+ return NULL;
+ _rv = CFStringCreateWithPascalString((CFAllocatorRef)NULL,
+ pStr,
+ encoding);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFStringCreateWithCString(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ char* cStr;
+ CFStringEncoding encoding;
+#ifndef CFStringCreateWithCString
+ PyMac_PRECHECK(CFStringCreateWithCString);
+#endif
+ if (!PyArg_ParseTuple(_args, "sl",
+ &cStr,
+ &encoding))
+ return NULL;
+ _rv = CFStringCreateWithCString((CFAllocatorRef)NULL,
+ cStr,
+ encoding);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFStringCreateWithCharacters(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ UniChar *chars__in__;
+ UniCharCount chars__len__;
+ int chars__in_len__;
+#ifndef CFStringCreateWithCharacters
+ PyMac_PRECHECK(CFStringCreateWithCharacters);
+#endif
+ if (!PyArg_ParseTuple(_args, "u#",
+ &chars__in__, &chars__in_len__))
+ return NULL;
+ chars__len__ = chars__in_len__;
+ _rv = CFStringCreateWithCharacters((CFAllocatorRef)NULL,
+ chars__in__, chars__len__);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFStringCreateWithPascalStringNoCopy(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ Str255 pStr;
+ CFStringEncoding encoding;
+#ifndef CFStringCreateWithPascalStringNoCopy
+ PyMac_PRECHECK(CFStringCreateWithPascalStringNoCopy);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetStr255, pStr,
+ &encoding))
+ return NULL;
+ _rv = CFStringCreateWithPascalStringNoCopy((CFAllocatorRef)NULL,
+ pStr,
+ encoding,
+ (CFAllocatorRef)NULL);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFStringCreateWithCStringNoCopy(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ char* cStr;
+ CFStringEncoding encoding;
+#ifndef CFStringCreateWithCStringNoCopy
+ PyMac_PRECHECK(CFStringCreateWithCStringNoCopy);
+#endif
+ if (!PyArg_ParseTuple(_args, "sl",
+ &cStr,
+ &encoding))
+ return NULL;
+ _rv = CFStringCreateWithCStringNoCopy((CFAllocatorRef)NULL,
+ cStr,
+ encoding,
+ (CFAllocatorRef)NULL);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFStringCreateWithCharactersNoCopy(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ UniChar *chars__in__;
+ UniCharCount chars__len__;
+ int chars__in_len__;
+#ifndef CFStringCreateWithCharactersNoCopy
+ PyMac_PRECHECK(CFStringCreateWithCharactersNoCopy);
+#endif
+ if (!PyArg_ParseTuple(_args, "u#",
+ &chars__in__, &chars__in_len__))
+ return NULL;
+ chars__len__ = chars__in_len__;
+ _rv = CFStringCreateWithCharactersNoCopy((CFAllocatorRef)NULL,
+ chars__in__, chars__len__,
+ (CFAllocatorRef)NULL);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFStringCreateMutable(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFMutableStringRef _rv;
+ CFIndex maxLength;
+#ifndef CFStringCreateMutable
+ PyMac_PRECHECK(CFStringCreateMutable);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &maxLength))
+ return NULL;
+ _rv = CFStringCreateMutable((CFAllocatorRef)NULL,
+ maxLength);
+ _res = Py_BuildValue("O&",
+ CFMutableStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFStringCreateMutableCopy(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFMutableStringRef _rv;
+ CFIndex maxLength;
+ CFStringRef theString;
+#ifndef CFStringCreateMutableCopy
+ PyMac_PRECHECK(CFStringCreateMutableCopy);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&",
+ &maxLength,
+ CFStringRefObj_Convert, &theString))
+ return NULL;
+ _rv = CFStringCreateMutableCopy((CFAllocatorRef)NULL,
+ maxLength,
+ theString);
+ _res = Py_BuildValue("O&",
+ CFMutableStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFStringCreateWithBytes(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ unsigned char *bytes__in__;
+ long bytes__len__;
+ int bytes__in_len__;
+ CFStringEncoding encoding;
+ Boolean isExternalRepresentation;
+#ifndef CFStringCreateWithBytes
+ PyMac_PRECHECK(CFStringCreateWithBytes);
+#endif
+ if (!PyArg_ParseTuple(_args, "s#ll",
+ &bytes__in__, &bytes__in_len__,
+ &encoding,
+ &isExternalRepresentation))
+ return NULL;
+ bytes__len__ = bytes__in_len__;
+ _rv = CFStringCreateWithBytes((CFAllocatorRef)NULL,
+ bytes__in__, bytes__len__,
+ encoding,
+ isExternalRepresentation);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFStringGetSystemEncoding(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringEncoding _rv;
+#ifndef CFStringGetSystemEncoding
+ PyMac_PRECHECK(CFStringGetSystemEncoding);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFStringGetSystemEncoding();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CF_CFStringGetMaximumSizeForEncoding(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFIndex _rv;
+ CFIndex length;
+ CFStringEncoding encoding;
+#ifndef CFStringGetMaximumSizeForEncoding
+ PyMac_PRECHECK(CFStringGetMaximumSizeForEncoding);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &length,
+ &encoding))
+ return NULL;
+ _rv = CFStringGetMaximumSizeForEncoding(length,
+ encoding);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CF_CFStringIsEncodingAvailable(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ CFStringEncoding encoding;
+#ifndef CFStringIsEncodingAvailable
+ PyMac_PRECHECK(CFStringIsEncodingAvailable);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &encoding))
+ return NULL;
+ _rv = CFStringIsEncodingAvailable(encoding);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CF_CFStringGetNameOfEncoding(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ CFStringEncoding encoding;
+#ifndef CFStringGetNameOfEncoding
+ PyMac_PRECHECK(CFStringGetNameOfEncoding);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &encoding))
+ return NULL;
+ _rv = CFStringGetNameOfEncoding(encoding);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFStringConvertEncodingToNSStringEncoding(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UInt32 _rv;
+ CFStringEncoding encoding;
+#ifndef CFStringConvertEncodingToNSStringEncoding
+ PyMac_PRECHECK(CFStringConvertEncodingToNSStringEncoding);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &encoding))
+ return NULL;
+ _rv = CFStringConvertEncodingToNSStringEncoding(encoding);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CF_CFStringConvertNSStringEncodingToEncoding(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringEncoding _rv;
+ UInt32 encoding;
+#ifndef CFStringConvertNSStringEncodingToEncoding
+ PyMac_PRECHECK(CFStringConvertNSStringEncodingToEncoding);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &encoding))
+ return NULL;
+ _rv = CFStringConvertNSStringEncodingToEncoding(encoding);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CF_CFStringConvertEncodingToWindowsCodepage(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UInt32 _rv;
+ CFStringEncoding encoding;
+#ifndef CFStringConvertEncodingToWindowsCodepage
+ PyMac_PRECHECK(CFStringConvertEncodingToWindowsCodepage);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &encoding))
+ return NULL;
+ _rv = CFStringConvertEncodingToWindowsCodepage(encoding);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CF_CFStringConvertWindowsCodepageToEncoding(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringEncoding _rv;
+ UInt32 codepage;
+#ifndef CFStringConvertWindowsCodepageToEncoding
+ PyMac_PRECHECK(CFStringConvertWindowsCodepageToEncoding);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &codepage))
+ return NULL;
+ _rv = CFStringConvertWindowsCodepageToEncoding(codepage);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CF_CFStringConvertEncodingToIANACharSetName(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ CFStringEncoding encoding;
+#ifndef CFStringConvertEncodingToIANACharSetName
+ PyMac_PRECHECK(CFStringConvertEncodingToIANACharSetName);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &encoding))
+ return NULL;
+ _rv = CFStringConvertEncodingToIANACharSetName(encoding);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFStringGetMostCompatibleMacStringEncoding(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringEncoding _rv;
+ CFStringEncoding encoding;
+#ifndef CFStringGetMostCompatibleMacStringEncoding
+ PyMac_PRECHECK(CFStringGetMostCompatibleMacStringEncoding);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &encoding))
+ return NULL;
+ _rv = CFStringGetMostCompatibleMacStringEncoding(encoding);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CF___CFStringMakeConstantString(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ char* cStr;
+#ifndef __CFStringMakeConstantString
+ PyMac_PRECHECK(__CFStringMakeConstantString);
+#endif
+ if (!PyArg_ParseTuple(_args, "s",
+ &cStr))
+ return NULL;
+ _rv = __CFStringMakeConstantString(cStr);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFURLGetTypeID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFTypeID _rv;
+#ifndef CFURLGetTypeID
+ PyMac_PRECHECK(CFURLGetTypeID);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFURLGetTypeID();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CF_CFURLCreateWithBytes(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFURLRef _rv;
+ unsigned char *URLBytes__in__;
+ long URLBytes__len__;
+ int URLBytes__in_len__;
+ CFStringEncoding encoding;
+ CFURLRef baseURL;
+#ifndef CFURLCreateWithBytes
+ PyMac_PRECHECK(CFURLCreateWithBytes);
+#endif
+ if (!PyArg_ParseTuple(_args, "s#lO&",
+ &URLBytes__in__, &URLBytes__in_len__,
+ &encoding,
+ OptionalCFURLRefObj_Convert, &baseURL))
+ return NULL;
+ URLBytes__len__ = URLBytes__in_len__;
+ _rv = CFURLCreateWithBytes((CFAllocatorRef)NULL,
+ URLBytes__in__, URLBytes__len__,
+ encoding,
+ baseURL);
+ _res = Py_BuildValue("O&",
+ CFURLRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFURLCreateFromFileSystemRepresentation(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFURLRef _rv;
+ unsigned char *buffer__in__;
+ long buffer__len__;
+ int buffer__in_len__;
+ Boolean isDirectory;
+#ifndef CFURLCreateFromFileSystemRepresentation
+ PyMac_PRECHECK(CFURLCreateFromFileSystemRepresentation);
+#endif
+ if (!PyArg_ParseTuple(_args, "s#l",
+ &buffer__in__, &buffer__in_len__,
+ &isDirectory))
+ return NULL;
+ buffer__len__ = buffer__in_len__;
+ _rv = CFURLCreateFromFileSystemRepresentation((CFAllocatorRef)NULL,
+ buffer__in__, buffer__len__,
+ isDirectory);
+ _res = Py_BuildValue("O&",
+ CFURLRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFURLCreateFromFileSystemRepresentationRelativeToBase(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFURLRef _rv;
+ unsigned char *buffer__in__;
+ long buffer__len__;
+ int buffer__in_len__;
+ Boolean isDirectory;
+ CFURLRef baseURL;
+#ifndef CFURLCreateFromFileSystemRepresentationRelativeToBase
+ PyMac_PRECHECK(CFURLCreateFromFileSystemRepresentationRelativeToBase);
+#endif
+ if (!PyArg_ParseTuple(_args, "s#lO&",
+ &buffer__in__, &buffer__in_len__,
+ &isDirectory,
+ OptionalCFURLRefObj_Convert, &baseURL))
+ return NULL;
+ buffer__len__ = buffer__in_len__;
+ _rv = CFURLCreateFromFileSystemRepresentationRelativeToBase((CFAllocatorRef)NULL,
+ buffer__in__, buffer__len__,
+ isDirectory,
+ baseURL);
+ _res = Py_BuildValue("O&",
+ CFURLRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFURLCreateFromFSRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFURLRef _rv;
+ FSRef fsRef;
+#ifndef CFURLCreateFromFSRef
+ PyMac_PRECHECK(CFURLCreateFromFSRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetFSRef, &fsRef))
+ return NULL;
+ _rv = CFURLCreateFromFSRef((CFAllocatorRef)NULL,
+ &fsRef);
+ _res = Py_BuildValue("O&",
+ CFURLRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_toCF(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ CFTypeRef rv;
+ CFTypeID typeid;
+
+ if (!PyArg_ParseTuple(_args, "O&", PyCF_Python2CF, &rv))
+ return NULL;
+ typeid = CFGetTypeID(rv);
+
+ if (typeid == CFStringGetTypeID())
+ return Py_BuildValue("O&", CFStringRefObj_New, rv);
+ if (typeid == CFArrayGetTypeID())
+ return Py_BuildValue("O&", CFArrayRefObj_New, rv);
+ if (typeid == CFDictionaryGetTypeID())
+ return Py_BuildValue("O&", CFDictionaryRefObj_New, rv);
+ if (typeid == CFURLGetTypeID())
+ return Py_BuildValue("O&", CFURLRefObj_New, rv);
+
+ _res = Py_BuildValue("O&", CFTypeRefObj_New, rv);
+ return _res;
+
+}
+
+static PyMethodDef CF_methods[] = {
+ {"__CFRangeMake", (PyCFunction)CF___CFRangeMake, 1,
+ PyDoc_STR("(CFIndex loc, CFIndex len) -> (CFRange _rv)")},
+ {"CFAllocatorGetTypeID", (PyCFunction)CF_CFAllocatorGetTypeID, 1,
+ PyDoc_STR("() -> (CFTypeID _rv)")},
+ {"CFAllocatorGetPreferredSizeForSize", (PyCFunction)CF_CFAllocatorGetPreferredSizeForSize, 1,
+ PyDoc_STR("(CFIndex size, CFOptionFlags hint) -> (CFIndex _rv)")},
+ {"CFCopyTypeIDDescription", (PyCFunction)CF_CFCopyTypeIDDescription, 1,
+ PyDoc_STR("(CFTypeID type_id) -> (CFStringRef _rv)")},
+ {"CFArrayGetTypeID", (PyCFunction)CF_CFArrayGetTypeID, 1,
+ PyDoc_STR("() -> (CFTypeID _rv)")},
+ {"CFArrayCreateMutable", (PyCFunction)CF_CFArrayCreateMutable, 1,
+ PyDoc_STR("(CFIndex capacity) -> (CFMutableArrayRef _rv)")},
+ {"CFArrayCreateMutableCopy", (PyCFunction)CF_CFArrayCreateMutableCopy, 1,
+ PyDoc_STR("(CFIndex capacity, CFArrayRef theArray) -> (CFMutableArrayRef _rv)")},
+ {"CFDataGetTypeID", (PyCFunction)CF_CFDataGetTypeID, 1,
+ PyDoc_STR("() -> (CFTypeID _rv)")},
+ {"CFDataCreate", (PyCFunction)CF_CFDataCreate, 1,
+ PyDoc_STR("(Buffer bytes) -> (CFDataRef _rv)")},
+ {"CFDataCreateWithBytesNoCopy", (PyCFunction)CF_CFDataCreateWithBytesNoCopy, 1,
+ PyDoc_STR("(Buffer bytes) -> (CFDataRef _rv)")},
+ {"CFDataCreateMutable", (PyCFunction)CF_CFDataCreateMutable, 1,
+ PyDoc_STR("(CFIndex capacity) -> (CFMutableDataRef _rv)")},
+ {"CFDataCreateMutableCopy", (PyCFunction)CF_CFDataCreateMutableCopy, 1,
+ PyDoc_STR("(CFIndex capacity, CFDataRef theData) -> (CFMutableDataRef _rv)")},
+ {"CFDictionaryGetTypeID", (PyCFunction)CF_CFDictionaryGetTypeID, 1,
+ PyDoc_STR("() -> (CFTypeID _rv)")},
+ {"CFDictionaryCreateMutable", (PyCFunction)CF_CFDictionaryCreateMutable, 1,
+ PyDoc_STR("(CFIndex capacity) -> (CFMutableDictionaryRef _rv)")},
+ {"CFDictionaryCreateMutableCopy", (PyCFunction)CF_CFDictionaryCreateMutableCopy, 1,
+ PyDoc_STR("(CFIndex capacity, CFDictionaryRef theDict) -> (CFMutableDictionaryRef _rv)")},
+ {"CFPreferencesCopyAppValue", (PyCFunction)CF_CFPreferencesCopyAppValue, 1,
+ PyDoc_STR("(CFStringRef key, CFStringRef applicationID) -> (CFTypeRef _rv)")},
+ {"CFPreferencesGetAppBooleanValue", (PyCFunction)CF_CFPreferencesGetAppBooleanValue, 1,
+ PyDoc_STR("(CFStringRef key, CFStringRef applicationID) -> (Boolean _rv, Boolean keyExistsAndHasValidFormat)")},
+ {"CFPreferencesGetAppIntegerValue", (PyCFunction)CF_CFPreferencesGetAppIntegerValue, 1,
+ PyDoc_STR("(CFStringRef key, CFStringRef applicationID) -> (CFIndex _rv, Boolean keyExistsAndHasValidFormat)")},
+ {"CFPreferencesSetAppValue", (PyCFunction)CF_CFPreferencesSetAppValue, 1,
+ PyDoc_STR("(CFStringRef key, CFTypeRef value, CFStringRef applicationID) -> None")},
+ {"CFPreferencesAddSuitePreferencesToApp", (PyCFunction)CF_CFPreferencesAddSuitePreferencesToApp, 1,
+ PyDoc_STR("(CFStringRef applicationID, CFStringRef suiteID) -> None")},
+ {"CFPreferencesRemoveSuitePreferencesFromApp", (PyCFunction)CF_CFPreferencesRemoveSuitePreferencesFromApp, 1,
+ PyDoc_STR("(CFStringRef applicationID, CFStringRef suiteID) -> None")},
+ {"CFPreferencesAppSynchronize", (PyCFunction)CF_CFPreferencesAppSynchronize, 1,
+ PyDoc_STR("(CFStringRef applicationID) -> (Boolean _rv)")},
+ {"CFPreferencesCopyValue", (PyCFunction)CF_CFPreferencesCopyValue, 1,
+ PyDoc_STR("(CFStringRef key, CFStringRef applicationID, CFStringRef userName, CFStringRef hostName) -> (CFTypeRef _rv)")},
+ {"CFPreferencesCopyMultiple", (PyCFunction)CF_CFPreferencesCopyMultiple, 1,
+ PyDoc_STR("(CFArrayRef keysToFetch, CFStringRef applicationID, CFStringRef userName, CFStringRef hostName) -> (CFDictionaryRef _rv)")},
+ {"CFPreferencesSetValue", (PyCFunction)CF_CFPreferencesSetValue, 1,
+ PyDoc_STR("(CFStringRef key, CFTypeRef value, CFStringRef applicationID, CFStringRef userName, CFStringRef hostName) -> None")},
+ {"CFPreferencesSetMultiple", (PyCFunction)CF_CFPreferencesSetMultiple, 1,
+ PyDoc_STR("(CFDictionaryRef keysToSet, CFArrayRef keysToRemove, CFStringRef applicationID, CFStringRef userName, CFStringRef hostName) -> None")},
+ {"CFPreferencesSynchronize", (PyCFunction)CF_CFPreferencesSynchronize, 1,
+ PyDoc_STR("(CFStringRef applicationID, CFStringRef userName, CFStringRef hostName) -> (Boolean _rv)")},
+ {"CFPreferencesCopyApplicationList", (PyCFunction)CF_CFPreferencesCopyApplicationList, 1,
+ PyDoc_STR("(CFStringRef userName, CFStringRef hostName) -> (CFArrayRef _rv)")},
+ {"CFPreferencesCopyKeyList", (PyCFunction)CF_CFPreferencesCopyKeyList, 1,
+ PyDoc_STR("(CFStringRef applicationID, CFStringRef userName, CFStringRef hostName) -> (CFArrayRef _rv)")},
+ {"CFStringGetTypeID", (PyCFunction)CF_CFStringGetTypeID, 1,
+ PyDoc_STR("() -> (CFTypeID _rv)")},
+ {"CFStringCreateWithPascalString", (PyCFunction)CF_CFStringCreateWithPascalString, 1,
+ PyDoc_STR("(Str255 pStr, CFStringEncoding encoding) -> (CFStringRef _rv)")},
+ {"CFStringCreateWithCString", (PyCFunction)CF_CFStringCreateWithCString, 1,
+ PyDoc_STR("(char* cStr, CFStringEncoding encoding) -> (CFStringRef _rv)")},
+ {"CFStringCreateWithCharacters", (PyCFunction)CF_CFStringCreateWithCharacters, 1,
+ PyDoc_STR("(Buffer chars) -> (CFStringRef _rv)")},
+ {"CFStringCreateWithPascalStringNoCopy", (PyCFunction)CF_CFStringCreateWithPascalStringNoCopy, 1,
+ PyDoc_STR("(Str255 pStr, CFStringEncoding encoding) -> (CFStringRef _rv)")},
+ {"CFStringCreateWithCStringNoCopy", (PyCFunction)CF_CFStringCreateWithCStringNoCopy, 1,
+ PyDoc_STR("(char* cStr, CFStringEncoding encoding) -> (CFStringRef _rv)")},
+ {"CFStringCreateWithCharactersNoCopy", (PyCFunction)CF_CFStringCreateWithCharactersNoCopy, 1,
+ PyDoc_STR("(Buffer chars) -> (CFStringRef _rv)")},
+ {"CFStringCreateMutable", (PyCFunction)CF_CFStringCreateMutable, 1,
+ PyDoc_STR("(CFIndex maxLength) -> (CFMutableStringRef _rv)")},
+ {"CFStringCreateMutableCopy", (PyCFunction)CF_CFStringCreateMutableCopy, 1,
+ PyDoc_STR("(CFIndex maxLength, CFStringRef theString) -> (CFMutableStringRef _rv)")},
+ {"CFStringCreateWithBytes", (PyCFunction)CF_CFStringCreateWithBytes, 1,
+ PyDoc_STR("(Buffer bytes, CFStringEncoding encoding, Boolean isExternalRepresentation) -> (CFStringRef _rv)")},
+ {"CFStringGetSystemEncoding", (PyCFunction)CF_CFStringGetSystemEncoding, 1,
+ PyDoc_STR("() -> (CFStringEncoding _rv)")},
+ {"CFStringGetMaximumSizeForEncoding", (PyCFunction)CF_CFStringGetMaximumSizeForEncoding, 1,
+ PyDoc_STR("(CFIndex length, CFStringEncoding encoding) -> (CFIndex _rv)")},
+ {"CFStringIsEncodingAvailable", (PyCFunction)CF_CFStringIsEncodingAvailable, 1,
+ PyDoc_STR("(CFStringEncoding encoding) -> (Boolean _rv)")},
+ {"CFStringGetNameOfEncoding", (PyCFunction)CF_CFStringGetNameOfEncoding, 1,
+ PyDoc_STR("(CFStringEncoding encoding) -> (CFStringRef _rv)")},
+ {"CFStringConvertEncodingToNSStringEncoding", (PyCFunction)CF_CFStringConvertEncodingToNSStringEncoding, 1,
+ PyDoc_STR("(CFStringEncoding encoding) -> (UInt32 _rv)")},
+ {"CFStringConvertNSStringEncodingToEncoding", (PyCFunction)CF_CFStringConvertNSStringEncodingToEncoding, 1,
+ PyDoc_STR("(UInt32 encoding) -> (CFStringEncoding _rv)")},
+ {"CFStringConvertEncodingToWindowsCodepage", (PyCFunction)CF_CFStringConvertEncodingToWindowsCodepage, 1,
+ PyDoc_STR("(CFStringEncoding encoding) -> (UInt32 _rv)")},
+ {"CFStringConvertWindowsCodepageToEncoding", (PyCFunction)CF_CFStringConvertWindowsCodepageToEncoding, 1,
+ PyDoc_STR("(UInt32 codepage) -> (CFStringEncoding _rv)")},
+ {"CFStringConvertEncodingToIANACharSetName", (PyCFunction)CF_CFStringConvertEncodingToIANACharSetName, 1,
+ PyDoc_STR("(CFStringEncoding encoding) -> (CFStringRef _rv)")},
+ {"CFStringGetMostCompatibleMacStringEncoding", (PyCFunction)CF_CFStringGetMostCompatibleMacStringEncoding, 1,
+ PyDoc_STR("(CFStringEncoding encoding) -> (CFStringEncoding _rv)")},
+ {"__CFStringMakeConstantString", (PyCFunction)CF___CFStringMakeConstantString, 1,
+ PyDoc_STR("(char* cStr) -> (CFStringRef _rv)")},
+ {"CFURLGetTypeID", (PyCFunction)CF_CFURLGetTypeID, 1,
+ PyDoc_STR("() -> (CFTypeID _rv)")},
+ {"CFURLCreateWithBytes", (PyCFunction)CF_CFURLCreateWithBytes, 1,
+ PyDoc_STR("(Buffer URLBytes, CFStringEncoding encoding, CFURLRef baseURL) -> (CFURLRef _rv)")},
+ {"CFURLCreateFromFileSystemRepresentation", (PyCFunction)CF_CFURLCreateFromFileSystemRepresentation, 1,
+ PyDoc_STR("(Buffer buffer, Boolean isDirectory) -> (CFURLRef _rv)")},
+ {"CFURLCreateFromFileSystemRepresentationRelativeToBase", (PyCFunction)CF_CFURLCreateFromFileSystemRepresentationRelativeToBase, 1,
+ PyDoc_STR("(Buffer buffer, Boolean isDirectory, CFURLRef baseURL) -> (CFURLRef _rv)")},
+ {"CFURLCreateFromFSRef", (PyCFunction)CF_CFURLCreateFromFSRef, 1,
+ PyDoc_STR("(FSRef fsRef) -> (CFURLRef _rv)")},
+ {"toCF", (PyCFunction)CF_toCF, 1,
+ PyDoc_STR("(python_object) -> (CF_object)")},
+ {NULL, NULL, 0}
+};
+
+
+
+
+/* Routines to convert any CF type to/from the corresponding CFxxxObj */
+PyObject *CFObj_New(CFTypeRef itself)
+{
+ if (itself == NULL)
+ {
+ PyErr_SetString(PyExc_RuntimeError, "cannot wrap NULL");
+ return NULL;
+ }
+ if (CFGetTypeID(itself) == CFArrayGetTypeID()) return CFArrayRefObj_New((CFArrayRef)itself);
+ if (CFGetTypeID(itself) == CFDictionaryGetTypeID()) return CFDictionaryRefObj_New((CFDictionaryRef)itself);
+ if (CFGetTypeID(itself) == CFDataGetTypeID()) return CFDataRefObj_New((CFDataRef)itself);
+ if (CFGetTypeID(itself) == CFStringGetTypeID()) return CFStringRefObj_New((CFStringRef)itself);
+ if (CFGetTypeID(itself) == CFURLGetTypeID()) return CFURLRefObj_New((CFURLRef)itself);
+ /* XXXX Or should we use PyCF_CF2Python here?? */
+ return CFTypeRefObj_New(itself);
+}
+int CFObj_Convert(PyObject *v, CFTypeRef *p_itself)
+{
+
+ if (v == Py_None) { *p_itself = NULL; return 1; }
+ /* Check for other CF objects here */
+
+ if (!CFTypeRefObj_Check(v) &&
+ !CFArrayRefObj_Check(v) &&
+ !CFMutableArrayRefObj_Check(v) &&
+ !CFDictionaryRefObj_Check(v) &&
+ !CFMutableDictionaryRefObj_Check(v) &&
+ !CFDataRefObj_Check(v) &&
+ !CFMutableDataRefObj_Check(v) &&
+ !CFStringRefObj_Check(v) &&
+ !CFMutableStringRefObj_Check(v) &&
+ !CFURLRefObj_Check(v) )
+ {
+ /* XXXX Or should we use PyCF_Python2CF here?? */
+ PyErr_SetString(PyExc_TypeError, "CF object required");
+ return 0;
+ }
+ *p_itself = ((CFTypeRefObject *)v)->ob_itself;
+ return 1;
+}
+
+
+void init_CF(void)
+{
+ PyObject *m;
+ PyObject *d;
+
+
+
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(CFTypeRef, CFObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CFTypeRef, CFObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(CFTypeRef, CFTypeRefObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CFTypeRef, CFTypeRefObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(CFStringRef, CFStringRefObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CFStringRef, CFStringRefObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(CFMutableStringRef, CFMutableStringRefObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CFMutableStringRef, CFMutableStringRefObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(CFArrayRef, CFArrayRefObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CFArrayRef, CFArrayRefObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(CFMutableArrayRef, CFMutableArrayRefObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CFMutableArrayRef, CFMutableArrayRefObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(CFDictionaryRef, CFDictionaryRefObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CFDictionaryRef, CFDictionaryRefObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(CFMutableDictionaryRef, CFMutableDictionaryRefObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CFMutableDictionaryRef, CFMutableDictionaryRefObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(CFURLRef, CFURLRefObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CFURLRef, CFURLRefObj_Convert);
+
+
+ m = Py_InitModule("_CF", CF_methods);
+ d = PyModule_GetDict(m);
+ CF_Error = PyMac_GetOSErrException();
+ if (CF_Error == NULL ||
+ PyDict_SetItemString(d, "Error", CF_Error) != 0)
+ return;
+ CFTypeRef_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&CFTypeRef_Type) < 0) return;
+ Py_INCREF(&CFTypeRef_Type);
+ PyModule_AddObject(m, "CFTypeRef", (PyObject *)&CFTypeRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&CFTypeRef_Type);
+ PyModule_AddObject(m, "CFTypeRefType", (PyObject *)&CFTypeRef_Type);
+ CFArrayRef_Type.ob_type = &PyType_Type;
+ CFArrayRef_Type.tp_base = &CFTypeRef_Type;
+ if (PyType_Ready(&CFArrayRef_Type) < 0) return;
+ Py_INCREF(&CFArrayRef_Type);
+ PyModule_AddObject(m, "CFArrayRef", (PyObject *)&CFArrayRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&CFArrayRef_Type);
+ PyModule_AddObject(m, "CFArrayRefType", (PyObject *)&CFArrayRef_Type);
+ CFMutableArrayRef_Type.ob_type = &PyType_Type;
+ CFMutableArrayRef_Type.tp_base = &CFArrayRef_Type;
+ if (PyType_Ready(&CFMutableArrayRef_Type) < 0) return;
+ Py_INCREF(&CFMutableArrayRef_Type);
+ PyModule_AddObject(m, "CFMutableArrayRef", (PyObject *)&CFMutableArrayRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&CFMutableArrayRef_Type);
+ PyModule_AddObject(m, "CFMutableArrayRefType", (PyObject *)&CFMutableArrayRef_Type);
+ CFDictionaryRef_Type.ob_type = &PyType_Type;
+ CFDictionaryRef_Type.tp_base = &CFTypeRef_Type;
+ if (PyType_Ready(&CFDictionaryRef_Type) < 0) return;
+ Py_INCREF(&CFDictionaryRef_Type);
+ PyModule_AddObject(m, "CFDictionaryRef", (PyObject *)&CFDictionaryRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&CFDictionaryRef_Type);
+ PyModule_AddObject(m, "CFDictionaryRefType", (PyObject *)&CFDictionaryRef_Type);
+ CFMutableDictionaryRef_Type.ob_type = &PyType_Type;
+ CFMutableDictionaryRef_Type.tp_base = &CFDictionaryRef_Type;
+ if (PyType_Ready(&CFMutableDictionaryRef_Type) < 0) return;
+ Py_INCREF(&CFMutableDictionaryRef_Type);
+ PyModule_AddObject(m, "CFMutableDictionaryRef", (PyObject *)&CFMutableDictionaryRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&CFMutableDictionaryRef_Type);
+ PyModule_AddObject(m, "CFMutableDictionaryRefType", (PyObject *)&CFMutableDictionaryRef_Type);
+ CFDataRef_Type.ob_type = &PyType_Type;
+ CFDataRef_Type.tp_base = &CFTypeRef_Type;
+ if (PyType_Ready(&CFDataRef_Type) < 0) return;
+ Py_INCREF(&CFDataRef_Type);
+ PyModule_AddObject(m, "CFDataRef", (PyObject *)&CFDataRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&CFDataRef_Type);
+ PyModule_AddObject(m, "CFDataRefType", (PyObject *)&CFDataRef_Type);
+ CFMutableDataRef_Type.ob_type = &PyType_Type;
+ CFMutableDataRef_Type.tp_base = &CFDataRef_Type;
+ if (PyType_Ready(&CFMutableDataRef_Type) < 0) return;
+ Py_INCREF(&CFMutableDataRef_Type);
+ PyModule_AddObject(m, "CFMutableDataRef", (PyObject *)&CFMutableDataRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&CFMutableDataRef_Type);
+ PyModule_AddObject(m, "CFMutableDataRefType", (PyObject *)&CFMutableDataRef_Type);
+ CFStringRef_Type.ob_type = &PyType_Type;
+ CFStringRef_Type.tp_base = &CFTypeRef_Type;
+ if (PyType_Ready(&CFStringRef_Type) < 0) return;
+ Py_INCREF(&CFStringRef_Type);
+ PyModule_AddObject(m, "CFStringRef", (PyObject *)&CFStringRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&CFStringRef_Type);
+ PyModule_AddObject(m, "CFStringRefType", (PyObject *)&CFStringRef_Type);
+ CFMutableStringRef_Type.ob_type = &PyType_Type;
+ CFMutableStringRef_Type.tp_base = &CFStringRef_Type;
+ if (PyType_Ready(&CFMutableStringRef_Type) < 0) return;
+ Py_INCREF(&CFMutableStringRef_Type);
+ PyModule_AddObject(m, "CFMutableStringRef", (PyObject *)&CFMutableStringRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&CFMutableStringRef_Type);
+ PyModule_AddObject(m, "CFMutableStringRefType", (PyObject *)&CFMutableStringRef_Type);
+ CFURLRef_Type.ob_type = &PyType_Type;
+ CFURLRef_Type.tp_base = &CFTypeRef_Type;
+ if (PyType_Ready(&CFURLRef_Type) < 0) return;
+ Py_INCREF(&CFURLRef_Type);
+ PyModule_AddObject(m, "CFURLRef", (PyObject *)&CFURLRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&CFURLRef_Type);
+ PyModule_AddObject(m, "CFURLRefType", (PyObject *)&CFURLRef_Type);
+
+#define _STRINGCONST(name) PyModule_AddObject(m, #name, CFStringRefObj_New(name))
+ _STRINGCONST(kCFPreferencesAnyApplication);
+ _STRINGCONST(kCFPreferencesCurrentApplication);
+ _STRINGCONST(kCFPreferencesAnyHost);
+ _STRINGCONST(kCFPreferencesCurrentHost);
+ _STRINGCONST(kCFPreferencesAnyUser);
+ _STRINGCONST(kCFPreferencesCurrentUser);
+
+
+
+}
+
+/* ========================= End module _CF ========================= */
+
diff --git a/Mac/Modules/cf/cfscan.py b/Mac/Modules/cf/cfscan.py
new file mode 100644
index 0000000000..6de4f1edc8
--- /dev/null
+++ b/Mac/Modules/cf/cfscan.py
@@ -0,0 +1,141 @@
+# Scan an Apple header file, generating a Python file of generator calls.
+
+import sys
+from bgenlocations import TOOLBOXDIR, BGENDIR
+sys.path.append(BGENDIR)
+from scantools import Scanner_OSX
+
+LONG = "CoreFoundation"
+SHORT = "cf"
+OBJECTS = ("CFTypeRef",
+ "CFArrayRef", "CFMutableArrayRef",
+ "CFDataRef", "CFMutableDataRef",
+ "CFDictionaryRef", "CFMutableDictionaryRef",
+ "CFStringRef", "CFMutableStringRef",
+ "CFURLRef",
+## "CFPropertyListRef",
+ )
+# ADD object typenames here
+
+def main():
+ input = [
+ "CFBase.h",
+ "CFArray.h",
+## "CFBag.h",
+## "CFBundle.h",
+## "CFCharacterSet.h",
+ "CFData.h",
+## "CFDate.h",
+ "CFDictionary.h",
+## "CFNumber.h",
+## "CFPlugIn.h",
+ "CFPreferences.h",
+ "CFPropertyList.h",
+## "CFSet.h",
+ "CFString.h",
+## "CFStringEncodingExt.h",
+## "CFTimeZone.h",
+ "CFURL.h",
+ ]
+ output = SHORT + "gen.py"
+ defsoutput = TOOLBOXDIR + LONG + ".py"
+ scanner = MyScanner(input, output, defsoutput)
+ scanner.scan()
+ scanner.gentypetest(SHORT+"typetest.py")
+ scanner.close()
+ print "=== Testing definitions output code ==="
+ execfile(defsoutput, {}, {})
+ print "=== Done scanning and generating, now importing the generated code... ==="
+ exec "import " + SHORT + "support"
+ print "=== Done. It's up to you to compile it now! ==="
+
+class MyScanner(Scanner_OSX):
+
+ def destination(self, type, name, arglist):
+ classname = "Function"
+ listname = "functions"
+ if arglist and name[:13] != 'CFPreferences':
+ t, n, m = arglist[0]
+ if t in OBJECTS and m == "InMode":
+ classname = "Method"
+ listname = t + "_methods"
+ # Special case for the silly first AllocatorRef argument
+ if t == 'CFAllocatorRef' and m == 'InMode' and len(arglist) > 1:
+ t, n, m = arglist[1]
+ if t in OBJECTS and m == "InMode":
+ classname = "MethodSkipArg1"
+ listname = t + "_methods"
+ return classname, listname
+
+ def writeinitialdefs(self):
+ self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
+
+ def makeblacklistnames(self):
+ return [
+ # Memory allocator functions
+ "CFAllocatorGetDefault",
+ "CFAllocatorSetDefault",
+ "CFAllocatorAllocate",
+ "CFAllocatorReallocate",
+ "CFAllocatorDeallocate",
+ "CFGetAllocator",
+ # Array functions we skip for now.
+ "CFArrayGetValueAtIndex",
+ # Data pointer functions. Skip for now.
+ "CFDataGetBytePtr",
+ "CFDataGetMutableBytePtr",
+ "CFDataGetBytes", # XXXX Should support this one
+ # String functions
+ "CFStringGetPascalString", # Use the C-string methods.
+ "CFStringGetPascalStringPtr", # TBD automatically
+ "CFStringGetCStringPtr",
+ "CFStringGetCharactersPtr",
+ "CFStringGetCString",
+ "CFStringGetCharacters",
+ "CFURLCreateStringWithFileSystemPath", # Gone in later releases
+ "CFStringCreateMutableWithExternalCharactersNoCopy", # Not a clue...
+ "CFStringSetExternalCharactersNoCopy",
+ "CFStringGetCharacterAtIndex", # No format for single unichars yet.
+ "kCFStringEncodingInvalidId", # incompatible constant declaration
+ "CFPropertyListCreateFromXMLData", # Manually generated
+ ]
+
+ def makegreylist(self):
+ return []
+
+ def makeblacklisttypes(self):
+ return [
+ "CFComparatorFunction", # Callback function pointer
+ "CFAllocatorContext", # Not interested in providing our own allocator
+ "void_ptr_ptr", # Tricky. This is the initializer for arrays...
+ "void_ptr", # Ditto for various array lookup methods
+ "CFArrayApplierFunction", # Callback function pointer
+ "CFDictionaryApplierFunction", # Callback function pointer
+ "va_list", # For printf-to-a-cfstring. Use Python.
+ "const_CFStringEncoding_ptr", # To be done, I guess
+ ]
+
+ def makerepairinstructions(self):
+ return [
+ # Buffers in CF seem to be passed as UInt8 * normally.
+ ([("UInt8_ptr", "*", "InMode"), ("CFIndex", "*", "InMode")],
+ [("UcharInBuffer", "*", "*")]),
+
+ ([("UniChar_ptr", "*", "InMode"), ("CFIndex", "*", "InMode")],
+ [("UnicodeInBuffer", "*", "*")]),
+
+ # Some functions return a const char *. Don't worry, we won't modify it.
+ ([("const_char_ptr", "*", "ReturnMode")],
+ [("return_stringptr", "*", "*")]),
+
+ # base URLs are optional (pass None for NULL)
+ ([("CFURLRef", "baseURL", "InMode")],
+ [("OptionalCFURLRef", "*", "*")]),
+
+ # We handle CFPropertyListRef objects as plain CFTypeRef
+ ([("CFPropertyListRef", "*", "*")],
+ [("CFTypeRef", "*", "*")]),
+ ]
+
+if __name__ == "__main__":
+ main()
diff --git a/Mac/Modules/cf/cfsupport.py b/Mac/Modules/cf/cfsupport.py
new file mode 100644
index 0000000000..c10a85eedb
--- /dev/null
+++ b/Mac/Modules/cf/cfsupport.py
@@ -0,0 +1,666 @@
+# This script generates a Python interface for an Apple Macintosh Manager.
+# It uses the "bgen" package to generate C code.
+# The function specifications are generated by scanning the mamager's header file,
+# using the "scantools" package (customized for this particular manager).
+
+#error missing SetActionFilter
+
+import string
+
+# Declarations that change for each manager
+MODNAME = '_CF' # The name of the module
+
+# The following is *usually* unchanged but may still require tuning
+MODPREFIX = 'CF' # The prefix for module-wide routines
+INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner
+OUTPUTFILE = MODNAME + "module.c" # The file generated by this program
+
+from macsupport import *
+
+# Special case generator for the functions that have an AllocatorRef first argument,
+# which we skip anyway, and the object as the second arg.
+class MethodSkipArg1(MethodGenerator):
+ """Similar to MethodGenerator, but has self as last argument"""
+
+ def parseArgumentList(self, args):
+ if len(args) < 2:
+ raise ValueError, "MethodSkipArg1 expects at least 2 args"
+ a0, a1, args = args[0], args[1], args[2:]
+ t0, n0, m0 = a0
+ if t0 != "CFAllocatorRef" and m0 != InMode:
+ raise ValueError, "MethodSkipArg1 should have dummy AllocatorRef first arg"
+ t1, n1, m1 = a1
+ if m1 != InMode:
+ raise ValueError, "method's 'self' must be 'InMode'"
+ dummy = Variable(t0, n0, m0)
+ self.argumentList.append(dummy)
+ self.itself = Variable(t1, "_self->ob_itself", SelfMode)
+ self.argumentList.append(self.itself)
+ FunctionGenerator.parseArgumentList(self, args)
+
+
+# Create the type objects
+
+includestuff = includestuff + """
+#include <CoreServices/CoreServices.h>
+
+#include "pycfbridge.h"
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_CFObj_New(CFTypeRef);
+extern int _CFObj_Convert(PyObject *, CFTypeRef *);
+#define CFObj_New _CFObj_New
+#define CFObj_Convert _CFObj_Convert
+
+extern PyObject *_CFTypeRefObj_New(CFTypeRef);
+extern int _CFTypeRefObj_Convert(PyObject *, CFTypeRef *);
+#define CFTypeRefObj_New _CFTypeRefObj_New
+#define CFTypeRefObj_Convert _CFTypeRefObj_Convert
+
+extern PyObject *_CFStringRefObj_New(CFStringRef);
+extern int _CFStringRefObj_Convert(PyObject *, CFStringRef *);
+#define CFStringRefObj_New _CFStringRefObj_New
+#define CFStringRefObj_Convert _CFStringRefObj_Convert
+
+extern PyObject *_CFMutableStringRefObj_New(CFMutableStringRef);
+extern int _CFMutableStringRefObj_Convert(PyObject *, CFMutableStringRef *);
+#define CFMutableStringRefObj_New _CFMutableStringRefObj_New
+#define CFMutableStringRefObj_Convert _CFMutableStringRefObj_Convert
+
+extern PyObject *_CFArrayRefObj_New(CFArrayRef);
+extern int _CFArrayRefObj_Convert(PyObject *, CFArrayRef *);
+#define CFArrayRefObj_New _CFArrayRefObj_New
+#define CFArrayRefObj_Convert _CFArrayRefObj_Convert
+
+extern PyObject *_CFMutableArrayRefObj_New(CFMutableArrayRef);
+extern int _CFMutableArrayRefObj_Convert(PyObject *, CFMutableArrayRef *);
+#define CFMutableArrayRefObj_New _CFMutableArrayRefObj_New
+#define CFMutableArrayRefObj_Convert _CFMutableArrayRefObj_Convert
+
+extern PyObject *_CFDataRefObj_New(CFDataRef);
+extern int _CFDataRefObj_Convert(PyObject *, CFDataRef *);
+#define CFDataRefObj_New _CFDataRefObj_New
+#define CFDataRefObj_Convert _CFDataRefObj_Convert
+
+extern PyObject *_CFMutableDataRefObj_New(CFMutableDataRef);
+extern int _CFMutableDataRefObj_Convert(PyObject *, CFMutableDataRef *);
+#define CFMutableDataRefObj_New _CFMutableDataRefObj_New
+#define CFMutableDataRefObj_Convert _CFMutableDataRefObj_Convert
+
+extern PyObject *_CFDictionaryRefObj_New(CFDictionaryRef);
+extern int _CFDictionaryRefObj_Convert(PyObject *, CFDictionaryRef *);
+#define CFDictionaryRefObj_New _CFDictionaryRefObj_New
+#define CFDictionaryRefObj_Convert _CFDictionaryRefObj_Convert
+
+extern PyObject *_CFMutableDictionaryRefObj_New(CFMutableDictionaryRef);
+extern int _CFMutableDictionaryRefObj_Convert(PyObject *, CFMutableDictionaryRef *);
+#define CFMutableDictionaryRefObj_New _CFMutableDictionaryRefObj_New
+#define CFMutableDictionaryRefObj_Convert _CFMutableDictionaryRefObj_Convert
+
+extern PyObject *_CFURLRefObj_New(CFURLRef);
+extern int _CFURLRefObj_Convert(PyObject *, CFURLRef *);
+extern int _OptionalCFURLRefObj_Convert(PyObject *, CFURLRef *);
+#define CFURLRefObj_New _CFURLRefObj_New
+#define CFURLRefObj_Convert _CFURLRefObj_Convert
+#define OptionalCFURLRefObj_Convert _OptionalCFURLRefObj_Convert
+#endif
+
+/*
+** Parse/generate CFRange records
+*/
+PyObject *CFRange_New(CFRange *itself)
+{
+
+ return Py_BuildValue("ll", (long)itself->location, (long)itself->length);
+}
+
+int
+CFRange_Convert(PyObject *v, CFRange *p_itself)
+{
+ long location, length;
+
+ if( !PyArg_ParseTuple(v, "ll", &location, &length) )
+ return 0;
+ p_itself->location = (CFIndex)location;
+ p_itself->length = (CFIndex)length;
+ return 1;
+}
+
+/* Optional CFURL argument or None (passed as NULL) */
+int
+OptionalCFURLRefObj_Convert(PyObject *v, CFURLRef *p_itself)
+{
+ if ( v == Py_None ) {
+ p_itself = NULL;
+ return 1;
+ }
+ return CFURLRefObj_Convert(v, p_itself);
+}
+"""
+
+finalstuff = finalstuff + """
+
+/* Routines to convert any CF type to/from the corresponding CFxxxObj */
+PyObject *CFObj_New(CFTypeRef itself)
+{
+ if (itself == NULL)
+ {
+ PyErr_SetString(PyExc_RuntimeError, "cannot wrap NULL");
+ return NULL;
+ }
+ if (CFGetTypeID(itself) == CFArrayGetTypeID()) return CFArrayRefObj_New((CFArrayRef)itself);
+ if (CFGetTypeID(itself) == CFDictionaryGetTypeID()) return CFDictionaryRefObj_New((CFDictionaryRef)itself);
+ if (CFGetTypeID(itself) == CFDataGetTypeID()) return CFDataRefObj_New((CFDataRef)itself);
+ if (CFGetTypeID(itself) == CFStringGetTypeID()) return CFStringRefObj_New((CFStringRef)itself);
+ if (CFGetTypeID(itself) == CFURLGetTypeID()) return CFURLRefObj_New((CFURLRef)itself);
+ /* XXXX Or should we use PyCF_CF2Python here?? */
+ return CFTypeRefObj_New(itself);
+}
+int CFObj_Convert(PyObject *v, CFTypeRef *p_itself)
+{
+
+ if (v == Py_None) { *p_itself = NULL; return 1; }
+ /* Check for other CF objects here */
+
+ if (!CFTypeRefObj_Check(v) &&
+ !CFArrayRefObj_Check(v) &&
+ !CFMutableArrayRefObj_Check(v) &&
+ !CFDictionaryRefObj_Check(v) &&
+ !CFMutableDictionaryRefObj_Check(v) &&
+ !CFDataRefObj_Check(v) &&
+ !CFMutableDataRefObj_Check(v) &&
+ !CFStringRefObj_Check(v) &&
+ !CFMutableStringRefObj_Check(v) &&
+ !CFURLRefObj_Check(v) )
+ {
+ /* XXXX Or should we use PyCF_Python2CF here?? */
+ PyErr_SetString(PyExc_TypeError, "CF object required");
+ return 0;
+ }
+ *p_itself = ((CFTypeRefObject *)v)->ob_itself;
+ return 1;
+}
+"""
+
+initstuff = initstuff + """
+PyMac_INIT_TOOLBOX_OBJECT_NEW(CFTypeRef, CFObj_New);
+PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CFTypeRef, CFObj_Convert);
+PyMac_INIT_TOOLBOX_OBJECT_NEW(CFTypeRef, CFTypeRefObj_New);
+PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CFTypeRef, CFTypeRefObj_Convert);
+PyMac_INIT_TOOLBOX_OBJECT_NEW(CFStringRef, CFStringRefObj_New);
+PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CFStringRef, CFStringRefObj_Convert);
+PyMac_INIT_TOOLBOX_OBJECT_NEW(CFMutableStringRef, CFMutableStringRefObj_New);
+PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CFMutableStringRef, CFMutableStringRefObj_Convert);
+PyMac_INIT_TOOLBOX_OBJECT_NEW(CFArrayRef, CFArrayRefObj_New);
+PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CFArrayRef, CFArrayRefObj_Convert);
+PyMac_INIT_TOOLBOX_OBJECT_NEW(CFMutableArrayRef, CFMutableArrayRefObj_New);
+PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CFMutableArrayRef, CFMutableArrayRefObj_Convert);
+PyMac_INIT_TOOLBOX_OBJECT_NEW(CFDictionaryRef, CFDictionaryRefObj_New);
+PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CFDictionaryRef, CFDictionaryRefObj_Convert);
+PyMac_INIT_TOOLBOX_OBJECT_NEW(CFMutableDictionaryRef, CFMutableDictionaryRefObj_New);
+PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CFMutableDictionaryRef, CFMutableDictionaryRefObj_Convert);
+PyMac_INIT_TOOLBOX_OBJECT_NEW(CFURLRef, CFURLRefObj_New);
+PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CFURLRef, CFURLRefObj_Convert);
+"""
+
+variablestuff="""
+#define _STRINGCONST(name) PyModule_AddObject(m, #name, CFStringRefObj_New(name))
+_STRINGCONST(kCFPreferencesAnyApplication);
+_STRINGCONST(kCFPreferencesCurrentApplication);
+_STRINGCONST(kCFPreferencesAnyHost);
+_STRINGCONST(kCFPreferencesCurrentHost);
+_STRINGCONST(kCFPreferencesAnyUser);
+_STRINGCONST(kCFPreferencesCurrentUser);
+
+"""
+
+Boolean = Type("Boolean", "l")
+CFTypeID = Type("CFTypeID", "l") # XXXX a guess, seems better than OSTypeType.
+CFHashCode = Type("CFHashCode", "l")
+CFIndex = Type("CFIndex", "l")
+CFRange = OpaqueByValueType('CFRange', 'CFRange')
+CFOptionFlags = Type("CFOptionFlags", "l")
+CFStringEncoding = Type("CFStringEncoding", "l")
+CFComparisonResult = Type("CFComparisonResult", "l") # a bit dangerous, it's an enum
+CFURLPathStyle = Type("CFURLPathStyle", "l") # a bit dangerous, it's an enum
+
+char_ptr = stringptr
+return_stringptr = Type("char *", "s") # ONLY FOR RETURN VALUES!!
+
+CFAllocatorRef = FakeType("(CFAllocatorRef)NULL")
+CFArrayCallBacks_ptr = FakeType("&kCFTypeArrayCallBacks")
+CFDictionaryKeyCallBacks_ptr = FakeType("&kCFTypeDictionaryKeyCallBacks")
+CFDictionaryValueCallBacks_ptr = FakeType("&kCFTypeDictionaryValueCallBacks")
+# The real objects
+CFTypeRef = OpaqueByValueType("CFTypeRef", "CFTypeRefObj")
+CFArrayRef = OpaqueByValueType("CFArrayRef", "CFArrayRefObj")
+CFMutableArrayRef = OpaqueByValueType("CFMutableArrayRef", "CFMutableArrayRefObj")
+CFArrayRef = OpaqueByValueType("CFArrayRef", "CFArrayRefObj")
+CFMutableArrayRef = OpaqueByValueType("CFMutableArrayRef", "CFMutableArrayRefObj")
+CFDataRef = OpaqueByValueType("CFDataRef", "CFDataRefObj")
+CFMutableDataRef = OpaqueByValueType("CFMutableDataRef", "CFMutableDataRefObj")
+CFDictionaryRef = OpaqueByValueType("CFDictionaryRef", "CFDictionaryRefObj")
+CFMutableDictionaryRef = OpaqueByValueType("CFMutableDictionaryRef", "CFMutableDictionaryRefObj")
+CFStringRef = OpaqueByValueType("CFStringRef", "CFStringRefObj")
+CFMutableStringRef = OpaqueByValueType("CFMutableStringRef", "CFMutableStringRefObj")
+CFURLRef = OpaqueByValueType("CFURLRef", "CFURLRefObj")
+OptionalCFURLRef = OpaqueByValueType("CFURLRef", "OptionalCFURLRefObj")
+##CFPropertyListRef = OpaqueByValueType("CFPropertyListRef", "CFTypeRefObj")
+# ADD object type here
+
+# Our (opaque) objects
+
+class MyGlobalObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
+ def outputCheckNewArg(self):
+ Output('if (itself == NULL)')
+ OutLbrace()
+ Output('PyErr_SetString(PyExc_RuntimeError, "cannot wrap NULL");')
+ Output('return NULL;')
+ OutRbrace()
+ def outputStructMembers(self):
+ GlobalObjectDefinition.outputStructMembers(self)
+ Output("void (*ob_freeit)(CFTypeRef ptr);")
+ def outputInitStructMembers(self):
+ GlobalObjectDefinition.outputInitStructMembers(self)
+## Output("it->ob_freeit = NULL;")
+ Output("it->ob_freeit = CFRelease;")
+ def outputCheckConvertArg(self):
+ Out("""
+ if (v == Py_None) { *p_itself = NULL; return 1; }
+ /* Check for other CF objects here */
+ """)
+ def outputCleanupStructMembers(self):
+ Output("if (self->ob_freeit && self->ob_itself)")
+ OutLbrace()
+ Output("self->ob_freeit((CFTypeRef)self->ob_itself);")
+ Output("self->ob_itself = NULL;")
+ OutRbrace()
+
+ def outputCompare(self):
+ Output()
+ Output("static int %s_compare(%s *self, %s *other)", self.prefix, self.objecttype, self.objecttype)
+ OutLbrace()
+ Output("/* XXXX Or should we use CFEqual?? */")
+ Output("if ( self->ob_itself > other->ob_itself ) return 1;")
+ Output("if ( self->ob_itself < other->ob_itself ) return -1;")
+ Output("return 0;")
+ OutRbrace()
+
+ def outputHash(self):
+ Output()
+ Output("static int %s_hash(%s *self)", self.prefix, self.objecttype)
+ OutLbrace()
+ Output("/* XXXX Or should we use CFHash?? */")
+ Output("return (int)self->ob_itself;")
+ OutRbrace()
+
+ def outputRepr(self):
+ Output()
+ Output("static PyObject * %s_repr(%s *self)", self.prefix, self.objecttype)
+ OutLbrace()
+ Output("char buf[100];")
+ Output("""sprintf(buf, "<CFTypeRef type-%%d object at 0x%%8.8x for 0x%%8.8x>", (int)CFGetTypeID(self->ob_itself), (unsigned)self, (unsigned)self->ob_itself);""")
+ Output("return PyString_FromString(buf);")
+ OutRbrace()
+
+ def output_tp_newBody(self):
+ Output("PyObject *self;")
+ Output
+ Output("if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;")
+ Output("((%s *)self)->ob_itself = NULL;", self.objecttype)
+ Output("((%s *)self)->ob_freeit = CFRelease;", self.objecttype)
+ Output("return self;")
+
+ def output_tp_initBody(self):
+ Output("%s itself;", self.itselftype)
+ Output("char *kw[] = {\"itself\", 0};")
+ Output()
+ Output("if (PyArg_ParseTupleAndKeywords(_args, _kwds, \"O&\", kw, %s_Convert, &itself))",
+ self.prefix)
+ OutLbrace()
+ Output("((%s *)_self)->ob_itself = itself;", self.objecttype)
+ Output("return 0;")
+ OutRbrace()
+ if self.prefix != 'CFTypeRefObj':
+ Output()
+ Output("/* Any CFTypeRef descendent is allowed as initializer too */")
+ Output("if (PyArg_ParseTupleAndKeywords(_args, _kwds, \"O&\", kw, CFTypeRefObj_Convert, &itself))")
+ OutLbrace()
+ Output("((%s *)_self)->ob_itself = itself;", self.objecttype)
+ Output("return 0;")
+ OutRbrace()
+ Output("return -1;")
+
+class CFTypeRefObjectDefinition(MyGlobalObjectDefinition):
+ pass
+
+class CFArrayRefObjectDefinition(MyGlobalObjectDefinition):
+ basetype = "CFTypeRef_Type"
+
+ def outputRepr(self):
+ Output()
+ Output("static PyObject * %s_repr(%s *self)", self.prefix, self.objecttype)
+ OutLbrace()
+ Output("char buf[100];")
+ Output("""sprintf(buf, "<CFArrayRef object at 0x%%8.8x for 0x%%8.8x>", (unsigned)self, (unsigned)self->ob_itself);""")
+ Output("return PyString_FromString(buf);")
+ OutRbrace()
+
+class CFMutableArrayRefObjectDefinition(MyGlobalObjectDefinition):
+ basetype = "CFArrayRef_Type"
+
+ def outputRepr(self):
+ Output()
+ Output("static PyObject * %s_repr(%s *self)", self.prefix, self.objecttype)
+ OutLbrace()
+ Output("char buf[100];")
+ Output("""sprintf(buf, "<CFMutableArrayRef object at 0x%%8.8x for 0x%%8.8x>", (unsigned)self, (unsigned)self->ob_itself);""")
+ Output("return PyString_FromString(buf);")
+ OutRbrace()
+
+class CFDictionaryRefObjectDefinition(MyGlobalObjectDefinition):
+ basetype = "CFTypeRef_Type"
+
+ def outputRepr(self):
+ Output()
+ Output("static PyObject * %s_repr(%s *self)", self.prefix, self.objecttype)
+ OutLbrace()
+ Output("char buf[100];")
+ Output("""sprintf(buf, "<CFDictionaryRef object at 0x%%8.8x for 0x%%8.8x>", (unsigned)self, (unsigned)self->ob_itself);""")
+ Output("return PyString_FromString(buf);")
+ OutRbrace()
+
+class CFMutableDictionaryRefObjectDefinition(MyGlobalObjectDefinition):
+ basetype = "CFDictionaryRef_Type"
+
+ def outputRepr(self):
+ Output()
+ Output("static PyObject * %s_repr(%s *self)", self.prefix, self.objecttype)
+ OutLbrace()
+ Output("char buf[100];")
+ Output("""sprintf(buf, "<CFMutableDictionaryRef object at 0x%%8.8x for 0x%%8.8x>", (unsigned)self, (unsigned)self->ob_itself);""")
+ Output("return PyString_FromString(buf);")
+ OutRbrace()
+
+class CFDataRefObjectDefinition(MyGlobalObjectDefinition):
+ basetype = "CFTypeRef_Type"
+
+ def outputCheckConvertArg(self):
+ Out("""
+ if (v == Py_None) { *p_itself = NULL; return 1; }
+ if (PyString_Check(v)) {
+ char *cStr;
+ int cLen;
+ if( PyString_AsStringAndSize(v, &cStr, &cLen) < 0 ) return 0;
+ *p_itself = CFDataCreate((CFAllocatorRef)NULL, (unsigned char *)cStr, cLen);
+ return 1;
+ }
+ """)
+
+ def outputRepr(self):
+ Output()
+ Output("static PyObject * %s_repr(%s *self)", self.prefix, self.objecttype)
+ OutLbrace()
+ Output("char buf[100];")
+ Output("""sprintf(buf, "<CFDataRef object at 0x%%8.8x for 0x%%8.8x>", (unsigned)self, (unsigned)self->ob_itself);""")
+ Output("return PyString_FromString(buf);")
+ OutRbrace()
+
+class CFMutableDataRefObjectDefinition(MyGlobalObjectDefinition):
+ basetype = "CFDataRef_Type"
+
+ def outputRepr(self):
+ Output()
+ Output("static PyObject * %s_repr(%s *self)", self.prefix, self.objecttype)
+ OutLbrace()
+ Output("char buf[100];")
+ Output("""sprintf(buf, "<CFMutableDataRef object at 0x%%8.8x for 0x%%8.8x>", (unsigned)self, (unsigned)self->ob_itself);""")
+ Output("return PyString_FromString(buf);")
+ OutRbrace()
+
+class CFStringRefObjectDefinition(MyGlobalObjectDefinition):
+ basetype = "CFTypeRef_Type"
+
+ def outputCheckConvertArg(self):
+ Out("""
+ if (v == Py_None) { *p_itself = NULL; return 1; }
+ if (PyString_Check(v)) {
+ char *cStr;
+ if (!PyArg_Parse(v, "es", "ascii", &cStr))
+ return NULL;
+ *p_itself = CFStringCreateWithCString((CFAllocatorRef)NULL, cStr, kCFStringEncodingASCII);
+ PyMem_Free(cStr);
+ return 1;
+ }
+ if (PyUnicode_Check(v)) {
+ /* We use the CF types here, if Python was configured differently that will give an error */
+ CFIndex size = PyUnicode_GetSize(v);
+ UniChar *unichars = PyUnicode_AsUnicode(v);
+ if (!unichars) return 0;
+ *p_itself = CFStringCreateWithCharacters((CFAllocatorRef)NULL, unichars, size);
+ return 1;
+ }
+
+ """)
+
+ def outputRepr(self):
+ Output()
+ Output("static PyObject * %s_repr(%s *self)", self.prefix, self.objecttype)
+ OutLbrace()
+ Output("char buf[100];")
+ Output("""sprintf(buf, "<CFStringRef object at 0x%%8.8x for 0x%%8.8x>", (unsigned)self, (unsigned)self->ob_itself);""")
+ Output("return PyString_FromString(buf);")
+ OutRbrace()
+
+class CFMutableStringRefObjectDefinition(CFStringRefObjectDefinition):
+ basetype = "CFStringRef_Type"
+
+ def outputCheckConvertArg(self):
+ # Mutable, don't allow Python strings
+ return MyGlobalObjectDefinition.outputCheckConvertArg(self)
+
+ def outputRepr(self):
+ Output()
+ Output("static PyObject * %s_repr(%s *self)", self.prefix, self.objecttype)
+ OutLbrace()
+ Output("char buf[100];")
+ Output("""sprintf(buf, "<CFMutableStringRef object at 0x%%8.8x for 0x%%8.8x>", (unsigned)self, (unsigned)self->ob_itself);""")
+ Output("return PyString_FromString(buf);")
+ OutRbrace()
+
+class CFURLRefObjectDefinition(MyGlobalObjectDefinition):
+ basetype = "CFTypeRef_Type"
+
+ def outputRepr(self):
+ Output()
+ Output("static PyObject * %s_repr(%s *self)", self.prefix, self.objecttype)
+ OutLbrace()
+ Output("char buf[100];")
+ Output("""sprintf(buf, "<CFURL object at 0x%%8.8x for 0x%%8.8x>", (unsigned)self, (unsigned)self->ob_itself);""")
+ Output("return PyString_FromString(buf);")
+ OutRbrace()
+
+
+# ADD object class here
+
+# From here on it's basically all boiler plate...
+
+# Create the generator groups and link them
+module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff, variablestuff)
+CFTypeRef_object = CFTypeRefObjectDefinition('CFTypeRef', 'CFTypeRefObj', 'CFTypeRef')
+CFArrayRef_object = CFArrayRefObjectDefinition('CFArrayRef', 'CFArrayRefObj', 'CFArrayRef')
+CFMutableArrayRef_object = CFMutableArrayRefObjectDefinition('CFMutableArrayRef', 'CFMutableArrayRefObj', 'CFMutableArrayRef')
+CFDictionaryRef_object = CFDictionaryRefObjectDefinition('CFDictionaryRef', 'CFDictionaryRefObj', 'CFDictionaryRef')
+CFMutableDictionaryRef_object = CFMutableDictionaryRefObjectDefinition('CFMutableDictionaryRef', 'CFMutableDictionaryRefObj', 'CFMutableDictionaryRef')
+CFDataRef_object = CFDataRefObjectDefinition('CFDataRef', 'CFDataRefObj', 'CFDataRef')
+CFMutableDataRef_object = CFMutableDataRefObjectDefinition('CFMutableDataRef', 'CFMutableDataRefObj', 'CFMutableDataRef')
+CFStringRef_object = CFStringRefObjectDefinition('CFStringRef', 'CFStringRefObj', 'CFStringRef')
+CFMutableStringRef_object = CFMutableStringRefObjectDefinition('CFMutableStringRef', 'CFMutableStringRefObj', 'CFMutableStringRef')
+CFURLRef_object = CFURLRefObjectDefinition('CFURLRef', 'CFURLRefObj', 'CFURLRef')
+
+# ADD object here
+
+module.addobject(CFTypeRef_object)
+module.addobject(CFArrayRef_object)
+module.addobject(CFMutableArrayRef_object)
+module.addobject(CFDictionaryRef_object)
+module.addobject(CFMutableDictionaryRef_object)
+module.addobject(CFDataRef_object)
+module.addobject(CFMutableDataRef_object)
+module.addobject(CFStringRef_object)
+module.addobject(CFMutableStringRef_object)
+module.addobject(CFURLRef_object)
+# ADD addobject call here
+
+# Create the generator classes used to populate the lists
+Function = OSErrWeakLinkFunctionGenerator
+Method = OSErrWeakLinkMethodGenerator
+
+# Create and populate the lists
+functions = []
+CFTypeRef_methods = []
+CFArrayRef_methods = []
+CFMutableArrayRef_methods = []
+CFDictionaryRef_methods = []
+CFMutableDictionaryRef_methods = []
+CFDataRef_methods = []
+CFMutableDataRef_methods = []
+CFStringRef_methods = []
+CFMutableStringRef_methods = []
+CFURLRef_methods = []
+
+# ADD _methods initializer here
+execfile(INPUTFILE)
+
+
+# add the populated lists to the generator groups
+# (in a different wordl the scan program would generate this)
+for f in functions: module.add(f)
+for f in CFTypeRef_methods: CFTypeRef_object.add(f)
+for f in CFArrayRef_methods: CFArrayRef_object.add(f)
+for f in CFMutableArrayRef_methods: CFMutableArrayRef_object.add(f)
+for f in CFDictionaryRef_methods: CFDictionaryRef_object.add(f)
+for f in CFMutableDictionaryRef_methods: CFMutableDictionaryRef_object.add(f)
+for f in CFDataRef_methods: CFDataRef_object.add(f)
+for f in CFMutableDataRef_methods: CFMutableDataRef_object.add(f)
+for f in CFStringRef_methods: CFStringRef_object.add(f)
+for f in CFMutableStringRef_methods: CFMutableStringRef_object.add(f)
+for f in CFURLRef_methods: CFURLRef_object.add(f)
+
+# Manual generators for getting data out of strings
+
+getasstring_body = """
+int size = CFStringGetLength(_self->ob_itself)+1;
+char *data = malloc(size);
+
+if( data == NULL ) return PyErr_NoMemory();
+if ( CFStringGetCString(_self->ob_itself, data, size, 0) ) {
+ _res = (PyObject *)PyString_FromString(data);
+} else {
+ PyErr_SetString(PyExc_RuntimeError, "CFStringGetCString could not fit the string");
+ _res = NULL;
+}
+free(data);
+return _res;
+"""
+
+f = ManualGenerator("CFStringGetString", getasstring_body);
+f.docstring = lambda: "() -> (string _rv)"
+CFStringRef_object.add(f)
+
+getasunicode_body = """
+int size = CFStringGetLength(_self->ob_itself)+1;
+Py_UNICODE *data = malloc(size*sizeof(Py_UNICODE));
+CFRange range;
+
+range.location = 0;
+range.length = size;
+if( data == NULL ) return PyErr_NoMemory();
+CFStringGetCharacters(_self->ob_itself, range, data);
+_res = (PyObject *)PyUnicode_FromUnicode(data, size-1);
+free(data);
+return _res;
+"""
+
+f = ManualGenerator("CFStringGetUnicode", getasunicode_body);
+f.docstring = lambda: "() -> (unicode _rv)"
+CFStringRef_object.add(f)
+
+# Get data from CFDataRef
+getasdata_body = """
+int size = CFDataGetLength(_self->ob_itself);
+char *data = (char *)CFDataGetBytePtr(_self->ob_itself);
+
+_res = (PyObject *)PyString_FromStringAndSize(data, size);
+return _res;
+"""
+
+f = ManualGenerator("CFDataGetData", getasdata_body);
+f.docstring = lambda: "() -> (string _rv)"
+CFDataRef_object.add(f)
+
+# Manual generator for CFPropertyListCreateFromXMLData because of funny error return
+fromxml_body = """
+CFTypeRef _rv;
+CFOptionFlags mutabilityOption;
+CFStringRef errorString;
+if (!PyArg_ParseTuple(_args, "l",
+ &mutabilityOption))
+ return NULL;
+_rv = CFPropertyListCreateFromXMLData((CFAllocatorRef)NULL,
+ _self->ob_itself,
+ mutabilityOption,
+ &errorString);
+if (errorString)
+ CFRelease(errorString);
+if (_rv == NULL) {
+ PyErr_SetString(PyExc_RuntimeError, "Parse error in XML data");
+ return NULL;
+}
+_res = Py_BuildValue("O&",
+ CFTypeRefObj_New, _rv);
+return _res;
+"""
+f = ManualGenerator("CFPropertyListCreateFromXMLData", fromxml_body)
+f.docstring = lambda: "(CFOptionFlags mutabilityOption) -> (CFTypeRefObj)"
+CFTypeRef_object.add(f)
+
+# Convert CF objects to Python objects
+toPython_body = """
+_res = PyCF_CF2Python(_self->ob_itself);
+return _res;
+"""
+
+f = ManualGenerator("toPython", toPython_body);
+f.docstring = lambda: "() -> (python_object)"
+CFTypeRef_object.add(f)
+
+toCF_body = """
+CFTypeRef rv;
+CFTypeID typeid;
+
+if (!PyArg_ParseTuple(_args, "O&", PyCF_Python2CF, &rv))
+ return NULL;
+typeid = CFGetTypeID(rv);
+
+if (typeid == CFStringGetTypeID())
+ return Py_BuildValue("O&", CFStringRefObj_New, rv);
+if (typeid == CFArrayGetTypeID())
+ return Py_BuildValue("O&", CFArrayRefObj_New, rv);
+if (typeid == CFDictionaryGetTypeID())
+ return Py_BuildValue("O&", CFDictionaryRefObj_New, rv);
+if (typeid == CFURLGetTypeID())
+ return Py_BuildValue("O&", CFURLRefObj_New, rv);
+
+_res = Py_BuildValue("O&", CFTypeRefObj_New, rv);
+return _res;
+"""
+f = ManualGenerator("toCF", toCF_body);
+f.docstring = lambda: "(python_object) -> (CF_object)"
+module.add(f)
+
+# ADD add forloop here
+
+# generate output (open the output file as late as possible)
+SetOutputFileName(OUTPUTFILE)
+module.generate()
diff --git a/Mac/Modules/cf/pycfbridge.c b/Mac/Modules/cf/pycfbridge.c
new file mode 100644
index 0000000000..708c1e67b3
--- /dev/null
+++ b/Mac/Modules/cf/pycfbridge.c
@@ -0,0 +1,303 @@
+/*
+** Convert objects from Python to CoreFoundation and vice-versa.
+*/
+
+#include <CoreServices/CoreServices.h>
+
+#include "Python.h"
+#include "pymactoolbox.h"
+#include "pycfbridge.h"
+
+
+/* ---------------------------------------- */
+/* CoreFoundation objects to Python objects */
+/* ---------------------------------------- */
+
+PyObject *
+PyCF_CF2Python(CFTypeRef src) {
+ CFTypeID typeid;
+
+ if( src == NULL ) {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+ typeid = CFGetTypeID(src);
+ if (typeid == CFArrayGetTypeID())
+ return PyCF_CF2Python_sequence((CFArrayRef)src);
+ if (typeid == CFDictionaryGetTypeID())
+ return PyCF_CF2Python_mapping((CFDictionaryRef)src);
+ return PyCF_CF2Python_simple(src);
+}
+
+PyObject *
+PyCF_CF2Python_sequence(CFArrayRef src) {
+ int size = CFArrayGetCount(src);
+ PyObject *rv;
+ CFTypeRef item_cf;
+ PyObject *item_py = NULL;
+ int i;
+
+ if ( (rv=PyList_New(size)) == NULL )
+ return NULL;
+ for(i=0; i<size; i++) {
+ item_cf = CFArrayGetValueAtIndex(src, i);
+ if (item_cf == NULL ) goto err;
+ item_py = PyCF_CF2Python(item_cf);
+ if (item_py == NULL ) goto err;
+ if (PyList_SetItem(rv, i, item_py) < 0) goto err;
+ item_py = NULL;
+ }
+ return rv;
+err:
+ Py_XDECREF(item_py);
+ Py_DECREF(rv);
+ return NULL;
+}
+
+PyObject *
+PyCF_CF2Python_mapping(CFTypeRef src) {
+ int size = CFDictionaryGetCount(src);
+ PyObject *rv = NULL;
+ CFTypeRef *allkeys = NULL, *allvalues = NULL;
+ CFTypeRef key_cf, value_cf;
+ PyObject *key_py = NULL, *value_py = NULL;
+ int i;
+
+ allkeys = malloc(size*sizeof(CFTypeRef *));
+ if (allkeys == NULL) {
+ PyErr_NoMemory();
+ goto err;
+ }
+ allvalues = malloc(size*sizeof(CFTypeRef *));
+ if (allvalues == NULL) {
+ PyErr_NoMemory();
+ goto err;
+ }
+ if ( (rv=PyDict_New()) == NULL ) goto err;
+ CFDictionaryGetKeysAndValues(src, allkeys, allvalues);
+ for(i=0; i<size; i++) {
+ key_cf = allkeys[i];
+ value_cf = allvalues[i];
+ key_py = PyCF_CF2Python(key_cf);
+ if (key_py == NULL ) goto err;
+ value_py = PyCF_CF2Python(value_cf);
+ if (value_py == NULL ) goto err;
+ if (PyDict_SetItem(rv, key_py, value_py) < 0) goto err;
+ key_py = NULL;
+ value_py = NULL;
+ }
+ return rv;
+err:
+ Py_XDECREF(key_py);
+ Py_XDECREF(value_py);
+ Py_XDECREF(rv);
+ free(allkeys);
+ free(allvalues);
+ return NULL;
+}
+
+PyObject *
+PyCF_CF2Python_simple(CFTypeRef src) {
+ CFTypeID typeid;
+
+ typeid = CFGetTypeID(src);
+ if (typeid == CFStringGetTypeID())
+ return PyCF_CF2Python_string((CFStringRef)src);
+ if (typeid == CFBooleanGetTypeID())
+ return PyBool_FromLong((long)CFBooleanGetValue(src));
+ if (typeid == CFNumberGetTypeID()) {
+ if (CFNumberIsFloatType(src)) {
+ double d;
+ CFNumberGetValue(src, kCFNumberDoubleType, &d);
+ return PyFloat_FromDouble(d);
+ } else {
+ long l;
+ if (!CFNumberGetValue(src, kCFNumberLongType, &l))
+ /* XXXX Out of range! */;
+ return PyInt_FromLong(l);
+ }
+ }
+ /* XXXX Should return as CFTypeRef, really... */
+ PyMac_Error(resNotFound);
+ return NULL;
+}
+
+/* Unsure - Return unicode or 8 bit strings? */
+PyObject *
+PyCF_CF2Python_string(CFStringRef src) {
+ int size = CFStringGetLength(src)+1;
+ Py_UNICODE *data = malloc(size*sizeof(Py_UNICODE));
+ CFRange range;
+ PyObject *rv;
+
+ range.location = 0;
+ range.length = size;
+ if( data == NULL ) return PyErr_NoMemory();
+ CFStringGetCharacters(src, range, data);
+ rv = (PyObject *)PyUnicode_FromUnicode(data, size-1);
+ free(data);
+ return rv;
+}
+
+/* ---------------------------------------- */
+/* Python objects to CoreFoundation objects */
+/* ---------------------------------------- */
+
+int
+PyCF_Python2CF(PyObject *src, CFTypeRef *dst) {
+
+ if (PyString_Check(src) || PyUnicode_Check(src))
+ return PyCF_Python2CF_simple(src, dst);
+ if (PySequence_Check(src))
+ return PyCF_Python2CF_sequence(src, (CFArrayRef *)dst);
+ if (PyMapping_Check(src))
+ return PyCF_Python2CF_mapping(src, (CFDictionaryRef *)dst);
+ return PyCF_Python2CF_simple(src, dst);
+}
+
+int
+PyCF_Python2CF_sequence(PyObject *src, CFArrayRef *dst) {
+ CFMutableArrayRef rv = NULL;
+ CFTypeRef item_cf = NULL;
+ PyObject *item_py = NULL;
+ int size, i;
+
+ if( !PySequence_Check(src) ) {
+ PyErr_Format(PyExc_TypeError,
+ "Cannot convert %.500s objects to CFArray",
+ src->ob_type->tp_name);
+ return 0;
+ }
+ size = PySequence_Size(src);
+ rv = CFArrayCreateMutable((CFAllocatorRef)NULL, size, &kCFTypeArrayCallBacks);
+ if (rv == NULL) {
+ PyMac_Error(resNotFound);
+ goto err;
+ }
+
+ for( i=0; i<size; i++) {
+ item_py = PySequence_GetItem(src, i);
+ if (item_py == NULL) goto err;
+ if ( !PyCF_Python2CF(item_py, &item_cf)) goto err;
+ Py_DECREF(item_py);
+ CFArraySetValueAtIndex(rv, i, item_cf);
+ CFRelease(item_cf);
+ item_cf = NULL;
+ }
+ *dst = rv;
+ return 1;
+err:
+ Py_XDECREF(item_py);
+ if (rv) CFRelease(rv);
+ if (item_cf) CFRelease(item_cf);
+ return 0;
+}
+
+int
+PyCF_Python2CF_mapping(PyObject *src, CFDictionaryRef *dst) {
+ CFMutableDictionaryRef rv = NULL;
+ PyObject *aslist = NULL;
+ CFTypeRef key_cf = NULL, value_cf = NULL;
+ PyObject *item_py = NULL, *key_py = NULL, *value_py = NULL;
+ int size, i;
+
+ if( !PyMapping_Check(src) ) {
+ PyErr_Format(PyExc_TypeError,
+ "Cannot convert %.500s objects to CFDictionary",
+ src->ob_type->tp_name);
+ return 0;
+ }
+ size = PyMapping_Size(src);
+ rv = CFDictionaryCreateMutable((CFAllocatorRef)NULL, size,
+ &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
+ if (rv == NULL) {
+ PyMac_Error(resNotFound);
+ goto err;
+ }
+ if ( (aslist = PyMapping_Items(src)) == NULL ) goto err;
+
+ for( i=0; i<size; i++) {
+ item_py = PySequence_GetItem(aslist, i);
+ if (item_py == NULL) goto err;
+ if (!PyArg_ParseTuple(item_py, "OO", &key_py, &value_py)) goto err;
+ if ( !PyCF_Python2CF(key_py, &key_cf) ) goto err;
+ if ( !PyCF_Python2CF(value_py, &value_cf) ) goto err;
+ CFDictionaryAddValue(rv, key_cf, value_cf);
+ CFRelease(key_cf);
+ key_cf = NULL;
+ CFRelease(value_cf);
+ value_cf = NULL;
+ }
+ *dst = rv;
+ return 1;
+err:
+ Py_XDECREF(item_py);
+ Py_XDECREF(aslist);
+ if (rv) CFRelease(rv);
+ if (key_cf) CFRelease(key_cf);
+ if (value_cf) CFRelease(value_cf);
+ return 0;
+}
+
+int
+PyCF_Python2CF_simple(PyObject *src, CFTypeRef *dst) {
+
+#if 0
+ if (PyObject_HasAttrString(src, "CFType")) {
+ *dst = PyObject_CallMethod(src, "CFType", "");
+ return (*dst != NULL);
+ }
+#endif
+ if (PyString_Check(src) || PyUnicode_Check(src))
+ return PyCF_Python2CF_string(src, (CFStringRef *)dst);
+ if (PyBool_Check(src)) {
+ if (src == Py_True)
+ *dst = kCFBooleanTrue;
+ else
+ *dst = kCFBooleanFalse;
+ return 1;
+ }
+ if (PyInt_Check(src)) {
+ long v = PyInt_AsLong(src);
+ *dst = CFNumberCreate(NULL, kCFNumberLongType, &v);
+ return 1;
+ }
+ if (PyFloat_Check(src)) {
+ double d = PyFloat_AsDouble(src);
+ *dst = CFNumberCreate(NULL, kCFNumberDoubleType, &d);
+ return 1;
+ }
+
+ PyErr_Format(PyExc_TypeError,
+ "Cannot convert %.500s objects to CFType",
+ src->ob_type->tp_name);
+ return 0;
+}
+
+int
+PyCF_Python2CF_string(PyObject *src, CFStringRef *dst) {
+ char *chars;
+ CFIndex size;
+ UniChar *unichars;
+
+ if (PyString_Check(src)) {
+ if (!PyArg_Parse(src, "es", "ascii", &chars))
+ return 0; /* This error is more descriptive than the general one below */
+ *dst = CFStringCreateWithCString((CFAllocatorRef)NULL, chars, kCFStringEncodingASCII);
+ PyMem_Free(chars);
+ return 1;
+ }
+ if (PyUnicode_Check(src)) {
+ /* We use the CF types here, if Python was configured differently that will give an error */
+ size = PyUnicode_GetSize(src);
+ if ((unichars = PyUnicode_AsUnicode(src)) == NULL ) goto err;
+ *dst = CFStringCreateWithCharacters((CFAllocatorRef)NULL, unichars, size);
+ return 1;
+ }
+err:
+ PyErr_Format(PyExc_TypeError,
+ "Cannot convert %.500s objects to CFString",
+ src->ob_type->tp_name);
+ return 0;
+}
diff --git a/Mac/Modules/cf/pycfbridge.h b/Mac/Modules/cf/pycfbridge.h
new file mode 100644
index 0000000000..3377d5dcb1
--- /dev/null
+++ b/Mac/Modules/cf/pycfbridge.h
@@ -0,0 +1,11 @@
+extern PyObject *PyCF_CF2Python(CFTypeRef src);
+extern PyObject *PyCF_CF2Python_sequence(CFArrayRef src);
+extern PyObject *PyCF_CF2Python_mapping(CFTypeRef src);
+extern PyObject *PyCF_CF2Python_simple(CFTypeRef src);
+extern PyObject *PyCF_CF2Python_string(CFStringRef src);
+
+extern int PyCF_Python2CF(PyObject *src, CFTypeRef *dst);
+extern int PyCF_Python2CF_sequence(PyObject *src, CFArrayRef *dst);
+extern int PyCF_Python2CF_mapping(PyObject *src, CFDictionaryRef *dst);
+extern int PyCF_Python2CF_simple(PyObject *src, CFTypeRef *dst);
+extern int PyCF_Python2CF_string(PyObject *src, CFStringRef *dst); \ No newline at end of file
diff --git a/Mac/Modules/cg/CFMLateImport.c b/Mac/Modules/cg/CFMLateImport.c
new file mode 100755
index 0000000000..955acfb85b
--- /dev/null
+++ b/Mac/Modules/cg/CFMLateImport.c
@@ -0,0 +1,1360 @@
+/*
+ File: CFMLateImport.c
+
+ Contains: Implementation of CFM late import library.
+
+ Written by: Quinn
+
+ Copyright: Copyright © 1999 by Apple Computer, Inc., all rights reserved.
+
+ You may incorporate this Apple sample source code into your program(s) without
+ restriction. This Apple sample source code has been provided "AS IS" and the
+ responsibility for its operation is yours. You are not permitted to redistribute
+ this Apple sample source code as "Apple sample source code" after having made
+ changes. If you're going to re-distribute the source, we require that you make
+ it clear in the source that the code was descended from Apple sample source
+ code, but that you've made changes.
+
+ Change History (most recent first):
+
+ <13> 24/9/01 Quinn Fixes to compile with C++ activated.
+ <12> 21/9/01 Quinn [2710489] Fix typo in the comments for FragmentLookup.
+ <11> 21/9/01 Quinn Changes for CWPro7 Mach-O build.
+ <10> 19/9/01 Quinn Corrected implementation of kPEFRelocSmBySection. Added
+ implementations of kPEFRelocSetPosition and kPEFRelocLgByImport
+ (from code contributed by Eric Grant, Ned Holbrook, and Steve
+ Kalkwarf), although I can't test them yet.
+ <9> 19/9/01 Quinn We now handle unpacked data sections, courtesy of some code from
+ Ned Holbrook.
+ <8> 19/9/01 Quinn Minor fixes for the previous checkin. Updated some comments and
+ killed some dead code.
+ <7> 19/9/01 Quinn Simplified API and implementation after a suggestion by Eric
+ Grant. You no longer have to CFM export a dummy function; you
+ can just pass in the address of your fragment's init routine.
+ <6> 15/2/01 Quinn Modify compile-time warnings to complain if you try to build
+ this module into a Mach-O binary.
+ <5> 5/2/01 Quinn Removed redundant assignment in CFMLateImportCore.
+ <4> 30/11/00 Quinn Added comment about future of data symbols in CF.
+ <3> 16/11/00 Quinn Allow symbol finding via a callback and use that to implement
+ CFBundle support.
+ <2> 18/10/99 Quinn Renamed CFMLateImport to CFMLateImportLibrary to allow for
+ possible future API expansion.
+ <1> 15/6/99 Quinn First checked in.
+*/
+
+// To Do List:
+//
+// o get rid of dependence on ANSI "string.h", but how?
+//
+// Done:
+//
+// Ã investigate alternative APIs, like an external lookup routine
+// renamed CFMLateImport to CFMLateImportLibrary to allow for
+// future expansion of the APIs for things like CFMLateImportSymbol
+// Ã test with non-zero fragment offset in the file
+// Ã test more with MPW fragments
+// Ã test data imports
+
+/////////////////////////////////////////////////////////////////
+
+// MoreIsBetter Setup
+
+//#include "MoreSetup.h"
+#define MoreAssert(x) (true)
+#define MoreAssertQ(x)
+
+// Mac OS Interfaces
+
+#if ! MORE_FRAMEWORK_INCLUDES
+ #include <CodeFragments.h>
+ #include <PEFBinaryFormat.h>
+#endif
+
+// Standard C Interfaces
+
+#include <string.h>
+
+// MIB Prototypes
+
+//#include "MoreInterfaceLib.h"
+#define MoreBlockZero BlockZero
+
+// Our Prototypes
+
+#include "CFMLateImport.h"
+
+/////////////////////////////////////////////////////////////////
+
+#if TARGET_RT_MAC_MACHO
+ #error CFMLateImport is not suitable for use in a Mach-O project.
+#elif !TARGET_RT_MAC_CFM || !TARGET_CPU_PPC
+ #error CFMLateImport has not been qualified for 68K or CFM-68K use.
+#endif
+
+/////////////////////////////////////////////////////////////////
+#pragma mark ----- Utility Routines -----
+
+static OSStatus FSReadAtOffset(SInt16 refNum, SInt32 offset, SInt32 count, void *buffer)
+ // A convenient wrapper around PBRead which has two advantages
+ // over FSRead. First, it takes count as a value parameter.
+ // Second, it reads from an arbitrary offset into the file,
+ // which avoids a bunch of SetFPos calls.
+ //
+ // I guess this should go into "MoreFiles.h", but I'm not sure
+ // how we're going to integrate such a concept into MIB yet.
+{
+ ParamBlockRec pb;
+
+ pb.ioParam.ioRefNum = refNum;
+ pb.ioParam.ioBuffer = (Ptr) buffer;
+ pb.ioParam.ioReqCount = count;
+ pb.ioParam.ioPosMode = fsFromStart;
+ pb.ioParam.ioPosOffset = offset;
+
+ return PBReadSync(&pb);
+}
+
+/////////////////////////////////////////////////////////////////
+#pragma mark ----- Late Import Engine -----
+
+// This structure represents the core data structure of the late import
+// engine. It basically holds information about the fragment we're going
+// to fix up. It starts off with the first three fields, which are
+// provided by the client. Then, as we procede through the operation,
+// we fill out more fields.
+
+struct FragToFixInfo {
+ CFragSystem7DiskFlatLocator locator; // How to find the fragment's container.
+ CFragConnectionID connID; // CFM connection to the fragment.
+ CFragInitFunction initRoutine; // The CFM init routine for the fragment.
+ PEFContainerHeader containerHeader; // The CFM header, read in from the container.
+ PEFSectionHeader *sectionHeaders; // The CFM section headers. A pointer block containing an array of containerHeader.sectionCount elements.
+ PEFLoaderInfoHeader *loaderSection; // The entire CFM loader section in a pointer block.
+ SInt16 fileRef; // A read-only path to the CFM container. We keep this here because one that one routine needs to read from the container.
+ void *section0Base; // The base address of section 0, which we go through hoops to calculate.
+ void *section1Base; // The base address of section 1, which we go through hoops to calculate.
+ Boolean disposeSectionPointers; // See below.
+};
+typedef struct FragToFixInfo FragToFixInfo;
+
+// The disposeSectionPointers Boolean is designed for future cool VM
+// support. If VM is on, the entire code fragment is file mapped into
+// high memory, including the data we're forced to allocate the
+// sectionHeaders and loaderSection memory blocks to maintain. If
+// we could find the address of the entire file mapped container,
+// we could access the information directly from there and thus
+// we wouldn't need to allocate (or dispose of) the memory blocks
+// for sectionHeaders and loaderSection.
+//
+// I haven't implemented this yet because a) I'm not sure how to do
+// it with documented APIs, and b) I couldn't be bothered, but
+// disposeSectionPointers remains as vestigial support for the concept.
+
+static OSStatus ReadContainerBasics(FragToFixInfo *fragToFix)
+ // Reads some basic information from the container of the
+ // fragment to fix and stores it in various fields of
+ // fragToFix. This includes:
+ //
+ // o containerHeader -- The contain header itself.
+ // o sectionHeaders -- The array of section headers (in a newly allocated pointer block).
+ // o loaderSection -- The entire loader section (in a newly allocated pointer block).
+ //
+ // Also sets disposeSectionPointers to indicate whether
+ // the last two pointers should be disposed of.
+ //
+ // Finally, it leaves the container file open for later
+ // folks who want to read data from it.
+{
+ OSStatus err;
+ UInt16 sectionIndex;
+ Boolean found;
+
+ MoreAssertQ(fragToFix != nil);
+ MoreAssertQ(fragToFix->locator.fileSpec != nil);
+ MoreAssertQ(fragToFix->connID != nil);
+ MoreAssertQ(fragToFix->loaderSection == nil);
+ MoreAssertQ(fragToFix->sectionHeaders == nil);
+ MoreAssertQ(fragToFix->fileRef == 0);
+
+ fragToFix->disposeSectionPointers = true;
+
+ // Open up the file, read the container head, then read in
+ // all the section headers, then go looking through the
+ // section headers for the loader section (PEF defines
+ // that there can be only one).
+
+ err = FSpOpenDF(fragToFix->locator.fileSpec, fsRdPerm, &fragToFix->fileRef);
+ if (err == noErr) {
+ err = FSReadAtOffset(fragToFix->fileRef,
+ fragToFix->locator.offset,
+ sizeof(fragToFix->containerHeader),
+ &fragToFix->containerHeader);
+ if (err == noErr) {
+ if ( fragToFix->containerHeader.tag1 != kPEFTag1
+ || fragToFix->containerHeader.tag2 != kPEFTag2
+ || fragToFix->containerHeader.architecture != kCompiledCFragArch
+ || fragToFix->containerHeader.formatVersion != kPEFVersion) {
+ err = cfragFragmentFormatErr;
+ }
+ }
+ if (err == noErr) {
+ fragToFix->sectionHeaders = (PEFSectionHeader *) NewPtr(fragToFix->containerHeader.sectionCount * sizeof(PEFSectionHeader));
+ err = MemError();
+ }
+ if (err == noErr) {
+ err = FSReadAtOffset(fragToFix->fileRef,
+ fragToFix->locator.offset + sizeof(fragToFix->containerHeader),
+ fragToFix->containerHeader.sectionCount * sizeof(PEFSectionHeader),
+ fragToFix->sectionHeaders);
+ }
+ if (err == noErr) {
+ sectionIndex = 0;
+ found = false;
+ while ( sectionIndex < fragToFix->containerHeader.sectionCount && ! found ) {
+ found = (fragToFix->sectionHeaders[sectionIndex].sectionKind == kPEFLoaderSection);
+ if ( ! found ) {
+ sectionIndex += 1;
+ }
+ }
+ }
+ if (err == noErr && ! found) {
+ err = cfragNoSectionErr;
+ }
+
+ // Now read allocate a pointer block and read the loader section into it.
+
+ if (err == noErr) {
+ fragToFix->loaderSection = (PEFLoaderInfoHeader *) NewPtr(fragToFix->sectionHeaders[sectionIndex].containerLength);
+ err = MemError();
+ }
+ if (err == noErr) {
+ err = FSReadAtOffset(fragToFix->fileRef,
+ fragToFix->locator.offset + fragToFix->sectionHeaders[sectionIndex].containerOffset,
+ fragToFix->sectionHeaders[sectionIndex].containerLength,
+ fragToFix->loaderSection);
+ }
+ }
+
+ // No clean up. The client must init fragToFix to zeros and then
+ // clean up regardless of whether we return an error.
+
+ return err;
+}
+
+static UInt32 DecodeVCountValue(const UInt8 *start, UInt32 *outCount)
+ // Given a pointer to the start of a variable length PEF value,
+ // work out the value (in *outCount). Returns the number of bytes
+ // consumed by the value.
+{
+ UInt8 * bytePtr;
+ UInt8 byte;
+ UInt32 count;
+
+ bytePtr = (UInt8 *)start;
+
+ // Code taken from "PEFBinaryFormat.h".
+ count = 0;
+ do {
+ byte = *bytePtr++;
+ count = (count << kPEFPkDataVCountShift) | (byte & kPEFPkDataVCountMask);
+ } while ((byte & kPEFPkDataVCountEndMask) != 0);
+
+ *outCount = count;
+ return bytePtr - start;
+}
+
+static UInt32 DecodeInstrCountValue(const UInt8 *inOpStart, UInt32 *outCount)
+ // Given a pointer to the start of an opcode (inOpStart), work out the
+ // count argument for that opcode (*outCount). Returns the number of
+ // bytes consumed by the opcode and count combination.
+{
+ MoreAssertQ(inOpStart != nil);
+ MoreAssertQ(outCount != nil);
+
+ if (PEFPkDataCount5(*inOpStart) != 0)
+ {
+ // Simple case, count encoded in opcode.
+ *outCount = PEFPkDataCount5(*inOpStart);
+ return 1;
+ }
+ else
+ {
+ // Variable-length case.
+ return 1 + DecodeVCountValue(inOpStart + 1, outCount);
+ }
+}
+
+static OSStatus UnpackPEFDataSection(const UInt8 * const packedData, UInt32 packedSize,
+ UInt8 * const unpackedData, UInt32 unpackedSize)
+{
+ OSErr err;
+ UInt32 offset;
+ UInt8 opCode;
+ UInt8 * unpackCursor;
+
+ MoreAssertQ(packedData != nil);
+ MoreAssertQ(unpackedData != nil);
+ MoreAssertQ(unpackedSize >= packedSize);
+
+ // The following asserts assume that the client allocated the memory with NewPtr,
+ // which may not always be true. However, the asserts' value in preventing accidental
+ // memory block overruns outweighs the possible maintenance effort.
+
+ MoreAssertQ( packedSize == GetPtrSize( (Ptr) packedData ) );
+ MoreAssertQ( unpackedSize == GetPtrSize( (Ptr) unpackedData) );
+
+ err = noErr;
+ offset = 0;
+ unpackCursor = unpackedData;
+ while (offset < packedSize) {
+ MoreAssertQ(unpackCursor < &unpackedData[unpackedSize]);
+
+ opCode = packedData[offset];
+
+ switch (PEFPkDataOpcode(opCode)) {
+ case kPEFPkDataZero:
+ {
+ UInt32 count;
+
+ offset += DecodeInstrCountValue(&packedData[offset], &count);
+
+ MoreBlockZero(unpackCursor, count);
+ unpackCursor += count;
+ }
+ break;
+
+ case kPEFPkDataBlock:
+ {
+ UInt32 blockSize;
+
+ offset += DecodeInstrCountValue(&packedData[offset], &blockSize);
+
+ BlockMoveData(&packedData[offset], unpackCursor, blockSize);
+ unpackCursor += blockSize;
+ offset += blockSize;
+ }
+ break;
+
+ case kPEFPkDataRepeat:
+ {
+ UInt32 blockSize;
+ UInt32 repeatCount;
+ UInt32 loopCounter;
+
+ offset += DecodeInstrCountValue(&packedData[offset], &blockSize);
+ offset += DecodeVCountValue(&packedData[offset], &repeatCount);
+ repeatCount += 1; // stored value is (repeatCount - 1)
+
+ for (loopCounter = 0; loopCounter < repeatCount; loopCounter++) {
+ BlockMoveData(&packedData[offset], unpackCursor, blockSize);
+ unpackCursor += blockSize;
+ }
+ offset += blockSize;
+ }
+ break;
+
+ case kPEFPkDataRepeatBlock:
+ {
+ UInt32 commonSize;
+ UInt32 customSize;
+ UInt32 repeatCount;
+ const UInt8 *commonData;
+ const UInt8 *customData;
+ UInt32 loopCounter;
+
+ offset += DecodeInstrCountValue(&packedData[offset], &commonSize);
+ offset += DecodeVCountValue(&packedData[offset], &customSize);
+ offset += DecodeVCountValue(&packedData[offset], &repeatCount);
+
+ commonData = &packedData[offset];
+ customData = &packedData[offset + commonSize];
+
+ for (loopCounter = 0; loopCounter < repeatCount; loopCounter++) {
+ BlockMoveData(commonData, unpackCursor, commonSize);
+ unpackCursor += commonSize;
+ BlockMoveData(customData, unpackCursor, customSize);
+ unpackCursor += customSize;
+ customData += customSize;
+ }
+ BlockMoveData(commonData, unpackCursor, commonSize);
+ unpackCursor += commonSize;
+ offset += (repeatCount * (commonSize + customSize)) + commonSize;
+ }
+ break;
+
+ case kPEFPkDataRepeatZero:
+ {
+ UInt32 commonSize;
+ UInt32 customSize;
+ UInt32 repeatCount;
+ const UInt8 *customData;
+ UInt32 loopCounter;
+
+ offset += DecodeInstrCountValue(&packedData[offset], &commonSize);
+ offset += DecodeVCountValue(&packedData[offset], &customSize);
+ offset += DecodeVCountValue(&packedData[offset], &repeatCount);
+
+ customData = &packedData[offset];
+
+ for (loopCounter = 0; loopCounter < repeatCount; loopCounter++) {
+ MoreBlockZero(unpackCursor, commonSize);
+ unpackCursor += commonSize;
+ BlockMoveData(customData, unpackCursor, customSize);
+ unpackCursor += customSize;
+ customData += customSize;
+ }
+ MoreBlockZero(unpackCursor, commonSize);
+ unpackCursor += commonSize;
+ offset += repeatCount * customSize;
+ }
+ break;
+
+ default:
+ #if MORE_DEBUG
+ DebugStr("\pUnpackPEFDataSection: Unexpected data opcode");
+ #endif
+ err = cfragFragmentCorruptErr;
+ goto leaveNow;
+ break;
+ }
+ }
+
+leaveNow:
+ return err;
+}
+
+/* SetupSectionBaseAddresses Rationale
+ -----------------------------------
+
+ OK, here's where things get weird. In order to run the relocation
+ engine, I need to be able to find the base address of an instantiated
+ section of the fragment we're fixing up given only its section number.
+ This isn't hard for CFM to do because it's the one that instantiated the
+ sections in the first place. It's surprisingly difficult to do if
+ you're not CFM. [And you don't have access to the private CFM APis for
+ doing it.]
+
+ [Alan Lillich is going to kill me when he reads this! I should point out
+ that TVector's don't have to contain two words, they can be longer,
+ and that the second word isn't necessarily a TOC pointer, it's
+ just that the calling conventions require that it be put in the
+ TOC register when the code is called.
+
+ Furthermore, the code section isn't always section 0, and the data
+ section isn't always section 1, and there can be zero to many sections
+ of each type.
+
+ But these niceties are besides the point: I'm doing something tricky
+ because I don't have a nice API for getting section base addresses.
+ If I had a nice API for doing that, none of this code would exist.
+ ]
+
+ The technique is very sneaky (thanks to Eric Grant). The fragment to
+ fix necessarily has a CFM init routine (because it needs that routine
+ in order to capture the fragment location and connection ID). Thus the
+ fragment to fix must have a TVector in its data section. TVectors are
+ interesting because they're made up of two words. The first is a pointer
+ to the code that implements the routine; the second is a pointer to the TOC
+ for the fragment that's exporting the TVector. How TVectors are
+ created is interesting too. On disk, a TVector consists of two words,
+ the first being the offset from the start of the code section to the
+ routine, the second being the offset from the start of the data section
+ to the TOC base. When CFM prepares a TVector, it applies the following
+ transform:
+
+ tvector.codePtr = tvector.codeOffset + base of code section
+ tvector.tocPtr = tvector.tocOffset + base of data section
+
+ Now, you can reverse these questions to make them:
+
+ base of code section = tvector.codePtr - tvector.codeOffset
+ base of data section = tvector.dataPtr - tvector.dataOffset
+
+ So if you can find the relocated contents of the TVector and
+ find the original offsets that made up the TVector, you can then
+ calculate the base address of both the code and data sections.
+
+ Finding the relocated contents of the TVector is easy; I simply
+ require the client to pass in a pointer to its init routine.
+ A routine pointer is a TVector pointer, so you can just cast it
+ and extract the pair of words.
+
+ Finding the original offsets is a trickier. My technique is to
+ look up the init routine in the fragment's loader info header. This
+ yields the section number and offset where the init routine's unrelocated
+ TVector exists. Once I have that, I can just read the unrelocated TVector
+ out of the file and extract the offsets.
+*/
+
+struct TVector {
+ void *codePtr;
+ void *tocPtr;
+};
+typedef struct TVector TVector;
+
+static OSStatus SetupSectionBaseAddresses(FragToFixInfo *fragToFix)
+ // This routine initialises the section0Base and section1Base
+ // base fields of fragToFix to the base addresses of the
+ // instantiated fragment represented by the other fields
+ // of fragToFix. The process works in three states:
+ //
+ // 1. Find the contents of the relocated TVector of the
+ // fragment's initialisation routine, provided to us by
+ // the caller.
+ //
+ // 2. Find the contents of the non-relocated TVector by
+ // looking it up in the PEF loader info header and then
+ // using that to read the TVector contents from disk.
+ // This yields the offsets from the section bases for
+ // the init routine.
+ //
+ // 3. Subtract 2 from 3.
+{
+ OSStatus err;
+ TVector * relocatedExport;
+ SInt32 initSection;
+ UInt32 initOffset;
+ PEFSectionHeader * initSectionHeader;
+ Ptr packedDataSection;
+ Ptr unpackedDataSection;
+ TVector originalOffsets;
+
+ packedDataSection = nil;
+ unpackedDataSection = nil;
+
+ // Step 1.
+
+ // First find the init routine's TVector, which gives us the relocated
+ // offsets of the init routine into the data and code sections.
+
+ relocatedExport = (TVector *) fragToFix->initRoutine;
+
+ // Step 2.
+
+ // Now find the init routine's TVector's offsets in the data section on
+ // disk. This gives us the raw offsets from the data and code section
+ // of the beginning of the init routine.
+
+ err = noErr;
+ initSection = fragToFix->loaderSection->initSection;
+ initOffset = fragToFix->loaderSection->initOffset;
+ if (initSection == -1) {
+ err = cfragFragmentUsageErr;
+ }
+ if (err == noErr) {
+ MoreAssertQ( initSection >= 0 ); // Negative indexes are pseudo-sections which are just not allowed!
+ MoreAssertQ( initSection < fragToFix->containerHeader.sectionCount );
+
+ initSectionHeader = &fragToFix->sectionHeaders[initSection];
+
+ // If the data section is packed, unpack it to a temporary buffer and then get the
+ // original offsets from that buffer. If the data section is unpacked, just read
+ // the original offsets directly off the disk.
+
+ if ( initSectionHeader->sectionKind == kPEFPackedDataSection ) {
+
+ // Allocate space for packed and unpacked copies of the section.
+
+ packedDataSection = NewPtr(initSectionHeader->containerLength);
+ err = MemError();
+
+ if (err == noErr) {
+ unpackedDataSection = NewPtr(initSectionHeader->unpackedLength);
+ err = MemError();
+ }
+
+ // Read the contents of the packed section.
+
+ if (err == noErr) {
+ err = FSReadAtOffset( fragToFix->fileRef,
+ fragToFix->locator.offset
+ + initSectionHeader->containerOffset,
+ initSectionHeader->containerLength,
+ packedDataSection);
+ }
+
+ // Unpack the data into the unpacked section.
+
+ if (err == noErr) {
+ err = UnpackPEFDataSection( (UInt8 *) packedDataSection, initSectionHeader->containerLength,
+ (UInt8 *) unpackedDataSection, initSectionHeader->unpackedLength);
+ }
+
+ // Extract the init routine's TVector from the unpacked section.
+
+ if (err == noErr) {
+ BlockMoveData(unpackedDataSection + initOffset, &originalOffsets, sizeof(TVector));
+ }
+
+ } else {
+ MoreAssertQ(fragToFix->sectionHeaders[initSection].sectionKind == kPEFUnpackedDataSection);
+ err = FSReadAtOffset(fragToFix->fileRef,
+ fragToFix->locator.offset
+ + fragToFix->sectionHeaders[initSection].containerOffset
+ + initOffset,
+ sizeof(TVector),
+ &originalOffsets);
+ }
+ }
+
+ // Step 3.
+
+ // Do the maths to subtract the unrelocated offsets from the current address
+ // to get the base address.
+
+ if (err == noErr) {
+ fragToFix->section0Base = ((char *) relocatedExport->codePtr) - (UInt32) originalOffsets.codePtr;
+ fragToFix->section1Base = ((char *) relocatedExport->tocPtr) - (UInt32) originalOffsets.tocPtr;
+ }
+
+ // Clean up.
+
+ if (packedDataSection != nil) {
+ DisposePtr(packedDataSection);
+ MoreAssertQ( MemError() == noErr );
+ }
+ if (unpackedDataSection != nil) {
+ DisposePtr(unpackedDataSection);
+ MoreAssertQ( MemError() == noErr );
+ }
+ return err;
+}
+
+static void *GetSectionBaseAddress(const FragToFixInfo *fragToFix, UInt16 sectionIndex)
+ // This routine returns the base of the instantiated section
+ // whose index is sectionIndex. This routine is the evil twin
+ // of SetupSectionBaseAddresses. It simply returns the values
+ // for section 0 and 1 that we derived in SetupSectionBaseAddresses.
+ // In a real implementation, this routine would call CFM API
+ // to get this information, and SetupSectionBaseAddresses would
+ // not exist, but CFM does not export the necessary APIs to
+ // third parties.
+{
+ void *result;
+
+ MoreAssertQ(fragToFix != nil);
+ MoreAssertQ(fragToFix->containerHeader.tag1 == kPEFTag1);
+
+ switch (sectionIndex) {
+ case 0:
+ result = fragToFix->section0Base;
+ break;
+ case 1:
+ result = fragToFix->section1Base;
+ break;
+ default:
+ result = nil;
+ break;
+ }
+ return result;
+}
+
+
+static OSStatus FindImportLibrary(PEFLoaderInfoHeader *loaderSection, const char *libraryName, PEFImportedLibrary **importLibrary)
+ // This routine finds the import library description (PEFImportedLibrary)
+ // for the import library libraryName in the PEF loader section.
+ // It sets *importLibrary to the address of the description.
+{
+ OSStatus err;
+ UInt32 librariesRemaining;
+ PEFImportedLibrary *thisImportLibrary;
+ Boolean found;
+
+ MoreAssertQ(loaderSection != nil);
+ MoreAssertQ(libraryName != nil);
+ MoreAssertQ(importLibrary != nil);
+
+ // Loop through each import library looking for a matching name.
+
+ // Initialise thisImportLibrary to point to the byte after the
+ // end of the loader section's header.
+
+ thisImportLibrary = (PEFImportedLibrary *) (loaderSection + 1);
+ librariesRemaining = loaderSection->importedLibraryCount;
+ found = false;
+ while ( librariesRemaining > 0 && ! found ) {
+ // PEF defines that import library names will have
+ // a null terminator, so we can just use strcmp.
+ found = (strcmp( libraryName,
+ ((char *)loaderSection)
+ + loaderSection->loaderStringsOffset
+ + thisImportLibrary->nameOffset) == 0);
+ // *** Remove ANSI strcmp eventually.
+ if ( ! found ) {
+ thisImportLibrary += 1;
+ librariesRemaining -= 1;
+ }
+ }
+
+ if (found) {
+ *importLibrary = thisImportLibrary;
+ err = noErr;
+ } else {
+ *importLibrary = nil;
+ err = cfragNoLibraryErr;
+ }
+ return err;
+}
+
+static OSStatus LookupSymbol(CFMLateImportLookupProc lookup, void *refCon,
+ PEFLoaderInfoHeader *loaderSection,
+ UInt32 symbolIndex,
+ UInt32 *symbolValue)
+ // This routine is used to look up a symbol during relocation.
+ // "lookup" is a client callback and refCon is its argument.
+ // Typically refCon is the CFM connection to the library that is
+ // substituting for the weak linked library. loaderSection
+ // is a pointer to the loader section of the fragment to fix up.
+ // symbolIndex is the index of the imported symbol in the loader section.
+ // The routine sets the word pointed to by symbolValue to the
+ // value of the symbol.
+ //
+ // The routine works by using symbolIndex to index into the imported
+ // symbol table to find the offset of the symbol's name in the string
+ // table. It then looks up the symbol by calling the client's "lookup"
+ // function and passes the resulting symbol address back in symbolValue.
+{
+ OSStatus err;
+ UInt32 *importSymbolTable;
+ UInt32 symbolStringOffset;
+ Boolean symbolIsWeak;
+ CFragSymbolClass symbolClass;
+ char *symbolStringAddress;
+ Str255 symbolString;
+
+ MoreAssertQ(lookup != nil);
+ MoreAssertQ(loaderSection != nil);
+ MoreAssertQ(symbolIndex < loaderSection->totalImportedSymbolCount);
+ MoreAssertQ(symbolValue != nil);
+
+ // Find the base of the imported symbol table.
+
+ importSymbolTable = (UInt32 *)(((char *)(loaderSection + 1)) + (loaderSection->importedLibraryCount * sizeof(PEFImportedLibrary)));
+
+ // Grab the appropriate entry out of the table and
+ // extract the information from that entry.
+
+ symbolStringOffset = importSymbolTable[symbolIndex];
+ symbolClass = PEFImportedSymbolClass(symbolStringOffset);
+ symbolIsWeak = ((symbolClass & kPEFWeakImportSymMask) != 0);
+ symbolClass = symbolClass & ~kPEFWeakImportSymMask;
+ symbolStringOffset = PEFImportedSymbolNameOffset(symbolStringOffset);
+
+ // Find the string for the symbol in the strings table and
+ // extract it from the table into a Pascal string on the stack.
+
+ symbolStringAddress = ((char *)loaderSection) + loaderSection->loaderStringsOffset + symbolStringOffset;
+ symbolString[0] = strlen(symbolStringAddress); // *** remove ANSI strlen
+ BlockMoveData(symbolStringAddress, &symbolString[1], symbolString[0]);
+
+ // Look up the symbol in substitute library. If it fails, return
+ // a 0 value and check whether the error is fatal (a strong linked
+ // symbol) or benign (a weak linked symbol).
+
+ err = lookup(symbolString, symbolClass, (void **) symbolValue, refCon);
+ if (err != noErr) {
+ *symbolValue = 0;
+ if (symbolIsWeak) {
+ err = noErr;
+ }
+ }
+ return err;
+}
+
+// The EngineState structure encapsulates all of the persistent state
+// of the CFM relocation engine virtual machine. I originally defined
+// this structure so I could pass the state around between routines
+// that implement various virtual opcodes, however I later worked
+// out that the relocation was sufficiently simple that I could put it
+// in in one routine. Still, I left the state in this structure in
+// case I ever need to reverse that decision. It's also a convenient
+// instructional design.
+
+struct EngineState {
+ UInt32 currentReloc; // Index of current relocation opcodes
+ UInt32 terminatingReloc; // Index of relocation opcodes which terminates relocation
+ UInt32 *sectionBase; // Start of the section
+ UInt32 *relocAddress; // Address within the section where the relocations are to be performed
+ UInt32 importIndex; // Symbol index, which is used to access an imported symbol's address
+ void *sectionC; // Memory address of an instantiated section within the PEF container; this variable is used by relocation opcodes that relocate section addresses
+ void *sectionD; // Memory address of an instantiated section within the PEF container; this variable is used by relocation opcodes that relocate section addresses
+};
+typedef struct EngineState EngineState;
+
+// Note:
+// If I ever have to support the repeat opcodes, I'll probably
+// have to add a repeat counter to EngineState.
+
+static OSStatus InitEngineState(const FragToFixInfo *fragToFix,
+ UInt16 relocHeaderIndex,
+ EngineState *state)
+ // This routine initialises the engine state suitably for
+ // running the relocation opcodes for the section whose
+ // index is relocHeaderIndex. relocHeaderIndex is not a
+ // a section number. See the comment where it's used below
+ // for details. The routine basically fills out all the fields
+ // in the EngineState structure as described by
+ // "Mac OS Runtime Architectures".
+{
+ OSStatus err;
+ PEFLoaderRelocationHeader *relocHeader;
+
+ MoreAssertQ(fragToFix != nil);
+ MoreAssertQ(state != nil);
+
+ // This bit is tricky. relocHeaderIndex is an index into the relocation
+ // header table, starting at relocSectionCount (which is in the loader
+ // section header) for the first relocated section and decrementing
+ // down to 1 for the last relocated section. I find the relocation
+ // header by using relocHeaderIndex as a index backwards from the
+ // start of the relocation opcodes (ie relocInstrOffset). If you
+ // look at the diagram of the layout of the container in
+ // "PEFBinaryFormat.h", you'll see that the relocation opcodes
+ // immediately follow the relocation headers.
+ //
+ // I did this because the alternative (starting at the loader
+ // header and stepping past the import library table and the
+ // import symbol table) was a pain.
+
+ relocHeader = (PEFLoaderRelocationHeader *) (((char *) fragToFix->loaderSection) + fragToFix->loaderSection->relocInstrOffset - relocHeaderIndex * sizeof(PEFLoaderRelocationHeader));
+
+ MoreAssertQ(relocHeader->reservedA == 0); // PEF spec says it must be; we check to try to catch bugs in calculation of relocHeader
+
+ state->currentReloc = relocHeader->firstRelocOffset;
+ state->terminatingReloc = relocHeader->firstRelocOffset + relocHeader->relocCount;
+ state->sectionBase = (UInt32 *) GetSectionBaseAddress(fragToFix, relocHeader->sectionIndex);
+ state->relocAddress = state->sectionBase;
+ state->importIndex = 0;
+
+ // From "Mac OS Runtime Architectures":
+ //
+ // The sectionC and sectionD variables actually contain the
+ // memory address of an instantiated section minus the
+ // default address for that section. The default address for a
+ // section is contained in the defaultAddress field of the
+ // section header. However, in almost all cases the default
+ // address should be 0, so the simplified definition suffices.
+ //
+ // In the debug version, we drop into MacsBug if this weird case
+ // ever executes because it's more likely we made a mistake than
+ // we encountered a section with a default address.
+
+ state->sectionC = GetSectionBaseAddress(fragToFix, 0);
+ if (state->sectionC != nil) {
+ #if MORE_DEBUG
+ if (fragToFix->sectionHeaders[0].defaultAddress != 0) {
+ DebugStr("\pInitEngineState: Executing weird case.");
+ }
+ #endif
+ (char *) state->sectionC -= fragToFix->sectionHeaders[0].defaultAddress;
+ }
+ state->sectionD = GetSectionBaseAddress(fragToFix, 1);
+ if (state->sectionD != nil) {
+ #if MORE_DEBUG
+ if (fragToFix->sectionHeaders[1].defaultAddress != 0) {
+ DebugStr("\pInitEngineState: Executing weird case.");
+ }
+ #endif
+ (char *) state->sectionD -= fragToFix->sectionHeaders[1].defaultAddress;
+ }
+
+ err = noErr;
+ if (state->relocAddress == nil) {
+ err = cfragFragmentUsageErr;
+ }
+ return err;
+}
+
+// kPEFRelocBasicOpcodes is a table that maps the top 7 bits of the opcode
+// to a fundamental action. It's contents are defined for me in "PEFBinaryFormat.h",
+// which is really convenient.
+
+static UInt8 kPEFRelocBasicOpcodes[kPEFRelocBasicOpcodeRange] = { PEFMaskedBasicOpcodes };
+
+static OSStatus RunRelocationEngine(const FragToFixInfo *fragToFix,
+ PEFImportedLibrary *importLibrary,
+ CFMLateImportLookupProc lookup, void *refCon)
+ // This is where the rubber really hits the. Given a fully
+ // populated fragToFix structure, the import library description
+ // of the weak imported library we're resolving, and a connection
+ // to the library we're going to substitute it, re-execute the
+ // relocation instructions (CFM has already executed them once)
+ // but only *do* instructions (ie store the change to the data section)
+ // that CFM skipped because the weak symbols were missing.
+{
+ OSStatus err;
+ EngineState state;
+ UInt16 sectionsLeftToRelocate;
+ UInt32 totalRelocs;
+ UInt16 *relocInstrTable;
+ UInt16 opCode;
+
+ MoreAssertQ(fragToFix != nil);
+ MoreAssertQ(fragToFix->containerHeader.tag1 == kPEFTag1);
+ MoreAssertQ(fragToFix->sectionHeaders != nil);
+ MoreAssertQ(fragToFix->loaderSection != nil);
+ MoreAssertQ(fragToFix->section0Base != nil); // Technically, having a nil for these two is not a problem, ...
+ MoreAssertQ(fragToFix->section1Base != nil); // but in practise it a wildly deviant case and we should know about it.
+ MoreAssertQ(importLibrary != nil);
+ MoreAssertQ(lookup != nil);
+
+ // Before entering the loop, work out some information in advance.
+
+ // totalRelocs is only used for debugging, to make sure our
+ // relocation PC (state.currentReloc) doesn't run wild.
+
+ totalRelocs = (fragToFix->loaderSection->loaderStringsOffset - fragToFix->loaderSection->relocInstrOffset) / sizeof(UInt16);
+
+ // relocInstrTable is the base address of the table of relocation
+ // instructions in the fragment to fix.
+
+ relocInstrTable = (UInt16 *)((char *) fragToFix->loaderSection + fragToFix->loaderSection->relocInstrOffset);
+
+ // sectionsLeftToRelocate is the loop counter for the outer loop.
+
+ MoreAssertQ(fragToFix->loaderSection->relocSectionCount <= 0x0FFFF);
+ sectionsLeftToRelocate = fragToFix->loaderSection->relocSectionCount;
+
+ // Now let's run the relocation engine. We run it once per
+ // section in the table. Each time around, we init the engine
+ // and then loop again, this time executing individual opcodes.
+ // The opcode loop terminates when the relocation PC
+ // (state.currentReloc) hits the final opcode (state.terminatingReloc).
+
+ // Note:
+ // One design decision I made was to totally re-init the engine state
+ // for each section. The CFM spec is unclear as to whether you're supposed
+ // to totally re-init the engine state, or just re-init the section-specific
+ // state (ie currentReloc, terminatingReloc, and relocAddress). I hope this
+ // is correct, but it's hard to test without having a fragment with multiple
+ // relocated sections, which is difficult to create.
+
+ // How do I decide which opcodes should be effective (ie make changes to
+ // the section being relocated) and which opcodes should just be executed
+ // for their side effects (ie updated state.relocAddress or state.importIndex)?
+ // The answer is both simple and subtle. Opcodes whose actions are dependent
+ // on a symbol that was in the weak linked library are effective, those that
+ // an independent of those symbols are not. The only opcodes that use
+ // symbolic values are kPEFRelocImportRun and kPEFRelocSmByImport, and
+ // these are only if the symbol is in the weak linked library.
+ // All other cases are executed for their side effects only.
+ //
+ // How do I determine if a symbol is in the weak linked library?
+ // Well I know the symbol's index and I know the lower bound and count
+ // of the symbols in the weak linked library, so I just do a simple
+ // bounds test, ie
+ //
+ // firstImportedSymbol <= importIndex < firstImportedSymbol + importedSymbolCount
+
+ // From this code, it's relatively easy to see which relocation opcodes
+ // aren't implemented. If you ever encounter one, you'll find yourself
+ // in MacsBug with a message telling you which opcode was found. The
+ // two big groups of opcodes I skipped were the large format opcodes
+ // and the repeating opcodes. I skipped them because:
+ //
+ // a) I haven't got a way to generate them in a PEF container that I can
+ // test against. Without that, there's no way I could be assured that
+ // the code worked.
+ //
+ // b) I'm lazy.
+
+ err = noErr;
+ while ( sectionsLeftToRelocate > 0 ) {
+ err = InitEngineState(fragToFix, sectionsLeftToRelocate, &state);
+ if (err != noErr) {
+ goto leaveNow;
+ }
+
+ while ( state.currentReloc != state.terminatingReloc ) {
+
+ MoreAssertQ( state.currentReloc < totalRelocs );
+
+ opCode = relocInstrTable[state.currentReloc];
+ switch ( PEFRelocBasicOpcode(opCode) ) {
+ case kPEFRelocBySectDWithSkip:
+ {
+ UInt16 skipCount;
+ UInt16 relocCount;
+
+ skipCount = ((opCode >> 6) & 0x00FF);
+ relocCount = (opCode & 0x003F);
+ state.relocAddress += skipCount;
+ state.relocAddress += relocCount;
+ }
+ break;
+ case kPEFRelocBySectC:
+ case kPEFRelocBySectD:
+ {
+ UInt16 runLength;
+
+ runLength = (opCode & 0x01FF) + 1;
+ state.relocAddress += runLength;
+ }
+ break;
+ case kPEFRelocTVector12:
+ {
+ UInt16 runLength;
+
+ runLength = (opCode & 0x01FF) + 1;
+ state.relocAddress += (runLength * 3);
+ }
+ break;
+ case kPEFRelocTVector8:
+ case kPEFRelocVTable8:
+ {
+ UInt16 runLength;
+
+ runLength = (opCode & 0x01FF) + 1;
+ state.relocAddress += (runLength * 2);
+ }
+ break;
+ case kPEFRelocImportRun:
+ {
+ UInt32 symbolValue;
+ UInt16 runLength;
+
+ runLength = (opCode & 0x01FF) + 1;
+ while (runLength > 0) {
+ if ( state.importIndex >= importLibrary->firstImportedSymbol && state.importIndex < (importLibrary->firstImportedSymbol + importLibrary->importedSymbolCount) ) {
+ err = LookupSymbol(lookup, refCon, fragToFix->loaderSection, state.importIndex, &symbolValue);
+ if (err != noErr) {
+ goto leaveNow;
+ }
+ *(state.relocAddress) += symbolValue;
+ }
+ state.importIndex += 1;
+ state.relocAddress += 1;
+ runLength -= 1;
+ }
+ }
+ break;
+ case kPEFRelocSmByImport:
+ {
+ UInt32 symbolValue;
+ UInt32 index;
+
+ index = (opCode & 0x01FF);
+ if ( index >= importLibrary->firstImportedSymbol && index < (importLibrary->firstImportedSymbol + importLibrary->importedSymbolCount) ) {
+ err = LookupSymbol(lookup, refCon, fragToFix->loaderSection, index, &symbolValue);
+ if (err != noErr) {
+ goto leaveNow;
+ }
+ *(state.relocAddress) += symbolValue;
+ }
+ state.importIndex = index + 1;
+ state.relocAddress += 1;
+ }
+ break;
+ case kPEFRelocSmSetSectC:
+ {
+ UInt32 index;
+
+ index = (opCode & 0x01FF);
+ state.sectionC = GetSectionBaseAddress(fragToFix, index);
+ MoreAssertQ(state.sectionC != nil);
+ }
+ break;
+ case kPEFRelocSmSetSectD:
+ {
+ UInt32 index;
+
+ index = (opCode & 0x01FF);
+ state.sectionD = GetSectionBaseAddress(fragToFix, index);
+ MoreAssertQ(state.sectionD != nil);
+ }
+ break;
+ case kPEFRelocSmBySection:
+ state.relocAddress += 1;
+ break;
+ case kPEFRelocIncrPosition:
+ {
+ UInt16 offset;
+
+ offset = (opCode & 0x0FFF) + 1;
+ ((char *) state.relocAddress) += offset;
+ }
+ break;
+ case kPEFRelocSmRepeat:
+ #if MORE_DEBUG
+ DebugStr("\pRunRelocationEngine: kPEFRelocSmRepeat not yet implemented");
+ #endif
+ err = unimpErr;
+ goto leaveNow;
+ break;
+ case kPEFRelocSetPosition:
+ {
+ UInt32 offset;
+
+ // Lot's of folks have tried various interpretations of the description of
+ // this opCode in "Mac OS Runtime Architectures" (which states "This instruction
+ // sets relocAddress to the address of the section offset offset." *smile*).
+ // I eventually dug into the CFM source code to find my interpretation, which
+ // I believe is correct. The key point is tht the offset is relative to
+ // the start of the section for which these relocations are being performed.
+
+ // Skip to next reloc word, which is the second chunk of the offset.
+
+ state.currentReloc += 1;
+
+ // Extract offset based on the most significant 10 bits in opCode and
+ // the next significant 16 bits in the next reloc word.
+
+ offset = PEFRelocSetPosFullOffset(opCode, relocInstrTable[state.currentReloc]);
+
+ state.relocAddress = (UInt32 *) ( ((char *) state.sectionBase) + offset);
+ }
+ break;
+ case kPEFRelocLgByImport:
+ {
+ UInt32 symbolValue;
+ UInt32 index;
+
+ // Get the 26 bit symbol index from the current and next reloc words.
+
+ state.currentReloc += 1;
+ index = PEFRelocLgByImportFullIndex(opCode, relocInstrTable[state.currentReloc]);
+
+ if ( index >= importLibrary->firstImportedSymbol && index < (importLibrary->firstImportedSymbol + importLibrary->importedSymbolCount) ) {
+ err = LookupSymbol(lookup, refCon, fragToFix->loaderSection, index, &symbolValue);
+ if (err != noErr) {
+ goto leaveNow;
+ }
+ *(state.relocAddress) += symbolValue;
+ }
+ state.importIndex = index + 1;
+ state.relocAddress += 1;
+ }
+ break;
+ case kPEFRelocLgRepeat:
+ #if MORE_DEBUG
+ DebugStr("\pRunRelocationEngine: kPEFRelocLgRepeat not yet implemented");
+ #endif
+ err = unimpErr;
+ goto leaveNow;
+ break;
+ case kPEFRelocLgSetOrBySection:
+ #if MORE_DEBUG
+ DebugStr("\pRunRelocationEngine: kPEFRelocLgSetOrBySection not yet implemented");
+ #endif
+ err = unimpErr;
+ goto leaveNow;
+ break;
+ case kPEFRelocUndefinedOpcode:
+ err = cfragFragmentCorruptErr;
+ goto leaveNow;
+ break;
+ default:
+ MoreAssertQ(false);
+ err = cfragFragmentCorruptErr;
+ goto leaveNow;
+ break;
+ }
+ state.currentReloc += 1;
+ }
+
+ sectionsLeftToRelocate -= 1;
+ }
+
+leaveNow:
+ return err;
+}
+
+extern pascal OSStatus CFMLateImportCore(const CFragSystem7DiskFlatLocator *fragToFixLocator,
+ CFragConnectionID fragToFixConnID,
+ CFragInitFunction fragToFixInitRoutine,
+ ConstStr255Param weakLinkedLibraryName,
+ CFMLateImportLookupProc lookup,
+ void *refCon)
+ // See comments in interface part.
+{
+ OSStatus err;
+ OSStatus junk;
+ FragToFixInfo fragToFix;
+ PEFImportedLibrary *importLibrary;
+ char weakLinkedLibraryNameCString[256];
+
+ MoreAssertQ(fragToFixLocator != nil);
+ MoreAssertQ(fragToFixConnID != nil);
+ MoreAssertQ(fragToFixInitRoutine != nil);
+ MoreAssertQ(weakLinkedLibraryName != nil);
+ MoreAssertQ(lookup != nil);
+
+ // Fill out the bits of fragToFix which are passed in
+ // by the client.
+
+ MoreBlockZero(&fragToFix, sizeof(fragToFix));
+ fragToFix.locator = *fragToFixLocator;
+ fragToFix.connID = fragToFixConnID;
+ fragToFix.initRoutine = fragToFixInitRoutine;
+
+ // Make a C string from weakLinkedLibraryName.
+
+ BlockMoveData(weakLinkedLibraryName + 1, weakLinkedLibraryNameCString, weakLinkedLibraryName[0]);
+ weakLinkedLibraryNameCString[weakLinkedLibraryName[0]] = 0;
+
+ // Get the basic information from the fragment.
+ // Fills out the containerHeader, sectionHeaders, loaderSection and fileRef fields
+ // of fragToFix.
+
+ err = ReadContainerBasics(&fragToFix);
+
+ // Set up the base address fields in fragToFix (ie section0Base and section1Base)
+ // by looking up our init routine (fragToFix.initRoutine) and subtracting
+ // away the section offsets (which we get from the disk copy of the section)
+ // to derive the bases of the sections themselves.
+
+ if (err == noErr) {
+ err = SetupSectionBaseAddresses(&fragToFix);
+ }
+
+ // Look inside the loader section for the import library description
+ // of weakLinkedLibraryName. We need this to know the range of symbol
+ // indexes we're going to fix up.
+
+ if (err == noErr) {
+ err = FindImportLibrary(fragToFix.loaderSection, weakLinkedLibraryNameCString, &importLibrary);
+ }
+
+ // Do a quick check to ensure that the library was actually imported weak.
+ // If it wasn't, it doesn't make much sense to resolve its weak imports
+ // later on. Resolving them again is likely to be bad.
+
+ if (err == noErr) {
+ if ((importLibrary->options & kPEFWeakImportLibMask) == 0) {
+ err = cfragFragmentUsageErr;
+ }
+ }
+
+ // Now run the main relocation engine.
+
+ if (err == noErr) {
+ err = RunRelocationEngine(&fragToFix, importLibrary, lookup, refCon);
+ }
+
+ // Clean up.
+
+ if (fragToFix.disposeSectionPointers) {
+ if (fragToFix.fileRef != 0) {
+ junk = FSClose(fragToFix.fileRef);
+ MoreAssertQ(junk == noErr);
+ }
+ if (fragToFix.loaderSection != nil) {
+ DisposePtr( (Ptr) fragToFix.loaderSection);
+ MoreAssertQ(MemError() == noErr);
+ }
+ if (fragToFix.sectionHeaders != nil) {
+ DisposePtr( (Ptr) fragToFix.sectionHeaders);
+ MoreAssertQ(MemError() == noErr);
+ }
+ }
+ return err;
+}
+
+static pascal OSStatus FragmentLookup(ConstStr255Param symName, CFragSymbolClass symClass,
+ void **symAddr, void *refCon)
+ // This is the CFMLateImportLookupProc callback used when
+ // late importing from a CFM shared library.
+{
+ OSStatus err;
+ CFragConnectionID connIDToImport;
+ CFragSymbolClass foundSymClass;
+
+ MoreAssertQ(symName != nil);
+ MoreAssertQ(symAddr != nil);
+ MoreAssertQ(refCon != nil);
+
+ connIDToImport = (CFragConnectionID) refCon;
+
+ // Shame there's no way to validate that connIDToImport is valid.
+
+ err = FindSymbol(connIDToImport, symName, (Ptr *) symAddr, &foundSymClass);
+ if (err == noErr) {
+ // If the symbol isn't of the right class, we act like we didn't
+ // find it, but also assert in the debug build because weird things
+ // are afoot.
+ if (foundSymClass != symClass) {
+ MoreAssertQ(false);
+ *symAddr = nil;
+ err = cfragNoSymbolErr;
+ }
+ }
+ return err;
+}
+
+extern pascal OSStatus CFMLateImportLibrary(const CFragSystem7DiskFlatLocator *fragToFixLocator,
+ CFragConnectionID fragToFixConnID,
+ CFragInitFunction fragToFixInitRoutine,
+ ConstStr255Param weakLinkedLibraryName,
+ CFragConnectionID connIDToImport)
+ // See comments in interface part.
+{
+ MoreAssertQ(connIDToImport != nil);
+ return CFMLateImportCore(fragToFixLocator, fragToFixConnID, fragToFixInitRoutine,
+ weakLinkedLibraryName, FragmentLookup, connIDToImport);
+}
+
+static pascal OSStatus BundleLookup(ConstStr255Param symName, CFragSymbolClass symClass,
+ void **symAddr, void *refCon)
+ // This is the CFMLateImportLookupProc callback used when
+ // late importing from a CFBundle.
+{
+ OSStatus err;
+ CFBundleRef bundleToImport;
+ CFStringRef symNameStr;
+
+ MoreAssertQ(symName != nil);
+ MoreAssertQ(symAddr != nil);
+ MoreAssertQ(refCon != nil);
+
+ symNameStr = nil;
+
+ bundleToImport = (CFBundleRef) refCon;
+
+ // Shame there's no way to validate that bundleToImport is really a bundle.
+
+ // We can only find function pointers because CFBundleGetFunctionPointerForName
+ // only works for function pointers. So if the client is asking for something
+ // other than a function pointer (ie TVector symbol) then we don't even true.
+ // Also assert in the debug build because this shows a certain lack of
+ // understanding on the part of the client.
+ //
+ // CF is being revise to support accessing data symbols using a new API
+ // (currently this is available to Apple internal developers as
+ // CFBundleGetDataPointerForName). When the new API is available in a
+ // public header file I should revise this code to lift this restriction.
+
+ err = noErr;
+ if (symClass != kTVectorCFragSymbol) {
+ MoreAssertQ(false);
+ err = cfragNoSymbolErr;
+ }
+ if (err == noErr) {
+ symNameStr = CFStringCreateWithPascalString(kCFAllocatorSystemDefault,
+ symName, kCFStringEncodingMacRoman);
+ if (symNameStr == nil) {
+ err = coreFoundationUnknownErr;
+ }
+ }
+ if (err == noErr) {
+ *symAddr = CFBundleGetFunctionPointerForName(bundleToImport, symNameStr);
+ if (*symAddr == nil) {
+ err = cfragNoSymbolErr;
+ }
+ }
+ if (symNameStr != nil) {
+ CFRelease(symNameStr);
+ }
+ return err;
+}
+
+extern pascal OSStatus CFMLateImportBundle(const CFragSystem7DiskFlatLocator *fragToFixLocator,
+ CFragConnectionID fragToFixConnID,
+ CFragInitFunction fragToFixInitRoutine,
+ ConstStr255Param weakLinkedLibraryName,
+ CFBundleRef bundleToImport)
+ // See comments in interface part.
+{
+ MoreAssertQ(bundleToImport != nil);
+ return CFMLateImportCore(fragToFixLocator, fragToFixConnID, fragToFixInitRoutine,
+ weakLinkedLibraryName, BundleLookup, bundleToImport);
+}
diff --git a/Mac/Modules/cg/CFMLateImport.h b/Mac/Modules/cg/CFMLateImport.h
new file mode 100755
index 0000000000..0878960cd8
--- /dev/null
+++ b/Mac/Modules/cg/CFMLateImport.h
@@ -0,0 +1,272 @@
+/*
+ File: CFMLateImport.h
+
+ Contains: Interface to CFM late import library.
+
+ Written by: Quinn
+
+ Copyright: Copyright © 1999 by Apple Computer, Inc., all rights reserved.
+
+ You may incorporate this Apple sample source code into your program(s) without
+ restriction. This Apple sample source code has been provided "AS IS" and the
+ responsibility for its operation is yours. You are not permitted to redistribute
+ this Apple sample source code as "Apple sample source code" after having made
+ changes. If you're going to re-distribute the source, we require that you make
+ it clear in the source that the code was descended from Apple sample source
+ code, but that you've made changes.
+
+ Change History (most recent first):
+
+ <6> 21/9/01 Quinn Changes for CWPro7 Mach-O build.
+ <5> 19/9/01 Quinn Change comments to reflect the fact that an unpacked data
+ section is no longer required.
+ <4> 19/9/01 Quinn Simplified API and implementation after a suggestion by Eric
+ Grant. You no longer have to CFM export a dummy function; you
+ can just pass in the address of your fragment's init routine.
+ <3> 16/11/00 Quinn Allow symbol finding via a callback and use that to implement
+ CFBundle support.
+ <2> 18/10/99 Quinn Renamed CFMLateImport to CFMLateImportLibrary to allow for
+ possible future API expansion.
+ <1> 15/6/99 Quinn First checked in.
+*/
+
+#pragma once
+
+/////////////////////////////////////////////////////////////////
+
+// MoreIsBetter Setup
+
+//#include "MoreSetup.h"
+
+// Mac OS Interfaces
+
+#if ! MORE_FRAMEWORK_INCLUDES
+ #include <MacTypes.h>
+ #include <CodeFragments.h>
+ #include <Devices.h>
+ #include <CFBundle.h>
+#endif
+
+/////////////////////////////////////////////////////////////////
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* FAQ
+ ---
+
+ Q: What does this library do?
+ A: It allows you to resolve a weak linked library at runtime,
+ by supply a CFM connection to the library that should substitute
+ for the weak linked one.
+
+ Q: Does the substituted library have to have the same name as the
+ weak linked library.
+ A: No.
+
+ Q: What's this useful for?
+ A: The most obvious example of where this is useful is when
+ you rely on shared libraries that the user might delete
+ or move. To can find the shared library (possibly even
+ using CatSearch), call GetDiskFragment to open a connection
+ to it, late import it using this library, and then the
+ rest of your code can continue to use the shared library
+ as if nothing had happened. No more defining thousands
+ of stub routines which call through routine pointers.
+
+ There are, however, numerous less obvious uses. You can
+ use this code to make a 'self repairing' application. If
+ the user removes your shared library from the Extensions
+ folder, the startup code for your application can offer
+ tor re-install it. If the user agrees, you can then
+ re-install your shared library, late import it, and then
+ continue running your application if nothing happened.
+
+ You can even use this code to free yourself from the
+ Extensions folder entirely. Say you have a suite of
+ applications that currently installs a dozen shared
+ libraries in the Extensions folder. You can move those
+ libraries to another folder entirely and each application's
+ startup code can track down the library (using an alias
+ in the Preferences file) and late import it.
+
+ An even cooler use is to provide easy abstraction layers.
+ Say you have a network code for both the MacTCP
+ API and the Open Transport API. Typically, you would be
+ force to do this by having an abstraction layer where every
+ routine contains a switch between MacTCP and OT. Your
+ OpenSocket routine might look like:
+
+ static int OpenSocket(void)
+ {
+ if (gOTAvailable) {
+ return OpenSocketOT();
+ } else {
+ return OpenSocketMacTCP();
+ }
+ }
+
+ With this code, you can avoid that entirely. Simply
+ weak link to a shared library that you know is never
+ going to be implemented ("crea;MySocketsDummy") and then,
+ at runtime, decide whether the system has MacTCP or OT
+ and late import the relevant real implementation
+ ("crea;MySocketsMacTCP" or "crea;MySocketsOT").
+ One benefit of this approach is that only the MacTCP or
+ the OT code is resident in memory on any given system.
+*/
+
+typedef pascal OSStatus (*CFMLateImportLookupProc)(ConstStr255Param symName, CFragSymbolClass symClass,
+ void **symAddr, void *refCon);
+ // CFMLateImportLookupProc defines a callback for CFMLateImportCore.
+ // The routine is expected to look up the address of the symbol named
+ // symName and return it in *symAddr. The symbol should be of class
+ // symClass, although the callback decides whether a class mismatch is
+ // an error. refCon is an application defined value that was originally
+ // passed in to CFMLateImportCore.
+ //
+ // If this routine returns an error, a symbol address of 0 is assumed.
+ // If the symbol is marked as a weak import, the CFMLateImportCore will
+ // continue, otherwise the CFMLateImportCore routine will fail with the
+ // error.
+
+extern pascal OSStatus CFMLateImportCore(const CFragSystem7DiskFlatLocator *fragToFixLocator,
+ CFragConnectionID fragToFixConnID,
+ CFragInitFunction fragToFixInitRoutine,
+ ConstStr255Param weakLinkedLibraryName,
+ CFMLateImportLookupProc lookup,
+ void *refCon);
+ // This routine will link you, at runtime, to some library
+ // that you were weak linked to and wasn't present when your
+ // fragment was prepared. As well as the obvious functionality
+ // of being able to resolve weak links after prepare time,
+ // this functionality can be put to a number of less obvious uses,
+ // some of which are discussed at the top of this header file.
+ //
+ // To call this routine, you need a number of pieces of information:
+ //
+ // 1. fragToFixLocator, fragToFixConnID: The location of your own
+ // code fragment on disk and the CFM connection ID to your own
+ // code fragment. Typically you get this information from your
+ // fragment's CFM init routine. You must ensure that
+ // fragToFixLocator->fileSpec points to an FSSpec of the
+ // file which holds your code fragment.
+ //
+ // IMPORTANT:
+ // The fact that you pass in a CFragSystem7DiskFlatLocator as the
+ // fragToFixLocator implies that the fragment to be fixed up must
+ // be in the data fork of a file. The code could be modified
+ // to remove this requirement, but on disk code fragments are the most
+ // common case.
+ //
+ // IMPORTANT:
+ // The fragment to fix may have a packed data section. Packing the
+ // data section will reduce the size of your fragment on disk, but it
+ // will significantly increase the memory needed by this routine
+ // (it increases memory usage by the sum of the sizes of the packed
+ // and unpacked data section). See below for instructions on how to
+ // create an unpacked data section.
+ //
+ // 2. fragToFixInitRoutine: A pointer to your own code fragment's
+ // fragment initialiser routine. You necessarily have one of these
+ // because you need it to get values for the fragToFixLocator and
+ // fragToFixConnID parameters. Just pass its address in as a parameter
+ // as well.
+ //
+ // 3. weakLinkedLibraryName: The name of the weak linked library which
+ // failed to link. You must have weak linked to this library.
+ // It is oxymoric for you to pass a strong linked library here,
+ // because your code would not have prepared if a strong linked
+ // library failed to prepare, and so you couldn't supply a valid
+ /// fragToFix.
+ //
+ // 4. lookup, refCon: A pointer to a callback function that the
+ // routine calls to look up the address of a symbol, and a refCon
+ // for that callback routine.
+ //
+ // Note:
+ // The fragToFixLocator and fragToFixInitRoutine parameters
+ // are artifacts of the way in which this functionality is implemented.
+ // In an ideal world, where CFM exported decent introspection APIs
+ // to third party developers, these parameters would not be necessary.
+ // If you're using this code inside Apple, you probably should investigate
+ // using the CFM private APIs for getting at the information these
+ // parameters are needed for. See the comments inside the implementation
+ // for more details.
+ //
+ // Note:
+ // The extra memory taken when you use a packed data section is also an
+ // artifact of my workaround for the lack of CFM introspection APIs. In
+ // my opinion it's better to use an unpacked data section and consume more
+ // space on disk while saving memory. In CodeWarrior you can switch to an
+ // unpacked data section by checking the "Expand Uninitialized Data"
+ // checkbox in the "PPC PEF" settings panel. In MPW, specified the
+ // "-packdata off" option to PPCLink.
+ //
+ // When the routine returns, any symbols that you imported from the
+ // library named weakLinkedLibraryName will be resolved to the address
+ // of the symbol provided by the "lookup" callback routine.
+ //
+ // It is possible for an unresolved import to remain unresolved after
+ // this routine returns. If the symbol import is marked as weak (as
+ // opposed to the library, which *must* be marked as weak) and the symbol
+ // is not found by the "lookup" callback, the routine will simple skip
+ // that symbol. If the symbol isn't marked as weak, the routine will fail
+ // in that case.
+ //
+ // Most of the possible error results are co-opted CFM errors. These
+ // include:
+ //
+ // cfragFragmentFormatErr -- The fragment to fix is is an unknown format.
+ // cfragNoSectionErr -- Could not find the loader section in the fragment to fix.
+ // cfragNoLibraryErr -- The fragment to fix is not weak linked to weakLinkedLibraryName.
+ // cfragFragmentUsageErr -- The fragment to fix doesn't have a data section.
+ // -- The fragment to fix is strong linked to weakLinkedLibraryName.
+ // -- The fragment doesn't have an init routine.
+ // cfragFragmentCorruptErr -- Encountered an undefined relocation opcode.
+ // unimpErr -- Encountered an unimplement relocation opcode. The
+ // relocation engine only implements a subset of the CFM
+ // relocation opcodes, the subset most commonly used by
+ // MPW and CodeWarrior PEF containers. If you encounter
+ // this error, you'll probably have to add the weird
+ // relocation opcode to the engine, which shouldn't be
+ // be too hard.
+ // memFullErr -- It's likely that this error is triggered by the memory
+ // needed to unpack your data section. Either make your
+ // data section smaller, or unpack it (see above).
+ // errors returned by FindSymbol
+ // errors returned by Memory Manager
+ //
+ // The routine needs enough memory to hold the loader section of the fragment
+ // to fix in memory. It allocates that memory using NewPtr and dispsoses of
+ // it before it returns. You may want to change the memory allocator, which
+ // is very simple.
+
+extern pascal OSStatus CFMLateImportLibrary(const CFragSystem7DiskFlatLocator *fragToFixLocator,
+ CFragConnectionID fragToFixConnID,
+ CFragInitFunction fragToFixInitRoutine,
+ ConstStr255Param weakLinkedLibraryName,
+ CFragConnectionID connIDToImport);
+ // A wrapper around CFMLateImportCore that looks up symbols by calling
+ // FindSymbol on a connection to a CFM library (connIDToImport).
+ // You can get this connection ID through any standard CFM API, for example
+ // GetSharedLibrary, GetDiskFragment, or GetMemFragment.
+ //
+ // IMPORTANT:
+ // The fragment name for connIDToImport *does not* have to match
+ // weakLinkedLibraryName. This is part of the power of this library.
+
+extern pascal OSStatus CFMLateImportBundle(const CFragSystem7DiskFlatLocator *fragToFixLocator,
+ CFragConnectionID fragToFixConnID,
+ CFragInitFunction fragToFixInitRoutine,
+ ConstStr255Param weakLinkedLibraryName,
+ CFBundleRef bundleToImport);
+ // A wrapper around CFMLateImportCore that looks up symbols by calling
+ // CFBundleGetFunctionPointerForName on a reference to a Core Foundation
+ // bundle (bundleToImport). You can get this reference through any
+ // Core Foundation bundle API, for example CFBundleCreate.
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/Mac/Modules/cg/CGStubLib b/Mac/Modules/cg/CGStubLib
new file mode 100755
index 0000000000..5f939a3cc0
--- /dev/null
+++ b/Mac/Modules/cg/CGStubLib
Binary files differ
diff --git a/Mac/Modules/cg/CGStubLib.exp b/Mac/Modules/cg/CGStubLib.exp
new file mode 100755
index 0000000000..b93dc7c085
--- /dev/null
+++ b/Mac/Modules/cg/CGStubLib.exp
@@ -0,0 +1,60 @@
+CGContextShowTextAtPoint
+CGContextShowText
+CGContextSelectFont
+CGContextSetTextDrawingMode
+CGContextDrawPath
+CGContextSetLineJoin
+CGContextSetLineCap
+CGContextGetTextPosition
+CGContextGetPathCurrentPoint
+CGContextSetShouldAntialias
+CGContextSynchronize
+CGContextFlush
+CGContextEndPage
+CGContextSetFontSize
+CGContextGetTextMatrix
+CGContextSetTextMatrix
+CGContextSetTextPosition
+CGContextSetCharacterSpacing
+CGContextSetCMYKStrokeColor
+CGContextSetCMYKFillColor
+CGContextSetRGBStrokeColor
+CGContextSetRGBFillColor
+CGContextSetGrayStrokeColor
+CGContextSetGrayFillColor
+CGContextClipToRect
+CGContextEOClip
+CGContextClip
+CGContextClearRect
+CGContextStrokeRectWithWidth
+CGContextStrokeRect
+CGContextFillRect
+CGContextStrokePath
+CGContextEOFillPath
+CGContextFillPath
+CGContextGetPathBoundingBox
+CGContextIsPathEmpty
+CGContextAddArcToPoint
+CGContextAddArc
+CGContextAddRect
+CGContextClosePath
+CGContextAddQuadCurveToPoint
+CGContextAddCurveToPoint
+CGContextAddLineToPoint
+CGContextMoveToPoint
+CGContextBeginPath
+CGContextSetAlpha
+CGContextSetFlatness
+CGContextSetMiterLimit
+CGContextSetLineWidth
+CGContextGetCTM
+CGContextConcatCTM
+CGContextRotateCTM
+CGContextTranslateCTM
+CGContextScaleCTM
+CGContextRestoreGState
+CGContextSaveGState
+CGContextRelease
+CreateCGContextForPort
+SyncCGContextOriginWithPort
+ClipCGContextToRegion
diff --git a/Mac/Modules/cg/CGStubLib.readme b/Mac/Modules/cg/CGStubLib.readme
new file mode 100755
index 0000000000..d2c5fa8dcc
--- /dev/null
+++ b/Mac/Modules/cg/CGStubLib.readme
@@ -0,0 +1,3 @@
+# CGStubLib was created by issuing this command in MPW:
+
+MakeStub CGStubLib.exp -o CGStubLib
diff --git a/Mac/Modules/cg/_CGmodule.c b/Mac/Modules/cg/_CGmodule.c
new file mode 100755
index 0000000000..716910131f
--- /dev/null
+++ b/Mac/Modules/cg/_CGmodule.c
@@ -0,0 +1,1316 @@
+
+/* =========================== Module _CG =========================== */
+
+#include "Python.h"
+
+
+
+#include "pymactoolbox.h"
+
+/* Macro to test whether a weak-loaded CFM function exists */
+#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
+ PyErr_SetString(PyExc_NotImplementedError, \
+ "Not available in this shared library/OS version"); \
+ return NULL; \
+ }} while(0)
+
+
+#include <ApplicationServices/ApplicationServices.h>
+
+extern int GrafObj_Convert(PyObject *, GrafPtr *);
+
+/*
+** Manual converters
+*/
+
+PyObject *CGPoint_New(CGPoint *itself)
+{
+
+ return Py_BuildValue("(ff)",
+ itself->x,
+ itself->y);
+}
+
+int
+CGPoint_Convert(PyObject *v, CGPoint *p_itself)
+{
+ if( !PyArg_Parse(v, "(ff)",
+ &p_itself->x,
+ &p_itself->y) )
+ return 0;
+ return 1;
+}
+
+PyObject *CGRect_New(CGRect *itself)
+{
+
+ return Py_BuildValue("(ffff)",
+ itself->origin.x,
+ itself->origin.y,
+ itself->size.width,
+ itself->size.height);
+}
+
+int
+CGRect_Convert(PyObject *v, CGRect *p_itself)
+{
+ if( !PyArg_Parse(v, "(ffff)",
+ &p_itself->origin.x,
+ &p_itself->origin.y,
+ &p_itself->size.width,
+ &p_itself->size.height) )
+ return 0;
+ return 1;
+}
+
+PyObject *CGAffineTransform_New(CGAffineTransform *itself)
+{
+
+ return Py_BuildValue("(ffffff)",
+ itself->a,
+ itself->b,
+ itself->c,
+ itself->d,
+ itself->tx,
+ itself->ty);
+}
+
+int
+CGAffineTransform_Convert(PyObject *v, CGAffineTransform *p_itself)
+{
+ if( !PyArg_Parse(v, "(ffffff)",
+ &p_itself->a,
+ &p_itself->b,
+ &p_itself->c,
+ &p_itself->d,
+ &p_itself->tx,
+ &p_itself->ty) )
+ return 0;
+ return 1;
+}
+
+static PyObject *CG_Error;
+
+/* -------------------- Object type CGContextRef -------------------- */
+
+PyTypeObject CGContextRef_Type;
+
+#define CGContextRefObj_Check(x) ((x)->ob_type == &CGContextRef_Type || PyObject_TypeCheck((x), &CGContextRef_Type))
+
+typedef struct CGContextRefObject {
+ PyObject_HEAD
+ CGContextRef ob_itself;
+} CGContextRefObject;
+
+PyObject *CGContextRefObj_New(CGContextRef itself)
+{
+ CGContextRefObject *it;
+ it = PyObject_NEW(CGContextRefObject, &CGContextRef_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+
+int CGContextRefObj_Convert(PyObject *v, CGContextRef *p_itself)
+{
+ if (!CGContextRefObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "CGContextRef required");
+ return 0;
+ }
+ *p_itself = ((CGContextRefObject *)v)->ob_itself;
+ return 1;
+}
+
+static void CGContextRefObj_dealloc(CGContextRefObject *self)
+{
+ CGContextRelease(self->ob_itself);
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *CGContextRefObj_CGContextSaveGState(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ CGContextSaveGState(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextRestoreGState(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ CGContextRestoreGState(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextScaleCTM(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ float sx;
+ float sy;
+ if (!PyArg_ParseTuple(_args, "ff",
+ &sx,
+ &sy))
+ return NULL;
+ CGContextScaleCTM(_self->ob_itself,
+ sx,
+ sy);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextTranslateCTM(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ float tx;
+ float ty;
+ if (!PyArg_ParseTuple(_args, "ff",
+ &tx,
+ &ty))
+ return NULL;
+ CGContextTranslateCTM(_self->ob_itself,
+ tx,
+ ty);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextRotateCTM(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ float angle;
+ if (!PyArg_ParseTuple(_args, "f",
+ &angle))
+ return NULL;
+ CGContextRotateCTM(_self->ob_itself,
+ angle);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextConcatCTM(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGAffineTransform transform;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CGAffineTransform_Convert, &transform))
+ return NULL;
+ CGContextConcatCTM(_self->ob_itself,
+ transform);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextGetCTM(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGAffineTransform _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CGContextGetCTM(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CGAffineTransform_New, &_rv);
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextSetLineWidth(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ float width;
+ if (!PyArg_ParseTuple(_args, "f",
+ &width))
+ return NULL;
+ CGContextSetLineWidth(_self->ob_itself,
+ width);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextSetLineCap(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ int cap;
+ if (!PyArg_ParseTuple(_args, "i",
+ &cap))
+ return NULL;
+ CGContextSetLineCap(_self->ob_itself,
+ cap);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextSetLineJoin(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ int join;
+ if (!PyArg_ParseTuple(_args, "i",
+ &join))
+ return NULL;
+ CGContextSetLineJoin(_self->ob_itself,
+ join);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextSetMiterLimit(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ float limit;
+ if (!PyArg_ParseTuple(_args, "f",
+ &limit))
+ return NULL;
+ CGContextSetMiterLimit(_self->ob_itself,
+ limit);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextSetFlatness(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ float flatness;
+ if (!PyArg_ParseTuple(_args, "f",
+ &flatness))
+ return NULL;
+ CGContextSetFlatness(_self->ob_itself,
+ flatness);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextSetAlpha(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ float alpha;
+ if (!PyArg_ParseTuple(_args, "f",
+ &alpha))
+ return NULL;
+ CGContextSetAlpha(_self->ob_itself,
+ alpha);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextBeginPath(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ CGContextBeginPath(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextMoveToPoint(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ float x;
+ float y;
+ if (!PyArg_ParseTuple(_args, "ff",
+ &x,
+ &y))
+ return NULL;
+ CGContextMoveToPoint(_self->ob_itself,
+ x,
+ y);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextAddLineToPoint(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ float x;
+ float y;
+ if (!PyArg_ParseTuple(_args, "ff",
+ &x,
+ &y))
+ return NULL;
+ CGContextAddLineToPoint(_self->ob_itself,
+ x,
+ y);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextAddCurveToPoint(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ float cp1x;
+ float cp1y;
+ float cp2x;
+ float cp2y;
+ float x;
+ float y;
+ if (!PyArg_ParseTuple(_args, "ffffff",
+ &cp1x,
+ &cp1y,
+ &cp2x,
+ &cp2y,
+ &x,
+ &y))
+ return NULL;
+ CGContextAddCurveToPoint(_self->ob_itself,
+ cp1x,
+ cp1y,
+ cp2x,
+ cp2y,
+ x,
+ y);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextAddQuadCurveToPoint(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ float cpx;
+ float cpy;
+ float x;
+ float y;
+ if (!PyArg_ParseTuple(_args, "ffff",
+ &cpx,
+ &cpy,
+ &x,
+ &y))
+ return NULL;
+ CGContextAddQuadCurveToPoint(_self->ob_itself,
+ cpx,
+ cpy,
+ x,
+ y);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextClosePath(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ CGContextClosePath(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextAddRect(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGRect rect;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CGRect_Convert, &rect))
+ return NULL;
+ CGContextAddRect(_self->ob_itself,
+ rect);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextAddArc(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ float x;
+ float y;
+ float radius;
+ float startAngle;
+ float endAngle;
+ int clockwise;
+ if (!PyArg_ParseTuple(_args, "fffffi",
+ &x,
+ &y,
+ &radius,
+ &startAngle,
+ &endAngle,
+ &clockwise))
+ return NULL;
+ CGContextAddArc(_self->ob_itself,
+ x,
+ y,
+ radius,
+ startAngle,
+ endAngle,
+ clockwise);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextAddArcToPoint(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ float x1;
+ float y1;
+ float x2;
+ float y2;
+ float radius;
+ if (!PyArg_ParseTuple(_args, "fffff",
+ &x1,
+ &y1,
+ &x2,
+ &y2,
+ &radius))
+ return NULL;
+ CGContextAddArcToPoint(_self->ob_itself,
+ x1,
+ y1,
+ x2,
+ y2,
+ radius);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextIsPathEmpty(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ int _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CGContextIsPathEmpty(_self->ob_itself);
+ _res = Py_BuildValue("i",
+ _rv);
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextGetPathCurrentPoint(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGPoint _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CGContextGetPathCurrentPoint(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CGPoint_New, &_rv);
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextGetPathBoundingBox(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGRect _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CGContextGetPathBoundingBox(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CGRect_New, &_rv);
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextDrawPath(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ int mode;
+ if (!PyArg_ParseTuple(_args, "i",
+ &mode))
+ return NULL;
+ CGContextDrawPath(_self->ob_itself,
+ mode);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextFillPath(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ CGContextFillPath(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextEOFillPath(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ CGContextEOFillPath(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextStrokePath(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ CGContextStrokePath(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextFillRect(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGRect rect;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CGRect_Convert, &rect))
+ return NULL;
+ CGContextFillRect(_self->ob_itself,
+ rect);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextStrokeRect(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGRect rect;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CGRect_Convert, &rect))
+ return NULL;
+ CGContextStrokeRect(_self->ob_itself,
+ rect);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextStrokeRectWithWidth(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGRect rect;
+ float width;
+ if (!PyArg_ParseTuple(_args, "O&f",
+ CGRect_Convert, &rect,
+ &width))
+ return NULL;
+ CGContextStrokeRectWithWidth(_self->ob_itself,
+ rect,
+ width);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextClearRect(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGRect rect;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CGRect_Convert, &rect))
+ return NULL;
+ CGContextClearRect(_self->ob_itself,
+ rect);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextClip(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ CGContextClip(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextEOClip(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ CGContextEOClip(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextClipToRect(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGRect rect;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CGRect_Convert, &rect))
+ return NULL;
+ CGContextClipToRect(_self->ob_itself,
+ rect);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextSetGrayFillColor(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ float gray;
+ float alpha;
+ if (!PyArg_ParseTuple(_args, "ff",
+ &gray,
+ &alpha))
+ return NULL;
+ CGContextSetGrayFillColor(_self->ob_itself,
+ gray,
+ alpha);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextSetGrayStrokeColor(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ float gray;
+ float alpha;
+ if (!PyArg_ParseTuple(_args, "ff",
+ &gray,
+ &alpha))
+ return NULL;
+ CGContextSetGrayStrokeColor(_self->ob_itself,
+ gray,
+ alpha);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextSetRGBFillColor(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ float red;
+ float green;
+ float blue;
+ float alpha;
+ if (!PyArg_ParseTuple(_args, "ffff",
+ &red,
+ &green,
+ &blue,
+ &alpha))
+ return NULL;
+ CGContextSetRGBFillColor(_self->ob_itself,
+ red,
+ green,
+ blue,
+ alpha);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextSetRGBStrokeColor(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ float red;
+ float green;
+ float blue;
+ float alpha;
+ if (!PyArg_ParseTuple(_args, "ffff",
+ &red,
+ &green,
+ &blue,
+ &alpha))
+ return NULL;
+ CGContextSetRGBStrokeColor(_self->ob_itself,
+ red,
+ green,
+ blue,
+ alpha);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextSetCMYKFillColor(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ float cyan;
+ float magenta;
+ float yellow;
+ float black;
+ float alpha;
+ if (!PyArg_ParseTuple(_args, "fffff",
+ &cyan,
+ &magenta,
+ &yellow,
+ &black,
+ &alpha))
+ return NULL;
+ CGContextSetCMYKFillColor(_self->ob_itself,
+ cyan,
+ magenta,
+ yellow,
+ black,
+ alpha);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextSetCMYKStrokeColor(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ float cyan;
+ float magenta;
+ float yellow;
+ float black;
+ float alpha;
+ if (!PyArg_ParseTuple(_args, "fffff",
+ &cyan,
+ &magenta,
+ &yellow,
+ &black,
+ &alpha))
+ return NULL;
+ CGContextSetCMYKStrokeColor(_self->ob_itself,
+ cyan,
+ magenta,
+ yellow,
+ black,
+ alpha);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextGetInterpolationQuality(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ int _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CGContextGetInterpolationQuality(_self->ob_itself);
+ _res = Py_BuildValue("i",
+ _rv);
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextSetInterpolationQuality(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ int quality;
+ if (!PyArg_ParseTuple(_args, "i",
+ &quality))
+ return NULL;
+ CGContextSetInterpolationQuality(_self->ob_itself,
+ quality);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextSetCharacterSpacing(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ float spacing;
+ if (!PyArg_ParseTuple(_args, "f",
+ &spacing))
+ return NULL;
+ CGContextSetCharacterSpacing(_self->ob_itself,
+ spacing);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextSetTextPosition(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ float x;
+ float y;
+ if (!PyArg_ParseTuple(_args, "ff",
+ &x,
+ &y))
+ return NULL;
+ CGContextSetTextPosition(_self->ob_itself,
+ x,
+ y);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextGetTextPosition(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGPoint _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CGContextGetTextPosition(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CGPoint_New, &_rv);
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextSetTextMatrix(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGAffineTransform transform;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CGAffineTransform_Convert, &transform))
+ return NULL;
+ CGContextSetTextMatrix(_self->ob_itself,
+ transform);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextGetTextMatrix(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGAffineTransform _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CGContextGetTextMatrix(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CGAffineTransform_New, &_rv);
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextSetTextDrawingMode(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ int mode;
+ if (!PyArg_ParseTuple(_args, "i",
+ &mode))
+ return NULL;
+ CGContextSetTextDrawingMode(_self->ob_itself,
+ mode);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextSetFontSize(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ float size;
+ if (!PyArg_ParseTuple(_args, "f",
+ &size))
+ return NULL;
+ CGContextSetFontSize(_self->ob_itself,
+ size);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextSelectFont(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ char * name;
+ float size;
+ int textEncoding;
+ if (!PyArg_ParseTuple(_args, "sfi",
+ &name,
+ &size,
+ &textEncoding))
+ return NULL;
+ CGContextSelectFont(_self->ob_itself,
+ name,
+ size,
+ textEncoding);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextShowText(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ char *cstring__in__;
+ long cstring__len__;
+ int cstring__in_len__;
+ if (!PyArg_ParseTuple(_args, "s#",
+ &cstring__in__, &cstring__in_len__))
+ return NULL;
+ cstring__len__ = cstring__in_len__;
+ CGContextShowText(_self->ob_itself,
+ cstring__in__, cstring__len__);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextShowTextAtPoint(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ float x;
+ float y;
+ char *cstring__in__;
+ long cstring__len__;
+ int cstring__in_len__;
+ if (!PyArg_ParseTuple(_args, "ffs#",
+ &x,
+ &y,
+ &cstring__in__, &cstring__in_len__))
+ return NULL;
+ cstring__len__ = cstring__in_len__;
+ CGContextShowTextAtPoint(_self->ob_itself,
+ x,
+ y,
+ cstring__in__, cstring__len__);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextEndPage(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ CGContextEndPage(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextFlush(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ CGContextFlush(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextSynchronize(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ CGContextSynchronize(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_CGContextSetShouldAntialias(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ int shouldAntialias;
+ if (!PyArg_ParseTuple(_args, "i",
+ &shouldAntialias))
+ return NULL;
+ CGContextSetShouldAntialias(_self->ob_itself,
+ shouldAntialias);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+#ifndef __LP64__
+static PyObject *CGContextRefObj_SyncCGContextOriginWithPort(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr port;
+ if (!PyArg_ParseTuple(_args, "O&",
+ GrafObj_Convert, &port))
+ return NULL;
+ SyncCGContextOriginWithPort(_self->ob_itself,
+ port);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CGContextRefObj_ClipCGContextToRegion(CGContextRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect portRect;
+ RgnHandle region;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetRect, &portRect,
+ ResObj_Convert, &region))
+ return NULL;
+ ClipCGContextToRegion(_self->ob_itself,
+ &portRect,
+ region);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+static PyMethodDef CGContextRefObj_methods[] = {
+ {"CGContextSaveGState", (PyCFunction)CGContextRefObj_CGContextSaveGState, 1,
+ PyDoc_STR("() -> None")},
+ {"CGContextRestoreGState", (PyCFunction)CGContextRefObj_CGContextRestoreGState, 1,
+ PyDoc_STR("() -> None")},
+ {"CGContextScaleCTM", (PyCFunction)CGContextRefObj_CGContextScaleCTM, 1,
+ PyDoc_STR("(float sx, float sy) -> None")},
+ {"CGContextTranslateCTM", (PyCFunction)CGContextRefObj_CGContextTranslateCTM, 1,
+ PyDoc_STR("(float tx, float ty) -> None")},
+ {"CGContextRotateCTM", (PyCFunction)CGContextRefObj_CGContextRotateCTM, 1,
+ PyDoc_STR("(float angle) -> None")},
+ {"CGContextConcatCTM", (PyCFunction)CGContextRefObj_CGContextConcatCTM, 1,
+ PyDoc_STR("(CGAffineTransform transform) -> None")},
+ {"CGContextGetCTM", (PyCFunction)CGContextRefObj_CGContextGetCTM, 1,
+ PyDoc_STR("() -> (CGAffineTransform _rv)")},
+ {"CGContextSetLineWidth", (PyCFunction)CGContextRefObj_CGContextSetLineWidth, 1,
+ PyDoc_STR("(float width) -> None")},
+ {"CGContextSetLineCap", (PyCFunction)CGContextRefObj_CGContextSetLineCap, 1,
+ PyDoc_STR("(int cap) -> None")},
+ {"CGContextSetLineJoin", (PyCFunction)CGContextRefObj_CGContextSetLineJoin, 1,
+ PyDoc_STR("(int join) -> None")},
+ {"CGContextSetMiterLimit", (PyCFunction)CGContextRefObj_CGContextSetMiterLimit, 1,
+ PyDoc_STR("(float limit) -> None")},
+ {"CGContextSetFlatness", (PyCFunction)CGContextRefObj_CGContextSetFlatness, 1,
+ PyDoc_STR("(float flatness) -> None")},
+ {"CGContextSetAlpha", (PyCFunction)CGContextRefObj_CGContextSetAlpha, 1,
+ PyDoc_STR("(float alpha) -> None")},
+ {"CGContextBeginPath", (PyCFunction)CGContextRefObj_CGContextBeginPath, 1,
+ PyDoc_STR("() -> None")},
+ {"CGContextMoveToPoint", (PyCFunction)CGContextRefObj_CGContextMoveToPoint, 1,
+ PyDoc_STR("(float x, float y) -> None")},
+ {"CGContextAddLineToPoint", (PyCFunction)CGContextRefObj_CGContextAddLineToPoint, 1,
+ PyDoc_STR("(float x, float y) -> None")},
+ {"CGContextAddCurveToPoint", (PyCFunction)CGContextRefObj_CGContextAddCurveToPoint, 1,
+ PyDoc_STR("(float cp1x, float cp1y, float cp2x, float cp2y, float x, float y) -> None")},
+ {"CGContextAddQuadCurveToPoint", (PyCFunction)CGContextRefObj_CGContextAddQuadCurveToPoint, 1,
+ PyDoc_STR("(float cpx, float cpy, float x, float y) -> None")},
+ {"CGContextClosePath", (PyCFunction)CGContextRefObj_CGContextClosePath, 1,
+ PyDoc_STR("() -> None")},
+ {"CGContextAddRect", (PyCFunction)CGContextRefObj_CGContextAddRect, 1,
+ PyDoc_STR("(CGRect rect) -> None")},
+ {"CGContextAddArc", (PyCFunction)CGContextRefObj_CGContextAddArc, 1,
+ PyDoc_STR("(float x, float y, float radius, float startAngle, float endAngle, int clockwise) -> None")},
+ {"CGContextAddArcToPoint", (PyCFunction)CGContextRefObj_CGContextAddArcToPoint, 1,
+ PyDoc_STR("(float x1, float y1, float x2, float y2, float radius) -> None")},
+ {"CGContextIsPathEmpty", (PyCFunction)CGContextRefObj_CGContextIsPathEmpty, 1,
+ PyDoc_STR("() -> (int _rv)")},
+ {"CGContextGetPathCurrentPoint", (PyCFunction)CGContextRefObj_CGContextGetPathCurrentPoint, 1,
+ PyDoc_STR("() -> (CGPoint _rv)")},
+ {"CGContextGetPathBoundingBox", (PyCFunction)CGContextRefObj_CGContextGetPathBoundingBox, 1,
+ PyDoc_STR("() -> (CGRect _rv)")},
+ {"CGContextDrawPath", (PyCFunction)CGContextRefObj_CGContextDrawPath, 1,
+ PyDoc_STR("(int mode) -> None")},
+ {"CGContextFillPath", (PyCFunction)CGContextRefObj_CGContextFillPath, 1,
+ PyDoc_STR("() -> None")},
+ {"CGContextEOFillPath", (PyCFunction)CGContextRefObj_CGContextEOFillPath, 1,
+ PyDoc_STR("() -> None")},
+ {"CGContextStrokePath", (PyCFunction)CGContextRefObj_CGContextStrokePath, 1,
+ PyDoc_STR("() -> None")},
+ {"CGContextFillRect", (PyCFunction)CGContextRefObj_CGContextFillRect, 1,
+ PyDoc_STR("(CGRect rect) -> None")},
+ {"CGContextStrokeRect", (PyCFunction)CGContextRefObj_CGContextStrokeRect, 1,
+ PyDoc_STR("(CGRect rect) -> None")},
+ {"CGContextStrokeRectWithWidth", (PyCFunction)CGContextRefObj_CGContextStrokeRectWithWidth, 1,
+ PyDoc_STR("(CGRect rect, float width) -> None")},
+ {"CGContextClearRect", (PyCFunction)CGContextRefObj_CGContextClearRect, 1,
+ PyDoc_STR("(CGRect rect) -> None")},
+ {"CGContextClip", (PyCFunction)CGContextRefObj_CGContextClip, 1,
+ PyDoc_STR("() -> None")},
+ {"CGContextEOClip", (PyCFunction)CGContextRefObj_CGContextEOClip, 1,
+ PyDoc_STR("() -> None")},
+ {"CGContextClipToRect", (PyCFunction)CGContextRefObj_CGContextClipToRect, 1,
+ PyDoc_STR("(CGRect rect) -> None")},
+ {"CGContextSetGrayFillColor", (PyCFunction)CGContextRefObj_CGContextSetGrayFillColor, 1,
+ PyDoc_STR("(float gray, float alpha) -> None")},
+ {"CGContextSetGrayStrokeColor", (PyCFunction)CGContextRefObj_CGContextSetGrayStrokeColor, 1,
+ PyDoc_STR("(float gray, float alpha) -> None")},
+ {"CGContextSetRGBFillColor", (PyCFunction)CGContextRefObj_CGContextSetRGBFillColor, 1,
+ PyDoc_STR("(float red, float green, float blue, float alpha) -> None")},
+ {"CGContextSetRGBStrokeColor", (PyCFunction)CGContextRefObj_CGContextSetRGBStrokeColor, 1,
+ PyDoc_STR("(float red, float green, float blue, float alpha) -> None")},
+ {"CGContextSetCMYKFillColor", (PyCFunction)CGContextRefObj_CGContextSetCMYKFillColor, 1,
+ PyDoc_STR("(float cyan, float magenta, float yellow, float black, float alpha) -> None")},
+ {"CGContextSetCMYKStrokeColor", (PyCFunction)CGContextRefObj_CGContextSetCMYKStrokeColor, 1,
+ PyDoc_STR("(float cyan, float magenta, float yellow, float black, float alpha) -> None")},
+ {"CGContextGetInterpolationQuality", (PyCFunction)CGContextRefObj_CGContextGetInterpolationQuality, 1,
+ PyDoc_STR("() -> (int _rv)")},
+ {"CGContextSetInterpolationQuality", (PyCFunction)CGContextRefObj_CGContextSetInterpolationQuality, 1,
+ PyDoc_STR("(int quality) -> None")},
+ {"CGContextSetCharacterSpacing", (PyCFunction)CGContextRefObj_CGContextSetCharacterSpacing, 1,
+ PyDoc_STR("(float spacing) -> None")},
+ {"CGContextSetTextPosition", (PyCFunction)CGContextRefObj_CGContextSetTextPosition, 1,
+ PyDoc_STR("(float x, float y) -> None")},
+ {"CGContextGetTextPosition", (PyCFunction)CGContextRefObj_CGContextGetTextPosition, 1,
+ PyDoc_STR("() -> (CGPoint _rv)")},
+ {"CGContextSetTextMatrix", (PyCFunction)CGContextRefObj_CGContextSetTextMatrix, 1,
+ PyDoc_STR("(CGAffineTransform transform) -> None")},
+ {"CGContextGetTextMatrix", (PyCFunction)CGContextRefObj_CGContextGetTextMatrix, 1,
+ PyDoc_STR("() -> (CGAffineTransform _rv)")},
+ {"CGContextSetTextDrawingMode", (PyCFunction)CGContextRefObj_CGContextSetTextDrawingMode, 1,
+ PyDoc_STR("(int mode) -> None")},
+ {"CGContextSetFontSize", (PyCFunction)CGContextRefObj_CGContextSetFontSize, 1,
+ PyDoc_STR("(float size) -> None")},
+ {"CGContextSelectFont", (PyCFunction)CGContextRefObj_CGContextSelectFont, 1,
+ PyDoc_STR("(char * name, float size, int textEncoding) -> None")},
+ {"CGContextShowText", (PyCFunction)CGContextRefObj_CGContextShowText, 1,
+ PyDoc_STR("(Buffer cstring) -> None")},
+ {"CGContextShowTextAtPoint", (PyCFunction)CGContextRefObj_CGContextShowTextAtPoint, 1,
+ PyDoc_STR("(float x, float y, Buffer cstring) -> None")},
+ {"CGContextEndPage", (PyCFunction)CGContextRefObj_CGContextEndPage, 1,
+ PyDoc_STR("() -> None")},
+ {"CGContextFlush", (PyCFunction)CGContextRefObj_CGContextFlush, 1,
+ PyDoc_STR("() -> None")},
+ {"CGContextSynchronize", (PyCFunction)CGContextRefObj_CGContextSynchronize, 1,
+ 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}
+};
+
+#define CGContextRefObj_getsetlist NULL
+
+
+#define CGContextRefObj_compare NULL
+
+#define CGContextRefObj_repr NULL
+
+#define CGContextRefObj_hash NULL
+#define CGContextRefObj_tp_init 0
+
+#define CGContextRefObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *CGContextRefObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *_self;
+ CGContextRef itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, CGContextRefObj_Convert, &itself)) return NULL;
+ if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((CGContextRefObject *)_self)->ob_itself = itself;
+ return _self;
+}
+
+#define CGContextRefObj_tp_free PyObject_Del
+
+
+PyTypeObject CGContextRef_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_CG.CGContextRef", /*tp_name*/
+ sizeof(CGContextRefObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) CGContextRefObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) CGContextRefObj_compare, /*tp_compare*/
+ (reprfunc) CGContextRefObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) CGContextRefObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ CGContextRefObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ CGContextRefObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ CGContextRefObj_tp_init, /* tp_init */
+ CGContextRefObj_tp_alloc, /* tp_alloc */
+ CGContextRefObj_tp_new, /* tp_new */
+ CGContextRefObj_tp_free, /* tp_free */
+};
+
+/* ------------------ End object type CGContextRef ------------------ */
+
+
+#ifndef __LP64__
+static PyObject *CG_CreateCGContextForPort(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GrafPtr port;
+ CGContextRef ctx;
+ OSStatus _err;
+
+ if (!PyArg_ParseTuple(_args, "O&", GrafObj_Convert, &port))
+ return NULL;
+
+ _err = CreateCGContextForPort(port, &ctx);
+ if (_err != noErr)
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&", CGContextRefObj_New, ctx);
+ return _res;
+
+}
+#endif
+
+static PyMethodDef CG_methods[] = {
+#ifndef __LP64__
+ {"CreateCGContextForPort", (PyCFunction)CG_CreateCGContextForPort, 1,
+ PyDoc_STR("(CGrafPtr) -> CGContextRef")},
+#endif
+ {NULL, NULL, 0}
+};
+
+
+
+
+void init_CG(void)
+{
+ PyObject *m;
+ PyObject *d;
+
+
+
+
+ m = Py_InitModule("_CG", CG_methods);
+ d = PyModule_GetDict(m);
+ CG_Error = PyMac_GetOSErrException();
+ if (CG_Error == NULL ||
+ PyDict_SetItemString(d, "Error", CG_Error) != 0)
+ return;
+ CGContextRef_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&CGContextRef_Type) < 0) return;
+ Py_INCREF(&CGContextRef_Type);
+ PyModule_AddObject(m, "CGContextRef", (PyObject *)&CGContextRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&CGContextRef_Type);
+ PyModule_AddObject(m, "CGContextRefType", (PyObject *)&CGContextRef_Type);
+}
+
+/* ========================= End module _CG ========================= */
+
diff --git a/Mac/Modules/cg/cgscan.py b/Mac/Modules/cg/cgscan.py
new file mode 100644
index 0000000000..c08394ee2d
--- /dev/null
+++ b/Mac/Modules/cg/cgscan.py
@@ -0,0 +1,83 @@
+# Scan an Apple header file, generating a Python file of generator calls.
+
+import sys
+from bgenlocations import TOOLBOXDIR, BGENDIR
+sys.path.append(BGENDIR)
+from scantools import Scanner_OSX
+
+LONG = "CoreGraphics"
+SHORT = "cg"
+OBJECTS = ("CGContextRef",
+ )
+# ADD object typenames here
+
+def main():
+ input = [
+ "CGContext.h",
+ ]
+ output = SHORT + "gen.py"
+ defsoutput = TOOLBOXDIR + LONG + ".py"
+ scanner = MyScanner(input, output, defsoutput)
+ scanner.scan()
+ scanner.gentypetest(SHORT+"typetest.py")
+ scanner.close()
+ print "=== Testing definitions output code ==="
+ execfile(defsoutput, {}, {})
+ print "=== Done scanning and generating, now importing the generated code... ==="
+ exec "import " + SHORT + "support"
+ print "=== Done. It's up to you to compile it now! ==="
+
+class MyScanner(Scanner_OSX):
+
+ def destination(self, type, name, arglist):
+ classname = "Function"
+ listname = "functions"
+ if arglist:
+ t, n, m = arglist[0]
+ if t in OBJECTS and m == "InMode":
+ classname = "Method"
+ listname = t + "_methods"
+ # Special case for the silly first AllocatorRef argument
+ if t == 'CFAllocatorRef' and m == 'InMode' and len(arglist) > 1:
+ t, n, m = arglist[1]
+ if t in OBJECTS and m == "InMode":
+ classname = "MethodSkipArg1"
+ listname = t + "_methods"
+ return classname, listname
+
+ def writeinitialdefs(self):
+ self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
+
+ def makeblacklistnames(self):
+ return [
+ "CGContextRetain",
+ "CGContextRelease",
+ ]
+
+ def makegreylist(self):
+ return []
+
+ def makeblacklisttypes(self):
+ return [
+ "float_ptr",
+ "CGRect_ptr",
+ "CGPoint_ptr",
+ "CGColorSpaceRef",
+ "CGColorRenderingIntent",
+ "CGFontRef",
+# "char_ptr",
+ "CGGlyph_ptr",
+ "CGImageRef",
+ "CGPDFDocumentRef",
+ ]
+
+ def makerepairinstructions(self):
+ return [
+ ([("char_ptr", "cstring", "InMode"), ("size_t", "length", "InMode")],
+ [("InBuffer", "*", "*")]),
+# ([("char_ptr", "name", "InMode"),],
+# [("CCCCC", "*", "*")]),
+ ]
+
+if __name__ == "__main__":
+ main()
diff --git a/Mac/Modules/cg/cgsupport.py b/Mac/Modules/cg/cgsupport.py
new file mode 100644
index 0000000000..6eedfbef3f
--- /dev/null
+++ b/Mac/Modules/cg/cgsupport.py
@@ -0,0 +1,192 @@
+# This script generates a Python interface for an Apple Macintosh Manager.
+# It uses the "bgen" package to generate C code.
+# The function specifications are generated by scanning the mamager's header file,
+# using the "scantools" package (customized for this particular manager).
+
+#error missing SetActionFilter
+
+import string
+
+# Declarations that change for each manager
+MODNAME = '_CG' # The name of the module
+
+# The following is *usually* unchanged but may still require tuning
+MODPREFIX = 'CG' # The prefix for module-wide routines
+INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner
+OUTPUTFILE = MODNAME + "module.c" # The file generated by this program
+
+from macsupport import *
+
+CGrafPtr = OpaqueByValueType("CGrafPtr", "GrafObj")
+RgnHandle = OpaqueByValueType("RgnHandle", "ResObj")
+
+# Create the type objects
+
+includestuff = includestuff + """
+#include <ApplicationServices/ApplicationServices.h>
+
+extern int GrafObj_Convert(PyObject *, GrafPtr *);
+
+/*
+** Manual converters
+*/
+
+PyObject *CGPoint_New(CGPoint *itself)
+{
+
+ return Py_BuildValue("(ff)",
+ itself->x,
+ itself->y);
+}
+
+int
+CGPoint_Convert(PyObject *v, CGPoint *p_itself)
+{
+ if( !PyArg_Parse(v, "(ff)",
+ &p_itself->x,
+ &p_itself->y) )
+ return 0;
+ return 1;
+}
+
+PyObject *CGRect_New(CGRect *itself)
+{
+
+ return Py_BuildValue("(ffff)",
+ itself->origin.x,
+ itself->origin.y,
+ itself->size.width,
+ itself->size.height);
+}
+
+int
+CGRect_Convert(PyObject *v, CGRect *p_itself)
+{
+ if( !PyArg_Parse(v, "(ffff)",
+ &p_itself->origin.x,
+ &p_itself->origin.y,
+ &p_itself->size.width,
+ &p_itself->size.height) )
+ return 0;
+ return 1;
+}
+
+PyObject *CGAffineTransform_New(CGAffineTransform *itself)
+{
+
+ return Py_BuildValue("(ffffff)",
+ itself->a,
+ itself->b,
+ itself->c,
+ itself->d,
+ itself->tx,
+ itself->ty);
+}
+
+int
+CGAffineTransform_Convert(PyObject *v, CGAffineTransform *p_itself)
+{
+ if( !PyArg_Parse(v, "(ffffff)",
+ &p_itself->a,
+ &p_itself->b,
+ &p_itself->c,
+ &p_itself->d,
+ &p_itself->tx,
+ &p_itself->ty) )
+ return 0;
+ return 1;
+}
+"""
+
+class MyOpaqueByValueType(OpaqueByValueType):
+ """Sort of a mix between OpaqueByValueType and OpaqueType."""
+ def mkvalueArgs(self, name):
+ return "%s, &%s" % (self.new, name)
+
+CGPoint = MyOpaqueByValueType('CGPoint', 'CGPoint')
+CGRect = MyOpaqueByValueType('CGRect', 'CGRect')
+CGAffineTransform = MyOpaqueByValueType('CGAffineTransform', 'CGAffineTransform')
+
+char_ptr = Type("char *", "s")
+
+CGTextEncoding = int
+CGLineCap = int
+CGLineJoin = int
+CGTextDrawingMode = int
+CGPathDrawingMode = int
+CGInterpolationQuality = int
+
+# The real objects
+CGContextRef = OpaqueByValueType("CGContextRef", "CGContextRefObj")
+
+
+class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
+ def outputStructMembers(self):
+ ObjectDefinition.outputStructMembers(self)
+ def outputCleanupStructMembers(self):
+ Output("CGContextRelease(self->ob_itself);")
+
+
+# Create the generator groups and link them
+module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff)
+
+CGContextRef_object = MyObjectDefinition('CGContextRef', 'CGContextRefObj', 'CGContextRef')
+
+
+# ADD object here
+
+module.addobject(CGContextRef_object)
+
+
+
+Function = FunctionGenerator
+Method = MethodGenerator
+
+CGContextRef_methods = []
+
+# ADD _methods initializer here
+execfile(INPUTFILE)
+
+# manual method, lives in Quickdraw.h
+f = Method(void, 'SyncCGContextOriginWithPort',
+ (CGContextRef, 'ctx', InMode),
+ (CGrafPtr, 'port', InMode),
+)
+CGContextRef_methods.append(f)
+
+# manual method, lives in Quickdraw.h
+f = Method(void, 'ClipCGContextToRegion',
+ (CGContextRef, 'ctx', InMode),
+ (Rect, 'portRect', InMode),
+ (RgnHandle, 'region', InMode),
+)
+CGContextRef_methods.append(f)
+
+
+CreateCGContextForPort_body = """\
+GrafPtr port;
+CGContextRef ctx;
+OSStatus _err;
+
+if (!PyArg_ParseTuple(_args, "O&", GrafObj_Convert, &port))
+ return NULL;
+
+_err = CreateCGContextForPort(port, &ctx);
+if (_err != noErr)
+ if (_err != noErr) return PyMac_Error(_err);
+_res = Py_BuildValue("O&", CGContextRefObj_New, ctx);
+return _res;
+"""
+
+f = ManualGenerator("CreateCGContextForPort", CreateCGContextForPort_body);
+f.docstring = lambda: "(CGrafPtr) -> CGContextRef"
+module.add(f)
+
+
+# ADD add forloop here
+for f in CGContextRef_methods:
+ CGContextRef_object.add(f)
+
+# generate output (open the output file as late as possible)
+SetOutputFileName(OUTPUTFILE)
+module.generate()
diff --git a/Mac/Modules/cm/_Cmmodule.c b/Mac/Modules/cm/_Cmmodule.c
new file mode 100644
index 0000000000..f07f12100b
--- /dev/null
+++ b/Mac/Modules/cm/_Cmmodule.c
@@ -0,0 +1,955 @@
+
+/* =========================== Module _Cm =========================== */
+
+#include "Python.h"
+
+
+
+#include "pymactoolbox.h"
+
+/* Macro to test whether a weak-loaded CFM function exists */
+#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
+ PyErr_SetString(PyExc_NotImplementedError, \
+ "Not available in this shared library/OS version"); \
+ return NULL; \
+ }} while(0)
+
+
+#include <Carbon/Carbon.h>
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_CmpObj_New(Component);
+extern int _CmpObj_Convert(PyObject *, Component *);
+extern PyObject *_CmpInstObj_New(ComponentInstance);
+extern int _CmpInstObj_Convert(PyObject *, ComponentInstance *);
+
+#define CmpObj_New _CmpObj_New
+#define CmpObj_Convert _CmpObj_Convert
+#define CmpInstObj_New _CmpInstObj_New
+#define CmpInstObj_Convert _CmpInstObj_Convert
+#endif
+
+/*
+** Parse/generate ComponentDescriptor records
+*/
+static PyObject *
+CmpDesc_New(ComponentDescription *itself)
+{
+
+ return Py_BuildValue("O&O&O&ll",
+ PyMac_BuildOSType, itself->componentType,
+ PyMac_BuildOSType, itself->componentSubType,
+ PyMac_BuildOSType, itself->componentManufacturer,
+ itself->componentFlags, itself->componentFlagsMask);
+}
+
+static int
+CmpDesc_Convert(PyObject *v, ComponentDescription *p_itself)
+{
+ return PyArg_ParseTuple(v, "O&O&O&ll",
+ PyMac_GetOSType, &p_itself->componentType,
+ PyMac_GetOSType, &p_itself->componentSubType,
+ PyMac_GetOSType, &p_itself->componentManufacturer,
+ &p_itself->componentFlags, &p_itself->componentFlagsMask);
+}
+
+
+static PyObject *Cm_Error;
+
+/* ----------------- Object type ComponentInstance ------------------ */
+
+PyTypeObject ComponentInstance_Type;
+
+#define CmpInstObj_Check(x) ((x)->ob_type == &ComponentInstance_Type || PyObject_TypeCheck((x), &ComponentInstance_Type))
+
+typedef struct ComponentInstanceObject {
+ PyObject_HEAD
+ ComponentInstance ob_itself;
+} ComponentInstanceObject;
+
+PyObject *CmpInstObj_New(ComponentInstance itself)
+{
+ ComponentInstanceObject *it;
+ if (itself == NULL) {
+ PyErr_SetString(Cm_Error,"NULL ComponentInstance");
+ return NULL;
+ }
+ it = PyObject_NEW(ComponentInstanceObject, &ComponentInstance_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+
+int CmpInstObj_Convert(PyObject *v, ComponentInstance *p_itself)
+{
+ if (!CmpInstObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "ComponentInstance required");
+ return 0;
+ }
+ *p_itself = ((ComponentInstanceObject *)v)->ob_itself;
+ return 1;
+}
+
+static void CmpInstObj_dealloc(ComponentInstanceObject *self)
+{
+ /* Cleanup of self->ob_itself goes here */
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *CmpInstObj_CloseComponent(ComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+#ifndef CloseComponent
+ PyMac_PRECHECK(CloseComponent);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = CloseComponent(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CmpInstObj_GetComponentInstanceError(ComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+#ifndef GetComponentInstanceError
+ PyMac_PRECHECK(GetComponentInstanceError);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetComponentInstanceError(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CmpInstObj_SetComponentInstanceError(ComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr theError;
+#ifndef SetComponentInstanceError
+ PyMac_PRECHECK(SetComponentInstanceError);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &theError))
+ return NULL;
+ SetComponentInstanceError(_self->ob_itself,
+ theError);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CmpInstObj_GetComponentInstanceStorage(ComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+#ifndef GetComponentInstanceStorage
+ PyMac_PRECHECK(GetComponentInstanceStorage);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetComponentInstanceStorage(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CmpInstObj_SetComponentInstanceStorage(ComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle theStorage;
+#ifndef SetComponentInstanceStorage
+ PyMac_PRECHECK(SetComponentInstanceStorage);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &theStorage))
+ return NULL;
+ SetComponentInstanceStorage(_self->ob_itself,
+ theStorage);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+#ifndef __LP64__
+static PyObject *CmpInstObj_ComponentFunctionImplemented(ComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ short ftnNumber;
+#ifndef ComponentFunctionImplemented
+ PyMac_PRECHECK(ComponentFunctionImplemented);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &ftnNumber))
+ return NULL;
+ _rv = ComponentFunctionImplemented(_self->ob_itself,
+ ftnNumber);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CmpInstObj_GetComponentVersion(ComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+#ifndef GetComponentVersion
+ PyMac_PRECHECK(GetComponentVersion);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetComponentVersion(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CmpInstObj_ComponentSetTarget(ComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ ComponentInstance target;
+#ifndef ComponentSetTarget
+ PyMac_PRECHECK(ComponentSetTarget);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &target))
+ return NULL;
+ _rv = ComponentSetTarget(_self->ob_itself,
+ target);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+#endif /* !__LP64__*/
+
+static PyMethodDef CmpInstObj_methods[] = {
+ {"CloseComponent", (PyCFunction)CmpInstObj_CloseComponent, 1,
+ PyDoc_STR("() -> None")},
+ {"GetComponentInstanceError", (PyCFunction)CmpInstObj_GetComponentInstanceError, 1,
+ PyDoc_STR("() -> None")},
+ {"SetComponentInstanceError", (PyCFunction)CmpInstObj_SetComponentInstanceError, 1,
+ PyDoc_STR("(OSErr theError) -> None")},
+ {"GetComponentInstanceStorage", (PyCFunction)CmpInstObj_GetComponentInstanceStorage, 1,
+ 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}
+};
+
+#define CmpInstObj_getsetlist NULL
+
+
+#define CmpInstObj_compare NULL
+
+#define CmpInstObj_repr NULL
+
+#define CmpInstObj_hash NULL
+#define CmpInstObj_tp_init 0
+
+#define CmpInstObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *CmpInstObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *_self;
+ ComponentInstance itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, CmpInstObj_Convert, &itself)) return NULL;
+ if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((ComponentInstanceObject *)_self)->ob_itself = itself;
+ return _self;
+}
+
+#define CmpInstObj_tp_free PyObject_Del
+
+
+PyTypeObject ComponentInstance_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_Cm.ComponentInstance", /*tp_name*/
+ sizeof(ComponentInstanceObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) CmpInstObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) CmpInstObj_compare, /*tp_compare*/
+ (reprfunc) CmpInstObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) CmpInstObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ CmpInstObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ CmpInstObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ CmpInstObj_tp_init, /* tp_init */
+ CmpInstObj_tp_alloc, /* tp_alloc */
+ CmpInstObj_tp_new, /* tp_new */
+ CmpInstObj_tp_free, /* tp_free */
+};
+
+/* --------------- End object type ComponentInstance ---------------- */
+
+
+/* --------------------- Object type Component ---------------------- */
+
+PyTypeObject Component_Type;
+
+#define CmpObj_Check(x) ((x)->ob_type == &Component_Type || PyObject_TypeCheck((x), &Component_Type))
+
+typedef struct ComponentObject {
+ PyObject_HEAD
+ Component ob_itself;
+} ComponentObject;
+
+PyObject *CmpObj_New(Component itself)
+{
+ ComponentObject *it;
+ if (itself == NULL) {
+ /* XXXX Or should we return None? */
+ PyErr_SetString(Cm_Error,"No such component");
+ return NULL;
+ }
+ it = PyObject_NEW(ComponentObject, &Component_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+
+int CmpObj_Convert(PyObject *v, Component *p_itself)
+{
+ if ( v == Py_None ) {
+ *p_itself = 0;
+ return 1;
+ }
+ if (!CmpObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "Component required");
+ return 0;
+ }
+ *p_itself = ((ComponentObject *)v)->ob_itself;
+ return 1;
+}
+
+static void CmpObj_dealloc(ComponentObject *self)
+{
+ /* Cleanup of self->ob_itself goes here */
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *CmpObj_UnregisterComponent(ComponentObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+#ifndef UnregisterComponent
+ PyMac_PRECHECK(UnregisterComponent);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = UnregisterComponent(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CmpObj_GetComponentInfo(ComponentObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ComponentDescription cd;
+ Handle componentName;
+ Handle componentInfo;
+ Handle componentIcon;
+#ifndef GetComponentInfo
+ PyMac_PRECHECK(GetComponentInfo);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ ResObj_Convert, &componentName,
+ ResObj_Convert, &componentInfo,
+ ResObj_Convert, &componentIcon))
+ return NULL;
+ _err = GetComponentInfo(_self->ob_itself,
+ &cd,
+ componentName,
+ componentInfo,
+ componentIcon);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CmpDesc_New, &cd);
+ return _res;
+}
+
+static PyObject *CmpObj_OpenComponent(ComponentObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentInstance _rv;
+#ifndef OpenComponent
+ PyMac_PRECHECK(OpenComponent);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = OpenComponent(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CmpInstObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CmpObj_ResolveComponentAlias(ComponentObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Component _rv;
+#ifndef ResolveComponentAlias
+ PyMac_PRECHECK(ResolveComponentAlias);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = ResolveComponentAlias(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CmpObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CmpObj_GetComponentPublicIndString(ComponentObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Str255 theString;
+ short strListID;
+ short index;
+#ifndef GetComponentPublicIndString
+ PyMac_PRECHECK(GetComponentPublicIndString);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetStr255, theString,
+ &strListID,
+ &index))
+ return NULL;
+ _err = GetComponentPublicIndString(_self->ob_itself,
+ theString,
+ strListID,
+ index);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CmpObj_GetComponentRefcon(ComponentObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+#ifndef GetComponentRefcon
+ PyMac_PRECHECK(GetComponentRefcon);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetComponentRefcon(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CmpObj_SetComponentRefcon(ComponentObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long theRefcon;
+#ifndef SetComponentRefcon
+ PyMac_PRECHECK(SetComponentRefcon);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &theRefcon))
+ return NULL;
+ SetComponentRefcon(_self->ob_itself,
+ theRefcon);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CmpObj_OpenComponentResFile(ComponentObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+#ifndef OpenComponentResFile
+ PyMac_PRECHECK(OpenComponentResFile);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = OpenComponentResFile(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *CmpObj_GetComponentResource(ComponentObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType resType;
+ short resID;
+ Handle theResource;
+#ifndef GetComponentResource
+ PyMac_PRECHECK(GetComponentResource);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ PyMac_GetOSType, &resType,
+ &resID))
+ return NULL;
+ _err = GetComponentResource(_self->ob_itself,
+ resType,
+ resID,
+ &theResource);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, theResource);
+ return _res;
+}
+
+static PyObject *CmpObj_GetComponentIndString(ComponentObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Str255 theString;
+ short strListID;
+ short index;
+#ifndef GetComponentIndString
+ PyMac_PRECHECK(GetComponentIndString);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetStr255, theString,
+ &strListID,
+ &index))
+ return NULL;
+ _err = GetComponentIndString(_self->ob_itself,
+ theString,
+ strListID,
+ index);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CmpObj_CountComponentInstances(ComponentObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+#ifndef CountComponentInstances
+ PyMac_PRECHECK(CountComponentInstances);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CountComponentInstances(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CmpObj_SetDefaultComponent(ComponentObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short flags;
+#ifndef SetDefaultComponent
+ PyMac_PRECHECK(SetDefaultComponent);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &flags))
+ return NULL;
+ _err = SetDefaultComponent(_self->ob_itself,
+ flags);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CmpObj_CaptureComponent(ComponentObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Component _rv;
+ Component capturingComponent;
+#ifndef CaptureComponent
+ PyMac_PRECHECK(CaptureComponent);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpObj_Convert, &capturingComponent))
+ return NULL;
+ _rv = CaptureComponent(_self->ob_itself,
+ capturingComponent);
+ _res = Py_BuildValue("O&",
+ CmpObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CmpObj_UncaptureComponent(ComponentObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+#ifndef UncaptureComponent
+ PyMac_PRECHECK(UncaptureComponent);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = UncaptureComponent(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+#ifndef __LP64__
+static PyObject *CmpObj_GetComponentIconSuite(ComponentObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle iconSuite;
+#ifndef GetComponentIconSuite
+ PyMac_PRECHECK(GetComponentIconSuite);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetComponentIconSuite(_self->ob_itself,
+ &iconSuite);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, iconSuite);
+ return _res;
+}
+#endif /* !__LP64__ */
+
+static PyMethodDef CmpObj_methods[] = {
+ {"UnregisterComponent", (PyCFunction)CmpObj_UnregisterComponent, 1,
+ PyDoc_STR("() -> None")},
+ {"GetComponentInfo", (PyCFunction)CmpObj_GetComponentInfo, 1,
+ PyDoc_STR("(Handle componentName, Handle componentInfo, Handle componentIcon) -> (ComponentDescription cd)")},
+ {"OpenComponent", (PyCFunction)CmpObj_OpenComponent, 1,
+ PyDoc_STR("() -> (ComponentInstance _rv)")},
+ {"ResolveComponentAlias", (PyCFunction)CmpObj_ResolveComponentAlias, 1,
+ PyDoc_STR("() -> (Component _rv)")},
+ {"GetComponentPublicIndString", (PyCFunction)CmpObj_GetComponentPublicIndString, 1,
+ PyDoc_STR("(Str255 theString, short strListID, short index) -> None")},
+ {"GetComponentRefcon", (PyCFunction)CmpObj_GetComponentRefcon, 1,
+ PyDoc_STR("() -> (long _rv)")},
+ {"SetComponentRefcon", (PyCFunction)CmpObj_SetComponentRefcon, 1,
+ PyDoc_STR("(long theRefcon) -> None")},
+ {"OpenComponentResFile", (PyCFunction)CmpObj_OpenComponentResFile, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"GetComponentResource", (PyCFunction)CmpObj_GetComponentResource, 1,
+ PyDoc_STR("(OSType resType, short resID) -> (Handle theResource)")},
+ {"GetComponentIndString", (PyCFunction)CmpObj_GetComponentIndString, 1,
+ PyDoc_STR("(Str255 theString, short strListID, short index) -> None")},
+ {"CountComponentInstances", (PyCFunction)CmpObj_CountComponentInstances, 1,
+ PyDoc_STR("() -> (long _rv)")},
+ {"SetDefaultComponent", (PyCFunction)CmpObj_SetDefaultComponent, 1,
+ PyDoc_STR("(short flags) -> None")},
+ {"CaptureComponent", (PyCFunction)CmpObj_CaptureComponent, 1,
+ 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}
+};
+
+#define CmpObj_getsetlist NULL
+
+
+#define CmpObj_compare NULL
+
+#define CmpObj_repr NULL
+
+#define CmpObj_hash NULL
+#define CmpObj_tp_init 0
+
+#define CmpObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *CmpObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *_self;
+ Component itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, CmpObj_Convert, &itself)) return NULL;
+ if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((ComponentObject *)_self)->ob_itself = itself;
+ return _self;
+}
+
+#define CmpObj_tp_free PyObject_Del
+
+
+PyTypeObject Component_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_Cm.Component", /*tp_name*/
+ sizeof(ComponentObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) CmpObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) CmpObj_compare, /*tp_compare*/
+ (reprfunc) CmpObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) CmpObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ CmpObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ CmpObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ CmpObj_tp_init, /* tp_init */
+ CmpObj_tp_alloc, /* tp_alloc */
+ CmpObj_tp_new, /* tp_new */
+ CmpObj_tp_free, /* tp_free */
+};
+
+/* ------------------- End object type Component -------------------- */
+
+
+static PyObject *Cm_RegisterComponentResource(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Component _rv;
+ ComponentResourceHandle cr;
+ short global;
+#ifndef RegisterComponentResource
+ PyMac_PRECHECK(RegisterComponentResource);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ ResObj_Convert, &cr,
+ &global))
+ return NULL;
+ _rv = RegisterComponentResource(cr,
+ global);
+ _res = Py_BuildValue("O&",
+ CmpObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Cm_FindNextComponent(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Component _rv;
+ Component aComponent;
+ ComponentDescription looking;
+#ifndef FindNextComponent
+ PyMac_PRECHECK(FindNextComponent);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpObj_Convert, &aComponent,
+ CmpDesc_Convert, &looking))
+ return NULL;
+ _rv = FindNextComponent(aComponent,
+ &looking);
+ _res = Py_BuildValue("O&",
+ CmpObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Cm_CountComponents(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ ComponentDescription looking;
+#ifndef CountComponents
+ PyMac_PRECHECK(CountComponents);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpDesc_Convert, &looking))
+ return NULL;
+ _rv = CountComponents(&looking);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Cm_GetComponentListModSeed(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+#ifndef GetComponentListModSeed
+ PyMac_PRECHECK(GetComponentListModSeed);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetComponentListModSeed();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Cm_CloseComponentResFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short refnum;
+#ifndef CloseComponentResFile
+ PyMac_PRECHECK(CloseComponentResFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &refnum))
+ return NULL;
+ _err = CloseComponentResFile(refnum);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Cm_OpenDefaultComponent(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentInstance _rv;
+ OSType componentType;
+ OSType componentSubType;
+#ifndef OpenDefaultComponent
+ PyMac_PRECHECK(OpenDefaultComponent);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &componentType,
+ PyMac_GetOSType, &componentSubType))
+ return NULL;
+ _rv = OpenDefaultComponent(componentType,
+ componentSubType);
+ _res = Py_BuildValue("O&",
+ CmpInstObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Cm_RegisterComponentResourceFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ short resRefNum;
+ short global;
+#ifndef RegisterComponentResourceFile
+ PyMac_PRECHECK(RegisterComponentResourceFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "hh",
+ &resRefNum,
+ &global))
+ return NULL;
+ _rv = RegisterComponentResourceFile(resRefNum,
+ global);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyMethodDef Cm_methods[] = {
+ {"RegisterComponentResource", (PyCFunction)Cm_RegisterComponentResource, 1,
+ PyDoc_STR("(ComponentResourceHandle cr, short global) -> (Component _rv)")},
+ {"FindNextComponent", (PyCFunction)Cm_FindNextComponent, 1,
+ PyDoc_STR("(Component aComponent, ComponentDescription looking) -> (Component _rv)")},
+ {"CountComponents", (PyCFunction)Cm_CountComponents, 1,
+ PyDoc_STR("(ComponentDescription looking) -> (long _rv)")},
+ {"GetComponentListModSeed", (PyCFunction)Cm_GetComponentListModSeed, 1,
+ PyDoc_STR("() -> (long _rv)")},
+ {"CloseComponentResFile", (PyCFunction)Cm_CloseComponentResFile, 1,
+ PyDoc_STR("(short refnum) -> None")},
+ {"OpenDefaultComponent", (PyCFunction)Cm_OpenDefaultComponent, 1,
+ PyDoc_STR("(OSType componentType, OSType componentSubType) -> (ComponentInstance _rv)")},
+ {"RegisterComponentResourceFile", (PyCFunction)Cm_RegisterComponentResourceFile, 1,
+ PyDoc_STR("(short resRefNum, short global) -> (long _rv)")},
+ {NULL, NULL, 0}
+};
+
+
+
+
+void init_Cm(void)
+{
+ PyObject *m;
+ PyObject *d;
+
+
+
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(Component, CmpObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Component, CmpObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(ComponentInstance, CmpInstObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ComponentInstance, CmpInstObj_Convert);
+
+
+ m = Py_InitModule("_Cm", Cm_methods);
+ d = PyModule_GetDict(m);
+ Cm_Error = PyMac_GetOSErrException();
+ if (Cm_Error == NULL ||
+ PyDict_SetItemString(d, "Error", Cm_Error) != 0)
+ return;
+ ComponentInstance_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&ComponentInstance_Type) < 0) return;
+ Py_INCREF(&ComponentInstance_Type);
+ PyModule_AddObject(m, "ComponentInstance", (PyObject *)&ComponentInstance_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&ComponentInstance_Type);
+ PyModule_AddObject(m, "ComponentInstanceType", (PyObject *)&ComponentInstance_Type);
+ Component_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&Component_Type) < 0) return;
+ Py_INCREF(&Component_Type);
+ PyModule_AddObject(m, "Component", (PyObject *)&Component_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&Component_Type);
+ PyModule_AddObject(m, "ComponentType", (PyObject *)&Component_Type);
+}
+
+/* ========================= End module _Cm ========================= */
+
diff --git a/Mac/Modules/cm/cmscan.py b/Mac/Modules/cm/cmscan.py
new file mode 100644
index 0000000000..73261f58b2
--- /dev/null
+++ b/Mac/Modules/cm/cmscan.py
@@ -0,0 +1,88 @@
+# Scan an Apple header file, generating a Python file of generator calls.
+
+import sys
+from bgenlocations import TOOLBOXDIR, BGENDIR
+sys.path.append(BGENDIR)
+from scantools import Scanner
+
+LONG = "Components"
+SHORT = "cm"
+
+def main():
+ input = "Components.h"
+ output = SHORT + "gen.py"
+ defsoutput = TOOLBOXDIR + LONG + ".py"
+ scanner = MyScanner(input, output, defsoutput)
+ scanner.scan()
+ scanner.close()
+ print "=== Testing definitions output code ==="
+ execfile(defsoutput, {}, {})
+ print "=== Done scanning and generating, now importing the generated code... ==="
+ exec "import " + SHORT + "support"
+ print "=== Done. It's up to you to compile it now! ==="
+
+class MyScanner(Scanner):
+
+ def destination(self, type, name, arglist):
+ classname = "Function"
+ listname = "functions"
+ if arglist:
+ t, n, m = arglist[0]
+ #
+ # FindNextComponent is a special case, since it call also be called
+ # with None as the argument. Hence, we make it a function
+ #
+ if t == "Component" and m == "InMode" and name != "FindNextComponent":
+ classname = "Method"
+ listname = "c_methods"
+ elif t == "ComponentInstance" and m == "InMode":
+ classname = "Method"
+ listname = "ci_methods"
+ return classname, listname
+
+ def writeinitialdefs(self):
+ self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
+
+ def makeblacklistnames(self):
+ return [
+ "OpenADefaultComponent",
+ "GetComponentTypeModSeed",
+ "OpenAComponentResFile",
+ "CallComponentUnregister",
+ "CallComponentTarget",
+ "CallComponentRegister",
+ "CallComponentVersion",
+ "CallComponentCanDo",
+ "CallComponentClose",
+ "CallComponentOpen",
+ "OpenAComponent",
+ "GetComponentPublicResource", # Missing in CW Pro 6
+ "CallComponentGetPublicResource", # Missing in CW Pro 6
+ 'SetComponentInstanceA5',
+ 'GetComponentInstanceA5',
+ ]
+
+ def makeblacklisttypes(self):
+ return [
+ "ResourceSpec",
+ "ComponentResource",
+ "ComponentPlatformInfo",
+ "ComponentResourceExtension",
+ "ComponentPlatformInfoArray",
+ "ExtComponentResource",
+ "ComponentParameters",
+
+ "ComponentRoutineUPP",
+ "ComponentMPWorkFunctionUPP",
+ "ComponentFunctionUPP",
+ "GetMissingComponentResourceUPP",
+ ]
+
+ def makerepairinstructions(self):
+ return [
+ ([('ComponentDescription', 'looking', 'OutMode')],
+ [('ComponentDescription', '*', 'InMode')]),
+ ]
+
+if __name__ == "__main__":
+ main()
diff --git a/Mac/Modules/cm/cmsupport.py b/Mac/Modules/cm/cmsupport.py
new file mode 100644
index 0000000000..4109dbabaa
--- /dev/null
+++ b/Mac/Modules/cm/cmsupport.py
@@ -0,0 +1,125 @@
+# This script generates a Python interface for an Apple Macintosh Manager.
+# It uses the "bgen" package to generate C code.
+# The function specifications are generated by scanning the mamager's header file,
+# using the "scantools" package (customized for this particular manager).
+
+import string
+
+# Declarations that change for each manager
+MACHEADERFILE = 'Components.h' # The Apple header file
+MODNAME = '_Cm' # The name of the module
+
+# The following is *usually* unchanged but may still require tuning
+MODPREFIX = 'Cm' # The prefix for module-wide routines
+C_OBJECTPREFIX = 'CmpObj' # The prefix for object methods
+CI_OBJECTPREFIX = 'CmpInstObj'
+INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner
+OUTPUTFILE = MODNAME + "module.c" # The file generated by this program
+
+from macsupport import *
+
+# Create the type objects
+
+includestuff = includestuff + """
+#include <Carbon/Carbon.h>
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_CmpObj_New(Component);
+extern int _CmpObj_Convert(PyObject *, Component *);
+extern PyObject *_CmpInstObj_New(ComponentInstance);
+extern int _CmpInstObj_Convert(PyObject *, ComponentInstance *);
+
+#define CmpObj_New _CmpObj_New
+#define CmpObj_Convert _CmpObj_Convert
+#define CmpInstObj_New _CmpInstObj_New
+#define CmpInstObj_Convert _CmpInstObj_Convert
+#endif
+
+/*
+** Parse/generate ComponentDescriptor records
+*/
+static PyObject *
+CmpDesc_New(ComponentDescription *itself)
+{
+
+ return Py_BuildValue("O&O&O&ll",
+ PyMac_BuildOSType, itself->componentType,
+ PyMac_BuildOSType, itself->componentSubType,
+ PyMac_BuildOSType, itself->componentManufacturer,
+ itself->componentFlags, itself->componentFlagsMask);
+}
+
+static int
+CmpDesc_Convert(PyObject *v, ComponentDescription *p_itself)
+{
+ return PyArg_ParseTuple(v, "O&O&O&ll",
+ PyMac_GetOSType, &p_itself->componentType,
+ PyMac_GetOSType, &p_itself->componentSubType,
+ PyMac_GetOSType, &p_itself->componentManufacturer,
+ &p_itself->componentFlags, &p_itself->componentFlagsMask);
+}
+
+"""
+
+initstuff = initstuff + """
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(Component, CmpObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Component, CmpObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(ComponentInstance, CmpInstObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ComponentInstance, CmpInstObj_Convert);
+"""
+
+ComponentDescription = OpaqueType('ComponentDescription', 'CmpDesc')
+Component = OpaqueByValueType('Component', C_OBJECTPREFIX)
+ComponentInstance = OpaqueByValueType('ComponentInstance', CI_OBJECTPREFIX)
+ComponentResult = Type("ComponentResult", "l")
+
+ComponentResourceHandle = OpaqueByValueType("ComponentResourceHandle", "ResObj")
+
+class MyCIObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
+ def outputCheckNewArg(self):
+ Output("""if (itself == NULL) {
+ PyErr_SetString(Cm_Error,"NULL ComponentInstance");
+ return NULL;
+ }""")
+
+class MyCObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
+ def outputCheckNewArg(self):
+ Output("""if (itself == NULL) {
+ /* XXXX Or should we return None? */
+ PyErr_SetString(Cm_Error,"No such component");
+ return NULL;
+ }""")
+
+ def outputCheckConvertArg(self):
+ Output("""if ( v == Py_None ) {
+ *p_itself = 0;
+ return 1;
+ }""")
+
+# Create the generator groups and link them
+module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff)
+ci_object = MyCIObjectDefinition('ComponentInstance', CI_OBJECTPREFIX,
+ 'ComponentInstance')
+c_object = MyCObjectDefinition('Component', C_OBJECTPREFIX, 'Component')
+module.addobject(ci_object)
+module.addobject(c_object)
+
+# Create the generator classes used to populate the lists
+Function = OSErrWeakLinkFunctionGenerator
+Method = OSErrWeakLinkMethodGenerator
+
+# Create and populate the lists
+functions = []
+c_methods = []
+ci_methods = []
+execfile(INPUTFILE)
+
+# add the populated lists to the generator groups
+# (in a different wordl the scan program would generate this)
+for f in functions: module.add(f)
+for f in c_methods: c_object.add(f)
+for f in ci_methods: ci_object.add(f)
+
+# generate output (open the output file as late as possible)
+SetOutputFileName(OUTPUTFILE)
+module.generate()
diff --git a/Mac/Modules/ctl/_Ctlmodule.c b/Mac/Modules/ctl/_Ctlmodule.c
new file mode 100644
index 0000000000..a959eb4f56
--- /dev/null
+++ b/Mac/Modules/ctl/_Ctlmodule.c
@@ -0,0 +1,5815 @@
+
+/* ========================== Module _Ctl =========================== */
+
+#include "Python.h"
+
+#ifndef __LP64__
+
+
+#include "pymactoolbox.h"
+
+/* Macro to test whether a weak-loaded CFM function exists */
+#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
+ PyErr_SetString(PyExc_NotImplementedError, \
+ "Not available in this shared library/OS version"); \
+ return NULL; \
+ }} while(0)
+
+
+#include <Carbon/Carbon.h>
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_CtlObj_New(ControlHandle);
+extern int _CtlObj_Convert(PyObject *, ControlHandle *);
+
+#define CtlObj_New _CtlObj_New
+#define CtlObj_Convert _CtlObj_Convert
+#endif
+
+static PyObject *CtlObj_WhichControl(ControlHandle);
+
+#define as_Control(h) ((ControlHandle)h)
+#define as_Resource(ctl) ((Handle)ctl)
+#define GetControlRect(ctl, rectp) GetControlBounds(ctl, rectp)
+
+#define MAXTABS 32 /* maximum number of tabs that we support in a tabs control */
+/*
+** Parse/generate ControlFontStyleRec records
+*/
+#if 0 /* Not needed */
+static PyObject *
+ControlFontStyle_New(ControlFontStyleRec *itself)
+{
+
+ return Py_BuildValue("hhhhhhO&O&", itself->flags, itself->font,
+ itself->size, itself->style, itself->mode, itself->just,
+ QdRGB_New, &itself->foreColor, QdRGB_New, &itself->backColor);
+}
+#endif
+
+static int
+ControlFontStyle_Convert(PyObject *v, ControlFontStyleRec *itself)
+{
+ return PyArg_Parse(v, "(hhhhhhO&O&)", &itself->flags,
+ &itself->font, &itself->size, &itself->style, &itself->mode,
+ &itself->just, QdRGB_Convert, &itself->foreColor,
+ QdRGB_Convert, &itself->backColor);
+}
+
+/*
+** Parse/generate ControlID records
+*/
+static PyObject *
+PyControlID_New(ControlID *itself)
+{
+
+ return Py_BuildValue("O&l", PyMac_BuildOSType, itself->signature, itself->id);
+}
+
+static int
+PyControlID_Convert(PyObject *v, ControlID *itself)
+{
+ return PyArg_Parse(v, "(O&l)", PyMac_GetOSType, &itself->signature, &itself->id);
+}
+
+/*
+** generate DataBrowserListViewColumnDesc records
+*/
+static int
+DataBrowserTableViewColumnDesc_Convert(PyObject *v, DataBrowserTableViewColumnDesc *itself)
+{
+ return PyArg_Parse(v, "(lO&l)",
+ &itself->propertyID,
+ PyMac_GetOSType, &itself->propertyType,
+ &itself->propertyFlags);
+}
+
+static int
+ControlButtonContentInfo_Convert(PyObject *v, ControlButtonContentInfo *itself)
+{
+ return PyArg_Parse(v, "(hO&)",
+ &itself->contentType,
+ OptResObj_Convert, &itself->u.iconSuite);
+}
+
+static int
+DataBrowserListViewHeaderDesc_Convert(PyObject *v, DataBrowserListViewHeaderDesc *itself)
+{
+ itself->version = kDataBrowserListViewLatestHeaderDesc;
+ return PyArg_Parse(v, "(HHhO&HO&O&)",
+ &itself->minimumWidth,
+ &itself->maximumWidth,
+ &itself->titleOffset,
+ CFStringRefObj_Convert, &itself->titleString,
+ &itself->initialOrder,
+ ControlFontStyle_Convert, &itself->btnFontStyle,
+ ControlButtonContentInfo_Convert, &itself->btnContentInfo);
+}
+
+static int
+DataBrowserListViewColumnDesc_Convert(PyObject *v, DataBrowserListViewColumnDesc *itself)
+{
+ return PyArg_Parse(v, "(O&O&)",
+ DataBrowserTableViewColumnDesc_Convert, &itself->propertyDesc,
+ DataBrowserListViewHeaderDesc_Convert, &itself->headerBtnDesc);
+}
+
+/* TrackControl and HandleControlClick callback support */
+#define kMyControlActionProcTag 'ACTN' /* not an official tag, only for internal use */
+static PyObject *tracker;
+static ControlActionUPP mytracker_upp;
+static ControlActionUPP myactionproc_upp;
+static ControlUserPaneKeyDownUPP mykeydownproc_upp;
+static ControlUserPaneFocusUPP myfocusproc_upp;
+static ControlUserPaneDrawUPP mydrawproc_upp;
+static ControlUserPaneIdleUPP myidleproc_upp;
+static ControlUserPaneHitTestUPP myhittestproc_upp;
+static ControlUserPaneTrackingUPP mytrackingproc_upp;
+
+static int settrackfunc(PyObject *); /* forward */
+static void clrtrackfunc(void); /* forward */
+static int setcallback(PyObject *, OSType, PyObject *, UniversalProcPtr *);
+
+static PyObject *Ctl_Error;
+
+/* ---------------------- Object type Control ----------------------- */
+
+PyTypeObject Control_Type;
+
+#define CtlObj_Check(x) ((x)->ob_type == &Control_Type || PyObject_TypeCheck((x), &Control_Type))
+
+typedef struct ControlObject {
+ PyObject_HEAD
+ ControlHandle ob_itself;
+ PyObject *ob_callbackdict;
+} ControlObject;
+
+PyObject *CtlObj_New(ControlHandle itself)
+{
+ ControlObject *it;
+ if (itself == NULL) return PyMac_Error(resNotFound);
+ it = PyObject_NEW(ControlObject, &Control_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ SetControlReference(itself, (long)it);
+ it->ob_callbackdict = NULL;
+ return (PyObject *)it;
+}
+
+int CtlObj_Convert(PyObject *v, ControlHandle *p_itself)
+{
+ if (!CtlObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "Control required");
+ return 0;
+ }
+ *p_itself = ((ControlObject *)v)->ob_itself;
+ return 1;
+}
+
+static void CtlObj_dealloc(ControlObject *self)
+{
+ Py_XDECREF(self->ob_callbackdict);
+ if (self->ob_itself)SetControlReference(self->ob_itself, (long)0); /* Make it forget about us */
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *CtlObj_HiliteControl(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ControlPartCode hiliteState;
+#ifndef HiliteControl
+ PyMac_PRECHECK(HiliteControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &hiliteState))
+ return NULL;
+ HiliteControl(_self->ob_itself,
+ hiliteState);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_ShowControl(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef ShowControl
+ PyMac_PRECHECK(ShowControl);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ShowControl(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_HideControl(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef HideControl
+ PyMac_PRECHECK(HideControl);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ HideControl(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_IsControlActive(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef IsControlActive
+ PyMac_PRECHECK(IsControlActive);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsControlActive(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *CtlObj_IsControlVisible(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef IsControlVisible
+ PyMac_PRECHECK(IsControlVisible);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsControlVisible(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *CtlObj_ActivateControl(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+#ifndef ActivateControl
+ PyMac_PRECHECK(ActivateControl);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = ActivateControl(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_DeactivateControl(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+#ifndef DeactivateControl
+ PyMac_PRECHECK(DeactivateControl);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = DeactivateControl(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_SetControlVisibility(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Boolean inIsVisible;
+ Boolean inDoDraw;
+#ifndef SetControlVisibility
+ PyMac_PRECHECK(SetControlVisibility);
+#endif
+ if (!PyArg_ParseTuple(_args, "bb",
+ &inIsVisible,
+ &inDoDraw))
+ return NULL;
+ _err = SetControlVisibility(_self->ob_itself,
+ inIsVisible,
+ inDoDraw);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_IsControlEnabled(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef IsControlEnabled
+ PyMac_PRECHECK(IsControlEnabled);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsControlEnabled(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *CtlObj_EnableControl(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+#ifndef EnableControl
+ PyMac_PRECHECK(EnableControl);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = EnableControl(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_DisableControl(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+#ifndef DisableControl
+ PyMac_PRECHECK(DisableControl);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = DisableControl(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_Draw1Control(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef Draw1Control
+ PyMac_PRECHECK(Draw1Control);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ Draw1Control(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetBestControlRect(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Rect outRect;
+ SInt16 outBaseLineOffset;
+#ifndef GetBestControlRect
+ PyMac_PRECHECK(GetBestControlRect);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetBestControlRect(_self->ob_itself,
+ &outRect,
+ &outBaseLineOffset);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&h",
+ PyMac_BuildRect, &outRect,
+ outBaseLineOffset);
+ return _res;
+}
+
+static PyObject *CtlObj_SetControlFontStyle(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ControlFontStyleRec inStyle;
+#ifndef SetControlFontStyle
+ PyMac_PRECHECK(SetControlFontStyle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ControlFontStyle_Convert, &inStyle))
+ return NULL;
+ _err = SetControlFontStyle(_self->ob_itself,
+ &inStyle);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_DrawControlInCurrentPort(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef DrawControlInCurrentPort
+ PyMac_PRECHECK(DrawControlInCurrentPort);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ DrawControlInCurrentPort(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_SetUpControlBackground(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inDepth;
+ Boolean inIsColorDevice;
+#ifndef SetUpControlBackground
+ PyMac_PRECHECK(SetUpControlBackground);
+#endif
+ if (!PyArg_ParseTuple(_args, "hb",
+ &inDepth,
+ &inIsColorDevice))
+ return NULL;
+ _err = SetUpControlBackground(_self->ob_itself,
+ inDepth,
+ inIsColorDevice);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_SetUpControlTextColor(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inDepth;
+ Boolean inIsColorDevice;
+#ifndef SetUpControlTextColor
+ PyMac_PRECHECK(SetUpControlTextColor);
+#endif
+ if (!PyArg_ParseTuple(_args, "hb",
+ &inDepth,
+ &inIsColorDevice))
+ return NULL;
+ _err = SetUpControlTextColor(_self->ob_itself,
+ inDepth,
+ inIsColorDevice);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_DragControl(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point startPoint;
+ Rect limitRect;
+ Rect slopRect;
+ DragConstraint axis;
+#ifndef DragControl
+ PyMac_PRECHECK(DragControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&H",
+ PyMac_GetPoint, &startPoint,
+ PyMac_GetRect, &limitRect,
+ PyMac_GetRect, &slopRect,
+ &axis))
+ return NULL;
+ DragControl(_self->ob_itself,
+ startPoint,
+ &limitRect,
+ &slopRect,
+ axis);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_TestControl(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ControlPartCode _rv;
+ Point testPoint;
+#ifndef TestControl
+ PyMac_PRECHECK(TestControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &testPoint))
+ return NULL;
+ _rv = TestControl(_self->ob_itself,
+ testPoint);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *CtlObj_HandleControlContextualMenuClick(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Point inWhere;
+ Boolean menuDisplayed;
+#ifndef HandleControlContextualMenuClick
+ PyMac_PRECHECK(HandleControlContextualMenuClick);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &inWhere))
+ return NULL;
+ _err = HandleControlContextualMenuClick(_self->ob_itself,
+ inWhere,
+ &menuDisplayed);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("b",
+ menuDisplayed);
+ return _res;
+}
+
+static PyObject *CtlObj_GetControlClickActivation(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Point inWhere;
+ EventModifiers inModifiers;
+ ClickActivationResult outResult;
+#ifndef GetControlClickActivation
+ PyMac_PRECHECK(GetControlClickActivation);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&H",
+ PyMac_GetPoint, &inWhere,
+ &inModifiers))
+ return NULL;
+ _err = GetControlClickActivation(_self->ob_itself,
+ inWhere,
+ inModifiers,
+ &outResult);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outResult);
+ return _res;
+}
+
+static PyObject *CtlObj_HandleControlKey(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ControlPartCode _rv;
+ SInt16 inKeyCode;
+ SInt16 inCharCode;
+ EventModifiers inModifiers;
+#ifndef HandleControlKey
+ PyMac_PRECHECK(HandleControlKey);
+#endif
+ if (!PyArg_ParseTuple(_args, "hhH",
+ &inKeyCode,
+ &inCharCode,
+ &inModifiers))
+ return NULL;
+ _rv = HandleControlKey(_self->ob_itself,
+ inKeyCode,
+ inCharCode,
+ inModifiers);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *CtlObj_HandleControlSetCursor(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Point localPoint;
+ EventModifiers modifiers;
+ Boolean cursorWasSet;
+#ifndef HandleControlSetCursor
+ PyMac_PRECHECK(HandleControlSetCursor);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&H",
+ PyMac_GetPoint, &localPoint,
+ &modifiers))
+ return NULL;
+ _err = HandleControlSetCursor(_self->ob_itself,
+ localPoint,
+ modifiers,
+ &cursorWasSet);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("b",
+ cursorWasSet);
+ return _res;
+}
+
+static PyObject *CtlObj_MoveControl(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 h;
+ SInt16 v;
+#ifndef MoveControl
+ PyMac_PRECHECK(MoveControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "hh",
+ &h,
+ &v))
+ return NULL;
+ MoveControl(_self->ob_itself,
+ h,
+ v);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_SizeControl(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 w;
+ SInt16 h;
+#ifndef SizeControl
+ PyMac_PRECHECK(SizeControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "hh",
+ &w,
+ &h))
+ return NULL;
+ SizeControl(_self->ob_itself,
+ w,
+ h);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_SetControlTitle(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Str255 title;
+#ifndef SetControlTitle
+ PyMac_PRECHECK(SetControlTitle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetStr255, title))
+ return NULL;
+ SetControlTitle(_self->ob_itself,
+ title);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetControlTitle(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Str255 title;
+#ifndef GetControlTitle
+ PyMac_PRECHECK(GetControlTitle);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetControlTitle(_self->ob_itself,
+ title);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildStr255, title);
+ return _res;
+}
+
+static PyObject *CtlObj_SetControlTitleWithCFString(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ CFStringRef inString;
+#ifndef SetControlTitleWithCFString
+ PyMac_PRECHECK(SetControlTitleWithCFString);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFStringRefObj_Convert, &inString))
+ return NULL;
+ _err = SetControlTitleWithCFString(_self->ob_itself,
+ inString);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_CopyControlTitleAsCFString(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ CFStringRef outString;
+#ifndef CopyControlTitleAsCFString
+ PyMac_PRECHECK(CopyControlTitleAsCFString);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = CopyControlTitleAsCFString(_self->ob_itself,
+ &outString);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, outString);
+ return _res;
+}
+
+static PyObject *CtlObj_GetControlValue(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 _rv;
+#ifndef GetControlValue
+ PyMac_PRECHECK(GetControlValue);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetControlValue(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *CtlObj_SetControlValue(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 newValue;
+#ifndef SetControlValue
+ PyMac_PRECHECK(SetControlValue);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &newValue))
+ return NULL;
+ SetControlValue(_self->ob_itself,
+ newValue);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetControlMinimum(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 _rv;
+#ifndef GetControlMinimum
+ PyMac_PRECHECK(GetControlMinimum);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetControlMinimum(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *CtlObj_SetControlMinimum(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 newMinimum;
+#ifndef SetControlMinimum
+ PyMac_PRECHECK(SetControlMinimum);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &newMinimum))
+ return NULL;
+ SetControlMinimum(_self->ob_itself,
+ newMinimum);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetControlMaximum(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 _rv;
+#ifndef GetControlMaximum
+ PyMac_PRECHECK(GetControlMaximum);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetControlMaximum(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *CtlObj_SetControlMaximum(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 newMaximum;
+#ifndef SetControlMaximum
+ PyMac_PRECHECK(SetControlMaximum);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &newMaximum))
+ return NULL;
+ SetControlMaximum(_self->ob_itself,
+ newMaximum);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetControlViewSize(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 _rv;
+#ifndef GetControlViewSize
+ PyMac_PRECHECK(GetControlViewSize);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetControlViewSize(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CtlObj_SetControlViewSize(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 newViewSize;
+#ifndef SetControlViewSize
+ PyMac_PRECHECK(SetControlViewSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &newViewSize))
+ return NULL;
+ SetControlViewSize(_self->ob_itself,
+ newViewSize);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetControl32BitValue(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 _rv;
+#ifndef GetControl32BitValue
+ PyMac_PRECHECK(GetControl32BitValue);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetControl32BitValue(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CtlObj_SetControl32BitValue(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 newValue;
+#ifndef SetControl32BitValue
+ PyMac_PRECHECK(SetControl32BitValue);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &newValue))
+ return NULL;
+ SetControl32BitValue(_self->ob_itself,
+ newValue);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetControl32BitMaximum(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 _rv;
+#ifndef GetControl32BitMaximum
+ PyMac_PRECHECK(GetControl32BitMaximum);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetControl32BitMaximum(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CtlObj_SetControl32BitMaximum(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 newMaximum;
+#ifndef SetControl32BitMaximum
+ PyMac_PRECHECK(SetControl32BitMaximum);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &newMaximum))
+ return NULL;
+ SetControl32BitMaximum(_self->ob_itself,
+ newMaximum);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetControl32BitMinimum(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 _rv;
+#ifndef GetControl32BitMinimum
+ PyMac_PRECHECK(GetControl32BitMinimum);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetControl32BitMinimum(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CtlObj_SetControl32BitMinimum(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 newMinimum;
+#ifndef SetControl32BitMinimum
+ PyMac_PRECHECK(SetControl32BitMinimum);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &newMinimum))
+ return NULL;
+ SetControl32BitMinimum(_self->ob_itself,
+ newMinimum);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_IsValidControlHandle(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef IsValidControlHandle
+ PyMac_PRECHECK(IsValidControlHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsValidControlHandle(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *CtlObj_SetControlID(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ControlID inID;
+#ifndef SetControlID
+ PyMac_PRECHECK(SetControlID);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyControlID_Convert, &inID))
+ return NULL;
+ _err = SetControlID(_self->ob_itself,
+ &inID);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetControlID(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ControlID outID;
+#ifndef GetControlID
+ PyMac_PRECHECK(GetControlID);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetControlID(_self->ob_itself,
+ &outID);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyControlID_New, &outID);
+ return _res;
+}
+
+static PyObject *CtlObj_SetControlCommandID(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 inCommandID;
+#ifndef SetControlCommandID
+ PyMac_PRECHECK(SetControlCommandID);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &inCommandID))
+ return NULL;
+ _err = SetControlCommandID(_self->ob_itself,
+ inCommandID);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetControlCommandID(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 outCommandID;
+#ifndef GetControlCommandID
+ PyMac_PRECHECK(GetControlCommandID);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetControlCommandID(_self->ob_itself,
+ &outCommandID);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outCommandID);
+ return _res;
+}
+
+static PyObject *CtlObj_RemoveControlProperty(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ OSType propertyCreator;
+ OSType propertyTag;
+#ifndef RemoveControlProperty
+ PyMac_PRECHECK(RemoveControlProperty);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &propertyCreator,
+ PyMac_GetOSType, &propertyTag))
+ return NULL;
+ _err = RemoveControlProperty(_self->ob_itself,
+ propertyCreator,
+ propertyTag);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetControlPropertyAttributes(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ OSType propertyCreator;
+ OSType propertyTag;
+ UInt32 attributes;
+#ifndef GetControlPropertyAttributes
+ PyMac_PRECHECK(GetControlPropertyAttributes);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &propertyCreator,
+ PyMac_GetOSType, &propertyTag))
+ return NULL;
+ _err = GetControlPropertyAttributes(_self->ob_itself,
+ propertyCreator,
+ propertyTag,
+ &attributes);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ attributes);
+ return _res;
+}
+
+static PyObject *CtlObj_ChangeControlPropertyAttributes(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ OSType propertyCreator;
+ OSType propertyTag;
+ UInt32 attributesToSet;
+ UInt32 attributesToClear;
+#ifndef ChangeControlPropertyAttributes
+ PyMac_PRECHECK(ChangeControlPropertyAttributes);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&ll",
+ PyMac_GetOSType, &propertyCreator,
+ PyMac_GetOSType, &propertyTag,
+ &attributesToSet,
+ &attributesToClear))
+ return NULL;
+ _err = ChangeControlPropertyAttributes(_self->ob_itself,
+ propertyCreator,
+ propertyTag,
+ attributesToSet,
+ attributesToClear);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetControlRegion(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ControlPartCode inPart;
+ RgnHandle outRegion;
+#ifndef GetControlRegion
+ PyMac_PRECHECK(GetControlRegion);
+#endif
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &inPart,
+ ResObj_Convert, &outRegion))
+ return NULL;
+ _err = GetControlRegion(_self->ob_itself,
+ inPart,
+ outRegion);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetControlVariant(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ControlVariant _rv;
+#ifndef GetControlVariant
+ PyMac_PRECHECK(GetControlVariant);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetControlVariant(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *CtlObj_SetControlAction(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PyObject* actionProc;
+ UniversalProcPtr c_callback;
+#ifndef SetControlAction
+ PyMac_PRECHECK(SetControlAction);
+#endif
+ if (!PyArg_ParseTuple(_args, "O",
+ &actionProc))
+ return NULL;
+ SetControlAction(_self->ob_itself,
+ myactionproc_upp);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ setcallback((PyObject*)_self, kMyControlActionProcTag, actionProc, &c_callback);
+ return _res;
+}
+
+static PyObject *CtlObj_SetControlReference(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 data;
+#ifndef SetControlReference
+ PyMac_PRECHECK(SetControlReference);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &data))
+ return NULL;
+ SetControlReference(_self->ob_itself,
+ data);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetControlReference(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 _rv;
+#ifndef GetControlReference
+ PyMac_PRECHECK(GetControlReference);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetControlReference(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CtlObj_EmbedControl(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ControlHandle inContainer;
+#ifndef EmbedControl
+ PyMac_PRECHECK(EmbedControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CtlObj_Convert, &inContainer))
+ return NULL;
+ _err = EmbedControl(_self->ob_itself,
+ inContainer);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_AutoEmbedControl(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ WindowPtr inWindow;
+#ifndef AutoEmbedControl
+ PyMac_PRECHECK(AutoEmbedControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &inWindow))
+ return NULL;
+ _err = AutoEmbedControl(_self->ob_itself,
+ inWindow);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetSuperControl(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ControlHandle outParent;
+#ifndef GetSuperControl
+ PyMac_PRECHECK(GetSuperControl);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetSuperControl(_self->ob_itself,
+ &outParent);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_WhichControl, outParent);
+ return _res;
+}
+
+static PyObject *CtlObj_CountSubControls(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ UInt16 outNumChildren;
+#ifndef CountSubControls
+ PyMac_PRECHECK(CountSubControls);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = CountSubControls(_self->ob_itself,
+ &outNumChildren);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("H",
+ outNumChildren);
+ return _res;
+}
+
+static PyObject *CtlObj_GetIndexedSubControl(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ UInt16 inIndex;
+ ControlHandle outSubControl;
+#ifndef GetIndexedSubControl
+ PyMac_PRECHECK(GetIndexedSubControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "H",
+ &inIndex))
+ return NULL;
+ _err = GetIndexedSubControl(_self->ob_itself,
+ inIndex,
+ &outSubControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_WhichControl, outSubControl);
+ return _res;
+}
+
+static PyObject *CtlObj_SetControlSupervisor(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ControlHandle inBoss;
+#ifndef SetControlSupervisor
+ PyMac_PRECHECK(SetControlSupervisor);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CtlObj_Convert, &inBoss))
+ return NULL;
+ _err = SetControlSupervisor(_self->ob_itself,
+ inBoss);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetControlFeatures(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ UInt32 outFeatures;
+#ifndef GetControlFeatures
+ PyMac_PRECHECK(GetControlFeatures);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetControlFeatures(_self->ob_itself,
+ &outFeatures);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outFeatures);
+ return _res;
+}
+
+static PyObject *CtlObj_GetControlDataSize(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ControlPartCode inPart;
+ ResType inTagName;
+ Size outMaxSize;
+#ifndef GetControlDataSize
+ PyMac_PRECHECK(GetControlDataSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &inPart,
+ PyMac_GetOSType, &inTagName))
+ return NULL;
+ _err = GetControlDataSize(_self->ob_itself,
+ inPart,
+ inTagName,
+ &outMaxSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outMaxSize);
+ return _res;
+}
+
+static PyObject *CtlObj_HandleControlDragTracking(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ DragTrackingMessage inMessage;
+ DragReference inDrag;
+ Boolean outLikesDrag;
+#ifndef HandleControlDragTracking
+ PyMac_PRECHECK(HandleControlDragTracking);
+#endif
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &inMessage,
+ DragObj_Convert, &inDrag))
+ return NULL;
+ _err = HandleControlDragTracking(_self->ob_itself,
+ inMessage,
+ inDrag,
+ &outLikesDrag);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("b",
+ outLikesDrag);
+ return _res;
+}
+
+static PyObject *CtlObj_HandleControlDragReceive(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ DragReference inDrag;
+#ifndef HandleControlDragReceive
+ PyMac_PRECHECK(HandleControlDragReceive);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ DragObj_Convert, &inDrag))
+ return NULL;
+ _err = HandleControlDragReceive(_self->ob_itself,
+ inDrag);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_SetControlDragTrackingEnabled(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Boolean inTracks;
+#ifndef SetControlDragTrackingEnabled
+ PyMac_PRECHECK(SetControlDragTrackingEnabled);
+#endif
+ if (!PyArg_ParseTuple(_args, "b",
+ &inTracks))
+ return NULL;
+ _err = SetControlDragTrackingEnabled(_self->ob_itself,
+ inTracks);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_IsControlDragTrackingEnabled(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Boolean outTracks;
+#ifndef IsControlDragTrackingEnabled
+ PyMac_PRECHECK(IsControlDragTrackingEnabled);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = IsControlDragTrackingEnabled(_self->ob_itself,
+ &outTracks);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("b",
+ outTracks);
+ return _res;
+}
+
+static PyObject *CtlObj_GetControlBounds(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect bounds;
+#ifndef GetControlBounds
+ PyMac_PRECHECK(GetControlBounds);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetControlBounds(_self->ob_itself,
+ &bounds);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &bounds);
+ return _res;
+}
+
+static PyObject *CtlObj_IsControlHilited(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef IsControlHilited
+ PyMac_PRECHECK(IsControlHilited);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsControlHilited(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *CtlObj_GetControlHilite(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UInt16 _rv;
+#ifndef GetControlHilite
+ PyMac_PRECHECK(GetControlHilite);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetControlHilite(_self->ob_itself);
+ _res = Py_BuildValue("H",
+ _rv);
+ return _res;
+}
+
+static PyObject *CtlObj_GetControlOwner(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr _rv;
+#ifndef GetControlOwner
+ PyMac_PRECHECK(GetControlOwner);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetControlOwner(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ WinObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CtlObj_GetControlDataHandle(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+#ifndef GetControlDataHandle
+ PyMac_PRECHECK(GetControlDataHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetControlDataHandle(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CtlObj_GetControlPopupMenuHandle(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuHandle _rv;
+#ifndef GetControlPopupMenuHandle
+ PyMac_PRECHECK(GetControlPopupMenuHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetControlPopupMenuHandle(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ MenuObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CtlObj_GetControlPopupMenuID(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+#ifndef GetControlPopupMenuID
+ PyMac_PRECHECK(GetControlPopupMenuID);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetControlPopupMenuID(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *CtlObj_SetControlDataHandle(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle dataHandle;
+#ifndef SetControlDataHandle
+ PyMac_PRECHECK(SetControlDataHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &dataHandle))
+ return NULL;
+ SetControlDataHandle(_self->ob_itself,
+ dataHandle);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_SetControlBounds(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect bounds;
+#ifndef SetControlBounds
+ PyMac_PRECHECK(SetControlBounds);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &bounds))
+ return NULL;
+ SetControlBounds(_self->ob_itself,
+ &bounds);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_SetControlPopupMenuHandle(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuHandle popupMenu;
+#ifndef SetControlPopupMenuHandle
+ PyMac_PRECHECK(SetControlPopupMenuHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ MenuObj_Convert, &popupMenu))
+ return NULL;
+ SetControlPopupMenuHandle(_self->ob_itself,
+ popupMenu);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_SetControlPopupMenuID(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short menuID;
+#ifndef SetControlPopupMenuID
+ PyMac_PRECHECK(SetControlPopupMenuID);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &menuID))
+ return NULL;
+ SetControlPopupMenuID(_self->ob_itself,
+ menuID);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetBevelButtonMenuValue(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ UInt16 outValue;
+#ifndef GetBevelButtonMenuValue
+ PyMac_PRECHECK(GetBevelButtonMenuValue);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetBevelButtonMenuValue(_self->ob_itself,
+ &outValue);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ outValue);
+ return _res;
+}
+
+static PyObject *CtlObj_SetBevelButtonMenuValue(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inValue;
+#ifndef SetBevelButtonMenuValue
+ PyMac_PRECHECK(SetBevelButtonMenuValue);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &inValue))
+ return NULL;
+ _err = SetBevelButtonMenuValue(_self->ob_itself,
+ inValue);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetBevelButtonMenuHandle(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ MenuHandle outHandle;
+#ifndef GetBevelButtonMenuHandle
+ PyMac_PRECHECK(GetBevelButtonMenuHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetBevelButtonMenuHandle(_self->ob_itself,
+ &outHandle);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ MenuObj_New, outHandle);
+ return _res;
+}
+
+static PyObject *CtlObj_SetBevelButtonContentInfo(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ControlButtonContentInfo inContent;
+#ifndef SetBevelButtonContentInfo
+ PyMac_PRECHECK(SetBevelButtonContentInfo);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ControlButtonContentInfo_Convert, &inContent))
+ return NULL;
+ _err = SetBevelButtonContentInfo(_self->ob_itself,
+ &inContent);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_SetBevelButtonTransform(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconTransformType transform;
+#ifndef SetBevelButtonTransform
+ PyMac_PRECHECK(SetBevelButtonTransform);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &transform))
+ return NULL;
+ _err = SetBevelButtonTransform(_self->ob_itself,
+ transform);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_SetDisclosureTriangleLastValue(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inValue;
+#ifndef SetDisclosureTriangleLastValue
+ PyMac_PRECHECK(SetDisclosureTriangleLastValue);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &inValue))
+ return NULL;
+ _err = SetDisclosureTriangleLastValue(_self->ob_itself,
+ inValue);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetTabContentRect(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Rect outContentRect;
+#ifndef GetTabContentRect
+ PyMac_PRECHECK(GetTabContentRect);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetTabContentRect(_self->ob_itself,
+ &outContentRect);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &outContentRect);
+ return _res;
+}
+
+static PyObject *CtlObj_SetTabEnabled(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inTabToHilite;
+ Boolean inEnabled;
+#ifndef SetTabEnabled
+ PyMac_PRECHECK(SetTabEnabled);
+#endif
+ if (!PyArg_ParseTuple(_args, "hb",
+ &inTabToHilite,
+ &inEnabled))
+ return NULL;
+ _err = SetTabEnabled(_self->ob_itself,
+ inTabToHilite,
+ inEnabled);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_SetImageWellContentInfo(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ControlButtonContentInfo inContent;
+#ifndef SetImageWellContentInfo
+ PyMac_PRECHECK(SetImageWellContentInfo);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ControlButtonContentInfo_Convert, &inContent))
+ return NULL;
+ _err = SetImageWellContentInfo(_self->ob_itself,
+ &inContent);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_SetImageWellTransform(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconTransformType inTransform;
+#ifndef SetImageWellTransform
+ PyMac_PRECHECK(SetImageWellTransform);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &inTransform))
+ return NULL;
+ _err = SetImageWellTransform(_self->ob_itself,
+ inTransform);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetDataBrowserViewStyle(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ OSType style;
+#ifndef GetDataBrowserViewStyle
+ PyMac_PRECHECK(GetDataBrowserViewStyle);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetDataBrowserViewStyle(_self->ob_itself,
+ &style);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildOSType, style);
+ return _res;
+}
+
+static PyObject *CtlObj_SetDataBrowserViewStyle(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ OSType style;
+#ifndef SetDataBrowserViewStyle
+ PyMac_PRECHECK(SetDataBrowserViewStyle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &style))
+ return NULL;
+ _err = SetDataBrowserViewStyle(_self->ob_itself,
+ style);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_EnableDataBrowserEditCommand(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ UInt32 command;
+#ifndef EnableDataBrowserEditCommand
+ PyMac_PRECHECK(EnableDataBrowserEditCommand);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &command))
+ return NULL;
+ _rv = EnableDataBrowserEditCommand(_self->ob_itself,
+ command);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *CtlObj_ExecuteDataBrowserEditCommand(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 command;
+#ifndef ExecuteDataBrowserEditCommand
+ PyMac_PRECHECK(ExecuteDataBrowserEditCommand);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &command))
+ return NULL;
+ _err = ExecuteDataBrowserEditCommand(_self->ob_itself,
+ command);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetDataBrowserSelectionAnchor(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 first;
+ UInt32 last;
+#ifndef GetDataBrowserSelectionAnchor
+ PyMac_PRECHECK(GetDataBrowserSelectionAnchor);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetDataBrowserSelectionAnchor(_self->ob_itself,
+ &first,
+ &last);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("ll",
+ first,
+ last);
+ return _res;
+}
+
+static PyObject *CtlObj_MoveDataBrowserSelectionAnchor(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 direction;
+ Boolean extendSelection;
+#ifndef MoveDataBrowserSelectionAnchor
+ PyMac_PRECHECK(MoveDataBrowserSelectionAnchor);
+#endif
+ if (!PyArg_ParseTuple(_args, "lb",
+ &direction,
+ &extendSelection))
+ return NULL;
+ _err = MoveDataBrowserSelectionAnchor(_self->ob_itself,
+ direction,
+ extendSelection);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_OpenDataBrowserContainer(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 container;
+#ifndef OpenDataBrowserContainer
+ PyMac_PRECHECK(OpenDataBrowserContainer);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &container))
+ return NULL;
+ _err = OpenDataBrowserContainer(_self->ob_itself,
+ container);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_CloseDataBrowserContainer(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 container;
+#ifndef CloseDataBrowserContainer
+ PyMac_PRECHECK(CloseDataBrowserContainer);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &container))
+ return NULL;
+ _err = CloseDataBrowserContainer(_self->ob_itself,
+ container);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_SortDataBrowserContainer(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 container;
+ Boolean sortChildren;
+#ifndef SortDataBrowserContainer
+ PyMac_PRECHECK(SortDataBrowserContainer);
+#endif
+ if (!PyArg_ParseTuple(_args, "lb",
+ &container,
+ &sortChildren))
+ return NULL;
+ _err = SortDataBrowserContainer(_self->ob_itself,
+ container,
+ sortChildren);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetDataBrowserItems(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 container;
+ Boolean recurse;
+ UInt32 state;
+ Handle items;
+#ifndef GetDataBrowserItems
+ PyMac_PRECHECK(GetDataBrowserItems);
+#endif
+ if (!PyArg_ParseTuple(_args, "lblO&",
+ &container,
+ &recurse,
+ &state,
+ ResObj_Convert, &items))
+ return NULL;
+ _err = GetDataBrowserItems(_self->ob_itself,
+ container,
+ recurse,
+ state,
+ items);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetDataBrowserItemCount(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 container;
+ Boolean recurse;
+ UInt32 state;
+ UInt32 numItems;
+#ifndef GetDataBrowserItemCount
+ PyMac_PRECHECK(GetDataBrowserItemCount);
+#endif
+ if (!PyArg_ParseTuple(_args, "lbl",
+ &container,
+ &recurse,
+ &state))
+ return NULL;
+ _err = GetDataBrowserItemCount(_self->ob_itself,
+ container,
+ recurse,
+ state,
+ &numItems);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ numItems);
+ return _res;
+}
+
+static PyObject *CtlObj_IsDataBrowserItemSelected(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ UInt32 item;
+#ifndef IsDataBrowserItemSelected
+ PyMac_PRECHECK(IsDataBrowserItemSelected);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &item))
+ return NULL;
+ _rv = IsDataBrowserItemSelected(_self->ob_itself,
+ item);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *CtlObj_GetDataBrowserItemState(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 item;
+ UInt32 state;
+#ifndef GetDataBrowserItemState
+ PyMac_PRECHECK(GetDataBrowserItemState);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &item))
+ return NULL;
+ _err = GetDataBrowserItemState(_self->ob_itself,
+ item,
+ &state);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ state);
+ return _res;
+}
+
+static PyObject *CtlObj_RevealDataBrowserItem(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 item;
+ UInt32 propertyID;
+ UInt8 options;
+#ifndef RevealDataBrowserItem
+ PyMac_PRECHECK(RevealDataBrowserItem);
+#endif
+ if (!PyArg_ParseTuple(_args, "llb",
+ &item,
+ &propertyID,
+ &options))
+ return NULL;
+ _err = RevealDataBrowserItem(_self->ob_itself,
+ item,
+ propertyID,
+ options);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_SetDataBrowserActiveItems(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Boolean active;
+#ifndef SetDataBrowserActiveItems
+ PyMac_PRECHECK(SetDataBrowserActiveItems);
+#endif
+ if (!PyArg_ParseTuple(_args, "b",
+ &active))
+ return NULL;
+ _err = SetDataBrowserActiveItems(_self->ob_itself,
+ active);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetDataBrowserActiveItems(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Boolean active;
+#ifndef GetDataBrowserActiveItems
+ PyMac_PRECHECK(GetDataBrowserActiveItems);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetDataBrowserActiveItems(_self->ob_itself,
+ &active);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("b",
+ active);
+ return _res;
+}
+
+static PyObject *CtlObj_SetDataBrowserScrollBarInset(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect insetRect;
+#ifndef SetDataBrowserScrollBarInset
+ PyMac_PRECHECK(SetDataBrowserScrollBarInset);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = SetDataBrowserScrollBarInset(_self->ob_itself,
+ &insetRect);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &insetRect);
+ return _res;
+}
+
+static PyObject *CtlObj_GetDataBrowserScrollBarInset(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect insetRect;
+#ifndef GetDataBrowserScrollBarInset
+ PyMac_PRECHECK(GetDataBrowserScrollBarInset);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetDataBrowserScrollBarInset(_self->ob_itself,
+ &insetRect);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &insetRect);
+ return _res;
+}
+
+static PyObject *CtlObj_SetDataBrowserTarget(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 target;
+#ifndef SetDataBrowserTarget
+ PyMac_PRECHECK(SetDataBrowserTarget);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &target))
+ return NULL;
+ _err = SetDataBrowserTarget(_self->ob_itself,
+ target);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetDataBrowserTarget(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 target;
+#ifndef GetDataBrowserTarget
+ PyMac_PRECHECK(GetDataBrowserTarget);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetDataBrowserTarget(_self->ob_itself,
+ &target);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ target);
+ return _res;
+}
+
+static PyObject *CtlObj_SetDataBrowserSortOrder(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt16 order;
+#ifndef SetDataBrowserSortOrder
+ PyMac_PRECHECK(SetDataBrowserSortOrder);
+#endif
+ if (!PyArg_ParseTuple(_args, "H",
+ &order))
+ return NULL;
+ _err = SetDataBrowserSortOrder(_self->ob_itself,
+ order);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetDataBrowserSortOrder(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt16 order;
+#ifndef GetDataBrowserSortOrder
+ PyMac_PRECHECK(GetDataBrowserSortOrder);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetDataBrowserSortOrder(_self->ob_itself,
+ &order);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("H",
+ order);
+ return _res;
+}
+
+static PyObject *CtlObj_SetDataBrowserScrollPosition(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 top;
+ UInt32 left;
+#ifndef SetDataBrowserScrollPosition
+ PyMac_PRECHECK(SetDataBrowserScrollPosition);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &top,
+ &left))
+ return NULL;
+ _err = SetDataBrowserScrollPosition(_self->ob_itself,
+ top,
+ left);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetDataBrowserScrollPosition(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 top;
+ UInt32 left;
+#ifndef GetDataBrowserScrollPosition
+ PyMac_PRECHECK(GetDataBrowserScrollPosition);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetDataBrowserScrollPosition(_self->ob_itself,
+ &top,
+ &left);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("ll",
+ top,
+ left);
+ return _res;
+}
+
+static PyObject *CtlObj_SetDataBrowserHasScrollBars(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Boolean horiz;
+ Boolean vert;
+#ifndef SetDataBrowserHasScrollBars
+ PyMac_PRECHECK(SetDataBrowserHasScrollBars);
+#endif
+ if (!PyArg_ParseTuple(_args, "bb",
+ &horiz,
+ &vert))
+ return NULL;
+ _err = SetDataBrowserHasScrollBars(_self->ob_itself,
+ horiz,
+ vert);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetDataBrowserHasScrollBars(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Boolean horiz;
+ Boolean vert;
+#ifndef GetDataBrowserHasScrollBars
+ PyMac_PRECHECK(GetDataBrowserHasScrollBars);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetDataBrowserHasScrollBars(_self->ob_itself,
+ &horiz,
+ &vert);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("bb",
+ horiz,
+ vert);
+ return _res;
+}
+
+static PyObject *CtlObj_SetDataBrowserSortProperty(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 property;
+#ifndef SetDataBrowserSortProperty
+ PyMac_PRECHECK(SetDataBrowserSortProperty);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &property))
+ return NULL;
+ _err = SetDataBrowserSortProperty(_self->ob_itself,
+ property);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetDataBrowserSortProperty(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 property;
+#ifndef GetDataBrowserSortProperty
+ PyMac_PRECHECK(GetDataBrowserSortProperty);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetDataBrowserSortProperty(_self->ob_itself,
+ &property);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ property);
+ return _res;
+}
+
+static PyObject *CtlObj_SetDataBrowserSelectionFlags(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 selectionFlags;
+#ifndef SetDataBrowserSelectionFlags
+ PyMac_PRECHECK(SetDataBrowserSelectionFlags);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &selectionFlags))
+ return NULL;
+ _err = SetDataBrowserSelectionFlags(_self->ob_itself,
+ selectionFlags);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetDataBrowserSelectionFlags(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 selectionFlags;
+#ifndef GetDataBrowserSelectionFlags
+ PyMac_PRECHECK(GetDataBrowserSelectionFlags);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetDataBrowserSelectionFlags(_self->ob_itself,
+ &selectionFlags);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ selectionFlags);
+ return _res;
+}
+
+static PyObject *CtlObj_SetDataBrowserPropertyFlags(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 property;
+ UInt32 flags;
+#ifndef SetDataBrowserPropertyFlags
+ PyMac_PRECHECK(SetDataBrowserPropertyFlags);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &property,
+ &flags))
+ return NULL;
+ _err = SetDataBrowserPropertyFlags(_self->ob_itself,
+ property,
+ flags);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetDataBrowserPropertyFlags(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 property;
+ UInt32 flags;
+#ifndef GetDataBrowserPropertyFlags
+ PyMac_PRECHECK(GetDataBrowserPropertyFlags);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &property))
+ return NULL;
+ _err = GetDataBrowserPropertyFlags(_self->ob_itself,
+ property,
+ &flags);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ flags);
+ return _res;
+}
+
+static PyObject *CtlObj_SetDataBrowserEditText(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ CFStringRef text;
+#ifndef SetDataBrowserEditText
+ PyMac_PRECHECK(SetDataBrowserEditText);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFStringRefObj_Convert, &text))
+ return NULL;
+ _err = SetDataBrowserEditText(_self->ob_itself,
+ text);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_CopyDataBrowserEditText(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ CFStringRef text;
+#ifndef CopyDataBrowserEditText
+ PyMac_PRECHECK(CopyDataBrowserEditText);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = CopyDataBrowserEditText(_self->ob_itself,
+ &text);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, text);
+ return _res;
+}
+
+static PyObject *CtlObj_GetDataBrowserEditText(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ CFMutableStringRef text;
+#ifndef GetDataBrowserEditText
+ PyMac_PRECHECK(GetDataBrowserEditText);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFMutableStringRefObj_Convert, &text))
+ return NULL;
+ _err = GetDataBrowserEditText(_self->ob_itself,
+ text);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_SetDataBrowserEditItem(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 item;
+ UInt32 property;
+#ifndef SetDataBrowserEditItem
+ PyMac_PRECHECK(SetDataBrowserEditItem);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &item,
+ &property))
+ return NULL;
+ _err = SetDataBrowserEditItem(_self->ob_itself,
+ item,
+ property);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetDataBrowserEditItem(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 item;
+ UInt32 property;
+#ifndef GetDataBrowserEditItem
+ PyMac_PRECHECK(GetDataBrowserEditItem);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetDataBrowserEditItem(_self->ob_itself,
+ &item,
+ &property);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("ll",
+ item,
+ property);
+ return _res;
+}
+
+static PyObject *CtlObj_GetDataBrowserItemPartBounds(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 item;
+ UInt32 property;
+ OSType part;
+ Rect bounds;
+#ifndef GetDataBrowserItemPartBounds
+ PyMac_PRECHECK(GetDataBrowserItemPartBounds);
+#endif
+ if (!PyArg_ParseTuple(_args, "llO&",
+ &item,
+ &property,
+ PyMac_GetOSType, &part))
+ return NULL;
+ _err = GetDataBrowserItemPartBounds(_self->ob_itself,
+ item,
+ property,
+ part,
+ &bounds);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &bounds);
+ return _res;
+}
+
+static PyObject *CtlObj_RemoveDataBrowserTableViewColumn(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 column;
+#ifndef RemoveDataBrowserTableViewColumn
+ PyMac_PRECHECK(RemoveDataBrowserTableViewColumn);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &column))
+ return NULL;
+ _err = RemoveDataBrowserTableViewColumn(_self->ob_itself,
+ column);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetDataBrowserTableViewColumnCount(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 numColumns;
+#ifndef GetDataBrowserTableViewColumnCount
+ PyMac_PRECHECK(GetDataBrowserTableViewColumnCount);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetDataBrowserTableViewColumnCount(_self->ob_itself,
+ &numColumns);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ numColumns);
+ return _res;
+}
+
+static PyObject *CtlObj_SetDataBrowserTableViewHiliteStyle(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 hiliteStyle;
+#ifndef SetDataBrowserTableViewHiliteStyle
+ PyMac_PRECHECK(SetDataBrowserTableViewHiliteStyle);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &hiliteStyle))
+ return NULL;
+ _err = SetDataBrowserTableViewHiliteStyle(_self->ob_itself,
+ hiliteStyle);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetDataBrowserTableViewHiliteStyle(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 hiliteStyle;
+#ifndef GetDataBrowserTableViewHiliteStyle
+ PyMac_PRECHECK(GetDataBrowserTableViewHiliteStyle);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetDataBrowserTableViewHiliteStyle(_self->ob_itself,
+ &hiliteStyle);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ hiliteStyle);
+ return _res;
+}
+
+static PyObject *CtlObj_SetDataBrowserTableViewRowHeight(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt16 height;
+#ifndef SetDataBrowserTableViewRowHeight
+ PyMac_PRECHECK(SetDataBrowserTableViewRowHeight);
+#endif
+ if (!PyArg_ParseTuple(_args, "H",
+ &height))
+ return NULL;
+ _err = SetDataBrowserTableViewRowHeight(_self->ob_itself,
+ height);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetDataBrowserTableViewRowHeight(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt16 height;
+#ifndef GetDataBrowserTableViewRowHeight
+ PyMac_PRECHECK(GetDataBrowserTableViewRowHeight);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetDataBrowserTableViewRowHeight(_self->ob_itself,
+ &height);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("H",
+ height);
+ return _res;
+}
+
+static PyObject *CtlObj_SetDataBrowserTableViewColumnWidth(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt16 width;
+#ifndef SetDataBrowserTableViewColumnWidth
+ PyMac_PRECHECK(SetDataBrowserTableViewColumnWidth);
+#endif
+ if (!PyArg_ParseTuple(_args, "H",
+ &width))
+ return NULL;
+ _err = SetDataBrowserTableViewColumnWidth(_self->ob_itself,
+ width);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetDataBrowserTableViewColumnWidth(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt16 width;
+#ifndef GetDataBrowserTableViewColumnWidth
+ PyMac_PRECHECK(GetDataBrowserTableViewColumnWidth);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetDataBrowserTableViewColumnWidth(_self->ob_itself,
+ &width);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("H",
+ width);
+ return _res;
+}
+
+static PyObject *CtlObj_SetDataBrowserTableViewItemRowHeight(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 item;
+ UInt16 height;
+#ifndef SetDataBrowserTableViewItemRowHeight
+ PyMac_PRECHECK(SetDataBrowserTableViewItemRowHeight);
+#endif
+ if (!PyArg_ParseTuple(_args, "lH",
+ &item,
+ &height))
+ return NULL;
+ _err = SetDataBrowserTableViewItemRowHeight(_self->ob_itself,
+ item,
+ height);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetDataBrowserTableViewItemRowHeight(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 item;
+ UInt16 height;
+#ifndef GetDataBrowserTableViewItemRowHeight
+ PyMac_PRECHECK(GetDataBrowserTableViewItemRowHeight);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &item))
+ return NULL;
+ _err = GetDataBrowserTableViewItemRowHeight(_self->ob_itself,
+ item,
+ &height);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("H",
+ height);
+ return _res;
+}
+
+static PyObject *CtlObj_SetDataBrowserTableViewNamedColumnWidth(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 column;
+ UInt16 width;
+#ifndef SetDataBrowserTableViewNamedColumnWidth
+ PyMac_PRECHECK(SetDataBrowserTableViewNamedColumnWidth);
+#endif
+ if (!PyArg_ParseTuple(_args, "lH",
+ &column,
+ &width))
+ return NULL;
+ _err = SetDataBrowserTableViewNamedColumnWidth(_self->ob_itself,
+ column,
+ width);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetDataBrowserTableViewNamedColumnWidth(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 column;
+ UInt16 width;
+#ifndef GetDataBrowserTableViewNamedColumnWidth
+ PyMac_PRECHECK(GetDataBrowserTableViewNamedColumnWidth);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &column))
+ return NULL;
+ _err = GetDataBrowserTableViewNamedColumnWidth(_self->ob_itself,
+ column,
+ &width);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("H",
+ width);
+ return _res;
+}
+
+static PyObject *CtlObj_SetDataBrowserTableViewGeometry(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Boolean variableWidthColumns;
+ Boolean variableHeightRows;
+#ifndef SetDataBrowserTableViewGeometry
+ PyMac_PRECHECK(SetDataBrowserTableViewGeometry);
+#endif
+ if (!PyArg_ParseTuple(_args, "bb",
+ &variableWidthColumns,
+ &variableHeightRows))
+ return NULL;
+ _err = SetDataBrowserTableViewGeometry(_self->ob_itself,
+ variableWidthColumns,
+ variableHeightRows);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetDataBrowserTableViewGeometry(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Boolean variableWidthColumns;
+ Boolean variableHeightRows;
+#ifndef GetDataBrowserTableViewGeometry
+ PyMac_PRECHECK(GetDataBrowserTableViewGeometry);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetDataBrowserTableViewGeometry(_self->ob_itself,
+ &variableWidthColumns,
+ &variableHeightRows);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("bb",
+ variableWidthColumns,
+ variableHeightRows);
+ return _res;
+}
+
+static PyObject *CtlObj_GetDataBrowserTableViewItemID(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 row;
+ UInt32 item;
+#ifndef GetDataBrowserTableViewItemID
+ PyMac_PRECHECK(GetDataBrowserTableViewItemID);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &row))
+ return NULL;
+ _err = GetDataBrowserTableViewItemID(_self->ob_itself,
+ row,
+ &item);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ item);
+ return _res;
+}
+
+static PyObject *CtlObj_SetDataBrowserTableViewItemRow(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 item;
+ UInt32 row;
+#ifndef SetDataBrowserTableViewItemRow
+ PyMac_PRECHECK(SetDataBrowserTableViewItemRow);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &item,
+ &row))
+ return NULL;
+ _err = SetDataBrowserTableViewItemRow(_self->ob_itself,
+ item,
+ row);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetDataBrowserTableViewItemRow(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 item;
+ UInt32 row;
+#ifndef GetDataBrowserTableViewItemRow
+ PyMac_PRECHECK(GetDataBrowserTableViewItemRow);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &item))
+ return NULL;
+ _err = GetDataBrowserTableViewItemRow(_self->ob_itself,
+ item,
+ &row);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ row);
+ return _res;
+}
+
+static PyObject *CtlObj_SetDataBrowserTableViewColumnPosition(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 column;
+ UInt32 position;
+#ifndef SetDataBrowserTableViewColumnPosition
+ PyMac_PRECHECK(SetDataBrowserTableViewColumnPosition);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &column,
+ &position))
+ return NULL;
+ _err = SetDataBrowserTableViewColumnPosition(_self->ob_itself,
+ column,
+ position);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetDataBrowserTableViewColumnPosition(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 column;
+ UInt32 position;
+#ifndef GetDataBrowserTableViewColumnPosition
+ PyMac_PRECHECK(GetDataBrowserTableViewColumnPosition);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &column))
+ return NULL;
+ _err = GetDataBrowserTableViewColumnPosition(_self->ob_itself,
+ column,
+ &position);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ position);
+ return _res;
+}
+
+static PyObject *CtlObj_GetDataBrowserTableViewColumnProperty(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 column;
+ UInt32 property;
+#ifndef GetDataBrowserTableViewColumnProperty
+ PyMac_PRECHECK(GetDataBrowserTableViewColumnProperty);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &column))
+ return NULL;
+ _err = GetDataBrowserTableViewColumnProperty(_self->ob_itself,
+ column,
+ &property);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ property);
+ return _res;
+}
+
+static PyObject *CtlObj_AutoSizeDataBrowserListViewColumns(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+#ifndef AutoSizeDataBrowserListViewColumns
+ PyMac_PRECHECK(AutoSizeDataBrowserListViewColumns);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = AutoSizeDataBrowserListViewColumns(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_AddDataBrowserListViewColumn(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ DataBrowserListViewColumnDesc columnDesc;
+ UInt32 position;
+#ifndef AddDataBrowserListViewColumn
+ PyMac_PRECHECK(AddDataBrowserListViewColumn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ DataBrowserListViewColumnDesc_Convert, &columnDesc,
+ &position))
+ return NULL;
+ _err = AddDataBrowserListViewColumn(_self->ob_itself,
+ &columnDesc,
+ position);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_SetDataBrowserListViewHeaderBtnHeight(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt16 height;
+#ifndef SetDataBrowserListViewHeaderBtnHeight
+ PyMac_PRECHECK(SetDataBrowserListViewHeaderBtnHeight);
+#endif
+ if (!PyArg_ParseTuple(_args, "H",
+ &height))
+ return NULL;
+ _err = SetDataBrowserListViewHeaderBtnHeight(_self->ob_itself,
+ height);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetDataBrowserListViewHeaderBtnHeight(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt16 height;
+#ifndef GetDataBrowserListViewHeaderBtnHeight
+ PyMac_PRECHECK(GetDataBrowserListViewHeaderBtnHeight);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetDataBrowserListViewHeaderBtnHeight(_self->ob_itself,
+ &height);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("H",
+ height);
+ return _res;
+}
+
+static PyObject *CtlObj_SetDataBrowserListViewUsePlainBackground(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Boolean usePlainBackground;
+#ifndef SetDataBrowserListViewUsePlainBackground
+ PyMac_PRECHECK(SetDataBrowserListViewUsePlainBackground);
+#endif
+ if (!PyArg_ParseTuple(_args, "b",
+ &usePlainBackground))
+ return NULL;
+ _err = SetDataBrowserListViewUsePlainBackground(_self->ob_itself,
+ usePlainBackground);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetDataBrowserListViewUsePlainBackground(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Boolean usePlainBackground;
+#ifndef GetDataBrowserListViewUsePlainBackground
+ PyMac_PRECHECK(GetDataBrowserListViewUsePlainBackground);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetDataBrowserListViewUsePlainBackground(_self->ob_itself,
+ &usePlainBackground);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("b",
+ usePlainBackground);
+ return _res;
+}
+
+static PyObject *CtlObj_SetDataBrowserListViewDisclosureColumn(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 column;
+ Boolean expandableRows;
+#ifndef SetDataBrowserListViewDisclosureColumn
+ PyMac_PRECHECK(SetDataBrowserListViewDisclosureColumn);
+#endif
+ if (!PyArg_ParseTuple(_args, "lb",
+ &column,
+ &expandableRows))
+ return NULL;
+ _err = SetDataBrowserListViewDisclosureColumn(_self->ob_itself,
+ column,
+ expandableRows);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetDataBrowserListViewDisclosureColumn(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 column;
+ Boolean expandableRows;
+#ifndef GetDataBrowserListViewDisclosureColumn
+ PyMac_PRECHECK(GetDataBrowserListViewDisclosureColumn);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetDataBrowserListViewDisclosureColumn(_self->ob_itself,
+ &column,
+ &expandableRows);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("lb",
+ column,
+ expandableRows);
+ return _res;
+}
+
+static PyObject *CtlObj_GetDataBrowserColumnViewPath(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Handle path;
+#ifndef GetDataBrowserColumnViewPath
+ PyMac_PRECHECK(GetDataBrowserColumnViewPath);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &path))
+ return NULL;
+ _err = GetDataBrowserColumnViewPath(_self->ob_itself,
+ path);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetDataBrowserColumnViewPathLength(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 pathLength;
+#ifndef GetDataBrowserColumnViewPathLength
+ PyMac_PRECHECK(GetDataBrowserColumnViewPathLength);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetDataBrowserColumnViewPathLength(_self->ob_itself,
+ &pathLength);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ pathLength);
+ return _res;
+}
+
+static PyObject *CtlObj_SetDataBrowserColumnViewDisplayType(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ OSType propertyType;
+#ifndef SetDataBrowserColumnViewDisplayType
+ PyMac_PRECHECK(SetDataBrowserColumnViewDisplayType);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &propertyType))
+ return NULL;
+ _err = SetDataBrowserColumnViewDisplayType(_self->ob_itself,
+ propertyType);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetDataBrowserColumnViewDisplayType(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ OSType propertyType;
+#ifndef GetDataBrowserColumnViewDisplayType
+ PyMac_PRECHECK(GetDataBrowserColumnViewDisplayType);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetDataBrowserColumnViewDisplayType(_self->ob_itself,
+ &propertyType);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildOSType, propertyType);
+ return _res;
+}
+
+static PyObject *CtlObj_as_Resource(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+#ifndef as_Resource
+ PyMac_PRECHECK(as_Resource);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = as_Resource(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CtlObj_GetControlRect(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect rect;
+#ifndef GetControlRect
+ PyMac_PRECHECK(GetControlRect);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetControlRect(_self->ob_itself,
+ &rect);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &rect);
+ return _res;
+}
+
+static PyObject *CtlObj_DisposeControl(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ if ( _self->ob_itself ) {
+ SetControlReference(_self->ob_itself, (long)0); /* Make it forget about us */
+ DisposeControl(_self->ob_itself);
+ _self->ob_itself = NULL;
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+
+}
+
+static PyObject *CtlObj_TrackControl(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ ControlPartCode _rv;
+ Point startPoint;
+ ControlActionUPP upp = 0;
+ PyObject *callback = 0;
+
+ if (!PyArg_ParseTuple(_args, "O&|O",
+ PyMac_GetPoint, &startPoint, &callback))
+ return NULL;
+ if (callback && callback != Py_None) {
+ if (PyInt_Check(callback) && PyInt_AS_LONG(callback) == -1)
+ upp = (ControlActionUPP)-1;
+ else {
+ settrackfunc(callback);
+ upp = mytracker_upp;
+ }
+ }
+ _rv = TrackControl(_self->ob_itself,
+ startPoint,
+ upp);
+ clrtrackfunc();
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+
+}
+
+static PyObject *CtlObj_HandleControlClick(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ ControlPartCode _rv;
+ Point startPoint;
+ SInt16 modifiers;
+ ControlActionUPP upp = 0;
+ PyObject *callback = 0;
+
+ if (!PyArg_ParseTuple(_args, "O&h|O",
+ PyMac_GetPoint, &startPoint,
+ &modifiers,
+ &callback))
+ return NULL;
+ if (callback && callback != Py_None) {
+ if (PyInt_Check(callback) && PyInt_AS_LONG(callback) == -1)
+ upp = (ControlActionUPP)-1;
+ else {
+ settrackfunc(callback);
+ upp = mytracker_upp;
+ }
+ }
+ _rv = HandleControlClick(_self->ob_itself,
+ startPoint,
+ modifiers,
+ upp);
+ clrtrackfunc();
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+
+}
+
+static PyObject *CtlObj_SetControlData(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ OSErr _err;
+ ControlPartCode inPart;
+ ResType inTagName;
+ Size bufferSize;
+ Ptr buffer;
+
+ if (!PyArg_ParseTuple(_args, "hO&s#",
+ &inPart,
+ PyMac_GetOSType, &inTagName,
+ &buffer, &bufferSize))
+ return NULL;
+
+ _err = SetControlData(_self->ob_itself,
+ inPart,
+ inTagName,
+ bufferSize,
+ buffer);
+
+ if (_err != noErr)
+ return PyMac_Error(_err);
+ _res = Py_None;
+ return _res;
+
+}
+
+static PyObject *CtlObj_GetControlData(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ OSErr _err;
+ ControlPartCode inPart;
+ ResType inTagName;
+ Size bufferSize;
+ Ptr buffer;
+ Size outSize;
+
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &inPart,
+ PyMac_GetOSType, &inTagName))
+ return NULL;
+
+ /* allocate a buffer for the data */
+ _err = GetControlDataSize(_self->ob_itself,
+ inPart,
+ inTagName,
+ &bufferSize);
+ if (_err != noErr)
+ return PyMac_Error(_err);
+ buffer = PyMem_NEW(char, bufferSize);
+ if (buffer == NULL)
+ return PyErr_NoMemory();
+
+ _err = GetControlData(_self->ob_itself,
+ inPart,
+ inTagName,
+ bufferSize,
+ buffer,
+ &outSize);
+
+ if (_err != noErr) {
+ PyMem_DEL(buffer);
+ return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("s#", buffer, outSize);
+ PyMem_DEL(buffer);
+ return _res;
+
+}
+
+static PyObject *CtlObj_SetControlData_Handle(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ OSErr _err;
+ ControlPartCode inPart;
+ ResType inTagName;
+ Handle buffer;
+
+ if (!PyArg_ParseTuple(_args, "hO&O&",
+ &inPart,
+ PyMac_GetOSType, &inTagName,
+ OptResObj_Convert, &buffer))
+ return NULL;
+
+ _err = SetControlData(_self->ob_itself,
+ inPart,
+ inTagName,
+ sizeof(buffer),
+ (Ptr)&buffer);
+
+ if (_err != noErr)
+ return PyMac_Error(_err);
+ _res = Py_None;
+ return _res;
+
+}
+
+static PyObject *CtlObj_GetControlData_Handle(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ OSErr _err;
+ ControlPartCode inPart;
+ ResType inTagName;
+ Size bufferSize;
+ Handle hdl;
+
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &inPart,
+ PyMac_GetOSType, &inTagName))
+ return NULL;
+
+ /* Check it is handle-sized */
+ _err = GetControlDataSize(_self->ob_itself,
+ inPart,
+ inTagName,
+ &bufferSize);
+ if (_err != noErr)
+ return PyMac_Error(_err);
+ if (bufferSize != sizeof(Handle)) {
+ PyErr_SetString(Ctl_Error, "GetControlDataSize() != sizeof(Handle)");
+ return NULL;
+ }
+
+ _err = GetControlData(_self->ob_itself,
+ inPart,
+ inTagName,
+ sizeof(Handle),
+ (Ptr)&hdl,
+ &bufferSize);
+
+ if (_err != noErr) {
+ return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("O&", OptResObj_New, hdl);
+ return _res;
+
+}
+
+static PyObject *CtlObj_SetControlData_Callback(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ OSErr _err;
+ ControlPartCode inPart;
+ ResType inTagName;
+ PyObject *callback;
+ UniversalProcPtr c_callback;
+
+ if (!PyArg_ParseTuple(_args, "hO&O",
+ &inPart,
+ PyMac_GetOSType, &inTagName,
+ &callback))
+ return NULL;
+
+ if ( setcallback((PyObject *)_self, inTagName, callback, &c_callback) < 0 )
+ return NULL;
+ _err = SetControlData(_self->ob_itself,
+ inPart,
+ inTagName,
+ sizeof(c_callback),
+ (Ptr)&c_callback);
+
+ if (_err != noErr)
+ return PyMac_Error(_err);
+ _res = Py_None;
+ return _res;
+
+}
+
+static PyMethodDef CtlObj_methods[] = {
+ {"HiliteControl", (PyCFunction)CtlObj_HiliteControl, 1,
+ PyDoc_STR("(ControlPartCode hiliteState) -> None")},
+ {"ShowControl", (PyCFunction)CtlObj_ShowControl, 1,
+ PyDoc_STR("() -> None")},
+ {"HideControl", (PyCFunction)CtlObj_HideControl, 1,
+ PyDoc_STR("() -> None")},
+ {"IsControlActive", (PyCFunction)CtlObj_IsControlActive, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"IsControlVisible", (PyCFunction)CtlObj_IsControlVisible, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"ActivateControl", (PyCFunction)CtlObj_ActivateControl, 1,
+ PyDoc_STR("() -> None")},
+ {"DeactivateControl", (PyCFunction)CtlObj_DeactivateControl, 1,
+ PyDoc_STR("() -> None")},
+ {"SetControlVisibility", (PyCFunction)CtlObj_SetControlVisibility, 1,
+ PyDoc_STR("(Boolean inIsVisible, Boolean inDoDraw) -> None")},
+ {"IsControlEnabled", (PyCFunction)CtlObj_IsControlEnabled, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"EnableControl", (PyCFunction)CtlObj_EnableControl, 1,
+ PyDoc_STR("() -> None")},
+ {"DisableControl", (PyCFunction)CtlObj_DisableControl, 1,
+ PyDoc_STR("() -> None")},
+ {"Draw1Control", (PyCFunction)CtlObj_Draw1Control, 1,
+ PyDoc_STR("() -> None")},
+ {"GetBestControlRect", (PyCFunction)CtlObj_GetBestControlRect, 1,
+ PyDoc_STR("() -> (Rect outRect, SInt16 outBaseLineOffset)")},
+ {"SetControlFontStyle", (PyCFunction)CtlObj_SetControlFontStyle, 1,
+ PyDoc_STR("(ControlFontStyleRec inStyle) -> None")},
+ {"DrawControlInCurrentPort", (PyCFunction)CtlObj_DrawControlInCurrentPort, 1,
+ PyDoc_STR("() -> None")},
+ {"SetUpControlBackground", (PyCFunction)CtlObj_SetUpControlBackground, 1,
+ PyDoc_STR("(SInt16 inDepth, Boolean inIsColorDevice) -> None")},
+ {"SetUpControlTextColor", (PyCFunction)CtlObj_SetUpControlTextColor, 1,
+ PyDoc_STR("(SInt16 inDepth, Boolean inIsColorDevice) -> None")},
+ {"DragControl", (PyCFunction)CtlObj_DragControl, 1,
+ PyDoc_STR("(Point startPoint, Rect limitRect, Rect slopRect, DragConstraint axis) -> None")},
+ {"TestControl", (PyCFunction)CtlObj_TestControl, 1,
+ PyDoc_STR("(Point testPoint) -> (ControlPartCode _rv)")},
+ {"HandleControlContextualMenuClick", (PyCFunction)CtlObj_HandleControlContextualMenuClick, 1,
+ PyDoc_STR("(Point inWhere) -> (Boolean menuDisplayed)")},
+ {"GetControlClickActivation", (PyCFunction)CtlObj_GetControlClickActivation, 1,
+ PyDoc_STR("(Point inWhere, EventModifiers inModifiers) -> (ClickActivationResult outResult)")},
+ {"HandleControlKey", (PyCFunction)CtlObj_HandleControlKey, 1,
+ PyDoc_STR("(SInt16 inKeyCode, SInt16 inCharCode, EventModifiers inModifiers) -> (ControlPartCode _rv)")},
+ {"HandleControlSetCursor", (PyCFunction)CtlObj_HandleControlSetCursor, 1,
+ PyDoc_STR("(Point localPoint, EventModifiers modifiers) -> (Boolean cursorWasSet)")},
+ {"MoveControl", (PyCFunction)CtlObj_MoveControl, 1,
+ PyDoc_STR("(SInt16 h, SInt16 v) -> None")},
+ {"SizeControl", (PyCFunction)CtlObj_SizeControl, 1,
+ PyDoc_STR("(SInt16 w, SInt16 h) -> None")},
+ {"SetControlTitle", (PyCFunction)CtlObj_SetControlTitle, 1,
+ PyDoc_STR("(Str255 title) -> None")},
+ {"GetControlTitle", (PyCFunction)CtlObj_GetControlTitle, 1,
+ PyDoc_STR("() -> (Str255 title)")},
+ {"SetControlTitleWithCFString", (PyCFunction)CtlObj_SetControlTitleWithCFString, 1,
+ PyDoc_STR("(CFStringRef inString) -> None")},
+ {"CopyControlTitleAsCFString", (PyCFunction)CtlObj_CopyControlTitleAsCFString, 1,
+ PyDoc_STR("() -> (CFStringRef outString)")},
+ {"GetControlValue", (PyCFunction)CtlObj_GetControlValue, 1,
+ PyDoc_STR("() -> (SInt16 _rv)")},
+ {"SetControlValue", (PyCFunction)CtlObj_SetControlValue, 1,
+ PyDoc_STR("(SInt16 newValue) -> None")},
+ {"GetControlMinimum", (PyCFunction)CtlObj_GetControlMinimum, 1,
+ PyDoc_STR("() -> (SInt16 _rv)")},
+ {"SetControlMinimum", (PyCFunction)CtlObj_SetControlMinimum, 1,
+ PyDoc_STR("(SInt16 newMinimum) -> None")},
+ {"GetControlMaximum", (PyCFunction)CtlObj_GetControlMaximum, 1,
+ PyDoc_STR("() -> (SInt16 _rv)")},
+ {"SetControlMaximum", (PyCFunction)CtlObj_SetControlMaximum, 1,
+ PyDoc_STR("(SInt16 newMaximum) -> None")},
+ {"GetControlViewSize", (PyCFunction)CtlObj_GetControlViewSize, 1,
+ PyDoc_STR("() -> (SInt32 _rv)")},
+ {"SetControlViewSize", (PyCFunction)CtlObj_SetControlViewSize, 1,
+ PyDoc_STR("(SInt32 newViewSize) -> None")},
+ {"GetControl32BitValue", (PyCFunction)CtlObj_GetControl32BitValue, 1,
+ PyDoc_STR("() -> (SInt32 _rv)")},
+ {"SetControl32BitValue", (PyCFunction)CtlObj_SetControl32BitValue, 1,
+ PyDoc_STR("(SInt32 newValue) -> None")},
+ {"GetControl32BitMaximum", (PyCFunction)CtlObj_GetControl32BitMaximum, 1,
+ PyDoc_STR("() -> (SInt32 _rv)")},
+ {"SetControl32BitMaximum", (PyCFunction)CtlObj_SetControl32BitMaximum, 1,
+ PyDoc_STR("(SInt32 newMaximum) -> None")},
+ {"GetControl32BitMinimum", (PyCFunction)CtlObj_GetControl32BitMinimum, 1,
+ PyDoc_STR("() -> (SInt32 _rv)")},
+ {"SetControl32BitMinimum", (PyCFunction)CtlObj_SetControl32BitMinimum, 1,
+ PyDoc_STR("(SInt32 newMinimum) -> None")},
+ {"IsValidControlHandle", (PyCFunction)CtlObj_IsValidControlHandle, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"SetControlID", (PyCFunction)CtlObj_SetControlID, 1,
+ PyDoc_STR("(ControlID inID) -> None")},
+ {"GetControlID", (PyCFunction)CtlObj_GetControlID, 1,
+ PyDoc_STR("() -> (ControlID outID)")},
+ {"SetControlCommandID", (PyCFunction)CtlObj_SetControlCommandID, 1,
+ PyDoc_STR("(UInt32 inCommandID) -> None")},
+ {"GetControlCommandID", (PyCFunction)CtlObj_GetControlCommandID, 1,
+ PyDoc_STR("() -> (UInt32 outCommandID)")},
+ {"RemoveControlProperty", (PyCFunction)CtlObj_RemoveControlProperty, 1,
+ PyDoc_STR("(OSType propertyCreator, OSType propertyTag) -> None")},
+ {"GetControlPropertyAttributes", (PyCFunction)CtlObj_GetControlPropertyAttributes, 1,
+ PyDoc_STR("(OSType propertyCreator, OSType propertyTag) -> (UInt32 attributes)")},
+ {"ChangeControlPropertyAttributes", (PyCFunction)CtlObj_ChangeControlPropertyAttributes, 1,
+ PyDoc_STR("(OSType propertyCreator, OSType propertyTag, UInt32 attributesToSet, UInt32 attributesToClear) -> None")},
+ {"GetControlRegion", (PyCFunction)CtlObj_GetControlRegion, 1,
+ PyDoc_STR("(ControlPartCode inPart, RgnHandle outRegion) -> None")},
+ {"GetControlVariant", (PyCFunction)CtlObj_GetControlVariant, 1,
+ PyDoc_STR("() -> (ControlVariant _rv)")},
+ {"SetControlAction", (PyCFunction)CtlObj_SetControlAction, 1,
+ PyDoc_STR("(PyObject* actionProc) -> None")},
+ {"SetControlReference", (PyCFunction)CtlObj_SetControlReference, 1,
+ PyDoc_STR("(SInt32 data) -> None")},
+ {"GetControlReference", (PyCFunction)CtlObj_GetControlReference, 1,
+ PyDoc_STR("() -> (SInt32 _rv)")},
+ {"EmbedControl", (PyCFunction)CtlObj_EmbedControl, 1,
+ PyDoc_STR("(ControlHandle inContainer) -> None")},
+ {"AutoEmbedControl", (PyCFunction)CtlObj_AutoEmbedControl, 1,
+ PyDoc_STR("(WindowPtr inWindow) -> None")},
+ {"GetSuperControl", (PyCFunction)CtlObj_GetSuperControl, 1,
+ PyDoc_STR("() -> (ControlHandle outParent)")},
+ {"CountSubControls", (PyCFunction)CtlObj_CountSubControls, 1,
+ PyDoc_STR("() -> (UInt16 outNumChildren)")},
+ {"GetIndexedSubControl", (PyCFunction)CtlObj_GetIndexedSubControl, 1,
+ PyDoc_STR("(UInt16 inIndex) -> (ControlHandle outSubControl)")},
+ {"SetControlSupervisor", (PyCFunction)CtlObj_SetControlSupervisor, 1,
+ PyDoc_STR("(ControlHandle inBoss) -> None")},
+ {"GetControlFeatures", (PyCFunction)CtlObj_GetControlFeatures, 1,
+ PyDoc_STR("() -> (UInt32 outFeatures)")},
+ {"GetControlDataSize", (PyCFunction)CtlObj_GetControlDataSize, 1,
+ PyDoc_STR("(ControlPartCode inPart, ResType inTagName) -> (Size outMaxSize)")},
+ {"HandleControlDragTracking", (PyCFunction)CtlObj_HandleControlDragTracking, 1,
+ PyDoc_STR("(DragTrackingMessage inMessage, DragReference inDrag) -> (Boolean outLikesDrag)")},
+ {"HandleControlDragReceive", (PyCFunction)CtlObj_HandleControlDragReceive, 1,
+ PyDoc_STR("(DragReference inDrag) -> None")},
+ {"SetControlDragTrackingEnabled", (PyCFunction)CtlObj_SetControlDragTrackingEnabled, 1,
+ PyDoc_STR("(Boolean inTracks) -> None")},
+ {"IsControlDragTrackingEnabled", (PyCFunction)CtlObj_IsControlDragTrackingEnabled, 1,
+ PyDoc_STR("() -> (Boolean outTracks)")},
+ {"GetControlBounds", (PyCFunction)CtlObj_GetControlBounds, 1,
+ PyDoc_STR("() -> (Rect bounds)")},
+ {"IsControlHilited", (PyCFunction)CtlObj_IsControlHilited, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"GetControlHilite", (PyCFunction)CtlObj_GetControlHilite, 1,
+ PyDoc_STR("() -> (UInt16 _rv)")},
+ {"GetControlOwner", (PyCFunction)CtlObj_GetControlOwner, 1,
+ PyDoc_STR("() -> (WindowPtr _rv)")},
+ {"GetControlDataHandle", (PyCFunction)CtlObj_GetControlDataHandle, 1,
+ PyDoc_STR("() -> (Handle _rv)")},
+ {"GetControlPopupMenuHandle", (PyCFunction)CtlObj_GetControlPopupMenuHandle, 1,
+ PyDoc_STR("() -> (MenuHandle _rv)")},
+ {"GetControlPopupMenuID", (PyCFunction)CtlObj_GetControlPopupMenuID, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"SetControlDataHandle", (PyCFunction)CtlObj_SetControlDataHandle, 1,
+ PyDoc_STR("(Handle dataHandle) -> None")},
+ {"SetControlBounds", (PyCFunction)CtlObj_SetControlBounds, 1,
+ PyDoc_STR("(Rect bounds) -> None")},
+ {"SetControlPopupMenuHandle", (PyCFunction)CtlObj_SetControlPopupMenuHandle, 1,
+ PyDoc_STR("(MenuHandle popupMenu) -> None")},
+ {"SetControlPopupMenuID", (PyCFunction)CtlObj_SetControlPopupMenuID, 1,
+ PyDoc_STR("(short menuID) -> None")},
+ {"GetBevelButtonMenuValue", (PyCFunction)CtlObj_GetBevelButtonMenuValue, 1,
+ PyDoc_STR("() -> (SInt16 outValue)")},
+ {"SetBevelButtonMenuValue", (PyCFunction)CtlObj_SetBevelButtonMenuValue, 1,
+ PyDoc_STR("(SInt16 inValue) -> None")},
+ {"GetBevelButtonMenuHandle", (PyCFunction)CtlObj_GetBevelButtonMenuHandle, 1,
+ PyDoc_STR("() -> (MenuHandle outHandle)")},
+ {"SetBevelButtonContentInfo", (PyCFunction)CtlObj_SetBevelButtonContentInfo, 1,
+ PyDoc_STR("(ControlButtonContentInfo inContent) -> None")},
+ {"SetBevelButtonTransform", (PyCFunction)CtlObj_SetBevelButtonTransform, 1,
+ PyDoc_STR("(IconTransformType transform) -> None")},
+ {"SetDisclosureTriangleLastValue", (PyCFunction)CtlObj_SetDisclosureTriangleLastValue, 1,
+ PyDoc_STR("(SInt16 inValue) -> None")},
+ {"GetTabContentRect", (PyCFunction)CtlObj_GetTabContentRect, 1,
+ PyDoc_STR("() -> (Rect outContentRect)")},
+ {"SetTabEnabled", (PyCFunction)CtlObj_SetTabEnabled, 1,
+ PyDoc_STR("(SInt16 inTabToHilite, Boolean inEnabled) -> None")},
+ {"SetImageWellContentInfo", (PyCFunction)CtlObj_SetImageWellContentInfo, 1,
+ PyDoc_STR("(ControlButtonContentInfo inContent) -> None")},
+ {"SetImageWellTransform", (PyCFunction)CtlObj_SetImageWellTransform, 1,
+ PyDoc_STR("(IconTransformType inTransform) -> None")},
+ {"GetDataBrowserViewStyle", (PyCFunction)CtlObj_GetDataBrowserViewStyle, 1,
+ PyDoc_STR("() -> (OSType style)")},
+ {"SetDataBrowserViewStyle", (PyCFunction)CtlObj_SetDataBrowserViewStyle, 1,
+ PyDoc_STR("(OSType style) -> None")},
+ {"EnableDataBrowserEditCommand", (PyCFunction)CtlObj_EnableDataBrowserEditCommand, 1,
+ PyDoc_STR("(UInt32 command) -> (Boolean _rv)")},
+ {"ExecuteDataBrowserEditCommand", (PyCFunction)CtlObj_ExecuteDataBrowserEditCommand, 1,
+ PyDoc_STR("(UInt32 command) -> None")},
+ {"GetDataBrowserSelectionAnchor", (PyCFunction)CtlObj_GetDataBrowserSelectionAnchor, 1,
+ PyDoc_STR("() -> (UInt32 first, UInt32 last)")},
+ {"MoveDataBrowserSelectionAnchor", (PyCFunction)CtlObj_MoveDataBrowserSelectionAnchor, 1,
+ PyDoc_STR("(UInt32 direction, Boolean extendSelection) -> None")},
+ {"OpenDataBrowserContainer", (PyCFunction)CtlObj_OpenDataBrowserContainer, 1,
+ PyDoc_STR("(UInt32 container) -> None")},
+ {"CloseDataBrowserContainer", (PyCFunction)CtlObj_CloseDataBrowserContainer, 1,
+ PyDoc_STR("(UInt32 container) -> None")},
+ {"SortDataBrowserContainer", (PyCFunction)CtlObj_SortDataBrowserContainer, 1,
+ PyDoc_STR("(UInt32 container, Boolean sortChildren) -> None")},
+ {"GetDataBrowserItems", (PyCFunction)CtlObj_GetDataBrowserItems, 1,
+ PyDoc_STR("(UInt32 container, Boolean recurse, UInt32 state, Handle items) -> None")},
+ {"GetDataBrowserItemCount", (PyCFunction)CtlObj_GetDataBrowserItemCount, 1,
+ PyDoc_STR("(UInt32 container, Boolean recurse, UInt32 state) -> (UInt32 numItems)")},
+ {"IsDataBrowserItemSelected", (PyCFunction)CtlObj_IsDataBrowserItemSelected, 1,
+ PyDoc_STR("(UInt32 item) -> (Boolean _rv)")},
+ {"GetDataBrowserItemState", (PyCFunction)CtlObj_GetDataBrowserItemState, 1,
+ PyDoc_STR("(UInt32 item) -> (UInt32 state)")},
+ {"RevealDataBrowserItem", (PyCFunction)CtlObj_RevealDataBrowserItem, 1,
+ PyDoc_STR("(UInt32 item, UInt32 propertyID, UInt8 options) -> None")},
+ {"SetDataBrowserActiveItems", (PyCFunction)CtlObj_SetDataBrowserActiveItems, 1,
+ PyDoc_STR("(Boolean active) -> None")},
+ {"GetDataBrowserActiveItems", (PyCFunction)CtlObj_GetDataBrowserActiveItems, 1,
+ PyDoc_STR("() -> (Boolean active)")},
+ {"SetDataBrowserScrollBarInset", (PyCFunction)CtlObj_SetDataBrowserScrollBarInset, 1,
+ PyDoc_STR("() -> (Rect insetRect)")},
+ {"GetDataBrowserScrollBarInset", (PyCFunction)CtlObj_GetDataBrowserScrollBarInset, 1,
+ PyDoc_STR("() -> (Rect insetRect)")},
+ {"SetDataBrowserTarget", (PyCFunction)CtlObj_SetDataBrowserTarget, 1,
+ PyDoc_STR("(UInt32 target) -> None")},
+ {"GetDataBrowserTarget", (PyCFunction)CtlObj_GetDataBrowserTarget, 1,
+ PyDoc_STR("() -> (UInt32 target)")},
+ {"SetDataBrowserSortOrder", (PyCFunction)CtlObj_SetDataBrowserSortOrder, 1,
+ PyDoc_STR("(UInt16 order) -> None")},
+ {"GetDataBrowserSortOrder", (PyCFunction)CtlObj_GetDataBrowserSortOrder, 1,
+ PyDoc_STR("() -> (UInt16 order)")},
+ {"SetDataBrowserScrollPosition", (PyCFunction)CtlObj_SetDataBrowserScrollPosition, 1,
+ PyDoc_STR("(UInt32 top, UInt32 left) -> None")},
+ {"GetDataBrowserScrollPosition", (PyCFunction)CtlObj_GetDataBrowserScrollPosition, 1,
+ PyDoc_STR("() -> (UInt32 top, UInt32 left)")},
+ {"SetDataBrowserHasScrollBars", (PyCFunction)CtlObj_SetDataBrowserHasScrollBars, 1,
+ PyDoc_STR("(Boolean horiz, Boolean vert) -> None")},
+ {"GetDataBrowserHasScrollBars", (PyCFunction)CtlObj_GetDataBrowserHasScrollBars, 1,
+ PyDoc_STR("() -> (Boolean horiz, Boolean vert)")},
+ {"SetDataBrowserSortProperty", (PyCFunction)CtlObj_SetDataBrowserSortProperty, 1,
+ PyDoc_STR("(UInt32 property) -> None")},
+ {"GetDataBrowserSortProperty", (PyCFunction)CtlObj_GetDataBrowserSortProperty, 1,
+ PyDoc_STR("() -> (UInt32 property)")},
+ {"SetDataBrowserSelectionFlags", (PyCFunction)CtlObj_SetDataBrowserSelectionFlags, 1,
+ PyDoc_STR("(UInt32 selectionFlags) -> None")},
+ {"GetDataBrowserSelectionFlags", (PyCFunction)CtlObj_GetDataBrowserSelectionFlags, 1,
+ PyDoc_STR("() -> (UInt32 selectionFlags)")},
+ {"SetDataBrowserPropertyFlags", (PyCFunction)CtlObj_SetDataBrowserPropertyFlags, 1,
+ PyDoc_STR("(UInt32 property, UInt32 flags) -> None")},
+ {"GetDataBrowserPropertyFlags", (PyCFunction)CtlObj_GetDataBrowserPropertyFlags, 1,
+ PyDoc_STR("(UInt32 property) -> (UInt32 flags)")},
+ {"SetDataBrowserEditText", (PyCFunction)CtlObj_SetDataBrowserEditText, 1,
+ PyDoc_STR("(CFStringRef text) -> None")},
+ {"CopyDataBrowserEditText", (PyCFunction)CtlObj_CopyDataBrowserEditText, 1,
+ PyDoc_STR("() -> (CFStringRef text)")},
+ {"GetDataBrowserEditText", (PyCFunction)CtlObj_GetDataBrowserEditText, 1,
+ PyDoc_STR("(CFMutableStringRef text) -> None")},
+ {"SetDataBrowserEditItem", (PyCFunction)CtlObj_SetDataBrowserEditItem, 1,
+ PyDoc_STR("(UInt32 item, UInt32 property) -> None")},
+ {"GetDataBrowserEditItem", (PyCFunction)CtlObj_GetDataBrowserEditItem, 1,
+ PyDoc_STR("() -> (UInt32 item, UInt32 property)")},
+ {"GetDataBrowserItemPartBounds", (PyCFunction)CtlObj_GetDataBrowserItemPartBounds, 1,
+ PyDoc_STR("(UInt32 item, UInt32 property, OSType part) -> (Rect bounds)")},
+ {"RemoveDataBrowserTableViewColumn", (PyCFunction)CtlObj_RemoveDataBrowserTableViewColumn, 1,
+ PyDoc_STR("(UInt32 column) -> None")},
+ {"GetDataBrowserTableViewColumnCount", (PyCFunction)CtlObj_GetDataBrowserTableViewColumnCount, 1,
+ PyDoc_STR("() -> (UInt32 numColumns)")},
+ {"SetDataBrowserTableViewHiliteStyle", (PyCFunction)CtlObj_SetDataBrowserTableViewHiliteStyle, 1,
+ PyDoc_STR("(UInt32 hiliteStyle) -> None")},
+ {"GetDataBrowserTableViewHiliteStyle", (PyCFunction)CtlObj_GetDataBrowserTableViewHiliteStyle, 1,
+ PyDoc_STR("() -> (UInt32 hiliteStyle)")},
+ {"SetDataBrowserTableViewRowHeight", (PyCFunction)CtlObj_SetDataBrowserTableViewRowHeight, 1,
+ PyDoc_STR("(UInt16 height) -> None")},
+ {"GetDataBrowserTableViewRowHeight", (PyCFunction)CtlObj_GetDataBrowserTableViewRowHeight, 1,
+ PyDoc_STR("() -> (UInt16 height)")},
+ {"SetDataBrowserTableViewColumnWidth", (PyCFunction)CtlObj_SetDataBrowserTableViewColumnWidth, 1,
+ PyDoc_STR("(UInt16 width) -> None")},
+ {"GetDataBrowserTableViewColumnWidth", (PyCFunction)CtlObj_GetDataBrowserTableViewColumnWidth, 1,
+ PyDoc_STR("() -> (UInt16 width)")},
+ {"SetDataBrowserTableViewItemRowHeight", (PyCFunction)CtlObj_SetDataBrowserTableViewItemRowHeight, 1,
+ PyDoc_STR("(UInt32 item, UInt16 height) -> None")},
+ {"GetDataBrowserTableViewItemRowHeight", (PyCFunction)CtlObj_GetDataBrowserTableViewItemRowHeight, 1,
+ PyDoc_STR("(UInt32 item) -> (UInt16 height)")},
+ {"SetDataBrowserTableViewNamedColumnWidth", (PyCFunction)CtlObj_SetDataBrowserTableViewNamedColumnWidth, 1,
+ PyDoc_STR("(UInt32 column, UInt16 width) -> None")},
+ {"GetDataBrowserTableViewNamedColumnWidth", (PyCFunction)CtlObj_GetDataBrowserTableViewNamedColumnWidth, 1,
+ PyDoc_STR("(UInt32 column) -> (UInt16 width)")},
+ {"SetDataBrowserTableViewGeometry", (PyCFunction)CtlObj_SetDataBrowserTableViewGeometry, 1,
+ PyDoc_STR("(Boolean variableWidthColumns, Boolean variableHeightRows) -> None")},
+ {"GetDataBrowserTableViewGeometry", (PyCFunction)CtlObj_GetDataBrowserTableViewGeometry, 1,
+ PyDoc_STR("() -> (Boolean variableWidthColumns, Boolean variableHeightRows)")},
+ {"GetDataBrowserTableViewItemID", (PyCFunction)CtlObj_GetDataBrowserTableViewItemID, 1,
+ PyDoc_STR("(UInt32 row) -> (UInt32 item)")},
+ {"SetDataBrowserTableViewItemRow", (PyCFunction)CtlObj_SetDataBrowserTableViewItemRow, 1,
+ PyDoc_STR("(UInt32 item, UInt32 row) -> None")},
+ {"GetDataBrowserTableViewItemRow", (PyCFunction)CtlObj_GetDataBrowserTableViewItemRow, 1,
+ PyDoc_STR("(UInt32 item) -> (UInt32 row)")},
+ {"SetDataBrowserTableViewColumnPosition", (PyCFunction)CtlObj_SetDataBrowserTableViewColumnPosition, 1,
+ PyDoc_STR("(UInt32 column, UInt32 position) -> None")},
+ {"GetDataBrowserTableViewColumnPosition", (PyCFunction)CtlObj_GetDataBrowserTableViewColumnPosition, 1,
+ PyDoc_STR("(UInt32 column) -> (UInt32 position)")},
+ {"GetDataBrowserTableViewColumnProperty", (PyCFunction)CtlObj_GetDataBrowserTableViewColumnProperty, 1,
+ PyDoc_STR("(UInt32 column) -> (UInt32 property)")},
+ {"AutoSizeDataBrowserListViewColumns", (PyCFunction)CtlObj_AutoSizeDataBrowserListViewColumns, 1,
+ PyDoc_STR("() -> None")},
+ {"AddDataBrowserListViewColumn", (PyCFunction)CtlObj_AddDataBrowserListViewColumn, 1,
+ PyDoc_STR("(DataBrowserListViewColumnDesc columnDesc, UInt32 position) -> None")},
+ {"SetDataBrowserListViewHeaderBtnHeight", (PyCFunction)CtlObj_SetDataBrowserListViewHeaderBtnHeight, 1,
+ PyDoc_STR("(UInt16 height) -> None")},
+ {"GetDataBrowserListViewHeaderBtnHeight", (PyCFunction)CtlObj_GetDataBrowserListViewHeaderBtnHeight, 1,
+ PyDoc_STR("() -> (UInt16 height)")},
+ {"SetDataBrowserListViewUsePlainBackground", (PyCFunction)CtlObj_SetDataBrowserListViewUsePlainBackground, 1,
+ PyDoc_STR("(Boolean usePlainBackground) -> None")},
+ {"GetDataBrowserListViewUsePlainBackground", (PyCFunction)CtlObj_GetDataBrowserListViewUsePlainBackground, 1,
+ PyDoc_STR("() -> (Boolean usePlainBackground)")},
+ {"SetDataBrowserListViewDisclosureColumn", (PyCFunction)CtlObj_SetDataBrowserListViewDisclosureColumn, 1,
+ PyDoc_STR("(UInt32 column, Boolean expandableRows) -> None")},
+ {"GetDataBrowserListViewDisclosureColumn", (PyCFunction)CtlObj_GetDataBrowserListViewDisclosureColumn, 1,
+ PyDoc_STR("() -> (UInt32 column, Boolean expandableRows)")},
+ {"GetDataBrowserColumnViewPath", (PyCFunction)CtlObj_GetDataBrowserColumnViewPath, 1,
+ PyDoc_STR("(Handle path) -> None")},
+ {"GetDataBrowserColumnViewPathLength", (PyCFunction)CtlObj_GetDataBrowserColumnViewPathLength, 1,
+ PyDoc_STR("() -> (UInt32 pathLength)")},
+ {"SetDataBrowserColumnViewDisplayType", (PyCFunction)CtlObj_SetDataBrowserColumnViewDisplayType, 1,
+ PyDoc_STR("(OSType propertyType) -> None")},
+ {"GetDataBrowserColumnViewDisplayType", (PyCFunction)CtlObj_GetDataBrowserColumnViewDisplayType, 1,
+ PyDoc_STR("() -> (OSType propertyType)")},
+ {"as_Resource", (PyCFunction)CtlObj_as_Resource, 1,
+ PyDoc_STR("() -> (Handle _rv)")},
+ {"GetControlRect", (PyCFunction)CtlObj_GetControlRect, 1,
+ PyDoc_STR("() -> (Rect rect)")},
+ {"DisposeControl", (PyCFunction)CtlObj_DisposeControl, 1,
+ PyDoc_STR("() -> None")},
+ {"TrackControl", (PyCFunction)CtlObj_TrackControl, 1,
+ PyDoc_STR("(Point startPoint [,trackercallback]) -> (ControlPartCode _rv)")},
+ {"HandleControlClick", (PyCFunction)CtlObj_HandleControlClick, 1,
+ PyDoc_STR("(Point startPoint, Integer modifiers, [,trackercallback]) -> (ControlPartCode _rv)")},
+ {"SetControlData", (PyCFunction)CtlObj_SetControlData, 1,
+ PyDoc_STR("(stuff) -> None")},
+ {"GetControlData", (PyCFunction)CtlObj_GetControlData, 1,
+ PyDoc_STR("(part, type) -> String")},
+ {"SetControlData_Handle", (PyCFunction)CtlObj_SetControlData_Handle, 1,
+ PyDoc_STR("(ResObj) -> None")},
+ {"GetControlData_Handle", (PyCFunction)CtlObj_GetControlData_Handle, 1,
+ PyDoc_STR("(part, type) -> ResObj")},
+ {"SetControlData_Callback", (PyCFunction)CtlObj_SetControlData_Callback, 1,
+ PyDoc_STR("(callbackfunc) -> None")},
+ {NULL, NULL, 0}
+};
+
+#define CtlObj_getsetlist NULL
+
+
+static int CtlObj_compare(ControlObject *self, ControlObject *other)
+{
+ unsigned long v, w;
+
+ if (!CtlObj_Check((PyObject *)other))
+ {
+ v=(unsigned long)self;
+ w=(unsigned long)other;
+ }
+ else
+ {
+ v=(unsigned long)self->ob_itself;
+ w=(unsigned long)other->ob_itself;
+ }
+ if( v < w ) return -1;
+ if( v > w ) return 1;
+ return 0;
+}
+
+#define CtlObj_repr NULL
+
+static long CtlObj_hash(ControlObject *self)
+{
+ return (long)self->ob_itself;
+}
+#define CtlObj_tp_init 0
+
+#define CtlObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *CtlObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *_self;
+ ControlHandle itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, CtlObj_Convert, &itself)) return NULL;
+ if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((ControlObject *)_self)->ob_itself = itself;
+ return _self;
+}
+
+#define CtlObj_tp_free PyObject_Del
+
+
+PyTypeObject Control_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_Ctl.Control", /*tp_name*/
+ sizeof(ControlObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) CtlObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) CtlObj_compare, /*tp_compare*/
+ (reprfunc) CtlObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) CtlObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ CtlObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ CtlObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ CtlObj_tp_init, /* tp_init */
+ CtlObj_tp_alloc, /* tp_alloc */
+ CtlObj_tp_new, /* tp_new */
+ CtlObj_tp_free, /* tp_free */
+};
+
+/* -------------------- End object type Control --------------------- */
+
+
+static PyObject *Ctl_NewControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ControlHandle _rv;
+ WindowPtr owningWindow;
+ Rect boundsRect;
+ Str255 controlTitle;
+ Boolean initiallyVisible;
+ SInt16 initialValue;
+ SInt16 minimumValue;
+ SInt16 maximumValue;
+ SInt16 procID;
+ SInt32 controlReference;
+#ifndef NewControl
+ PyMac_PRECHECK(NewControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&bhhhhl",
+ WinObj_Convert, &owningWindow,
+ PyMac_GetRect, &boundsRect,
+ PyMac_GetStr255, controlTitle,
+ &initiallyVisible,
+ &initialValue,
+ &minimumValue,
+ &maximumValue,
+ &procID,
+ &controlReference))
+ return NULL;
+ _rv = NewControl(owningWindow,
+ &boundsRect,
+ controlTitle,
+ initiallyVisible,
+ initialValue,
+ minimumValue,
+ maximumValue,
+ procID,
+ controlReference);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Ctl_GetNewControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ControlHandle _rv;
+ SInt16 resourceID;
+ WindowPtr owningWindow;
+#ifndef GetNewControl
+ PyMac_PRECHECK(GetNewControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &resourceID,
+ WinObj_Convert, &owningWindow))
+ return NULL;
+ _rv = GetNewControl(resourceID,
+ owningWindow);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Ctl_DrawControls(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr theWindow;
+#ifndef DrawControls
+ PyMac_PRECHECK(DrawControls);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &theWindow))
+ return NULL;
+ DrawControls(theWindow);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Ctl_UpdateControls(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr inWindow;
+ RgnHandle inUpdateRegion;
+#ifndef UpdateControls
+ PyMac_PRECHECK(UpdateControls);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ WinObj_Convert, &inWindow,
+ ResObj_Convert, &inUpdateRegion))
+ return NULL;
+ UpdateControls(inWindow,
+ inUpdateRegion);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Ctl_FindControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ControlPartCode _rv;
+ Point testPoint;
+ WindowPtr theWindow;
+ ControlHandle theControl;
+#ifndef FindControl
+ PyMac_PRECHECK(FindControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetPoint, &testPoint,
+ WinObj_Convert, &theWindow))
+ return NULL;
+ _rv = FindControl(testPoint,
+ theWindow,
+ &theControl);
+ _res = Py_BuildValue("hO&",
+ _rv,
+ CtlObj_WhichControl, theControl);
+ return _res;
+}
+
+static PyObject *Ctl_IdleControls(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr inWindow;
+#ifndef IdleControls
+ PyMac_PRECHECK(IdleControls);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &inWindow))
+ return NULL;
+ IdleControls(inWindow);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Ctl_GetControlByID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr inWindow;
+ ControlID inID;
+ ControlHandle outControl;
+#ifndef GetControlByID
+ PyMac_PRECHECK(GetControlByID);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ WinObj_Convert, &inWindow,
+ PyControlID_Convert, &inID))
+ return NULL;
+ _err = GetControlByID(inWindow,
+ &inID,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_WhichControl, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_DumpControlHierarchy(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ WindowPtr inWindow;
+ FSSpec inDumpFile;
+#ifndef DumpControlHierarchy
+ PyMac_PRECHECK(DumpControlHierarchy);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ WinObj_Convert, &inWindow,
+ PyMac_GetFSSpec, &inDumpFile))
+ return NULL;
+ _err = DumpControlHierarchy(inWindow,
+ &inDumpFile);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Ctl_CreateRootControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ WindowPtr inWindow;
+ ControlHandle outControl;
+#ifndef CreateRootControl
+ PyMac_PRECHECK(CreateRootControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &inWindow))
+ return NULL;
+ _err = CreateRootControl(inWindow,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_GetRootControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ WindowPtr inWindow;
+ ControlHandle outControl;
+#ifndef GetRootControl
+ PyMac_PRECHECK(GetRootControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &inWindow))
+ return NULL;
+ _err = GetRootControl(inWindow,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_WhichControl, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_GetKeyboardFocus(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ WindowPtr inWindow;
+ ControlHandle outControl;
+#ifndef GetKeyboardFocus
+ PyMac_PRECHECK(GetKeyboardFocus);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &inWindow))
+ return NULL;
+ _err = GetKeyboardFocus(inWindow,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_WhichControl, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_SetKeyboardFocus(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ WindowPtr inWindow;
+ ControlHandle inControl;
+ ControlFocusPart inPart;
+#ifndef SetKeyboardFocus
+ PyMac_PRECHECK(SetKeyboardFocus);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&h",
+ WinObj_Convert, &inWindow,
+ CtlObj_Convert, &inControl,
+ &inPart))
+ return NULL;
+ _err = SetKeyboardFocus(inWindow,
+ inControl,
+ inPart);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Ctl_AdvanceKeyboardFocus(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ WindowPtr inWindow;
+#ifndef AdvanceKeyboardFocus
+ PyMac_PRECHECK(AdvanceKeyboardFocus);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &inWindow))
+ return NULL;
+ _err = AdvanceKeyboardFocus(inWindow);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Ctl_ReverseKeyboardFocus(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ WindowPtr inWindow;
+#ifndef ReverseKeyboardFocus
+ PyMac_PRECHECK(ReverseKeyboardFocus);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &inWindow))
+ return NULL;
+ _err = ReverseKeyboardFocus(inWindow);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Ctl_ClearKeyboardFocus(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ WindowPtr inWindow;
+#ifndef ClearKeyboardFocus
+ PyMac_PRECHECK(ClearKeyboardFocus);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &inWindow))
+ return NULL;
+ _err = ClearKeyboardFocus(inWindow);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Ctl_SetAutomaticControlDragTrackingEnabledForWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr inWindow;
+ Boolean inTracks;
+#ifndef SetAutomaticControlDragTrackingEnabledForWindow
+ PyMac_PRECHECK(SetAutomaticControlDragTrackingEnabledForWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&b",
+ WinObj_Convert, &inWindow,
+ &inTracks))
+ return NULL;
+ _err = SetAutomaticControlDragTrackingEnabledForWindow(inWindow,
+ inTracks);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Ctl_IsAutomaticControlDragTrackingEnabledForWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr inWindow;
+ Boolean outTracks;
+#ifndef IsAutomaticControlDragTrackingEnabledForWindow
+ PyMac_PRECHECK(IsAutomaticControlDragTrackingEnabledForWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &inWindow))
+ return NULL;
+ _err = IsAutomaticControlDragTrackingEnabledForWindow(inWindow,
+ &outTracks);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("b",
+ outTracks);
+ return _res;
+}
+
+static PyObject *Ctl_CreateBevelButtonControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ CFStringRef title;
+ UInt16 thickness;
+ UInt16 behavior;
+ ControlButtonContentInfo info;
+ SInt16 menuID;
+ UInt16 menuBehavior;
+ UInt16 menuPlacement;
+ ControlHandle outControl;
+#ifndef CreateBevelButtonControl
+ PyMac_PRECHECK(CreateBevelButtonControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&HHO&hHH",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect,
+ CFStringRefObj_Convert, &title,
+ &thickness,
+ &behavior,
+ ControlButtonContentInfo_Convert, &info,
+ &menuID,
+ &menuBehavior,
+ &menuPlacement))
+ return NULL;
+ _err = CreateBevelButtonControl(window,
+ &boundsRect,
+ title,
+ thickness,
+ behavior,
+ &info,
+ menuID,
+ menuBehavior,
+ menuPlacement,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_CreateSliderControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ SInt32 value;
+ SInt32 minimum;
+ SInt32 maximum;
+ UInt16 orientation;
+ UInt16 numTickMarks;
+ Boolean liveTracking;
+ PyObject* liveTrackingProc;
+ UniversalProcPtr c_callback;
+ ControlHandle outControl;
+#ifndef CreateSliderControl
+ PyMac_PRECHECK(CreateSliderControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&lllHHbO",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect,
+ &value,
+ &minimum,
+ &maximum,
+ &orientation,
+ &numTickMarks,
+ &liveTracking,
+ &liveTrackingProc))
+ return NULL;
+ _err = CreateSliderControl(window,
+ &boundsRect,
+ value,
+ minimum,
+ maximum,
+ orientation,
+ numTickMarks,
+ liveTracking,
+ myactionproc_upp,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ setcallback(_res, kMyControlActionProcTag, liveTrackingProc, &c_callback);
+ return _res;
+}
+
+static PyObject *Ctl_CreateDisclosureTriangleControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr inWindow;
+ Rect inBoundsRect;
+ UInt16 inOrientation;
+ CFStringRef inTitle;
+ SInt32 inInitialValue;
+ Boolean inDrawTitle;
+ Boolean inAutoToggles;
+ ControlHandle outControl;
+#ifndef CreateDisclosureTriangleControl
+ PyMac_PRECHECK(CreateDisclosureTriangleControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&HO&lbb",
+ WinObj_Convert, &inWindow,
+ PyMac_GetRect, &inBoundsRect,
+ &inOrientation,
+ CFStringRefObj_Convert, &inTitle,
+ &inInitialValue,
+ &inDrawTitle,
+ &inAutoToggles))
+ return NULL;
+ _err = CreateDisclosureTriangleControl(inWindow,
+ &inBoundsRect,
+ inOrientation,
+ inTitle,
+ inInitialValue,
+ inDrawTitle,
+ inAutoToggles,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_CreateProgressBarControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ SInt32 value;
+ SInt32 minimum;
+ SInt32 maximum;
+ Boolean indeterminate;
+ ControlHandle outControl;
+#ifndef CreateProgressBarControl
+ PyMac_PRECHECK(CreateProgressBarControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&lllb",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect,
+ &value,
+ &minimum,
+ &maximum,
+ &indeterminate))
+ return NULL;
+ _err = CreateProgressBarControl(window,
+ &boundsRect,
+ value,
+ minimum,
+ maximum,
+ indeterminate,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_CreateRelevanceBarControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ SInt32 value;
+ SInt32 minimum;
+ SInt32 maximum;
+ ControlHandle outControl;
+#ifndef CreateRelevanceBarControl
+ PyMac_PRECHECK(CreateRelevanceBarControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&lll",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect,
+ &value,
+ &minimum,
+ &maximum))
+ return NULL;
+ _err = CreateRelevanceBarControl(window,
+ &boundsRect,
+ value,
+ minimum,
+ maximum,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_CreateLittleArrowsControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ SInt32 value;
+ SInt32 minimum;
+ SInt32 maximum;
+ SInt32 increment;
+ ControlHandle outControl;
+#ifndef CreateLittleArrowsControl
+ PyMac_PRECHECK(CreateLittleArrowsControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&llll",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect,
+ &value,
+ &minimum,
+ &maximum,
+ &increment))
+ return NULL;
+ _err = CreateLittleArrowsControl(window,
+ &boundsRect,
+ value,
+ minimum,
+ maximum,
+ increment,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_CreateChasingArrowsControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ ControlHandle outControl;
+#ifndef CreateChasingArrowsControl
+ PyMac_PRECHECK(CreateChasingArrowsControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect))
+ return NULL;
+ _err = CreateChasingArrowsControl(window,
+ &boundsRect,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_CreateSeparatorControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ ControlHandle outControl;
+#ifndef CreateSeparatorControl
+ PyMac_PRECHECK(CreateSeparatorControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect))
+ return NULL;
+ _err = CreateSeparatorControl(window,
+ &boundsRect,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_CreateGroupBoxControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ CFStringRef title;
+ Boolean primary;
+ ControlHandle outControl;
+#ifndef CreateGroupBoxControl
+ PyMac_PRECHECK(CreateGroupBoxControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&b",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect,
+ CFStringRefObj_Convert, &title,
+ &primary))
+ return NULL;
+ _err = CreateGroupBoxControl(window,
+ &boundsRect,
+ title,
+ primary,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_CreateCheckGroupBoxControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ CFStringRef title;
+ SInt32 initialValue;
+ Boolean primary;
+ Boolean autoToggle;
+ ControlHandle outControl;
+#ifndef CreateCheckGroupBoxControl
+ PyMac_PRECHECK(CreateCheckGroupBoxControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&lbb",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect,
+ CFStringRefObj_Convert, &title,
+ &initialValue,
+ &primary,
+ &autoToggle))
+ return NULL;
+ _err = CreateCheckGroupBoxControl(window,
+ &boundsRect,
+ title,
+ initialValue,
+ primary,
+ autoToggle,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_CreatePopupGroupBoxControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ CFStringRef title;
+ Boolean primary;
+ SInt16 menuID;
+ Boolean variableWidth;
+ SInt16 titleWidth;
+ SInt16 titleJustification;
+ Style titleStyle;
+ ControlHandle outControl;
+#ifndef CreatePopupGroupBoxControl
+ PyMac_PRECHECK(CreatePopupGroupBoxControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&bhbhhb",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect,
+ CFStringRefObj_Convert, &title,
+ &primary,
+ &menuID,
+ &variableWidth,
+ &titleWidth,
+ &titleJustification,
+ &titleStyle))
+ return NULL;
+ _err = CreatePopupGroupBoxControl(window,
+ &boundsRect,
+ title,
+ primary,
+ menuID,
+ variableWidth,
+ titleWidth,
+ titleJustification,
+ titleStyle,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_CreateImageWellControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ ControlButtonContentInfo info;
+ ControlHandle outControl;
+#ifndef CreateImageWellControl
+ PyMac_PRECHECK(CreateImageWellControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect,
+ ControlButtonContentInfo_Convert, &info))
+ return NULL;
+ _err = CreateImageWellControl(window,
+ &boundsRect,
+ &info,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_CreatePopupArrowControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ UInt16 orientation;
+ UInt16 size;
+ ControlHandle outControl;
+#ifndef CreatePopupArrowControl
+ PyMac_PRECHECK(CreatePopupArrowControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&HH",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect,
+ &orientation,
+ &size))
+ return NULL;
+ _err = CreatePopupArrowControl(window,
+ &boundsRect,
+ orientation,
+ size,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_CreatePlacardControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ ControlHandle outControl;
+#ifndef CreatePlacardControl
+ PyMac_PRECHECK(CreatePlacardControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect))
+ return NULL;
+ _err = CreatePlacardControl(window,
+ &boundsRect,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_CreateClockControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ UInt16 clockType;
+ UInt32 clockFlags;
+ ControlHandle outControl;
+#ifndef CreateClockControl
+ PyMac_PRECHECK(CreateClockControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&Hl",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect,
+ &clockType,
+ &clockFlags))
+ return NULL;
+ _err = CreateClockControl(window,
+ &boundsRect,
+ clockType,
+ clockFlags,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_CreateUserPaneControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ UInt32 features;
+ ControlHandle outControl;
+#ifndef CreateUserPaneControl
+ PyMac_PRECHECK(CreateUserPaneControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&l",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect,
+ &features))
+ return NULL;
+ _err = CreateUserPaneControl(window,
+ &boundsRect,
+ features,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_CreateEditTextControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ CFStringRef text;
+ Boolean isPassword;
+ Boolean useInlineInput;
+ ControlFontStyleRec style;
+ ControlHandle outControl;
+#ifndef CreateEditTextControl
+ PyMac_PRECHECK(CreateEditTextControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&bbO&",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect,
+ CFStringRefObj_Convert, &text,
+ &isPassword,
+ &useInlineInput,
+ ControlFontStyle_Convert, &style))
+ return NULL;
+ _err = CreateEditTextControl(window,
+ &boundsRect,
+ text,
+ isPassword,
+ useInlineInput,
+ &style,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_CreateStaticTextControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ CFStringRef text;
+ ControlFontStyleRec style;
+ ControlHandle outControl;
+#ifndef CreateStaticTextControl
+ PyMac_PRECHECK(CreateStaticTextControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect,
+ CFStringRefObj_Convert, &text,
+ ControlFontStyle_Convert, &style))
+ return NULL;
+ _err = CreateStaticTextControl(window,
+ &boundsRect,
+ text,
+ &style,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_CreatePictureControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ ControlButtonContentInfo content;
+ Boolean dontTrack;
+ ControlHandle outControl;
+#ifndef CreatePictureControl
+ PyMac_PRECHECK(CreatePictureControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&b",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect,
+ ControlButtonContentInfo_Convert, &content,
+ &dontTrack))
+ return NULL;
+ _err = CreatePictureControl(window,
+ &boundsRect,
+ &content,
+ dontTrack,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_CreateIconControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr inWindow;
+ Rect inBoundsRect;
+ ControlButtonContentInfo inIconContent;
+ Boolean inDontTrack;
+ ControlHandle outControl;
+#ifndef CreateIconControl
+ PyMac_PRECHECK(CreateIconControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&b",
+ WinObj_Convert, &inWindow,
+ PyMac_GetRect, &inBoundsRect,
+ ControlButtonContentInfo_Convert, &inIconContent,
+ &inDontTrack))
+ return NULL;
+ _err = CreateIconControl(inWindow,
+ &inBoundsRect,
+ &inIconContent,
+ inDontTrack,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_CreateWindowHeaderControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ Boolean isListHeader;
+ ControlHandle outControl;
+#ifndef CreateWindowHeaderControl
+ PyMac_PRECHECK(CreateWindowHeaderControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&b",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect,
+ &isListHeader))
+ return NULL;
+ _err = CreateWindowHeaderControl(window,
+ &boundsRect,
+ isListHeader,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_CreatePushButtonControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ CFStringRef title;
+ ControlHandle outControl;
+#ifndef CreatePushButtonControl
+ PyMac_PRECHECK(CreatePushButtonControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect,
+ CFStringRefObj_Convert, &title))
+ return NULL;
+ _err = CreatePushButtonControl(window,
+ &boundsRect,
+ title,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_CreatePushButtonWithIconControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ CFStringRef title;
+ ControlButtonContentInfo icon;
+ UInt16 iconAlignment;
+ ControlHandle outControl;
+#ifndef CreatePushButtonWithIconControl
+ PyMac_PRECHECK(CreatePushButtonWithIconControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&H",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect,
+ CFStringRefObj_Convert, &title,
+ ControlButtonContentInfo_Convert, &icon,
+ &iconAlignment))
+ return NULL;
+ _err = CreatePushButtonWithIconControl(window,
+ &boundsRect,
+ title,
+ &icon,
+ iconAlignment,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_CreateRadioButtonControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ CFStringRef title;
+ SInt32 initialValue;
+ Boolean autoToggle;
+ ControlHandle outControl;
+#ifndef CreateRadioButtonControl
+ PyMac_PRECHECK(CreateRadioButtonControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&lb",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect,
+ CFStringRefObj_Convert, &title,
+ &initialValue,
+ &autoToggle))
+ return NULL;
+ _err = CreateRadioButtonControl(window,
+ &boundsRect,
+ title,
+ initialValue,
+ autoToggle,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_CreateCheckBoxControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ CFStringRef title;
+ SInt32 initialValue;
+ Boolean autoToggle;
+ ControlHandle outControl;
+#ifndef CreateCheckBoxControl
+ PyMac_PRECHECK(CreateCheckBoxControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&lb",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect,
+ CFStringRefObj_Convert, &title,
+ &initialValue,
+ &autoToggle))
+ return NULL;
+ _err = CreateCheckBoxControl(window,
+ &boundsRect,
+ title,
+ initialValue,
+ autoToggle,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_CreateScrollBarControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ SInt32 value;
+ SInt32 minimum;
+ SInt32 maximum;
+ SInt32 viewSize;
+ Boolean liveTracking;
+ PyObject* liveTrackingProc;
+ UniversalProcPtr c_callback;
+ ControlHandle outControl;
+#ifndef CreateScrollBarControl
+ PyMac_PRECHECK(CreateScrollBarControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&llllbO",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect,
+ &value,
+ &minimum,
+ &maximum,
+ &viewSize,
+ &liveTracking,
+ &liveTrackingProc))
+ return NULL;
+ _err = CreateScrollBarControl(window,
+ &boundsRect,
+ value,
+ minimum,
+ maximum,
+ viewSize,
+ liveTracking,
+ myactionproc_upp,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ setcallback(_res, kMyControlActionProcTag, liveTrackingProc, &c_callback);
+ return _res;
+}
+
+static PyObject *Ctl_CreatePopupButtonControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ CFStringRef title;
+ SInt16 menuID;
+ Boolean variableWidth;
+ SInt16 titleWidth;
+ SInt16 titleJustification;
+ Style titleStyle;
+ ControlHandle outControl;
+#ifndef CreatePopupButtonControl
+ PyMac_PRECHECK(CreatePopupButtonControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&hbhhb",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect,
+ CFStringRefObj_Convert, &title,
+ &menuID,
+ &variableWidth,
+ &titleWidth,
+ &titleJustification,
+ &titleStyle))
+ return NULL;
+ _err = CreatePopupButtonControl(window,
+ &boundsRect,
+ title,
+ menuID,
+ variableWidth,
+ titleWidth,
+ titleJustification,
+ titleStyle,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_CreateRadioGroupControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ ControlHandle outControl;
+#ifndef CreateRadioGroupControl
+ PyMac_PRECHECK(CreateRadioGroupControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect))
+ return NULL;
+ _err = CreateRadioGroupControl(window,
+ &boundsRect,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_CreateScrollingTextBoxControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ SInt16 contentResID;
+ Boolean autoScroll;
+ UInt32 delayBeforeAutoScroll;
+ UInt32 delayBetweenAutoScroll;
+ UInt16 autoScrollAmount;
+ ControlHandle outControl;
+#ifndef CreateScrollingTextBoxControl
+ PyMac_PRECHECK(CreateScrollingTextBoxControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&hbllH",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect,
+ &contentResID,
+ &autoScroll,
+ &delayBeforeAutoScroll,
+ &delayBetweenAutoScroll,
+ &autoScrollAmount))
+ return NULL;
+ _err = CreateScrollingTextBoxControl(window,
+ &boundsRect,
+ contentResID,
+ autoScroll,
+ delayBeforeAutoScroll,
+ delayBetweenAutoScroll,
+ autoScrollAmount,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_CreateDisclosureButtonControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr inWindow;
+ Rect inBoundsRect;
+ SInt32 inValue;
+ Boolean inAutoToggles;
+ ControlHandle outControl;
+#ifndef CreateDisclosureButtonControl
+ PyMac_PRECHECK(CreateDisclosureButtonControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&lb",
+ WinObj_Convert, &inWindow,
+ PyMac_GetRect, &inBoundsRect,
+ &inValue,
+ &inAutoToggles))
+ return NULL;
+ _err = CreateDisclosureButtonControl(inWindow,
+ &inBoundsRect,
+ inValue,
+ inAutoToggles,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_CreateRoundButtonControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr inWindow;
+ Rect inBoundsRect;
+ SInt16 inSize;
+ ControlButtonContentInfo inContent;
+ ControlHandle outControl;
+#ifndef CreateRoundButtonControl
+ PyMac_PRECHECK(CreateRoundButtonControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&hO&",
+ WinObj_Convert, &inWindow,
+ PyMac_GetRect, &inBoundsRect,
+ &inSize,
+ ControlButtonContentInfo_Convert, &inContent))
+ return NULL;
+ _err = CreateRoundButtonControl(inWindow,
+ &inBoundsRect,
+ inSize,
+ &inContent,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_CreateDataBrowserControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ OSType style;
+ ControlHandle outControl;
+#ifndef CreateDataBrowserControl
+ PyMac_PRECHECK(CreateDataBrowserControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect,
+ PyMac_GetOSType, &style))
+ return NULL;
+ _err = CreateDataBrowserControl(window,
+ &boundsRect,
+ style,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_CreateEditUnicodeTextControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ CFStringRef text;
+ Boolean isPassword;
+ ControlFontStyleRec style;
+ ControlHandle outControl;
+#ifndef CreateEditUnicodeTextControl
+ PyMac_PRECHECK(CreateEditUnicodeTextControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&bO&",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect,
+ CFStringRefObj_Convert, &text,
+ &isPassword,
+ ControlFontStyle_Convert, &style))
+ return NULL;
+ _err = CreateEditUnicodeTextControl(window,
+ &boundsRect,
+ text,
+ isPassword,
+ &style,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_FindControlUnderMouse(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ControlHandle _rv;
+ Point inWhere;
+ WindowPtr inWindow;
+ SInt16 outPart;
+#ifndef FindControlUnderMouse
+ PyMac_PRECHECK(FindControlUnderMouse);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetPoint, &inWhere,
+ WinObj_Convert, &inWindow))
+ return NULL;
+ _rv = FindControlUnderMouse(inWhere,
+ inWindow,
+ &outPart);
+ _res = Py_BuildValue("O&h",
+ CtlObj_WhichControl, _rv,
+ outPart);
+ return _res;
+}
+
+static PyObject *Ctl_as_Control(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ControlHandle _rv;
+ Handle h;
+#ifndef as_Control
+ PyMac_PRECHECK(as_Control);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &h))
+ return NULL;
+ _rv = as_Control(h);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Ctl_CreateTabsControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ UInt16 size;
+ UInt16 direction;
+ int i;
+ UInt16 numTabs;
+ ControlTabEntry tabArray[MAXTABS];
+ ControlHandle outControl;
+ PyObject *tabArrayObj, *tabEntry;
+
+#ifndef CreateTabsControl
+ PyMac_PRECHECK(CreateTabsControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&HHO",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect,
+ &size,
+ &direction,
+ &tabArrayObj))
+ return NULL;
+
+ i = PySequence_Length(tabArrayObj);
+ if (i == -1)
+ return NULL;
+ if (i > MAXTABS) {
+ PyErr_SetString(Ctl_Error, "Too many tabs");
+ return NULL;
+ }
+ numTabs = i;
+ for (i=0; i<numTabs; i++) {
+ tabEntry = PySequence_GetItem(tabArrayObj, i);
+ if (tabEntry == NULL)
+ return NULL;
+ if (!PyArg_Parse(tabEntry, "(O&O&B)",
+ ControlButtonContentInfo_Convert, &tabArray[i].icon,
+ CFStringRefObj_Convert, &tabArray[i].name,
+ &tabArray[i].enabled
+ ))
+ return NULL;
+ }
+
+ _err = CreateTabsControl(window,
+ &boundsRect,
+ size,
+ direction,
+ numTabs,
+ tabArray,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+
+static PyMethodDef Ctl_methods[] = {
+ {"NewControl", (PyCFunction)Ctl_NewControl, 1,
+ PyDoc_STR("(WindowPtr owningWindow, Rect boundsRect, Str255 controlTitle, Boolean initiallyVisible, SInt16 initialValue, SInt16 minimumValue, SInt16 maximumValue, SInt16 procID, SInt32 controlReference) -> (ControlHandle _rv)")},
+ {"GetNewControl", (PyCFunction)Ctl_GetNewControl, 1,
+ PyDoc_STR("(SInt16 resourceID, WindowPtr owningWindow) -> (ControlHandle _rv)")},
+ {"DrawControls", (PyCFunction)Ctl_DrawControls, 1,
+ PyDoc_STR("(WindowPtr theWindow) -> None")},
+ {"UpdateControls", (PyCFunction)Ctl_UpdateControls, 1,
+ PyDoc_STR("(WindowPtr inWindow, RgnHandle inUpdateRegion) -> None")},
+ {"FindControl", (PyCFunction)Ctl_FindControl, 1,
+ PyDoc_STR("(Point testPoint, WindowPtr theWindow) -> (ControlPartCode _rv, ControlHandle theControl)")},
+ {"IdleControls", (PyCFunction)Ctl_IdleControls, 1,
+ PyDoc_STR("(WindowPtr inWindow) -> None")},
+ {"GetControlByID", (PyCFunction)Ctl_GetControlByID, 1,
+ PyDoc_STR("(WindowPtr inWindow, ControlID inID) -> (ControlHandle outControl)")},
+ {"DumpControlHierarchy", (PyCFunction)Ctl_DumpControlHierarchy, 1,
+ PyDoc_STR("(WindowPtr inWindow, FSSpec inDumpFile) -> None")},
+ {"CreateRootControl", (PyCFunction)Ctl_CreateRootControl, 1,
+ PyDoc_STR("(WindowPtr inWindow) -> (ControlHandle outControl)")},
+ {"GetRootControl", (PyCFunction)Ctl_GetRootControl, 1,
+ PyDoc_STR("(WindowPtr inWindow) -> (ControlHandle outControl)")},
+ {"GetKeyboardFocus", (PyCFunction)Ctl_GetKeyboardFocus, 1,
+ PyDoc_STR("(WindowPtr inWindow) -> (ControlHandle outControl)")},
+ {"SetKeyboardFocus", (PyCFunction)Ctl_SetKeyboardFocus, 1,
+ PyDoc_STR("(WindowPtr inWindow, ControlHandle inControl, ControlFocusPart inPart) -> None")},
+ {"AdvanceKeyboardFocus", (PyCFunction)Ctl_AdvanceKeyboardFocus, 1,
+ PyDoc_STR("(WindowPtr inWindow) -> None")},
+ {"ReverseKeyboardFocus", (PyCFunction)Ctl_ReverseKeyboardFocus, 1,
+ PyDoc_STR("(WindowPtr inWindow) -> None")},
+ {"ClearKeyboardFocus", (PyCFunction)Ctl_ClearKeyboardFocus, 1,
+ PyDoc_STR("(WindowPtr inWindow) -> None")},
+ {"SetAutomaticControlDragTrackingEnabledForWindow", (PyCFunction)Ctl_SetAutomaticControlDragTrackingEnabledForWindow, 1,
+ PyDoc_STR("(WindowPtr inWindow, Boolean inTracks) -> None")},
+ {"IsAutomaticControlDragTrackingEnabledForWindow", (PyCFunction)Ctl_IsAutomaticControlDragTrackingEnabledForWindow, 1,
+ PyDoc_STR("(WindowPtr inWindow) -> (Boolean outTracks)")},
+ {"CreateBevelButtonControl", (PyCFunction)Ctl_CreateBevelButtonControl, 1,
+ PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef title, UInt16 thickness, UInt16 behavior, ControlButtonContentInfo info, SInt16 menuID, UInt16 menuBehavior, UInt16 menuPlacement) -> (ControlHandle outControl)")},
+ {"CreateSliderControl", (PyCFunction)Ctl_CreateSliderControl, 1,
+ PyDoc_STR("(WindowPtr window, Rect boundsRect, SInt32 value, SInt32 minimum, SInt32 maximum, UInt16 orientation, UInt16 numTickMarks, Boolean liveTracking, PyObject* liveTrackingProc) -> (ControlHandle outControl)")},
+ {"CreateDisclosureTriangleControl", (PyCFunction)Ctl_CreateDisclosureTriangleControl, 1,
+ PyDoc_STR("(WindowPtr inWindow, Rect inBoundsRect, UInt16 inOrientation, CFStringRef inTitle, SInt32 inInitialValue, Boolean inDrawTitle, Boolean inAutoToggles) -> (ControlHandle outControl)")},
+ {"CreateProgressBarControl", (PyCFunction)Ctl_CreateProgressBarControl, 1,
+ PyDoc_STR("(WindowPtr window, Rect boundsRect, SInt32 value, SInt32 minimum, SInt32 maximum, Boolean indeterminate) -> (ControlHandle outControl)")},
+ {"CreateRelevanceBarControl", (PyCFunction)Ctl_CreateRelevanceBarControl, 1,
+ PyDoc_STR("(WindowPtr window, Rect boundsRect, SInt32 value, SInt32 minimum, SInt32 maximum) -> (ControlHandle outControl)")},
+ {"CreateLittleArrowsControl", (PyCFunction)Ctl_CreateLittleArrowsControl, 1,
+ PyDoc_STR("(WindowPtr window, Rect boundsRect, SInt32 value, SInt32 minimum, SInt32 maximum, SInt32 increment) -> (ControlHandle outControl)")},
+ {"CreateChasingArrowsControl", (PyCFunction)Ctl_CreateChasingArrowsControl, 1,
+ PyDoc_STR("(WindowPtr window, Rect boundsRect) -> (ControlHandle outControl)")},
+ {"CreateSeparatorControl", (PyCFunction)Ctl_CreateSeparatorControl, 1,
+ PyDoc_STR("(WindowPtr window, Rect boundsRect) -> (ControlHandle outControl)")},
+ {"CreateGroupBoxControl", (PyCFunction)Ctl_CreateGroupBoxControl, 1,
+ PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef title, Boolean primary) -> (ControlHandle outControl)")},
+ {"CreateCheckGroupBoxControl", (PyCFunction)Ctl_CreateCheckGroupBoxControl, 1,
+ PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef title, SInt32 initialValue, Boolean primary, Boolean autoToggle) -> (ControlHandle outControl)")},
+ {"CreatePopupGroupBoxControl", (PyCFunction)Ctl_CreatePopupGroupBoxControl, 1,
+ PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef title, Boolean primary, SInt16 menuID, Boolean variableWidth, SInt16 titleWidth, SInt16 titleJustification, Style titleStyle) -> (ControlHandle outControl)")},
+ {"CreateImageWellControl", (PyCFunction)Ctl_CreateImageWellControl, 1,
+ PyDoc_STR("(WindowPtr window, Rect boundsRect, ControlButtonContentInfo info) -> (ControlHandle outControl)")},
+ {"CreatePopupArrowControl", (PyCFunction)Ctl_CreatePopupArrowControl, 1,
+ PyDoc_STR("(WindowPtr window, Rect boundsRect, UInt16 orientation, UInt16 size) -> (ControlHandle outControl)")},
+ {"CreatePlacardControl", (PyCFunction)Ctl_CreatePlacardControl, 1,
+ PyDoc_STR("(WindowPtr window, Rect boundsRect) -> (ControlHandle outControl)")},
+ {"CreateClockControl", (PyCFunction)Ctl_CreateClockControl, 1,
+ PyDoc_STR("(WindowPtr window, Rect boundsRect, UInt16 clockType, UInt32 clockFlags) -> (ControlHandle outControl)")},
+ {"CreateUserPaneControl", (PyCFunction)Ctl_CreateUserPaneControl, 1,
+ PyDoc_STR("(WindowPtr window, Rect boundsRect, UInt32 features) -> (ControlHandle outControl)")},
+ {"CreateEditTextControl", (PyCFunction)Ctl_CreateEditTextControl, 1,
+ PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef text, Boolean isPassword, Boolean useInlineInput, ControlFontStyleRec style) -> (ControlHandle outControl)")},
+ {"CreateStaticTextControl", (PyCFunction)Ctl_CreateStaticTextControl, 1,
+ PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef text, ControlFontStyleRec style) -> (ControlHandle outControl)")},
+ {"CreatePictureControl", (PyCFunction)Ctl_CreatePictureControl, 1,
+ PyDoc_STR("(WindowPtr window, Rect boundsRect, ControlButtonContentInfo content, Boolean dontTrack) -> (ControlHandle outControl)")},
+ {"CreateIconControl", (PyCFunction)Ctl_CreateIconControl, 1,
+ PyDoc_STR("(WindowPtr inWindow, Rect inBoundsRect, ControlButtonContentInfo inIconContent, Boolean inDontTrack) -> (ControlHandle outControl)")},
+ {"CreateWindowHeaderControl", (PyCFunction)Ctl_CreateWindowHeaderControl, 1,
+ PyDoc_STR("(WindowPtr window, Rect boundsRect, Boolean isListHeader) -> (ControlHandle outControl)")},
+ {"CreatePushButtonControl", (PyCFunction)Ctl_CreatePushButtonControl, 1,
+ PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef title) -> (ControlHandle outControl)")},
+ {"CreatePushButtonWithIconControl", (PyCFunction)Ctl_CreatePushButtonWithIconControl, 1,
+ PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef title, ControlButtonContentInfo icon, UInt16 iconAlignment) -> (ControlHandle outControl)")},
+ {"CreateRadioButtonControl", (PyCFunction)Ctl_CreateRadioButtonControl, 1,
+ PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef title, SInt32 initialValue, Boolean autoToggle) -> (ControlHandle outControl)")},
+ {"CreateCheckBoxControl", (PyCFunction)Ctl_CreateCheckBoxControl, 1,
+ PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef title, SInt32 initialValue, Boolean autoToggle) -> (ControlHandle outControl)")},
+ {"CreateScrollBarControl", (PyCFunction)Ctl_CreateScrollBarControl, 1,
+ PyDoc_STR("(WindowPtr window, Rect boundsRect, SInt32 value, SInt32 minimum, SInt32 maximum, SInt32 viewSize, Boolean liveTracking, PyObject* liveTrackingProc) -> (ControlHandle outControl)")},
+ {"CreatePopupButtonControl", (PyCFunction)Ctl_CreatePopupButtonControl, 1,
+ PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef title, SInt16 menuID, Boolean variableWidth, SInt16 titleWidth, SInt16 titleJustification, Style titleStyle) -> (ControlHandle outControl)")},
+ {"CreateRadioGroupControl", (PyCFunction)Ctl_CreateRadioGroupControl, 1,
+ PyDoc_STR("(WindowPtr window, Rect boundsRect) -> (ControlHandle outControl)")},
+ {"CreateScrollingTextBoxControl", (PyCFunction)Ctl_CreateScrollingTextBoxControl, 1,
+ PyDoc_STR("(WindowPtr window, Rect boundsRect, SInt16 contentResID, Boolean autoScroll, UInt32 delayBeforeAutoScroll, UInt32 delayBetweenAutoScroll, UInt16 autoScrollAmount) -> (ControlHandle outControl)")},
+ {"CreateDisclosureButtonControl", (PyCFunction)Ctl_CreateDisclosureButtonControl, 1,
+ PyDoc_STR("(WindowPtr inWindow, Rect inBoundsRect, SInt32 inValue, Boolean inAutoToggles) -> (ControlHandle outControl)")},
+ {"CreateRoundButtonControl", (PyCFunction)Ctl_CreateRoundButtonControl, 1,
+ PyDoc_STR("(WindowPtr inWindow, Rect inBoundsRect, SInt16 inSize, ControlButtonContentInfo inContent) -> (ControlHandle outControl)")},
+ {"CreateDataBrowserControl", (PyCFunction)Ctl_CreateDataBrowserControl, 1,
+ PyDoc_STR("(WindowPtr window, Rect boundsRect, OSType style) -> (ControlHandle outControl)")},
+ {"CreateEditUnicodeTextControl", (PyCFunction)Ctl_CreateEditUnicodeTextControl, 1,
+ PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef text, Boolean isPassword, ControlFontStyleRec style) -> (ControlHandle outControl)")},
+ {"FindControlUnderMouse", (PyCFunction)Ctl_FindControlUnderMouse, 1,
+ PyDoc_STR("(Point inWhere, WindowPtr inWindow) -> (ControlHandle _rv, SInt16 outPart)")},
+ {"as_Control", (PyCFunction)Ctl_as_Control, 1,
+ PyDoc_STR("(Handle h) -> (ControlHandle _rv)")},
+ {"CreateTabsControl", (PyCFunction)Ctl_CreateTabsControl, 1,
+ PyDoc_STR("(WindowPtr window, Rect boundsRect, UInt16 size, UInt16 direction, ControlTabEntry tabArray) -> (ControlHandle outControl)")},
+ {NULL, NULL, 0}
+};
+
+
+
+static PyObject *
+CtlObj_NewUnmanaged(ControlHandle itself)
+{
+ ControlObject *it;
+ if (itself == NULL) return PyMac_Error(resNotFound);
+ it = PyObject_NEW(ControlObject, &Control_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ it->ob_callbackdict = NULL;
+ return (PyObject *)it;
+}
+
+static PyObject *
+CtlObj_WhichControl(ControlHandle c)
+{
+ PyObject *it;
+
+ if (c == NULL)
+ it = Py_None;
+ else {
+ it = (PyObject *) GetControlReference(c);
+ /*
+ ** If the refcon is zero or doesn't point back to the Python object
+ ** the control is not ours. Return a temporary object.
+ */
+ if (it == NULL || ((ControlObject *)it)->ob_itself != c)
+ return CtlObj_NewUnmanaged(c);
+ }
+ Py_INCREF(it);
+ return it;
+}
+
+static int
+settrackfunc(PyObject *obj)
+{
+ if (tracker) {
+ PyErr_SetString(Ctl_Error, "Tracker function in use");
+ return 0;
+ }
+ tracker = obj;
+ Py_INCREF(tracker);
+ return 1;
+}
+
+static void
+clrtrackfunc(void)
+{
+ Py_XDECREF(tracker);
+ tracker = 0;
+}
+
+static pascal void
+mytracker(ControlHandle ctl, short part)
+{
+ PyObject *args, *rv=0;
+
+ args = Py_BuildValue("(O&i)", CtlObj_WhichControl, ctl, (int)part);
+ if (args && tracker) {
+ rv = PyEval_CallObject(tracker, args);
+ Py_DECREF(args);
+ }
+ if (rv)
+ Py_DECREF(rv);
+ else {
+ PySys_WriteStderr("TrackControl or HandleControlClick: exception in tracker function\n");
+ PyErr_Print();
+ }
+}
+
+static int
+setcallback(PyObject *myself, OSType which, PyObject *callback, UniversalProcPtr *uppp)
+{
+ ControlObject *self = (ControlObject *)myself;
+ char keybuf[9];
+
+ if ( which == kMyControlActionProcTag )
+ *uppp = (UniversalProcPtr)myactionproc_upp;
+ else if ( which == kControlUserPaneKeyDownProcTag )
+ *uppp = (UniversalProcPtr)mykeydownproc_upp;
+ else if ( which == kControlUserPaneFocusProcTag )
+ *uppp = (UniversalProcPtr)myfocusproc_upp;
+ else if ( which == kControlUserPaneDrawProcTag )
+ *uppp = (UniversalProcPtr)mydrawproc_upp;
+ else if ( which == kControlUserPaneIdleProcTag )
+ *uppp = (UniversalProcPtr)myidleproc_upp;
+ else if ( which == kControlUserPaneHitTestProcTag )
+ *uppp = (UniversalProcPtr)myhittestproc_upp;
+ else if ( which == kControlUserPaneTrackingProcTag )
+ *uppp = (UniversalProcPtr)mytrackingproc_upp;
+ else
+ return -1;
+ /* Only now do we test for clearing of the callback: */
+ if ( callback == Py_None )
+ *uppp = NULL;
+ /* Create the dict if it doesn't exist yet (so we don't get such a dict for every control) */
+ if ( self->ob_callbackdict == NULL )
+ if ( (self->ob_callbackdict = PyDict_New()) == NULL )
+ return -1;
+ /* And store the Python callback */
+ sprintf(keybuf, "%x", (unsigned)which);
+ if (PyDict_SetItemString(self->ob_callbackdict, keybuf, callback) < 0)
+ return -1;
+ return 0;
+}
+
+static PyObject *
+callcallback(ControlObject *self, OSType which, PyObject *arglist)
+{
+ char keybuf[9];
+ PyObject *func, *rv;
+
+ sprintf(keybuf, "%x", (unsigned)which);
+ if ( self->ob_callbackdict == NULL ||
+ (func = PyDict_GetItemString(self->ob_callbackdict, keybuf)) == NULL ) {
+ PySys_WriteStderr("Control callback %x without callback object\n", (unsigned)which);
+ return NULL;
+ }
+ rv = PyEval_CallObject(func, arglist);
+ if ( rv == NULL ) {
+ PySys_WriteStderr("Exception in control callback %x handler\n", (unsigned)which);
+ PyErr_Print();
+ }
+ return rv;
+}
+
+static pascal void
+myactionproc(ControlHandle control, SInt16 part)
+{
+ ControlObject *ctl_obj;
+ PyObject *arglist, *rv;
+
+ ctl_obj = (ControlObject *)CtlObj_WhichControl(control);
+ arglist = Py_BuildValue("Oh", ctl_obj, part);
+ rv = callcallback(ctl_obj, kMyControlActionProcTag, arglist);
+ Py_XDECREF(arglist);
+ Py_XDECREF(rv);
+}
+
+static pascal ControlPartCode
+mykeydownproc(ControlHandle control, SInt16 keyCode, SInt16 charCode, SInt16 modifiers)
+{
+ ControlObject *ctl_obj;
+ PyObject *arglist, *rv;
+ short c_rv = 0;
+
+ ctl_obj = (ControlObject *)CtlObj_WhichControl(control);
+ arglist = Py_BuildValue("Ohhh", ctl_obj, keyCode, charCode, modifiers);
+ rv = callcallback(ctl_obj, kControlUserPaneKeyDownProcTag, arglist);
+ Py_XDECREF(arglist);
+ if ( rv )
+ if (!PyArg_Parse(rv, "h", &c_rv))
+ PyErr_Clear();
+ Py_XDECREF(rv);
+ return (ControlPartCode)c_rv;
+}
+
+static pascal ControlPartCode
+myfocusproc(ControlHandle control, ControlPartCode part)
+{
+ ControlObject *ctl_obj;
+ PyObject *arglist, *rv;
+ short c_rv = kControlFocusNoPart;
+
+ ctl_obj = (ControlObject *)CtlObj_WhichControl(control);
+ arglist = Py_BuildValue("Oh", ctl_obj, part);
+ rv = callcallback(ctl_obj, kControlUserPaneFocusProcTag, arglist);
+ Py_XDECREF(arglist);
+ if ( rv )
+ if (!PyArg_Parse(rv, "h", &c_rv))
+ PyErr_Clear();
+ Py_XDECREF(rv);
+ return (ControlPartCode)c_rv;
+}
+
+static pascal void
+mydrawproc(ControlHandle control, SInt16 part)
+{
+ ControlObject *ctl_obj;
+ PyObject *arglist, *rv;
+
+ ctl_obj = (ControlObject *)CtlObj_WhichControl(control);
+ arglist = Py_BuildValue("Oh", ctl_obj, part);
+ rv = callcallback(ctl_obj, kControlUserPaneDrawProcTag, arglist);
+ Py_XDECREF(arglist);
+ Py_XDECREF(rv);
+}
+
+static pascal void
+myidleproc(ControlHandle control)
+{
+ ControlObject *ctl_obj;
+ PyObject *arglist, *rv;
+
+ ctl_obj = (ControlObject *)CtlObj_WhichControl(control);
+ arglist = Py_BuildValue("O", ctl_obj);
+ rv = callcallback(ctl_obj, kControlUserPaneIdleProcTag, arglist);
+ Py_XDECREF(arglist);
+ Py_XDECREF(rv);
+}
+
+static pascal ControlPartCode
+myhittestproc(ControlHandle control, Point where)
+{
+ ControlObject *ctl_obj;
+ PyObject *arglist, *rv;
+ short c_rv = -1;
+
+ ctl_obj = (ControlObject *)CtlObj_WhichControl(control);
+ arglist = Py_BuildValue("OO&", ctl_obj, PyMac_BuildPoint, where);
+ rv = callcallback(ctl_obj, kControlUserPaneHitTestProcTag, arglist);
+ Py_XDECREF(arglist);
+ /* Ignore errors, nothing we can do about them */
+ if ( rv )
+ if (!PyArg_Parse(rv, "h", &c_rv))
+ PyErr_Clear();
+ Py_XDECREF(rv);
+ return (ControlPartCode)c_rv;
+}
+
+static pascal ControlPartCode
+mytrackingproc(ControlHandle control, Point startPt, ControlActionUPP actionProc)
+{
+ ControlObject *ctl_obj;
+ PyObject *arglist, *rv;
+ short c_rv = -1;
+
+ ctl_obj = (ControlObject *)CtlObj_WhichControl(control);
+ /* We cannot pass the actionProc without lots of work */
+ arglist = Py_BuildValue("OO&", ctl_obj, PyMac_BuildPoint, startPt);
+ rv = callcallback(ctl_obj, kControlUserPaneTrackingProcTag, arglist);
+ Py_XDECREF(arglist);
+ if ( rv )
+ if (!PyArg_Parse(rv, "h", &c_rv))
+ PyErr_Clear();
+ Py_XDECREF(rv);
+ 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);
+ myfocusproc_upp = NewControlUserPaneFocusUPP(myfocusproc);
+ mydrawproc_upp = NewControlUserPaneDrawUPP(mydrawproc);
+ myidleproc_upp = NewControlUserPaneIdleUPP(myidleproc);
+ myhittestproc_upp = NewControlUserPaneHitTestUPP(myhittestproc);
+ 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 ||
+ PyDict_SetItemString(d, "Error", Ctl_Error) != 0)
+ return;
+ Control_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&Control_Type) < 0) return;
+ Py_INCREF(&Control_Type);
+ PyModule_AddObject(m, "Control", (PyObject *)&Control_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&Control_Type);
+ PyModule_AddObject(m, "ControlType", (PyObject *)&Control_Type);
+#endif /* !__LP64__ */
+}
+
+/* ======================== End module _Ctl ========================= */
+
diff --git a/Mac/Modules/ctl/ctledit.py b/Mac/Modules/ctl/ctledit.py
new file mode 100644
index 0000000000..fdd9712c3f
--- /dev/null
+++ b/Mac/Modules/ctl/ctledit.py
@@ -0,0 +1,45 @@
+# FindControlUnderMouse() returns an existing control, not a new one,
+# so create this one by hand.
+f = Function(ExistingControlHandle, 'FindControlUnderMouse',
+ (Point, 'inWhere', InMode),
+ (WindowRef, 'inWindow', InMode),
+ (SInt16, 'outPart', OutMode),
+)
+functions.append(f)
+
+f = Function(ControlHandle, 'as_Control',
+ (Handle, 'h', InMode))
+functions.append(f)
+
+f = Method(Handle, 'as_Resource', (ControlHandle, 'ctl', InMode))
+methods.append(f)
+
+f = Method(void, 'GetControlRect', (ControlHandle, 'ctl', InMode), (Rect, 'rect', OutMode))
+methods.append(f)
+
+DisposeControl_body = """
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ if ( _self->ob_itself ) {
+ SetControlReference(_self->ob_itself, (long)0); /* Make it forget about us */
+ DisposeControl(_self->ob_itself);
+ _self->ob_itself = NULL;
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+"""
+
+f = ManualGenerator("DisposeControl", DisposeControl_body)
+f.docstring = lambda : "() -> None"
+
+methods.append(f)
+
+# All CreateXxxXxxControl() functions return a new object in an output
+# parameter; these should however be managed by us (we're creating them
+# after all), so set the type to ControlRef.
+for f in functions:
+ if f.name.startswith("Create"):
+ v = f.argumentList[-1]
+ if v.type == ExistingControlHandle:
+ v.type = ControlRef
diff --git a/Mac/Modules/ctl/ctlscan.py b/Mac/Modules/ctl/ctlscan.py
new file mode 100644
index 0000000000..9cb30d15c1
--- /dev/null
+++ b/Mac/Modules/ctl/ctlscan.py
@@ -0,0 +1,171 @@
+# Scan <Controls.h>, generating ctlgen.py.
+import sys
+from bgenlocations import TOOLBOXDIR, BGENDIR
+sys.path.append(BGENDIR)
+
+from scantools import Scanner
+
+def main():
+# input = "Controls.h" # Universal Headers < 3.3
+ input = ["Controls.h", "ControlDefinitions.h"] # Universal Headers >= 3.3
+ output = "ctlgen.py"
+ defsoutput = TOOLBOXDIR + "Controls.py"
+ scanner = MyScanner(input, output, defsoutput)
+ scanner.scan()
+ scanner.close()
+ print "=== Testing definitions output code ==="
+ execfile(defsoutput, {}, {})
+ print "=== Done scanning and generating, now doing 'import ctlsupport' ==="
+ import ctlsupport
+ print "=== Done. It's up to you to compile Ctlmodule.c ==="
+
+class MyScanner(Scanner):
+
+ def destination(self, type, name, arglist):
+ classname = "Function"
+ listname = "functions"
+ if arglist:
+ t, n, m = arglist[0]
+ if t in ("ControlHandle", "ControlRef") and m == "InMode":
+ classname = "Method"
+ listname = "methods"
+ return classname, listname
+
+ def writeinitialdefs(self):
+ self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
+ self.defsfile.write("from Carbon.TextEdit import *\n")
+ self.defsfile.write("from Carbon.QuickDraw import *\n")
+ self.defsfile.write("from Carbon.Dragconst import *\n")
+ self.defsfile.write("from Carbon.CarbonEvents import *\n")
+ self.defsfile.write("from Carbon.Appearance import *\n")
+ self.defsfile.write("kDataBrowserItemAnyState = -1\n")
+ self.defsfile.write("kControlBevelButtonCenterPopupGlyphTag = -1\n")
+ self.defsfile.write("kDataBrowserClientPropertyFlagsMask = 0xFF000000\n")
+ self.defsfile.write("\n")
+
+ def makeblacklistnames(self):
+ return [
+ 'FindControlUnderMouse', # Generated manually, returns an existing control, not a new one.
+ 'DisposeControl', # Generated manually
+ 'KillControls', # Implied by close of dialog
+ 'SetCtlAction',
+ 'TrackControl', # Generated manually
+ 'HandleControlClick', # Generated manually
+ 'SetControlData', # Generated manually
+ 'GetControlData', # Generated manually
+ 'kControlBevelButtonCenterPopupGlyphTag', # Constant with funny definition
+ 'kDataBrowserClientPropertyFlagsMask', # ditto
+ 'kDataBrowserItemAnyState', # and ditto
+ # The following are unavailable for static 68k (appearance manager)
+## 'GetBevelButtonMenuValue',
+## 'SetBevelButtonMenuValue',
+## 'GetBevelButtonMenuHandle',
+## 'SetBevelButtonTransform',
+ 'SetBevelButtonGraphicAlignment',
+ 'SetBevelButtonTextAlignment',
+ 'SetBevelButtonTextPlacement',
+## 'SetImageWellTransform',
+## 'GetTabContentRect',
+## 'SetTabEnabled',
+## 'SetDisclosureTriangleLastValue',
+## # Unavailable in CW Pro 3 libraries
+## 'SetUpControlTextColor',
+## # Unavailable in Jack's CW Pro 5.1 libraries
+## 'GetControlRegion',
+## 'RemoveControlProperty',
+## 'IsValidControlHandle',
+## 'SetControl32BitMinimum',
+## 'GetControl32BitMinimum',
+## 'SetControl32BitMaximum',
+## 'GetControl32BitMaximum',
+## 'SetControl32BitValue',
+## 'GetControl32BitValue',
+## 'SetControlViewSize',
+## 'GetControlViewSize',
+ # Generally Bad News
+ 'GetControlProperty',
+ 'SetControlProperty',
+ 'GetControlPropertySize',
+ 'SendControlMessage', # Parameter changed from long to void* from UH3.3 to UH3.4
+ 'CreateTabsControl', # wrote manually
+ 'GetControlAction', # too much effort for too little usefulness
+
+ # too lazy for now
+ 'GetImageWellContentInfo',
+ 'GetBevelButtonContentInfo',
+ # OS8 only
+ 'GetAuxiliaryControlRecord',
+ 'SetControlColor',
+ ]
+
+ def makeblacklisttypes(self):
+ return [
+ 'ProcPtr',
+# 'ControlActionUPP',
+ 'Ptr',
+ 'ControlDefSpec', # Don't know how to do this yet
+ 'ControlDefSpec_ptr', # ditto
+ 'Collection', # Ditto
+ # not-yet-supported stuff in Universal Headers 3.4:
+ 'ControlColorUPP',
+ 'ControlKind', # XXX easy: 2-tuple containing 2 OSType's
+# 'ControlTabEntry_ptr', # XXX needed for tabs
+# 'ControlButtonContentInfoPtr',
+# 'ControlButtonContentInfo', # XXX ugh: a union
+# 'ControlButtonContentInfo_ptr', # XXX ugh: a union
+ 'ListDefSpec_ptr', # XXX see _Listmodule.c, tricky but possible
+ 'DataBrowserItemID_ptr', # XXX array of UInt32, for BrowserView
+ 'DataBrowserItemUPP',
+ 'DataBrowserItemDataRef', # XXX void *
+ 'DataBrowserCallbacks', # difficult struct
+ 'DataBrowserCallbacks_ptr',
+ 'DataBrowserCustomCallbacks',
+ 'DataBrowserCustomCallbacks_ptr',
+## 'DataBrowserTableViewColumnDesc',
+## 'DataBrowserListViewColumnDesc',
+ 'CFDataRef',
+ 'DataBrowserListViewHeaderDesc', # difficult struct
+ ]
+
+ def makerepairinstructions(self):
+ return [
+ ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
+ [("InBuffer", "*", "*")]),
+
+ ([("void", "*", "OutMode"), ("long", "*", "InMode"),
+ ("long", "*", "OutMode")],
+ [("VarVarOutBuffer", "*", "InOutMode")]),
+
+## # For TrackControl
+## ([("ProcPtr", "actionProc", "InMode")],
+## [("FakeType('(ControlActionUPP)0')", "*", "*")]),
+## ([("ControlActionUPP", "actionProc", "InMode")],
+## [("FakeType('(ControlActionUPP)0')", "*", "*")]),
+
+ # For GetControlTitle
+ ([('Str255', 'title', 'InMode')],
+ [('Str255', 'title', 'OutMode')]),
+
+ ([("ControlHandle", "*", "OutMode")],
+ [("ExistingControlHandle", "*", "*")]),
+ ([("ControlRef", "*", "OutMode")], # Ditto, for Universal Headers
+ [("ExistingControlHandle", "*", "*")]),
+
+ ([("Rect_ptr", "*", "ReturnMode")], # GetControlBounds
+ [("void", "*", "ReturnMode")]),
+
+ ([("DataBrowserListViewColumnDesc", "*", "OutMode")],
+ [("DataBrowserListViewColumnDesc", "*", "InMode")]),
+
+ ([("ControlButtonContentInfoPtr", 'outContent', "InMode")],
+ [("ControlButtonContentInfoPtr", '*', "OutMode")]),
+
+ ([("ControlButtonContentInfo", '*', "OutMode")],
+ [("ControlButtonContentInfo", '*', "InMode")]),
+
+ ([("ControlActionUPP", 'liveTrackingProc', "InMode")],
+ [("ControlActionUPPNewControl", 'liveTrackingProc', "InMode")]),
+ ]
+
+if __name__ == "__main__":
+ main()
diff --git a/Mac/Modules/ctl/ctlsupport.py b/Mac/Modules/ctl/ctlsupport.py
new file mode 100644
index 0000000000..d354d94276
--- /dev/null
+++ b/Mac/Modules/ctl/ctlsupport.py
@@ -0,0 +1,826 @@
+# This script generates a Python interface for an Apple Macintosh Manager.
+# It uses the "bgen" package to generate C code.
+# The function specifications are generated by scanning the mamager's header file,
+# using the "scantools" package (customized for this particular manager).
+
+import string
+
+# Declarations that change for each manager
+MACHEADERFILE = 'Controls.h' # The Apple header file
+MODNAME = '_Ctl' # The name of the module
+OBJECTNAME = 'Control' # The basic name of the objects used here
+
+# The following is *usually* unchanged but may still require tuning
+MODPREFIX = 'Ctl' # The prefix for module-wide routines
+OBJECTTYPE = OBJECTNAME + 'Handle' # The C type used to represent them
+OBJECTPREFIX = MODPREFIX + 'Obj' # The prefix for object methods
+INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner
+OUTPUTFILE = MODNAME + "module.c" # The file generated by this program
+
+from macsupport import *
+
+# Create the type objects
+
+ControlHandle = OpaqueByValueType(OBJECTTYPE, OBJECTPREFIX)
+ControlRef = ControlHandle
+ExistingControlHandle = OpaqueByValueType(OBJECTTYPE, "CtlObj_WhichControl", "BUG")
+
+RgnHandle = OpaqueByValueType("RgnHandle", "ResObj")
+CCTabHandle = OpaqueByValueType("CCTabHandle", "ResObj")
+AuxCtlHandle = OpaqueByValueType("AuxCtlHandle", "ResObj")
+ControlPartCode = Type("ControlPartCode", "h")
+DragConstraint = Type("DragConstraint", "H")
+ControlVariant = Type("ControlVariant", "h")
+IconTransformType = Type("IconTransformType", "h")
+EventModifiers = Type("EventModifiers", "H")
+ClickActivationResult = Type("ClickActivationResult", "l")
+ControlButtonGraphicAlignment = Type("ControlButtonGraphicAlignment", "h")
+ControlButtonTextAlignment = Type("ControlButtonTextAlignment", "h")
+ControlButtonTextPlacement = Type("ControlButtonTextPlacement", "h")
+ControlContentType = Type("ControlContentType", "h")
+ControlFocusPart = Type("ControlFocusPart", "h")
+
+ControlFontStyleRec = OpaqueType('ControlFontStyleRec', 'ControlFontStyle')
+ControlFontStyleRec_ptr = ControlFontStyleRec
+ControlID = OpaqueType('ControlID', 'PyControlID')
+ControlID_ptr = ControlID
+
+DragTrackingMessage = Type("DragTrackingMessage", "h")
+DragReference = OpaqueByValueType("DragReference", "DragObj")
+
+CFStringRef = OpaqueByValueType("CFStringRef", "CFStringRefObj")
+CFMutableStringRef = OpaqueByValueType("CFMutableStringRef", "CFMutableStringRefObj")
+CFDataRef = OpaqueByValueType("CFDataRef", "CFDataRefObj")
+
+ControlTabSize = UInt16
+ControlTabDirection = UInt16
+ControlPopupArrowOrientation = UInt16
+ControlPopupArrowSize = UInt16
+ControlClockType = UInt16
+ControlClockFlags = UInt32
+ControlRoundButtonSize = SInt16
+DataBrowserViewStyle = OSType
+DataBrowserItemID = UInt32
+DataBrowserEditCommand = UInt32
+DataBrowserSelectionAnchorDirection = UInt32
+DataBrowserItemState = UInt32
+DataBrowserPropertyID = UInt32
+DataBrowserRevealOptions = UInt8
+DataBrowserSortOrder = UInt16
+DataBrowserSelectionFlags = UInt32
+DataBrowserPropertyFlags = UInt32
+DataBrowserPropertyPart = OSType
+DataBrowserTableViewColumnID = DataBrowserPropertyID
+#DataBrowserTableViewColumnDesc = DataBrowserPropertyDesc
+DataBrowserTableViewHiliteStyle = UInt32
+DataBrowserTableViewRowIndex = UInt32
+DataBrowserTableViewColumnIndex = UInt32
+DataBrowserPropertyType = OSType
+ControlDisclosureTriangleOrientation = UInt16
+
+DataBrowserTableViewColumnDesc = OpaqueType("DataBrowserTableViewColumnDesc",
+ "DataBrowserTableViewColumnDesc")
+DataBrowserListViewColumnDesc = OpaqueType("DataBrowserListViewColumnDesc",
+ "DataBrowserListViewColumnDesc")
+ControlButtonContentInfo = OpaqueType("ControlButtonContentInfo",
+ "ControlButtonContentInfo")
+ControlButtonContentInfoPtr = ControlButtonContentInfo_ptr = ControlButtonContentInfo
+
+ControlTabEntry_ptr = OpaqueType("ControlTabEntry", "ControlTabEntry")
+
+ControlBevelThickness = UInt16
+ControlBevelButtonBehavior = UInt16
+ControlBevelButtonMenuBehavior = UInt16
+ControlBevelButtonMenuPlacement = UInt16
+ControlPushButtonIconAlignment = UInt16
+
+class ControlActionDefinition(Type):
+ def declare(self, name):
+ Output("%s %s;", self.typeName, name)
+ Output("UniversalProcPtr c_callback;")
+ def passInput(self, name):
+ return "myactionproc_upp"
+ def cleanup(self, name):
+ Output("setcallback((PyObject*)_self, kMyControlActionProcTag, actionProc, &c_callback);")
+
+class ControlActionDefinitionNewControl(ControlActionDefinition):
+ def cleanup(self, name):
+ Output("setcallback(_res, kMyControlActionProcTag, liveTrackingProc, &c_callback);")
+
+ControlActionUPP = ControlActionDefinition("PyObject*", "O")
+ControlActionUPPNewControl = ControlActionDefinitionNewControl("PyObject*", "O")
+ControlSliderOrientation = UInt16
+
+
+includestuff = includestuff + """
+#include <Carbon/Carbon.h>
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_CtlObj_New(ControlHandle);
+extern int _CtlObj_Convert(PyObject *, ControlHandle *);
+
+#define CtlObj_New _CtlObj_New
+#define CtlObj_Convert _CtlObj_Convert
+#endif
+
+static PyObject *CtlObj_WhichControl(ControlHandle);
+
+#define as_Control(h) ((ControlHandle)h)
+#define as_Resource(ctl) ((Handle)ctl)
+#define GetControlRect(ctl, rectp) GetControlBounds(ctl, rectp)
+
+#define MAXTABS 32 /* maximum number of tabs that we support in a tabs control */
+/*
+** Parse/generate ControlFontStyleRec records
+*/
+#if 0 /* Not needed */
+static PyObject *
+ControlFontStyle_New(ControlFontStyleRec *itself)
+{
+
+ return Py_BuildValue("hhhhhhO&O&", itself->flags, itself->font,
+ itself->size, itself->style, itself->mode, itself->just,
+ QdRGB_New, &itself->foreColor, QdRGB_New, &itself->backColor);
+}
+#endif
+
+static int
+ControlFontStyle_Convert(PyObject *v, ControlFontStyleRec *itself)
+{
+ return PyArg_Parse(v, "(hhhhhhO&O&)", &itself->flags,
+ &itself->font, &itself->size, &itself->style, &itself->mode,
+ &itself->just, QdRGB_Convert, &itself->foreColor,
+ QdRGB_Convert, &itself->backColor);
+}
+
+/*
+** Parse/generate ControlID records
+*/
+static PyObject *
+PyControlID_New(ControlID *itself)
+{
+
+ return Py_BuildValue("O&l", PyMac_BuildOSType, itself->signature, itself->id);
+}
+
+static int
+PyControlID_Convert(PyObject *v, ControlID *itself)
+{
+ return PyArg_Parse(v, "(O&l)", PyMac_GetOSType, &itself->signature, &itself->id);
+}
+
+/*
+** generate DataBrowserListViewColumnDesc records
+*/
+static int
+DataBrowserTableViewColumnDesc_Convert(PyObject *v, DataBrowserTableViewColumnDesc *itself)
+{
+ return PyArg_Parse(v, "(lO&l)",
+ &itself->propertyID,
+ PyMac_GetOSType, &itself->propertyType,
+ &itself->propertyFlags);
+}
+
+static int
+ControlButtonContentInfo_Convert(PyObject *v, ControlButtonContentInfo *itself)
+{
+ return PyArg_Parse(v, "(hO&)",
+ &itself->contentType,
+ OptResObj_Convert, &itself->u.iconSuite);
+}
+
+static int
+DataBrowserListViewHeaderDesc_Convert(PyObject *v, DataBrowserListViewHeaderDesc *itself)
+{
+ itself->version = kDataBrowserListViewLatestHeaderDesc;
+ return PyArg_Parse(v, "(HHhO&HO&O&)",
+ &itself->minimumWidth,
+ &itself->maximumWidth,
+ &itself->titleOffset,
+ CFStringRefObj_Convert, &itself->titleString,
+ &itself->initialOrder,
+ ControlFontStyle_Convert, &itself->btnFontStyle,
+ ControlButtonContentInfo_Convert, &itself->btnContentInfo);
+}
+
+static int
+DataBrowserListViewColumnDesc_Convert(PyObject *v, DataBrowserListViewColumnDesc *itself)
+{
+ return PyArg_Parse(v, "(O&O&)",
+ DataBrowserTableViewColumnDesc_Convert, &itself->propertyDesc,
+ DataBrowserListViewHeaderDesc_Convert, &itself->headerBtnDesc);
+}
+
+/* TrackControl and HandleControlClick callback support */
+#define kMyControlActionProcTag 'ACTN' /* not an official tag, only for internal use */
+static PyObject *tracker;
+static ControlActionUPP mytracker_upp;
+static ControlActionUPP myactionproc_upp;
+static ControlUserPaneKeyDownUPP mykeydownproc_upp;
+static ControlUserPaneFocusUPP myfocusproc_upp;
+static ControlUserPaneDrawUPP mydrawproc_upp;
+static ControlUserPaneIdleUPP myidleproc_upp;
+static ControlUserPaneHitTestUPP myhittestproc_upp;
+static ControlUserPaneTrackingUPP mytrackingproc_upp;
+
+static int settrackfunc(PyObject *); /* forward */
+static void clrtrackfunc(void); /* forward */
+static int setcallback(PyObject *, OSType, PyObject *, UniversalProcPtr *);
+"""
+
+finalstuff = finalstuff + """
+static PyObject *
+CtlObj_NewUnmanaged(ControlHandle itself)
+{
+ ControlObject *it;
+ if (itself == NULL) return PyMac_Error(resNotFound);
+ it = PyObject_NEW(ControlObject, &Control_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ it->ob_callbackdict = NULL;
+ return (PyObject *)it;
+}
+
+static PyObject *
+CtlObj_WhichControl(ControlHandle c)
+{
+ PyObject *it;
+
+ if (c == NULL)
+ it = Py_None;
+ else {
+ it = (PyObject *) GetControlReference(c);
+ /*
+ ** If the refcon is zero or doesn't point back to the Python object
+ ** the control is not ours. Return a temporary object.
+ */
+ if (it == NULL || ((ControlObject *)it)->ob_itself != c)
+ return CtlObj_NewUnmanaged(c);
+ }
+ Py_INCREF(it);
+ return it;
+}
+
+static int
+settrackfunc(PyObject *obj)
+{
+ if (tracker) {
+ PyErr_SetString(Ctl_Error, "Tracker function in use");
+ return 0;
+ }
+ tracker = obj;
+ Py_INCREF(tracker);
+ return 1;
+}
+
+static void
+clrtrackfunc(void)
+{
+ Py_XDECREF(tracker);
+ tracker = 0;
+}
+
+static pascal void
+mytracker(ControlHandle ctl, short part)
+{
+ PyObject *args, *rv=0;
+
+ args = Py_BuildValue("(O&i)", CtlObj_WhichControl, ctl, (int)part);
+ if (args && tracker) {
+ rv = PyEval_CallObject(tracker, args);
+ Py_DECREF(args);
+ }
+ if (rv)
+ Py_DECREF(rv);
+ else {
+ PySys_WriteStderr("TrackControl or HandleControlClick: exception in tracker function\\n");
+ PyErr_Print();
+ }
+}
+
+static int
+setcallback(PyObject *myself, OSType which, PyObject *callback, UniversalProcPtr *uppp)
+{
+ ControlObject *self = (ControlObject *)myself;
+ char keybuf[9];
+
+ if ( which == kMyControlActionProcTag )
+ *uppp = (UniversalProcPtr)myactionproc_upp;
+ else if ( which == kControlUserPaneKeyDownProcTag )
+ *uppp = (UniversalProcPtr)mykeydownproc_upp;
+ else if ( which == kControlUserPaneFocusProcTag )
+ *uppp = (UniversalProcPtr)myfocusproc_upp;
+ else if ( which == kControlUserPaneDrawProcTag )
+ *uppp = (UniversalProcPtr)mydrawproc_upp;
+ else if ( which == kControlUserPaneIdleProcTag )
+ *uppp = (UniversalProcPtr)myidleproc_upp;
+ else if ( which == kControlUserPaneHitTestProcTag )
+ *uppp = (UniversalProcPtr)myhittestproc_upp;
+ else if ( which == kControlUserPaneTrackingProcTag )
+ *uppp = (UniversalProcPtr)mytrackingproc_upp;
+ else
+ return -1;
+ /* Only now do we test for clearing of the callback: */
+ if ( callback == Py_None )
+ *uppp = NULL;
+ /* Create the dict if it doesn't exist yet (so we don't get such a dict for every control) */
+ if ( self->ob_callbackdict == NULL )
+ if ( (self->ob_callbackdict = PyDict_New()) == NULL )
+ return -1;
+ /* And store the Python callback */
+ sprintf(keybuf, "%x", (unsigned)which);
+ if (PyDict_SetItemString(self->ob_callbackdict, keybuf, callback) < 0)
+ return -1;
+ return 0;
+}
+
+static PyObject *
+callcallback(ControlObject *self, OSType which, PyObject *arglist)
+{
+ char keybuf[9];
+ PyObject *func, *rv;
+
+ sprintf(keybuf, "%x", (unsigned)which);
+ if ( self->ob_callbackdict == NULL ||
+ (func = PyDict_GetItemString(self->ob_callbackdict, keybuf)) == NULL ) {
+ PySys_WriteStderr("Control callback %x without callback object\\n", (unsigned)which);
+ return NULL;
+ }
+ rv = PyEval_CallObject(func, arglist);
+ if ( rv == NULL ) {
+ PySys_WriteStderr("Exception in control callback %x handler\\n", (unsigned)which);
+ PyErr_Print();
+ }
+ return rv;
+}
+
+static pascal void
+myactionproc(ControlHandle control, SInt16 part)
+{
+ ControlObject *ctl_obj;
+ PyObject *arglist, *rv;
+
+ ctl_obj = (ControlObject *)CtlObj_WhichControl(control);
+ arglist = Py_BuildValue("Oh", ctl_obj, part);
+ rv = callcallback(ctl_obj, kMyControlActionProcTag, arglist);
+ Py_XDECREF(arglist);
+ Py_XDECREF(rv);
+}
+
+static pascal ControlPartCode
+mykeydownproc(ControlHandle control, SInt16 keyCode, SInt16 charCode, SInt16 modifiers)
+{
+ ControlObject *ctl_obj;
+ PyObject *arglist, *rv;
+ short c_rv = 0;
+
+ ctl_obj = (ControlObject *)CtlObj_WhichControl(control);
+ arglist = Py_BuildValue("Ohhh", ctl_obj, keyCode, charCode, modifiers);
+ rv = callcallback(ctl_obj, kControlUserPaneKeyDownProcTag, arglist);
+ Py_XDECREF(arglist);
+ if ( rv )
+ if (!PyArg_Parse(rv, "h", &c_rv))
+ PyErr_Clear();
+ Py_XDECREF(rv);
+ return (ControlPartCode)c_rv;
+}
+
+static pascal ControlPartCode
+myfocusproc(ControlHandle control, ControlPartCode part)
+{
+ ControlObject *ctl_obj;
+ PyObject *arglist, *rv;
+ short c_rv = kControlFocusNoPart;
+
+ ctl_obj = (ControlObject *)CtlObj_WhichControl(control);
+ arglist = Py_BuildValue("Oh", ctl_obj, part);
+ rv = callcallback(ctl_obj, kControlUserPaneFocusProcTag, arglist);
+ Py_XDECREF(arglist);
+ if ( rv )
+ if (!PyArg_Parse(rv, "h", &c_rv))
+ PyErr_Clear();
+ Py_XDECREF(rv);
+ return (ControlPartCode)c_rv;
+}
+
+static pascal void
+mydrawproc(ControlHandle control, SInt16 part)
+{
+ ControlObject *ctl_obj;
+ PyObject *arglist, *rv;
+
+ ctl_obj = (ControlObject *)CtlObj_WhichControl(control);
+ arglist = Py_BuildValue("Oh", ctl_obj, part);
+ rv = callcallback(ctl_obj, kControlUserPaneDrawProcTag, arglist);
+ Py_XDECREF(arglist);
+ Py_XDECREF(rv);
+}
+
+static pascal void
+myidleproc(ControlHandle control)
+{
+ ControlObject *ctl_obj;
+ PyObject *arglist, *rv;
+
+ ctl_obj = (ControlObject *)CtlObj_WhichControl(control);
+ arglist = Py_BuildValue("O", ctl_obj);
+ rv = callcallback(ctl_obj, kControlUserPaneIdleProcTag, arglist);
+ Py_XDECREF(arglist);
+ Py_XDECREF(rv);
+}
+
+static pascal ControlPartCode
+myhittestproc(ControlHandle control, Point where)
+{
+ ControlObject *ctl_obj;
+ PyObject *arglist, *rv;
+ short c_rv = -1;
+
+ ctl_obj = (ControlObject *)CtlObj_WhichControl(control);
+ arglist = Py_BuildValue("OO&", ctl_obj, PyMac_BuildPoint, where);
+ rv = callcallback(ctl_obj, kControlUserPaneHitTestProcTag, arglist);
+ Py_XDECREF(arglist);
+ /* Ignore errors, nothing we can do about them */
+ if ( rv )
+ if (!PyArg_Parse(rv, "h", &c_rv))
+ PyErr_Clear();
+ Py_XDECREF(rv);
+ return (ControlPartCode)c_rv;
+}
+
+static pascal ControlPartCode
+mytrackingproc(ControlHandle control, Point startPt, ControlActionUPP actionProc)
+{
+ ControlObject *ctl_obj;
+ PyObject *arglist, *rv;
+ short c_rv = -1;
+
+ ctl_obj = (ControlObject *)CtlObj_WhichControl(control);
+ /* We cannot pass the actionProc without lots of work */
+ arglist = Py_BuildValue("OO&", ctl_obj, PyMac_BuildPoint, startPt);
+ rv = callcallback(ctl_obj, kControlUserPaneTrackingProcTag, arglist);
+ Py_XDECREF(arglist);
+ if ( rv )
+ if (!PyArg_Parse(rv, "h", &c_rv))
+ PyErr_Clear();
+ Py_XDECREF(rv);
+ return (ControlPartCode)c_rv;
+}
+"""
+
+initstuff = initstuff + """
+mytracker_upp = NewControlActionUPP(mytracker);
+myactionproc_upp = NewControlActionUPP(myactionproc);
+mykeydownproc_upp = NewControlUserPaneKeyDownUPP(mykeydownproc);
+myfocusproc_upp = NewControlUserPaneFocusUPP(myfocusproc);
+mydrawproc_upp = NewControlUserPaneDrawUPP(mydrawproc);
+myidleproc_upp = NewControlUserPaneIdleUPP(myidleproc);
+myhittestproc_upp = NewControlUserPaneHitTestUPP(myhittestproc);
+mytrackingproc_upp = NewControlUserPaneTrackingUPP(mytrackingproc);
+PyMac_INIT_TOOLBOX_OBJECT_NEW(ControlHandle, CtlObj_New);
+PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ControlHandle, CtlObj_Convert);
+"""
+
+class MyObjectDefinition(PEP253Mixin, ObjectIdentityMixin, GlobalObjectDefinition):
+ def outputStructMembers(self):
+ GlobalObjectDefinition.outputStructMembers(self)
+ Output("PyObject *ob_callbackdict;")
+ def outputCheckNewArg(self):
+ Output("if (itself == NULL) return PyMac_Error(resNotFound);")
+ def outputInitStructMembers(self):
+ GlobalObjectDefinition.outputInitStructMembers(self)
+ Output("SetControlReference(itself, (long)it);")
+ Output("it->ob_callbackdict = NULL;")
+ def outputCleanupStructMembers(self):
+ Output("Py_XDECREF(self->ob_callbackdict);")
+ Output("if (self->ob_itself)SetControlReference(self->ob_itself, (long)0); /* Make it forget about us */")
+
+# Create the generator groups and link them
+module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff)
+object = MyObjectDefinition(OBJECTNAME, OBJECTPREFIX, OBJECTTYPE)
+module.addobject(object)
+
+# Create the generator classes used to populate the lists
+Function = OSErrWeakLinkFunctionGenerator
+Method = OSErrWeakLinkMethodGenerator
+
+# Create and populate the lists
+functions = []
+methods = []
+execfile(INPUTFILE)
+execfile('ctledit.py')
+
+# add the populated lists to the generator groups
+for f in functions: module.add(f)
+for f in methods: object.add(f)
+
+# Manual generator for TrackControl, due to callback ideosyncracies
+trackcontrol_body = """
+ControlPartCode _rv;
+Point startPoint;
+ControlActionUPP upp = 0;
+PyObject *callback = 0;
+
+if (!PyArg_ParseTuple(_args, "O&|O",
+ PyMac_GetPoint, &startPoint, &callback))
+ return NULL;
+if (callback && callback != Py_None) {
+ if (PyInt_Check(callback) && PyInt_AS_LONG(callback) == -1)
+ upp = (ControlActionUPP)-1;
+ else {
+ settrackfunc(callback);
+ upp = mytracker_upp;
+ }
+}
+_rv = TrackControl(_self->ob_itself,
+ startPoint,
+ upp);
+clrtrackfunc();
+_res = Py_BuildValue("h",
+ _rv);
+return _res;
+"""
+
+f = ManualGenerator("TrackControl", trackcontrol_body);
+f.docstring = lambda: "(Point startPoint [,trackercallback]) -> (ControlPartCode _rv)"
+object.add(f)
+
+# CJW - added 5/12/99
+# Manual generator for HandleControlClick, as for TrackControl
+handlecontrolclick_body = """
+ControlPartCode _rv;
+Point startPoint;
+SInt16 modifiers;
+ControlActionUPP upp = 0;
+PyObject *callback = 0;
+
+if (!PyArg_ParseTuple(_args, "O&h|O",
+ PyMac_GetPoint, &startPoint,
+ &modifiers,
+ &callback))
+ return NULL;
+if (callback && callback != Py_None) {
+ if (PyInt_Check(callback) && PyInt_AS_LONG(callback) == -1)
+ upp = (ControlActionUPP)-1;
+ else {
+ settrackfunc(callback);
+ upp = mytracker_upp;
+ }
+}
+_rv = HandleControlClick(_self->ob_itself,
+ startPoint,
+ modifiers,
+ upp);
+clrtrackfunc();
+_res = Py_BuildValue("h",
+ _rv);
+return _res;
+"""
+
+f = ManualGenerator("HandleControlClick", handlecontrolclick_body);
+f.docstring = lambda: "(Point startPoint, Integer modifiers, [,trackercallback]) -> (ControlPartCode _rv)"
+object.add(f)
+
+# Manual Generator for SetControlData
+setcontroldata_body = """
+OSErr _err;
+ControlPartCode inPart;
+ResType inTagName;
+Size bufferSize;
+Ptr buffer;
+
+if (!PyArg_ParseTuple(_args, "hO&s#",
+ &inPart,
+ PyMac_GetOSType, &inTagName,
+ &buffer, &bufferSize))
+ return NULL;
+
+_err = SetControlData(_self->ob_itself,
+ inPart,
+ inTagName,
+ bufferSize,
+ buffer);
+
+if (_err != noErr)
+ return PyMac_Error(_err);
+_res = Py_None;
+return _res;
+"""
+
+f = ManualGenerator("SetControlData", setcontroldata_body);
+f.docstring = lambda: "(stuff) -> None"
+object.add(f)
+
+# Manual Generator for GetControlData
+getcontroldata_body = """
+OSErr _err;
+ControlPartCode inPart;
+ResType inTagName;
+Size bufferSize;
+Ptr buffer;
+Size outSize;
+
+if (!PyArg_ParseTuple(_args, "hO&",
+ &inPart,
+ PyMac_GetOSType, &inTagName))
+ return NULL;
+
+/* allocate a buffer for the data */
+_err = GetControlDataSize(_self->ob_itself,
+ inPart,
+ inTagName,
+ &bufferSize);
+if (_err != noErr)
+ return PyMac_Error(_err);
+buffer = PyMem_NEW(char, bufferSize);
+if (buffer == NULL)
+ return PyErr_NoMemory();
+
+_err = GetControlData(_self->ob_itself,
+ inPart,
+ inTagName,
+ bufferSize,
+ buffer,
+ &outSize);
+
+if (_err != noErr) {
+ PyMem_DEL(buffer);
+ return PyMac_Error(_err);
+}
+_res = Py_BuildValue("s#", buffer, outSize);
+PyMem_DEL(buffer);
+return _res;
+"""
+
+f = ManualGenerator("GetControlData", getcontroldata_body);
+f.docstring = lambda: "(part, type) -> String"
+object.add(f)
+
+# Manual Generator for SetControlData_Handle
+setcontroldata_handle_body = """
+OSErr _err;
+ControlPartCode inPart;
+ResType inTagName;
+Handle buffer;
+
+if (!PyArg_ParseTuple(_args, "hO&O&",
+ &inPart,
+ PyMac_GetOSType, &inTagName,
+ OptResObj_Convert, &buffer))
+ return NULL;
+
+_err = SetControlData(_self->ob_itself,
+ inPart,
+ inTagName,
+ sizeof(buffer),
+ (Ptr)&buffer);
+
+if (_err != noErr)
+ return PyMac_Error(_err);
+_res = Py_None;
+return _res;
+"""
+
+f = ManualGenerator("SetControlData_Handle", setcontroldata_handle_body);
+f.docstring = lambda: "(ResObj) -> None"
+object.add(f)
+
+# Manual Generator for GetControlData_Handle
+getcontroldata_handle_body = """
+OSErr _err;
+ControlPartCode inPart;
+ResType inTagName;
+Size bufferSize;
+Handle hdl;
+
+if (!PyArg_ParseTuple(_args, "hO&",
+ &inPart,
+ PyMac_GetOSType, &inTagName))
+ return NULL;
+
+/* Check it is handle-sized */
+_err = GetControlDataSize(_self->ob_itself,
+ inPart,
+ inTagName,
+ &bufferSize);
+if (_err != noErr)
+ return PyMac_Error(_err);
+if (bufferSize != sizeof(Handle)) {
+ PyErr_SetString(Ctl_Error, "GetControlDataSize() != sizeof(Handle)");
+ return NULL;
+}
+
+_err = GetControlData(_self->ob_itself,
+ inPart,
+ inTagName,
+ sizeof(Handle),
+ (Ptr)&hdl,
+ &bufferSize);
+
+if (_err != noErr) {
+ return PyMac_Error(_err);
+}
+_res = Py_BuildValue("O&", OptResObj_New, hdl);
+return _res;
+"""
+
+f = ManualGenerator("GetControlData_Handle", getcontroldata_handle_body);
+f.docstring = lambda: "(part, type) -> ResObj"
+object.add(f)
+
+# Manual Generator for SetControlData_Callback
+setcontroldata_callback_body = """
+OSErr _err;
+ControlPartCode inPart;
+ResType inTagName;
+PyObject *callback;
+UniversalProcPtr c_callback;
+
+if (!PyArg_ParseTuple(_args, "hO&O",
+ &inPart,
+ PyMac_GetOSType, &inTagName,
+ &callback))
+ return NULL;
+
+if ( setcallback((PyObject *)_self, inTagName, callback, &c_callback) < 0 )
+ return NULL;
+_err = SetControlData(_self->ob_itself,
+ inPart,
+ inTagName,
+ sizeof(c_callback),
+ (Ptr)&c_callback);
+
+if (_err != noErr)
+ return PyMac_Error(_err);
+_res = Py_None;
+return _res;
+"""
+
+f = ManualGenerator("SetControlData_Callback", setcontroldata_callback_body);
+f.docstring = lambda: "(callbackfunc) -> None"
+object.add(f)
+
+
+
+createtabscontrol_body = """\
+OSStatus _err;
+WindowPtr window;
+Rect boundsRect;
+UInt16 size;
+UInt16 direction;
+int i;
+UInt16 numTabs;
+ControlTabEntry tabArray[MAXTABS];
+ControlHandle outControl;
+PyObject *tabArrayObj, *tabEntry;
+
+#ifndef CreateTabsControl
+PyMac_PRECHECK(CreateTabsControl);
+#endif
+if (!PyArg_ParseTuple(_args, "O&O&HHO",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect,
+ &size,
+ &direction,
+ &tabArrayObj))
+ return NULL;
+
+i = PySequence_Length(tabArrayObj);
+if (i == -1)
+ return NULL;
+if (i > MAXTABS) {
+ PyErr_SetString(Ctl_Error, "Too many tabs");
+ return NULL;
+}
+numTabs = i;
+for (i=0; i<numTabs; i++) {
+ tabEntry = PySequence_GetItem(tabArrayObj, i);
+ if (tabEntry == NULL)
+ return NULL;
+ if (!PyArg_Parse(tabEntry, "(O&O&B)",
+ ControlButtonContentInfo_Convert, &tabArray[i].icon,
+ CFStringRefObj_Convert, &tabArray[i].name,
+ &tabArray[i].enabled
+ ))
+ return NULL;
+}
+
+_err = CreateTabsControl(window,
+ &boundsRect,
+ size,
+ direction,
+ numTabs,
+ tabArray,
+ &outControl);
+if (_err != noErr) return PyMac_Error(_err);
+_res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+return _res;"""
+
+f = ManualGenerator("CreateTabsControl", createtabscontrol_body)
+f.docstring = lambda: "(WindowPtr window, Rect boundsRect, UInt16 size, UInt16 direction, ControlTabEntry tabArray) -> (ControlHandle outControl)"
+module.add(f)
+
+# generate output (open the output file as late as possible)
+SetOutputFileName(OUTPUTFILE)
+module.generate()
diff --git a/Mac/Modules/dlg/_Dlgmodule.c b/Mac/Modules/dlg/_Dlgmodule.c
new file mode 100644
index 0000000000..c4d66a9de0
--- /dev/null
+++ b/Mac/Modules/dlg/_Dlgmodule.c
@@ -0,0 +1,1609 @@
+
+/* ========================== Module _Dlg =========================== */
+
+#include "Python.h"
+
+#ifndef __LP64__
+
+
+#include "pymactoolbox.h"
+
+/* Macro to test whether a weak-loaded CFM function exists */
+#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
+ PyErr_SetString(PyExc_NotImplementedError, \
+ "Not available in this shared library/OS version"); \
+ return NULL; \
+ }} while(0)
+
+
+#include <Carbon/Carbon.h>
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_DlgObj_New(DialogRef);
+extern PyObject *_DlgObj_WhichDialog(DialogRef);
+extern int _DlgObj_Convert(PyObject *, DialogRef *);
+
+#define DlgObj_New _DlgObj_New
+#define DlgObj_WhichDialog _DlgObj_WhichDialog
+#define DlgObj_Convert _DlgObj_Convert
+#endif
+
+/* XXX Shouldn't this be a stack? */
+static PyObject *Dlg_FilterProc_callback = NULL;
+
+static pascal Boolean Dlg_UnivFilterProc(DialogPtr dialog,
+ EventRecord *event,
+ short *itemHit)
+{
+ Boolean rv;
+ PyObject *args, *res;
+ PyObject *callback = Dlg_FilterProc_callback;
+ if (callback == NULL)
+ return 0; /* Default behavior */
+ Dlg_FilterProc_callback = NULL; /* We'll restore it when call successful */
+ args = Py_BuildValue("O&O&", DlgObj_WhichDialog, dialog, PyMac_BuildEventRecord, event);
+ if (args == NULL)
+ res = NULL;
+ else {
+ res = PyEval_CallObject(callback, args);
+ Py_DECREF(args);
+ }
+ if (res == NULL) {
+ PySys_WriteStderr("Exception in Dialog Filter\n");
+ PyErr_Print();
+ *itemHit = -1; /* Fake return item */
+ return 1; /* We handled it */
+ }
+ else {
+ Dlg_FilterProc_callback = callback;
+ if (PyInt_Check(res)) {
+ *itemHit = PyInt_AsLong(res);
+ rv = 1;
+ }
+ else
+ rv = PyObject_IsTrue(res);
+ }
+ Py_DECREF(res);
+ return rv;
+}
+
+static ModalFilterUPP
+Dlg_PassFilterProc(PyObject *callback)
+{
+ PyObject *tmp = Dlg_FilterProc_callback;
+ static ModalFilterUPP UnivFilterUpp = NULL;
+
+ Dlg_FilterProc_callback = NULL;
+ if (callback == Py_None) {
+ Py_XDECREF(tmp);
+ return NULL;
+ }
+ Py_INCREF(callback);
+ Dlg_FilterProc_callback = callback;
+ Py_XDECREF(tmp);
+ if ( UnivFilterUpp == NULL )
+ UnivFilterUpp = NewModalFilterUPP(&Dlg_UnivFilterProc);
+ return UnivFilterUpp;
+}
+
+static PyObject *Dlg_UserItemProc_callback = NULL;
+
+static pascal void Dlg_UnivUserItemProc(DialogPtr dialog,
+ short item)
+{
+ PyObject *args, *res;
+
+ if (Dlg_UserItemProc_callback == NULL)
+ return; /* Default behavior */
+ Dlg_FilterProc_callback = NULL; /* We'll restore it when call successful */
+ args = Py_BuildValue("O&h", DlgObj_WhichDialog, dialog, item);
+ if (args == NULL)
+ res = NULL;
+ else {
+ res = PyEval_CallObject(Dlg_UserItemProc_callback, args);
+ Py_DECREF(args);
+ }
+ if (res == NULL) {
+ PySys_WriteStderr("Exception in Dialog UserItem proc\n");
+ PyErr_Print();
+ }
+ Py_XDECREF(res);
+ return;
+}
+
+#if 0
+/*
+** Treating DialogObjects as WindowObjects is (I think) illegal under Carbon.
+** However, as they are still identical under MacOS9 Carbon this is a problem, even
+** if we neatly call GetDialogWindow() at the right places: there's one refcon field
+** and it points to the DialogObject, so WinObj_WhichWindow will smartly return the
+** dialog object, and therefore we still don't have a WindowObject.
+** I'll leave the chaining code in place for now, with this comment to warn the
+** unsuspecting victims (i.e. me, probably, in a few weeks:-)
+*/
+extern PyMethodChain WinObj_chain;
+#endif
+
+static PyObject *Dlg_Error;
+
+/* ----------------------- Object type Dialog ----------------------- */
+
+PyTypeObject Dialog_Type;
+
+#define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type || PyObject_TypeCheck((x), &Dialog_Type))
+
+typedef struct DialogObject {
+ PyObject_HEAD
+ DialogPtr ob_itself;
+} DialogObject;
+
+PyObject *DlgObj_New(DialogPtr itself)
+{
+ DialogObject *it;
+ if (itself == NULL) { Py_INCREF(Py_None); return Py_None; }
+ it = PyObject_NEW(DialogObject, &Dialog_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ SetWRefCon(GetDialogWindow(itself), (long)it);
+ return (PyObject *)it;
+}
+
+int DlgObj_Convert(PyObject *v, DialogPtr *p_itself)
+{
+ if (v == Py_None) { *p_itself = NULL; return 1; }
+ if (PyInt_Check(v)) { *p_itself = (DialogPtr)PyInt_AsLong(v);
+ return 1; }
+ if (!DlgObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "Dialog required");
+ return 0;
+ }
+ *p_itself = ((DialogObject *)v)->ob_itself;
+ return 1;
+}
+
+static void DlgObj_dealloc(DialogObject *self)
+{
+ DisposeDialog(self->ob_itself);
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *DlgObj_DrawDialog(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef DrawDialog
+ PyMac_PRECHECK(DrawDialog);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ DrawDialog(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_UpdateDialog(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle updateRgn;
+#ifndef UpdateDialog
+ PyMac_PRECHECK(UpdateDialog);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &updateRgn))
+ return NULL;
+ UpdateDialog(_self->ob_itself,
+ updateRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_HideDialogItem(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DialogItemIndex itemNo;
+#ifndef HideDialogItem
+ PyMac_PRECHECK(HideDialogItem);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &itemNo))
+ return NULL;
+ HideDialogItem(_self->ob_itself,
+ itemNo);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_ShowDialogItem(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DialogItemIndex itemNo;
+#ifndef ShowDialogItem
+ PyMac_PRECHECK(ShowDialogItem);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &itemNo))
+ return NULL;
+ ShowDialogItem(_self->ob_itself,
+ itemNo);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_FindDialogItem(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DialogItemIndexZeroBased _rv;
+ Point thePt;
+#ifndef FindDialogItem
+ PyMac_PRECHECK(FindDialogItem);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &thePt))
+ return NULL;
+ _rv = FindDialogItem(_self->ob_itself,
+ thePt);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *DlgObj_DialogCut(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef DialogCut
+ PyMac_PRECHECK(DialogCut);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ DialogCut(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_DialogPaste(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef DialogPaste
+ PyMac_PRECHECK(DialogPaste);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ DialogPaste(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_DialogCopy(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef DialogCopy
+ PyMac_PRECHECK(DialogCopy);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ DialogCopy(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_DialogDelete(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef DialogDelete
+ PyMac_PRECHECK(DialogDelete);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ DialogDelete(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_GetDialogItem(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DialogItemIndex itemNo;
+ DialogItemType itemType;
+ Handle item;
+ Rect box;
+#ifndef GetDialogItem
+ PyMac_PRECHECK(GetDialogItem);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &itemNo))
+ return NULL;
+ GetDialogItem(_self->ob_itself,
+ itemNo,
+ &itemType,
+ &item,
+ &box);
+ _res = Py_BuildValue("hO&O&",
+ itemType,
+ OptResObj_New, item,
+ PyMac_BuildRect, &box);
+ return _res;
+}
+
+static PyObject *DlgObj_SetDialogItem(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DialogItemIndex itemNo;
+ DialogItemType itemType;
+ Handle item;
+ Rect box;
+#ifndef SetDialogItem
+ PyMac_PRECHECK(SetDialogItem);
+#endif
+ if (!PyArg_ParseTuple(_args, "hhO&O&",
+ &itemNo,
+ &itemType,
+ ResObj_Convert, &item,
+ PyMac_GetRect, &box))
+ return NULL;
+ SetDialogItem(_self->ob_itself,
+ itemNo,
+ itemType,
+ item,
+ &box);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_SelectDialogItemText(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DialogItemIndex itemNo;
+ SInt16 strtSel;
+ SInt16 endSel;
+#ifndef SelectDialogItemText
+ PyMac_PRECHECK(SelectDialogItemText);
+#endif
+ if (!PyArg_ParseTuple(_args, "hhh",
+ &itemNo,
+ &strtSel,
+ &endSel))
+ return NULL;
+ SelectDialogItemText(_self->ob_itself,
+ itemNo,
+ strtSel,
+ endSel);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_AppendDITL(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle theHandle;
+ DITLMethod method;
+#ifndef AppendDITL
+ PyMac_PRECHECK(AppendDITL);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ ResObj_Convert, &theHandle,
+ &method))
+ return NULL;
+ AppendDITL(_self->ob_itself,
+ theHandle,
+ method);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_CountDITL(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DialogItemIndex _rv;
+#ifndef CountDITL
+ PyMac_PRECHECK(CountDITL);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CountDITL(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *DlgObj_ShortenDITL(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DialogItemIndex numberItems;
+#ifndef ShortenDITL
+ PyMac_PRECHECK(ShortenDITL);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &numberItems))
+ return NULL;
+ ShortenDITL(_self->ob_itself,
+ numberItems);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_InsertDialogItem(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ DialogItemIndex afterItem;
+ DialogItemType itemType;
+ Handle itemHandle;
+ Rect box;
+#ifndef InsertDialogItem
+ PyMac_PRECHECK(InsertDialogItem);
+#endif
+ if (!PyArg_ParseTuple(_args, "hhO&O&",
+ &afterItem,
+ &itemType,
+ ResObj_Convert, &itemHandle,
+ PyMac_GetRect, &box))
+ return NULL;
+ _err = InsertDialogItem(_self->ob_itself,
+ afterItem,
+ itemType,
+ itemHandle,
+ &box);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_RemoveDialogItems(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ DialogItemIndex itemNo;
+ DialogItemIndex amountToRemove;
+ Boolean disposeItemData;
+#ifndef RemoveDialogItems
+ PyMac_PRECHECK(RemoveDialogItems);
+#endif
+ if (!PyArg_ParseTuple(_args, "hhb",
+ &itemNo,
+ &amountToRemove,
+ &disposeItemData))
+ return NULL;
+ _err = RemoveDialogItems(_self->ob_itself,
+ itemNo,
+ amountToRemove,
+ disposeItemData);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_StdFilterProc(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ EventRecord event;
+ DialogItemIndex itemHit;
+#ifndef StdFilterProc
+ PyMac_PRECHECK(StdFilterProc);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ PyMac_GetEventRecord, &event,
+ &itemHit))
+ return NULL;
+ _rv = StdFilterProc(_self->ob_itself,
+ &event,
+ &itemHit);
+ _res = Py_BuildValue("bO&h",
+ _rv,
+ PyMac_BuildEventRecord, &event,
+ itemHit);
+ return _res;
+}
+
+static PyObject *DlgObj_SetDialogDefaultItem(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ DialogItemIndex newItem;
+#ifndef SetDialogDefaultItem
+ PyMac_PRECHECK(SetDialogDefaultItem);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &newItem))
+ return NULL;
+ _err = SetDialogDefaultItem(_self->ob_itself,
+ newItem);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_SetDialogCancelItem(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ DialogItemIndex newItem;
+#ifndef SetDialogCancelItem
+ PyMac_PRECHECK(SetDialogCancelItem);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &newItem))
+ return NULL;
+ _err = SetDialogCancelItem(_self->ob_itself,
+ newItem);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_SetDialogTracksCursor(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Boolean tracks;
+#ifndef SetDialogTracksCursor
+ PyMac_PRECHECK(SetDialogTracksCursor);
+#endif
+ if (!PyArg_ParseTuple(_args, "b",
+ &tracks))
+ return NULL;
+ _err = SetDialogTracksCursor(_self->ob_itself,
+ tracks);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_AutoSizeDialog(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+#ifndef AutoSizeDialog
+ PyMac_PRECHECK(AutoSizeDialog);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = AutoSizeDialog(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_GetDialogItemAsControl(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItemNo;
+ ControlHandle outControl;
+#ifndef GetDialogItemAsControl
+ PyMac_PRECHECK(GetDialogItemAsControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &inItemNo))
+ return NULL;
+ _err = GetDialogItemAsControl(_self->ob_itself,
+ inItemNo,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+
+static PyObject *DlgObj_MoveDialogItem(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItemNo;
+ SInt16 inHoriz;
+ SInt16 inVert;
+#ifndef MoveDialogItem
+ PyMac_PRECHECK(MoveDialogItem);
+#endif
+ if (!PyArg_ParseTuple(_args, "hhh",
+ &inItemNo,
+ &inHoriz,
+ &inVert))
+ return NULL;
+ _err = MoveDialogItem(_self->ob_itself,
+ inItemNo,
+ inHoriz,
+ inVert);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_SizeDialogItem(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItemNo;
+ SInt16 inWidth;
+ SInt16 inHeight;
+#ifndef SizeDialogItem
+ PyMac_PRECHECK(SizeDialogItem);
+#endif
+ if (!PyArg_ParseTuple(_args, "hhh",
+ &inItemNo,
+ &inWidth,
+ &inHeight))
+ return NULL;
+ _err = SizeDialogItem(_self->ob_itself,
+ inItemNo,
+ inWidth,
+ inHeight);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_AppendDialogItemList(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 ditlID;
+ DITLMethod method;
+#ifndef AppendDialogItemList
+ PyMac_PRECHECK(AppendDialogItemList);
+#endif
+ if (!PyArg_ParseTuple(_args, "hh",
+ &ditlID,
+ &method))
+ return NULL;
+ _err = AppendDialogItemList(_self->ob_itself,
+ ditlID,
+ method);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_SetDialogTimeout(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ SInt16 inButtonToPress;
+ UInt32 inSecondsToWait;
+#ifndef SetDialogTimeout
+ PyMac_PRECHECK(SetDialogTimeout);
+#endif
+ if (!PyArg_ParseTuple(_args, "hl",
+ &inButtonToPress,
+ &inSecondsToWait))
+ return NULL;
+ _err = SetDialogTimeout(_self->ob_itself,
+ inButtonToPress,
+ inSecondsToWait);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_GetDialogTimeout(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ SInt16 outButtonToPress;
+ UInt32 outSecondsToWait;
+ UInt32 outSecondsRemaining;
+#ifndef GetDialogTimeout
+ PyMac_PRECHECK(GetDialogTimeout);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetDialogTimeout(_self->ob_itself,
+ &outButtonToPress,
+ &outSecondsToWait,
+ &outSecondsRemaining);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("hll",
+ outButtonToPress,
+ outSecondsToWait,
+ outSecondsRemaining);
+ return _res;
+}
+
+static PyObject *DlgObj_SetModalDialogEventMask(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ EventMask inMask;
+#ifndef SetModalDialogEventMask
+ PyMac_PRECHECK(SetModalDialogEventMask);
+#endif
+ if (!PyArg_ParseTuple(_args, "H",
+ &inMask))
+ return NULL;
+ _err = SetModalDialogEventMask(_self->ob_itself,
+ inMask);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_GetModalDialogEventMask(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ EventMask outMask;
+#ifndef GetModalDialogEventMask
+ PyMac_PRECHECK(GetModalDialogEventMask);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetModalDialogEventMask(_self->ob_itself,
+ &outMask);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("H",
+ outMask);
+ return _res;
+}
+
+static PyObject *DlgObj_GetDialogWindow(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr _rv;
+#ifndef GetDialogWindow
+ PyMac_PRECHECK(GetDialogWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetDialogWindow(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ WinObj_New, _rv);
+ return _res;
+}
+
+static PyObject *DlgObj_GetDialogTextEditHandle(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TEHandle _rv;
+#ifndef GetDialogTextEditHandle
+ PyMac_PRECHECK(GetDialogTextEditHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetDialogTextEditHandle(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *DlgObj_GetDialogDefaultItem(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 _rv;
+#ifndef GetDialogDefaultItem
+ PyMac_PRECHECK(GetDialogDefaultItem);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetDialogDefaultItem(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *DlgObj_GetDialogCancelItem(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 _rv;
+#ifndef GetDialogCancelItem
+ PyMac_PRECHECK(GetDialogCancelItem);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetDialogCancelItem(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *DlgObj_GetDialogKeyboardFocusItem(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 _rv;
+#ifndef GetDialogKeyboardFocusItem
+ PyMac_PRECHECK(GetDialogKeyboardFocusItem);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetDialogKeyboardFocusItem(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *DlgObj_SetPortDialogPort(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef SetPortDialogPort
+ PyMac_PRECHECK(SetPortDialogPort);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ SetPortDialogPort(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_GetDialogPort(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr _rv;
+#ifndef GetDialogPort
+ PyMac_PRECHECK(GetDialogPort);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetDialogPort(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ GrafObj_New, _rv);
+ return _res;
+}
+
+static PyMethodDef DlgObj_methods[] = {
+ {"DrawDialog", (PyCFunction)DlgObj_DrawDialog, 1,
+ PyDoc_STR("() -> None")},
+ {"UpdateDialog", (PyCFunction)DlgObj_UpdateDialog, 1,
+ PyDoc_STR("(RgnHandle updateRgn) -> None")},
+ {"HideDialogItem", (PyCFunction)DlgObj_HideDialogItem, 1,
+ PyDoc_STR("(DialogItemIndex itemNo) -> None")},
+ {"ShowDialogItem", (PyCFunction)DlgObj_ShowDialogItem, 1,
+ PyDoc_STR("(DialogItemIndex itemNo) -> None")},
+ {"FindDialogItem", (PyCFunction)DlgObj_FindDialogItem, 1,
+ PyDoc_STR("(Point thePt) -> (DialogItemIndexZeroBased _rv)")},
+ {"DialogCut", (PyCFunction)DlgObj_DialogCut, 1,
+ PyDoc_STR("() -> None")},
+ {"DialogPaste", (PyCFunction)DlgObj_DialogPaste, 1,
+ PyDoc_STR("() -> None")},
+ {"DialogCopy", (PyCFunction)DlgObj_DialogCopy, 1,
+ PyDoc_STR("() -> None")},
+ {"DialogDelete", (PyCFunction)DlgObj_DialogDelete, 1,
+ PyDoc_STR("() -> None")},
+ {"GetDialogItem", (PyCFunction)DlgObj_GetDialogItem, 1,
+ PyDoc_STR("(DialogItemIndex itemNo) -> (DialogItemType itemType, Handle item, Rect box)")},
+ {"SetDialogItem", (PyCFunction)DlgObj_SetDialogItem, 1,
+ PyDoc_STR("(DialogItemIndex itemNo, DialogItemType itemType, Handle item, Rect box) -> None")},
+ {"SelectDialogItemText", (PyCFunction)DlgObj_SelectDialogItemText, 1,
+ PyDoc_STR("(DialogItemIndex itemNo, SInt16 strtSel, SInt16 endSel) -> None")},
+ {"AppendDITL", (PyCFunction)DlgObj_AppendDITL, 1,
+ PyDoc_STR("(Handle theHandle, DITLMethod method) -> None")},
+ {"CountDITL", (PyCFunction)DlgObj_CountDITL, 1,
+ PyDoc_STR("() -> (DialogItemIndex _rv)")},
+ {"ShortenDITL", (PyCFunction)DlgObj_ShortenDITL, 1,
+ PyDoc_STR("(DialogItemIndex numberItems) -> None")},
+ {"InsertDialogItem", (PyCFunction)DlgObj_InsertDialogItem, 1,
+ PyDoc_STR("(DialogItemIndex afterItem, DialogItemType itemType, Handle itemHandle, Rect box) -> None")},
+ {"RemoveDialogItems", (PyCFunction)DlgObj_RemoveDialogItems, 1,
+ PyDoc_STR("(DialogItemIndex itemNo, DialogItemIndex amountToRemove, Boolean disposeItemData) -> None")},
+ {"StdFilterProc", (PyCFunction)DlgObj_StdFilterProc, 1,
+ PyDoc_STR("(EventRecord event, DialogItemIndex itemHit) -> (Boolean _rv, EventRecord event, DialogItemIndex itemHit)")},
+ {"SetDialogDefaultItem", (PyCFunction)DlgObj_SetDialogDefaultItem, 1,
+ PyDoc_STR("(DialogItemIndex newItem) -> None")},
+ {"SetDialogCancelItem", (PyCFunction)DlgObj_SetDialogCancelItem, 1,
+ PyDoc_STR("(DialogItemIndex newItem) -> None")},
+ {"SetDialogTracksCursor", (PyCFunction)DlgObj_SetDialogTracksCursor, 1,
+ PyDoc_STR("(Boolean tracks) -> None")},
+ {"AutoSizeDialog", (PyCFunction)DlgObj_AutoSizeDialog, 1,
+ PyDoc_STR("() -> None")},
+ {"GetDialogItemAsControl", (PyCFunction)DlgObj_GetDialogItemAsControl, 1,
+ PyDoc_STR("(SInt16 inItemNo) -> (ControlHandle outControl)")},
+ {"MoveDialogItem", (PyCFunction)DlgObj_MoveDialogItem, 1,
+ PyDoc_STR("(SInt16 inItemNo, SInt16 inHoriz, SInt16 inVert) -> None")},
+ {"SizeDialogItem", (PyCFunction)DlgObj_SizeDialogItem, 1,
+ PyDoc_STR("(SInt16 inItemNo, SInt16 inWidth, SInt16 inHeight) -> None")},
+ {"AppendDialogItemList", (PyCFunction)DlgObj_AppendDialogItemList, 1,
+ PyDoc_STR("(SInt16 ditlID, DITLMethod method) -> None")},
+ {"SetDialogTimeout", (PyCFunction)DlgObj_SetDialogTimeout, 1,
+ PyDoc_STR("(SInt16 inButtonToPress, UInt32 inSecondsToWait) -> None")},
+ {"GetDialogTimeout", (PyCFunction)DlgObj_GetDialogTimeout, 1,
+ PyDoc_STR("() -> (SInt16 outButtonToPress, UInt32 outSecondsToWait, UInt32 outSecondsRemaining)")},
+ {"SetModalDialogEventMask", (PyCFunction)DlgObj_SetModalDialogEventMask, 1,
+ PyDoc_STR("(EventMask inMask) -> None")},
+ {"GetModalDialogEventMask", (PyCFunction)DlgObj_GetModalDialogEventMask, 1,
+ PyDoc_STR("() -> (EventMask outMask)")},
+ {"GetDialogWindow", (PyCFunction)DlgObj_GetDialogWindow, 1,
+ PyDoc_STR("() -> (WindowPtr _rv)")},
+ {"GetDialogTextEditHandle", (PyCFunction)DlgObj_GetDialogTextEditHandle, 1,
+ PyDoc_STR("() -> (TEHandle _rv)")},
+ {"GetDialogDefaultItem", (PyCFunction)DlgObj_GetDialogDefaultItem, 1,
+ PyDoc_STR("() -> (SInt16 _rv)")},
+ {"GetDialogCancelItem", (PyCFunction)DlgObj_GetDialogCancelItem, 1,
+ PyDoc_STR("() -> (SInt16 _rv)")},
+ {"GetDialogKeyboardFocusItem", (PyCFunction)DlgObj_GetDialogKeyboardFocusItem, 1,
+ PyDoc_STR("() -> (SInt16 _rv)")},
+ {"SetPortDialogPort", (PyCFunction)DlgObj_SetPortDialogPort, 1,
+ PyDoc_STR("() -> None")},
+ {"GetDialogPort", (PyCFunction)DlgObj_GetDialogPort, 1,
+ PyDoc_STR("() -> (CGrafPtr _rv)")},
+ {NULL, NULL, 0}
+};
+
+#define DlgObj_getsetlist NULL
+
+
+static int DlgObj_compare(DialogObject *self, DialogObject *other)
+{
+ if ( self->ob_itself > other->ob_itself ) return 1;
+ if ( self->ob_itself < other->ob_itself ) return -1;
+ return 0;
+}
+
+#define DlgObj_repr NULL
+
+static int DlgObj_hash(DialogObject *self)
+{
+ return (int)self->ob_itself;
+}
+#define DlgObj_tp_init 0
+
+#define DlgObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *DlgObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *_self;
+ DialogPtr itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, DlgObj_Convert, &itself)) return NULL;
+ if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((DialogObject *)_self)->ob_itself = itself;
+ return _self;
+}
+
+#define DlgObj_tp_free PyObject_Del
+
+
+PyTypeObject Dialog_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_Dlg.Dialog", /*tp_name*/
+ sizeof(DialogObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) DlgObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) DlgObj_compare, /*tp_compare*/
+ (reprfunc) DlgObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) DlgObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ DlgObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ DlgObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ DlgObj_tp_init, /* tp_init */
+ DlgObj_tp_alloc, /* tp_alloc */
+ DlgObj_tp_new, /* tp_new */
+ DlgObj_tp_free, /* tp_free */
+};
+
+/* --------------------- End object type Dialog --------------------- */
+
+
+static PyObject *Dlg_NewDialog(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DialogPtr _rv;
+ Rect boundsRect;
+ Str255 title;
+ Boolean visible;
+ SInt16 procID;
+ WindowPtr behind;
+ Boolean goAwayFlag;
+ SInt32 refCon;
+ Handle items;
+#ifndef NewDialog
+ PyMac_PRECHECK(NewDialog);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&bhO&blO&",
+ PyMac_GetRect, &boundsRect,
+ PyMac_GetStr255, title,
+ &visible,
+ &procID,
+ WinObj_Convert, &behind,
+ &goAwayFlag,
+ &refCon,
+ ResObj_Convert, &items))
+ return NULL;
+ _rv = NewDialog((void *)0,
+ &boundsRect,
+ title,
+ visible,
+ procID,
+ behind,
+ goAwayFlag,
+ refCon,
+ items);
+ _res = Py_BuildValue("O&",
+ DlgObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Dlg_GetNewDialog(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DialogPtr _rv;
+ SInt16 dialogID;
+ WindowPtr behind;
+#ifndef GetNewDialog
+ PyMac_PRECHECK(GetNewDialog);
+#endif
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &dialogID,
+ WinObj_Convert, &behind))
+ return NULL;
+ _rv = GetNewDialog(dialogID,
+ (void *)0,
+ behind);
+ _res = Py_BuildValue("O&",
+ DlgObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Dlg_NewColorDialog(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DialogPtr _rv;
+ Rect boundsRect;
+ Str255 title;
+ Boolean visible;
+ SInt16 procID;
+ WindowPtr behind;
+ Boolean goAwayFlag;
+ SInt32 refCon;
+ Handle items;
+#ifndef NewColorDialog
+ PyMac_PRECHECK(NewColorDialog);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&bhO&blO&",
+ PyMac_GetRect, &boundsRect,
+ PyMac_GetStr255, title,
+ &visible,
+ &procID,
+ WinObj_Convert, &behind,
+ &goAwayFlag,
+ &refCon,
+ ResObj_Convert, &items))
+ return NULL;
+ _rv = NewColorDialog((void *)0,
+ &boundsRect,
+ title,
+ visible,
+ procID,
+ behind,
+ goAwayFlag,
+ refCon,
+ items);
+ _res = Py_BuildValue("O&",
+ DlgObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Dlg_ModalDialog(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PyObject* modalFilter;
+ DialogItemIndex itemHit;
+#ifndef ModalDialog
+ PyMac_PRECHECK(ModalDialog);
+#endif
+ if (!PyArg_ParseTuple(_args, "O",
+ &modalFilter))
+ return NULL;
+ ModalDialog(Dlg_PassFilterProc(modalFilter),
+ &itemHit);
+ _res = Py_BuildValue("h",
+ itemHit);
+ return _res;
+}
+
+static PyObject *Dlg_IsDialogEvent(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ EventRecord theEvent;
+#ifndef IsDialogEvent
+ PyMac_PRECHECK(IsDialogEvent);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetEventRecord, &theEvent))
+ return NULL;
+ _rv = IsDialogEvent(&theEvent);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Dlg_DialogSelect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ EventRecord theEvent;
+ DialogPtr theDialog;
+ DialogItemIndex itemHit;
+#ifndef DialogSelect
+ PyMac_PRECHECK(DialogSelect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetEventRecord, &theEvent))
+ return NULL;
+ _rv = DialogSelect(&theEvent,
+ &theDialog,
+ &itemHit);
+ _res = Py_BuildValue("bO&h",
+ _rv,
+ DlgObj_WhichDialog, theDialog,
+ itemHit);
+ return _res;
+}
+
+static PyObject *Dlg_Alert(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DialogItemIndex _rv;
+ SInt16 alertID;
+ PyObject* modalFilter;
+#ifndef Alert
+ PyMac_PRECHECK(Alert);
+#endif
+ if (!PyArg_ParseTuple(_args, "hO",
+ &alertID,
+ &modalFilter))
+ return NULL;
+ _rv = Alert(alertID,
+ Dlg_PassFilterProc(modalFilter));
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Dlg_StopAlert(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DialogItemIndex _rv;
+ SInt16 alertID;
+ PyObject* modalFilter;
+#ifndef StopAlert
+ PyMac_PRECHECK(StopAlert);
+#endif
+ if (!PyArg_ParseTuple(_args, "hO",
+ &alertID,
+ &modalFilter))
+ return NULL;
+ _rv = StopAlert(alertID,
+ Dlg_PassFilterProc(modalFilter));
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Dlg_NoteAlert(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DialogItemIndex _rv;
+ SInt16 alertID;
+ PyObject* modalFilter;
+#ifndef NoteAlert
+ PyMac_PRECHECK(NoteAlert);
+#endif
+ if (!PyArg_ParseTuple(_args, "hO",
+ &alertID,
+ &modalFilter))
+ return NULL;
+ _rv = NoteAlert(alertID,
+ Dlg_PassFilterProc(modalFilter));
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Dlg_CautionAlert(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DialogItemIndex _rv;
+ SInt16 alertID;
+ PyObject* modalFilter;
+#ifndef CautionAlert
+ PyMac_PRECHECK(CautionAlert);
+#endif
+ if (!PyArg_ParseTuple(_args, "hO",
+ &alertID,
+ &modalFilter))
+ return NULL;
+ _rv = CautionAlert(alertID,
+ Dlg_PassFilterProc(modalFilter));
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Dlg_ParamText(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Str255 param0;
+ Str255 param1;
+ Str255 param2;
+ Str255 param3;
+#ifndef ParamText
+ PyMac_PRECHECK(ParamText);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&",
+ PyMac_GetStr255, param0,
+ PyMac_GetStr255, param1,
+ PyMac_GetStr255, param2,
+ PyMac_GetStr255, param3))
+ return NULL;
+ ParamText(param0,
+ param1,
+ param2,
+ param3);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Dlg_GetDialogItemText(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle item;
+ Str255 text;
+#ifndef GetDialogItemText
+ PyMac_PRECHECK(GetDialogItemText);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &item))
+ return NULL;
+ GetDialogItemText(item,
+ text);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildStr255, text);
+ return _res;
+}
+
+static PyObject *Dlg_SetDialogItemText(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle item;
+ Str255 text;
+#ifndef SetDialogItemText
+ PyMac_PRECHECK(SetDialogItemText);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &item,
+ PyMac_GetStr255, text))
+ return NULL;
+ SetDialogItemText(item,
+ text);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Dlg_GetAlertStage(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 _rv;
+#ifndef GetAlertStage
+ PyMac_PRECHECK(GetAlertStage);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetAlertStage();
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Dlg_SetDialogFont(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 fontNum;
+#ifndef SetDialogFont
+ PyMac_PRECHECK(SetDialogFont);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &fontNum))
+ return NULL;
+ SetDialogFont(fontNum);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Dlg_ResetAlertStage(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef ResetAlertStage
+ PyMac_PRECHECK(ResetAlertStage);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ResetAlertStage();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Dlg_GetParamText(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Str255 param0;
+ Str255 param1;
+ Str255 param2;
+ Str255 param3;
+#ifndef GetParamText
+ PyMac_PRECHECK(GetParamText);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&",
+ PyMac_GetStr255, param0,
+ PyMac_GetStr255, param1,
+ PyMac_GetStr255, param2,
+ PyMac_GetStr255, param3))
+ return NULL;
+ GetParamText(param0,
+ param1,
+ param2,
+ param3);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Dlg_NewFeaturesDialog(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DialogPtr _rv;
+ Rect inBoundsRect;
+ Str255 inTitle;
+ Boolean inIsVisible;
+ SInt16 inProcID;
+ WindowPtr inBehind;
+ Boolean inGoAwayFlag;
+ SInt32 inRefCon;
+ Handle inItemListHandle;
+ UInt32 inFlags;
+#ifndef NewFeaturesDialog
+ PyMac_PRECHECK(NewFeaturesDialog);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&bhO&blO&l",
+ PyMac_GetRect, &inBoundsRect,
+ PyMac_GetStr255, inTitle,
+ &inIsVisible,
+ &inProcID,
+ WinObj_Convert, &inBehind,
+ &inGoAwayFlag,
+ &inRefCon,
+ ResObj_Convert, &inItemListHandle,
+ &inFlags))
+ return NULL;
+ _rv = NewFeaturesDialog((void *)0,
+ &inBoundsRect,
+ inTitle,
+ inIsVisible,
+ inProcID,
+ inBehind,
+ inGoAwayFlag,
+ inRefCon,
+ inItemListHandle,
+ inFlags);
+ _res = Py_BuildValue("O&",
+ DlgObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Dlg_GetDialogFromWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DialogPtr _rv;
+ WindowPtr window;
+#ifndef GetDialogFromWindow
+ PyMac_PRECHECK(GetDialogFromWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &window))
+ return NULL;
+ _rv = GetDialogFromWindow(window);
+ _res = Py_BuildValue("O&",
+ DlgObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Dlg_SetUserItemHandler(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ PyObject *new = NULL;
+
+
+ if (!PyArg_ParseTuple(_args, "|O", &new))
+ return NULL;
+
+ if (Dlg_UserItemProc_callback && new && new != Py_None) {
+ PyErr_SetString(Dlg_Error, "Another UserItemProc is already installed");
+ return NULL;
+ }
+
+ if (new == NULL || new == Py_None) {
+ new = NULL;
+ _res = Py_None;
+ Py_INCREF(Py_None);
+ } else {
+ Py_INCREF(new);
+ _res = Py_BuildValue("O&", ResObj_New, (Handle)NewUserItemUPP(Dlg_UnivUserItemProc));
+ }
+
+ Dlg_UserItemProc_callback = new;
+ return _res;
+
+}
+
+static PyMethodDef Dlg_methods[] = {
+ {"NewDialog", (PyCFunction)Dlg_NewDialog, 1,
+ PyDoc_STR("(Rect boundsRect, Str255 title, Boolean visible, SInt16 procID, WindowPtr behind, Boolean goAwayFlag, SInt32 refCon, Handle items) -> (DialogPtr _rv)")},
+ {"GetNewDialog", (PyCFunction)Dlg_GetNewDialog, 1,
+ PyDoc_STR("(SInt16 dialogID, WindowPtr behind) -> (DialogPtr _rv)")},
+ {"NewColorDialog", (PyCFunction)Dlg_NewColorDialog, 1,
+ PyDoc_STR("(Rect boundsRect, Str255 title, Boolean visible, SInt16 procID, WindowPtr behind, Boolean goAwayFlag, SInt32 refCon, Handle items) -> (DialogPtr _rv)")},
+ {"ModalDialog", (PyCFunction)Dlg_ModalDialog, 1,
+ PyDoc_STR("(PyObject* modalFilter) -> (DialogItemIndex itemHit)")},
+ {"IsDialogEvent", (PyCFunction)Dlg_IsDialogEvent, 1,
+ PyDoc_STR("(EventRecord theEvent) -> (Boolean _rv)")},
+ {"DialogSelect", (PyCFunction)Dlg_DialogSelect, 1,
+ PyDoc_STR("(EventRecord theEvent) -> (Boolean _rv, DialogPtr theDialog, DialogItemIndex itemHit)")},
+ {"Alert", (PyCFunction)Dlg_Alert, 1,
+ PyDoc_STR("(SInt16 alertID, PyObject* modalFilter) -> (DialogItemIndex _rv)")},
+ {"StopAlert", (PyCFunction)Dlg_StopAlert, 1,
+ PyDoc_STR("(SInt16 alertID, PyObject* modalFilter) -> (DialogItemIndex _rv)")},
+ {"NoteAlert", (PyCFunction)Dlg_NoteAlert, 1,
+ PyDoc_STR("(SInt16 alertID, PyObject* modalFilter) -> (DialogItemIndex _rv)")},
+ {"CautionAlert", (PyCFunction)Dlg_CautionAlert, 1,
+ PyDoc_STR("(SInt16 alertID, PyObject* modalFilter) -> (DialogItemIndex _rv)")},
+ {"ParamText", (PyCFunction)Dlg_ParamText, 1,
+ PyDoc_STR("(Str255 param0, Str255 param1, Str255 param2, Str255 param3) -> None")},
+ {"GetDialogItemText", (PyCFunction)Dlg_GetDialogItemText, 1,
+ PyDoc_STR("(Handle item) -> (Str255 text)")},
+ {"SetDialogItemText", (PyCFunction)Dlg_SetDialogItemText, 1,
+ PyDoc_STR("(Handle item, Str255 text) -> None")},
+ {"GetAlertStage", (PyCFunction)Dlg_GetAlertStage, 1,
+ PyDoc_STR("() -> (SInt16 _rv)")},
+ {"SetDialogFont", (PyCFunction)Dlg_SetDialogFont, 1,
+ PyDoc_STR("(SInt16 fontNum) -> None")},
+ {"ResetAlertStage", (PyCFunction)Dlg_ResetAlertStage, 1,
+ PyDoc_STR("() -> None")},
+ {"GetParamText", (PyCFunction)Dlg_GetParamText, 1,
+ PyDoc_STR("(Str255 param0, Str255 param1, Str255 param2, Str255 param3) -> None")},
+ {"NewFeaturesDialog", (PyCFunction)Dlg_NewFeaturesDialog, 1,
+ PyDoc_STR("(Rect inBoundsRect, Str255 inTitle, Boolean inIsVisible, SInt16 inProcID, WindowPtr inBehind, Boolean inGoAwayFlag, SInt32 inRefCon, Handle inItemListHandle, UInt32 inFlags) -> (DialogPtr _rv)")},
+ {"GetDialogFromWindow", (PyCFunction)Dlg_GetDialogFromWindow, 1,
+ PyDoc_STR("(WindowPtr window) -> (DialogPtr _rv)")},
+ {"SetUserItemHandler", (PyCFunction)Dlg_SetUserItemHandler, 1,
+ PyDoc_STR(NULL)},
+ {NULL, NULL, 0}
+};
+
+
+
+/* Return the WindowPtr corresponding to a DialogObject */
+#if 0
+WindowPtr
+DlgObj_ConvertToWindow(PyObject *self)
+{
+ if ( DlgObj_Check(self) )
+ return GetDialogWindow(((DialogObject *)self)->ob_itself);
+ return NULL;
+}
+#endif
+/* Return the object corresponding to the dialog, or None */
+
+PyObject *
+DlgObj_WhichDialog(DialogPtr d)
+{
+ PyObject *it;
+
+ if (d == NULL) {
+ it = Py_None;
+ Py_INCREF(it);
+ } else {
+ WindowPtr w = GetDialogWindow(d);
+
+ it = (PyObject *) GetWRefCon(w);
+ if (it == NULL || ((DialogObject *)it)->ob_itself != d || !DlgObj_Check(it)) {
+#if 0
+ /* Should do this, but we don't have an ob_freeit for dialogs yet. */
+ it = WinObj_New(w);
+ ((WindowObject *)it)->ob_freeit = NULL;
+#else
+ it = Py_None;
+ Py_INCREF(it);
+#endif
+ } else {
+ Py_INCREF(it);
+ }
+ }
+ return it;
+}
+
+#else /* __LP64__ */
+
+static PyMethodDef Dlg_methods[] = {
+ {NULL, NULL, 0}
+};
+
+#endif /* __LP64__ */
+
+
+void init_Dlg(void)
+{
+ PyObject *m;
+#ifndef __LP64__
+ PyObject *d;
+
+
+
+ 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 ||
+ PyDict_SetItemString(d, "Error", Dlg_Error) != 0)
+ return;
+ Dialog_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&Dialog_Type) < 0) return;
+ Py_INCREF(&Dialog_Type);
+ PyModule_AddObject(m, "Dialog", (PyObject *)&Dialog_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&Dialog_Type);
+ PyModule_AddObject(m, "DialogType", (PyObject *)&Dialog_Type);
+#endif /* !__LP64__ */
+}
+
+/* ======================== End module _Dlg ========================= */
+
diff --git a/Mac/Modules/dlg/dlgscan.py b/Mac/Modules/dlg/dlgscan.py
new file mode 100644
index 0000000000..a4d6d5b974
--- /dev/null
+++ b/Mac/Modules/dlg/dlgscan.py
@@ -0,0 +1,115 @@
+# Scan an Apple header file, generating a Python file of generator calls.
+
+import sys
+from bgenlocations import TOOLBOXDIR, BGENDIR
+sys.path.append(BGENDIR)
+
+from scantools import Scanner
+
+LONG = "Dialogs"
+SHORT = "dlg"
+OBJECT = "DialogPtr"
+
+def main():
+ input = LONG + ".h"
+ output = SHORT + "gen.py"
+ defsoutput = TOOLBOXDIR + LONG + ".py"
+ scanner = MyScanner(input, output, defsoutput)
+ scanner.scan()
+ scanner.close()
+ print "=== Testing definitions output code ==="
+ execfile(defsoutput, {}, {})
+ print "=== Done scanning and generating, now importing the generated code... ==="
+ exec "import " + SHORT + "support"
+ print "=== Done. It's up to you to compile it now! ==="
+
+class MyScanner(Scanner):
+
+ def destination(self, type, name, arglist):
+ classname = "Function"
+ listname = "functions"
+ if arglist:
+ t, n, m = arglist[0]
+ if t in ("DialogPtr", "DialogRef") and m == "InMode":
+ classname = "Method"
+ listname = "methods"
+ return classname, listname
+
+ def makeblacklistnames(self):
+ return [
+ 'InitDialogs',
+ 'ErrorSound',
+ # Dialogs are disposed when the object is deleted
+ 'CloseDialog',
+ 'DisposDialog',
+ 'DisposeDialog',
+ 'UpdtDialog',
+ 'CouldAlert',
+ 'FreeAlert',
+ 'CouldDialog',
+ 'FreeDialog',
+ 'GetStdFilterProc',
+ 'GetDialogParent',
+## # Can't find these in the CW Pro 3 libraries
+ 'SetDialogMovableModal',
+ 'GetDialogControlNotificationProc',
+ 'SetGrafPortOfDialog', # Funny, and probably not useful
+ # Can't find these:
+ 'CloseStandardSheet',
+ 'RunStandardAlert',
+ ]
+
+ def makeblacklisttypes(self):
+ return [
+ "AlertStdAlertParamPtr", # Too much work, for now
+ "AlertStdAlertParamRec", # ditto
+ "AlertStdAlertParamRec_ptr", # ditto
+ "AlertStdCFStringAlertParamPtr", # ditto
+ "AlertStdCFStringAlertParamRec",
+ "AlertStdCFStringAlertParamRec_ptr",
+ "QTModelessCallbackProcPtr",
+ ]
+
+ def makerepairinstructions(self):
+ return [
+ ([("Str255", "*", "InMode")],
+ [("*", "*", "OutMode")]),
+
+ ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
+ [("InBuffer", "*", "*")]),
+
+ ([("void", "*", "OutMode"), ("long", "*", "InMode"),
+ ("long", "*", "OutMode")],
+ [("VarVarOutBuffer", "*", "InOutMode")]),
+
+ # GetDialogItem return handle is optional
+ ([("Handle", "item", "OutMode")],
+ [("OptHandle", "item", "OutMode")]),
+
+ # NewDialog ETC.
+ ([("void", "*", "OutMode")],
+ [("NullStorage", "*", "InMode")]),
+
+ ([("DialogPtr", "*", "OutMode")],
+ [("ExistingDialogPtr", "*", "*")]),
+ ([("DialogRef", "*", "OutMode")],
+ [("ExistingDialogPtr", "*", "*")]),
+ ([("WindowPtr", "*", "OutMode")],
+ [("ExistingWindowPtr", "*", "*")]),
+ ([("WindowPtr", "*", "ReturnMode")],
+ [("ExistingWindowPtr", "*", "*")]),
+
+ # StdFilterProc
+ ([('EventRecord', 'event', 'OutMode'),
+ ('DialogItemIndex', 'itemHit', 'OutMode')],
+ [('EventRecord', 'event', 'InOutMode'),
+ ('DialogItemIndex', 'itemHit', 'InOutMode')])
+
+ ]
+
+ def writeinitialdefs(self):
+ self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/Mac/Modules/dlg/dlgsupport.py b/Mac/Modules/dlg/dlgsupport.py
new file mode 100644
index 0000000000..fa1442ec37
--- /dev/null
+++ b/Mac/Modules/dlg/dlgsupport.py
@@ -0,0 +1,278 @@
+# This script generates the Dialogs interface for Python.
+# It uses the "bgen" package to generate C code.
+# It execs the file dlggen.py which contain the function definitions
+# (dlggen.py was generated by dlgscan.py, scanning the <Dialogs.h> header file).
+
+from macsupport import *
+
+# Create the type objects
+
+DialogPtr = OpaqueByValueType("DialogPtr", "DlgObj")
+DialogRef = DialogPtr
+
+# An OptHandle is either a handle or None (in case NULL is passed in).
+# This is needed for GetDialogItem().
+OptHandle = OpaqueByValueType("Handle", "OptResObj")
+
+ModalFilterProcPtr = InputOnlyType("PyObject*", "O")
+ModalFilterProcPtr.passInput = lambda name: "Dlg_PassFilterProc(%s)" % name
+ModalFilterUPP = ModalFilterProcPtr
+
+RgnHandle = OpaqueByValueType("RgnHandle", "ResObj")
+TEHandle = OpaqueByValueType("TEHandle", "ResObj")
+CGrafPtr = OpaqueByValueType("CGrafPtr", "GrafObj")
+
+DITLMethod = Type("DITLMethod", "h")
+DialogItemIndex = Type("DialogItemIndex", "h")
+DialogItemType = Type("DialogItemType", "h")
+DialogItemIndexZeroBased = Type("DialogItemIndexZeroBased", "h")
+AlertType = Type("AlertType", "h")
+StringPtr = Str255
+EventMask = Type("EventMask", "H")
+
+includestuff = includestuff + """
+#include <Carbon/Carbon.h>
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_DlgObj_New(DialogRef);
+extern PyObject *_DlgObj_WhichDialog(DialogRef);
+extern int _DlgObj_Convert(PyObject *, DialogRef *);
+
+#define DlgObj_New _DlgObj_New
+#define DlgObj_WhichDialog _DlgObj_WhichDialog
+#define DlgObj_Convert _DlgObj_Convert
+#endif
+
+/* XXX Shouldn't this be a stack? */
+static PyObject *Dlg_FilterProc_callback = NULL;
+
+static pascal Boolean Dlg_UnivFilterProc(DialogPtr dialog,
+ EventRecord *event,
+ short *itemHit)
+{
+ Boolean rv;
+ PyObject *args, *res;
+ PyObject *callback = Dlg_FilterProc_callback;
+ if (callback == NULL)
+ return 0; /* Default behavior */
+ Dlg_FilterProc_callback = NULL; /* We'll restore it when call successful */
+ args = Py_BuildValue("O&O&", DlgObj_WhichDialog, dialog, PyMac_BuildEventRecord, event);
+ if (args == NULL)
+ res = NULL;
+ else {
+ res = PyEval_CallObject(callback, args);
+ Py_DECREF(args);
+ }
+ if (res == NULL) {
+ PySys_WriteStderr("Exception in Dialog Filter\\n");
+ PyErr_Print();
+ *itemHit = -1; /* Fake return item */
+ return 1; /* We handled it */
+ }
+ else {
+ Dlg_FilterProc_callback = callback;
+ if (PyInt_Check(res)) {
+ *itemHit = PyInt_AsLong(res);
+ rv = 1;
+ }
+ else
+ rv = PyObject_IsTrue(res);
+ }
+ Py_DECREF(res);
+ return rv;
+}
+
+static ModalFilterUPP
+Dlg_PassFilterProc(PyObject *callback)
+{
+ PyObject *tmp = Dlg_FilterProc_callback;
+ static ModalFilterUPP UnivFilterUpp = NULL;
+
+ Dlg_FilterProc_callback = NULL;
+ if (callback == Py_None) {
+ Py_XDECREF(tmp);
+ return NULL;
+ }
+ Py_INCREF(callback);
+ Dlg_FilterProc_callback = callback;
+ Py_XDECREF(tmp);
+ if ( UnivFilterUpp == NULL )
+ UnivFilterUpp = NewModalFilterUPP(&Dlg_UnivFilterProc);
+ return UnivFilterUpp;
+}
+
+static PyObject *Dlg_UserItemProc_callback = NULL;
+
+static pascal void Dlg_UnivUserItemProc(DialogPtr dialog,
+ short item)
+{
+ PyObject *args, *res;
+
+ if (Dlg_UserItemProc_callback == NULL)
+ return; /* Default behavior */
+ Dlg_FilterProc_callback = NULL; /* We'll restore it when call successful */
+ args = Py_BuildValue("O&h", DlgObj_WhichDialog, dialog, item);
+ if (args == NULL)
+ res = NULL;
+ else {
+ res = PyEval_CallObject(Dlg_UserItemProc_callback, args);
+ Py_DECREF(args);
+ }
+ if (res == NULL) {
+ PySys_WriteStderr("Exception in Dialog UserItem proc\\n");
+ PyErr_Print();
+ }
+ Py_XDECREF(res);
+ return;
+}
+
+#if 0
+/*
+** Treating DialogObjects as WindowObjects is (I think) illegal under Carbon.
+** However, as they are still identical under MacOS9 Carbon this is a problem, even
+** if we neatly call GetDialogWindow() at the right places: there's one refcon field
+** and it points to the DialogObject, so WinObj_WhichWindow will smartly return the
+** dialog object, and therefore we still don't have a WindowObject.
+** I'll leave the chaining code in place for now, with this comment to warn the
+** unsuspecting victims (i.e. me, probably, in a few weeks:-)
+*/
+extern PyMethodChain WinObj_chain;
+#endif
+"""
+
+finalstuff = finalstuff + """
+/* Return the WindowPtr corresponding to a DialogObject */
+#if 0
+WindowPtr
+DlgObj_ConvertToWindow(PyObject *self)
+{
+ if ( DlgObj_Check(self) )
+ return GetDialogWindow(((DialogObject *)self)->ob_itself);
+ return NULL;
+}
+#endif
+/* Return the object corresponding to the dialog, or None */
+
+PyObject *
+DlgObj_WhichDialog(DialogPtr d)
+{
+ PyObject *it;
+
+ if (d == NULL) {
+ it = Py_None;
+ Py_INCREF(it);
+ } else {
+ WindowPtr w = GetDialogWindow(d);
+
+ it = (PyObject *) GetWRefCon(w);
+ if (it == NULL || ((DialogObject *)it)->ob_itself != d || !DlgObj_Check(it)) {
+#if 0
+ /* Should do this, but we don't have an ob_freeit for dialogs yet. */
+ it = WinObj_New(w);
+ ((WindowObject *)it)->ob_freeit = NULL;
+#else
+ it = Py_None;
+ Py_INCREF(it);
+#endif
+ } else {
+ Py_INCREF(it);
+ }
+ }
+ return it;
+}
+"""
+
+initstuff = initstuff + """
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(DialogPtr, DlgObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(DialogPtr, DlgObj_WhichDialog);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(DialogPtr, DlgObj_Convert);
+"""
+
+
+# Define a class which specializes our object definition
+class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
+ def __init__(self, name, prefix = None, itselftype = None):
+ GlobalObjectDefinition.__init__(self, name, prefix, itselftype)
+## This won't work in Carbon, so we disable it for all MacPythons:-(
+## But see the comment above:-((
+## self.basechain = "&WinObj_chain"
+
+ def outputInitStructMembers(self):
+ GlobalObjectDefinition.outputInitStructMembers(self)
+ Output("SetWRefCon(GetDialogWindow(itself), (long)it);")
+
+ def outputCheckNewArg(self):
+ Output("if (itself == NULL) { Py_INCREF(Py_None); return Py_None; }")
+
+ def outputCheckConvertArg(self):
+ Output("if (v == Py_None) { *p_itself = NULL; return 1; }")
+ Output("if (PyInt_Check(v)) { *p_itself = (DialogPtr)PyInt_AsLong(v);")
+ Output(" return 1; }")
+
+ def outputCompare(self):
+ Output()
+ Output("static int %s_compare(%s *self, %s *other)", self.prefix, self.objecttype, self.objecttype)
+ OutLbrace()
+ Output("if ( self->ob_itself > other->ob_itself ) return 1;")
+ Output("if ( self->ob_itself < other->ob_itself ) return -1;")
+ Output("return 0;")
+ OutRbrace()
+
+ def outputHash(self):
+ Output()
+ Output("static int %s_hash(%s *self)", self.prefix, self.objecttype)
+ OutLbrace()
+ Output("return (int)self->ob_itself;")
+ OutRbrace()
+
+ def outputFreeIt(self, itselfname):
+ Output("DisposeDialog(%s);", itselfname)
+
+# Create the generator groups and link them
+module = MacModule('_Dlg', 'Dlg', includestuff, finalstuff, initstuff)
+object = MyObjectDefinition('Dialog', 'DlgObj', 'DialogPtr')
+module.addobject(object)
+
+# Create the generator classes used to populate the lists
+Function = OSErrWeakLinkFunctionGenerator
+Method = OSErrWeakLinkMethodGenerator
+
+# Create and populate the lists
+functions = []
+methods = []
+execfile("dlggen.py")
+
+# add the populated lists to the generator groups
+for f in functions: module.add(f)
+for f in methods: object.add(f)
+
+setuseritembody = """
+ PyObject *new = NULL;
+
+
+ if (!PyArg_ParseTuple(_args, "|O", &new))
+ return NULL;
+
+ if (Dlg_UserItemProc_callback && new && new != Py_None) {
+ PyErr_SetString(Dlg_Error, "Another UserItemProc is already installed");
+ return NULL;
+ }
+
+ if (new == NULL || new == Py_None) {
+ new = NULL;
+ _res = Py_None;
+ Py_INCREF(Py_None);
+ } else {
+ Py_INCREF(new);
+ _res = Py_BuildValue("O&", ResObj_New, (Handle)NewUserItemUPP(Dlg_UnivUserItemProc));
+ }
+
+ Dlg_UserItemProc_callback = new;
+ return _res;
+"""
+f = ManualGenerator("SetUserItemHandler", setuseritembody)
+module.add(f)
+
+# generate output
+SetOutputFileName('_Dlgmodule.c')
+module.generate()
diff --git a/Mac/Modules/drag/_Dragmodule.c b/Mac/Modules/drag/_Dragmodule.c
new file mode 100644
index 0000000000..aa87690d72
--- /dev/null
+++ b/Mac/Modules/drag/_Dragmodule.c
@@ -0,0 +1,1158 @@
+
+/* ========================== Module _Drag ========================== */
+
+#include "Python.h"
+
+#ifndef __LP64__
+
+
+#include "pymactoolbox.h"
+
+/* Macro to test whether a weak-loaded CFM function exists */
+#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
+ PyErr_SetString(PyExc_NotImplementedError, \
+ "Not available in this shared library/OS version"); \
+ return NULL; \
+ }} while(0)
+
+
+#include <Carbon/Carbon.h>
+
+/* Callback glue routines */
+DragTrackingHandlerUPP dragglue_TrackingHandlerUPP;
+DragReceiveHandlerUPP dragglue_ReceiveHandlerUPP;
+DragSendDataUPP dragglue_SendDataUPP;
+#if 0
+DragInputUPP dragglue_InputUPP;
+DragDrawingUPP dragglue_DrawingUPP;
+#endif
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_DragObj_New(DragRef);
+extern int _DragObj_Convert(PyObject *, DragRef *);
+
+#define DragObj_New _DragObj_New
+#define DragObj_Convert _DragObj_Convert
+#endif
+
+static PyObject *Drag_Error;
+
+/* ---------------------- Object type DragObj ----------------------- */
+
+PyTypeObject DragObj_Type;
+
+#define DragObj_Check(x) ((x)->ob_type == &DragObj_Type || PyObject_TypeCheck((x), &DragObj_Type))
+
+typedef struct DragObjObject {
+ PyObject_HEAD
+ DragRef ob_itself;
+ PyObject *sendproc;
+} DragObjObject;
+
+PyObject *DragObj_New(DragRef itself)
+{
+ DragObjObject *it;
+ if (itself == NULL) {
+ PyErr_SetString(Drag_Error,"Cannot create null Drag");
+ return NULL;
+ }
+ it = PyObject_NEW(DragObjObject, &DragObj_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ it->sendproc = NULL;
+ return (PyObject *)it;
+}
+
+int DragObj_Convert(PyObject *v, DragRef *p_itself)
+{
+ if (!DragObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "DragObj required");
+ return 0;
+ }
+ *p_itself = ((DragObjObject *)v)->ob_itself;
+ return 1;
+}
+
+static void DragObj_dealloc(DragObjObject *self)
+{
+ Py_XDECREF(self->sendproc);
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *DragObj_DisposeDrag(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+#ifndef DisposeDrag
+ PyMac_PRECHECK(DisposeDrag);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = DisposeDrag(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DragObj_AddDragItemFlavor(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ItemReference theItemRef;
+ FlavorType theType;
+ char *dataPtr__in__;
+ long dataPtr__len__;
+ int dataPtr__in_len__;
+ FlavorFlags theFlags;
+#ifndef AddDragItemFlavor
+ PyMac_PRECHECK(AddDragItemFlavor);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&z#l",
+ &theItemRef,
+ PyMac_GetOSType, &theType,
+ &dataPtr__in__, &dataPtr__in_len__,
+ &theFlags))
+ return NULL;
+ dataPtr__len__ = dataPtr__in_len__;
+ _err = AddDragItemFlavor(_self->ob_itself,
+ theItemRef,
+ theType,
+ dataPtr__in__, dataPtr__len__,
+ theFlags);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DragObj_SetDragItemFlavorData(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ItemReference theItemRef;
+ FlavorType theType;
+ char *dataPtr__in__;
+ long dataPtr__len__;
+ int dataPtr__in_len__;
+ UInt32 dataOffset;
+#ifndef SetDragItemFlavorData
+ PyMac_PRECHECK(SetDragItemFlavorData);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&z#l",
+ &theItemRef,
+ PyMac_GetOSType, &theType,
+ &dataPtr__in__, &dataPtr__in_len__,
+ &dataOffset))
+ return NULL;
+ dataPtr__len__ = dataPtr__in_len__;
+ _err = SetDragItemFlavorData(_self->ob_itself,
+ theItemRef,
+ theType,
+ dataPtr__in__, dataPtr__len__,
+ dataOffset);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DragObj_SetDragImage(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ PixMapHandle imagePixMap;
+ RgnHandle imageRgn;
+ Point imageOffsetPt;
+ DragImageFlags theImageFlags;
+#ifndef SetDragImage
+ PyMac_PRECHECK(SetDragImage);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&l",
+ ResObj_Convert, &imagePixMap,
+ ResObj_Convert, &imageRgn,
+ PyMac_GetPoint, &imageOffsetPt,
+ &theImageFlags))
+ return NULL;
+ _err = SetDragImage(_self->ob_itself,
+ imagePixMap,
+ imageRgn,
+ imageOffsetPt,
+ theImageFlags);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DragObj_ChangeDragBehaviors(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ DragBehaviors inBehaviorsToSet;
+ DragBehaviors inBehaviorsToClear;
+#ifndef ChangeDragBehaviors
+ PyMac_PRECHECK(ChangeDragBehaviors);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &inBehaviorsToSet,
+ &inBehaviorsToClear))
+ return NULL;
+ _err = ChangeDragBehaviors(_self->ob_itself,
+ inBehaviorsToSet,
+ inBehaviorsToClear);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DragObj_TrackDrag(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ EventRecord theEvent;
+ RgnHandle theRegion;
+#ifndef TrackDrag
+ PyMac_PRECHECK(TrackDrag);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetEventRecord, &theEvent,
+ ResObj_Convert, &theRegion))
+ return NULL;
+ _err = TrackDrag(_self->ob_itself,
+ &theEvent,
+ theRegion);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DragObj_CountDragItems(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ UInt16 numItems;
+#ifndef CountDragItems
+ PyMac_PRECHECK(CountDragItems);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = CountDragItems(_self->ob_itself,
+ &numItems);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("H",
+ numItems);
+ return _res;
+}
+
+static PyObject *DragObj_GetDragItemReferenceNumber(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ UInt16 index;
+ ItemReference theItemRef;
+#ifndef GetDragItemReferenceNumber
+ PyMac_PRECHECK(GetDragItemReferenceNumber);
+#endif
+ if (!PyArg_ParseTuple(_args, "H",
+ &index))
+ return NULL;
+ _err = GetDragItemReferenceNumber(_self->ob_itself,
+ index,
+ &theItemRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ theItemRef);
+ return _res;
+}
+
+static PyObject *DragObj_CountDragItemFlavors(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ItemReference theItemRef;
+ UInt16 numFlavors;
+#ifndef CountDragItemFlavors
+ PyMac_PRECHECK(CountDragItemFlavors);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &theItemRef))
+ return NULL;
+ _err = CountDragItemFlavors(_self->ob_itself,
+ theItemRef,
+ &numFlavors);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("H",
+ numFlavors);
+ return _res;
+}
+
+static PyObject *DragObj_GetFlavorType(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ItemReference theItemRef;
+ UInt16 index;
+ FlavorType theType;
+#ifndef GetFlavorType
+ PyMac_PRECHECK(GetFlavorType);
+#endif
+ if (!PyArg_ParseTuple(_args, "lH",
+ &theItemRef,
+ &index))
+ return NULL;
+ _err = GetFlavorType(_self->ob_itself,
+ theItemRef,
+ index,
+ &theType);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildOSType, theType);
+ return _res;
+}
+
+static PyObject *DragObj_GetFlavorFlags(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ItemReference theItemRef;
+ FlavorType theType;
+ FlavorFlags theFlags;
+#ifndef GetFlavorFlags
+ PyMac_PRECHECK(GetFlavorFlags);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&",
+ &theItemRef,
+ PyMac_GetOSType, &theType))
+ return NULL;
+ _err = GetFlavorFlags(_self->ob_itself,
+ theItemRef,
+ theType,
+ &theFlags);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ theFlags);
+ return _res;
+}
+
+static PyObject *DragObj_GetFlavorDataSize(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ItemReference theItemRef;
+ FlavorType theType;
+ Size dataSize;
+#ifndef GetFlavorDataSize
+ PyMac_PRECHECK(GetFlavorDataSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&",
+ &theItemRef,
+ PyMac_GetOSType, &theType))
+ return NULL;
+ _err = GetFlavorDataSize(_self->ob_itself,
+ theItemRef,
+ theType,
+ &dataSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ dataSize);
+ return _res;
+}
+
+static PyObject *DragObj_GetFlavorData(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ItemReference theItemRef;
+ FlavorType theType;
+ char *dataPtr__out__;
+ long dataPtr__len__;
+ int dataPtr__in_len__;
+ UInt32 dataOffset;
+#ifndef GetFlavorData
+ PyMac_PRECHECK(GetFlavorData);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&il",
+ &theItemRef,
+ PyMac_GetOSType, &theType,
+ &dataPtr__in_len__,
+ &dataOffset))
+ return NULL;
+ if ((dataPtr__out__ = malloc(dataPtr__in_len__)) == NULL)
+ {
+ PyErr_NoMemory();
+ goto dataPtr__error__;
+ }
+ dataPtr__len__ = dataPtr__in_len__;
+ _err = GetFlavorData(_self->ob_itself,
+ theItemRef,
+ theType,
+ dataPtr__out__, &dataPtr__len__,
+ dataOffset);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("s#",
+ dataPtr__out__, (int)dataPtr__len__);
+ free(dataPtr__out__);
+ dataPtr__error__: ;
+ return _res;
+}
+
+static PyObject *DragObj_GetDragItemBounds(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ItemReference theItemRef;
+ Rect itemBounds;
+#ifndef GetDragItemBounds
+ PyMac_PRECHECK(GetDragItemBounds);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &theItemRef))
+ return NULL;
+ _err = GetDragItemBounds(_self->ob_itself,
+ theItemRef,
+ &itemBounds);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &itemBounds);
+ return _res;
+}
+
+static PyObject *DragObj_SetDragItemBounds(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ItemReference theItemRef;
+ Rect itemBounds;
+#ifndef SetDragItemBounds
+ PyMac_PRECHECK(SetDragItemBounds);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&",
+ &theItemRef,
+ PyMac_GetRect, &itemBounds))
+ return NULL;
+ _err = SetDragItemBounds(_self->ob_itself,
+ theItemRef,
+ &itemBounds);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DragObj_GetDropLocation(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEDesc dropLocation;
+#ifndef GetDropLocation
+ PyMac_PRECHECK(GetDropLocation);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetDropLocation(_self->ob_itself,
+ &dropLocation);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &dropLocation);
+ return _res;
+}
+
+static PyObject *DragObj_SetDropLocation(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEDesc dropLocation;
+#ifndef SetDropLocation
+ PyMac_PRECHECK(SetDropLocation);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ AEDesc_Convert, &dropLocation))
+ return NULL;
+ _err = SetDropLocation(_self->ob_itself,
+ &dropLocation);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DragObj_GetDragAttributes(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ DragAttributes flags;
+#ifndef GetDragAttributes
+ PyMac_PRECHECK(GetDragAttributes);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetDragAttributes(_self->ob_itself,
+ &flags);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ flags);
+ return _res;
+}
+
+static PyObject *DragObj_GetDragMouse(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Point mouse;
+ Point globalPinnedMouse;
+#ifndef GetDragMouse
+ PyMac_PRECHECK(GetDragMouse);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetDragMouse(_self->ob_itself,
+ &mouse,
+ &globalPinnedMouse);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&O&",
+ PyMac_BuildPoint, mouse,
+ PyMac_BuildPoint, globalPinnedMouse);
+ return _res;
+}
+
+static PyObject *DragObj_SetDragMouse(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Point globalPinnedMouse;
+#ifndef SetDragMouse
+ PyMac_PRECHECK(SetDragMouse);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &globalPinnedMouse))
+ return NULL;
+ _err = SetDragMouse(_self->ob_itself,
+ globalPinnedMouse);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DragObj_GetDragOrigin(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Point globalInitialMouse;
+#ifndef GetDragOrigin
+ PyMac_PRECHECK(GetDragOrigin);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetDragOrigin(_self->ob_itself,
+ &globalInitialMouse);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, globalInitialMouse);
+ return _res;
+}
+
+static PyObject *DragObj_GetDragModifiers(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 modifiers;
+ SInt16 mouseDownModifiers;
+ SInt16 mouseUpModifiers;
+#ifndef GetDragModifiers
+ PyMac_PRECHECK(GetDragModifiers);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetDragModifiers(_self->ob_itself,
+ &modifiers,
+ &mouseDownModifiers,
+ &mouseUpModifiers);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("hhh",
+ modifiers,
+ mouseDownModifiers,
+ mouseUpModifiers);
+ return _res;
+}
+
+static PyObject *DragObj_ShowDragHilite(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ RgnHandle hiliteFrame;
+ Boolean inside;
+#ifndef ShowDragHilite
+ PyMac_PRECHECK(ShowDragHilite);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&b",
+ ResObj_Convert, &hiliteFrame,
+ &inside))
+ return NULL;
+ _err = ShowDragHilite(_self->ob_itself,
+ hiliteFrame,
+ inside);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DragObj_HideDragHilite(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+#ifndef HideDragHilite
+ PyMac_PRECHECK(HideDragHilite);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = HideDragHilite(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DragObj_DragPreScroll(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 dH;
+ SInt16 dV;
+#ifndef DragPreScroll
+ PyMac_PRECHECK(DragPreScroll);
+#endif
+ if (!PyArg_ParseTuple(_args, "hh",
+ &dH,
+ &dV))
+ return NULL;
+ _err = DragPreScroll(_self->ob_itself,
+ dH,
+ dV);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DragObj_DragPostScroll(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+#ifndef DragPostScroll
+ PyMac_PRECHECK(DragPostScroll);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = DragPostScroll(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DragObj_UpdateDragHilite(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ RgnHandle updateRgn;
+#ifndef UpdateDragHilite
+ PyMac_PRECHECK(UpdateDragHilite);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &updateRgn))
+ return NULL;
+ _err = UpdateDragHilite(_self->ob_itself,
+ updateRgn);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyMethodDef DragObj_methods[] = {
+ {"DisposeDrag", (PyCFunction)DragObj_DisposeDrag, 1,
+ PyDoc_STR("() -> None")},
+ {"AddDragItemFlavor", (PyCFunction)DragObj_AddDragItemFlavor, 1,
+ PyDoc_STR("(ItemReference theItemRef, FlavorType theType, Buffer dataPtr, FlavorFlags theFlags) -> None")},
+ {"SetDragItemFlavorData", (PyCFunction)DragObj_SetDragItemFlavorData, 1,
+ PyDoc_STR("(ItemReference theItemRef, FlavorType theType, Buffer dataPtr, UInt32 dataOffset) -> None")},
+ {"SetDragImage", (PyCFunction)DragObj_SetDragImage, 1,
+ PyDoc_STR("(PixMapHandle imagePixMap, RgnHandle imageRgn, Point imageOffsetPt, DragImageFlags theImageFlags) -> None")},
+ {"ChangeDragBehaviors", (PyCFunction)DragObj_ChangeDragBehaviors, 1,
+ PyDoc_STR("(DragBehaviors inBehaviorsToSet, DragBehaviors inBehaviorsToClear) -> None")},
+ {"TrackDrag", (PyCFunction)DragObj_TrackDrag, 1,
+ PyDoc_STR("(EventRecord theEvent, RgnHandle theRegion) -> None")},
+ {"CountDragItems", (PyCFunction)DragObj_CountDragItems, 1,
+ PyDoc_STR("() -> (UInt16 numItems)")},
+ {"GetDragItemReferenceNumber", (PyCFunction)DragObj_GetDragItemReferenceNumber, 1,
+ PyDoc_STR("(UInt16 index) -> (ItemReference theItemRef)")},
+ {"CountDragItemFlavors", (PyCFunction)DragObj_CountDragItemFlavors, 1,
+ PyDoc_STR("(ItemReference theItemRef) -> (UInt16 numFlavors)")},
+ {"GetFlavorType", (PyCFunction)DragObj_GetFlavorType, 1,
+ PyDoc_STR("(ItemReference theItemRef, UInt16 index) -> (FlavorType theType)")},
+ {"GetFlavorFlags", (PyCFunction)DragObj_GetFlavorFlags, 1,
+ PyDoc_STR("(ItemReference theItemRef, FlavorType theType) -> (FlavorFlags theFlags)")},
+ {"GetFlavorDataSize", (PyCFunction)DragObj_GetFlavorDataSize, 1,
+ PyDoc_STR("(ItemReference theItemRef, FlavorType theType) -> (Size dataSize)")},
+ {"GetFlavorData", (PyCFunction)DragObj_GetFlavorData, 1,
+ PyDoc_STR("(ItemReference theItemRef, FlavorType theType, Buffer dataPtr, UInt32 dataOffset) -> (Buffer dataPtr)")},
+ {"GetDragItemBounds", (PyCFunction)DragObj_GetDragItemBounds, 1,
+ PyDoc_STR("(ItemReference theItemRef) -> (Rect itemBounds)")},
+ {"SetDragItemBounds", (PyCFunction)DragObj_SetDragItemBounds, 1,
+ PyDoc_STR("(ItemReference theItemRef, Rect itemBounds) -> None")},
+ {"GetDropLocation", (PyCFunction)DragObj_GetDropLocation, 1,
+ PyDoc_STR("() -> (AEDesc dropLocation)")},
+ {"SetDropLocation", (PyCFunction)DragObj_SetDropLocation, 1,
+ PyDoc_STR("(AEDesc dropLocation) -> None")},
+ {"GetDragAttributes", (PyCFunction)DragObj_GetDragAttributes, 1,
+ PyDoc_STR("() -> (DragAttributes flags)")},
+ {"GetDragMouse", (PyCFunction)DragObj_GetDragMouse, 1,
+ PyDoc_STR("() -> (Point mouse, Point globalPinnedMouse)")},
+ {"SetDragMouse", (PyCFunction)DragObj_SetDragMouse, 1,
+ PyDoc_STR("(Point globalPinnedMouse) -> None")},
+ {"GetDragOrigin", (PyCFunction)DragObj_GetDragOrigin, 1,
+ PyDoc_STR("() -> (Point globalInitialMouse)")},
+ {"GetDragModifiers", (PyCFunction)DragObj_GetDragModifiers, 1,
+ PyDoc_STR("() -> (SInt16 modifiers, SInt16 mouseDownModifiers, SInt16 mouseUpModifiers)")},
+ {"ShowDragHilite", (PyCFunction)DragObj_ShowDragHilite, 1,
+ PyDoc_STR("(RgnHandle hiliteFrame, Boolean inside) -> None")},
+ {"HideDragHilite", (PyCFunction)DragObj_HideDragHilite, 1,
+ PyDoc_STR("() -> None")},
+ {"DragPreScroll", (PyCFunction)DragObj_DragPreScroll, 1,
+ PyDoc_STR("(SInt16 dH, SInt16 dV) -> None")},
+ {"DragPostScroll", (PyCFunction)DragObj_DragPostScroll, 1,
+ PyDoc_STR("() -> None")},
+ {"UpdateDragHilite", (PyCFunction)DragObj_UpdateDragHilite, 1,
+ PyDoc_STR("(RgnHandle updateRgn) -> None")},
+ {NULL, NULL, 0}
+};
+
+#define DragObj_getsetlist NULL
+
+
+#define DragObj_compare NULL
+
+#define DragObj_repr NULL
+
+#define DragObj_hash NULL
+#define DragObj_tp_init 0
+
+#define DragObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *DragObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *_self;
+ DragRef itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, DragObj_Convert, &itself)) return NULL;
+ if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((DragObjObject *)_self)->ob_itself = itself;
+ return _self;
+}
+
+#define DragObj_tp_free PyObject_Del
+
+
+PyTypeObject DragObj_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_Drag.DragObj", /*tp_name*/
+ sizeof(DragObjObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) DragObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) DragObj_compare, /*tp_compare*/
+ (reprfunc) DragObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) DragObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ DragObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ DragObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ DragObj_tp_init, /* tp_init */
+ DragObj_tp_alloc, /* tp_alloc */
+ DragObj_tp_new, /* tp_new */
+ DragObj_tp_free, /* tp_free */
+};
+
+/* -------------------- End object type DragObj --------------------- */
+
+
+static PyObject *Drag_NewDrag(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ DragRef theDrag;
+#ifndef NewDrag
+ PyMac_PRECHECK(NewDrag);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = NewDrag(&theDrag);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ DragObj_New, theDrag);
+ return _res;
+}
+
+static PyObject *Drag_GetDragHiliteColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ WindowPtr window;
+ RGBColor color;
+#ifndef GetDragHiliteColor
+ PyMac_PRECHECK(GetDragHiliteColor);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &window))
+ return NULL;
+ _err = GetDragHiliteColor(window,
+ &color);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ QdRGB_New, &color);
+ return _res;
+}
+
+static PyObject *Drag_WaitMouseMoved(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Point initialMouse;
+#ifndef WaitMouseMoved
+ PyMac_PRECHECK(WaitMouseMoved);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &initialMouse))
+ return NULL;
+ _rv = WaitMouseMoved(initialMouse);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Drag_ZoomRects(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Rect fromRect;
+ Rect toRect;
+ SInt16 zoomSteps;
+ ZoomAcceleration acceleration;
+#ifndef ZoomRects
+ PyMac_PRECHECK(ZoomRects);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&hh",
+ PyMac_GetRect, &fromRect,
+ PyMac_GetRect, &toRect,
+ &zoomSteps,
+ &acceleration))
+ return NULL;
+ _err = ZoomRects(&fromRect,
+ &toRect,
+ zoomSteps,
+ acceleration);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Drag_ZoomRegion(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ RgnHandle region;
+ Point zoomDistance;
+ SInt16 zoomSteps;
+ ZoomAcceleration acceleration;
+#ifndef ZoomRegion
+ PyMac_PRECHECK(ZoomRegion);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&hh",
+ ResObj_Convert, &region,
+ PyMac_GetPoint, &zoomDistance,
+ &zoomSteps,
+ &acceleration))
+ return NULL;
+ _err = ZoomRegion(region,
+ zoomDistance,
+ zoomSteps,
+ acceleration);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Drag_InstallTrackingHandler(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ PyObject *callback;
+ WindowPtr theWindow = NULL;
+ OSErr _err;
+
+ if ( !PyArg_ParseTuple(_args, "O|O&", &callback, WinObj_Convert, &theWindow) )
+ return NULL;
+ Py_INCREF(callback); /* Cannot decref later, too bad */
+ _err = InstallTrackingHandler(dragglue_TrackingHandlerUPP, theWindow, (void *)callback);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+
+}
+
+static PyObject *Drag_InstallReceiveHandler(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ PyObject *callback;
+ WindowPtr theWindow = NULL;
+ OSErr _err;
+
+ if ( !PyArg_ParseTuple(_args, "O|O&", &callback, WinObj_Convert, &theWindow) )
+ return NULL;
+ Py_INCREF(callback); /* Cannot decref later, too bad */
+ _err = InstallReceiveHandler(dragglue_ReceiveHandlerUPP, theWindow, (void *)callback);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+
+}
+
+static PyObject *Drag_RemoveTrackingHandler(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ WindowPtr theWindow = NULL;
+ OSErr _err;
+
+ if ( !PyArg_ParseTuple(_args, "|O&", WinObj_Convert, &theWindow) )
+ return NULL;
+ _err = RemoveTrackingHandler(dragglue_TrackingHandlerUPP, theWindow);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+
+}
+
+static PyObject *Drag_RemoveReceiveHandler(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ WindowPtr theWindow = NULL;
+ OSErr _err;
+
+ if ( !PyArg_ParseTuple(_args, "|O&", WinObj_Convert, &theWindow) )
+ return NULL;
+ _err = RemoveReceiveHandler(dragglue_ReceiveHandlerUPP, theWindow);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+
+}
+
+static PyMethodDef Drag_methods[] = {
+ {"NewDrag", (PyCFunction)Drag_NewDrag, 1,
+ PyDoc_STR("() -> (DragRef theDrag)")},
+ {"GetDragHiliteColor", (PyCFunction)Drag_GetDragHiliteColor, 1,
+ PyDoc_STR("(WindowPtr window) -> (RGBColor color)")},
+ {"WaitMouseMoved", (PyCFunction)Drag_WaitMouseMoved, 1,
+ PyDoc_STR("(Point initialMouse) -> (Boolean _rv)")},
+ {"ZoomRects", (PyCFunction)Drag_ZoomRects, 1,
+ PyDoc_STR("(Rect fromRect, Rect toRect, SInt16 zoomSteps, ZoomAcceleration acceleration) -> None")},
+ {"ZoomRegion", (PyCFunction)Drag_ZoomRegion, 1,
+ PyDoc_STR("(RgnHandle region, Point zoomDistance, SInt16 zoomSteps, ZoomAcceleration acceleration) -> None")},
+ {"InstallTrackingHandler", (PyCFunction)Drag_InstallTrackingHandler, 1,
+ PyDoc_STR(NULL)},
+ {"InstallReceiveHandler", (PyCFunction)Drag_InstallReceiveHandler, 1,
+ PyDoc_STR(NULL)},
+ {"RemoveTrackingHandler", (PyCFunction)Drag_RemoveTrackingHandler, 1,
+ PyDoc_STR(NULL)},
+ {"RemoveReceiveHandler", (PyCFunction)Drag_RemoveReceiveHandler, 1,
+ PyDoc_STR(NULL)},
+ {NULL, NULL, 0}
+};
+
+
+
+static pascal OSErr
+dragglue_TrackingHandler(DragTrackingMessage theMessage, WindowPtr theWindow,
+ void *handlerRefCon, DragReference theDrag)
+{
+ PyObject *args, *rv;
+ int i;
+
+ args = Py_BuildValue("hO&O&", theMessage, DragObj_New, theDrag, WinObj_WhichWindow, theWindow);
+ if ( args == NULL )
+ return -1;
+ rv = PyEval_CallObject((PyObject *)handlerRefCon, args);
+ Py_DECREF(args);
+ if ( rv == NULL ) {
+ PySys_WriteStderr("Drag: Exception in TrackingHandler\n");
+ PyErr_Print();
+ return -1;
+ }
+ i = -1;
+ if ( rv == Py_None )
+ i = 0;
+ else
+ PyArg_Parse(rv, "l", &i);
+ Py_DECREF(rv);
+ return i;
+}
+
+static pascal OSErr
+dragglue_ReceiveHandler(WindowPtr theWindow, void *handlerRefCon,
+ DragReference theDrag)
+{
+ PyObject *args, *rv;
+ int i;
+
+ args = Py_BuildValue("O&O&", DragObj_New, theDrag, WinObj_WhichWindow, theWindow);
+ if ( args == NULL )
+ return -1;
+ rv = PyEval_CallObject((PyObject *)handlerRefCon, args);
+ Py_DECREF(args);
+ if ( rv == NULL ) {
+ PySys_WriteStderr("Drag: Exception in ReceiveHandler\n");
+ PyErr_Print();
+ return -1;
+ }
+ i = -1;
+ if ( rv == Py_None )
+ i = 0;
+ else
+ PyArg_Parse(rv, "l", &i);
+ Py_DECREF(rv);
+ return i;
+}
+
+static pascal OSErr
+dragglue_SendData(FlavorType theType, void *dragSendRefCon,
+ ItemReference theItem, DragReference theDrag)
+{
+ DragObjObject *self = (DragObjObject *)dragSendRefCon;
+ PyObject *args, *rv;
+ int i;
+
+ if ( self->sendproc == NULL )
+ return -1;
+ args = Py_BuildValue("O&l", PyMac_BuildOSType, theType, theItem);
+ if ( args == NULL )
+ return -1;
+ rv = PyEval_CallObject(self->sendproc, args);
+ Py_DECREF(args);
+ if ( rv == NULL ) {
+ PySys_WriteStderr("Drag: Exception in SendDataHandler\n");
+ PyErr_Print();
+ return -1;
+ }
+ i = -1;
+ if ( rv == Py_None )
+ i = 0;
+ else
+ PyArg_Parse(rv, "l", &i);
+ Py_DECREF(rv);
+ return i;
+}
+
+#if 0
+static pascal OSErr
+dragglue_Input(Point *mouse, short *modifiers,
+ void *dragSendRefCon, DragReference theDrag)
+{
+ return 0;
+}
+
+static pascal OSErr
+dragglue_Drawing(xxxx
+ void *dragSendRefCon, DragReference theDrag)
+{
+ 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 ||
+ PyDict_SetItemString(d, "Error", Drag_Error) != 0)
+ return;
+ DragObj_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&DragObj_Type) < 0) return;
+ Py_INCREF(&DragObj_Type);
+ PyModule_AddObject(m, "DragObj", (PyObject *)&DragObj_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&DragObj_Type);
+ PyModule_AddObject(m, "DragObjType", (PyObject *)&DragObj_Type);
+
+ dragglue_TrackingHandlerUPP = NewDragTrackingHandlerUPP(dragglue_TrackingHandler);
+ dragglue_ReceiveHandlerUPP = NewDragReceiveHandlerUPP(dragglue_ReceiveHandler);
+ dragglue_SendDataUPP = NewDragSendDataUPP(dragglue_SendData);
+#if 0
+ dragglue_InputUPP = NewDragInputUPP(dragglue_Input);
+ dragglue_DrawingUPP = NewDragDrawingUPP(dragglue_Drawing);
+#endif
+
+#endif /* !__LP64__ */
+
+}
+
+/* ======================== End module _Drag ======================== */
+
diff --git a/Mac/Modules/drag/dragscan.py b/Mac/Modules/drag/dragscan.py
new file mode 100644
index 0000000000..bd419c4a6f
--- /dev/null
+++ b/Mac/Modules/drag/dragscan.py
@@ -0,0 +1,79 @@
+# Scan <Drag.h>, generating draggen.py.
+import sys
+from bgenlocations import TOOLBOXDIR, BGENDIR, INCLUDEDIR
+sys.path.append(BGENDIR)
+
+from scantools import Scanner
+
+MISSING_DEFINES="""
+kDragHasLeftSenderWindow = (1 << 0)
+kDragInsideSenderApplication = (1 << 1)
+kDragInsideSenderWindow = (1 << 2)
+kDragRegionAndImage = (1 << 4)
+flavorSenderOnly = (1 << 0)
+flavorSenderTranslated = (1 << 1)
+flavorNotSaved = (1 << 2)
+flavorSystemTranslated = (1 << 8)
+"""
+
+
+def main():
+ input = INCLUDEDIR + "Drag.h"
+ output = "draggen.py"
+ defsoutput = TOOLBOXDIR + "Dragconst.py"
+ scanner = MyScanner(input, output, defsoutput)
+ scanner.scan()
+ scanner.close()
+ print "=== Testing definitions output code ==="
+ execfile(defsoutput, {}, {})
+ print "=== Done scanning and generating, now doing 'import dragsupport' ==="
+ import dragsupport
+ print "=== Done. It's up to you to compile Dragmodule.c ==="
+
+class MyScanner(Scanner):
+
+ def destination(self, type, name, arglist):
+ classname = "Function"
+ listname = "functions"
+ if arglist:
+ t, n, m = arglist[0]
+ if t in ('DragReference', 'DragRef') and m == "InMode":
+ classname = "Method"
+ listname = "methods"
+ return classname, listname
+
+ def writeinitialdefs(self):
+ self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
+ self.defsfile.write("from Carbon.TextEdit import *\n")
+ self.defsfile.write("from Carbon.QuickDraw import *\n")
+ self.defsfile.write("fkDragActionAll = -1\n")
+ self.defsfile.write("\n")
+ # Defines unparseable in Drag.h
+ self.defsfile.write(MISSING_DEFINES)
+
+ def makeblacklistnames(self):
+ return [
+ "kDragActionAll",
+ ]
+
+ def makeblacklisttypes(self):
+ return [
+ "DragTrackingHandlerUPP",
+ "DragReceiveHandlerUPP",
+ "DragSendDataUPP",
+ "DragInputUPP",
+ "DragDrawingUPP",
+ ]
+
+ def makerepairinstructions(self):
+ return [
+ ([("void_ptr", "*", "InMode"), ("Size", "*", "InMode")],
+ [("OptionalInBuffer", "*", "*")]),
+
+ ([("void", "*", "OutMode"), ("Size", "*", "OutMode")],
+ [("VarOutBuffer", "*", "InOutMode")]),
+
+ ]
+
+if __name__ == "__main__":
+ main()
diff --git a/Mac/Modules/drag/dragsupport.py b/Mac/Modules/drag/dragsupport.py
new file mode 100644
index 0000000000..45838efde6
--- /dev/null
+++ b/Mac/Modules/drag/dragsupport.py
@@ -0,0 +1,293 @@
+# This script generates a Python interface for an Apple Macintosh Manager.
+# It uses the "bgen" package to generate C code.
+# The function specifications are generated by scanning the mamager's header file,
+# using the "scantools" package (customized for this particular manager).
+
+import string
+
+# Declarations that change for each manager
+MACHEADERFILE = 'Drag.h' # The Apple header file
+MODNAME = '_Drag' # The name of the module
+OBJECTNAME = 'DragObj' # The basic name of the objects used here
+
+# The following is *usually* unchanged but may still require tuning
+MODPREFIX = 'Drag' # The prefix for module-wide routines
+OBJECTTYPE = 'DragRef' # The C type used to represent them
+OBJECTPREFIX = MODPREFIX + 'Obj' # The prefix for object methods
+INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner
+OUTPUTFILE = MODNAME + "module.c" # The file generated by this program
+
+from macsupport import *
+
+# Create the type objects
+
+DragRef = OpaqueByValueType(OBJECTTYPE, OBJECTPREFIX)
+DragItemRef = Type("ItemReference", "l")
+# Old names
+DragReference = DragRef
+ItemReference = DragItemRef
+
+PixMapHandle = OpaqueByValueType("PixMapHandle", "ResObj")
+RgnHandle = OpaqueByValueType("RgnHandle", "ResObj")
+AEDesc = OpaqueType('AEDesc')
+AEDesc_ptr = AEDesc
+RGBColor = OpaqueType("RGBColor", "QdRGB")
+
+FlavorType = OSTypeType("FlavorType")
+DragAttributes = Type("DragAttributes", "l")
+DragBehaviors = Type("DragBehaviors", "l")
+DragImageFlags = Type("DragImageFlags", "l")
+DragImageTranslucency = Type("DragImageTranslucency", "l")
+DragRegionMessage = Type("DragRegionMessage", "h")
+ZoomAcceleration = Type("ZoomAcceleration", "h")
+FlavorFlags = Type("FlavorFlags", "l")
+DragTrackingMessage = Type("DragTrackingMessage", "h")
+
+includestuff = includestuff + """
+#include <Carbon/Carbon.h>
+
+/* Callback glue routines */
+DragTrackingHandlerUPP dragglue_TrackingHandlerUPP;
+DragReceiveHandlerUPP dragglue_ReceiveHandlerUPP;
+DragSendDataUPP dragglue_SendDataUPP;
+#if 0
+DragInputUPP dragglue_InputUPP;
+DragDrawingUPP dragglue_DrawingUPP;
+#endif
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_DragObj_New(DragRef);
+extern int _DragObj_Convert(PyObject *, DragRef *);
+
+#define DragObj_New _DragObj_New
+#define DragObj_Convert _DragObj_Convert
+#endif
+"""
+
+finalstuff = finalstuff + """
+static pascal OSErr
+dragglue_TrackingHandler(DragTrackingMessage theMessage, WindowPtr theWindow,
+ void *handlerRefCon, DragReference theDrag)
+{
+ PyObject *args, *rv;
+ int i;
+
+ args = Py_BuildValue("hO&O&", theMessage, DragObj_New, theDrag, WinObj_WhichWindow, theWindow);
+ if ( args == NULL )
+ return -1;
+ rv = PyEval_CallObject((PyObject *)handlerRefCon, args);
+ Py_DECREF(args);
+ if ( rv == NULL ) {
+ PySys_WriteStderr("Drag: Exception in TrackingHandler\\n");
+ PyErr_Print();
+ return -1;
+ }
+ i = -1;
+ if ( rv == Py_None )
+ i = 0;
+ else
+ PyArg_Parse(rv, "l", &i);
+ Py_DECREF(rv);
+ return i;
+}
+
+static pascal OSErr
+dragglue_ReceiveHandler(WindowPtr theWindow, void *handlerRefCon,
+ DragReference theDrag)
+{
+ PyObject *args, *rv;
+ int i;
+
+ args = Py_BuildValue("O&O&", DragObj_New, theDrag, WinObj_WhichWindow, theWindow);
+ if ( args == NULL )
+ return -1;
+ rv = PyEval_CallObject((PyObject *)handlerRefCon, args);
+ Py_DECREF(args);
+ if ( rv == NULL ) {
+ PySys_WriteStderr("Drag: Exception in ReceiveHandler\\n");
+ PyErr_Print();
+ return -1;
+ }
+ i = -1;
+ if ( rv == Py_None )
+ i = 0;
+ else
+ PyArg_Parse(rv, "l", &i);
+ Py_DECREF(rv);
+ return i;
+}
+
+static pascal OSErr
+dragglue_SendData(FlavorType theType, void *dragSendRefCon,
+ ItemReference theItem, DragReference theDrag)
+{
+ DragObjObject *self = (DragObjObject *)dragSendRefCon;
+ PyObject *args, *rv;
+ int i;
+
+ if ( self->sendproc == NULL )
+ return -1;
+ args = Py_BuildValue("O&l", PyMac_BuildOSType, theType, theItem);
+ if ( args == NULL )
+ return -1;
+ rv = PyEval_CallObject(self->sendproc, args);
+ Py_DECREF(args);
+ if ( rv == NULL ) {
+ PySys_WriteStderr("Drag: Exception in SendDataHandler\\n");
+ PyErr_Print();
+ return -1;
+ }
+ i = -1;
+ if ( rv == Py_None )
+ i = 0;
+ else
+ PyArg_Parse(rv, "l", &i);
+ Py_DECREF(rv);
+ return i;
+}
+
+#if 0
+static pascal OSErr
+dragglue_Input(Point *mouse, short *modifiers,
+ void *dragSendRefCon, DragReference theDrag)
+{
+ return 0;
+}
+
+static pascal OSErr
+dragglue_Drawing(xxxx
+ void *dragSendRefCon, DragReference theDrag)
+{
+ return 0;
+}
+#endif
+
+"""
+
+initstuff = initstuff + """
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(DragRef, DragObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(DragRef, DragObj_Convert);
+"""
+
+variablestuff = """
+dragglue_TrackingHandlerUPP = NewDragTrackingHandlerUPP(dragglue_TrackingHandler);
+dragglue_ReceiveHandlerUPP = NewDragReceiveHandlerUPP(dragglue_ReceiveHandler);
+dragglue_SendDataUPP = NewDragSendDataUPP(dragglue_SendData);
+#if 0
+dragglue_InputUPP = NewDragInputUPP(dragglue_Input);
+dragglue_DrawingUPP = NewDragDrawingUPP(dragglue_Drawing);
+#endif
+"""
+
+class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
+ def outputCheckNewArg(self):
+ Output("""if (itself == NULL) {
+ PyErr_SetString(Drag_Error,"Cannot create null Drag");
+ return NULL;
+ }""")
+ def outputFreeIt(self, itselfname):
+ ## Output("DisposeDrag(%s);", itselfname)
+ Output("Py_XDECREF(self->sendproc);")
+ ## Output("Py_XDECREF(self->inputproc);")
+ ## Output("Py_XDECREF(self->drawingproc);")
+
+ def outputStructMembers(self):
+ GlobalObjectDefinition.outputStructMembers(self)
+ Output("PyObject *sendproc;")
+ ## Output("PyObject *inputproc;")
+ ## Output("PyObject *drawingproc;")
+
+ def outputInitStructMembers(self):
+ GlobalObjectDefinition.outputInitStructMembers(self)
+ Output("it->sendproc = NULL;")
+ ## Output("it->inputproc = NULL;")
+ ## Output("it->drawingproc = NULL;")
+
+
+# Create the generator groups and link them
+module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff, variablestuff)
+object = MyObjectDefinition(OBJECTNAME, OBJECTPREFIX, OBJECTTYPE)
+module.addobject(object)
+
+# Create the generator classes used to populate the lists
+Function = OSErrWeakLinkFunctionGenerator
+Method = OSErrWeakLinkMethodGenerator
+
+# Create and populate the lists
+functions = []
+methods = []
+execfile(INPUTFILE)
+
+# add the populated lists to the generator groups
+for f in functions: module.add(f)
+for f in methods: object.add(f)
+
+# Manual generators for the callbacks
+
+installtracking_body = """
+ PyObject *callback;
+ WindowPtr theWindow = NULL;
+ OSErr _err;
+
+ if ( !PyArg_ParseTuple(_args, "O|O&", &callback, WinObj_Convert, &theWindow) )
+ return NULL;
+ Py_INCREF(callback); /* Cannot decref later, too bad */
+ _err = InstallTrackingHandler(dragglue_TrackingHandlerUPP, theWindow, (void *)callback);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+"""
+installtracking = ManualGenerator("InstallTrackingHandler", installtracking_body)
+module.add(installtracking)
+
+installreceive_body = """
+ PyObject *callback;
+ WindowPtr theWindow = NULL;
+ OSErr _err;
+
+ if ( !PyArg_ParseTuple(_args, "O|O&", &callback, WinObj_Convert, &theWindow) )
+ return NULL;
+ Py_INCREF(callback); /* Cannot decref later, too bad */
+ _err = InstallReceiveHandler(dragglue_ReceiveHandlerUPP, theWindow, (void *)callback);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+"""
+installreceive = ManualGenerator("InstallReceiveHandler", installreceive_body)
+module.add(installreceive)
+
+removetracking_body = """
+ WindowPtr theWindow = NULL;
+ OSErr _err;
+
+ if ( !PyArg_ParseTuple(_args, "|O&", WinObj_Convert, &theWindow) )
+ return NULL;
+ _err = RemoveTrackingHandler(dragglue_TrackingHandlerUPP, theWindow);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+"""
+removetracking = ManualGenerator("RemoveTrackingHandler", removetracking_body)
+module.add(removetracking)
+
+removereceive_body = """
+ WindowPtr theWindow = NULL;
+ OSErr _err;
+
+ if ( !PyArg_ParseTuple(_args, "|O&", WinObj_Convert, &theWindow) )
+ return NULL;
+ _err = RemoveReceiveHandler(dragglue_ReceiveHandlerUPP, theWindow);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+"""
+removereceive = ManualGenerator("RemoveReceiveHandler", removereceive_body)
+module.add(removereceive)
+
+# generate output (open the output file as late as possible)
+SetOutputFileName(OUTPUTFILE)
+module.generate()
diff --git a/Mac/Modules/evt/_Evtmodule.c b/Mac/Modules/evt/_Evtmodule.c
new file mode 100644
index 0000000000..bd61efab5a
--- /dev/null
+++ b/Mac/Modules/evt/_Evtmodule.c
@@ -0,0 +1,559 @@
+
+/* ========================== Module _Evt =========================== */
+
+#include "Python.h"
+
+#ifndef __LP64__
+
+
+#include "pymactoolbox.h"
+
+/* Macro to test whether a weak-loaded CFM function exists */
+#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
+ PyErr_SetString(PyExc_NotImplementedError, \
+ "Not available in this shared library/OS version"); \
+ return NULL; \
+ }} while(0)
+
+
+#include <Carbon/Carbon.h>
+
+
+static PyObject *Evt_Error;
+
+static PyObject *Evt_GetMouse(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point mouseLoc;
+#ifndef GetMouse
+ PyMac_PRECHECK(GetMouse);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetMouse(&mouseLoc);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, mouseLoc);
+ return _res;
+}
+
+static PyObject *Evt_Button(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef Button
+ PyMac_PRECHECK(Button);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = Button();
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Evt_StillDown(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef StillDown
+ PyMac_PRECHECK(StillDown);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = StillDown();
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Evt_WaitMouseUp(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef WaitMouseUp
+ PyMac_PRECHECK(WaitMouseUp);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = WaitMouseUp();
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Evt_GetCaretTime(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UInt32 _rv;
+#ifndef GetCaretTime
+ PyMac_PRECHECK(GetCaretTime);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetCaretTime();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Evt_GetKeys(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ KeyMap theKeys__out__;
+#ifndef GetKeys
+ PyMac_PRECHECK(GetKeys);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetKeys(theKeys__out__);
+ _res = Py_BuildValue("s#",
+ (char *)&theKeys__out__, (int)sizeof(KeyMap));
+ return _res;
+}
+
+static PyObject *Evt_GetDblTime(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UInt32 _rv;
+#ifndef GetDblTime
+ PyMac_PRECHECK(GetDblTime);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetDblTime();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Evt_SetEventMask(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ EventMask value;
+#ifndef SetEventMask
+ PyMac_PRECHECK(SetEventMask);
+#endif
+ if (!PyArg_ParseTuple(_args, "H",
+ &value))
+ return NULL;
+ SetEventMask(value);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Evt_GetNextEvent(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ EventMask eventMask;
+ EventRecord theEvent;
+#ifndef GetNextEvent
+ PyMac_PRECHECK(GetNextEvent);
+#endif
+ if (!PyArg_ParseTuple(_args, "H",
+ &eventMask))
+ return NULL;
+ _rv = GetNextEvent(eventMask,
+ &theEvent);
+ _res = Py_BuildValue("bO&",
+ _rv,
+ PyMac_BuildEventRecord, &theEvent);
+ return _res;
+}
+
+static PyObject *Evt_EventAvail(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ EventMask eventMask;
+ EventRecord theEvent;
+#ifndef EventAvail
+ PyMac_PRECHECK(EventAvail);
+#endif
+ if (!PyArg_ParseTuple(_args, "H",
+ &eventMask))
+ return NULL;
+ _rv = EventAvail(eventMask,
+ &theEvent);
+ _res = Py_BuildValue("bO&",
+ _rv,
+ PyMac_BuildEventRecord, &theEvent);
+ return _res;
+}
+
+static PyObject *Evt_PostEvent(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ EventKind eventNum;
+ UInt32 eventMsg;
+#ifndef PostEvent
+ PyMac_PRECHECK(PostEvent);
+#endif
+ if (!PyArg_ParseTuple(_args, "Hl",
+ &eventNum,
+ &eventMsg))
+ return NULL;
+ _err = PostEvent(eventNum,
+ eventMsg);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Evt_FlushEvents(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ EventMask whichMask;
+ EventMask stopMask;
+#ifndef FlushEvents
+ PyMac_PRECHECK(FlushEvents);
+#endif
+ if (!PyArg_ParseTuple(_args, "HH",
+ &whichMask,
+ &stopMask))
+ return NULL;
+ FlushEvents(whichMask,
+ stopMask);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Evt_GetGlobalMouse(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point globalMouse;
+#ifndef GetGlobalMouse
+ PyMac_PRECHECK(GetGlobalMouse);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetGlobalMouse(&globalMouse);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, globalMouse);
+ return _res;
+}
+
+static PyObject *Evt_GetCurrentKeyModifiers(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UInt32 _rv;
+#ifndef GetCurrentKeyModifiers
+ PyMac_PRECHECK(GetCurrentKeyModifiers);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetCurrentKeyModifiers();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Evt_CheckEventQueueForUserCancel(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef CheckEventQueueForUserCancel
+ PyMac_PRECHECK(CheckEventQueueForUserCancel);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CheckEventQueueForUserCancel();
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Evt_KeyScript(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short code;
+#ifndef KeyScript
+ PyMac_PRECHECK(KeyScript);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &code))
+ return NULL;
+ KeyScript(code);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Evt_IsCmdChar(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ EventRecord event;
+ short test;
+#ifndef IsCmdChar
+ PyMac_PRECHECK(IsCmdChar);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ PyMac_GetEventRecord, &event,
+ &test))
+ return NULL;
+ _rv = IsCmdChar(&event,
+ test);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Evt_LMGetKeyThresh(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 _rv;
+#ifndef LMGetKeyThresh
+ PyMac_PRECHECK(LMGetKeyThresh);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = LMGetKeyThresh();
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Evt_LMSetKeyThresh(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 value;
+#ifndef LMSetKeyThresh
+ PyMac_PRECHECK(LMSetKeyThresh);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &value))
+ return NULL;
+ LMSetKeyThresh(value);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Evt_LMGetKeyRepThresh(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 _rv;
+#ifndef LMGetKeyRepThresh
+ PyMac_PRECHECK(LMGetKeyRepThresh);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = LMGetKeyRepThresh();
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Evt_LMSetKeyRepThresh(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 value;
+#ifndef LMSetKeyRepThresh
+ PyMac_PRECHECK(LMSetKeyRepThresh);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &value))
+ return NULL;
+ LMSetKeyRepThresh(value);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Evt_LMGetKbdLast(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UInt8 _rv;
+#ifndef LMGetKbdLast
+ PyMac_PRECHECK(LMGetKbdLast);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = LMGetKbdLast();
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Evt_LMSetKbdLast(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UInt8 value;
+#ifndef LMSetKbdLast
+ PyMac_PRECHECK(LMSetKbdLast);
+#endif
+ if (!PyArg_ParseTuple(_args, "b",
+ &value))
+ return NULL;
+ LMSetKbdLast(value);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Evt_LMGetKbdType(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UInt8 _rv;
+#ifndef LMGetKbdType
+ PyMac_PRECHECK(LMGetKbdType);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = LMGetKbdType();
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Evt_LMSetKbdType(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UInt8 value;
+#ifndef LMSetKbdType
+ PyMac_PRECHECK(LMSetKbdType);
+#endif
+ if (!PyArg_ParseTuple(_args, "b",
+ &value))
+ return NULL;
+ LMSetKbdType(value);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Evt_TickCount(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UInt32 _rv;
+#ifndef TickCount
+ PyMac_PRECHECK(TickCount);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = TickCount();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Evt_WaitNextEvent(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ Boolean _rv;
+ EventMask eventMask;
+ EventRecord theEvent;
+ UInt32 sleep;
+ Handle mouseregion = (Handle)0;
+
+ if (!PyArg_ParseTuple(_args, "Hl|O&",
+ &eventMask,
+ &sleep,
+ OptResObj_Convert, &mouseregion))
+ return NULL;
+ _rv = WaitNextEvent(eventMask,
+ &theEvent,
+ sleep,
+ (RgnHandle)mouseregion);
+ _res = Py_BuildValue("bO&",
+ _rv,
+ PyMac_BuildEventRecord, &theEvent);
+ return _res;
+
+}
+
+static PyMethodDef Evt_methods[] = {
+ {"GetMouse", (PyCFunction)Evt_GetMouse, 1,
+ PyDoc_STR("() -> (Point mouseLoc)")},
+ {"Button", (PyCFunction)Evt_Button, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"StillDown", (PyCFunction)Evt_StillDown, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"WaitMouseUp", (PyCFunction)Evt_WaitMouseUp, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"GetCaretTime", (PyCFunction)Evt_GetCaretTime, 1,
+ PyDoc_STR("() -> (UInt32 _rv)")},
+ {"GetKeys", (PyCFunction)Evt_GetKeys, 1,
+ PyDoc_STR("() -> (KeyMap theKeys)")},
+ {"GetDblTime", (PyCFunction)Evt_GetDblTime, 1,
+ PyDoc_STR("() -> (UInt32 _rv)")},
+ {"SetEventMask", (PyCFunction)Evt_SetEventMask, 1,
+ PyDoc_STR("(EventMask value) -> None")},
+ {"GetNextEvent", (PyCFunction)Evt_GetNextEvent, 1,
+ PyDoc_STR("(EventMask eventMask) -> (Boolean _rv, EventRecord theEvent)")},
+ {"EventAvail", (PyCFunction)Evt_EventAvail, 1,
+ PyDoc_STR("(EventMask eventMask) -> (Boolean _rv, EventRecord theEvent)")},
+ {"PostEvent", (PyCFunction)Evt_PostEvent, 1,
+ PyDoc_STR("(EventKind eventNum, UInt32 eventMsg) -> None")},
+ {"FlushEvents", (PyCFunction)Evt_FlushEvents, 1,
+ PyDoc_STR("(EventMask whichMask, EventMask stopMask) -> None")},
+ {"GetGlobalMouse", (PyCFunction)Evt_GetGlobalMouse, 1,
+ PyDoc_STR("() -> (Point globalMouse)")},
+ {"GetCurrentKeyModifiers", (PyCFunction)Evt_GetCurrentKeyModifiers, 1,
+ PyDoc_STR("() -> (UInt32 _rv)")},
+ {"CheckEventQueueForUserCancel", (PyCFunction)Evt_CheckEventQueueForUserCancel, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"KeyScript", (PyCFunction)Evt_KeyScript, 1,
+ PyDoc_STR("(short code) -> None")},
+ {"IsCmdChar", (PyCFunction)Evt_IsCmdChar, 1,
+ PyDoc_STR("(EventRecord event, short test) -> (Boolean _rv)")},
+ {"LMGetKeyThresh", (PyCFunction)Evt_LMGetKeyThresh, 1,
+ PyDoc_STR("() -> (SInt16 _rv)")},
+ {"LMSetKeyThresh", (PyCFunction)Evt_LMSetKeyThresh, 1,
+ PyDoc_STR("(SInt16 value) -> None")},
+ {"LMGetKeyRepThresh", (PyCFunction)Evt_LMGetKeyRepThresh, 1,
+ PyDoc_STR("() -> (SInt16 _rv)")},
+ {"LMSetKeyRepThresh", (PyCFunction)Evt_LMSetKeyRepThresh, 1,
+ PyDoc_STR("(SInt16 value) -> None")},
+ {"LMGetKbdLast", (PyCFunction)Evt_LMGetKbdLast, 1,
+ PyDoc_STR("() -> (UInt8 _rv)")},
+ {"LMSetKbdLast", (PyCFunction)Evt_LMSetKbdLast, 1,
+ PyDoc_STR("(UInt8 value) -> None")},
+ {"LMGetKbdType", (PyCFunction)Evt_LMGetKbdType, 1,
+ PyDoc_STR("() -> (UInt8 _rv)")},
+ {"LMSetKbdType", (PyCFunction)Evt_LMSetKbdType, 1,
+ PyDoc_STR("(UInt8 value) -> None")},
+ {"TickCount", (PyCFunction)Evt_TickCount, 1,
+ PyDoc_STR("() -> (UInt32 _rv)")},
+ {"WaitNextEvent", (PyCFunction)Evt_WaitNextEvent, 1,
+ PyDoc_STR("(EventMask eventMask, UInt32 sleep [,RegionHandle]) -> (Boolean _rv, EventRecord theEvent)")},
+ {NULL, NULL, 0}
+};
+
+
+#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 ========================= */
+
diff --git a/Mac/Modules/evt/evtedit.py b/Mac/Modules/evt/evtedit.py
new file mode 100644
index 0000000000..02087e14c6
--- /dev/null
+++ b/Mac/Modules/evt/evtedit.py
@@ -0,0 +1,9 @@
+f = Function(void, 'SystemClick',
+ (EventRecord_ptr, 'theEvent', InMode),
+ (WindowPtr, 'theWindow', InMode),
+)
+functions.append(f)
+
+f = Function(UInt32, 'TickCount',
+)
+functions.append(f)
diff --git a/Mac/Modules/evt/evtscan.py b/Mac/Modules/evt/evtscan.py
new file mode 100644
index 0000000000..ea0692cfe1
--- /dev/null
+++ b/Mac/Modules/evt/evtscan.py
@@ -0,0 +1,80 @@
+# Scan an Apple header file, generating a Python file of generator calls.
+
+import sys
+from bgenlocations import TOOLBOXDIR, BGENDIR
+sys.path.append(BGENDIR)
+from scantools import Scanner
+
+LONG = "Events"
+SHORT = "evt"
+OBJECT = "NOTUSED"
+
+def main():
+ input = LONG + ".h"
+ output = SHORT + "gen.py"
+ defsoutput = TOOLBOXDIR + LONG + ".py"
+ scanner = MyScanner(input, output, defsoutput)
+ scanner.scan()
+ scanner.close()
+ print "=== Testing definitions output code ==="
+ execfile(defsoutput, {}, {})
+ print "=== Done scanning and generating, now importing the generated code... ==="
+ exec "import " + SHORT + "support"
+ print "=== Done. It's up to you to compile it now! ==="
+
+class MyScanner(Scanner):
+
+ def destination(self, type, name, arglist):
+ classname = "Function"
+ listname = "functions"
+ if arglist:
+ t, n, m = arglist[0]
+ # This is non-functional today
+ if t == OBJECT and m == "InMode":
+ classname = "Method"
+ listname = "methods"
+ return classname, listname
+
+ def makeblacklistnames(self):
+ return [
+ "KeyTranslate",
+ "GetEventMask", # I cannot seem to find this routine...
+ "WaitNextEvent", # Manually generated because of optional region
+ # Constants with funny definitions
+ "osEvtMessageMask",
+ # OS8 calls
+ 'SystemEvent',
+ 'SystemTask',
+ 'SystemClick',
+ 'GetOSEvent',
+ 'OSEventAvail',
+ ]
+
+ def makeblacklisttypes(self):
+ return [
+ "EvQElPtr", "QHdrPtr"
+ ]
+
+ def makerepairinstructions(self):
+ return [
+ ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
+ [("InBuffer", "*", "*")]),
+
+ ([("void", "*", "OutMode"), ("long", "*", "InMode"),
+ ("long", "*", "OutMode")],
+ [("VarVarOutBuffer", "*", "InOutMode")]),
+
+ ([("void", "wStorage", "OutMode")],
+ [("NullStorage", "*", "InMode")]),
+
+ # GetKeys
+ ([('KeyMap', 'theKeys', 'InMode')],
+ [('*', '*', 'OutMode')]),
+
+ # GetTicker
+ ([('unsigned long', '*', '*')],
+ [('unsigned_long', '*', '*')]),
+ ]
+
+if __name__ == "__main__":
+ main()
diff --git a/Mac/Modules/evt/evtsupport.py b/Mac/Modules/evt/evtsupport.py
new file mode 100644
index 0000000000..f58da14a66
--- /dev/null
+++ b/Mac/Modules/evt/evtsupport.py
@@ -0,0 +1,92 @@
+# This script generates a Python interface for an Apple Macintosh Manager.
+# It uses the "bgen" package to generate C code.
+# The function specifications are generated by scanning the mamager's header file,
+# using the "scantools" package (customized for this particular manager).
+
+import string
+
+# Declarations that change for each manager
+MACHEADERFILE = 'Events.h' # The Apple header file
+MODNAME = '_Evt' # The name of the module
+OBJECTNAME = 'Event' # The basic name of the objects used here
+KIND = 'Record' # Usually 'Ptr' or 'Handle'
+
+# The following is *usually* unchanged but may still require tuning
+MODPREFIX = 'Evt' # The prefix for module-wide routines
+OBJECTTYPE = OBJECTNAME + KIND # The C type used to represent them
+OBJECTPREFIX = MODPREFIX + 'Obj' # The prefix for object methods
+INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner
+OUTPUTFILE = MODNAME + "module.c" # The file generated by this program
+
+from macsupport import *
+
+# Create the type objects
+
+#WindowPeek = OpaqueByValueType("WindowPeek", OBJECTPREFIX)
+
+RgnHandle = FakeType("(RgnHandle)0")
+# XXXX Should be next, but this will break a lot of code...
+# RgnHandle = OpaqueByValueType("RgnHandle", "OptResObj")
+
+KeyMap = ArrayOutputBufferType("KeyMap")
+##MacOSEventKind = Type("MacOSEventKind", "h") # Old-style
+##MacOSEventMask = Type("MacOSEventMask", "h") # Old-style
+EventMask = Type("EventMask", "H")
+EventKind = Type("EventKind", "H")
+
+includestuff = includestuff + """
+#include <Carbon/Carbon.h>
+
+"""
+
+# From here on it's basically all boiler plate...
+
+# Create the generator groups and link them
+module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff)
+
+# Create the generator classes used to populate the lists
+Function = OSErrWeakLinkFunctionGenerator
+##Method = OSErrWeakLinkMethodGenerator
+
+# Create and populate the lists
+functions = []
+execfile(INPUTFILE)
+
+# Move TickCount here, for convenience
+f = Function(UInt32, 'TickCount',
+)
+functions.append(f)
+
+# add the populated lists to the generator groups
+# (in a different wordl the scan program would generate this)
+for f in functions: module.add(f)
+
+WaitNextEvent_body = """
+Boolean _rv;
+EventMask eventMask;
+EventRecord theEvent;
+UInt32 sleep;
+Handle mouseregion = (Handle)0;
+
+if (!PyArg_ParseTuple(_args, "Hl|O&",
+ &eventMask,
+ &sleep,
+ OptResObj_Convert, &mouseregion))
+ return NULL;
+_rv = WaitNextEvent(eventMask,
+ &theEvent,
+ sleep,
+ (RgnHandle)mouseregion);
+_res = Py_BuildValue("bO&",
+ _rv,
+ PyMac_BuildEventRecord, &theEvent);
+return _res;
+"""
+f = ManualGenerator("WaitNextEvent", WaitNextEvent_body);
+f.docstring = lambda: "(EventMask eventMask, UInt32 sleep [,RegionHandle]) -> (Boolean _rv, EventRecord theEvent)"
+module.add(f)
+
+
+# generate output (open the output file as late as possible)
+SetOutputFileName(OUTPUTFILE)
+module.generate()
diff --git a/Mac/Modules/file/_Filemodule.c b/Mac/Modules/file/_Filemodule.c
new file mode 100644
index 0000000000..eb5b16de2d
--- /dev/null
+++ b/Mac/Modules/file/_Filemodule.c
@@ -0,0 +1,3410 @@
+
+/* ========================== Module _File ========================== */
+
+#include "Python.h"
+
+
+
+#include "pymactoolbox.h"
+
+#ifndef HAVE_OSX105_SDK
+typedef SInt16 FSIORefNum;
+#endif
+
+/* Macro to test whether a weak-loaded CFM function exists */
+#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
+ PyErr_SetString(PyExc_NotImplementedError, \
+ "Not available in this shared library/OS version"); \
+ return NULL; \
+ }} while(0)
+
+
+#include <Carbon/Carbon.h>
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+
+#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
+
+#else /* !USE_TOOLBOX_OBJECT_GLUE */
+
+#ifndef __LP64__
+extern int PyMac_GetFSSpec(PyObject *v, FSSpec *spec);
+extern PyObject *PyMac_BuildFSSpec(FSSpec *spec);
+#endif /* !__LP64__*/
+
+extern int PyMac_GetFSRef(PyObject *v, FSRef *fsr);
+extern PyObject *PyMac_BuildFSRef(FSRef *spec);
+
+#endif /* !USE_TOOLBOX_OBJECT_GLUE */
+
+/* Forward declarations */
+static PyObject *FSRef_New(FSRef *itself);
+#ifndef __LP64__
+static PyObject *FInfo_New(FInfo *itself);
+
+static PyObject *FSSpec_New(FSSpec *itself);
+#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);
+
+/*
+** UTCDateTime records
+*/
+static int
+UTCDateTime_Convert(PyObject *v, UTCDateTime *ptr)
+{
+ return PyArg_Parse(v, "(HlH)", &ptr->highSeconds, &ptr->lowSeconds, &ptr->fraction);
+}
+
+static PyObject *
+UTCDateTime_New(UTCDateTime *ptr)
+{
+ return Py_BuildValue("(HlH)", ptr->highSeconds, ptr->lowSeconds, ptr->fraction);
+}
+
+/*
+** Optional fsspec and fsref pointers. None will pass NULL
+*/
+#ifndef __LP64__
+static int
+myPyMac_GetOptFSSpecPtr(PyObject *v, FSSpec **spec)
+{
+ if (v == Py_None) {
+ *spec = NULL;
+ return 1;
+ }
+ return PyMac_GetFSSpec(v, *spec);
+}
+#endif /* !__LP64__ */
+
+static int
+myPyMac_GetOptFSRefPtr(PyObject *v, FSRef **ref)
+{
+ if (v == Py_None) {
+ *ref = NULL;
+ return 1;
+ }
+ return PyMac_GetFSRef(v, *ref);
+}
+
+/*
+** Parse/generate objsect
+*/
+static PyObject *
+PyMac_BuildHFSUniStr255(HFSUniStr255 *itself)
+{
+
+ return Py_BuildValue("u#", itself->unicode, itself->length);
+}
+
+#ifndef __LP64__
+static OSErr
+_PyMac_GetFullPathname(FSSpec *fss, char *path, int len)
+{
+ FSRef fsr;
+ OSErr err;
+
+ *path = '\0';
+ err = FSpMakeFSRef(fss, &fsr);
+ if (err == fnfErr) {
+ /* FSSpecs can point to non-existing files, fsrefs can't. */
+ FSSpec fss2;
+ int tocopy;
+
+ err = FSMakeFSSpec(fss->vRefNum, fss->parID,
+ (unsigned char*)"", &fss2);
+ if (err)
+ return err;
+ err = FSpMakeFSRef(&fss2, &fsr);
+ if (err)
+ return err;
+ err = (OSErr)FSRefMakePath(&fsr, (unsigned char*)path, len-1);
+ if (err)
+ return err;
+ /* This part is not 100% safe: we append the filename part, but
+ ** I'm not sure that we don't run afoul of the various 8bit
+ ** encodings here. Will have to look this up at some point...
+ */
+ strcat(path, "/");
+ tocopy = fss->name[0];
+ if ((strlen(path) + tocopy) >= len)
+ tocopy = len - strlen(path) - 1;
+ if (tocopy > 0)
+ strncat(path, (char*)fss->name+1, tocopy);
+ }
+ else {
+ if (err)
+ return err;
+ err = (OSErr)FSRefMakePath(&fsr, (unsigned char*)path, len);
+ if (err)
+ return err;
+ }
+ return 0;
+}
+#endif /* !__LP64__ */
+
+
+static PyObject *File_Error;
+
+/* ------------------- Object type FSCatalogInfo -------------------- */
+
+static PyTypeObject FSCatalogInfo_Type;
+
+#define FSCatalogInfo_Check(x) ((x)->ob_type == &FSCatalogInfo_Type || PyObject_TypeCheck((x), &FSCatalogInfo_Type))
+
+typedef struct FSCatalogInfoObject {
+ PyObject_HEAD
+ FSCatalogInfo ob_itself;
+} FSCatalogInfoObject;
+
+static PyObject *FSCatalogInfo_New(FSCatalogInfo *itself)
+{
+ FSCatalogInfoObject *it;
+ if (itself == NULL) { Py_INCREF(Py_None); return Py_None; }
+ it = PyObject_NEW(FSCatalogInfoObject, &FSCatalogInfo_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = *itself;
+ return (PyObject *)it;
+}
+
+static int FSCatalogInfo_Convert(PyObject *v, FSCatalogInfo *p_itself)
+{
+ if (!FSCatalogInfo_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "FSCatalogInfo required");
+ return 0;
+ }
+ *p_itself = ((FSCatalogInfoObject *)v)->ob_itself;
+ return 1;
+}
+
+static void FSCatalogInfo_dealloc(FSCatalogInfoObject *self)
+{
+ /* Cleanup of self->ob_itself goes here */
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyMethodDef FSCatalogInfo_methods[] = {
+ {NULL, NULL, 0}
+};
+
+static PyObject *FSCatalogInfo_get_nodeFlags(FSCatalogInfoObject *self, void *closure)
+{
+ return Py_BuildValue("H", self->ob_itself.nodeFlags);
+}
+
+static int FSCatalogInfo_set_nodeFlags(FSCatalogInfoObject *self, PyObject *v, void *closure)
+{
+ return PyArg_Parse(v, "H", &self->ob_itself.nodeFlags)-1;
+ return 0;
+}
+
+static PyObject *FSCatalogInfo_get_volume(FSCatalogInfoObject *self, void *closure)
+{
+ return Py_BuildValue("h", self->ob_itself.volume);
+}
+
+static int FSCatalogInfo_set_volume(FSCatalogInfoObject *self, PyObject *v, void *closure)
+{
+ return PyArg_Parse(v, "h", &self->ob_itself.volume)-1;
+ return 0;
+}
+
+static PyObject *FSCatalogInfo_get_parentDirID(FSCatalogInfoObject *self, void *closure)
+{
+ return Py_BuildValue("l", self->ob_itself.parentDirID);
+}
+
+static int FSCatalogInfo_set_parentDirID(FSCatalogInfoObject *self, PyObject *v, void *closure)
+{
+ return PyArg_Parse(v, "l", &self->ob_itself.parentDirID)-1;
+ return 0;
+}
+
+static PyObject *FSCatalogInfo_get_nodeID(FSCatalogInfoObject *self, void *closure)
+{
+ return Py_BuildValue("l", self->ob_itself.nodeID);
+}
+
+static int FSCatalogInfo_set_nodeID(FSCatalogInfoObject *self, PyObject *v, void *closure)
+{
+ return PyArg_Parse(v, "l", &self->ob_itself.nodeID)-1;
+ return 0;
+}
+
+static PyObject *FSCatalogInfo_get_createDate(FSCatalogInfoObject *self, void *closure)
+{
+ return Py_BuildValue("O&", UTCDateTime_New, &self->ob_itself.createDate);
+}
+
+static int FSCatalogInfo_set_createDate(FSCatalogInfoObject *self, PyObject *v, void *closure)
+{
+ return PyArg_Parse(v, "O&", UTCDateTime_Convert, &self->ob_itself.createDate)-1;
+ return 0;
+}
+
+static PyObject *FSCatalogInfo_get_contentModDate(FSCatalogInfoObject *self, void *closure)
+{
+ return Py_BuildValue("O&", UTCDateTime_New, &self->ob_itself.contentModDate);
+}
+
+static int FSCatalogInfo_set_contentModDate(FSCatalogInfoObject *self, PyObject *v, void *closure)
+{
+ return PyArg_Parse(v, "O&", UTCDateTime_Convert, &self->ob_itself.contentModDate)-1;
+ return 0;
+}
+
+static PyObject *FSCatalogInfo_get_attributeModDate(FSCatalogInfoObject *self, void *closure)
+{
+ return Py_BuildValue("O&", UTCDateTime_New, &self->ob_itself.attributeModDate);
+}
+
+static int FSCatalogInfo_set_attributeModDate(FSCatalogInfoObject *self, PyObject *v, void *closure)
+{
+ return PyArg_Parse(v, "O&", UTCDateTime_Convert, &self->ob_itself.attributeModDate)-1;
+ return 0;
+}
+
+static PyObject *FSCatalogInfo_get_accessDate(FSCatalogInfoObject *self, void *closure)
+{
+ return Py_BuildValue("O&", UTCDateTime_New, &self->ob_itself.accessDate);
+}
+
+static int FSCatalogInfo_set_accessDate(FSCatalogInfoObject *self, PyObject *v, void *closure)
+{
+ return PyArg_Parse(v, "O&", UTCDateTime_Convert, &self->ob_itself.accessDate)-1;
+ return 0;
+}
+
+static PyObject *FSCatalogInfo_get_backupDate(FSCatalogInfoObject *self, void *closure)
+{
+ return Py_BuildValue("O&", UTCDateTime_New, &self->ob_itself.backupDate);
+}
+
+static int FSCatalogInfo_set_backupDate(FSCatalogInfoObject *self, PyObject *v, void *closure)
+{
+ return PyArg_Parse(v, "O&", UTCDateTime_Convert, &self->ob_itself.backupDate)-1;
+ return 0;
+}
+
+static PyObject *FSCatalogInfo_get_permissions(FSCatalogInfoObject *self, void *closure)
+{
+ 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)
+{
+ 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;
+}
+
+static PyObject *FSCatalogInfo_get_valence(FSCatalogInfoObject *self, void *closure)
+{
+ return Py_BuildValue("l", self->ob_itself.valence);
+}
+
+static int FSCatalogInfo_set_valence(FSCatalogInfoObject *self, PyObject *v, void *closure)
+{
+ return PyArg_Parse(v, "l", &self->ob_itself.valence)-1;
+ return 0;
+}
+
+static PyObject *FSCatalogInfo_get_dataLogicalSize(FSCatalogInfoObject *self, void *closure)
+{
+ return Py_BuildValue("l", self->ob_itself.dataLogicalSize);
+}
+
+static int FSCatalogInfo_set_dataLogicalSize(FSCatalogInfoObject *self, PyObject *v, void *closure)
+{
+ return PyArg_Parse(v, "l", &self->ob_itself.dataLogicalSize)-1;
+ return 0;
+}
+
+static PyObject *FSCatalogInfo_get_dataPhysicalSize(FSCatalogInfoObject *self, void *closure)
+{
+ return Py_BuildValue("l", self->ob_itself.dataPhysicalSize);
+}
+
+static int FSCatalogInfo_set_dataPhysicalSize(FSCatalogInfoObject *self, PyObject *v, void *closure)
+{
+ return PyArg_Parse(v, "l", &self->ob_itself.dataPhysicalSize)-1;
+ return 0;
+}
+
+static PyObject *FSCatalogInfo_get_rsrcLogicalSize(FSCatalogInfoObject *self, void *closure)
+{
+ return Py_BuildValue("l", self->ob_itself.rsrcLogicalSize);
+}
+
+static int FSCatalogInfo_set_rsrcLogicalSize(FSCatalogInfoObject *self, PyObject *v, void *closure)
+{
+ return PyArg_Parse(v, "l", &self->ob_itself.rsrcLogicalSize)-1;
+ return 0;
+}
+
+static PyObject *FSCatalogInfo_get_rsrcPhysicalSize(FSCatalogInfoObject *self, void *closure)
+{
+ return Py_BuildValue("l", self->ob_itself.rsrcPhysicalSize);
+}
+
+static int FSCatalogInfo_set_rsrcPhysicalSize(FSCatalogInfoObject *self, PyObject *v, void *closure)
+{
+ return PyArg_Parse(v, "l", &self->ob_itself.rsrcPhysicalSize)-1;
+ return 0;
+}
+
+static PyObject *FSCatalogInfo_get_sharingFlags(FSCatalogInfoObject *self, void *closure)
+{
+ return Py_BuildValue("l", self->ob_itself.sharingFlags);
+}
+
+static int FSCatalogInfo_set_sharingFlags(FSCatalogInfoObject *self, PyObject *v, void *closure)
+{
+ return PyArg_Parse(v, "l", &self->ob_itself.sharingFlags)-1;
+ return 0;
+}
+
+static PyObject *FSCatalogInfo_get_userPrivileges(FSCatalogInfoObject *self, void *closure)
+{
+ return Py_BuildValue("b", self->ob_itself.userPrivileges);
+}
+
+static int FSCatalogInfo_set_userPrivileges(FSCatalogInfoObject *self, PyObject *v, void *closure)
+{
+ return PyArg_Parse(v, "b", &self->ob_itself.userPrivileges)-1;
+ return 0;
+}
+
+static PyGetSetDef FSCatalogInfo_getsetlist[] = {
+ {"nodeFlags", (getter)FSCatalogInfo_get_nodeFlags, (setter)FSCatalogInfo_set_nodeFlags, NULL},
+ {"volume", (getter)FSCatalogInfo_get_volume, (setter)FSCatalogInfo_set_volume, NULL},
+ {"parentDirID", (getter)FSCatalogInfo_get_parentDirID, (setter)FSCatalogInfo_set_parentDirID, NULL},
+ {"nodeID", (getter)FSCatalogInfo_get_nodeID, (setter)FSCatalogInfo_set_nodeID, NULL},
+ {"createDate", (getter)FSCatalogInfo_get_createDate, (setter)FSCatalogInfo_set_createDate, NULL},
+ {"contentModDate", (getter)FSCatalogInfo_get_contentModDate, (setter)FSCatalogInfo_set_contentModDate, NULL},
+ {"attributeModDate", (getter)FSCatalogInfo_get_attributeModDate, (setter)FSCatalogInfo_set_attributeModDate, NULL},
+ {"accessDate", (getter)FSCatalogInfo_get_accessDate, (setter)FSCatalogInfo_set_accessDate, NULL},
+ {"backupDate", (getter)FSCatalogInfo_get_backupDate, (setter)FSCatalogInfo_set_backupDate, NULL},
+ {"permissions", (getter)FSCatalogInfo_get_permissions, (setter)FSCatalogInfo_set_permissions, NULL},
+ {"valence", (getter)FSCatalogInfo_get_valence, (setter)FSCatalogInfo_set_valence, NULL},
+ {"dataLogicalSize", (getter)FSCatalogInfo_get_dataLogicalSize, (setter)FSCatalogInfo_set_dataLogicalSize, NULL},
+ {"dataPhysicalSize", (getter)FSCatalogInfo_get_dataPhysicalSize, (setter)FSCatalogInfo_set_dataPhysicalSize, NULL},
+ {"rsrcLogicalSize", (getter)FSCatalogInfo_get_rsrcLogicalSize, (setter)FSCatalogInfo_set_rsrcLogicalSize, NULL},
+ {"rsrcPhysicalSize", (getter)FSCatalogInfo_get_rsrcPhysicalSize, (setter)FSCatalogInfo_set_rsrcPhysicalSize, NULL},
+ {"sharingFlags", (getter)FSCatalogInfo_get_sharingFlags, (setter)FSCatalogInfo_set_sharingFlags, NULL},
+ {"userPrivileges", (getter)FSCatalogInfo_get_userPrivileges, (setter)FSCatalogInfo_set_userPrivileges, NULL},
+ {NULL, NULL, NULL, NULL},
+};
+
+
+#define FSCatalogInfo_compare NULL
+
+#define FSCatalogInfo_repr NULL
+
+#define FSCatalogInfo_hash NULL
+static int FSCatalogInfo_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds)
+{
+ static char *kw[] = {
+ "nodeFlags",
+ "volume",
+ "parentDirID",
+ "nodeID",
+ "createDate",
+ "contentModDate",
+ "atributeModDate",
+ "accessDate",
+ "backupDate",
+ "valence",
+ "dataLogicalSize",
+ "dataPhysicalSize",
+ "rsrcLogicalSize",
+ "rsrcPhysicalSize",
+ "sharingFlags",
+ "userPrivileges"
+ , 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "|HhllO&O&O&O&O&llllllb", kw, &((FSCatalogInfoObject *)_self)->ob_itself.nodeFlags,
+ &((FSCatalogInfoObject *)_self)->ob_itself.volume,
+ &((FSCatalogInfoObject *)_self)->ob_itself.parentDirID,
+ &((FSCatalogInfoObject *)_self)->ob_itself.nodeID,
+ UTCDateTime_Convert, &((FSCatalogInfoObject *)_self)->ob_itself.createDate,
+ UTCDateTime_Convert, &((FSCatalogInfoObject *)_self)->ob_itself.contentModDate,
+ UTCDateTime_Convert, &((FSCatalogInfoObject *)_self)->ob_itself.attributeModDate,
+ UTCDateTime_Convert, &((FSCatalogInfoObject *)_self)->ob_itself.accessDate,
+ UTCDateTime_Convert, &((FSCatalogInfoObject *)_self)->ob_itself.backupDate,
+ &((FSCatalogInfoObject *)_self)->ob_itself.valence,
+ &((FSCatalogInfoObject *)_self)->ob_itself.dataLogicalSize,
+ &((FSCatalogInfoObject *)_self)->ob_itself.dataPhysicalSize,
+ &((FSCatalogInfoObject *)_self)->ob_itself.rsrcLogicalSize,
+ &((FSCatalogInfoObject *)_self)->ob_itself.rsrcPhysicalSize,
+ &((FSCatalogInfoObject *)_self)->ob_itself.sharingFlags,
+ &((FSCatalogInfoObject *)_self)->ob_itself.userPrivileges))
+ {
+ return -1;
+ }
+ return 0;
+}
+
+#define FSCatalogInfo_tp_alloc PyType_GenericAlloc
+
+static PyObject *FSCatalogInfo_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *self;
+
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ memset(&((FSCatalogInfoObject *)self)->ob_itself, 0, sizeof(FSCatalogInfo));
+ return self;
+}
+
+#define FSCatalogInfo_tp_free PyObject_Del
+
+
+static PyTypeObject FSCatalogInfo_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "Carbon.File.FSCatalogInfo", /*tp_name*/
+ sizeof(FSCatalogInfoObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) FSCatalogInfo_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) FSCatalogInfo_compare, /*tp_compare*/
+ (reprfunc) FSCatalogInfo_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) FSCatalogInfo_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ FSCatalogInfo_methods, /* tp_methods */
+ 0, /*tp_members*/
+ FSCatalogInfo_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ FSCatalogInfo_tp_init, /* tp_init */
+ FSCatalogInfo_tp_alloc, /* tp_alloc */
+ FSCatalogInfo_tp_new, /* tp_new */
+ FSCatalogInfo_tp_free, /* tp_free */
+};
+
+/* ----------------- End object type FSCatalogInfo ------------------ */
+
+
+/* ----------------------- Object type FInfo ------------------------ */
+
+#ifndef __LP64__
+
+static PyTypeObject FInfo_Type;
+
+#define FInfo_Check(x) ((x)->ob_type == &FInfo_Type || PyObject_TypeCheck((x), &FInfo_Type))
+
+typedef struct FInfoObject {
+ PyObject_HEAD
+ FInfo ob_itself;
+} FInfoObject;
+
+static PyObject *FInfo_New(FInfo *itself)
+{
+ FInfoObject *it;
+ if (itself == NULL) return PyMac_Error(resNotFound);
+ it = PyObject_NEW(FInfoObject, &FInfo_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = *itself;
+ return (PyObject *)it;
+}
+
+static int FInfo_Convert(PyObject *v, FInfo *p_itself)
+{
+ if (!FInfo_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "FInfo required");
+ return 0;
+ }
+ *p_itself = ((FInfoObject *)v)->ob_itself;
+ return 1;
+}
+
+static void FInfo_dealloc(FInfoObject *self)
+{
+ /* Cleanup of self->ob_itself goes here */
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyMethodDef FInfo_methods[] = {
+ {NULL, NULL, 0}
+};
+
+static PyObject *FInfo_get_Type(FInfoObject *self, void *closure)
+{
+ return Py_BuildValue("O&", PyMac_BuildOSType, self->ob_itself.fdType);
+}
+
+static int FInfo_set_Type(FInfoObject *self, PyObject *v, void *closure)
+{
+ return PyArg_Parse(v, "O&", PyMac_GetOSType, &self->ob_itself.fdType)-1;
+ return 0;
+}
+
+static PyObject *FInfo_get_Creator(FInfoObject *self, void *closure)
+{
+ return Py_BuildValue("O&", PyMac_BuildOSType, self->ob_itself.fdCreator);
+}
+
+static int FInfo_set_Creator(FInfoObject *self, PyObject *v, void *closure)
+{
+ return PyArg_Parse(v, "O&", PyMac_GetOSType, &self->ob_itself.fdCreator)-1;
+ return 0;
+}
+
+static PyObject *FInfo_get_Flags(FInfoObject *self, void *closure)
+{
+ return Py_BuildValue("H", self->ob_itself.fdFlags);
+}
+
+static int FInfo_set_Flags(FInfoObject *self, PyObject *v, void *closure)
+{
+ return PyArg_Parse(v, "H", &self->ob_itself.fdFlags)-1;
+ return 0;
+}
+
+static PyObject *FInfo_get_Location(FInfoObject *self, void *closure)
+{
+ return Py_BuildValue("O&", PyMac_BuildPoint, self->ob_itself.fdLocation);
+}
+
+static int FInfo_set_Location(FInfoObject *self, PyObject *v, void *closure)
+{
+ return PyArg_Parse(v, "O&", PyMac_GetPoint, &self->ob_itself.fdLocation)-1;
+ return 0;
+}
+
+static PyObject *FInfo_get_Fldr(FInfoObject *self, void *closure)
+{
+ return Py_BuildValue("h", self->ob_itself.fdFldr);
+}
+
+static int FInfo_set_Fldr(FInfoObject *self, PyObject *v, void *closure)
+{
+ return PyArg_Parse(v, "h", &self->ob_itself.fdFldr)-1;
+ return 0;
+}
+
+static PyGetSetDef FInfo_getsetlist[] = {
+ {"Type", (getter)FInfo_get_Type, (setter)FInfo_set_Type, "4-char file type"},
+ {"Creator", (getter)FInfo_get_Creator, (setter)FInfo_set_Creator, "4-char file creator"},
+ {"Flags", (getter)FInfo_get_Flags, (setter)FInfo_set_Flags, "Finder flag bits"},
+ {"Location", (getter)FInfo_get_Location, (setter)FInfo_set_Location, "(x, y) location of the file's icon in its parent finder window"},
+ {"Fldr", (getter)FInfo_get_Fldr, (setter)FInfo_set_Fldr, "Original folder, for 'put away'"},
+ {NULL, NULL, NULL, NULL},
+};
+
+
+#define FInfo_compare NULL
+
+#define FInfo_repr NULL
+
+#define FInfo_hash NULL
+static int FInfo_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds)
+{
+ FInfo *itself = NULL;
+ static char *kw[] = {"itself", 0};
+
+ if (PyArg_ParseTupleAndKeywords(_args, _kwds, "|O&", kw, FInfo_Convert, &itself))
+ {
+ if (itself) memcpy(&((FInfoObject *)_self)->ob_itself, itself, sizeof(FInfo));
+ return 0;
+ }
+ return -1;
+}
+
+#define FInfo_tp_alloc PyType_GenericAlloc
+
+static PyObject *FInfo_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *self;
+
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ memset(&((FInfoObject *)self)->ob_itself, 0, sizeof(FInfo));
+ return self;
+}
+
+#define FInfo_tp_free PyObject_Del
+
+
+static PyTypeObject FInfo_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "Carbon.File.FInfo", /*tp_name*/
+ sizeof(FInfoObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) FInfo_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) FInfo_compare, /*tp_compare*/
+ (reprfunc) FInfo_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) FInfo_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ FInfo_methods, /* tp_methods */
+ 0, /*tp_members*/
+ FInfo_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ FInfo_tp_init, /* tp_init */
+ FInfo_tp_alloc, /* tp_alloc */
+ FInfo_tp_new, /* tp_new */
+ FInfo_tp_free, /* tp_free */
+};
+
+#endif /* !__LP64__ */
+/* --------------------- End object type FInfo ---------------------- */
+
+
+/* ----------------------- Object type Alias ------------------------ */
+
+static PyTypeObject Alias_Type;
+
+#define Alias_Check(x) ((x)->ob_type == &Alias_Type || PyObject_TypeCheck((x), &Alias_Type))
+
+typedef struct AliasObject {
+ PyObject_HEAD
+ AliasHandle ob_itself;
+ void (*ob_freeit)(AliasHandle ptr);
+} AliasObject;
+
+static PyObject *Alias_New(AliasHandle itself)
+{
+ AliasObject *it;
+ if (itself == NULL) return PyMac_Error(resNotFound);
+ it = PyObject_NEW(AliasObject, &Alias_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ it->ob_freeit = NULL;
+ return (PyObject *)it;
+}
+
+static int Alias_Convert(PyObject *v, AliasHandle *p_itself)
+{
+ if (!Alias_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "Alias required");
+ return 0;
+ }
+ *p_itself = ((AliasObject *)v)->ob_itself;
+ return 1;
+}
+
+static void Alias_dealloc(AliasObject *self)
+{
+ if (self->ob_freeit && self->ob_itself)
+ {
+ self->ob_freeit(self->ob_itself);
+ }
+ self->ob_itself = NULL;
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+#ifndef __LP64__
+static PyObject *Alias_ResolveAlias(AliasObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSSpec fromFile__buf__;
+ FSSpec *fromFile = &fromFile__buf__;
+ FSSpec target;
+ Boolean wasChanged;
+ if (!PyArg_ParseTuple(_args, "O&",
+ myPyMac_GetOptFSSpecPtr, &fromFile))
+ return NULL;
+ _err = ResolveAlias(fromFile,
+ _self->ob_itself,
+ &target,
+ &wasChanged);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&b",
+ FSSpec_New, &target,
+ wasChanged);
+ return _res;
+}
+
+static PyObject *Alias_GetAliasInfo(AliasObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AliasInfoType index;
+ Str63 theString;
+ if (!PyArg_ParseTuple(_args, "h",
+ &index))
+ return NULL;
+ _err = GetAliasInfo(_self->ob_itself,
+ index,
+ theString);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildStr255, theString);
+ return _res;
+}
+
+static PyObject *Alias_ResolveAliasWithMountFlags(AliasObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSSpec fromFile__buf__;
+ FSSpec *fromFile = &fromFile__buf__;
+ FSSpec target;
+ Boolean wasChanged;
+ unsigned long mountFlags;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ myPyMac_GetOptFSSpecPtr, &fromFile,
+ &mountFlags))
+ return NULL;
+ _err = ResolveAliasWithMountFlags(fromFile,
+ _self->ob_itself,
+ &target,
+ &wasChanged,
+ mountFlags);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&b",
+ FSSpec_New, &target,
+ wasChanged);
+ return _res;
+}
+
+static PyObject *Alias_FollowFinderAlias(AliasObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSSpec fromFile__buf__;
+ FSSpec *fromFile = &fromFile__buf__;
+ Boolean logon;
+ FSSpec target;
+ Boolean wasChanged;
+ if (!PyArg_ParseTuple(_args, "O&b",
+ myPyMac_GetOptFSSpecPtr, &fromFile,
+ &logon))
+ return NULL;
+ _err = FollowFinderAlias(fromFile,
+ _self->ob_itself,
+ logon,
+ &target,
+ &wasChanged);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&b",
+ FSSpec_New, &target,
+ wasChanged);
+ return _res;
+}
+#endif /* !__LP64__ */
+
+static PyObject *Alias_FSResolveAliasWithMountFlags(AliasObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSRef fromFile__buf__;
+ FSRef *fromFile = &fromFile__buf__;
+ FSRef target;
+ Boolean wasChanged;
+ unsigned long mountFlags;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ myPyMac_GetOptFSRefPtr, &fromFile,
+ &mountFlags))
+ return NULL;
+ _err = FSResolveAliasWithMountFlags(fromFile,
+ _self->ob_itself,
+ &target,
+ &wasChanged,
+ mountFlags);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&b",
+ FSRef_New, &target,
+ wasChanged);
+ return _res;
+}
+
+static PyObject *Alias_FSResolveAlias(AliasObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSRef fromFile__buf__;
+ FSRef *fromFile = &fromFile__buf__;
+ FSRef target;
+ Boolean wasChanged;
+ if (!PyArg_ParseTuple(_args, "O&",
+ myPyMac_GetOptFSRefPtr, &fromFile))
+ return NULL;
+ _err = FSResolveAlias(fromFile,
+ _self->ob_itself,
+ &target,
+ &wasChanged);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&b",
+ FSRef_New, &target,
+ wasChanged);
+ return _res;
+}
+
+static PyObject *Alias_FSFollowFinderAlias(AliasObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSRef fromFile;
+ Boolean logon;
+ FSRef target;
+ Boolean wasChanged;
+ if (!PyArg_ParseTuple(_args, "b",
+ &logon))
+ return NULL;
+ _err = FSFollowFinderAlias(&fromFile,
+ _self->ob_itself,
+ logon,
+ &target,
+ &wasChanged);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&O&b",
+ FSRef_New, &fromFile,
+ FSRef_New, &target,
+ wasChanged);
+ return _res;
+}
+
+static PyMethodDef Alias_methods[] = {
+#ifndef __LP64__
+ {"ResolveAlias", (PyCFunction)Alias_ResolveAlias, 1,
+ PyDoc_STR("(FSSpec fromFile) -> (FSSpec target, Boolean wasChanged)")},
+ {"GetAliasInfo", (PyCFunction)Alias_GetAliasInfo, 1,
+ PyDoc_STR("(AliasInfoType index) -> (Str63 theString)")},
+ {"ResolveAliasWithMountFlags", (PyCFunction)Alias_ResolveAliasWithMountFlags, 1,
+ 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,
+ PyDoc_STR("(FSRef fromFile) -> (FSRef target, Boolean wasChanged)")},
+ {"FSFollowFinderAlias", (PyCFunction)Alias_FSFollowFinderAlias, 1,
+ PyDoc_STR("(Boolean logon) -> (FSRef fromFile, FSRef target, Boolean wasChanged)")},
+ {NULL, NULL, 0}
+};
+
+static PyObject *Alias_get_data(AliasObject *self, void *closure)
+{
+ int size;
+ PyObject *rv;
+
+ size = GetHandleSize((Handle)self->ob_itself);
+ HLock((Handle)self->ob_itself);
+ rv = PyString_FromStringAndSize(*(Handle)self->ob_itself, size);
+ HUnlock((Handle)self->ob_itself);
+ return rv;
+
+}
+
+#define Alias_set_data NULL
+
+static PyGetSetDef Alias_getsetlist[] = {
+ {"data", (getter)Alias_get_data, (setter)Alias_set_data, "Raw data of the alias object"},
+ {NULL, NULL, NULL, NULL},
+};
+
+
+#define Alias_compare NULL
+
+#define Alias_repr NULL
+
+#define Alias_hash NULL
+static int Alias_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds)
+{
+ AliasHandle itself = NULL;
+ char *rawdata = NULL;
+ int rawdatalen = 0;
+ Handle h;
+ static char *kw[] = {"itself", "rawdata", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "|O&s#", kw, Alias_Convert, &itself, &rawdata, &rawdatalen))
+ return -1;
+ if (itself && rawdata)
+ {
+ PyErr_SetString(PyExc_TypeError, "Only one of itself or rawdata may be specified");
+ return -1;
+ }
+ if (!itself && !rawdata)
+ {
+ PyErr_SetString(PyExc_TypeError, "One of itself or rawdata must be specified");
+ return -1;
+ }
+ if (rawdata)
+ {
+ if ((h = NewHandle(rawdatalen)) == NULL)
+ {
+ PyErr_NoMemory();
+ return -1;
+ }
+ HLock(h);
+ memcpy((char *)*h, rawdata, rawdatalen);
+ HUnlock(h);
+ ((AliasObject *)_self)->ob_itself = (AliasHandle)h;
+ return 0;
+ }
+ ((AliasObject *)_self)->ob_itself = itself;
+ return 0;
+}
+
+#define Alias_tp_alloc PyType_GenericAlloc
+
+static PyObject *Alias_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *self;
+
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((AliasObject *)self)->ob_itself = NULL;
+ return self;
+}
+
+#define Alias_tp_free PyObject_Del
+
+
+static PyTypeObject Alias_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "Carbon.File.Alias", /*tp_name*/
+ sizeof(AliasObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) Alias_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) Alias_compare, /*tp_compare*/
+ (reprfunc) Alias_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) Alias_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ Alias_methods, /* tp_methods */
+ 0, /*tp_members*/
+ Alias_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ Alias_tp_init, /* tp_init */
+ Alias_tp_alloc, /* tp_alloc */
+ Alias_tp_new, /* tp_new */
+ Alias_tp_free, /* tp_free */
+};
+
+/* --------------------- End object type Alias ---------------------- */
+
+
+/* ----------------------- Object type FSSpec ----------------------- */
+#ifndef __LP64__
+
+static PyTypeObject FSSpec_Type;
+
+#define FSSpec_Check(x) ((x)->ob_type == &FSSpec_Type || PyObject_TypeCheck((x), &FSSpec_Type))
+
+typedef struct FSSpecObject {
+ PyObject_HEAD
+ FSSpec ob_itself;
+} FSSpecObject;
+
+static PyObject *FSSpec_New(FSSpec *itself)
+{
+ FSSpecObject *it;
+ if (itself == NULL) return PyMac_Error(resNotFound);
+ it = PyObject_NEW(FSSpecObject, &FSSpec_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = *itself;
+ return (PyObject *)it;
+}
+
+static void FSSpec_dealloc(FSSpecObject *self)
+{
+ /* Cleanup of self->ob_itself goes here */
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *FSSpec_FSpOpenDF(FSSpecObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt8 permission;
+ short refNum;
+ if (!PyArg_ParseTuple(_args, "b",
+ &permission))
+ return NULL;
+ _err = FSpOpenDF(&_self->ob_itself,
+ permission,
+ &refNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ refNum);
+ return _res;
+}
+
+static PyObject *FSSpec_FSpOpenRF(FSSpecObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt8 permission;
+ short refNum;
+ if (!PyArg_ParseTuple(_args, "b",
+ &permission))
+ return NULL;
+ _err = FSpOpenRF(&_self->ob_itself,
+ permission,
+ &refNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ refNum);
+ return _res;
+}
+
+static PyObject *FSSpec_FSpCreate(FSSpecObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType creator;
+ OSType fileType;
+ ScriptCode scriptTag;
+ if (!PyArg_ParseTuple(_args, "O&O&h",
+ PyMac_GetOSType, &creator,
+ PyMac_GetOSType, &fileType,
+ &scriptTag))
+ return NULL;
+ _err = FSpCreate(&_self->ob_itself,
+ creator,
+ fileType,
+ scriptTag);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *FSSpec_FSpDirCreate(FSSpecObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ScriptCode scriptTag;
+ long createdDirID;
+ if (!PyArg_ParseTuple(_args, "h",
+ &scriptTag))
+ return NULL;
+ _err = FSpDirCreate(&_self->ob_itself,
+ scriptTag,
+ &createdDirID);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ createdDirID);
+ return _res;
+}
+
+static PyObject *FSSpec_FSpDelete(FSSpecObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = FSpDelete(&_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *FSSpec_FSpGetFInfo(FSSpecObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FInfo fndrInfo;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = FSpGetFInfo(&_self->ob_itself,
+ &fndrInfo);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ FInfo_New, &fndrInfo);
+ return _res;
+}
+
+static PyObject *FSSpec_FSpSetFInfo(FSSpecObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FInfo fndrInfo;
+ if (!PyArg_ParseTuple(_args, "O&",
+ FInfo_Convert, &fndrInfo))
+ return NULL;
+ _err = FSpSetFInfo(&_self->ob_itself,
+ &fndrInfo);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *FSSpec_FSpSetFLock(FSSpecObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = FSpSetFLock(&_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *FSSpec_FSpRstFLock(FSSpecObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = FSpRstFLock(&_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *FSSpec_FSpRename(FSSpecObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Str255 newName;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetStr255, newName))
+ return NULL;
+ _err = FSpRename(&_self->ob_itself,
+ newName);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *FSSpec_FSpCatMove(FSSpecObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSSpec dest;
+ if (!PyArg_ParseTuple(_args, "O&",
+ FSSpec_Convert, &dest))
+ return NULL;
+ _err = FSpCatMove(&_self->ob_itself,
+ &dest);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *FSSpec_FSpExchangeFiles(FSSpecObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSSpec dest;
+ if (!PyArg_ParseTuple(_args, "O&",
+ FSSpec_Convert, &dest))
+ return NULL;
+ _err = FSpExchangeFiles(&_self->ob_itself,
+ &dest);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *FSSpec_FSpMakeFSRef(FSSpecObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSRef newRef;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = FSpMakeFSRef(&_self->ob_itself,
+ &newRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ FSRef_New, &newRef);
+ return _res;
+}
+
+static PyObject *FSSpec_NewAliasMinimal(FSSpecObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AliasHandle alias;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = NewAliasMinimal(&_self->ob_itself,
+ &alias);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ Alias_New, alias);
+ return _res;
+}
+
+static PyObject *FSSpec_IsAliasFile(FSSpecObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Boolean aliasFileFlag;
+ Boolean folderFlag;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = IsAliasFile(&_self->ob_itself,
+ &aliasFileFlag,
+ &folderFlag);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("bb",
+ aliasFileFlag,
+ folderFlag);
+ return _res;
+}
+
+static PyObject *FSSpec_as_pathname(FSSpecObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ char strbuf[1024];
+ OSErr err;
+
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ err = _PyMac_GetFullPathname(&_self->ob_itself, strbuf, sizeof(strbuf));
+ if ( err ) {
+ PyMac_Error(err);
+ return NULL;
+ }
+ _res = PyString_FromString(strbuf);
+ return _res;
+
+}
+
+static PyObject *FSSpec_as_tuple(FSSpecObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _res = Py_BuildValue("(iis#)", _self->ob_itself.vRefNum, _self->ob_itself.parID,
+ &_self->ob_itself.name[1], _self->ob_itself.name[0]);
+ return _res;
+
+}
+
+static PyMethodDef FSSpec_methods[] = {
+ {"FSpOpenDF", (PyCFunction)FSSpec_FSpOpenDF, 1,
+ PyDoc_STR("(SInt8 permission) -> (short refNum)")},
+ {"FSpOpenRF", (PyCFunction)FSSpec_FSpOpenRF, 1,
+ PyDoc_STR("(SInt8 permission) -> (short refNum)")},
+ {"FSpCreate", (PyCFunction)FSSpec_FSpCreate, 1,
+ PyDoc_STR("(OSType creator, OSType fileType, ScriptCode scriptTag) -> None")},
+ {"FSpDirCreate", (PyCFunction)FSSpec_FSpDirCreate, 1,
+ PyDoc_STR("(ScriptCode scriptTag) -> (long createdDirID)")},
+ {"FSpDelete", (PyCFunction)FSSpec_FSpDelete, 1,
+ PyDoc_STR("() -> None")},
+ {"FSpGetFInfo", (PyCFunction)FSSpec_FSpGetFInfo, 1,
+ PyDoc_STR("() -> (FInfo fndrInfo)")},
+ {"FSpSetFInfo", (PyCFunction)FSSpec_FSpSetFInfo, 1,
+ PyDoc_STR("(FInfo fndrInfo) -> None")},
+ {"FSpSetFLock", (PyCFunction)FSSpec_FSpSetFLock, 1,
+ PyDoc_STR("() -> None")},
+ {"FSpRstFLock", (PyCFunction)FSSpec_FSpRstFLock, 1,
+ PyDoc_STR("() -> None")},
+ {"FSpRename", (PyCFunction)FSSpec_FSpRename, 1,
+ PyDoc_STR("(Str255 newName) -> None")},
+ {"FSpCatMove", (PyCFunction)FSSpec_FSpCatMove, 1,
+ PyDoc_STR("(FSSpec dest) -> None")},
+ {"FSpExchangeFiles", (PyCFunction)FSSpec_FSpExchangeFiles, 1,
+ PyDoc_STR("(FSSpec dest) -> None")},
+ {"FSpMakeFSRef", (PyCFunction)FSSpec_FSpMakeFSRef, 1,
+ PyDoc_STR("() -> (FSRef newRef)")},
+ {"NewAliasMinimal", (PyCFunction)FSSpec_NewAliasMinimal, 1,
+ PyDoc_STR("() -> (AliasHandle alias)")},
+ {"IsAliasFile", (PyCFunction)FSSpec_IsAliasFile, 1,
+ PyDoc_STR("() -> (Boolean aliasFileFlag, Boolean folderFlag)")},
+ {"as_pathname", (PyCFunction)FSSpec_as_pathname, 1,
+ PyDoc_STR("() -> string")},
+ {"as_tuple", (PyCFunction)FSSpec_as_tuple, 1,
+ PyDoc_STR("() -> (vRefNum, dirID, name)")},
+ {NULL, NULL, 0}
+};
+
+static PyObject *FSSpec_get_data(FSSpecObject *self, void *closure)
+{
+ return PyString_FromStringAndSize((char *)&self->ob_itself, sizeof(self->ob_itself));
+}
+
+#define FSSpec_set_data NULL
+
+static PyGetSetDef FSSpec_getsetlist[] = {
+ {"data", (getter)FSSpec_get_data, (setter)FSSpec_set_data, "Raw data of the FSSpec object"},
+ {NULL, NULL, NULL, NULL},
+};
+
+
+#define FSSpec_compare NULL
+
+static PyObject * FSSpec_repr(FSSpecObject *self)
+{
+ char buf[512];
+ PyOS_snprintf(buf, sizeof(buf), "%s((%d, %ld, '%.*s'))",
+ self->ob_type->tp_name,
+ self->ob_itself.vRefNum,
+ self->ob_itself.parID,
+ self->ob_itself.name[0], self->ob_itself.name+1);
+ return PyString_FromString(buf);
+}
+
+#define FSSpec_hash NULL
+static int FSSpec_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *v = NULL;
+ char *rawdata = NULL;
+ int rawdatalen = 0;
+ static char *kw[] = {"itself", "rawdata", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "|Os#", kw, &v, &rawdata, &rawdatalen))
+ return -1;
+ if (v && rawdata)
+ {
+ PyErr_SetString(PyExc_TypeError, "Only one of itself or rawdata may be specified");
+ return -1;
+ }
+ if (!v && !rawdata)
+ {
+ PyErr_SetString(PyExc_TypeError, "One of itself or rawdata must be specified");
+ return -1;
+ }
+ if (rawdata)
+ {
+ if (rawdatalen != sizeof(FSSpec))
+ {
+ PyErr_SetString(PyExc_TypeError, "FSSpec rawdata incorrect size");
+ return -1;
+ }
+ memcpy(&((FSSpecObject *)_self)->ob_itself, rawdata, rawdatalen);
+ return 0;
+ }
+ if (PyMac_GetFSSpec(v, &((FSSpecObject *)_self)->ob_itself)) return 0;
+ return -1;
+}
+
+#define FSSpec_tp_alloc PyType_GenericAlloc
+
+static PyObject *FSSpec_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *self;
+
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ memset(&((FSSpecObject *)self)->ob_itself, 0, sizeof(FSSpec));
+ return self;
+}
+
+#define FSSpec_tp_free PyObject_Del
+
+
+static PyTypeObject FSSpec_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "Carbon.File.FSSpec", /*tp_name*/
+ sizeof(FSSpecObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) FSSpec_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) FSSpec_compare, /*tp_compare*/
+ (reprfunc) FSSpec_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) FSSpec_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ FSSpec_methods, /* tp_methods */
+ 0, /*tp_members*/
+ FSSpec_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ FSSpec_tp_init, /* tp_init */
+ FSSpec_tp_alloc, /* tp_alloc */
+ FSSpec_tp_new, /* tp_new */
+ FSSpec_tp_free, /* tp_free */
+};
+
+#endif /* !__LP64__ */
+/* --------------------- End object type FSSpec --------------------- */
+
+
+/* ----------------------- Object type FSRef ------------------------ */
+
+static PyTypeObject FSRef_Type;
+
+#define FSRef_Check(x) ((x)->ob_type == &FSRef_Type || PyObject_TypeCheck((x), &FSRef_Type))
+
+typedef struct FSRefObject {
+ PyObject_HEAD
+ FSRef ob_itself;
+} FSRefObject;
+
+static PyObject *FSRef_New(FSRef *itself)
+{
+ FSRefObject *it;
+ if (itself == NULL) return PyMac_Error(resNotFound);
+ it = PyObject_NEW(FSRefObject, &FSRef_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = *itself;
+ return (PyObject *)it;
+}
+
+static void FSRef_dealloc(FSRefObject *self)
+{
+ /* Cleanup of self->ob_itself goes here */
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *FSRef_FSMakeFSRefUnicode(FSRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ UniChar *nameLength__in__;
+ UniCharCount nameLength__len__;
+ int nameLength__in_len__;
+ TextEncoding textEncodingHint;
+ FSRef newRef;
+ if (!PyArg_ParseTuple(_args, "u#l",
+ &nameLength__in__, &nameLength__in_len__,
+ &textEncodingHint))
+ return NULL;
+ nameLength__len__ = nameLength__in_len__;
+ _err = FSMakeFSRefUnicode(&_self->ob_itself,
+ nameLength__len__, nameLength__in__,
+ textEncodingHint,
+ &newRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ FSRef_New, &newRef);
+ return _res;
+}
+
+static PyObject *FSRef_FSCompareFSRefs(FSRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSRef ref2;
+ if (!PyArg_ParseTuple(_args, "O&",
+ FSRef_Convert, &ref2))
+ return NULL;
+ _err = FSCompareFSRefs(&_self->ob_itself,
+ &ref2);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *FSRef_FSCreateFileUnicode(FSRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ UniChar *nameLength__in__;
+ UniCharCount nameLength__len__;
+ int nameLength__in_len__;
+ FSCatalogInfoBitmap whichInfo;
+ FSCatalogInfo catalogInfo;
+ FSRef newRef;
+#ifndef __LP64__
+ FSSpec newSpec;
+#endif
+ if (!PyArg_ParseTuple(_args, "u#lO&",
+ &nameLength__in__, &nameLength__in_len__,
+ &whichInfo,
+ FSCatalogInfo_Convert, &catalogInfo))
+ return NULL;
+ nameLength__len__ = nameLength__in_len__;
+ _err = FSCreateFileUnicode(&_self->ob_itself,
+ nameLength__len__, nameLength__in__,
+ whichInfo,
+ &catalogInfo,
+ &newRef,
+#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;
+}
+
+static PyObject *FSRef_FSCreateDirectoryUnicode(FSRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ UniChar *nameLength__in__;
+ UniCharCount nameLength__len__;
+ int nameLength__in_len__;
+ 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__,
+ &whichInfo,
+ FSCatalogInfo_Convert, &catalogInfo))
+ return NULL;
+ nameLength__len__ = nameLength__in_len__;
+ _err = FSCreateDirectoryUnicode(&_self->ob_itself,
+ nameLength__len__, nameLength__in__,
+ 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;
+}
+
+static PyObject *FSRef_FSDeleteObject(FSRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = FSDeleteObject(&_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *FSRef_FSMoveObject(FSRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSRef destDirectory;
+ FSRef newRef;
+ if (!PyArg_ParseTuple(_args, "O&",
+ FSRef_Convert, &destDirectory))
+ return NULL;
+ _err = FSMoveObject(&_self->ob_itself,
+ &destDirectory,
+ &newRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ FSRef_New, &newRef);
+ return _res;
+}
+
+static PyObject *FSRef_FSExchangeObjects(FSRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSRef destRef;
+ if (!PyArg_ParseTuple(_args, "O&",
+ FSRef_Convert, &destRef))
+ return NULL;
+ _err = FSExchangeObjects(&_self->ob_itself,
+ &destRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *FSRef_FSRenameUnicode(FSRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ UniChar *nameLength__in__;
+ UniCharCount nameLength__len__;
+ int nameLength__in_len__;
+ TextEncoding textEncodingHint;
+ FSRef newRef;
+ if (!PyArg_ParseTuple(_args, "u#l",
+ &nameLength__in__, &nameLength__in_len__,
+ &textEncodingHint))
+ return NULL;
+ nameLength__len__ = nameLength__in_len__;
+ _err = FSRenameUnicode(&_self->ob_itself,
+ nameLength__len__, nameLength__in__,
+ textEncodingHint,
+ &newRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ FSRef_New, &newRef);
+ return _res;
+}
+
+static PyObject *FSRef_FSGetCatalogInfo(FSRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSCatalogInfoBitmap whichInfo;
+ FSCatalogInfo catalogInfo;
+ HFSUniStr255 outName;
+#ifndef __LP64__
+ FSSpec fsSpec;
+#endif /* !__LP64__ */
+ FSRef parentRef;
+ if (!PyArg_ParseTuple(_args, "l",
+ &whichInfo))
+ return NULL;
+ _err = FSGetCatalogInfo(&_self->ob_itself,
+ 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;
+}
+
+static PyObject *FSRef_FSSetCatalogInfo(FSRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSCatalogInfoBitmap whichInfo;
+ FSCatalogInfo catalogInfo;
+ if (!PyArg_ParseTuple(_args, "lO&",
+ &whichInfo,
+ FSCatalogInfo_Convert, &catalogInfo))
+ return NULL;
+ _err = FSSetCatalogInfo(&_self->ob_itself,
+ whichInfo,
+ &catalogInfo);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *FSRef_FSCreateFork(FSRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ UniChar *forkNameLength__in__;
+ UniCharCount forkNameLength__len__;
+ int forkNameLength__in_len__;
+ if (!PyArg_ParseTuple(_args, "u#",
+ &forkNameLength__in__, &forkNameLength__in_len__))
+ return NULL;
+ forkNameLength__len__ = forkNameLength__in_len__;
+ _err = FSCreateFork(&_self->ob_itself,
+ forkNameLength__len__, forkNameLength__in__);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *FSRef_FSDeleteFork(FSRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ UniChar *forkNameLength__in__;
+ UniCharCount forkNameLength__len__;
+ int forkNameLength__in_len__;
+ if (!PyArg_ParseTuple(_args, "u#",
+ &forkNameLength__in__, &forkNameLength__in_len__))
+ return NULL;
+ forkNameLength__len__ = forkNameLength__in_len__;
+ _err = FSDeleteFork(&_self->ob_itself,
+ forkNameLength__len__, forkNameLength__in__);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *FSRef_FSOpenFork(FSRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ UniChar *forkNameLength__in__;
+ UniCharCount forkNameLength__len__;
+ int forkNameLength__in_len__;
+ SInt8 permissions;
+ FSIORefNum forkRefNum;
+ if (!PyArg_ParseTuple(_args, "u#b",
+ &forkNameLength__in__, &forkNameLength__in_len__,
+ &permissions))
+ return NULL;
+ forkNameLength__len__ = forkNameLength__in_len__;
+ _err = FSOpenFork(&_self->ob_itself,
+ forkNameLength__len__, forkNameLength__in__,
+ permissions,
+ &forkRefNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ forkRefNum);
+ return _res;
+}
+
+static PyObject *FSRef_FNNotify(FSRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ FNMessage message;
+ OptionBits flags;
+ if (!PyArg_ParseTuple(_args, "ll",
+ &message,
+ &flags))
+ return NULL;
+ _err = FNNotify(&_self->ob_itself,
+ message,
+ flags);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *FSRef_FSNewAliasMinimal(FSRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AliasHandle inAlias;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = FSNewAliasMinimal(&_self->ob_itself,
+ &inAlias);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ Alias_New, inAlias);
+ return _res;
+}
+
+static PyObject *FSRef_FSIsAliasFile(FSRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Boolean aliasFileFlag;
+ Boolean folderFlag;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = FSIsAliasFile(&_self->ob_itself,
+ &aliasFileFlag,
+ &folderFlag);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("bb",
+ aliasFileFlag,
+ folderFlag);
+ return _res;
+}
+
+static PyObject *FSRef_FSRefMakePath(FSRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ OSStatus _err;
+#define MAXPATHNAME 1024
+ UInt8 path[MAXPATHNAME];
+ UInt32 maxPathSize = MAXPATHNAME;
+
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = FSRefMakePath(&_self->ob_itself,
+ path,
+ maxPathSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("s", path);
+ return _res;
+
+}
+
+static PyObject *FSRef_as_pathname(FSRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _res = FSRef_FSRefMakePath(_self, _args);
+ return _res;
+
+}
+
+static PyMethodDef FSRef_methods[] = {
+ {"FSMakeFSRefUnicode", (PyCFunction)FSRef_FSMakeFSRefUnicode, 1,
+ PyDoc_STR("(Buffer nameLength, TextEncoding textEncodingHint) -> (FSRef newRef)")},
+ {"FSCompareFSRefs", (PyCFunction)FSRef_FSCompareFSRefs, 1,
+ PyDoc_STR("(FSRef ref2) -> None")},
+ {"FSCreateFileUnicode", (PyCFunction)FSRef_FSCreateFileUnicode, 1,
+ PyDoc_STR("(Buffer nameLength, FSCatalogInfoBitmap whichInfo, FSCatalogInfo catalogInfo) -> (FSRef newRef, FSSpec newSpec)")},
+ {"FSCreateDirectoryUnicode", (PyCFunction)FSRef_FSCreateDirectoryUnicode, 1,
+ PyDoc_STR("(Buffer nameLength, FSCatalogInfoBitmap whichInfo, FSCatalogInfo catalogInfo) -> (FSRef newRef, FSSpec newSpec, UInt32 newDirID)")},
+ {"FSDeleteObject", (PyCFunction)FSRef_FSDeleteObject, 1,
+ PyDoc_STR("() -> None")},
+ {"FSMoveObject", (PyCFunction)FSRef_FSMoveObject, 1,
+ PyDoc_STR("(FSRef destDirectory) -> (FSRef newRef)")},
+ {"FSExchangeObjects", (PyCFunction)FSRef_FSExchangeObjects, 1,
+ PyDoc_STR("(FSRef destRef) -> None")},
+ {"FSRenameUnicode", (PyCFunction)FSRef_FSRenameUnicode, 1,
+ PyDoc_STR("(Buffer nameLength, TextEncoding textEncodingHint) -> (FSRef newRef)")},
+ {"FSGetCatalogInfo", (PyCFunction)FSRef_FSGetCatalogInfo, 1,
+ PyDoc_STR("(FSCatalogInfoBitmap whichInfo) -> (FSCatalogInfo catalogInfo, HFSUniStr255 outName, FSSpec fsSpec, FSRef parentRef)")},
+ {"FSSetCatalogInfo", (PyCFunction)FSRef_FSSetCatalogInfo, 1,
+ PyDoc_STR("(FSCatalogInfoBitmap whichInfo, FSCatalogInfo catalogInfo) -> None")},
+ {"FSCreateFork", (PyCFunction)FSRef_FSCreateFork, 1,
+ PyDoc_STR("(Buffer forkNameLength) -> None")},
+ {"FSDeleteFork", (PyCFunction)FSRef_FSDeleteFork, 1,
+ PyDoc_STR("(Buffer forkNameLength) -> None")},
+ {"FSOpenFork", (PyCFunction)FSRef_FSOpenFork, 1,
+ PyDoc_STR("(Buffer forkNameLength, SInt8 permissions) -> (SInt16 forkRefNum)")},
+ {"FNNotify", (PyCFunction)FSRef_FNNotify, 1,
+ PyDoc_STR("(FNMessage message, OptionBits flags) -> None")},
+ {"FSNewAliasMinimal", (PyCFunction)FSRef_FSNewAliasMinimal, 1,
+ PyDoc_STR("() -> (AliasHandle inAlias)")},
+ {"FSIsAliasFile", (PyCFunction)FSRef_FSIsAliasFile, 1,
+ PyDoc_STR("() -> (Boolean aliasFileFlag, Boolean folderFlag)")},
+ {"FSRefMakePath", (PyCFunction)FSRef_FSRefMakePath, 1,
+ PyDoc_STR("() -> string")},
+ {"as_pathname", (PyCFunction)FSRef_as_pathname, 1,
+ PyDoc_STR("() -> string")},
+ {NULL, NULL, 0}
+};
+
+static PyObject *FSRef_get_data(FSRefObject *self, void *closure)
+{
+ return PyString_FromStringAndSize((char *)&self->ob_itself, sizeof(self->ob_itself));
+}
+
+#define FSRef_set_data NULL
+
+static PyGetSetDef FSRef_getsetlist[] = {
+ {"data", (getter)FSRef_get_data, (setter)FSRef_set_data, "Raw data of the FSRef object"},
+ {NULL, NULL, NULL, NULL},
+};
+
+
+#define FSRef_compare NULL
+
+#define FSRef_repr NULL
+
+#define FSRef_hash NULL
+static int FSRef_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *v = NULL;
+ char *rawdata = NULL;
+ int rawdatalen = 0;
+ static char *kw[] = {"itself", "rawdata", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "|Os#", kw, &v, &rawdata, &rawdatalen))
+ return -1;
+ if (v && rawdata)
+ {
+ PyErr_SetString(PyExc_TypeError, "Only one of itself or rawdata may be specified");
+ return -1;
+ }
+ if (!v && !rawdata)
+ {
+ PyErr_SetString(PyExc_TypeError, "One of itself or rawdata must be specified");
+ return -1;
+ }
+ if (rawdata)
+ {
+ if (rawdatalen != sizeof(FSRef))
+ {
+ PyErr_SetString(PyExc_TypeError, "FSRef rawdata incorrect size");
+ return -1;
+ }
+ memcpy(&((FSRefObject *)_self)->ob_itself, rawdata, rawdatalen);
+ return 0;
+ }
+ if (PyMac_GetFSRef(v, &((FSRefObject *)_self)->ob_itself)) return 0;
+ return -1;
+}
+
+#define FSRef_tp_alloc PyType_GenericAlloc
+
+static PyObject *FSRef_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *self;
+
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ memset(&((FSRefObject *)self)->ob_itself, 0, sizeof(FSRef));
+ return self;
+}
+
+#define FSRef_tp_free PyObject_Del
+
+
+static PyTypeObject FSRef_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "Carbon.File.FSRef", /*tp_name*/
+ sizeof(FSRefObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) FSRef_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) FSRef_compare, /*tp_compare*/
+ (reprfunc) FSRef_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) FSRef_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ FSRef_methods, /* tp_methods */
+ 0, /*tp_members*/
+ FSRef_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ FSRef_tp_init, /* tp_init */
+ FSRef_tp_alloc, /* tp_alloc */
+ FSRef_tp_new, /* tp_new */
+ FSRef_tp_free, /* tp_free */
+};
+
+/* --------------------- End object type FSRef ---------------------- */
+
+#ifndef __LP64__
+static PyObject *File_UnmountVol(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Str63 volName;
+ short vRefNum;
+ if (!PyArg_ParseTuple(_args, "O&h",
+ PyMac_GetStr255, volName,
+ &vRefNum))
+ return NULL;
+ _err = UnmountVol(volName,
+ vRefNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *File_FlushVol(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Str63 volName;
+ short vRefNum;
+ if (!PyArg_ParseTuple(_args, "O&h",
+ PyMac_GetStr255, volName,
+ &vRefNum))
+ return NULL;
+ _err = FlushVol(volName,
+ vRefNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *File_HSetVol(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Str63 volName;
+ short vRefNum;
+ long dirID;
+ if (!PyArg_ParseTuple(_args, "O&hl",
+ PyMac_GetStr255, volName,
+ &vRefNum,
+ &dirID))
+ return NULL;
+ _err = HSetVol(volName,
+ vRefNum,
+ dirID);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *File_FSClose(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short refNum;
+ if (!PyArg_ParseTuple(_args, "h",
+ &refNum))
+ return NULL;
+ _err = FSClose(refNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *File_Allocate(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short refNum;
+ long count;
+ if (!PyArg_ParseTuple(_args, "h",
+ &refNum))
+ return NULL;
+ _err = Allocate(refNum,
+ &count);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ count);
+ return _res;
+}
+
+static PyObject *File_GetEOF(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short refNum;
+ long logEOF;
+ if (!PyArg_ParseTuple(_args, "h",
+ &refNum))
+ return NULL;
+ _err = GetEOF(refNum,
+ &logEOF);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ logEOF);
+ return _res;
+}
+
+static PyObject *File_SetEOF(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short refNum;
+ long logEOF;
+ if (!PyArg_ParseTuple(_args, "hl",
+ &refNum,
+ &logEOF))
+ return NULL;
+ _err = SetEOF(refNum,
+ logEOF);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *File_GetFPos(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short refNum;
+ long filePos;
+ if (!PyArg_ParseTuple(_args, "h",
+ &refNum))
+ return NULL;
+ _err = GetFPos(refNum,
+ &filePos);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ filePos);
+ return _res;
+}
+
+static PyObject *File_SetFPos(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short refNum;
+ short posMode;
+ long posOff;
+ if (!PyArg_ParseTuple(_args, "hhl",
+ &refNum,
+ &posMode,
+ &posOff))
+ return NULL;
+ _err = SetFPos(refNum,
+ posMode,
+ posOff);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *File_GetVRefNum(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short fileRefNum;
+ short vRefNum;
+ if (!PyArg_ParseTuple(_args, "h",
+ &fileRefNum))
+ return NULL;
+ _err = GetVRefNum(fileRefNum,
+ &vRefNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ vRefNum);
+ return _res;
+}
+
+static PyObject *File_HGetVol(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ StringPtr volName;
+ short vRefNum;
+ long dirID;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetStr255, &volName))
+ return NULL;
+ _err = HGetVol(volName,
+ &vRefNum,
+ &dirID);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("hl",
+ vRefNum,
+ dirID);
+ return _res;
+}
+
+static PyObject *File_HOpen(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short vRefNum;
+ long dirID;
+ Str255 fileName;
+ SInt8 permission;
+ short refNum;
+ if (!PyArg_ParseTuple(_args, "hlO&b",
+ &vRefNum,
+ &dirID,
+ PyMac_GetStr255, fileName,
+ &permission))
+ return NULL;
+ _err = HOpen(vRefNum,
+ dirID,
+ fileName,
+ permission,
+ &refNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ refNum);
+ return _res;
+}
+
+static PyObject *File_HOpenDF(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short vRefNum;
+ long dirID;
+ Str255 fileName;
+ SInt8 permission;
+ short refNum;
+ if (!PyArg_ParseTuple(_args, "hlO&b",
+ &vRefNum,
+ &dirID,
+ PyMac_GetStr255, fileName,
+ &permission))
+ return NULL;
+ _err = HOpenDF(vRefNum,
+ dirID,
+ fileName,
+ permission,
+ &refNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ refNum);
+ return _res;
+}
+
+static PyObject *File_HOpenRF(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short vRefNum;
+ long dirID;
+ Str255 fileName;
+ SInt8 permission;
+ short refNum;
+ if (!PyArg_ParseTuple(_args, "hlO&b",
+ &vRefNum,
+ &dirID,
+ PyMac_GetStr255, fileName,
+ &permission))
+ return NULL;
+ _err = HOpenRF(vRefNum,
+ dirID,
+ fileName,
+ permission,
+ &refNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ refNum);
+ return _res;
+}
+
+static PyObject *File_AllocContig(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short refNum;
+ long count;
+ if (!PyArg_ParseTuple(_args, "h",
+ &refNum))
+ return NULL;
+ _err = AllocContig(refNum,
+ &count);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ count);
+ return _res;
+}
+
+static PyObject *File_HCreate(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short vRefNum;
+ long dirID;
+ Str255 fileName;
+ OSType creator;
+ OSType fileType;
+ if (!PyArg_ParseTuple(_args, "hlO&O&O&",
+ &vRefNum,
+ &dirID,
+ PyMac_GetStr255, fileName,
+ PyMac_GetOSType, &creator,
+ PyMac_GetOSType, &fileType))
+ return NULL;
+ _err = HCreate(vRefNum,
+ dirID,
+ fileName,
+ creator,
+ fileType);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *File_DirCreate(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short vRefNum;
+ long parentDirID;
+ Str255 directoryName;
+ long createdDirID;
+ if (!PyArg_ParseTuple(_args, "hlO&",
+ &vRefNum,
+ &parentDirID,
+ PyMac_GetStr255, directoryName))
+ return NULL;
+ _err = DirCreate(vRefNum,
+ parentDirID,
+ directoryName,
+ &createdDirID);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ createdDirID);
+ return _res;
+}
+
+static PyObject *File_HDelete(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short vRefNum;
+ long dirID;
+ Str255 fileName;
+ if (!PyArg_ParseTuple(_args, "hlO&",
+ &vRefNum,
+ &dirID,
+ PyMac_GetStr255, fileName))
+ return NULL;
+ _err = HDelete(vRefNum,
+ dirID,
+ fileName);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *File_HGetFInfo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short vRefNum;
+ long dirID;
+ Str255 fileName;
+ FInfo fndrInfo;
+ if (!PyArg_ParseTuple(_args, "hlO&",
+ &vRefNum,
+ &dirID,
+ PyMac_GetStr255, fileName))
+ return NULL;
+ _err = HGetFInfo(vRefNum,
+ dirID,
+ fileName,
+ &fndrInfo);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ FInfo_New, &fndrInfo);
+ return _res;
+}
+
+static PyObject *File_HSetFInfo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short vRefNum;
+ long dirID;
+ Str255 fileName;
+ FInfo fndrInfo;
+ if (!PyArg_ParseTuple(_args, "hlO&O&",
+ &vRefNum,
+ &dirID,
+ PyMac_GetStr255, fileName,
+ FInfo_Convert, &fndrInfo))
+ return NULL;
+ _err = HSetFInfo(vRefNum,
+ dirID,
+ fileName,
+ &fndrInfo);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *File_HSetFLock(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short vRefNum;
+ long dirID;
+ Str255 fileName;
+ if (!PyArg_ParseTuple(_args, "hlO&",
+ &vRefNum,
+ &dirID,
+ PyMac_GetStr255, fileName))
+ return NULL;
+ _err = HSetFLock(vRefNum,
+ dirID,
+ fileName);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *File_HRstFLock(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short vRefNum;
+ long dirID;
+ Str255 fileName;
+ if (!PyArg_ParseTuple(_args, "hlO&",
+ &vRefNum,
+ &dirID,
+ PyMac_GetStr255, fileName))
+ return NULL;
+ _err = HRstFLock(vRefNum,
+ dirID,
+ fileName);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *File_HRename(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short vRefNum;
+ long dirID;
+ Str255 oldName;
+ Str255 newName;
+ if (!PyArg_ParseTuple(_args, "hlO&O&",
+ &vRefNum,
+ &dirID,
+ PyMac_GetStr255, oldName,
+ PyMac_GetStr255, newName))
+ return NULL;
+ _err = HRename(vRefNum,
+ dirID,
+ oldName,
+ newName);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *File_CatMove(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short vRefNum;
+ long dirID;
+ Str255 oldName;
+ long newDirID;
+ Str255 newName;
+ if (!PyArg_ParseTuple(_args, "hlO&lO&",
+ &vRefNum,
+ &dirID,
+ PyMac_GetStr255, oldName,
+ &newDirID,
+ PyMac_GetStr255, newName))
+ return NULL;
+ _err = CatMove(vRefNum,
+ dirID,
+ oldName,
+ newDirID,
+ newName);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *File_FSMakeFSSpec(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short vRefNum;
+ long dirID;
+ Str255 fileName;
+ FSSpec spec;
+ if (!PyArg_ParseTuple(_args, "hlO&",
+ &vRefNum,
+ &dirID,
+ PyMac_GetStr255, fileName))
+ return NULL;
+ _err = FSMakeFSSpec(vRefNum,
+ dirID,
+ fileName,
+ &spec);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ FSSpec_New, &spec);
+ return _res;
+}
+#endif /* !__LP64__ */
+
+static PyObject *File_FSGetForkPosition(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 forkRefNum;
+ SInt64 position;
+ if (!PyArg_ParseTuple(_args, "h",
+ &forkRefNum))
+ return NULL;
+ _err = FSGetForkPosition(forkRefNum,
+ &position);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("L",
+ position);
+ return _res;
+}
+
+static PyObject *File_FSSetForkPosition(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 forkRefNum;
+ UInt16 positionMode;
+ SInt64 positionOffset;
+ if (!PyArg_ParseTuple(_args, "hHL",
+ &forkRefNum,
+ &positionMode,
+ &positionOffset))
+ return NULL;
+ _err = FSSetForkPosition(forkRefNum,
+ positionMode,
+ positionOffset);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *File_FSGetForkSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 forkRefNum;
+ SInt64 forkSize;
+ if (!PyArg_ParseTuple(_args, "h",
+ &forkRefNum))
+ return NULL;
+ _err = FSGetForkSize(forkRefNum,
+ &forkSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("L",
+ forkSize);
+ return _res;
+}
+
+static PyObject *File_FSSetForkSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 forkRefNum;
+ UInt16 positionMode;
+ SInt64 positionOffset;
+ if (!PyArg_ParseTuple(_args, "hHL",
+ &forkRefNum,
+ &positionMode,
+ &positionOffset))
+ return NULL;
+ _err = FSSetForkSize(forkRefNum,
+ positionMode,
+ positionOffset);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *File_FSAllocateFork(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 forkRefNum;
+ FSAllocationFlags flags;
+ UInt16 positionMode;
+ SInt64 positionOffset;
+ UInt64 requestCount;
+ UInt64 actualCount;
+ if (!PyArg_ParseTuple(_args, "hHHLL",
+ &forkRefNum,
+ &flags,
+ &positionMode,
+ &positionOffset,
+ &requestCount))
+ return NULL;
+ _err = FSAllocateFork(forkRefNum,
+ flags,
+ positionMode,
+ positionOffset,
+ requestCount,
+ &actualCount);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("L",
+ actualCount);
+ return _res;
+}
+
+static PyObject *File_FSFlushFork(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 forkRefNum;
+ if (!PyArg_ParseTuple(_args, "h",
+ &forkRefNum))
+ return NULL;
+ _err = FSFlushFork(forkRefNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *File_FSCloseFork(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 forkRefNum;
+ if (!PyArg_ParseTuple(_args, "h",
+ &forkRefNum))
+ return NULL;
+ _err = FSCloseFork(forkRefNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *File_FSGetDataForkName(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ HFSUniStr255 dataForkName;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = FSGetDataForkName(&dataForkName);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildHFSUniStr255, &dataForkName);
+ return _res;
+}
+
+static PyObject *File_FSGetResourceForkName(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ HFSUniStr255 resourceForkName;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = FSGetResourceForkName(&resourceForkName);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildHFSUniStr255, &resourceForkName);
+ return _res;
+}
+
+static PyObject *File_FSPathMakeRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt8 * path;
+ FSRef ref;
+ Boolean isDirectory;
+ if (!PyArg_ParseTuple(_args, "s",
+ &path))
+ return NULL;
+ _err = FSPathMakeRef(path,
+ &ref,
+ &isDirectory);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&b",
+ FSRef_New, &ref,
+ isDirectory);
+ return _res;
+}
+
+static PyObject *File_FNNotifyByPath(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt8 * path;
+ FNMessage message;
+ OptionBits flags;
+ if (!PyArg_ParseTuple(_args, "sll",
+ &path,
+ &message,
+ &flags))
+ return NULL;
+ _err = FNNotifyByPath(path,
+ message,
+ flags);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *File_FNNotifyAll(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ FNMessage message;
+ OptionBits flags;
+ if (!PyArg_ParseTuple(_args, "ll",
+ &message,
+ &flags))
+ return NULL;
+ _err = FNNotifyAll(message,
+ flags);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+#ifndef __LP64__
+static PyObject *File_NewAlias(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSSpec fromFile__buf__;
+ FSSpec *fromFile = &fromFile__buf__;
+ FSSpec target;
+ AliasHandle alias;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ myPyMac_GetOptFSSpecPtr, &fromFile,
+ FSSpec_Convert, &target))
+ return NULL;
+ _err = NewAlias(fromFile,
+ &target,
+ &alias);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ Alias_New, alias);
+ return _res;
+}
+
+static PyObject *File_NewAliasMinimalFromFullPath(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ char *fullPath__in__;
+ int fullPath__len__;
+ int fullPath__in_len__;
+ Str32 zoneName;
+ Str31 serverName;
+ AliasHandle alias;
+ if (!PyArg_ParseTuple(_args, "s#O&O&",
+ &fullPath__in__, &fullPath__in_len__,
+ PyMac_GetStr255, zoneName,
+ PyMac_GetStr255, serverName))
+ return NULL;
+ fullPath__len__ = fullPath__in_len__;
+ _err = NewAliasMinimalFromFullPath(fullPath__len__, fullPath__in__,
+ zoneName,
+ serverName,
+ &alias);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ Alias_New, alias);
+ return _res;
+}
+
+static PyObject *File_ResolveAliasFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSSpec theSpec;
+ Boolean resolveAliasChains;
+ Boolean targetIsFolder;
+ Boolean wasAliased;
+ if (!PyArg_ParseTuple(_args, "O&b",
+ FSSpec_Convert, &theSpec,
+ &resolveAliasChains))
+ return NULL;
+ _err = ResolveAliasFile(&theSpec,
+ resolveAliasChains,
+ &targetIsFolder,
+ &wasAliased);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&bb",
+ FSSpec_New, &theSpec,
+ targetIsFolder,
+ wasAliased);
+ return _res;
+}
+
+static PyObject *File_ResolveAliasFileWithMountFlags(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSSpec theSpec;
+ Boolean resolveAliasChains;
+ Boolean targetIsFolder;
+ Boolean wasAliased;
+ unsigned long mountFlags;
+ if (!PyArg_ParseTuple(_args, "O&bl",
+ FSSpec_Convert, &theSpec,
+ &resolveAliasChains,
+ &mountFlags))
+ return NULL;
+ _err = ResolveAliasFileWithMountFlags(&theSpec,
+ resolveAliasChains,
+ &targetIsFolder,
+ &wasAliased,
+ mountFlags);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&bb",
+ FSSpec_New, &theSpec,
+ targetIsFolder,
+ wasAliased);
+ return _res;
+}
+
+static PyObject *File_UpdateAlias(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSSpec fromFile__buf__;
+ FSSpec *fromFile = &fromFile__buf__;
+ FSSpec target;
+ AliasHandle alias;
+ Boolean wasChanged;
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ myPyMac_GetOptFSSpecPtr, &fromFile,
+ FSSpec_Convert, &target,
+ Alias_Convert, &alias))
+ return NULL;
+ _err = UpdateAlias(fromFile,
+ &target,
+ alias,
+ &wasChanged);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("b",
+ wasChanged);
+ return _res;
+}
+
+static PyObject *File_ResolveAliasFileWithMountFlagsNoUI(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSSpec theSpec;
+ Boolean resolveAliasChains;
+ Boolean targetIsFolder;
+ Boolean wasAliased;
+ unsigned long mountFlags;
+ if (!PyArg_ParseTuple(_args, "O&bl",
+ FSSpec_Convert, &theSpec,
+ &resolveAliasChains,
+ &mountFlags))
+ return NULL;
+ _err = ResolveAliasFileWithMountFlagsNoUI(&theSpec,
+ resolveAliasChains,
+ &targetIsFolder,
+ &wasAliased,
+ mountFlags);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&bb",
+ FSSpec_New, &theSpec,
+ targetIsFolder,
+ wasAliased);
+ return _res;
+}
+#endif /* !__LP64__ */
+
+static PyObject *File_FSNewAlias(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSRef fromFile__buf__;
+ FSRef *fromFile = &fromFile__buf__;
+ FSRef target;
+ AliasHandle inAlias;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ myPyMac_GetOptFSRefPtr, &fromFile,
+ FSRef_Convert, &target))
+ return NULL;
+ _err = FSNewAlias(fromFile,
+ &target,
+ &inAlias);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ Alias_New, inAlias);
+ return _res;
+}
+
+static PyObject *File_FSResolveAliasFileWithMountFlags(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSRef theRef;
+ Boolean resolveAliasChains;
+ Boolean targetIsFolder;
+ Boolean wasAliased;
+ unsigned long mountFlags;
+ if (!PyArg_ParseTuple(_args, "O&bl",
+ FSRef_Convert, &theRef,
+ &resolveAliasChains,
+ &mountFlags))
+ return NULL;
+ _err = FSResolveAliasFileWithMountFlags(&theRef,
+ resolveAliasChains,
+ &targetIsFolder,
+ &wasAliased,
+ mountFlags);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&bb",
+ FSRef_New, &theRef,
+ targetIsFolder,
+ wasAliased);
+ return _res;
+}
+
+static PyObject *File_FSResolveAliasFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSRef theRef;
+ Boolean resolveAliasChains;
+ Boolean targetIsFolder;
+ Boolean wasAliased;
+ if (!PyArg_ParseTuple(_args, "O&b",
+ FSRef_Convert, &theRef,
+ &resolveAliasChains))
+ return NULL;
+ _err = FSResolveAliasFile(&theRef,
+ resolveAliasChains,
+ &targetIsFolder,
+ &wasAliased);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&bb",
+ FSRef_New, &theRef,
+ targetIsFolder,
+ wasAliased);
+ return _res;
+}
+
+static PyObject *File_FSUpdateAlias(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSRef fromFile__buf__;
+ FSRef *fromFile = &fromFile__buf__;
+ FSRef target;
+ AliasHandle alias;
+ Boolean wasChanged;
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ myPyMac_GetOptFSRefPtr, &fromFile,
+ FSRef_Convert, &target,
+ Alias_Convert, &alias))
+ return NULL;
+ _err = FSUpdateAlias(fromFile,
+ &target,
+ alias,
+ &wasChanged);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("b",
+ wasChanged);
+ return _res;
+}
+
+static PyObject *File_pathname(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ PyObject *obj;
+
+ if (!PyArg_ParseTuple(_args, "O", &obj))
+ return NULL;
+ if (PyString_Check(obj)) {
+ Py_INCREF(obj);
+ return obj;
+ }
+ if (PyUnicode_Check(obj))
+ return PyUnicode_AsEncodedString(obj, "utf8", "strict");
+ _res = PyObject_CallMethod(obj, "as_pathname", NULL);
+ return _res;
+
+}
+
+static PyMethodDef File_methods[] = {
+#ifndef __LP64__
+ {"UnmountVol", (PyCFunction)File_UnmountVol, 1,
+ PyDoc_STR("(Str63 volName, short vRefNum) -> None")},
+ {"FlushVol", (PyCFunction)File_FlushVol, 1,
+ PyDoc_STR("(Str63 volName, short vRefNum) -> None")},
+ {"HSetVol", (PyCFunction)File_HSetVol, 1,
+ PyDoc_STR("(Str63 volName, short vRefNum, long dirID) -> None")},
+ {"FSClose", (PyCFunction)File_FSClose, 1,
+ PyDoc_STR("(short refNum) -> None")},
+ {"Allocate", (PyCFunction)File_Allocate, 1,
+ PyDoc_STR("(short refNum) -> (long count)")},
+ {"GetEOF", (PyCFunction)File_GetEOF, 1,
+ PyDoc_STR("(short refNum) -> (long logEOF)")},
+ {"SetEOF", (PyCFunction)File_SetEOF, 1,
+ PyDoc_STR("(short refNum, long logEOF) -> None")},
+ {"GetFPos", (PyCFunction)File_GetFPos, 1,
+ PyDoc_STR("(short refNum) -> (long filePos)")},
+ {"SetFPos", (PyCFunction)File_SetFPos, 1,
+ PyDoc_STR("(short refNum, short posMode, long posOff) -> None")},
+ {"GetVRefNum", (PyCFunction)File_GetVRefNum, 1,
+ PyDoc_STR("(short fileRefNum) -> (short vRefNum)")},
+ {"HGetVol", (PyCFunction)File_HGetVol, 1,
+ PyDoc_STR("(StringPtr volName) -> (short vRefNum, long dirID)")},
+ {"HOpen", (PyCFunction)File_HOpen, 1,
+ PyDoc_STR("(short vRefNum, long dirID, Str255 fileName, SInt8 permission) -> (short refNum)")},
+ {"HOpenDF", (PyCFunction)File_HOpenDF, 1,
+ PyDoc_STR("(short vRefNum, long dirID, Str255 fileName, SInt8 permission) -> (short refNum)")},
+ {"HOpenRF", (PyCFunction)File_HOpenRF, 1,
+ PyDoc_STR("(short vRefNum, long dirID, Str255 fileName, SInt8 permission) -> (short refNum)")},
+ {"AllocContig", (PyCFunction)File_AllocContig, 1,
+ PyDoc_STR("(short refNum) -> (long count)")},
+ {"HCreate", (PyCFunction)File_HCreate, 1,
+ PyDoc_STR("(short vRefNum, long dirID, Str255 fileName, OSType creator, OSType fileType) -> None")},
+ {"DirCreate", (PyCFunction)File_DirCreate, 1,
+ PyDoc_STR("(short vRefNum, long parentDirID, Str255 directoryName) -> (long createdDirID)")},
+ {"HDelete", (PyCFunction)File_HDelete, 1,
+ PyDoc_STR("(short vRefNum, long dirID, Str255 fileName) -> None")},
+ {"HGetFInfo", (PyCFunction)File_HGetFInfo, 1,
+ PyDoc_STR("(short vRefNum, long dirID, Str255 fileName) -> (FInfo fndrInfo)")},
+ {"HSetFInfo", (PyCFunction)File_HSetFInfo, 1,
+ PyDoc_STR("(short vRefNum, long dirID, Str255 fileName, FInfo fndrInfo) -> None")},
+ {"HSetFLock", (PyCFunction)File_HSetFLock, 1,
+ PyDoc_STR("(short vRefNum, long dirID, Str255 fileName) -> None")},
+ {"HRstFLock", (PyCFunction)File_HRstFLock, 1,
+ PyDoc_STR("(short vRefNum, long dirID, Str255 fileName) -> None")},
+ {"HRename", (PyCFunction)File_HRename, 1,
+ PyDoc_STR("(short vRefNum, long dirID, Str255 oldName, Str255 newName) -> None")},
+ {"CatMove", (PyCFunction)File_CatMove, 1,
+ 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,
+ PyDoc_STR("(SInt16 forkRefNum, UInt16 positionMode, SInt64 positionOffset) -> None")},
+ {"FSGetForkSize", (PyCFunction)File_FSGetForkSize, 1,
+ PyDoc_STR("(SInt16 forkRefNum) -> (SInt64 forkSize)")},
+ {"FSSetForkSize", (PyCFunction)File_FSSetForkSize, 1,
+ PyDoc_STR("(SInt16 forkRefNum, UInt16 positionMode, SInt64 positionOffset) -> None")},
+ {"FSAllocateFork", (PyCFunction)File_FSAllocateFork, 1,
+ PyDoc_STR("(SInt16 forkRefNum, FSAllocationFlags flags, UInt16 positionMode, SInt64 positionOffset, UInt64 requestCount) -> (UInt64 actualCount)")},
+ {"FSFlushFork", (PyCFunction)File_FSFlushFork, 1,
+ PyDoc_STR("(SInt16 forkRefNum) -> None")},
+ {"FSCloseFork", (PyCFunction)File_FSCloseFork, 1,
+ PyDoc_STR("(SInt16 forkRefNum) -> None")},
+ {"FSGetDataForkName", (PyCFunction)File_FSGetDataForkName, 1,
+ PyDoc_STR("() -> (HFSUniStr255 dataForkName)")},
+ {"FSGetResourceForkName", (PyCFunction)File_FSGetResourceForkName, 1,
+ PyDoc_STR("() -> (HFSUniStr255 resourceForkName)")},
+ {"FSPathMakeRef", (PyCFunction)File_FSPathMakeRef, 1,
+ PyDoc_STR("(UInt8 * path) -> (FSRef ref, Boolean isDirectory)")},
+ {"FNNotifyByPath", (PyCFunction)File_FNNotifyByPath, 1,
+ 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,
+ PyDoc_STR("(Buffer fullPath, Str32 zoneName, Str31 serverName) -> (AliasHandle alias)")},
+ {"ResolveAliasFile", (PyCFunction)File_ResolveAliasFile, 1,
+ PyDoc_STR("(FSSpec theSpec, Boolean resolveAliasChains) -> (FSSpec theSpec, Boolean targetIsFolder, Boolean wasAliased)")},
+ {"ResolveAliasFileWithMountFlags", (PyCFunction)File_ResolveAliasFileWithMountFlags, 1,
+ PyDoc_STR("(FSSpec theSpec, Boolean resolveAliasChains, unsigned long mountFlags) -> (FSSpec theSpec, Boolean targetIsFolder, Boolean wasAliased)")},
+ {"UpdateAlias", (PyCFunction)File_UpdateAlias, 1,
+ 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,
+ PyDoc_STR("(FSRef theRef, Boolean resolveAliasChains, unsigned long mountFlags) -> (FSRef theRef, Boolean targetIsFolder, Boolean wasAliased)")},
+ {"FSResolveAliasFile", (PyCFunction)File_FSResolveAliasFile, 1,
+ PyDoc_STR("(FSRef theRef, Boolean resolveAliasChains) -> (FSRef theRef, Boolean targetIsFolder, Boolean wasAliased)")},
+ {"FSUpdateAlias", (PyCFunction)File_FSUpdateAlias, 1,
+ PyDoc_STR("(FSRef fromFile, FSRef target, AliasHandle alias) -> (Boolean wasChanged)")},
+ {"pathname", (PyCFunction)File_pathname, 1,
+ PyDoc_STR("(str|unicode|FSSpec|FSref) -> pathname")},
+ {NULL, NULL, 0}
+};
+
+
+#ifndef __LP64__
+int
+PyMac_GetFSSpec(PyObject *v, FSSpec *spec)
+{
+ Str255 path;
+ short refnum;
+ long parid;
+ OSErr err;
+ FSRef fsr;
+
+ if (FSSpec_Check(v)) {
+ *spec = ((FSSpecObject *)v)->ob_itself;
+ return 1;
+ }
+
+ if (PyArg_Parse(v, "(hlO&)",
+ &refnum, &parid, PyMac_GetStr255, &path)) {
+ err = FSMakeFSSpec(refnum, parid, path, spec);
+ if ( err && err != fnfErr ) {
+ PyMac_Error(err);
+ return 0;
+ }
+ return 1;
+ }
+ PyErr_Clear();
+ /* Otherwise we try to go via an FSRef. On OSX we go all the way,
+ ** on OS9 we accept only a real FSRef object
+ */
+ if ( PyMac_GetFSRef(v, &fsr) ) {
+ err = FSGetCatalogInfo(&fsr, kFSCatInfoNone, NULL, NULL, spec, NULL);
+ if (err != noErr) {
+ PyMac_Error(err);
+ return 0;
+ }
+ return 1;
+ }
+ 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;
+ return 1;
+ }
+
+ /* On OSX we now try a pathname */
+ if ( PyString_Check(v) || PyUnicode_Check(v)) {
+ char *path = NULL;
+ if (!PyArg_Parse(v, "et", Py_FileSystemDefaultEncoding, &path))
+ return 0;
+ 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;
+ if ((err=FSpMakeFSRef(&fss, fsr)) == 0)
+ return 1;
+ 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)
+{
+ return FSRef_New(spec);
+}
+
+
+void init_File(void)
+{
+ PyObject *m;
+ PyObject *d;
+
+
+#ifndef __LP64__
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(FSSpec *, PyMac_BuildFSSpec);
+ 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);
+
+
+ m = Py_InitModule("_File", File_methods);
+ d = PyModule_GetDict(m);
+ File_Error = PyMac_GetOSErrException();
+ if (File_Error == NULL ||
+ PyDict_SetItemString(d, "Error", File_Error) != 0)
+ return;
+ FSCatalogInfo_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&FSCatalogInfo_Type) < 0) return;
+ Py_INCREF(&FSCatalogInfo_Type);
+ PyModule_AddObject(m, "FSCatalogInfo", (PyObject *)&FSCatalogInfo_Type);
+ /* 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);
+ PyModule_AddObject(m, "FInfo", (PyObject *)&FInfo_Type);
+ /* 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);
+ PyModule_AddObject(m, "Alias", (PyObject *)&Alias_Type);
+ /* 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);
+ PyModule_AddObject(m, "FSSpec", (PyObject *)&FSSpec_Type);
+ /* 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);
+ PyModule_AddObject(m, "FSRef", (PyObject *)&FSRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&FSRef_Type);
+ PyModule_AddObject(m, "FSRefType", (PyObject *)&FSRef_Type);
+}
+
+/* ======================== End module _File ======================== */
+
diff --git a/Mac/Modules/file/filescan.py b/Mac/Modules/file/filescan.py
new file mode 100644
index 0000000000..4b70823745
--- /dev/null
+++ b/Mac/Modules/file/filescan.py
@@ -0,0 +1,198 @@
+# Scan an Apple header file, generating a Python file of generator calls.
+
+import sys
+from bgenlocations import TOOLBOXDIR, BGENDIR
+sys.path.append(BGENDIR)
+from scantools import Scanner_OSX
+
+LONG = "Files"
+SHORT = "file"
+
+def main():
+ input = ["Files.h", "Aliases.h", "Finder.h"]
+ output = SHORT + "gen.py"
+ defsoutput = TOOLBOXDIR + LONG + ".py"
+ scanner = MyScanner(input, output, defsoutput)
+ scanner.scan()
+ scanner.close()
+ scanner.gentypetest(SHORT+"typetest.py")
+ print "=== Testing definitions output code ==="
+ execfile(defsoutput, {}, {})
+ print "=== Done scanning and generating, now importing the generated code... ==="
+ exec "import " + SHORT + "support"
+ print "=== Done. It's up to you to compile it now! ==="
+
+class MyScanner(Scanner_OSX):
+
+ def destination(self, type, name, arglist):
+ classname = "Function"
+ listname = "functions"
+ if arglist:
+ # Funny special case
+ if len(arglist) > 2:
+ t, n, m = arglist[1]
+ if t == "AliasHandle" and m == "InMode":
+ classname = "Arg2MethodGenerator"
+ listname = "alias_methods"
+ return classname, listname
+ # Normal cases
+ t, n, m = arglist[0]
+ if t == "AliasHandle" and m == "InMode":
+ classname = "Method"
+ listname = "alias_methods"
+ if t == "FSSpec_ptr" and m == "InMode":
+ classname = "Method"
+ listname = "fsspec_methods"
+ if t == "FSRef_ptr" and m == "InMode":
+ classname = "Method"
+ listname = "fsref_methods"
+ return classname, listname
+
+ def makeblacklistnames(self):
+ return [
+ # Constants with incompatible definitions
+ "kioACAccessOwnerMask",
+ "kFSCatInfoReserved",
+ "kFSIterateReserved",
+ "kSystemFolderType",
+
+ "FSRefMakePath", # Do this manually
+# "ResolveAlias", # Do this manually
+# "ResolveAliasWithMountFlags", # Do this manually
+# "FollowFinderAlias", # Do this manually
+
+ "FSRead", # Couldn't be bothered
+ "FSWrite", # ditto
+ "FSReadFork", # ditto
+ "FSWriteFork", # ditto
+
+ # Old routines:
+ "GetWDInfo",
+ "OpenWD",
+ "CloseWD",
+ "FInitQueue",
+ "rstflock",
+ "setflock",
+ "setfinfo",
+ "fsrename",
+ "fsdelete",
+ "create",
+ "flushvol",
+ "eject",
+ "umountvol",
+ "setvol",
+ "getvol",
+ "getfinfo",
+ "getvinfo",
+ "fsopen",
+ "RstFLock",
+ "SetFLock",
+ "SetFInfo",
+ "Rename",
+ "OpenRF",
+ "FSDelete",
+ "Create",
+ "GetVol",
+ "GetFInfo",
+ "GetVInfo",
+ "FSOpen",
+ "Eject",
+ "SetVol",
+ "openrf",
+ "unmountvol",
+ "OpenDF",
+
+ ]
+
+ def makeblacklisttypes(self):
+ return [
+ "CInfoPBPtr", # Old stuff
+ "CMovePBPtr", # Old stuff
+ "ParmBlkPtr", # Old stuff
+ "HParmBlkPtr", # Old stuff
+ "DTPBPtr", # Old stuff
+ "FCBPBPtr", # Old stuff
+ "QHdrPtr", # Old stuff
+ "CSParamPtr", # Old stuff
+ "FSCatalogBulkParam", # old stuff
+ "FSForkCBInfoParam", # old stuff
+ "FSForkIOParam", # old stuff
+ "FSRefParam", # old stuff
+ "FSVolumeInfoParam", # old stuff
+ "WDPBPtr", # old stuff
+ "XCInfoPBPtr", # old stuff
+ "XVolumeParamPtr", # old stuff
+
+
+ "CatPositionRec", # State variable, not too difficult
+ "FSIterator", # Should become an object
+ "FSForkInfo", # Lots of fields, difficult struct
+ "FSSearchParams", # Also catsearch stuff
+ "FSVolumeInfo", # big struct
+ "FSVolumeInfo_ptr", # big struct
+
+ "IOCompletionProcPtr", # proc pointer
+ "IOCompletionUPP", # Proc pointer
+ "AliasFilterProcPtr",
+ "AliasFilterUPP",
+ "FNSubscriptionUPP",
+
+ "FNSubscriptionRef", # Lazy, for now.
+ ]
+
+ def makerepairinstructions(self):
+ return [
+ # Various ways to give pathnames
+ ([('char_ptr', '*', 'InMode')],
+ [('stringptr', '*', 'InMode')]
+ ),
+
+ # Unicode filenames passed as length, buffer
+ ([('UniCharCount', '*', 'InMode'),
+ ('UniChar_ptr', '*', 'InMode')],
+ [('UnicodeReverseInBuffer', '*', 'InMode')]
+ ),
+ # Wrong guess
+ ([('Str63', 'theString', 'InMode')],
+ [('Str63', 'theString', 'OutMode')]),
+
+ # Yet another way to give a pathname:-)
+ ([('short', 'fullPathLength', 'InMode'),
+ ('void_ptr', 'fullPath', 'InMode')],
+ [('FullPathName', 'fullPath', 'InMode')]),
+
+ # Various ResolveAliasFileXXXX functions
+ ([('FSSpec', 'theSpec', 'OutMode')],
+ [('FSSpec_ptr', 'theSpec', 'InOutMode')]),
+
+ ([('FSRef', 'theRef', 'OutMode')],
+ [('FSRef_ptr', 'theRef', 'InOutMode')]),
+
+ # The optional FSSpec to all ResolveAlias and NewAlias methods
+ ([('FSSpec_ptr', 'fromFile', 'InMode')],
+ [('OptFSSpecPtr', 'fromFile', 'InMode')]),
+
+ ([('FSRef_ptr', 'fromFile', 'InMode')],
+ [('OptFSRefPtr', 'fromFile', 'InMode')]),
+
+## # FSCatalogInfo input handling
+## ([('FSCatalogInfoBitmap', 'whichInfo', 'InMode'),
+## ('FSCatalogInfo_ptr', 'catalogInfo', 'InMode')],
+## [('FSCatalogInfoAndBitmap_in', 'catalogInfo', 'InMode')]),
+##
+## # FSCatalogInfo output handling
+## ([('FSCatalogInfoBitmap', 'whichInfo', 'InMode'),
+## ('FSCatalogInfo', 'catalogInfo', 'OutMode')],
+## [('FSCatalogInfoAndBitmap_out', 'catalogInfo', 'InOutMode')]),
+##
+
+ ]
+
+
+ def writeinitialdefs(self):
+ self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
+ self.defsfile.write("true = True\n")
+ self.defsfile.write("false = False\n")
+
+if __name__ == "__main__":
+ main()
diff --git a/Mac/Modules/file/filesupport.py b/Mac/Modules/file/filesupport.py
new file mode 100644
index 0000000000..88f88cd9dc
--- /dev/null
+++ b/Mac/Modules/file/filesupport.py
@@ -0,0 +1,918 @@
+# This script generates a Python interface for an Apple Macintosh Manager.
+# It uses the "bgen" package to generate C code.
+# The function specifications are generated by scanning the mamager's header file,
+# using the "scantools" package (customized for this particular manager).
+#
+# 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
+
+# Declarations that change for each manager
+#MACHEADERFILE = 'Files.h' # The Apple header file
+MODNAME = '_File' # The name of the module
+LONGMODNAME = 'Carbon.File' # The "normal" external name of the module
+
+# The following is *usually* unchanged but may still require tuning
+MODPREFIX = 'File' # The prefix for module-wide routines
+INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner
+OUTPUTFILE = MODNAME + "module.c" # The file generated by this program
+
+from macsupport import *
+
+# Various integers:
+SInt64 = Type("SInt64", "L")
+UInt64 = Type("UInt64", "L")
+FNMessage = Type("FNMessage", "l")
+FSAllocationFlags = Type("FSAllocationFlags", "H")
+FSCatalogInfoBitmap = Type("FSCatalogInfoBitmap", "l")
+FSIteratorFlags = Type("FSIteratorFlags", "l")
+FSVolumeRefNum = Type("FSVolumeRefNum", "h")
+AliasInfoType = Type("AliasInfoType", "h")
+
+# Various types of strings:
+#class UniCharCountBuffer(InputOnlyType):
+# pass
+class VarReverseInputBufferType(ReverseInputBufferMixin, VarInputBufferType):
+ pass
+FullPathName = VarReverseInputBufferType()
+ConstStr31Param = OpaqueArrayType("Str31", "PyMac_BuildStr255", "PyMac_GetStr255")
+ConstStr32Param = OpaqueArrayType("Str32", "PyMac_BuildStr255", "PyMac_GetStr255")
+ConstStr63Param = OpaqueArrayType("Str63", "PyMac_BuildStr255", "PyMac_GetStr255")
+Str63 = OpaqueArrayType("Str63", "PyMac_BuildStr255", "PyMac_GetStr255")
+
+HFSUniStr255 = OpaqueType("HFSUniStr255", "PyMac_BuildHFSUniStr255", "PyMac_GetHFSUniStr255")
+UInt8_ptr = InputOnlyType("UInt8 *", "s")
+
+# Other types:
+class OptionalFSxxxType(OpaqueByValueType):
+ def declare(self, name):
+ Output("%s %s__buf__;", self.typeName, name)
+ Output("%s *%s = &%s__buf__;", self.typeName, name, name)
+
+class FSCatalogInfoAndBitmapType(InputOnlyType):
+
+ def __init__(self):
+ InputOnlyType.__init__(self, "BUG", "BUG")
+
+ def declare(self, name):
+ Output("PyObject *%s__object = NULL;", name)
+ Output("FSCatalogInfoBitmap %s__bitmap = 0;", name)
+ Output("FSCatalogInfo %s;", name)
+
+ def getargsFormat(self):
+ return "lO"
+
+ def getargsArgs(self, name):
+ return "%s__bitmap, %s__object"%(name, name)
+
+ def getargsCheck(self, name):
+ Output("if (!convert_FSCatalogInfo(%s__object, %s__bitmap, &%s)) return NULL;", name, name, name)
+
+ def passInput(self, name):
+ return "%s__bitmap, &%s"% (name, name)
+
+ def passOutput(self, name):
+ return "%s__bitmap, &%s"% (name, name)
+
+ def mkvalueFormat(self):
+ return "O"
+
+ def mkvalueArgs(self, name):
+ return "%s__object" % (name)
+
+ def xxxxmkvalueCheck(self, name):
+ Output("if ((%s__object = new_FSCatalogInfo(%s__bitmap, &%s)) == NULL) return NULL;", name, name)
+
+class FSCatalogInfoAndBitmap_inType(FSCatalogInfoAndBitmapType, InputOnlyMixIn):
+
+ def xxxxmkvalueCheck(self, name):
+ pass
+
+class FSCatalogInfoAndBitmap_outType(FSCatalogInfoAndBitmapType):
+
+ def getargsFormat(self):
+ return "l"
+
+ def getargsArgs(self, name):
+ return "%s__bitmap" % name
+
+ def getargsCheck(self, name):
+ pass
+
+FInfo = OpaqueType("FInfo", "FInfo")
+FInfo_ptr = OpaqueType("FInfo", "FInfo")
+AliasHandle = OpaqueByValueType("AliasHandle", "Alias")
+FSSpec = OpaqueType("FSSpec", "FSSpec")
+FSSpec_ptr = OpaqueType("FSSpec", "FSSpec")
+OptFSSpecPtr = OptionalFSxxxType("FSSpec", "BUG", "myPyMac_GetOptFSSpecPtr")
+FSRef = OpaqueType("FSRef", "FSRef")
+FSRef_ptr = OpaqueType("FSRef", "FSRef")
+OptFSRefPtr = OptionalFSxxxType("FSRef", "BUG", "myPyMac_GetOptFSRefPtr")
+FSCatalogInfo = OpaqueType("FSCatalogInfo", "FSCatalogInfo")
+FSCatalogInfo_ptr = OpaqueType("FSCatalogInfo", "FSCatalogInfo")
+
+# To be done:
+#CatPositionRec
+#FSCatalogInfo
+#FSForkInfo
+#FSIterator
+#FSVolumeInfo
+#FSSpecArrayPtr
+
+includestuff = includestuff + """
+#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);
+
+#define PyMac_GetFSSpec _PyMac_GetFSSpec
+#define PyMac_GetFSRef _PyMac_GetFSRef
+#define PyMac_BuildFSSpec _PyMac_BuildFSSpec
+#define PyMac_BuildFSRef _PyMac_BuildFSRef
+#else
+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);
+#endif
+
+/* Forward declarations */
+static PyObject *FInfo_New(FInfo *itself);
+static PyObject *FSRef_New(FSRef *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
+static int Alias_Convert(PyObject *v, AliasHandle *p_itself);
+
+/*
+** UTCDateTime records
+*/
+static int
+UTCDateTime_Convert(PyObject *v, UTCDateTime *ptr)
+{
+ return PyArg_Parse(v, "(HlH)", &ptr->highSeconds, &ptr->lowSeconds, &ptr->fraction);
+}
+
+static PyObject *
+UTCDateTime_New(UTCDateTime *ptr)
+{
+ return Py_BuildValue("(HlH)", ptr->highSeconds, ptr->lowSeconds, ptr->fraction);
+}
+
+/*
+** Optional fsspec and fsref pointers. None will pass NULL
+*/
+static int
+myPyMac_GetOptFSSpecPtr(PyObject *v, FSSpec **spec)
+{
+ if (v == Py_None) {
+ *spec = NULL;
+ return 1;
+ }
+ return PyMac_GetFSSpec(v, *spec);
+}
+
+static int
+myPyMac_GetOptFSRefPtr(PyObject *v, FSRef **ref)
+{
+ if (v == Py_None) {
+ *ref = NULL;
+ return 1;
+ }
+ return PyMac_GetFSRef(v, *ref);
+}
+
+/*
+** Parse/generate objsect
+*/
+static PyObject *
+PyMac_BuildHFSUniStr255(HFSUniStr255 *itself)
+{
+
+ return Py_BuildValue("u#", itself->unicode, itself->length);
+}
+
+#ifndef __LP64__
+/*
+** Get pathname for a given FSSpec
+*/
+static OSErr
+_PyMac_GetFullPathname(FSSpec *fss, char *path, int len)
+{
+ FSRef fsr;
+ OSErr err;
+
+ *path = '\0';
+ err = FSpMakeFSRef(fss, &fsr);
+ if (err == fnfErr) {
+ /* FSSpecs can point to non-existing files, fsrefs can't. */
+ FSSpec fss2;
+ int tocopy;
+
+ err = FSMakeFSSpec(fss->vRefNum, fss->parID, "", &fss2);
+ if (err)
+ return err;
+ err = FSpMakeFSRef(&fss2, &fsr);
+ if (err)
+ return err;
+ err = (OSErr)FSRefMakePath(&fsr, path, len-1);
+ if (err)
+ return err;
+ /* This part is not 100% safe: we append the filename part, but
+ ** I'm not sure that we don't run afoul of the various 8bit
+ ** encodings here. Will have to look this up at some point...
+ */
+ strcat(path, "/");
+ tocopy = fss->name[0];
+ if ((strlen(path) + tocopy) >= len)
+ tocopy = len - strlen(path) - 1;
+ if (tocopy > 0)
+ strncat(path, fss->name+1, tocopy);
+ }
+ else {
+ if (err)
+ return err;
+ err = (OSErr)FSRefMakePath(&fsr, path, len);
+ if (err)
+ return err;
+ }
+ return 0;
+}
+#endif /* !__LP64__ */
+
+"""
+
+finalstuff = finalstuff + """
+
+#ifndef __LP64__
+int
+PyMac_GetFSSpec(PyObject *v, FSSpec *spec)
+{
+ Str255 path;
+ short refnum;
+ long parid;
+ OSErr err;
+ FSRef fsr;
+
+ if (FSSpec_Check(v)) {
+ *spec = ((FSSpecObject *)v)->ob_itself;
+ return 1;
+ }
+
+ if (PyArg_Parse(v, "(hlO&)",
+ &refnum, &parid, PyMac_GetStr255, &path)) {
+ err = FSMakeFSSpec(refnum, parid, path, spec);
+ if ( err && err != fnfErr ) {
+ PyMac_Error(err);
+ return 0;
+ }
+ return 1;
+ }
+ PyErr_Clear();
+ /* Otherwise we try to go via an FSRef. On OSX we go all the way,
+ ** on OS9 we accept only a real FSRef object
+ */
+ if ( PyMac_GetFSRef(v, &fsr) ) {
+ err = FSGetCatalogInfo(&fsr, kFSCatInfoNone, NULL, NULL, spec, NULL);
+ if (err != noErr) {
+ PyMac_Error(err);
+ return 0;
+ }
+ return 1;
+ }
+ return 0;
+}
+
+#endif /* !__LP64__ */
+
+int
+PyMac_GetFSRef(PyObject *v, FSRef *fsr)
+{
+ OSStatus err;
+ FSSpec fss;
+
+ if (FSRef_Check(v)) {
+ *fsr = ((FSRefObject *)v)->ob_itself;
+ return 1;
+ }
+
+ /* On OSX we now try a pathname */
+ if ( PyString_Check(v) || PyUnicode_Check(v)) {
+ char *path = NULL;
+ if (!PyArg_Parse(v, "et", Py_FileSystemDefaultEncoding, &path))
+ return 0;
+ if ( (err=FSPathMakeRef(path, fsr, NULL)) )
+ PyMac_Error(err);
+ PyMem_Free(path);
+ return !err;
+ }
+ /* 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)
+ return 1;
+ PyMac_Error(err);
+ 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)
+{
+ return FSRef_New(spec);
+}
+"""
+
+initstuff = initstuff + """
+#ifndef __LP64__
+PyMac_INIT_TOOLBOX_OBJECT_NEW(FSSpec *, PyMac_BuildFSSpec);
+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);
+"""
+
+execfile(string.lower(MODPREFIX) + 'typetest.py')
+
+# Our object types:
+class FSCatalogInfoDefinition(PEP253Mixin, ObjectDefinition):
+ getsetlist = [
+ ("nodeFlags",
+ "return Py_BuildValue(\"H\", self->ob_itself.nodeFlags);",
+ "return PyArg_Parse(v, \"H\", &self->ob_itself.nodeFlags)-1;",
+ None
+ ),
+ ("volume",
+ "return Py_BuildValue(\"h\", self->ob_itself.volume);",
+ "return PyArg_Parse(v, \"h\", &self->ob_itself.volume)-1;",
+ None
+ ),
+ ("parentDirID",
+ "return Py_BuildValue(\"l\", self->ob_itself.parentDirID);",
+ "return PyArg_Parse(v, \"l\", &self->ob_itself.parentDirID)-1;",
+ None
+ ),
+ ("nodeID",
+ "return Py_BuildValue(\"l\", self->ob_itself.nodeID);",
+ "return PyArg_Parse(v, \"l\", &self->ob_itself.nodeID)-1;",
+ None
+ ),
+ ("createDate",
+ "return Py_BuildValue(\"O&\", UTCDateTime_New, &self->ob_itself.createDate);",
+ "return PyArg_Parse(v, \"O&\", UTCDateTime_Convert, &self->ob_itself.createDate)-1;",
+ None
+ ),
+ ("contentModDate",
+ "return Py_BuildValue(\"O&\", UTCDateTime_New, &self->ob_itself.contentModDate);",
+ "return PyArg_Parse(v, \"O&\", UTCDateTime_Convert, &self->ob_itself.contentModDate)-1;",
+ None
+ ),
+ ("attributeModDate",
+ "return Py_BuildValue(\"O&\", UTCDateTime_New, &self->ob_itself.attributeModDate);",
+ "return PyArg_Parse(v, \"O&\", UTCDateTime_Convert, &self->ob_itself.attributeModDate)-1;",
+ None
+ ),
+ ("accessDate",
+ "return Py_BuildValue(\"O&\", UTCDateTime_New, &self->ob_itself.accessDate);",
+ "return PyArg_Parse(v, \"O&\", UTCDateTime_Convert, &self->ob_itself.accessDate)-1;",
+ None
+ ),
+ ("backupDate",
+ "return Py_BuildValue(\"O&\", UTCDateTime_New, &self->ob_itself.backupDate);",
+ "return PyArg_Parse(v, \"O&\", UTCDateTime_Convert, &self->ob_itself.backupDate)-1;",
+ None
+ ),
+ ("permissions",
+ "return Py_BuildValue(\"(llll)\", self->ob_itself.permissions[0], self->ob_itself.permissions[1], self->ob_itself.permissions[2], self->ob_itself.permissions[3]);",
+ "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;",
+ None
+ ),
+ # XXXX FinderInfo TBD
+ # XXXX FinderXInfo TBD
+ ("valence",
+ "return Py_BuildValue(\"l\", self->ob_itself.valence);",
+ "return PyArg_Parse(v, \"l\", &self->ob_itself.valence)-1;",
+ None
+ ),
+ ("dataLogicalSize",
+ "return Py_BuildValue(\"l\", self->ob_itself.dataLogicalSize);",
+ "return PyArg_Parse(v, \"l\", &self->ob_itself.dataLogicalSize)-1;",
+ None
+ ),
+ ("dataPhysicalSize",
+ "return Py_BuildValue(\"l\", self->ob_itself.dataPhysicalSize);",
+ "return PyArg_Parse(v, \"l\", &self->ob_itself.dataPhysicalSize)-1;",
+ None
+ ),
+ ("rsrcLogicalSize",
+ "return Py_BuildValue(\"l\", self->ob_itself.rsrcLogicalSize);",
+ "return PyArg_Parse(v, \"l\", &self->ob_itself.rsrcLogicalSize)-1;",
+ None
+ ),
+ ("rsrcPhysicalSize",
+ "return Py_BuildValue(\"l\", self->ob_itself.rsrcPhysicalSize);",
+ "return PyArg_Parse(v, \"l\", &self->ob_itself.rsrcPhysicalSize)-1;",
+ None
+ ),
+ ("sharingFlags",
+ "return Py_BuildValue(\"l\", self->ob_itself.sharingFlags);",
+ "return PyArg_Parse(v, \"l\", &self->ob_itself.sharingFlags)-1;",
+ None
+ ),
+ ("userPrivileges",
+ "return Py_BuildValue(\"b\", self->ob_itself.userPrivileges);",
+ "return PyArg_Parse(v, \"b\", &self->ob_itself.userPrivileges)-1;",
+ None
+ ),
+ ]
+ # The same info, but in a different form
+ INITFORMAT = "HhllO&O&O&O&O&llllllb"
+ INITARGS = """&((FSCatalogInfoObject *)_self)->ob_itself.nodeFlags,
+ &((FSCatalogInfoObject *)_self)->ob_itself.volume,
+ &((FSCatalogInfoObject *)_self)->ob_itself.parentDirID,
+ &((FSCatalogInfoObject *)_self)->ob_itself.nodeID,
+ UTCDateTime_Convert, &((FSCatalogInfoObject *)_self)->ob_itself.createDate,
+ UTCDateTime_Convert, &((FSCatalogInfoObject *)_self)->ob_itself.contentModDate,
+ UTCDateTime_Convert, &((FSCatalogInfoObject *)_self)->ob_itself.attributeModDate,
+ UTCDateTime_Convert, &((FSCatalogInfoObject *)_self)->ob_itself.accessDate,
+ UTCDateTime_Convert, &((FSCatalogInfoObject *)_self)->ob_itself.backupDate,
+ &((FSCatalogInfoObject *)_self)->ob_itself.valence,
+ &((FSCatalogInfoObject *)_self)->ob_itself.dataLogicalSize,
+ &((FSCatalogInfoObject *)_self)->ob_itself.dataPhysicalSize,
+ &((FSCatalogInfoObject *)_self)->ob_itself.rsrcLogicalSize,
+ &((FSCatalogInfoObject *)_self)->ob_itself.rsrcPhysicalSize,
+ &((FSCatalogInfoObject *)_self)->ob_itself.sharingFlags,
+ &((FSCatalogInfoObject *)_self)->ob_itself.userPrivileges"""
+ INITNAMES = """
+ "nodeFlags",
+ "volume",
+ "parentDirID",
+ "nodeID",
+ "createDate",
+ "contentModDate",
+ "atributeModDate",
+ "accessDate",
+ "backupDate",
+ "valence",
+ "dataLogicalSize",
+ "dataPhysicalSize",
+ "rsrcLogicalSize",
+ "rsrcPhysicalSize",
+ "sharingFlags",
+ "userPrivileges"
+ """
+
+ def __init__(self, name, prefix, itselftype):
+ ObjectDefinition.__init__(self, name, prefix, itselftype)
+ self.argref = "*" # Store FSSpecs, but pass them by address
+
+ def outputCheckNewArg(self):
+ Output("if (itself == NULL) { Py_INCREF(Py_None); return Py_None; }")
+
+ def output_tp_newBody(self):
+ Output("PyObject *self;");
+ Output()
+ Output("if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;")
+ Output("memset(&((%s *)self)->ob_itself, 0, sizeof(%s));",
+ self.objecttype, self.itselftype)
+ Output("return self;")
+
+ def output_tp_initBody(self):
+ Output("static char *kw[] = {%s, 0};", self.INITNAMES)
+ Output()
+ Output("if (!PyArg_ParseTupleAndKeywords(_args, _kwds, \"|%s\", kw, %s))",
+ self.INITFORMAT, self.INITARGS)
+ OutLbrace()
+ Output("return -1;")
+ OutRbrace()
+ Output("return 0;")
+
+class FInfoDefinition(PEP253Mixin, ObjectDefinition):
+ getsetlist = [
+ ("Type",
+ "return Py_BuildValue(\"O&\", PyMac_BuildOSType, self->ob_itself.fdType);",
+ "return PyArg_Parse(v, \"O&\", PyMac_GetOSType, &self->ob_itself.fdType)-1;",
+ "4-char file type"
+ ),
+ ("Creator",
+ "return Py_BuildValue(\"O&\", PyMac_BuildOSType, self->ob_itself.fdCreator);",
+ "return PyArg_Parse(v, \"O&\", PyMac_GetOSType, &self->ob_itself.fdCreator)-1;",
+ "4-char file creator"
+ ),
+ ("Flags",
+ "return Py_BuildValue(\"H\", self->ob_itself.fdFlags);",
+ "return PyArg_Parse(v, \"H\", &self->ob_itself.fdFlags)-1;",
+ "Finder flag bits"
+ ),
+ ("Location",
+ "return Py_BuildValue(\"O&\", PyMac_BuildPoint, self->ob_itself.fdLocation);",
+ "return PyArg_Parse(v, \"O&\", PyMac_GetPoint, &self->ob_itself.fdLocation)-1;",
+ "(x, y) location of the file's icon in its parent finder window"
+ ),
+ ("Fldr",
+ "return Py_BuildValue(\"h\", self->ob_itself.fdFldr);",
+ "return PyArg_Parse(v, \"h\", &self->ob_itself.fdFldr)-1;",
+ "Original folder, for 'put away'"
+ ),
+
+ ]
+
+ def __init__(self, name, prefix, itselftype):
+ ObjectDefinition.__init__(self, name, prefix, itselftype)
+ self.argref = "*" # Store FSSpecs, but pass them by address
+
+ def outputCheckNewArg(self):
+ Output("if (itself == NULL) return PyMac_Error(resNotFound);")
+
+ def output_tp_newBody(self):
+ Output("PyObject *self;");
+ Output()
+ Output("if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;")
+ Output("memset(&((%s *)self)->ob_itself, 0, sizeof(%s));",
+ self.objecttype, self.itselftype)
+ Output("return self;")
+
+ def output_tp_initBody(self):
+ Output("%s *itself = NULL;", self.itselftype)
+ Output("static char *kw[] = {\"itself\", 0};")
+ Output()
+ Output("if (PyArg_ParseTupleAndKeywords(_args, _kwds, \"|O&\", kw, FInfo_Convert, &itself))")
+ OutLbrace()
+ Output("if (itself) memcpy(&((%s *)_self)->ob_itself, itself, sizeof(%s));",
+ self.objecttype, self.itselftype)
+ Output("return 0;")
+ OutRbrace()
+ Output("return -1;")
+
+class FSSpecDefinition(PEP253Mixin, ObjectDefinition):
+ getsetlist = [
+ ("data",
+ "return PyString_FromStringAndSize((char *)&self->ob_itself, sizeof(self->ob_itself));",
+ None,
+ "Raw data of the FSSpec object"
+ )
+ ]
+
+ def __init__(self, name, prefix, itselftype):
+ ObjectDefinition.__init__(self, name, prefix, itselftype)
+ self.argref = "*" # Store FSSpecs, but pass them by address
+
+ def outputCheckNewArg(self):
+ Output("if (itself == NULL) return PyMac_Error(resNotFound);")
+
+ # We do Convert ourselves (with PyMac_GetFSxxx)
+ def outputConvert(self):
+ pass
+
+ def output_tp_newBody(self):
+ Output("PyObject *self;");
+ Output()
+ Output("if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;")
+ Output("memset(&((%s *)self)->ob_itself, 0, sizeof(%s));",
+ self.objecttype, self.itselftype)
+ Output("return self;")
+
+ def output_tp_initBody(self):
+ Output("PyObject *v = NULL;")
+ Output("char *rawdata = NULL;")
+ Output("int rawdatalen = 0;")
+ Output("static char *kw[] = {\"itself\", \"rawdata\", 0};")
+ Output()
+ Output("if (!PyArg_ParseTupleAndKeywords(_args, _kwds, \"|Os#\", kw, &v, &rawdata, &rawdatalen))")
+ Output("return -1;")
+ Output("if (v && rawdata)")
+ OutLbrace()
+ Output("PyErr_SetString(PyExc_TypeError, \"Only one of itself or rawdata may be specified\");")
+ Output("return -1;")
+ OutRbrace()
+ Output("if (!v && !rawdata)")
+ OutLbrace()
+ Output("PyErr_SetString(PyExc_TypeError, \"One of itself or rawdata must be specified\");")
+ Output("return -1;")
+ OutRbrace()
+ Output("if (rawdata)")
+ OutLbrace()
+ Output("if (rawdatalen != sizeof(%s))", self.itselftype)
+ OutLbrace()
+ Output("PyErr_SetString(PyExc_TypeError, \"%s rawdata incorrect size\");",
+ self.itselftype)
+ Output("return -1;")
+ OutRbrace()
+ Output("memcpy(&((%s *)_self)->ob_itself, rawdata, rawdatalen);", self.objecttype)
+ Output("return 0;")
+ OutRbrace()
+ Output("if (PyMac_GetFSSpec(v, &((%s *)_self)->ob_itself)) return 0;", self.objecttype)
+ Output("return -1;")
+
+ def outputRepr(self):
+ Output()
+ Output("static PyObject * %s_repr(%s *self)", self.prefix, self.objecttype)
+ OutLbrace()
+ Output("char buf[512];")
+ Output("""PyOS_snprintf(buf, sizeof(buf), \"%%s((%%d, %%ld, '%%.*s'))\",
+ self->ob_type->tp_name,
+ self->ob_itself.vRefNum,
+ self->ob_itself.parID,
+ self->ob_itself.name[0], self->ob_itself.name+1);""")
+ Output("return PyString_FromString(buf);")
+ OutRbrace()
+
+class FSRefDefinition(PEP253Mixin, ObjectDefinition):
+ getsetlist = [
+ ("data",
+ "return PyString_FromStringAndSize((char *)&self->ob_itself, sizeof(self->ob_itself));",
+ None,
+ "Raw data of the FSRef object"
+ )
+ ]
+
+ def __init__(self, name, prefix, itselftype):
+ ObjectDefinition.__init__(self, name, prefix, itselftype)
+ self.argref = "*" # Store FSRefs, but pass them by address
+
+ def outputCheckNewArg(self):
+ Output("if (itself == NULL) return PyMac_Error(resNotFound);")
+
+ # We do Convert ourselves (with PyMac_GetFSxxx)
+ def outputConvert(self):
+ pass
+
+ def output_tp_newBody(self):
+ Output("PyObject *self;");
+ Output()
+ Output("if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;")
+ Output("memset(&((%s *)self)->ob_itself, 0, sizeof(%s));",
+ self.objecttype, self.itselftype)
+ Output("return self;")
+
+ def output_tp_initBody(self):
+ Output("PyObject *v = NULL;")
+ Output("char *rawdata = NULL;")
+ Output("int rawdatalen = 0;")
+ Output("static char *kw[] = {\"itself\", \"rawdata\", 0};")
+ Output()
+ Output("if (!PyArg_ParseTupleAndKeywords(_args, _kwds, \"|Os#\", kw, &v, &rawdata, &rawdatalen))")
+ Output("return -1;")
+ Output("if (v && rawdata)")
+ OutLbrace()
+ Output("PyErr_SetString(PyExc_TypeError, \"Only one of itself or rawdata may be specified\");")
+ Output("return -1;")
+ OutRbrace()
+ Output("if (!v && !rawdata)")
+ OutLbrace()
+ Output("PyErr_SetString(PyExc_TypeError, \"One of itself or rawdata must be specified\");")
+ Output("return -1;")
+ OutRbrace()
+ Output("if (rawdata)")
+ OutLbrace()
+ Output("if (rawdatalen != sizeof(%s))", self.itselftype)
+ OutLbrace()
+ Output("PyErr_SetString(PyExc_TypeError, \"%s rawdata incorrect size\");",
+ self.itselftype)
+ Output("return -1;")
+ OutRbrace()
+ Output("memcpy(&((%s *)_self)->ob_itself, rawdata, rawdatalen);", self.objecttype)
+ Output("return 0;")
+ OutRbrace()
+ Output("if (PyMac_GetFSRef(v, &((%s *)_self)->ob_itself)) return 0;", self.objecttype)
+ Output("return -1;")
+
+class AliasDefinition(PEP253Mixin, ObjectDefinition):
+ # XXXX Should inherit from resource?
+ getsetlist = [
+ ("data",
+ """int size;
+ PyObject *rv;
+
+ size = GetHandleSize((Handle)self->ob_itself);
+ HLock((Handle)self->ob_itself);
+ rv = PyString_FromStringAndSize(*(Handle)self->ob_itself, size);
+ HUnlock((Handle)self->ob_itself);
+ return rv;
+ """,
+ None,
+ "Raw data of the alias object"
+ )
+ ]
+
+ def outputCheckNewArg(self):
+ Output("if (itself == NULL) return PyMac_Error(resNotFound);")
+
+ def outputStructMembers(self):
+ ObjectDefinition.outputStructMembers(self)
+ Output("void (*ob_freeit)(%s ptr);", self.itselftype)
+
+ def outputInitStructMembers(self):
+ ObjectDefinition.outputInitStructMembers(self)
+ Output("it->ob_freeit = NULL;")
+
+ def outputCleanupStructMembers(self):
+ Output("if (self->ob_freeit && self->ob_itself)")
+ OutLbrace()
+ Output("self->ob_freeit(self->ob_itself);")
+ OutRbrace()
+ Output("self->ob_itself = NULL;")
+
+ def output_tp_newBody(self):
+ Output("PyObject *self;");
+ Output()
+ Output("if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;")
+ Output("((%s *)self)->ob_itself = NULL;", self.objecttype)
+ Output("return self;")
+
+ def output_tp_initBody(self):
+ Output("%s itself = NULL;", self.itselftype)
+ Output("char *rawdata = NULL;")
+ Output("int rawdatalen = 0;")
+ Output("Handle h;")
+ Output("static char *kw[] = {\"itself\", \"rawdata\", 0};")
+ Output()
+ Output("if (!PyArg_ParseTupleAndKeywords(_args, _kwds, \"|O&s#\", kw, %s_Convert, &itself, &rawdata, &rawdatalen))",
+ self.prefix)
+ Output("return -1;")
+ Output("if (itself && rawdata)")
+ OutLbrace()
+ Output("PyErr_SetString(PyExc_TypeError, \"Only one of itself or rawdata may be specified\");")
+ Output("return -1;")
+ OutRbrace()
+ Output("if (!itself && !rawdata)")
+ OutLbrace()
+ Output("PyErr_SetString(PyExc_TypeError, \"One of itself or rawdata must be specified\");")
+ Output("return -1;")
+ OutRbrace()
+ Output("if (rawdata)")
+ OutLbrace()
+ Output("if ((h = NewHandle(rawdatalen)) == NULL)")
+ OutLbrace()
+ Output("PyErr_NoMemory();")
+ Output("return -1;")
+ OutRbrace()
+ Output("HLock(h);")
+ Output("memcpy((char *)*h, rawdata, rawdatalen);")
+ Output("HUnlock(h);")
+ Output("((%s *)_self)->ob_itself = (%s)h;", self.objecttype, self.itselftype)
+ Output("return 0;")
+ OutRbrace()
+ Output("((%s *)_self)->ob_itself = itself;", self.objecttype)
+ Output("return 0;")
+
+# Alias methods come in two flavors: those with the alias as arg1 and
+# those with the alias as arg 2.
+class Arg2MethodGenerator(OSErrMethodGenerator):
+ """Similar to MethodGenerator, but has self as second argument"""
+
+ def parseArgumentList(self, args):
+ args0, arg1, argsrest = args[:1], args[1], args[2:]
+ t0, n0, m0 = arg1
+ args = args0 + argsrest
+ if m0 != InMode:
+ raise ValueError, "method's 'self' must be 'InMode'"
+ self.itself = Variable(t0, "_self->ob_itself", SelfMode)
+ FunctionGenerator.parseArgumentList(self, args)
+ self.argumentList.insert(2, self.itself)
+
+# From here on it's basically all boiler plate...
+
+# Create the generator groups and link them
+module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff,
+ longname=LONGMODNAME)
+
+fscataloginfoobject = FSCatalogInfoDefinition('FSCatalogInfo', 'FSCatalogInfo', 'FSCatalogInfo')
+finfoobject = FInfoDefinition('FInfo', 'FInfo', 'FInfo')
+aliasobject = AliasDefinition('Alias', 'Alias', 'AliasHandle')
+fsspecobject = FSSpecDefinition('FSSpec', 'FSSpec', 'FSSpec')
+fsrefobject = FSRefDefinition('FSRef', 'FSRef', 'FSRef')
+
+module.addobject(fscataloginfoobject)
+module.addobject(finfoobject)
+module.addobject(aliasobject)
+module.addobject(fsspecobject)
+module.addobject(fsrefobject)
+
+# Create the generator classes used to populate the lists
+Function = OSErrFunctionGenerator
+Method = OSErrMethodGenerator
+
+# Create and populate the lists
+functions = []
+alias_methods = []
+fsref_methods = []
+fsspec_methods = []
+execfile(INPUTFILE)
+
+# Manual generators:
+FSRefMakePath_body = """
+OSStatus _err;
+#define MAXPATHNAME 1024
+UInt8 path[MAXPATHNAME];
+UInt32 maxPathSize = MAXPATHNAME;
+
+if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+_err = FSRefMakePath(&_self->ob_itself,
+ path,
+ maxPathSize);
+if (_err != noErr) return PyMac_Error(_err);
+_res = Py_BuildValue("s", path);
+return _res;
+"""
+f = ManualGenerator("FSRefMakePath", FSRefMakePath_body)
+f.docstring = lambda: "() -> string"
+fsref_methods.append(f)
+
+FSRef_as_pathname_body = """
+if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+_res = FSRef_FSRefMakePath(_self, _args);
+return _res;
+"""
+f = ManualGenerator("as_pathname", FSRef_as_pathname_body)
+f.docstring = lambda: "() -> string"
+fsref_methods.append(f)
+
+FSSpec_as_pathname_body = """
+char strbuf[1024];
+OSErr err;
+
+if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+err = _PyMac_GetFullPathname(&_self->ob_itself, strbuf, sizeof(strbuf));
+if ( err ) {
+ PyMac_Error(err);
+ return NULL;
+}
+_res = PyString_FromString(strbuf);
+return _res;
+"""
+f = ManualGenerator("as_pathname", FSSpec_as_pathname_body)
+f.docstring = lambda: "() -> string"
+fsspec_methods.append(f)
+
+FSSpec_as_tuple_body = """
+if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+_res = Py_BuildValue("(iis#)", _self->ob_itself.vRefNum, _self->ob_itself.parID,
+ &_self->ob_itself.name[1], _self->ob_itself.name[0]);
+return _res;
+"""
+f = ManualGenerator("as_tuple", FSSpec_as_tuple_body)
+f.docstring = lambda: "() -> (vRefNum, dirID, name)"
+fsspec_methods.append(f)
+
+pathname_body = """
+PyObject *obj;
+
+if (!PyArg_ParseTuple(_args, "O", &obj))
+ return NULL;
+if (PyString_Check(obj)) {
+ Py_INCREF(obj);
+ return obj;
+}
+if (PyUnicode_Check(obj))
+ return PyUnicode_AsEncodedString(obj, "utf8", "strict");
+_res = PyObject_CallMethod(obj, "as_pathname", NULL);
+return _res;
+"""
+f = ManualGenerator("pathname", pathname_body)
+f.docstring = lambda: "(str|unicode|FSSpec|FSref) -> pathname"
+functions.append(f)
+
+# add the populated lists to the generator groups
+# (in a different wordl the scan program would generate this)
+for f in functions: module.add(f)
+for f in alias_methods: aliasobject.add(f)
+for f in fsspec_methods: fsspecobject.add(f)
+for f in fsref_methods: fsrefobject.add(f)
+
+# generate output (open the output file as late as possible)
+SetOutputFileName(OUTPUTFILE)
+module.generate()
diff --git a/Mac/Modules/fm/_Fmmodule.c b/Mac/Modules/fm/_Fmmodule.c
new file mode 100644
index 0000000000..adc47aa250
--- /dev/null
+++ b/Mac/Modules/fm/_Fmmodule.c
@@ -0,0 +1,368 @@
+
+/* =========================== Module _Fm =========================== */
+
+#include "Python.h"
+
+#ifndef __LP64__
+
+
+#include "pymactoolbox.h"
+
+/* Macro to test whether a weak-loaded CFM function exists */
+#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
+ PyErr_SetString(PyExc_NotImplementedError, \
+ "Not available in this shared library/OS version"); \
+ return NULL; \
+ }} while(0)
+
+
+#include <Carbon/Carbon.h>
+
+
+/*
+** Parse/generate ComponentDescriptor records
+*/
+static PyObject *
+FMRec_New(FMetricRec *itself)
+{
+
+ return Py_BuildValue("O&O&O&O&O&",
+ PyMac_BuildFixed, itself->ascent,
+ PyMac_BuildFixed, itself->descent,
+ PyMac_BuildFixed, itself->leading,
+ PyMac_BuildFixed, itself->widMax,
+ ResObj_New, itself->wTabHandle);
+}
+
+#if 0
+/* Not needed... */
+static int
+FMRec_Convert(PyObject *v, FMetricRec *p_itself)
+{
+ return PyArg_ParseTuple(v, "O&O&O&O&O&",
+ PyMac_GetFixed, &itself->ascent,
+ PyMac_GetFixed, &itself->descent,
+ PyMac_GetFixed, &itself->leading,
+ PyMac_GetFixed, &itself->widMax,
+ ResObj_Convert, &itself->wTabHandle);
+}
+#endif
+
+
+static PyObject *Fm_Error;
+
+static PyObject *Fm_GetFontName(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short familyID;
+ Str255 name;
+#ifndef GetFontName
+ PyMac_PRECHECK(GetFontName);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &familyID))
+ return NULL;
+ GetFontName(familyID,
+ name);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildStr255, name);
+ return _res;
+}
+
+static PyObject *Fm_GetFNum(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Str255 name;
+ short familyID;
+#ifndef GetFNum
+ PyMac_PRECHECK(GetFNum);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetStr255, name))
+ return NULL;
+ GetFNum(name,
+ &familyID);
+ _res = Py_BuildValue("h",
+ familyID);
+ return _res;
+}
+
+static PyObject *Fm_RealFont(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ short fontNum;
+ short size;
+#ifndef RealFont
+ PyMac_PRECHECK(RealFont);
+#endif
+ if (!PyArg_ParseTuple(_args, "hh",
+ &fontNum,
+ &size))
+ return NULL;
+ _rv = RealFont(fontNum,
+ size);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Fm_SetFScaleDisable(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean fscaleDisable;
+#ifndef SetFScaleDisable
+ PyMac_PRECHECK(SetFScaleDisable);
+#endif
+ if (!PyArg_ParseTuple(_args, "b",
+ &fscaleDisable))
+ return NULL;
+ SetFScaleDisable(fscaleDisable);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Fm_FontMetrics(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ FMetricRec theMetrics;
+#ifndef FontMetrics
+ PyMac_PRECHECK(FontMetrics);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ FontMetrics(&theMetrics);
+ _res = Py_BuildValue("O&",
+ FMRec_New, &theMetrics);
+ return _res;
+}
+
+static PyObject *Fm_SetFractEnable(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean fractEnable;
+#ifndef SetFractEnable
+ PyMac_PRECHECK(SetFractEnable);
+#endif
+ if (!PyArg_ParseTuple(_args, "b",
+ &fractEnable))
+ return NULL;
+ SetFractEnable(fractEnable);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Fm_GetDefFontSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+#ifndef GetDefFontSize
+ PyMac_PRECHECK(GetDefFontSize);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetDefFontSize();
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Fm_IsOutline(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Point numer;
+ Point denom;
+#ifndef IsOutline
+ PyMac_PRECHECK(IsOutline);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetPoint, &numer,
+ PyMac_GetPoint, &denom))
+ return NULL;
+ _rv = IsOutline(numer,
+ denom);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Fm_SetOutlinePreferred(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean outlinePreferred;
+#ifndef SetOutlinePreferred
+ PyMac_PRECHECK(SetOutlinePreferred);
+#endif
+ if (!PyArg_ParseTuple(_args, "b",
+ &outlinePreferred))
+ return NULL;
+ SetOutlinePreferred(outlinePreferred);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Fm_GetOutlinePreferred(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef GetOutlinePreferred
+ PyMac_PRECHECK(GetOutlinePreferred);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetOutlinePreferred();
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Fm_SetPreserveGlyph(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean preserveGlyph;
+#ifndef SetPreserveGlyph
+ PyMac_PRECHECK(SetPreserveGlyph);
+#endif
+ if (!PyArg_ParseTuple(_args, "b",
+ &preserveGlyph))
+ return NULL;
+ SetPreserveGlyph(preserveGlyph);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Fm_GetPreserveGlyph(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef GetPreserveGlyph
+ PyMac_PRECHECK(GetPreserveGlyph);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetPreserveGlyph();
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Fm_GetSysFont(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+#ifndef GetSysFont
+ PyMac_PRECHECK(GetSysFont);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetSysFont();
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Fm_GetAppFont(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+#ifndef GetAppFont
+ PyMac_PRECHECK(GetAppFont);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetAppFont();
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Fm_QDTextBounds(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ char *inText__in__;
+ int inText__len__;
+ int inText__in_len__;
+ Rect bounds;
+#ifndef QDTextBounds
+ PyMac_PRECHECK(QDTextBounds);
+#endif
+ if (!PyArg_ParseTuple(_args, "s#",
+ &inText__in__, &inText__in_len__))
+ return NULL;
+ inText__len__ = inText__in_len__;
+ QDTextBounds(inText__len__, inText__in__,
+ &bounds);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &bounds);
+ return _res;
+}
+
+static PyMethodDef Fm_methods[] = {
+ {"GetFontName", (PyCFunction)Fm_GetFontName, 1,
+ PyDoc_STR("(short familyID) -> (Str255 name)")},
+ {"GetFNum", (PyCFunction)Fm_GetFNum, 1,
+ PyDoc_STR("(Str255 name) -> (short familyID)")},
+ {"RealFont", (PyCFunction)Fm_RealFont, 1,
+ PyDoc_STR("(short fontNum, short size) -> (Boolean _rv)")},
+ {"SetFScaleDisable", (PyCFunction)Fm_SetFScaleDisable, 1,
+ PyDoc_STR("(Boolean fscaleDisable) -> None")},
+ {"FontMetrics", (PyCFunction)Fm_FontMetrics, 1,
+ PyDoc_STR("() -> (FMetricRec theMetrics)")},
+ {"SetFractEnable", (PyCFunction)Fm_SetFractEnable, 1,
+ PyDoc_STR("(Boolean fractEnable) -> None")},
+ {"GetDefFontSize", (PyCFunction)Fm_GetDefFontSize, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"IsOutline", (PyCFunction)Fm_IsOutline, 1,
+ PyDoc_STR("(Point numer, Point denom) -> (Boolean _rv)")},
+ {"SetOutlinePreferred", (PyCFunction)Fm_SetOutlinePreferred, 1,
+ PyDoc_STR("(Boolean outlinePreferred) -> None")},
+ {"GetOutlinePreferred", (PyCFunction)Fm_GetOutlinePreferred, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"SetPreserveGlyph", (PyCFunction)Fm_SetPreserveGlyph, 1,
+ PyDoc_STR("(Boolean preserveGlyph) -> None")},
+ {"GetPreserveGlyph", (PyCFunction)Fm_GetPreserveGlyph, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"GetSysFont", (PyCFunction)Fm_GetSysFont, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"GetAppFont", (PyCFunction)Fm_GetAppFont, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"QDTextBounds", (PyCFunction)Fm_QDTextBounds, 1,
+ PyDoc_STR("(Buffer inText) -> (Rect bounds)")},
+ {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 ========================= */
+
diff --git a/Mac/Modules/fm/fmscan.py b/Mac/Modules/fm/fmscan.py
new file mode 100644
index 0000000000..1c0d4122fe
--- /dev/null
+++ b/Mac/Modules/fm/fmscan.py
@@ -0,0 +1,71 @@
+# Scan an Apple header file, generating a Python file of generator calls.
+
+import sys
+from bgenlocations import TOOLBOXDIR, BGENDIR
+sys.path.append(BGENDIR)
+from scantools import Scanner
+
+LONG = "Fonts"
+SHORT = "fm"
+
+def main():
+ input = "Fonts.h"
+ output = SHORT + "gen.py"
+ defsoutput = TOOLBOXDIR + LONG + ".py"
+ scanner = MyScanner(input, output, defsoutput)
+ scanner.scan()
+ scanner.close()
+ print "=== Testing definitions output code ==="
+ execfile(defsoutput, {}, {})
+ print "=== Done scanning and generating, now importing the generated code... ==="
+ exec "import " + SHORT + "support"
+ print "=== Done. It's up to you to compile it now! ==="
+
+class MyScanner(Scanner):
+
+ def destination(self, type, name, arglist):
+ classname = "Function"
+ listname = "functions"
+ return classname, listname
+
+ def makeblacklistnames(self):
+ return [
+ "OutlineMetrics", # Too complicated
+ "AntiTextIsAntiAliased", # XXXX Missing from library...
+ "AntiTextGetEnabled",
+ "AntiTextSetEnabled",
+ "AntiTextGetApplicationAware",
+ "AntiTextSetApplicationAware",
+ # These are tricky: they're not Carbon dependent or anything, but they
+ # exist only on 8.6 or later (both in Carbon and Classic).
+ # Disabling them is the easiest path.
+ 'SetAntiAliasedTextEnabled',
+ 'IsAntiAliasedTextEnabled',
+ # OS8-only
+ 'InitFonts',
+ 'SetFontLock',
+ 'FlushFonts',
+ ]
+
+ def makeblacklisttypes(self):
+ return [
+ "FMInput_ptr", # Not needed for now
+ "FMOutPtr", # Ditto
+## "void_ptr", # Don't know how to do this right now
+ "FontInfo", # Ditto
+ ]
+
+ def makerepairinstructions(self):
+ return [
+ ([('Str255', '*', 'InMode')], [('Str255', '*', 'OutMode')]),
+ ([('FMetricRecPtr', 'theMetrics', 'InMode')], [('FMetricRecPtr', 'theMetrics', 'OutMode')]),
+ ([('short', 'byteCount', 'InMode'), ('void_ptr', 'textAddr', 'InMode'),],
+ [('TextBuffer', 'inText', 'InMode')]),
+ ]
+
+ def writeinitialdefs(self):
+ self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
+ self.defsfile.write("kNilOptions = 0\n")
+
+if __name__ == "__main__":
+ main()
diff --git a/Mac/Modules/fm/fmsupport.py b/Mac/Modules/fm/fmsupport.py
new file mode 100644
index 0000000000..e69205316c
--- /dev/null
+++ b/Mac/Modules/fm/fmsupport.py
@@ -0,0 +1,81 @@
+# This script generates a Python interface for an Apple Macintosh Manager.
+# It uses the "bgen" package to generate C code.
+# The function specifications are generated by scanning the mamager's header file,
+# using the "scantools" package (customized for this particular manager).
+
+import string
+
+# Declarations that change for each manager
+MACHEADERFILE = 'Fonts.h' # The Apple header file
+MODNAME = '_Fm' # The name of the module
+
+# The following is *usually* unchanged but may still require tuning
+MODPREFIX = 'Fm' # The prefix for module-wide routines
+INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner
+OUTPUTFILE = MODNAME + "module.c" # The file generated by this program
+
+from macsupport import *
+
+# Create the type objects
+
+class RevVarInputBufferType(VarInputBufferType):
+ def passInput(self, name):
+ return "%s__len__, %s__in__" % (name, name)
+
+TextBuffer = RevVarInputBufferType()
+
+
+includestuff = includestuff + """
+#include <Carbon/Carbon.h>
+
+
+/*
+** Parse/generate ComponentDescriptor records
+*/
+static PyObject *
+FMRec_New(FMetricRec *itself)
+{
+
+ return Py_BuildValue("O&O&O&O&O&",
+ PyMac_BuildFixed, itself->ascent,
+ PyMac_BuildFixed, itself->descent,
+ PyMac_BuildFixed, itself->leading,
+ PyMac_BuildFixed, itself->widMax,
+ ResObj_New, itself->wTabHandle);
+}
+
+#if 0
+/* Not needed... */
+static int
+FMRec_Convert(PyObject *v, FMetricRec *p_itself)
+{
+ return PyArg_ParseTuple(v, "O&O&O&O&O&",
+ PyMac_GetFixed, &itself->ascent,
+ PyMac_GetFixed, &itself->descent,
+ PyMac_GetFixed, &itself->leading,
+ PyMac_GetFixed, &itself->widMax,
+ ResObj_Convert, &itself->wTabHandle);
+}
+#endif
+
+"""
+
+FMetricRecPtr = OpaqueType('FMetricRec', 'FMRec')
+
+# Create the generator groups and link them
+module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff)
+
+# Create the generator classes used to populate the lists
+Function = OSErrWeakLinkFunctionGenerator
+
+# Create and populate the lists
+functions = []
+execfile(INPUTFILE)
+
+# add the populated lists to the generator groups
+# (in a different wordl the scan program would generate this)
+for f in functions: module.add(f)
+
+# generate output (open the output file as late as possible)
+SetOutputFileName(OUTPUTFILE)
+module.generate()
diff --git a/Mac/Modules/folder/_Foldermodule.c b/Mac/Modules/folder/_Foldermodule.c
new file mode 100644
index 0000000000..10597f5e28
--- /dev/null
+++ b/Mac/Modules/folder/_Foldermodule.c
@@ -0,0 +1,342 @@
+
+/* ========================= Module _Folder ========================= */
+
+#include "Python.h"
+
+
+
+#include "pymactoolbox.h"
+
+/* Macro to test whether a weak-loaded CFM function exists */
+#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
+ PyErr_SetString(PyExc_NotImplementedError, \
+ "Not available in this shared library/OS version"); \
+ return NULL; \
+ }} while(0)
+
+
+#include <Carbon/Carbon.h>
+
+
+static PyObject *Folder_Error;
+
+static PyObject *Folder_FindFolder(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short vRefNum;
+ OSType folderType;
+ Boolean createFolder;
+ FSVolumeRefNum foundVRefNum;
+ SInt32 foundDirID;
+ if (!PyArg_ParseTuple(_args, "hO&b",
+ &vRefNum,
+ PyMac_GetOSType, &folderType,
+ &createFolder))
+ return NULL;
+ _err = FindFolder(vRefNum,
+ folderType,
+ createFolder,
+ &foundVRefNum,
+ &foundDirID);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("hl",
+ foundVRefNum,
+ foundDirID);
+ return _res;
+}
+
+static PyObject *Folder_ReleaseFolder(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short vRefNum;
+ OSType folderType;
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &vRefNum,
+ PyMac_GetOSType, &folderType))
+ return NULL;
+ _err = ReleaseFolder(vRefNum,
+ folderType);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Folder_FSFindFolder(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short vRefNum;
+ OSType folderType;
+ Boolean createFolder;
+ FSRef foundRef;
+ if (!PyArg_ParseTuple(_args, "hO&b",
+ &vRefNum,
+ PyMac_GetOSType, &folderType,
+ &createFolder))
+ return NULL;
+ _err = FSFindFolder(vRefNum,
+ folderType,
+ createFolder,
+ &foundRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildFSRef, &foundRef);
+ return _res;
+}
+
+static PyObject *Folder_AddFolderDescriptor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FolderType foldType;
+ FolderDescFlags flags;
+ FolderClass foldClass;
+ FolderLocation foldLocation;
+ OSType badgeSignature;
+ OSType badgeType;
+ Str255 name;
+ Boolean replaceFlag;
+ if (!PyArg_ParseTuple(_args, "O&lO&O&O&O&O&b",
+ PyMac_GetOSType, &foldType,
+ &flags,
+ PyMac_GetOSType, &foldClass,
+ PyMac_GetOSType, &foldLocation,
+ PyMac_GetOSType, &badgeSignature,
+ PyMac_GetOSType, &badgeType,
+ PyMac_GetStr255, name,
+ &replaceFlag))
+ return NULL;
+ _err = AddFolderDescriptor(foldType,
+ flags,
+ foldClass,
+ foldLocation,
+ badgeSignature,
+ badgeType,
+ name,
+ replaceFlag);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Folder_GetFolderTypes(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ UInt32 requestedTypeCount;
+ UInt32 totalTypeCount;
+ FolderType theTypes;
+ if (!PyArg_ParseTuple(_args, "l",
+ &requestedTypeCount))
+ return NULL;
+ _err = GetFolderTypes(requestedTypeCount,
+ &totalTypeCount,
+ &theTypes);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("lO&",
+ totalTypeCount,
+ PyMac_BuildOSType, theTypes);
+ return _res;
+}
+
+static PyObject *Folder_RemoveFolderDescriptor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FolderType foldType;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &foldType))
+ return NULL;
+ _err = RemoveFolderDescriptor(foldType);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+#ifndef __LP64__
+static PyObject *Folder_GetFolderName(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short vRefNum;
+ OSType foldType;
+ short foundVRefNum;
+ Str255 name;
+ if (!PyArg_ParseTuple(_args, "hO&O&",
+ &vRefNum,
+ PyMac_GetOSType, &foldType,
+ PyMac_GetStr255, name))
+ return NULL;
+ _err = GetFolderName(vRefNum,
+ foldType,
+ &foundVRefNum,
+ name);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ foundVRefNum);
+ return _res;
+}
+
+static PyObject *Folder_AddFolderRouting(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType fileType;
+ FolderType routeFromFolder;
+ FolderType routeToFolder;
+ RoutingFlags flags;
+ Boolean replaceFlag;
+ if (!PyArg_ParseTuple(_args, "O&O&O&lb",
+ PyMac_GetOSType, &fileType,
+ PyMac_GetOSType, &routeFromFolder,
+ PyMac_GetOSType, &routeToFolder,
+ &flags,
+ &replaceFlag))
+ return NULL;
+ _err = AddFolderRouting(fileType,
+ routeFromFolder,
+ routeToFolder,
+ flags,
+ replaceFlag);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Folder_RemoveFolderRouting(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType fileType;
+ FolderType routeFromFolder;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &fileType,
+ PyMac_GetOSType, &routeFromFolder))
+ return NULL;
+ _err = RemoveFolderRouting(fileType,
+ routeFromFolder);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Folder_FindFolderRouting(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType fileType;
+ FolderType routeFromFolder;
+ FolderType routeToFolder;
+ RoutingFlags flags;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &fileType,
+ PyMac_GetOSType, &routeFromFolder))
+ return NULL;
+ _err = FindFolderRouting(fileType,
+ routeFromFolder,
+ &routeToFolder,
+ &flags);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&l",
+ PyMac_BuildOSType, routeToFolder,
+ flags);
+ return _res;
+}
+#endif /* !__LP64__ */
+
+static PyObject *Folder_InvalidateFolderDescriptorCache(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short vRefNum;
+ long dirID;
+ if (!PyArg_ParseTuple(_args, "hl",
+ &vRefNum,
+ &dirID))
+ return NULL;
+ _err = InvalidateFolderDescriptorCache(vRefNum,
+ dirID);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Folder_IdentifyFolder(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short vRefNum;
+ long dirID;
+ FolderType foldType;
+ if (!PyArg_ParseTuple(_args, "hl",
+ &vRefNum,
+ &dirID))
+ return NULL;
+ _err = IdentifyFolder(vRefNum,
+ dirID,
+ &foldType);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildOSType, foldType);
+ return _res;
+}
+
+static PyMethodDef Folder_methods[] = {
+ {"FindFolder", (PyCFunction)Folder_FindFolder, 1,
+ PyDoc_STR("(short vRefNum, OSType folderType, Boolean createFolder) -> (short foundVRefNum, long foundDirID)")},
+ {"ReleaseFolder", (PyCFunction)Folder_ReleaseFolder, 1,
+ PyDoc_STR("(short vRefNum, OSType folderType) -> None")},
+ {"FSFindFolder", (PyCFunction)Folder_FSFindFolder, 1,
+ PyDoc_STR("(short vRefNum, OSType folderType, Boolean createFolder) -> (FSRef foundRef)")},
+ {"AddFolderDescriptor", (PyCFunction)Folder_AddFolderDescriptor, 1,
+ PyDoc_STR("(FolderType foldType, FolderDescFlags flags, FolderClass foldClass, FolderLocation foldLocation, OSType badgeSignature, OSType badgeType, Str255 name, Boolean replaceFlag) -> None")},
+ {"GetFolderTypes", (PyCFunction)Folder_GetFolderTypes, 1,
+ 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,
+ PyDoc_STR("(OSType fileType, FolderType routeFromFolder, FolderType routeToFolder, RoutingFlags flags, Boolean replaceFlag) -> None")},
+ {"RemoveFolderRouting", (PyCFunction)Folder_RemoveFolderRouting, 1,
+ 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,
+ PyDoc_STR("(short vRefNum, long dirID) -> (FolderType foldType)")},
+ {NULL, NULL, 0}
+};
+
+
+
+
+void init_Folder(void)
+{
+ PyObject *m;
+ PyObject *d;
+
+
+
+
+ m = Py_InitModule("_Folder", Folder_methods);
+ d = PyModule_GetDict(m);
+ Folder_Error = PyMac_GetOSErrException();
+ if (Folder_Error == NULL ||
+ PyDict_SetItemString(d, "Error", Folder_Error) != 0)
+ return;
+}
+
+/* ======================= End module _Folder ======================= */
+
diff --git a/Mac/Modules/folder/folderscan.py b/Mac/Modules/folder/folderscan.py
new file mode 100644
index 0000000000..746a333e0f
--- /dev/null
+++ b/Mac/Modules/folder/folderscan.py
@@ -0,0 +1,67 @@
+# Scan an Apple header file, generating a Python file of generator calls.
+
+import sys
+from bgenlocations import TOOLBOXDIR, BGENDIR
+sys.path.append(BGENDIR)
+from scantools import Scanner_OSX
+
+LONG = "Folders"
+SHORT = "folder"
+OBJECT = "NOTUSED"
+
+def main():
+ input = LONG + ".h"
+ output = SHORT + "gen.py"
+ defsoutput = TOOLBOXDIR + LONG + ".py"
+ scanner = MyScanner(input, output, defsoutput)
+ scanner.scan()
+ scanner.close()
+ scanner.gentypetest(SHORT+"typetest.py")
+ print "=== Testing definitions output code ==="
+ execfile(defsoutput, {}, {})
+ print "=== Done scanning and generating, now importing the generated code... ==="
+ exec "import " + SHORT + "support"
+ print "=== Done. It's up to you to compile it now! ==="
+
+class MyScanner(Scanner_OSX):
+
+ def destination(self, type, name, arglist):
+ classname = "Function"
+ listname = "functions"
+ if arglist:
+ t, n, m = arglist[0]
+ # This is non-functional today
+ if t == OBJECT and m == "InMode":
+ classname = "Method"
+ listname = "methods"
+ return classname, listname
+
+ def makeblacklistnames(self):
+ return [
+ "FindFolderExtended", # Has funny void* argument
+ "FSFindFolderExtended", # ditto
+ "FolderManagerRegisterCallNotificationProcs", # ditto
+
+ "FindFolderEx", # Non-MacOS routine
+ ]
+
+ def makeblacklisttypes(self):
+ return [
+ "FolderManagerNotificationProcPtr",
+ "FolderManagerNotificationUPP",
+ "FolderRouting", # To be done, not difficult
+ "FolderDesc", # To be done, not difficult
+
+ ]
+
+ def makerepairinstructions(self):
+ return [
+ ]
+
+ def writeinitialdefs(self):
+ self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
+ self.defsfile.write("true = True\n")
+ self.defsfile.write("false = False\n")
+
+if __name__ == "__main__":
+ main()
diff --git a/Mac/Modules/folder/foldersupport.py b/Mac/Modules/folder/foldersupport.py
new file mode 100644
index 0000000000..b9b64bfb01
--- /dev/null
+++ b/Mac/Modules/folder/foldersupport.py
@@ -0,0 +1,56 @@
+# This script generates a Python interface for an Apple Macintosh Manager.
+# It uses the "bgen" package to generate C code.
+# The function specifications are generated by scanning the mamager's header file,
+# using the "scantools" package (customized for this particular manager).
+
+import string
+
+# Declarations that change for each manager
+MACHEADERFILE = 'Folders.h' # The Apple header file
+MODNAME = '_Folder' # The name of the module
+
+# The following is *usually* unchanged but may still require tuning
+MODPREFIX = 'Folder' # The prefix for module-wide routines
+INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner
+OUTPUTFILE = MODNAME + "module.c" # The file generated by this program
+
+from macsupport import *
+
+# Create the type objects
+ConstStrFileNameParam = ConstStr255Param
+StrFileName = Str255
+FolderClass = OSTypeType("FolderClass")
+# FolderDesc
+FolderDescFlags = Type("FolderDescFlags", "l")
+FolderLocation = OSTypeType("FolderLocation")
+# FolderRouting
+FolderType = OSTypeType("FolderType")
+RoutingFlags = Type("RoutingFlags", "l")
+
+
+includestuff = includestuff + """
+#include <Carbon/Carbon.h>
+
+"""
+
+execfile(string.lower(MODPREFIX) + 'typetest.py')
+
+# From here on it's basically all boiler plate...
+
+# Create the generator groups and link them
+module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff)
+
+# Create the generator classes used to populate the lists
+Function = OSErrFunctionGenerator
+
+# Create and populate the lists
+functions = []
+execfile(INPUTFILE)
+
+# add the populated lists to the generator groups
+# (in a different wordl the scan program would generate this)
+for f in functions: module.add(f)
+
+# generate output (open the output file as late as possible)
+SetOutputFileName(OUTPUTFILE)
+module.generate()
diff --git a/Mac/Modules/gestaltmodule.c b/Mac/Modules/gestaltmodule.c
new file mode 100644
index 0000000000..56757ab5ef
--- /dev/null
+++ b/Mac/Modules/gestaltmodule.c
@@ -0,0 +1,55 @@
+/***********************************************************
+Copyright 1991-1997 by Stichting Mathematisch Centrum, Amsterdam,
+The Netherlands.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of Stichting Mathematisch
+Centrum or CWI not be used in advertising or publicity pertaining to
+distribution of the software without specific, written prior permission.
+
+STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
+THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
+FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+******************************************************************/
+
+/* Macintosh Gestalt interface */
+
+#include "Python.h"
+#include "pymactoolbox.h"
+
+#include <Carbon/Carbon.h>
+
+static PyObject *
+gestalt_gestalt(PyObject *self, PyObject *args)
+{
+ OSErr iErr;
+ OSType selector;
+ SInt32 response;
+ if (!PyArg_ParseTuple(args, "O&", PyMac_GetOSType, &selector))
+ return NULL;
+ iErr = Gestalt ( selector, &response );
+ if (iErr != 0)
+ return PyMac_Error(iErr);
+ return PyInt_FromLong(response);
+}
+
+static struct PyMethodDef gestalt_methods[] = {
+ {"gestalt", gestalt_gestalt, METH_VARARGS},
+ {NULL, NULL} /* Sentinel */
+};
+
+void
+initgestalt(void)
+{
+ Py_InitModule("gestalt", gestalt_methods);
+}
diff --git a/Mac/Modules/help/_Helpmodule.c b/Mac/Modules/help/_Helpmodule.c
new file mode 100644
index 0000000000..eaa2e8a83b
--- /dev/null
+++ b/Mac/Modules/help/_Helpmodule.c
@@ -0,0 +1,196 @@
+
+/* ========================== Module _Help ========================== */
+
+#include "Python.h"
+
+#ifndef __LP64__
+
+
+#include "pymactoolbox.h"
+
+/* Macro to test whether a weak-loaded CFM function exists */
+#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
+ PyErr_SetString(PyExc_NotImplementedError, \
+ "Not available in this shared library/OS version"); \
+ return NULL; \
+ }} while(0)
+
+
+#include <Carbon/Carbon.h>
+
+static PyObject *Help_Error;
+
+static PyObject *Help_HMGetHelpMenu(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuRef outHelpMenu;
+ MenuItemIndex outFirstCustomItemIndex;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = HMGetHelpMenu(&outHelpMenu,
+ &outFirstCustomItemIndex);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&H",
+ MenuObj_New, outHelpMenu,
+ outFirstCustomItemIndex);
+ return _res;
+}
+
+static PyObject *Help_HMAreHelpTagsDisplayed(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = HMAreHelpTagsDisplayed();
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Help_HMSetHelpTagsDisplayed(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Boolean inDisplayTags;
+ if (!PyArg_ParseTuple(_args, "b",
+ &inDisplayTags))
+ return NULL;
+ _err = HMSetHelpTagsDisplayed(inDisplayTags);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Help_HMSetTagDelay(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Duration inDelay;
+ if (!PyArg_ParseTuple(_args, "l",
+ &inDelay))
+ return NULL;
+ _err = HMSetTagDelay(inDelay);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Help_HMGetTagDelay(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Duration outDelay;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = HMGetTagDelay(&outDelay);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outDelay);
+ return _res;
+}
+
+static PyObject *Help_HMSetMenuHelpFromBalloonRsrc(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuRef inMenu;
+ SInt16 inHmnuRsrcID;
+ if (!PyArg_ParseTuple(_args, "O&h",
+ MenuObj_Convert, &inMenu,
+ &inHmnuRsrcID))
+ return NULL;
+ _err = HMSetMenuHelpFromBalloonRsrc(inMenu,
+ inHmnuRsrcID);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Help_HMSetDialogHelpFromBalloonRsrc(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ DialogPtr inDialog;
+ SInt16 inHdlgRsrcID;
+ SInt16 inItemStart;
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ DlgObj_Convert, &inDialog,
+ &inHdlgRsrcID,
+ &inItemStart))
+ return NULL;
+ _err = HMSetDialogHelpFromBalloonRsrc(inDialog,
+ inHdlgRsrcID,
+ inItemStart);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Help_HMHideTag(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = HMHideTag();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ 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,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"HMSetHelpTagsDisplayed", (PyCFunction)Help_HMSetHelpTagsDisplayed, 1,
+ PyDoc_STR("(Boolean inDisplayTags) -> None")},
+ {"HMSetTagDelay", (PyCFunction)Help_HMSetTagDelay, 1,
+ PyDoc_STR("(Duration inDelay) -> None")},
+ {"HMGetTagDelay", (PyCFunction)Help_HMGetTagDelay, 1,
+ PyDoc_STR("() -> (Duration outDelay)")},
+ {"HMSetMenuHelpFromBalloonRsrc", (PyCFunction)Help_HMSetMenuHelpFromBalloonRsrc, 1,
+ PyDoc_STR("(MenuRef inMenu, SInt16 inHmnuRsrcID) -> None")},
+ {"HMSetDialogHelpFromBalloonRsrc", (PyCFunction)Help_HMSetDialogHelpFromBalloonRsrc, 1,
+ PyDoc_STR("(DialogPtr inDialog, SInt16 inHdlgRsrcID, SInt16 inItemStart) -> None")},
+ {"HMHideTag", (PyCFunction)Help_HMHideTag, 1,
+ PyDoc_STR("() -> None")},
+#endif /* __LP64__ */
+ {NULL, NULL, 0}
+};
+
+
+
+
+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 ======================== */
+
diff --git a/Mac/Modules/help/helpscan.py b/Mac/Modules/help/helpscan.py
new file mode 100644
index 0000000000..b3543b99e4
--- /dev/null
+++ b/Mac/Modules/help/helpscan.py
@@ -0,0 +1,66 @@
+# Scan an Apple header file, generating a Python file of generator calls.
+
+import sys
+from bgenlocations import TOOLBOXDIR, BGENDIR
+sys.path.append(BGENDIR)
+from scantools import Scanner
+
+LONG = "MacHelp"
+SHORT = "help"
+OBJECT = "NOTUSED"
+
+def main():
+ input = LONG + ".h"
+ output = SHORT + "gen.py"
+ defsoutput = TOOLBOXDIR + LONG + ".py"
+ scanner = MyScanner(input, output, defsoutput)
+ scanner.scan()
+ scanner.close()
+ print "=== Testing definitions output code ==="
+ execfile(defsoutput, {}, {})
+ print "=== Done scanning and generating, now importing the generated code... ==="
+ exec "import " + SHORT + "support"
+ print "=== Done. It's up to you to compile it now! ==="
+
+class MyScanner(Scanner):
+
+ def destination(self, type, name, arglist):
+ classname = "Function"
+ listname = "functions"
+ if arglist:
+ t, n, m = arglist[0]
+ # This is non-functional today
+ if t == OBJECT and m == "InMode":
+ classname = "Method"
+ listname = "methods"
+ return classname, listname
+
+ def writeinitialdefs(self):
+ self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
+
+ def makeblacklistnames(self):
+ return [
+ ]
+
+ def makeblacklisttypes(self):
+ return [
+## "TipFunctionUPP",
+## "HMMessageRecord",
+## "HMMessageRecord_ptr",
+ "HMWindowContentUPP",
+ "HMMenuTitleContentUPP",
+ "HMControlContentUPP",
+ "HMMenuItemContentUPP",
+ # For the moment
+ "HMHelpContentRec",
+ "HMHelpContentRec_ptr",
+ ]
+
+ def makerepairinstructions(self):
+ return [
+## ([("WindowPtr", "*", "OutMode")],
+## [("ExistingWindowPtr", "*", "*")]),
+ ]
+
+if __name__ == "__main__":
+ main()
diff --git a/Mac/Modules/help/helpsupport.py b/Mac/Modules/help/helpsupport.py
new file mode 100644
index 0000000000..77f5c2ecc9
--- /dev/null
+++ b/Mac/Modules/help/helpsupport.py
@@ -0,0 +1,78 @@
+# This script generates a Python interface for an Apple Macintosh Manager.
+# It uses the "bgen" package to generate C code.
+# The function specifications are generated by scanning the mamager's header file,
+# using the "scantools" package (customized for this particular manager).
+
+import string
+
+# Declarations that change for each manager
+MODNAME = '_Help' # The name of the module
+OBJECTNAME = 'UNUSED' # The basic name of the objects used here
+KIND = 'Record' # Usually 'Ptr' or 'Handle'
+
+# The following is *usually* unchanged but may still require tuning
+MODPREFIX = 'Help' # The prefix for module-wide routines
+OBJECTTYPE = OBJECTNAME + KIND # The C type used to represent them
+OBJECTPREFIX = MODPREFIX + 'Obj' # The prefix for object methods
+INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner
+OUTPUTFILE = MODNAME + "module.c" # The file generated by this program
+
+from macsupport import *
+
+# Create the type objects
+MenuRef = OpaqueByValueType("MenuRef", "MenuObj")
+MenuItemIndex = Type("MenuItemIndex", "H")
+
+#WindowPeek = OpaqueByValueType("WindowPeek", OBJECTPREFIX)
+
+#RgnHandle = FakeType("(RgnHandle)0")
+# XXXX Should be next, but this will break a lot of code...
+# RgnHandle = OpaqueByValueType("RgnHandle", "OptResObj")
+
+#KeyMap = ArrayOutputBufferType("KeyMap")
+##MacOSEventKind = Type("MacOSEventKind", "h") # Old-style
+##MacOSEventMask = Type("MacOSEventMask", "h") # Old-style
+#EventMask = Type("EventMask", "H")
+#EventKind = Type("EventKind", "H")
+
+includestuff = includestuff + """
+#include <Carbon/Carbon.h>
+"""
+
+class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
+ def outputCheckNewArg(self):
+ Output("if (itself == NULL) return PyMac_Error(resNotFound);")
+ def outputCheckConvertArg(self):
+ OutLbrace("if (DlgObj_Check(v))")
+ Output("*p_itself = ((WindowObject *)v)->ob_itself;")
+ Output("return 1;")
+ OutRbrace()
+ Out("""
+ if (v == Py_None) { *p_itself = NULL; return 1; }
+ if (PyInt_Check(v)) { *p_itself = (WindowPtr)PyInt_AsLong(v); return 1; }
+ """)
+
+# From here on it's basically all boiler plate...
+
+# Create the generator groups and link them
+module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff)
+##object = MyObjectDefinition(OBJECTNAME, OBJECTPREFIX, OBJECTTYPE)
+##module.addobject(object)
+
+# Create the generator classes used to populate the lists
+Function = OSErrFunctionGenerator
+##Method = OSErrMethodGenerator
+
+# Create and populate the lists
+functions = []
+##methods = []
+execfile(INPUTFILE)
+
+# add the populated lists to the generator groups
+# (in a different wordl the scan program would generate this)
+for f in functions: module.add(f)
+##for f in methods: object.add(f)
+
+# generate output (open the output file as late as possible)
+SetOutputFileName(OUTPUTFILE)
+module.generate()
diff --git a/Mac/Modules/ibcarbon/IBCarbonscan.py b/Mac/Modules/ibcarbon/IBCarbonscan.py
new file mode 100644
index 0000000000..f71f864e03
--- /dev/null
+++ b/Mac/Modules/ibcarbon/IBCarbonscan.py
@@ -0,0 +1,47 @@
+# IBCarbonscan.py
+
+import sys
+
+from bgenlocations import TOOLBOXDIR, BGENDIR
+sys.path.append(BGENDIR)
+
+from scantools import Scanner_OSX
+
+def main():
+ print "---Scanning IBCarbonRuntime.h---"
+ input = ["IBCarbonRuntime.h"]
+ output = "IBCarbongen.py"
+ defsoutput = TOOLBOXDIR + "IBCarbonRuntime.py"
+ scanner = IBCarbon_Scanner(input, output, defsoutput)
+ scanner.scan()
+ scanner.close()
+ print "=== Testing definitions output code ==="
+ execfile(defsoutput, {}, {})
+ print "--done scanning, importing--"
+ import IBCarbonsupport
+ print "done"
+
+class IBCarbon_Scanner(Scanner_OSX):
+
+ def destination(self, type, name, arglist):
+ classname = "IBCarbonFunction"
+ listname = "functions"
+ if arglist:
+ t, n, m = arglist[0]
+ if t == "IBNibRef" and m == "InMode":
+ classname = "IBCarbonMethod"
+ listname = "methods"
+ return classname, listname
+
+ def makeblacklistnames(self):
+ return [
+ "DisposeNibReference", # taken care of by destructor
+ "CreateNibReferenceWithCFBundle", ## need to wrap CFBundle.h properly first
+ ]
+
+ def makerepairinstructions(self):
+ return []
+
+
+if __name__ == "__main__":
+ main()
diff --git a/Mac/Modules/ibcarbon/IBCarbonsupport.py b/Mac/Modules/ibcarbon/IBCarbonsupport.py
new file mode 100644
index 0000000000..5f4132840e
--- /dev/null
+++ b/Mac/Modules/ibcarbon/IBCarbonsupport.py
@@ -0,0 +1,51 @@
+# IBCarbonsupport.py
+
+from macsupport import *
+
+IBNibRef = OpaqueByValueType('IBNibRef', 'IBNibRefObj')
+#CFBundleRef = OpaqueByValueType('CFBundleRef')
+
+IBCarbonFunction = OSErrFunctionGenerator
+IBCarbonMethod = OSErrMethodGenerator
+
+includestuff = """
+#include <Carbon/Carbon.h>
+#include "pymactoolbox.h"
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern int _CFStringRefObj_Convert(PyObject *, CFStringRef *);
+#endif
+
+"""
+
+initstuff = """
+
+"""
+
+module = MacModule('_IBCarbon', 'IBCarbon', includestuff, finalstuff, initstuff)
+
+class CFReleaserObject(PEP253Mixin, GlobalObjectDefinition):
+ def outputFreeIt(self, name):
+ Output("CFRelease(%s);" % name)
+
+class CFNibDesc(PEP253Mixin, GlobalObjectDefinition):
+ def outputFreeIt(self, name):
+ Output("DisposeNibReference(%s);" % name)
+
+#cfstringobject = CFReleaserObject("CFStringRef")
+#module.addobject(cfstringobject)
+#cfbundleobject = CFReleaserObject("CFBundleRef")
+#module.addobject(cfbundleobject)
+ibnibobject = CFNibDesc("IBNibRef", "IBNibRefObj")
+module.addobject(ibnibobject)
+
+functions = []
+methods = []
+
+execfile('IBCarbongen.py')
+
+for f in functions: module.add(f)
+for m in methods: ibnibobject.add(m)
+
+SetOutputFileName('_IBCarbon.c')
+module.generate()
diff --git a/Mac/Modules/ibcarbon/_IBCarbon.c b/Mac/Modules/ibcarbon/_IBCarbon.c
new file mode 100644
index 0000000000..2a65f42b33
--- /dev/null
+++ b/Mac/Modules/ibcarbon/_IBCarbon.c
@@ -0,0 +1,270 @@
+
+/* ======================== Module _IBCarbon ======================== */
+
+#include "Python.h"
+
+
+#ifndef __LP64__
+
+#include <Carbon/Carbon.h>
+#include "pymactoolbox.h"
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern int _CFStringRefObj_Convert(PyObject *, CFStringRef *);
+#endif
+
+
+static PyObject *IBCarbon_Error;
+
+/* ---------------------- Object type IBNibRef ---------------------- */
+
+PyTypeObject IBNibRef_Type;
+
+#define IBNibRefObj_Check(x) ((x)->ob_type == &IBNibRef_Type || PyObject_TypeCheck((x), &IBNibRef_Type))
+
+typedef struct IBNibRefObject {
+ PyObject_HEAD
+ IBNibRef ob_itself;
+} IBNibRefObject;
+
+PyObject *IBNibRefObj_New(IBNibRef itself)
+{
+ IBNibRefObject *it;
+ it = PyObject_NEW(IBNibRefObject, &IBNibRef_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+
+int IBNibRefObj_Convert(PyObject *v, IBNibRef *p_itself)
+{
+ if (!IBNibRefObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "IBNibRef required");
+ return 0;
+ }
+ *p_itself = ((IBNibRefObject *)v)->ob_itself;
+ return 1;
+}
+
+static void IBNibRefObj_dealloc(IBNibRefObject *self)
+{
+ DisposeNibReference(self->ob_itself);
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *IBNibRefObj_CreateWindowFromNib(IBNibRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ CFStringRef inName;
+ WindowPtr outWindow;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFStringRefObj_Convert, &inName))
+ return NULL;
+ _err = CreateWindowFromNib(_self->ob_itself,
+ inName,
+ &outWindow);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ WinObj_New, outWindow);
+ return _res;
+}
+
+static PyObject *IBNibRefObj_CreateMenuFromNib(IBNibRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ CFStringRef inName;
+ MenuHandle outMenuRef;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFStringRefObj_Convert, &inName))
+ return NULL;
+ _err = CreateMenuFromNib(_self->ob_itself,
+ inName,
+ &outMenuRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ MenuObj_New, outMenuRef);
+ return _res;
+}
+
+static PyObject *IBNibRefObj_CreateMenuBarFromNib(IBNibRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ CFStringRef inName;
+ Handle outMenuBar;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFStringRefObj_Convert, &inName))
+ return NULL;
+ _err = CreateMenuBarFromNib(_self->ob_itself,
+ inName,
+ &outMenuBar);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, outMenuBar);
+ return _res;
+}
+
+static PyObject *IBNibRefObj_SetMenuBarFromNib(IBNibRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ CFStringRef inName;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFStringRefObj_Convert, &inName))
+ return NULL;
+ _err = SetMenuBarFromNib(_self->ob_itself,
+ inName);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyMethodDef IBNibRefObj_methods[] = {
+ {"CreateWindowFromNib", (PyCFunction)IBNibRefObj_CreateWindowFromNib, 1,
+ PyDoc_STR("(CFStringRef inName) -> (WindowPtr outWindow)")},
+ {"CreateMenuFromNib", (PyCFunction)IBNibRefObj_CreateMenuFromNib, 1,
+ PyDoc_STR("(CFStringRef inName) -> (MenuHandle outMenuRef)")},
+ {"CreateMenuBarFromNib", (PyCFunction)IBNibRefObj_CreateMenuBarFromNib, 1,
+ PyDoc_STR("(CFStringRef inName) -> (Handle outMenuBar)")},
+ {"SetMenuBarFromNib", (PyCFunction)IBNibRefObj_SetMenuBarFromNib, 1,
+ PyDoc_STR("(CFStringRef inName) -> None")},
+ {NULL, NULL, 0}
+};
+
+#define IBNibRefObj_getsetlist NULL
+
+
+#define IBNibRefObj_compare NULL
+
+#define IBNibRefObj_repr NULL
+
+#define IBNibRefObj_hash NULL
+#define IBNibRefObj_tp_init 0
+
+#define IBNibRefObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *IBNibRefObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *_self;
+ IBNibRef itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, IBNibRefObj_Convert, &itself)) return NULL;
+ if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((IBNibRefObject *)_self)->ob_itself = itself;
+ return _self;
+}
+
+#define IBNibRefObj_tp_free PyObject_Del
+
+
+PyTypeObject IBNibRef_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_IBCarbon.IBNibRef", /*tp_name*/
+ sizeof(IBNibRefObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) IBNibRefObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) IBNibRefObj_compare, /*tp_compare*/
+ (reprfunc) IBNibRefObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) IBNibRefObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ IBNibRefObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ IBNibRefObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ IBNibRefObj_tp_init, /* tp_init */
+ IBNibRefObj_tp_alloc, /* tp_alloc */
+ IBNibRefObj_tp_new, /* tp_new */
+ IBNibRefObj_tp_free, /* tp_free */
+};
+
+/* -------------------- End object type IBNibRef -------------------- */
+
+
+static PyObject *IBCarbon_CreateNibReference(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ CFStringRef inNibName;
+ IBNibRef outNibRef;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFStringRefObj_Convert, &inNibName))
+ return NULL;
+ _err = CreateNibReference(inNibName,
+ &outNibRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ 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}
+};
+
+
+
+
+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 ||
+ PyDict_SetItemString(d, "Error", IBCarbon_Error) != 0)
+ return;
+ IBNibRef_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&IBNibRef_Type) < 0) return;
+ Py_INCREF(&IBNibRef_Type);
+ PyModule_AddObject(m, "IBNibRef", (PyObject *)&IBNibRef_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&IBNibRef_Type);
+ PyModule_AddObject(m, "IBNibRefType", (PyObject *)&IBNibRef_Type);
+#endif /* __LP64__ */
+}
+
+/* ====================== End module _IBCarbon ====================== */
+
diff --git a/Mac/Modules/icgluemodule.c b/Mac/Modules/icgluemodule.c
new file mode 100644
index 0000000000..4d17bf7841
--- /dev/null
+++ b/Mac/Modules/icgluemodule.c
@@ -0,0 +1,478 @@
+/***********************************************************
+Copyright 1991-1997 by Stichting Mathematisch Centrum, Amsterdam,
+The Netherlands.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of Stichting Mathematisch
+Centrum or CWI or Corporation for National Research Initiatives or
+CNRI not be used in advertising or publicity pertaining to
+distribution of the software without specific, written prior
+permission.
+
+While CWI is the initial source for this software, a modified version
+is made available by the Corporation for National Research Initiatives
+(CNRI) at the Internet address ftp://ftp.python.org.
+
+STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
+REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
+CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+
+******************************************************************/
+
+#include "Python.h"
+#include "pymactoolbox.h"
+
+extern int ResObj_Convert(PyObject *, Handle *); /* From Resmodule.c */
+
+#include <Carbon/Carbon.h>
+
+static PyObject *ErrorObject;
+
+/* ----------------------------------------------------- */
+
+/* Declarations for objects of type ic_instance */
+
+typedef struct {
+ PyObject_HEAD
+ ICInstance inst;
+} iciobject;
+
+static PyTypeObject Icitype;
+
+
+
+/* ---------------------------------------------------------------- */
+
+
+static char ici_ICGetSeed__doc__[] =
+"()->int; Returns int that changes when configuration does"
+;
+
+static PyObject *
+ici_ICGetSeed(iciobject *self, PyObject *args)
+{
+ OSStatus err;
+ long seed;
+
+ if (!PyArg_ParseTuple(args, ""))
+ return NULL;
+ if ((err=ICGetSeed(self->inst, &seed)) != 0 )
+ return PyMac_Error(err);
+ return Py_BuildValue("i", (int)seed);
+}
+
+
+static char ici_ICBegin__doc__[] =
+"(perm)->None; Lock config file for read/write"
+;
+
+static PyObject *
+ici_ICBegin(iciobject *self, PyObject *args)
+{
+ OSStatus err;
+ int perm;
+
+ if (!PyArg_ParseTuple(args, "i", &perm))
+ return NULL;
+ if ((err=ICBegin(self->inst, (ICPerm)perm)) != 0 )
+ return PyMac_Error(err);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+
+static char ici_ICFindPrefHandle__doc__[] =
+"(key, handle)->attrs; Lookup key, store result in handle, return attributes"
+;
+
+static PyObject *
+ici_ICFindPrefHandle(iciobject *self, PyObject *args)
+{
+ OSStatus err;
+ Str255 key;
+ ICAttr attr;
+ Handle h;
+
+ if (!PyArg_ParseTuple(args, "O&O&", PyMac_GetStr255, &key, ResObj_Convert, &h))
+ return NULL;
+ if ((err=ICFindPrefHandle(self->inst, key, &attr, h)) != 0 )
+ return PyMac_Error(err);
+ return Py_BuildValue("i", (int)attr);
+}
+
+
+static char ici_ICSetPref__doc__[] =
+"(key, attr, data)->None; Set preference key to data with attributes"
+;
+
+static PyObject *
+ici_ICSetPref(iciobject *self, PyObject *args)
+{
+ OSStatus err;
+ Str255 key;
+ int attr;
+ char *data;
+ int datalen;
+
+ if (!PyArg_ParseTuple(args, "O&is#", PyMac_GetStr255, &key, &attr,
+ &data, &datalen))
+ return NULL;
+ if ((err=ICSetPref(self->inst, key, (ICAttr)attr, (Ptr)data,
+ (long)datalen)) != 0)
+ return PyMac_Error(err);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+
+static char ici_ICCountPref__doc__[] =
+"()->int; Return number of preferences"
+;
+
+static PyObject *
+ici_ICCountPref(iciobject *self, PyObject *args)
+{
+ OSStatus err;
+ long count;
+
+ if (!PyArg_ParseTuple(args, ""))
+ return NULL;
+ if ((err=ICCountPref(self->inst, &count)) != 0 )
+ return PyMac_Error(err);
+ return Py_BuildValue("i", (int)count);
+}
+
+
+static char ici_ICGetIndPref__doc__[] =
+"(num)->key; Return key of preference with given index"
+;
+
+static PyObject *
+ici_ICGetIndPref(iciobject *self, PyObject *args)
+{
+ OSStatus err;
+ long num;
+ Str255 key;
+
+ if (!PyArg_ParseTuple(args, "l", &num))
+ return NULL;
+ if ((err=ICGetIndPref(self->inst, num, key)) != 0 )
+ return PyMac_Error(err);
+ return Py_BuildValue("O&", PyMac_BuildStr255, key);
+}
+
+
+static char ici_ICDeletePref__doc__[] =
+"(key)->None; Delete preference"
+;
+
+static PyObject *
+ici_ICDeletePref(iciobject *self, PyObject *args)
+{
+ OSStatus err;
+ Str255 key;
+
+ if (!PyArg_ParseTuple(args, "O&", PyMac_GetStr255, key))
+ return NULL;
+ if ((err=ICDeletePref(self->inst, key)) != 0 )
+ return PyMac_Error(err);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+
+static char ici_ICEnd__doc__[] =
+"()->None; Unlock file after ICBegin call"
+;
+
+static PyObject *
+ici_ICEnd(iciobject *self, PyObject *args)
+{
+ OSStatus err;
+
+ if (!PyArg_ParseTuple(args, ""))
+ return NULL;
+ if ((err=ICEnd(self->inst)) != 0 )
+ return PyMac_Error(err);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+
+static char ici_ICEditPreferences__doc__[] =
+"(key)->None; Ask user to edit preferences, staring with key"
+;
+
+static PyObject *
+ici_ICEditPreferences(iciobject *self, PyObject *args)
+{
+ OSStatus err;
+ Str255 key;
+
+ if (!PyArg_ParseTuple(args, "O&", PyMac_GetStr255, key))
+ return NULL;
+ if ((err=ICEditPreferences(self->inst, key)) != 0 )
+ return PyMac_Error(err);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+
+static char ici_ICParseURL__doc__[] =
+"(hint, data, selStart, selEnd, handle)->selStart, selEnd; Find an URL, return in handle"
+;
+
+static PyObject *
+ici_ICParseURL(iciobject *self, PyObject *args)
+{
+ OSStatus err;
+ Str255 hint;
+ char *data;
+ int datalen;
+ long selStart, selEnd;
+ Handle h;
+
+ if (!PyArg_ParseTuple(args, "O&s#llO&", PyMac_GetStr255, hint, &data, &datalen,
+ &selStart, &selEnd, ResObj_Convert, &h))
+ return NULL;
+ if ((err=ICParseURL(self->inst, hint, (Ptr)data, (long)datalen,
+ &selStart, &selEnd, h)) != 0 )
+ return PyMac_Error(err);
+ return Py_BuildValue("ii", (int)selStart, (int)selEnd);
+}
+
+
+static char ici_ICLaunchURL__doc__[] =
+"(hint, data, selStart, selEnd)->None; Find an URL and launch the correct app"
+;
+
+static PyObject *
+ici_ICLaunchURL(iciobject *self, PyObject *args)
+{
+ OSStatus err;
+ Str255 hint;
+ char *data;
+ int datalen;
+ long selStart, selEnd;
+
+ if (!PyArg_ParseTuple(args, "O&s#ll", PyMac_GetStr255, hint, &data, &datalen,
+ &selStart, &selEnd))
+ return NULL;
+ if ((err=ICLaunchURL(self->inst, hint, (Ptr)data, (long)datalen,
+ &selStart, &selEnd)) != 0 )
+ return PyMac_Error(err);
+ return Py_BuildValue("ii", (int)selStart, (int)selEnd);
+}
+
+
+static char ici_ICMapFilename__doc__[] =
+"(filename)->mapinfo; Get filemap info for given filename"
+;
+
+static PyObject *
+ici_ICMapFilename(iciobject *self, PyObject *args)
+{
+ OSStatus err;
+ Str255 filename;
+ ICMapEntry entry;
+
+ if (!PyArg_ParseTuple(args, "O&", PyMac_GetStr255, filename))
+ return NULL;
+ if ((err=ICMapFilename(self->inst, filename, &entry)) != 0 )
+ return PyMac_Error(err);
+ return Py_BuildValue("hO&O&O&lO&O&O&O&O&", entry.version,
+ PyMac_BuildOSType, entry.fileType,
+ PyMac_BuildOSType, entry.fileCreator,
+ PyMac_BuildOSType, entry.postCreator,
+ entry.flags,
+ PyMac_BuildStr255, entry.extension,
+ PyMac_BuildStr255, entry.creatorAppName,
+ PyMac_BuildStr255, entry.postAppName,
+ PyMac_BuildStr255, entry.MIMEType,
+ PyMac_BuildStr255, entry.entryName);
+}
+
+
+static char ici_ICMapTypeCreator__doc__[] =
+"(type, creator, filename)->mapinfo; Get filemap info for given tp/cr/filename"
+;
+
+static PyObject *
+ici_ICMapTypeCreator(iciobject *self, PyObject *args)
+{
+ OSStatus err;
+ OSType type, creator;
+ Str255 filename;
+ ICMapEntry entry;
+
+ if (!PyArg_ParseTuple(args, "O&O&O&",
+ PyMac_GetOSType, &type,
+ PyMac_GetOSType, &creator,
+ PyMac_GetStr255, filename))
+ return NULL;
+ if ((err=ICMapTypeCreator(self->inst, type, creator, filename, &entry)) != 0 )
+ return PyMac_Error(err);
+ return Py_BuildValue("hO&O&O&lO&O&O&O&O&", entry.version,
+ PyMac_BuildOSType, entry.fileType,
+ PyMac_BuildOSType, entry.fileCreator,
+ PyMac_BuildOSType, entry.postCreator,
+ entry.flags,
+ PyMac_BuildStr255, entry.extension,
+ PyMac_BuildStr255, entry.creatorAppName,
+ PyMac_BuildStr255, entry.postAppName,
+ PyMac_BuildStr255, entry.MIMEType,
+ PyMac_BuildStr255, entry.entryName);
+}
+
+
+static struct PyMethodDef ici_methods[] = {
+ {"ICGetSeed", (PyCFunction)ici_ICGetSeed, METH_VARARGS, ici_ICGetSeed__doc__},
+ {"ICBegin", (PyCFunction)ici_ICBegin, METH_VARARGS, ici_ICBegin__doc__},
+ {"ICFindPrefHandle", (PyCFunction)ici_ICFindPrefHandle, METH_VARARGS, ici_ICFindPrefHandle__doc__},
+ {"ICSetPref", (PyCFunction)ici_ICSetPref, METH_VARARGS, ici_ICSetPref__doc__},
+ {"ICCountPref", (PyCFunction)ici_ICCountPref, METH_VARARGS, ici_ICCountPref__doc__},
+ {"ICGetIndPref", (PyCFunction)ici_ICGetIndPref, METH_VARARGS, ici_ICGetIndPref__doc__},
+ {"ICDeletePref", (PyCFunction)ici_ICDeletePref, METH_VARARGS, ici_ICDeletePref__doc__},
+ {"ICEnd", (PyCFunction)ici_ICEnd, METH_VARARGS, ici_ICEnd__doc__},
+ {"ICEditPreferences", (PyCFunction)ici_ICEditPreferences, METH_VARARGS, ici_ICEditPreferences__doc__},
+ {"ICParseURL", (PyCFunction)ici_ICParseURL, METH_VARARGS, ici_ICParseURL__doc__},
+ {"ICLaunchURL", (PyCFunction)ici_ICLaunchURL, METH_VARARGS, ici_ICLaunchURL__doc__},
+ {"ICMapFilename", (PyCFunction)ici_ICMapFilename, METH_VARARGS, ici_ICMapFilename__doc__},
+ {"ICMapTypeCreator", (PyCFunction)ici_ICMapTypeCreator, METH_VARARGS, ici_ICMapTypeCreator__doc__},
+
+ {NULL, NULL} /* sentinel */
+};
+
+/* ---------- */
+
+
+static iciobject *
+newiciobject(OSType creator)
+{
+ iciobject *self;
+ OSStatus err;
+
+ self = PyObject_NEW(iciobject, &Icitype);
+ if (self == NULL)
+ return NULL;
+ if ((err=ICStart(&self->inst, creator)) != 0 ) {
+ (void)PyMac_Error(err);
+ PyObject_DEL(self);
+ return NULL;
+ }
+ return self;
+}
+
+
+static void
+ici_dealloc(iciobject *self)
+{
+ (void)ICStop(self->inst);
+ PyObject_DEL(self);
+}
+
+static PyObject *
+ici_getattr(iciobject *self, char *name)
+{
+ return Py_FindMethod(ici_methods, (PyObject *)self, name);
+}
+
+static char Icitype__doc__[] =
+"Internet Config instance"
+;
+
+static PyTypeObject Icitype = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "icglue.ic_instance", /*tp_name*/
+ sizeof(iciobject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor)ici_dealloc, /*tp_dealloc*/
+ (printfunc)0, /*tp_print*/
+ (getattrfunc)ici_getattr, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc)0, /*tp_compare*/
+ (reprfunc)0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ (hashfunc)0, /*tp_hash*/
+ (ternaryfunc)0, /*tp_call*/
+ (reprfunc)0, /*tp_str*/
+
+ /* Space for future expansion */
+ 0L,0L,0L,0L,
+ Icitype__doc__ /* Documentation string */
+};
+
+/* End of code for ic_instance objects */
+/* -------------------------------------------------------- */
+
+
+static char ic_ICStart__doc__[] =
+"(OSType)->ic_instance; Create an Internet Config instance"
+;
+
+static PyObject *
+ic_ICStart(PyObject *self, PyObject *args)
+{
+ OSType creator;
+
+ if (!PyArg_ParseTuple(args, "O&", PyMac_GetOSType, &creator))
+ return NULL;
+ return (PyObject *)newiciobject(creator);
+}
+
+/* List of methods defined in the module */
+
+static struct PyMethodDef ic_methods[] = {
+ {"ICStart", (PyCFunction)ic_ICStart, METH_VARARGS, ic_ICStart__doc__},
+
+ {NULL, (PyCFunction)NULL, 0, NULL} /* sentinel */
+};
+
+
+/* Initialization function for the module (*must* be called initicglue) */
+
+static char icglue_module_documentation[] =
+"Implements low-level Internet Config interface"
+;
+
+void
+initicglue(void)
+{
+ PyObject *m, *d;
+
+ if (PyErr_WarnPy3k("In 3.x, the icglue module is removed.", 1))
+ return;
+
+ /* Create the module and add the functions */
+ m = Py_InitModule4("icglue", ic_methods,
+ icglue_module_documentation,
+ (PyObject*)NULL,PYTHON_API_VERSION);
+
+ /* Add some symbolic constants to the module */
+ d = PyModule_GetDict(m);
+ ErrorObject = PyMac_GetOSErrException();
+ if (ErrorObject == NULL ||
+ PyDict_SetItemString(d, "error", ErrorObject) != 0)
+ return;
+
+ /* XXXX Add constants here */
+
+ /* Check for errors */
+ if (PyErr_Occurred())
+ Py_FatalError("can't initialize module icglue");
+}
+
diff --git a/Mac/Modules/icn/_Icnmodule.c b/Mac/Modules/icn/_Icnmodule.c
new file mode 100644
index 0000000000..6967ae4019
--- /dev/null
+++ b/Mac/Modules/icn/_Icnmodule.c
@@ -0,0 +1,1607 @@
+
+/* ========================== Module _Icn =========================== */
+
+#include "Python.h"
+
+
+#ifndef __LP64__
+
+#include "pymactoolbox.h"
+
+/* Macro to test whether a weak-loaded CFM function exists */
+#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
+ PyErr_SetString(PyExc_NotImplementedError, \
+ "Not available in this shared library/OS version"); \
+ return NULL; \
+ }} while(0)
+
+
+#include <Carbon/Carbon.h>
+
+
+static PyObject *Icn_Error;
+
+static PyObject *Icn_GetCIcon(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CIconHandle _rv;
+ SInt16 iconID;
+#ifndef GetCIcon
+ PyMac_PRECHECK(GetCIcon);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &iconID))
+ return NULL;
+ _rv = GetCIcon(iconID);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Icn_PlotCIcon(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect theRect;
+ CIconHandle theIcon;
+#ifndef PlotCIcon
+ PyMac_PRECHECK(PlotCIcon);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetRect, &theRect,
+ ResObj_Convert, &theIcon))
+ return NULL;
+ PlotCIcon(&theRect,
+ theIcon);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_DisposeCIcon(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CIconHandle theIcon;
+#ifndef DisposeCIcon
+ PyMac_PRECHECK(DisposeCIcon);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &theIcon))
+ return NULL;
+ DisposeCIcon(theIcon);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_GetIcon(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+ SInt16 iconID;
+#ifndef GetIcon
+ PyMac_PRECHECK(GetIcon);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &iconID))
+ return NULL;
+ _rv = GetIcon(iconID);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Icn_PlotIcon(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect theRect;
+ Handle theIcon;
+#ifndef PlotIcon
+ PyMac_PRECHECK(PlotIcon);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetRect, &theRect,
+ ResObj_Convert, &theIcon))
+ return NULL;
+ PlotIcon(&theRect,
+ theIcon);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_PlotIconID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Rect theRect;
+ IconAlignmentType align;
+ IconTransformType transform;
+ SInt16 theResID;
+#ifndef PlotIconID
+ PyMac_PRECHECK(PlotIconID);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hhh",
+ PyMac_GetRect, &theRect,
+ &align,
+ &transform,
+ &theResID))
+ return NULL;
+ _err = PlotIconID(&theRect,
+ align,
+ transform,
+ theResID);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_NewIconSuite(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconSuiteRef theIconSuite;
+#ifndef NewIconSuite
+ PyMac_PRECHECK(NewIconSuite);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = NewIconSuite(&theIconSuite);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, theIconSuite);
+ return _res;
+}
+
+static PyObject *Icn_AddIconToSuite(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle theIconData;
+ IconSuiteRef theSuite;
+ ResType theType;
+#ifndef AddIconToSuite
+ PyMac_PRECHECK(AddIconToSuite);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ ResObj_Convert, &theIconData,
+ ResObj_Convert, &theSuite,
+ PyMac_GetOSType, &theType))
+ return NULL;
+ _err = AddIconToSuite(theIconData,
+ theSuite,
+ theType);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_GetIconFromSuite(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle theIconData;
+ IconSuiteRef theSuite;
+ ResType theType;
+#ifndef GetIconFromSuite
+ PyMac_PRECHECK(GetIconFromSuite);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &theSuite,
+ PyMac_GetOSType, &theType))
+ return NULL;
+ _err = GetIconFromSuite(&theIconData,
+ theSuite,
+ theType);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, theIconData);
+ return _res;
+}
+
+static PyObject *Icn_GetIconSuite(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconSuiteRef theIconSuite;
+ SInt16 theResID;
+ IconSelectorValue selector;
+#ifndef GetIconSuite
+ PyMac_PRECHECK(GetIconSuite);
+#endif
+ if (!PyArg_ParseTuple(_args, "hl",
+ &theResID,
+ &selector))
+ return NULL;
+ _err = GetIconSuite(&theIconSuite,
+ theResID,
+ selector);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, theIconSuite);
+ return _res;
+}
+
+static PyObject *Icn_DisposeIconSuite(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconSuiteRef theIconSuite;
+ Boolean disposeData;
+#ifndef DisposeIconSuite
+ PyMac_PRECHECK(DisposeIconSuite);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&b",
+ ResObj_Convert, &theIconSuite,
+ &disposeData))
+ return NULL;
+ _err = DisposeIconSuite(theIconSuite,
+ disposeData);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_PlotIconSuite(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Rect theRect;
+ IconAlignmentType align;
+ IconTransformType transform;
+ IconSuiteRef theIconSuite;
+#ifndef PlotIconSuite
+ PyMac_PRECHECK(PlotIconSuite);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hhO&",
+ PyMac_GetRect, &theRect,
+ &align,
+ &transform,
+ ResObj_Convert, &theIconSuite))
+ return NULL;
+ _err = PlotIconSuite(&theRect,
+ align,
+ transform,
+ theIconSuite);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_LoadIconCache(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Rect theRect;
+ IconAlignmentType align;
+ IconTransformType transform;
+ IconCacheRef theIconCache;
+#ifndef LoadIconCache
+ PyMac_PRECHECK(LoadIconCache);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hhO&",
+ PyMac_GetRect, &theRect,
+ &align,
+ &transform,
+ ResObj_Convert, &theIconCache))
+ return NULL;
+ _err = LoadIconCache(&theRect,
+ align,
+ transform,
+ theIconCache);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_GetLabel(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 labelNumber;
+ RGBColor labelColor;
+ Str255 labelString;
+#ifndef GetLabel
+ PyMac_PRECHECK(GetLabel);
+#endif
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &labelNumber,
+ PyMac_GetStr255, labelString))
+ return NULL;
+ _err = GetLabel(labelNumber,
+ &labelColor,
+ labelString);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ QdRGB_New, &labelColor);
+ return _res;
+}
+
+static PyObject *Icn_PtInIconID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Point testPt;
+ Rect iconRect;
+ IconAlignmentType align;
+ SInt16 iconID;
+#ifndef PtInIconID
+ PyMac_PRECHECK(PtInIconID);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&hh",
+ PyMac_GetPoint, &testPt,
+ PyMac_GetRect, &iconRect,
+ &align,
+ &iconID))
+ return NULL;
+ _rv = PtInIconID(testPt,
+ &iconRect,
+ align,
+ iconID);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Icn_PtInIconSuite(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Point testPt;
+ Rect iconRect;
+ IconAlignmentType align;
+ IconSuiteRef theIconSuite;
+#ifndef PtInIconSuite
+ PyMac_PRECHECK(PtInIconSuite);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&hO&",
+ PyMac_GetPoint, &testPt,
+ PyMac_GetRect, &iconRect,
+ &align,
+ ResObj_Convert, &theIconSuite))
+ return NULL;
+ _rv = PtInIconSuite(testPt,
+ &iconRect,
+ align,
+ theIconSuite);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Icn_RectInIconID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Rect testRect;
+ Rect iconRect;
+ IconAlignmentType align;
+ SInt16 iconID;
+#ifndef RectInIconID
+ PyMac_PRECHECK(RectInIconID);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&hh",
+ PyMac_GetRect, &testRect,
+ PyMac_GetRect, &iconRect,
+ &align,
+ &iconID))
+ return NULL;
+ _rv = RectInIconID(&testRect,
+ &iconRect,
+ align,
+ iconID);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Icn_RectInIconSuite(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Rect testRect;
+ Rect iconRect;
+ IconAlignmentType align;
+ IconSuiteRef theIconSuite;
+#ifndef RectInIconSuite
+ PyMac_PRECHECK(RectInIconSuite);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&hO&",
+ PyMac_GetRect, &testRect,
+ PyMac_GetRect, &iconRect,
+ &align,
+ ResObj_Convert, &theIconSuite))
+ return NULL;
+ _rv = RectInIconSuite(&testRect,
+ &iconRect,
+ align,
+ theIconSuite);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Icn_IconIDToRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ RgnHandle theRgn;
+ Rect iconRect;
+ IconAlignmentType align;
+ SInt16 iconID;
+#ifndef IconIDToRgn
+ PyMac_PRECHECK(IconIDToRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&hh",
+ ResObj_Convert, &theRgn,
+ PyMac_GetRect, &iconRect,
+ &align,
+ &iconID))
+ return NULL;
+ _err = IconIDToRgn(theRgn,
+ &iconRect,
+ align,
+ iconID);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_IconSuiteToRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ RgnHandle theRgn;
+ Rect iconRect;
+ IconAlignmentType align;
+ IconSuiteRef theIconSuite;
+#ifndef IconSuiteToRgn
+ PyMac_PRECHECK(IconSuiteToRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&hO&",
+ ResObj_Convert, &theRgn,
+ PyMac_GetRect, &iconRect,
+ &align,
+ ResObj_Convert, &theIconSuite))
+ return NULL;
+ _err = IconSuiteToRgn(theRgn,
+ &iconRect,
+ align,
+ theIconSuite);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_SetSuiteLabel(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconSuiteRef theSuite;
+ SInt16 theLabel;
+#ifndef SetSuiteLabel
+ PyMac_PRECHECK(SetSuiteLabel);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ ResObj_Convert, &theSuite,
+ &theLabel))
+ return NULL;
+ _err = SetSuiteLabel(theSuite,
+ theLabel);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_GetSuiteLabel(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 _rv;
+ IconSuiteRef theSuite;
+#ifndef GetSuiteLabel
+ PyMac_PRECHECK(GetSuiteLabel);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &theSuite))
+ return NULL;
+ _rv = GetSuiteLabel(theSuite);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Icn_PlotIconHandle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Rect theRect;
+ IconAlignmentType align;
+ IconTransformType transform;
+ Handle theIcon;
+#ifndef PlotIconHandle
+ PyMac_PRECHECK(PlotIconHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hhO&",
+ PyMac_GetRect, &theRect,
+ &align,
+ &transform,
+ ResObj_Convert, &theIcon))
+ return NULL;
+ _err = PlotIconHandle(&theRect,
+ align,
+ transform,
+ theIcon);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_PlotSICNHandle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Rect theRect;
+ IconAlignmentType align;
+ IconTransformType transform;
+ Handle theSICN;
+#ifndef PlotSICNHandle
+ PyMac_PRECHECK(PlotSICNHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hhO&",
+ PyMac_GetRect, &theRect,
+ &align,
+ &transform,
+ ResObj_Convert, &theSICN))
+ return NULL;
+ _err = PlotSICNHandle(&theRect,
+ align,
+ transform,
+ theSICN);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_PlotCIconHandle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Rect theRect;
+ IconAlignmentType align;
+ IconTransformType transform;
+ CIconHandle theCIcon;
+#ifndef PlotCIconHandle
+ PyMac_PRECHECK(PlotCIconHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hhO&",
+ PyMac_GetRect, &theRect,
+ &align,
+ &transform,
+ ResObj_Convert, &theCIcon))
+ return NULL;
+ _err = PlotCIconHandle(&theRect,
+ align,
+ transform,
+ theCIcon);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_IconRefToIconFamily(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconRef theIconRef;
+ IconSelectorValue whichIcons;
+ IconFamilyHandle iconFamily;
+#ifndef IconRefToIconFamily
+ PyMac_PRECHECK(IconRefToIconFamily);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ ResObj_Convert, &theIconRef,
+ &whichIcons))
+ return NULL;
+ _err = IconRefToIconFamily(theIconRef,
+ whichIcons,
+ &iconFamily);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, iconFamily);
+ return _res;
+}
+
+static PyObject *Icn_IconFamilyToIconSuite(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconFamilyHandle iconFamily;
+ IconSelectorValue whichIcons;
+ IconSuiteRef iconSuite;
+#ifndef IconFamilyToIconSuite
+ PyMac_PRECHECK(IconFamilyToIconSuite);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ ResObj_Convert, &iconFamily,
+ &whichIcons))
+ return NULL;
+ _err = IconFamilyToIconSuite(iconFamily,
+ whichIcons,
+ &iconSuite);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, iconSuite);
+ return _res;
+}
+
+static PyObject *Icn_IconSuiteToIconFamily(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconSuiteRef iconSuite;
+ IconSelectorValue whichIcons;
+ IconFamilyHandle iconFamily;
+#ifndef IconSuiteToIconFamily
+ PyMac_PRECHECK(IconSuiteToIconFamily);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ ResObj_Convert, &iconSuite,
+ &whichIcons))
+ return NULL;
+ _err = IconSuiteToIconFamily(iconSuite,
+ whichIcons,
+ &iconFamily);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, iconFamily);
+ return _res;
+}
+
+static PyObject *Icn_SetIconFamilyData(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconFamilyHandle iconFamily;
+ OSType iconType;
+ Handle h;
+#ifndef SetIconFamilyData
+ PyMac_PRECHECK(SetIconFamilyData);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ ResObj_Convert, &iconFamily,
+ PyMac_GetOSType, &iconType,
+ ResObj_Convert, &h))
+ return NULL;
+ _err = SetIconFamilyData(iconFamily,
+ iconType,
+ h);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_GetIconFamilyData(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconFamilyHandle iconFamily;
+ OSType iconType;
+ Handle h;
+#ifndef GetIconFamilyData
+ PyMac_PRECHECK(GetIconFamilyData);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ ResObj_Convert, &iconFamily,
+ PyMac_GetOSType, &iconType,
+ ResObj_Convert, &h))
+ return NULL;
+ _err = GetIconFamilyData(iconFamily,
+ iconType,
+ h);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_GetIconRefOwners(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconRef theIconRef;
+ UInt16 owners;
+#ifndef GetIconRefOwners
+ PyMac_PRECHECK(GetIconRefOwners);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &theIconRef))
+ return NULL;
+ _err = GetIconRefOwners(theIconRef,
+ &owners);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("H",
+ owners);
+ return _res;
+}
+
+static PyObject *Icn_AcquireIconRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconRef theIconRef;
+#ifndef AcquireIconRef
+ PyMac_PRECHECK(AcquireIconRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &theIconRef))
+ return NULL;
+ _err = AcquireIconRef(theIconRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_ReleaseIconRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconRef theIconRef;
+#ifndef ReleaseIconRef
+ PyMac_PRECHECK(ReleaseIconRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &theIconRef))
+ return NULL;
+ _err = ReleaseIconRef(theIconRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_GetIconRefFromFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSSpec theFile;
+ IconRef theIconRef;
+ SInt16 theLabel;
+#ifndef GetIconRefFromFile
+ PyMac_PRECHECK(GetIconRefFromFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetFSSpec, &theFile))
+ return NULL;
+ _err = GetIconRefFromFile(&theFile,
+ &theIconRef,
+ &theLabel);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&h",
+ ResObj_New, theIconRef,
+ theLabel);
+ return _res;
+}
+
+static PyObject *Icn_GetIconRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 vRefNum;
+ OSType creator;
+ OSType iconType;
+ IconRef theIconRef;
+#ifndef GetIconRef
+ PyMac_PRECHECK(GetIconRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "hO&O&",
+ &vRefNum,
+ PyMac_GetOSType, &creator,
+ PyMac_GetOSType, &iconType))
+ return NULL;
+ _err = GetIconRef(vRefNum,
+ creator,
+ iconType,
+ &theIconRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, theIconRef);
+ return _res;
+}
+
+static PyObject *Icn_GetIconRefFromFolder(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 vRefNum;
+ SInt32 parentFolderID;
+ SInt32 folderID;
+ SInt8 attributes;
+ SInt8 accessPrivileges;
+ IconRef theIconRef;
+#ifndef GetIconRefFromFolder
+ PyMac_PRECHECK(GetIconRefFromFolder);
+#endif
+ if (!PyArg_ParseTuple(_args, "hllbb",
+ &vRefNum,
+ &parentFolderID,
+ &folderID,
+ &attributes,
+ &accessPrivileges))
+ return NULL;
+ _err = GetIconRefFromFolder(vRefNum,
+ parentFolderID,
+ folderID,
+ attributes,
+ accessPrivileges,
+ &theIconRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, theIconRef);
+ return _res;
+}
+
+static PyObject *Icn_RegisterIconRefFromIconFamily(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType creator;
+ OSType iconType;
+ IconFamilyHandle iconFamily;
+ IconRef theIconRef;
+#ifndef RegisterIconRefFromIconFamily
+ PyMac_PRECHECK(RegisterIconRefFromIconFamily);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ PyMac_GetOSType, &creator,
+ PyMac_GetOSType, &iconType,
+ ResObj_Convert, &iconFamily))
+ return NULL;
+ _err = RegisterIconRefFromIconFamily(creator,
+ iconType,
+ iconFamily,
+ &theIconRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, theIconRef);
+ return _res;
+}
+
+static PyObject *Icn_RegisterIconRefFromResource(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType creator;
+ OSType iconType;
+ FSSpec resourceFile;
+ SInt16 resourceID;
+ IconRef theIconRef;
+#ifndef RegisterIconRefFromResource
+ PyMac_PRECHECK(RegisterIconRefFromResource);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&h",
+ PyMac_GetOSType, &creator,
+ PyMac_GetOSType, &iconType,
+ PyMac_GetFSSpec, &resourceFile,
+ &resourceID))
+ return NULL;
+ _err = RegisterIconRefFromResource(creator,
+ iconType,
+ &resourceFile,
+ resourceID,
+ &theIconRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, theIconRef);
+ return _res;
+}
+
+static PyObject *Icn_RegisterIconRefFromFSRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ OSType creator;
+ OSType iconType;
+ FSRef iconFile;
+ IconRef theIconRef;
+#ifndef RegisterIconRefFromFSRef
+ PyMac_PRECHECK(RegisterIconRefFromFSRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ PyMac_GetOSType, &creator,
+ PyMac_GetOSType, &iconType,
+ PyMac_GetFSRef, &iconFile))
+ return NULL;
+ _err = RegisterIconRefFromFSRef(creator,
+ iconType,
+ &iconFile,
+ &theIconRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, theIconRef);
+ return _res;
+}
+
+static PyObject *Icn_UnregisterIconRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType creator;
+ OSType iconType;
+#ifndef UnregisterIconRef
+ PyMac_PRECHECK(UnregisterIconRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &creator,
+ PyMac_GetOSType, &iconType))
+ return NULL;
+ _err = UnregisterIconRef(creator,
+ iconType);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_UpdateIconRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconRef theIconRef;
+#ifndef UpdateIconRef
+ PyMac_PRECHECK(UpdateIconRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &theIconRef))
+ return NULL;
+ _err = UpdateIconRef(theIconRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_OverrideIconRefFromResource(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconRef theIconRef;
+ FSSpec resourceFile;
+ SInt16 resourceID;
+#ifndef OverrideIconRefFromResource
+ PyMac_PRECHECK(OverrideIconRefFromResource);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&h",
+ ResObj_Convert, &theIconRef,
+ PyMac_GetFSSpec, &resourceFile,
+ &resourceID))
+ return NULL;
+ _err = OverrideIconRefFromResource(theIconRef,
+ &resourceFile,
+ resourceID);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_OverrideIconRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconRef oldIconRef;
+ IconRef newIconRef;
+#ifndef OverrideIconRef
+ PyMac_PRECHECK(OverrideIconRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &oldIconRef,
+ ResObj_Convert, &newIconRef))
+ return NULL;
+ _err = OverrideIconRef(oldIconRef,
+ newIconRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_RemoveIconRefOverride(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconRef theIconRef;
+#ifndef RemoveIconRefOverride
+ PyMac_PRECHECK(RemoveIconRefOverride);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &theIconRef))
+ return NULL;
+ _err = RemoveIconRefOverride(theIconRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_CompositeIconRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconRef backgroundIconRef;
+ IconRef foregroundIconRef;
+ IconRef compositeIconRef;
+#ifndef CompositeIconRef
+ PyMac_PRECHECK(CompositeIconRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &backgroundIconRef,
+ ResObj_Convert, &foregroundIconRef))
+ return NULL;
+ _err = CompositeIconRef(backgroundIconRef,
+ foregroundIconRef,
+ &compositeIconRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, compositeIconRef);
+ return _res;
+}
+
+static PyObject *Icn_IsIconRefComposite(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconRef compositeIconRef;
+ IconRef backgroundIconRef;
+ IconRef foregroundIconRef;
+#ifndef IsIconRefComposite
+ PyMac_PRECHECK(IsIconRefComposite);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &compositeIconRef))
+ return NULL;
+ _err = IsIconRefComposite(compositeIconRef,
+ &backgroundIconRef,
+ &foregroundIconRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&O&",
+ ResObj_New, backgroundIconRef,
+ ResObj_New, foregroundIconRef);
+ return _res;
+}
+
+static PyObject *Icn_IsValidIconRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ IconRef theIconRef;
+#ifndef IsValidIconRef
+ PyMac_PRECHECK(IsValidIconRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &theIconRef))
+ return NULL;
+ _rv = IsValidIconRef(theIconRef);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Icn_PlotIconRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Rect theRect;
+ IconAlignmentType align;
+ IconTransformType transform;
+ IconServicesUsageFlags theIconServicesUsageFlags;
+ IconRef theIconRef;
+#ifndef PlotIconRef
+ PyMac_PRECHECK(PlotIconRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hhlO&",
+ PyMac_GetRect, &theRect,
+ &align,
+ &transform,
+ &theIconServicesUsageFlags,
+ ResObj_Convert, &theIconRef))
+ return NULL;
+ _err = PlotIconRef(&theRect,
+ align,
+ transform,
+ theIconServicesUsageFlags,
+ theIconRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_PtInIconRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Point testPt;
+ Rect iconRect;
+ IconAlignmentType align;
+ IconServicesUsageFlags theIconServicesUsageFlags;
+ IconRef theIconRef;
+#ifndef PtInIconRef
+ PyMac_PRECHECK(PtInIconRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&hlO&",
+ PyMac_GetPoint, &testPt,
+ PyMac_GetRect, &iconRect,
+ &align,
+ &theIconServicesUsageFlags,
+ ResObj_Convert, &theIconRef))
+ return NULL;
+ _rv = PtInIconRef(&testPt,
+ &iconRect,
+ align,
+ theIconServicesUsageFlags,
+ theIconRef);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Icn_RectInIconRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Rect testRect;
+ Rect iconRect;
+ IconAlignmentType align;
+ IconServicesUsageFlags iconServicesUsageFlags;
+ IconRef theIconRef;
+#ifndef RectInIconRef
+ PyMac_PRECHECK(RectInIconRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&hlO&",
+ PyMac_GetRect, &testRect,
+ PyMac_GetRect, &iconRect,
+ &align,
+ &iconServicesUsageFlags,
+ ResObj_Convert, &theIconRef))
+ return NULL;
+ _rv = RectInIconRef(&testRect,
+ &iconRect,
+ align,
+ iconServicesUsageFlags,
+ theIconRef);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Icn_IconRefToRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ RgnHandle theRgn;
+ Rect iconRect;
+ IconAlignmentType align;
+ IconServicesUsageFlags iconServicesUsageFlags;
+ IconRef theIconRef;
+#ifndef IconRefToRgn
+ PyMac_PRECHECK(IconRefToRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&hlO&",
+ ResObj_Convert, &theRgn,
+ PyMac_GetRect, &iconRect,
+ &align,
+ &iconServicesUsageFlags,
+ ResObj_Convert, &theIconRef))
+ return NULL;
+ _err = IconRefToRgn(theRgn,
+ &iconRect,
+ align,
+ iconServicesUsageFlags,
+ theIconRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_GetIconSizesFromIconRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconSelectorValue iconSelectorInput;
+ IconSelectorValue iconSelectorOutputPtr;
+ IconServicesUsageFlags iconServicesUsageFlags;
+ IconRef theIconRef;
+#ifndef GetIconSizesFromIconRef
+ PyMac_PRECHECK(GetIconSizesFromIconRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "llO&",
+ &iconSelectorInput,
+ &iconServicesUsageFlags,
+ ResObj_Convert, &theIconRef))
+ return NULL;
+ _err = GetIconSizesFromIconRef(iconSelectorInput,
+ &iconSelectorOutputPtr,
+ iconServicesUsageFlags,
+ theIconRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ iconSelectorOutputPtr);
+ return _res;
+}
+
+static PyObject *Icn_FlushIconRefs(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType creator;
+ OSType iconType;
+#ifndef FlushIconRefs
+ PyMac_PRECHECK(FlushIconRefs);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &creator,
+ PyMac_GetOSType, &iconType))
+ return NULL;
+ _err = FlushIconRefs(creator,
+ iconType);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_FlushIconRefsByVolume(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 vRefNum;
+#ifndef FlushIconRefsByVolume
+ PyMac_PRECHECK(FlushIconRefsByVolume);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &vRefNum))
+ return NULL;
+ _err = FlushIconRefsByVolume(vRefNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_SetCustomIconsEnabled(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 vRefNum;
+ Boolean enableCustomIcons;
+#ifndef SetCustomIconsEnabled
+ PyMac_PRECHECK(SetCustomIconsEnabled);
+#endif
+ if (!PyArg_ParseTuple(_args, "hb",
+ &vRefNum,
+ &enableCustomIcons))
+ return NULL;
+ _err = SetCustomIconsEnabled(vRefNum,
+ enableCustomIcons);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_GetCustomIconsEnabled(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 vRefNum;
+ Boolean customIconsEnabled;
+#ifndef GetCustomIconsEnabled
+ PyMac_PRECHECK(GetCustomIconsEnabled);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &vRefNum))
+ return NULL;
+ _err = GetCustomIconsEnabled(vRefNum,
+ &customIconsEnabled);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("b",
+ customIconsEnabled);
+ return _res;
+}
+
+static PyObject *Icn_IsIconRefMaskEmpty(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ IconRef iconRef;
+#ifndef IsIconRefMaskEmpty
+ PyMac_PRECHECK(IsIconRefMaskEmpty);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &iconRef))
+ return NULL;
+ _rv = IsIconRefMaskEmpty(iconRef);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Icn_GetIconRefVariant(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ IconRef _rv;
+ IconRef inIconRef;
+ OSType inVariant;
+ IconTransformType outTransform;
+#ifndef GetIconRefVariant
+ PyMac_PRECHECK(GetIconRefVariant);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &inIconRef,
+ PyMac_GetOSType, &inVariant))
+ return NULL;
+ _rv = GetIconRefVariant(inIconRef,
+ inVariant,
+ &outTransform);
+ _res = Py_BuildValue("O&h",
+ ResObj_New, _rv,
+ outTransform);
+ return _res;
+}
+
+static PyObject *Icn_RegisterIconRefFromIconFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType creator;
+ OSType iconType;
+ FSSpec iconFile;
+ IconRef theIconRef;
+#ifndef RegisterIconRefFromIconFile
+ PyMac_PRECHECK(RegisterIconRefFromIconFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ PyMac_GetOSType, &creator,
+ PyMac_GetOSType, &iconType,
+ PyMac_GetFSSpec, &iconFile))
+ return NULL;
+ _err = RegisterIconRefFromIconFile(creator,
+ iconType,
+ &iconFile,
+ &theIconRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, theIconRef);
+ return _res;
+}
+
+static PyObject *Icn_ReadIconFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSSpec iconFile;
+ IconFamilyHandle iconFamily;
+#ifndef ReadIconFile
+ PyMac_PRECHECK(ReadIconFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetFSSpec, &iconFile))
+ return NULL;
+ _err = ReadIconFile(&iconFile,
+ &iconFamily);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, iconFamily);
+ return _res;
+}
+
+static PyObject *Icn_ReadIconFromFSRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ FSRef ref;
+ IconFamilyHandle iconFamily;
+#ifndef ReadIconFromFSRef
+ PyMac_PRECHECK(ReadIconFromFSRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetFSRef, &ref))
+ return NULL;
+ _err = ReadIconFromFSRef(&ref,
+ &iconFamily);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, iconFamily);
+ return _res;
+}
+
+static PyObject *Icn_WriteIconFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconFamilyHandle iconFamily;
+ FSSpec iconFile;
+#ifndef WriteIconFile
+ PyMac_PRECHECK(WriteIconFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &iconFamily,
+ PyMac_GetFSSpec, &iconFile))
+ return NULL;
+ _err = WriteIconFile(iconFamily,
+ &iconFile);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _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,
+ PyDoc_STR("(Rect theRect, CIconHandle theIcon) -> None")},
+ {"DisposeCIcon", (PyCFunction)Icn_DisposeCIcon, 1,
+ PyDoc_STR("(CIconHandle theIcon) -> None")},
+ {"GetIcon", (PyCFunction)Icn_GetIcon, 1,
+ PyDoc_STR("(SInt16 iconID) -> (Handle _rv)")},
+ {"PlotIcon", (PyCFunction)Icn_PlotIcon, 1,
+ PyDoc_STR("(Rect theRect, Handle theIcon) -> None")},
+ {"PlotIconID", (PyCFunction)Icn_PlotIconID, 1,
+ PyDoc_STR("(Rect theRect, IconAlignmentType align, IconTransformType transform, SInt16 theResID) -> None")},
+ {"NewIconSuite", (PyCFunction)Icn_NewIconSuite, 1,
+ PyDoc_STR("() -> (IconSuiteRef theIconSuite)")},
+ {"AddIconToSuite", (PyCFunction)Icn_AddIconToSuite, 1,
+ PyDoc_STR("(Handle theIconData, IconSuiteRef theSuite, ResType theType) -> None")},
+ {"GetIconFromSuite", (PyCFunction)Icn_GetIconFromSuite, 1,
+ PyDoc_STR("(IconSuiteRef theSuite, ResType theType) -> (Handle theIconData)")},
+ {"GetIconSuite", (PyCFunction)Icn_GetIconSuite, 1,
+ PyDoc_STR("(SInt16 theResID, IconSelectorValue selector) -> (IconSuiteRef theIconSuite)")},
+ {"DisposeIconSuite", (PyCFunction)Icn_DisposeIconSuite, 1,
+ PyDoc_STR("(IconSuiteRef theIconSuite, Boolean disposeData) -> None")},
+ {"PlotIconSuite", (PyCFunction)Icn_PlotIconSuite, 1,
+ PyDoc_STR("(Rect theRect, IconAlignmentType align, IconTransformType transform, IconSuiteRef theIconSuite) -> None")},
+ {"LoadIconCache", (PyCFunction)Icn_LoadIconCache, 1,
+ PyDoc_STR("(Rect theRect, IconAlignmentType align, IconTransformType transform, IconCacheRef theIconCache) -> None")},
+ {"GetLabel", (PyCFunction)Icn_GetLabel, 1,
+ PyDoc_STR("(SInt16 labelNumber, Str255 labelString) -> (RGBColor labelColor)")},
+ {"PtInIconID", (PyCFunction)Icn_PtInIconID, 1,
+ PyDoc_STR("(Point testPt, Rect iconRect, IconAlignmentType align, SInt16 iconID) -> (Boolean _rv)")},
+ {"PtInIconSuite", (PyCFunction)Icn_PtInIconSuite, 1,
+ PyDoc_STR("(Point testPt, Rect iconRect, IconAlignmentType align, IconSuiteRef theIconSuite) -> (Boolean _rv)")},
+ {"RectInIconID", (PyCFunction)Icn_RectInIconID, 1,
+ PyDoc_STR("(Rect testRect, Rect iconRect, IconAlignmentType align, SInt16 iconID) -> (Boolean _rv)")},
+ {"RectInIconSuite", (PyCFunction)Icn_RectInIconSuite, 1,
+ PyDoc_STR("(Rect testRect, Rect iconRect, IconAlignmentType align, IconSuiteRef theIconSuite) -> (Boolean _rv)")},
+ {"IconIDToRgn", (PyCFunction)Icn_IconIDToRgn, 1,
+ PyDoc_STR("(RgnHandle theRgn, Rect iconRect, IconAlignmentType align, SInt16 iconID) -> None")},
+ {"IconSuiteToRgn", (PyCFunction)Icn_IconSuiteToRgn, 1,
+ PyDoc_STR("(RgnHandle theRgn, Rect iconRect, IconAlignmentType align, IconSuiteRef theIconSuite) -> None")},
+ {"SetSuiteLabel", (PyCFunction)Icn_SetSuiteLabel, 1,
+ PyDoc_STR("(IconSuiteRef theSuite, SInt16 theLabel) -> None")},
+ {"GetSuiteLabel", (PyCFunction)Icn_GetSuiteLabel, 1,
+ PyDoc_STR("(IconSuiteRef theSuite) -> (SInt16 _rv)")},
+ {"PlotIconHandle", (PyCFunction)Icn_PlotIconHandle, 1,
+ PyDoc_STR("(Rect theRect, IconAlignmentType align, IconTransformType transform, Handle theIcon) -> None")},
+ {"PlotSICNHandle", (PyCFunction)Icn_PlotSICNHandle, 1,
+ PyDoc_STR("(Rect theRect, IconAlignmentType align, IconTransformType transform, Handle theSICN) -> None")},
+ {"PlotCIconHandle", (PyCFunction)Icn_PlotCIconHandle, 1,
+ PyDoc_STR("(Rect theRect, IconAlignmentType align, IconTransformType transform, CIconHandle theCIcon) -> None")},
+ {"IconRefToIconFamily", (PyCFunction)Icn_IconRefToIconFamily, 1,
+ PyDoc_STR("(IconRef theIconRef, IconSelectorValue whichIcons) -> (IconFamilyHandle iconFamily)")},
+ {"IconFamilyToIconSuite", (PyCFunction)Icn_IconFamilyToIconSuite, 1,
+ PyDoc_STR("(IconFamilyHandle iconFamily, IconSelectorValue whichIcons) -> (IconSuiteRef iconSuite)")},
+ {"IconSuiteToIconFamily", (PyCFunction)Icn_IconSuiteToIconFamily, 1,
+ PyDoc_STR("(IconSuiteRef iconSuite, IconSelectorValue whichIcons) -> (IconFamilyHandle iconFamily)")},
+ {"SetIconFamilyData", (PyCFunction)Icn_SetIconFamilyData, 1,
+ PyDoc_STR("(IconFamilyHandle iconFamily, OSType iconType, Handle h) -> None")},
+ {"GetIconFamilyData", (PyCFunction)Icn_GetIconFamilyData, 1,
+ PyDoc_STR("(IconFamilyHandle iconFamily, OSType iconType, Handle h) -> None")},
+ {"GetIconRefOwners", (PyCFunction)Icn_GetIconRefOwners, 1,
+ PyDoc_STR("(IconRef theIconRef) -> (UInt16 owners)")},
+ {"AcquireIconRef", (PyCFunction)Icn_AcquireIconRef, 1,
+ PyDoc_STR("(IconRef theIconRef) -> None")},
+ {"ReleaseIconRef", (PyCFunction)Icn_ReleaseIconRef, 1,
+ PyDoc_STR("(IconRef theIconRef) -> None")},
+ {"GetIconRefFromFile", (PyCFunction)Icn_GetIconRefFromFile, 1,
+ PyDoc_STR("(FSSpec theFile) -> (IconRef theIconRef, SInt16 theLabel)")},
+ {"GetIconRef", (PyCFunction)Icn_GetIconRef, 1,
+ PyDoc_STR("(SInt16 vRefNum, OSType creator, OSType iconType) -> (IconRef theIconRef)")},
+ {"GetIconRefFromFolder", (PyCFunction)Icn_GetIconRefFromFolder, 1,
+ PyDoc_STR("(SInt16 vRefNum, SInt32 parentFolderID, SInt32 folderID, SInt8 attributes, SInt8 accessPrivileges) -> (IconRef theIconRef)")},
+ {"RegisterIconRefFromIconFamily", (PyCFunction)Icn_RegisterIconRefFromIconFamily, 1,
+ PyDoc_STR("(OSType creator, OSType iconType, IconFamilyHandle iconFamily) -> (IconRef theIconRef)")},
+ {"RegisterIconRefFromResource", (PyCFunction)Icn_RegisterIconRefFromResource, 1,
+ PyDoc_STR("(OSType creator, OSType iconType, FSSpec resourceFile, SInt16 resourceID) -> (IconRef theIconRef)")},
+ {"RegisterIconRefFromFSRef", (PyCFunction)Icn_RegisterIconRefFromFSRef, 1,
+ PyDoc_STR("(OSType creator, OSType iconType, FSRef iconFile) -> (IconRef theIconRef)")},
+ {"UnregisterIconRef", (PyCFunction)Icn_UnregisterIconRef, 1,
+ PyDoc_STR("(OSType creator, OSType iconType) -> None")},
+ {"UpdateIconRef", (PyCFunction)Icn_UpdateIconRef, 1,
+ PyDoc_STR("(IconRef theIconRef) -> None")},
+ {"OverrideIconRefFromResource", (PyCFunction)Icn_OverrideIconRefFromResource, 1,
+ PyDoc_STR("(IconRef theIconRef, FSSpec resourceFile, SInt16 resourceID) -> None")},
+ {"OverrideIconRef", (PyCFunction)Icn_OverrideIconRef, 1,
+ PyDoc_STR("(IconRef oldIconRef, IconRef newIconRef) -> None")},
+ {"RemoveIconRefOverride", (PyCFunction)Icn_RemoveIconRefOverride, 1,
+ PyDoc_STR("(IconRef theIconRef) -> None")},
+ {"CompositeIconRef", (PyCFunction)Icn_CompositeIconRef, 1,
+ PyDoc_STR("(IconRef backgroundIconRef, IconRef foregroundIconRef) -> (IconRef compositeIconRef)")},
+ {"IsIconRefComposite", (PyCFunction)Icn_IsIconRefComposite, 1,
+ PyDoc_STR("(IconRef compositeIconRef) -> (IconRef backgroundIconRef, IconRef foregroundIconRef)")},
+ {"IsValidIconRef", (PyCFunction)Icn_IsValidIconRef, 1,
+ PyDoc_STR("(IconRef theIconRef) -> (Boolean _rv)")},
+ {"PlotIconRef", (PyCFunction)Icn_PlotIconRef, 1,
+ PyDoc_STR("(Rect theRect, IconAlignmentType align, IconTransformType transform, IconServicesUsageFlags theIconServicesUsageFlags, IconRef theIconRef) -> None")},
+ {"PtInIconRef", (PyCFunction)Icn_PtInIconRef, 1,
+ PyDoc_STR("(Point testPt, Rect iconRect, IconAlignmentType align, IconServicesUsageFlags theIconServicesUsageFlags, IconRef theIconRef) -> (Boolean _rv)")},
+ {"RectInIconRef", (PyCFunction)Icn_RectInIconRef, 1,
+ PyDoc_STR("(Rect testRect, Rect iconRect, IconAlignmentType align, IconServicesUsageFlags iconServicesUsageFlags, IconRef theIconRef) -> (Boolean _rv)")},
+ {"IconRefToRgn", (PyCFunction)Icn_IconRefToRgn, 1,
+ PyDoc_STR("(RgnHandle theRgn, Rect iconRect, IconAlignmentType align, IconServicesUsageFlags iconServicesUsageFlags, IconRef theIconRef) -> None")},
+ {"GetIconSizesFromIconRef", (PyCFunction)Icn_GetIconSizesFromIconRef, 1,
+ PyDoc_STR("(IconSelectorValue iconSelectorInput, IconServicesUsageFlags iconServicesUsageFlags, IconRef theIconRef) -> (IconSelectorValue iconSelectorOutputPtr)")},
+ {"FlushIconRefs", (PyCFunction)Icn_FlushIconRefs, 1,
+ PyDoc_STR("(OSType creator, OSType iconType) -> None")},
+ {"FlushIconRefsByVolume", (PyCFunction)Icn_FlushIconRefsByVolume, 1,
+ PyDoc_STR("(SInt16 vRefNum) -> None")},
+ {"SetCustomIconsEnabled", (PyCFunction)Icn_SetCustomIconsEnabled, 1,
+ PyDoc_STR("(SInt16 vRefNum, Boolean enableCustomIcons) -> None")},
+ {"GetCustomIconsEnabled", (PyCFunction)Icn_GetCustomIconsEnabled, 1,
+ PyDoc_STR("(SInt16 vRefNum) -> (Boolean customIconsEnabled)")},
+ {"IsIconRefMaskEmpty", (PyCFunction)Icn_IsIconRefMaskEmpty, 1,
+ PyDoc_STR("(IconRef iconRef) -> (Boolean _rv)")},
+ {"GetIconRefVariant", (PyCFunction)Icn_GetIconRefVariant, 1,
+ PyDoc_STR("(IconRef inIconRef, OSType inVariant) -> (IconRef _rv, IconTransformType outTransform)")},
+ {"RegisterIconRefFromIconFile", (PyCFunction)Icn_RegisterIconRefFromIconFile, 1,
+ PyDoc_STR("(OSType creator, OSType iconType, FSSpec iconFile) -> (IconRef theIconRef)")},
+ {"ReadIconFile", (PyCFunction)Icn_ReadIconFile, 1,
+ PyDoc_STR("(FSSpec iconFile) -> (IconFamilyHandle iconFamily)")},
+ {"ReadIconFromFSRef", (PyCFunction)Icn_ReadIconFromFSRef, 1,
+ PyDoc_STR("(FSRef ref) -> (IconFamilyHandle iconFamily)")},
+ {"WriteIconFile", (PyCFunction)Icn_WriteIconFile, 1,
+ PyDoc_STR("(IconFamilyHandle iconFamily, FSSpec iconFile) -> None")},
+#endif /* __LP64__ */
+ {NULL, NULL, 0}
+};
+
+
+
+
+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 ========================= */
+
diff --git a/Mac/Modules/icn/icnscan.py b/Mac/Modules/icn/icnscan.py
new file mode 100644
index 0000000000..6af3a4ea0f
--- /dev/null
+++ b/Mac/Modules/icn/icnscan.py
@@ -0,0 +1,71 @@
+# Scan an Apple header file, generating a Python file of generator calls.
+
+import sys
+from bgenlocations import TOOLBOXDIR, BGENDIR
+sys.path.append(BGENDIR)
+from scantools import Scanner
+
+LONG = "Icons"
+SHORT = "icn"
+OBJECT = "NOTUSED"
+
+def main():
+ input = LONG + ".h"
+ output = SHORT + "gen.py"
+ defsoutput = TOOLBOXDIR + LONG + ".py"
+ scanner = MyScanner(input, output, defsoutput)
+ scanner.scan()
+ scanner.close()
+ print "=== Testing definitions output code ==="
+ execfile(defsoutput, {}, {})
+ print "=== Done scanning and generating, now importing the generated code... ==="
+ exec "import " + SHORT + "support"
+ print "=== Done. It's up to you to compile it now! ==="
+
+class MyScanner(Scanner):
+
+ def destination(self, type, name, arglist):
+ classname = "Function"
+ listname = "functions"
+ if arglist:
+ t, n, m = arglist[0]
+ # This is non-functional today
+ if t == OBJECT and m == "InMode":
+ classname = "Method"
+ listname = "methods"
+ return classname, listname
+
+ def makeblacklistnames(self):
+ return [
+ "GetIconCacheData",
+ "SetIconCacheData",
+ # Constants with funny definitions
+ "kSelectorAllHugeData",
+ "kSelectorAllAvailableData",
+ "svAllAvailableData",
+ # Something in a comment accidentally seen as a const definition
+ "err",
+ # OS8 only
+ 'IconServicesTerminate',
+ # Lazy, right now.
+ "GetIconRefFromFileInfo"
+ ]
+
+ def makeblacklisttypes(self):
+ return [
+ "IconActionUPP",
+ "IconGetterUPP",
+ "CFragInitBlockPtr",
+ "CGRect_ptr",
+ ]
+
+ def makerepairinstructions(self):
+ return [
+ ]
+
+ def writeinitialdefs(self):
+ self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
+ self.defsfile.write("from Carbon.Files import *\n")
+
+if __name__ == "__main__":
+ main()
diff --git a/Mac/Modules/icn/icnsupport.py b/Mac/Modules/icn/icnsupport.py
new file mode 100644
index 0000000000..1b153854bd
--- /dev/null
+++ b/Mac/Modules/icn/icnsupport.py
@@ -0,0 +1,90 @@
+# This script generates a Python interface for an Apple Macintosh Manager.
+# It uses the "bgen" package to generate C code.
+# The function specifications are generated by scanning the mamager's header file,
+# using the "scantools" package (customized for this particular manager).
+
+import string
+
+# Declarations that change for each manager
+MACHEADERFILE = 'Icons.h' # The Apple header file
+MODNAME = '_Icn' # The name of the module
+OBJECTNAME = 'Icon' # The basic name of the objects used here
+KIND = 'Handle' # Usually 'Ptr' or 'Handle'
+
+# The following is *usually* unchanged but may still require tuning
+MODPREFIX = 'Icn' # The prefix for module-wide routines
+OBJECTTYPE = OBJECTNAME + KIND # The C type used to represent them
+OBJECTPREFIX = MODPREFIX + 'Obj' # The prefix for object methods
+INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner
+OUTPUTFILE = MODNAME + "module.c" # The file generated by this program
+
+from macsupport import *
+
+# Create the type objects
+CIconHandle = OpaqueByValueType("CIconHandle", "ResObj")
+IconSuiteRef = OpaqueByValueType("IconSuiteRef", "ResObj")
+IconCacheRef = OpaqueByValueType("IconCacheRef", "ResObj")
+IconRef = OpaqueByValueType("IconRef", "ResObj")
+IconFamilyHandle = OpaqueByValueType("IconFamilyHandle", "ResObj")
+RgnHandle = OpaqueByValueType("RgnHandle", "ResObj")
+IconAlignmentType = Type("IconAlignmentType", "h")
+IconTransformType = Type("IconTransformType", "h")
+IconSelectorValue = Type("IconSelectorValue", "l")
+IconServicesUsageFlags = Type("IconServicesUsageFlags", "l")
+RGBColor = OpaqueType("RGBColor", "QdRGB")
+CGContextRef = OpaqueByValueType("CGContextRef", "CGContextRefObj")
+
+#WindowPeek = OpaqueByValueType("WindowPeek", OBJECTPREFIX)
+
+# RgnHandle = FakeType("(RgnHandle)0")
+# XXXX Should be next, but this will break a lot of code...
+# RgnHandle = OpaqueByValueType("RgnHandle", "OptResObj")
+
+# KeyMap = ArrayOutputBufferType("KeyMap")
+#MacOSEventKind = Type("MacOSEventKind", "h") # Old-style
+#MacOSEventMask = Type("MacOSEventMask", "h") # Old-style
+#EventMask = Type("EventMask", "H")
+#EventKind = Type("EventKind", "H")
+
+includestuff = includestuff + """
+#include <Carbon/Carbon.h>
+
+"""
+
+class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
+ def outputCheckNewArg(self):
+ Output("if (itself == NULL) return PyMac_Error(resNotFound);")
+ def outputCheckConvertArg(self):
+ OutLbrace("if (DlgObj_Check(v))")
+ Output("*p_itself = ((WindowObject *)v)->ob_itself;")
+ Output("return 1;")
+ OutRbrace()
+ Out("""
+ if (v == Py_None) { *p_itself = NULL; return 1; }
+ if (PyInt_Check(v)) { *p_itself = (WindowPtr)PyInt_AsLong(v); return 1; }
+ """)
+
+# From here on it's basically all boiler plate...
+
+# Create the generator groups and link them
+module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff)
+##object = MyObjectDefinition(OBJECTNAME, OBJECTPREFIX, OBJECTTYPE)
+##module.addobject(object)
+
+# Create the generator classes used to populate the lists
+Function = OSErrWeakLinkFunctionGenerator
+##Method = OSErrMethodGenerator
+
+# Create and populate the lists
+functions = []
+##methods = []
+execfile(INPUTFILE)
+
+# add the populated lists to the generator groups
+# (in a different wordl the scan program would generate this)
+for f in functions: module.add(f)
+##for f in methods: object.add(f)
+
+# generate output (open the output file as late as possible)
+SetOutputFileName(OUTPUTFILE)
+module.generate()
diff --git a/Mac/Modules/launch/_Launchmodule.c b/Mac/Modules/launch/_Launchmodule.c
new file mode 100644
index 0000000000..88912b2b70
--- /dev/null
+++ b/Mac/Modules/launch/_Launchmodule.c
@@ -0,0 +1,481 @@
+
+/* ========================= Module _Launch ========================= */
+
+#include "Python.h"
+
+
+
+#include "pymactoolbox.h"
+
+/* Macro to test whether a weak-loaded CFM function exists */
+#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
+ PyErr_SetString(PyExc_NotImplementedError, \
+ "Not available in this shared library/OS version"); \
+ return NULL; \
+ }} while(0)
+
+
+#if PY_VERSION_HEX < 0x02040000
+PyObject *PyMac_GetOSErrException(void);
+#endif
+
+#include <ApplicationServices/ApplicationServices.h>
+
+/*
+** Optional CFStringRef. None will pass NULL
+*/
+static int
+OptCFStringRefObj_Convert(PyObject *v, CFStringRef *spec)
+{
+ if (v == Py_None) {
+ *spec = NULL;
+ return 1;
+ }
+ return CFStringRefObj_Convert(v, spec);
+}
+
+PyObject *
+OptCFStringRefObj_New(CFStringRef it)
+{
+ if (it == NULL) {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+ return CFStringRefObj_New(it);
+}
+
+/*
+** Convert LSItemInfoRecord to Python.
+*/
+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,
+ "creator", PyMac_BuildOSType, it->creator,
+ "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;
+
+static PyObject *Launch_LSCopyItemInfoForRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ FSRef inItemRef;
+ LSRequestedInfo inWhichInfo;
+ LSItemInfoRecord outItemInfo;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetFSRef, &inItemRef,
+ &inWhichInfo))
+ return NULL;
+ _err = LSCopyItemInfoForRef(&inItemRef,
+ inWhichInfo,
+ &outItemInfo);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ LSItemInfoRecord_New, &outItemInfo);
+ return _res;
+}
+
+static PyObject *Launch_LSCopyItemInfoForURL(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ CFURLRef inURL;
+ LSRequestedInfo inWhichInfo;
+ LSItemInfoRecord outItemInfo;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CFURLRefObj_Convert, &inURL,
+ &inWhichInfo))
+ return NULL;
+ _err = LSCopyItemInfoForURL(inURL,
+ inWhichInfo,
+ &outItemInfo);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ LSItemInfoRecord_New, &outItemInfo);
+ return _res;
+}
+
+static PyObject *Launch_LSGetExtensionInfo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UniChar *inNameLen__in__;
+ UniCharCount inNameLen__len__;
+ int inNameLen__in_len__;
+ UniCharCount outExtStartIndex;
+ if (!PyArg_ParseTuple(_args, "u#",
+ &inNameLen__in__, &inNameLen__in_len__))
+ return NULL;
+ inNameLen__len__ = inNameLen__in_len__;
+ _err = LSGetExtensionInfo(inNameLen__len__, inNameLen__in__,
+ &outExtStartIndex);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outExtStartIndex);
+ return _res;
+}
+
+static PyObject *Launch_LSCopyDisplayNameForRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ FSRef inRef;
+ CFStringRef outDisplayName;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetFSRef, &inRef))
+ return NULL;
+ _err = LSCopyDisplayNameForRef(&inRef,
+ &outDisplayName);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, outDisplayName);
+ return _res;
+}
+
+static PyObject *Launch_LSCopyDisplayNameForURL(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ CFURLRef inURL;
+ CFStringRef outDisplayName;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFURLRefObj_Convert, &inURL))
+ return NULL;
+ _err = LSCopyDisplayNameForURL(inURL,
+ &outDisplayName);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, outDisplayName);
+ return _res;
+}
+
+static PyObject *Launch_LSSetExtensionHiddenForRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ FSRef inRef;
+ Boolean inHide;
+ if (!PyArg_ParseTuple(_args, "O&b",
+ PyMac_GetFSRef, &inRef,
+ &inHide))
+ return NULL;
+ _err = LSSetExtensionHiddenForRef(&inRef,
+ inHide);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Launch_LSSetExtensionHiddenForURL(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ CFURLRef inURL;
+ Boolean inHide;
+ if (!PyArg_ParseTuple(_args, "O&b",
+ CFURLRefObj_Convert, &inURL,
+ &inHide))
+ return NULL;
+ _err = LSSetExtensionHiddenForURL(inURL,
+ inHide);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Launch_LSCopyKindStringForRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ FSRef inFSRef;
+ CFStringRef outKindString;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetFSRef, &inFSRef))
+ return NULL;
+ _err = LSCopyKindStringForRef(&inFSRef,
+ &outKindString);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, outKindString);
+ return _res;
+}
+
+static PyObject *Launch_LSCopyKindStringForURL(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ CFURLRef inURL;
+ CFStringRef outKindString;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFURLRefObj_Convert, &inURL))
+ return NULL;
+ _err = LSCopyKindStringForURL(inURL,
+ &outKindString);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, outKindString);
+ return _res;
+}
+
+static PyObject *Launch_LSGetApplicationForItem(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ FSRef inItemRef;
+ LSRolesMask inRoleMask;
+ FSRef outAppRef;
+ CFURLRef outAppURL;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetFSRef, &inItemRef,
+ &inRoleMask))
+ return NULL;
+ _err = LSGetApplicationForItem(&inItemRef,
+ inRoleMask,
+ &outAppRef,
+ &outAppURL);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&O&",
+ PyMac_BuildFSRef, &outAppRef,
+ CFURLRefObj_New, outAppURL);
+ return _res;
+}
+
+static PyObject *Launch_LSGetApplicationForInfo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ OSType inType;
+ OSType inCreator;
+ CFStringRef inExtension;
+ LSRolesMask inRoleMask;
+ FSRef outAppRef;
+ CFURLRef outAppURL;
+ if (!PyArg_ParseTuple(_args, "O&O&O&l",
+ PyMac_GetOSType, &inType,
+ PyMac_GetOSType, &inCreator,
+ OptCFStringRefObj_Convert, &inExtension,
+ &inRoleMask))
+ return NULL;
+ _err = LSGetApplicationForInfo(inType,
+ inCreator,
+ inExtension,
+ inRoleMask,
+ &outAppRef,
+ &outAppURL);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&O&",
+ PyMac_BuildFSRef, &outAppRef,
+ CFURLRefObj_New, outAppURL);
+ return _res;
+}
+
+static PyObject *Launch_LSGetApplicationForURL(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ CFURLRef inURL;
+ LSRolesMask inRoleMask;
+ FSRef outAppRef;
+ CFURLRef outAppURL;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CFURLRefObj_Convert, &inURL,
+ &inRoleMask))
+ return NULL;
+ _err = LSGetApplicationForURL(inURL,
+ inRoleMask,
+ &outAppRef,
+ &outAppURL);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&O&",
+ PyMac_BuildFSRef, &outAppRef,
+ CFURLRefObj_New, outAppURL);
+ return _res;
+}
+
+static PyObject *Launch_LSFindApplicationForInfo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ OSType inCreator;
+ CFStringRef inBundleID;
+ CFStringRef inName;
+ FSRef outAppRef;
+ CFURLRef outAppURL;
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ PyMac_GetOSType, &inCreator,
+ OptCFStringRefObj_Convert, &inBundleID,
+ OptCFStringRefObj_Convert, &inName))
+ return NULL;
+ _err = LSFindApplicationForInfo(inCreator,
+ inBundleID,
+ inName,
+ &outAppRef,
+ &outAppURL);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&O&",
+ PyMac_BuildFSRef, &outAppRef,
+ CFURLRefObj_New, outAppURL);
+ return _res;
+}
+
+static PyObject *Launch_LSCanRefAcceptItem(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ FSRef inItemFSRef;
+ FSRef inTargetRef;
+ LSRolesMask inRoleMask;
+ LSAcceptanceFlags inFlags;
+ Boolean outAcceptsItem;
+ if (!PyArg_ParseTuple(_args, "O&O&ll",
+ PyMac_GetFSRef, &inItemFSRef,
+ PyMac_GetFSRef, &inTargetRef,
+ &inRoleMask,
+ &inFlags))
+ return NULL;
+ _err = LSCanRefAcceptItem(&inItemFSRef,
+ &inTargetRef,
+ inRoleMask,
+ inFlags,
+ &outAcceptsItem);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("b",
+ outAcceptsItem);
+ return _res;
+}
+
+static PyObject *Launch_LSCanURLAcceptURL(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ CFURLRef inItemURL;
+ CFURLRef inTargetURL;
+ LSRolesMask inRoleMask;
+ LSAcceptanceFlags inFlags;
+ Boolean outAcceptsItem;
+ if (!PyArg_ParseTuple(_args, "O&O&ll",
+ CFURLRefObj_Convert, &inItemURL,
+ CFURLRefObj_Convert, &inTargetURL,
+ &inRoleMask,
+ &inFlags))
+ return NULL;
+ _err = LSCanURLAcceptURL(inItemURL,
+ inTargetURL,
+ inRoleMask,
+ inFlags,
+ &outAcceptsItem);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("b",
+ outAcceptsItem);
+ return _res;
+}
+
+static PyObject *Launch_LSOpenFSRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ FSRef inRef;
+ FSRef outLaunchedRef;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetFSRef, &inRef))
+ return NULL;
+ _err = LSOpenFSRef(&inRef,
+ &outLaunchedRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildFSRef, &outLaunchedRef);
+ return _res;
+}
+
+static PyObject *Launch_LSOpenCFURLRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ CFURLRef inURL;
+ CFURLRef outLaunchedURL;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFURLRefObj_Convert, &inURL))
+ return NULL;
+ _err = LSOpenCFURLRef(inURL,
+ &outLaunchedURL);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CFURLRefObj_New, outLaunchedURL);
+ return _res;
+}
+
+static PyMethodDef Launch_methods[] = {
+ {"LSCopyItemInfoForRef", (PyCFunction)Launch_LSCopyItemInfoForRef, 1,
+ PyDoc_STR("(FSRef inItemRef, LSRequestedInfo inWhichInfo) -> (LSItemInfoRecord outItemInfo)")},
+ {"LSCopyItemInfoForURL", (PyCFunction)Launch_LSCopyItemInfoForURL, 1,
+ PyDoc_STR("(CFURLRef inURL, LSRequestedInfo inWhichInfo) -> (LSItemInfoRecord outItemInfo)")},
+ {"LSGetExtensionInfo", (PyCFunction)Launch_LSGetExtensionInfo, 1,
+ PyDoc_STR("(Buffer inNameLen) -> (UniCharCount outExtStartIndex)")},
+ {"LSCopyDisplayNameForRef", (PyCFunction)Launch_LSCopyDisplayNameForRef, 1,
+ PyDoc_STR("(FSRef inRef) -> (CFStringRef outDisplayName)")},
+ {"LSCopyDisplayNameForURL", (PyCFunction)Launch_LSCopyDisplayNameForURL, 1,
+ PyDoc_STR("(CFURLRef inURL) -> (CFStringRef outDisplayName)")},
+ {"LSSetExtensionHiddenForRef", (PyCFunction)Launch_LSSetExtensionHiddenForRef, 1,
+ PyDoc_STR("(FSRef inRef, Boolean inHide) -> None")},
+ {"LSSetExtensionHiddenForURL", (PyCFunction)Launch_LSSetExtensionHiddenForURL, 1,
+ PyDoc_STR("(CFURLRef inURL, Boolean inHide) -> None")},
+ {"LSCopyKindStringForRef", (PyCFunction)Launch_LSCopyKindStringForRef, 1,
+ PyDoc_STR("(FSRef inFSRef) -> (CFStringRef outKindString)")},
+ {"LSCopyKindStringForURL", (PyCFunction)Launch_LSCopyKindStringForURL, 1,
+ PyDoc_STR("(CFURLRef inURL) -> (CFStringRef outKindString)")},
+ {"LSGetApplicationForItem", (PyCFunction)Launch_LSGetApplicationForItem, 1,
+ PyDoc_STR("(FSRef inItemRef, LSRolesMask inRoleMask) -> (FSRef outAppRef, CFURLRef outAppURL)")},
+ {"LSGetApplicationForInfo", (PyCFunction)Launch_LSGetApplicationForInfo, 1,
+ PyDoc_STR("(OSType inType, OSType inCreator, CFStringRef inExtension, LSRolesMask inRoleMask) -> (FSRef outAppRef, CFURLRef outAppURL)")},
+ {"LSGetApplicationForURL", (PyCFunction)Launch_LSGetApplicationForURL, 1,
+ PyDoc_STR("(CFURLRef inURL, LSRolesMask inRoleMask) -> (FSRef outAppRef, CFURLRef outAppURL)")},
+ {"LSFindApplicationForInfo", (PyCFunction)Launch_LSFindApplicationForInfo, 1,
+ PyDoc_STR("(OSType inCreator, CFStringRef inBundleID, CFStringRef inName) -> (FSRef outAppRef, CFURLRef outAppURL)")},
+ {"LSCanRefAcceptItem", (PyCFunction)Launch_LSCanRefAcceptItem, 1,
+ PyDoc_STR("(FSRef inItemFSRef, FSRef inTargetRef, LSRolesMask inRoleMask, LSAcceptanceFlags inFlags) -> (Boolean outAcceptsItem)")},
+ {"LSCanURLAcceptURL", (PyCFunction)Launch_LSCanURLAcceptURL, 1,
+ PyDoc_STR("(CFURLRef inItemURL, CFURLRef inTargetURL, LSRolesMask inRoleMask, LSAcceptanceFlags inFlags) -> (Boolean outAcceptsItem)")},
+ {"LSOpenFSRef", (PyCFunction)Launch_LSOpenFSRef, 1,
+ PyDoc_STR("(FSRef inRef) -> (FSRef outLaunchedRef)")},
+ {"LSOpenCFURLRef", (PyCFunction)Launch_LSOpenCFURLRef, 1,
+ PyDoc_STR("(CFURLRef inURL) -> (CFURLRef outLaunchedURL)")},
+ {NULL, NULL, 0}
+};
+
+
+
+
+void init_Launch(void)
+{
+ PyObject *m;
+ PyObject *d;
+
+
+
+
+ m = Py_InitModule("_Launch", Launch_methods);
+ d = PyModule_GetDict(m);
+ Launch_Error = PyMac_GetOSErrException();
+ if (Launch_Error == NULL ||
+ PyDict_SetItemString(d, "Error", Launch_Error) != 0)
+ return;
+}
+
+/* ======================= End module _Launch ======================= */
+
diff --git a/Mac/Modules/launch/launchscan.py b/Mac/Modules/launch/launchscan.py
new file mode 100644
index 0000000000..3e07238431
--- /dev/null
+++ b/Mac/Modules/launch/launchscan.py
@@ -0,0 +1,85 @@
+# Scan an Apple header file, generating a Python file of generator calls.
+
+import sys
+from bgenlocations import TOOLBOXDIR, BGENDIR
+sys.path.append(BGENDIR)
+from scantools import Scanner
+
+LONG = "LaunchServices"
+SHORT = "launch"
+OBJECT = "NOTUSED"
+
+def main():
+ input = LONG + ".h"
+ output = SHORT + "gen.py"
+ defsoutput = TOOLBOXDIR + LONG + ".py"
+ scanner = MyScanner(input, output, defsoutput)
+ scanner.scan()
+ scanner.close()
+ scanner.gentypetest(SHORT+"typetest.py")
+ print "=== Testing definitions output code ==="
+ execfile(defsoutput, {}, {})
+ print "=== Done scanning and generating, now importing the generated code... ==="
+ exec "import " + SHORT + "support"
+ print "=== Done. It's up to you to compile it now! ==="
+
+class MyScanner(Scanner):
+
+ def destination(self, type, name, arglist):
+ classname = "Function"
+ listname = "functions"
+ if arglist:
+ t, n, m = arglist[0]
+ # This is non-functional today
+ if t == OBJECT and m == "InMode":
+ classname = "Method"
+ listname = "methods"
+ return classname, listname
+
+ def writeinitialdefs(self):
+ self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
+ self.defsfile.write("from Carbon.Files import *\n")
+ self.defsfile.write("kLSRequestAllInfo = -1\n")
+ self.defsfile.write("kLSRolesAll = -1\n")
+ self.defsfile.write("kLSUnknownType = FOUR_CHAR_CODE('\\0\\0\\0\\0')\n")
+ self.defsfile.write("kLSUnknownCreator = FOUR_CHAR_CODE('\\0\\0\\0\\0')\n")
+ self.defsfile.write("kLSInvalidExtensionIndex = -1\n")
+
+ def makeblacklistnames(self):
+ return [
+ "LSInit",
+ "LSTerm",
+ "kLSRequestAllInfo",
+ "kLSRolesAll",
+ "kLSInvalidExtensionIndex",
+ "kLSUnknownType",
+ "kLSUnknownCreator"
+ ]
+
+ def makeblacklisttypes(self):
+ return [
+ "LSLaunchFSRefSpec_ptr",
+ "LSLaunchURLSpec_ptr",
+ ]
+
+ def makerepairinstructions(self):
+ return [
+ # LSGetApplicationForInfo
+ ([('CFStringRef', 'inExtension', 'InMode')],
+ [('OptCFStringRef', 'inExtension', 'InMode')]),
+
+ # LSFindApplicationForInfo
+ ([('CFStringRef', 'inBundleID', 'InMode')],
+ [('OptCFStringRef', 'inBundleID', 'InMode')]),
+ ([('CFStringRef', 'inName', 'InMode')],
+ [('OptCFStringRef', 'inName', 'InMode')]),
+
+ # Unicode filenames passed as length, buffer. LSGetExtensionInfo
+ ([('UniCharCount', '*', 'InMode'),
+ ('UniChar_ptr', '*', 'InMode')],
+ [('UnicodeReverseInBuffer', '*', 'InMode')]
+ ),
+ ]
+
+if __name__ == "__main__":
+ main()
diff --git a/Mac/Modules/launch/launchsupport.py b/Mac/Modules/launch/launchsupport.py
new file mode 100644
index 0000000000..34c2efbcfd
--- /dev/null
+++ b/Mac/Modules/launch/launchsupport.py
@@ -0,0 +1,101 @@
+# This script generates a Python interface for an Apple Macintosh Manager.
+# It uses the "bgen" package to generate C code.
+# The function specifications are generated by scanning the mamager's header file,
+# using the "scantools" package (customized for this particular manager).
+
+import string
+
+# Declarations that change for each manager
+MODNAME = '_Launch' # The name of the module
+OBJECTNAME = 'UNUSED' # The basic name of the objects used here
+KIND = 'Record' # Usually 'Ptr' or 'Handle'
+
+# The following is *usually* unchanged but may still require tuning
+MODPREFIX = 'Launch' # The prefix for module-wide routines
+OBJECTTYPE = OBJECTNAME + KIND # The C type used to represent them
+OBJECTPREFIX = MODPREFIX + 'Obj' # The prefix for object methods
+INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner
+OUTPUTFILE = MODNAME + "module.c" # The file generated by this program
+
+from macsupport import *
+
+# Create the type objects
+LSAcceptanceFlags = Type("LSAcceptanceFlags", "l")
+LSInitializeFlags = Type("LSInitializeFlags", "l")
+LSRequestedInfo = Type("LSRequestedInfo", "l")
+LSRolesMask = Type("LSRolesMask", "l")
+UniCharCount = Type("UniCharCount", "l")
+OptCFStringRef = OpaqueByValueType("CFStringRef", "OptCFStringRefObj")
+LSItemInfoRecord = OpaqueType("LSItemInfoRecord", "LSItemInfoRecord")
+
+includestuff = includestuff + """
+#if PY_VERSION_HEX < 0x02040000
+PyObject *PyMac_GetOSErrException(void);
+#endif
+
+#include <ApplicationServices/ApplicationServices.h>
+
+/*
+** Optional CFStringRef. None will pass NULL
+*/
+static int
+OptCFStringRefObj_Convert(PyObject *v, CFStringRef *spec)
+{
+ if (v == Py_None) {
+ *spec = NULL;
+ return 1;
+ }
+ return CFStringRefObj_Convert(v, spec);
+}
+
+PyObject *
+OptCFStringRefObj_New(CFStringRef it)
+{
+ if (it == NULL) {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+ return CFStringRefObj_New(it);
+}
+
+/*
+** Convert LSItemInfoRecord to Python.
+*/
+PyObject *
+LSItemInfoRecord_New(LSItemInfoRecord *it)
+{
+ return Py_BuildValue("{s:is:O&s:O&s:O&s:O&s:i}",
+ "flags", it->flags,
+ "filetype", PyMac_BuildOSType, it->filetype,
+ "creator", PyMac_BuildOSType, it->creator,
+ "extension", OptCFStringRefObj_New, it->extension,
+ "iconFileName", OptCFStringRefObj_New, it->iconFileName,
+ "kindID", it->kindID);
+}
+"""
+
+# From here on it's basically all boiler plate...
+execfile(string.lower(MODPREFIX) + 'typetest.py')
+
+# Create the generator groups and link them
+module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff)
+##object = MyObjectDefinition(OBJECTNAME, OBJECTPREFIX, OBJECTTYPE)
+##module.addobject(object)
+
+# Create the generator classes used to populate the lists
+Function = OSErrFunctionGenerator
+##Method = OSErrMethodGenerator
+
+# Create and populate the lists
+functions = []
+##methods = []
+execfile(INPUTFILE)
+
+# add the populated lists to the generator groups
+# (in a different wordl the scan program would generate this)
+for f in functions: module.add(f)
+##for f in methods: object.add(f)
+
+# generate output (open the output file as late as possible)
+SetOutputFileName(OUTPUTFILE)
+module.generate()
diff --git a/Mac/Modules/launch/setup.py b/Mac/Modules/launch/setup.py
new file mode 100644
index 0000000000..205419524c
--- /dev/null
+++ b/Mac/Modules/launch/setup.py
@@ -0,0 +1,13 @@
+# This is a temporary setup script to allow distribution of
+# MacPython 2.4 modules for MacPython 2.3.
+
+from distutils.core import Extension, setup
+
+setup(name="LaunchServices", version="0.2",
+ ext_modules=[
+ Extension('_Launch', ['_Launchmodule.c'],
+ extra_link_args=['-framework', 'ApplicationServices'])
+ ],
+ py_modules=['LaunchServices.Launch', 'LaunchServices.LaunchServices'],
+ package_dir={'LaunchServices':'../../../Lib/plat-mac/Carbon'}
+ )
diff --git a/Mac/Modules/list/_Listmodule.c b/Mac/Modules/list/_Listmodule.c
new file mode 100644
index 0000000000..3f43b06f42
--- /dev/null
+++ b/Mac/Modules/list/_Listmodule.c
@@ -0,0 +1,1140 @@
+
+/* ========================== Module _List ========================== */
+
+#include "Python.h"
+
+#ifndef __LP64__
+
+
+#include "pymactoolbox.h"
+
+/* Macro to test whether a weak-loaded CFM function exists */
+#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
+ PyErr_SetString(PyExc_NotImplementedError, \
+ "Not available in this shared library/OS version"); \
+ return NULL; \
+ }} while(0)
+
+
+#include <Carbon/Carbon.h>
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_ListObj_New(ListHandle);
+extern int _ListObj_Convert(PyObject *, ListHandle *);
+
+#define ListObj_New _ListObj_New
+#define ListObj_Convert _ListObj_Convert
+#endif
+
+#define as_List(x) ((ListHandle)x)
+#define as_Resource(lh) ((Handle)lh)
+
+static ListDefUPP myListDefFunctionUPP;
+
+
+static PyObject *List_Error;
+
+/* ------------------------ Object type List ------------------------ */
+
+PyTypeObject List_Type;
+
+#define ListObj_Check(x) ((x)->ob_type == &List_Type || PyObject_TypeCheck((x), &List_Type))
+
+typedef struct ListObject {
+ PyObject_HEAD
+ ListHandle ob_itself;
+ PyObject *ob_ldef_func;
+ int ob_must_be_disposed;
+} ListObject;
+
+PyObject *ListObj_New(ListHandle itself)
+{
+ ListObject *it;
+ if (itself == NULL) {
+ PyErr_SetString(List_Error,"Cannot create null List");
+ return NULL;
+ }
+ it = PyObject_NEW(ListObject, &List_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ it->ob_ldef_func = NULL;
+ it->ob_must_be_disposed = 1;
+ SetListRefCon(itself, (long)it);
+ return (PyObject *)it;
+}
+
+int ListObj_Convert(PyObject *v, ListHandle *p_itself)
+{
+ if (!ListObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "List required");
+ return 0;
+ }
+ *p_itself = ((ListObject *)v)->ob_itself;
+ return 1;
+}
+
+static void ListObj_dealloc(ListObject *self)
+{
+ Py_XDECREF(self->ob_ldef_func);
+ self->ob_ldef_func = NULL;
+ SetListRefCon(self->ob_itself, (long)0);
+ if (self->ob_must_be_disposed && self->ob_itself) LDispose(self->ob_itself);
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *ListObj_LAddColumn(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ short count;
+ short colNum;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &count,
+ &colNum))
+ return NULL;
+ _rv = LAddColumn(count,
+ colNum,
+ _self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *ListObj_LAddRow(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ short count;
+ short rowNum;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &count,
+ &rowNum))
+ return NULL;
+ _rv = LAddRow(count,
+ rowNum,
+ _self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *ListObj_LDelColumn(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short count;
+ short colNum;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &count,
+ &colNum))
+ return NULL;
+ LDelColumn(count,
+ colNum,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ListObj_LDelRow(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short count;
+ short rowNum;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &count,
+ &rowNum))
+ return NULL;
+ LDelRow(count,
+ rowNum,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ListObj_LGetSelect(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Boolean next;
+ Point theCell;
+ if (!PyArg_ParseTuple(_args, "bO&",
+ &next,
+ PyMac_GetPoint, &theCell))
+ return NULL;
+ _rv = LGetSelect(next,
+ &theCell,
+ _self->ob_itself);
+ _res = Py_BuildValue("bO&",
+ _rv,
+ PyMac_BuildPoint, theCell);
+ return _res;
+}
+
+static PyObject *ListObj_LLastClick(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = LLastClick(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, _rv);
+ return _res;
+}
+
+static PyObject *ListObj_LNextCell(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Boolean hNext;
+ Boolean vNext;
+ Point theCell;
+ if (!PyArg_ParseTuple(_args, "bbO&",
+ &hNext,
+ &vNext,
+ PyMac_GetPoint, &theCell))
+ return NULL;
+ _rv = LNextCell(hNext,
+ vNext,
+ &theCell,
+ _self->ob_itself);
+ _res = Py_BuildValue("bO&",
+ _rv,
+ PyMac_BuildPoint, theCell);
+ return _res;
+}
+
+static PyObject *ListObj_LSize(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short listWidth;
+ short listHeight;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &listWidth,
+ &listHeight))
+ return NULL;
+ LSize(listWidth,
+ listHeight,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ListObj_LSetDrawingMode(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean drawIt;
+ if (!PyArg_ParseTuple(_args, "b",
+ &drawIt))
+ return NULL;
+ LSetDrawingMode(drawIt,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ListObj_LScroll(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short dCols;
+ short dRows;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &dCols,
+ &dRows))
+ return NULL;
+ LScroll(dCols,
+ dRows,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ListObj_LAutoScroll(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ LAutoScroll(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ListObj_LUpdate(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle theRgn;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &theRgn))
+ return NULL;
+ LUpdate(theRgn,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ListObj_LActivate(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean act;
+ if (!PyArg_ParseTuple(_args, "b",
+ &act))
+ return NULL;
+ LActivate(act,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ListObj_LCellSize(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point cSize;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &cSize))
+ return NULL;
+ LCellSize(cSize,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ListObj_LClick(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Point pt;
+ EventModifiers modifiers;
+ if (!PyArg_ParseTuple(_args, "O&H",
+ PyMac_GetPoint, &pt,
+ &modifiers))
+ return NULL;
+ _rv = LClick(pt,
+ modifiers,
+ _self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *ListObj_LAddToCell(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ char *dataPtr__in__;
+ short dataPtr__len__;
+ int dataPtr__in_len__;
+ Point theCell;
+ if (!PyArg_ParseTuple(_args, "s#O&",
+ &dataPtr__in__, &dataPtr__in_len__,
+ PyMac_GetPoint, &theCell))
+ return NULL;
+ dataPtr__len__ = dataPtr__in_len__;
+ LAddToCell(dataPtr__in__, dataPtr__len__,
+ theCell,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ListObj_LClrCell(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point theCell;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &theCell))
+ return NULL;
+ LClrCell(theCell,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ListObj_LGetCell(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ char *dataPtr__out__;
+ short dataPtr__len__;
+ int dataPtr__in_len__;
+ Point theCell;
+ if (!PyArg_ParseTuple(_args, "iO&",
+ &dataPtr__in_len__,
+ PyMac_GetPoint, &theCell))
+ return NULL;
+ if ((dataPtr__out__ = malloc(dataPtr__in_len__)) == NULL)
+ {
+ PyErr_NoMemory();
+ goto dataPtr__error__;
+ }
+ dataPtr__len__ = dataPtr__in_len__;
+ LGetCell(dataPtr__out__, &dataPtr__len__,
+ theCell,
+ _self->ob_itself);
+ _res = Py_BuildValue("s#",
+ dataPtr__out__, (int)dataPtr__len__);
+ free(dataPtr__out__);
+ dataPtr__error__: ;
+ return _res;
+}
+
+static PyObject *ListObj_LRect(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect cellRect;
+ Point theCell;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &theCell))
+ return NULL;
+ LRect(&cellRect,
+ theCell,
+ _self->ob_itself);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &cellRect);
+ return _res;
+}
+
+static PyObject *ListObj_LSetCell(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ char *dataPtr__in__;
+ short dataPtr__len__;
+ int dataPtr__in_len__;
+ Point theCell;
+ if (!PyArg_ParseTuple(_args, "s#O&",
+ &dataPtr__in__, &dataPtr__in_len__,
+ PyMac_GetPoint, &theCell))
+ return NULL;
+ dataPtr__len__ = dataPtr__in_len__;
+ LSetCell(dataPtr__in__, dataPtr__len__,
+ theCell,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ListObj_LSetSelect(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean setIt;
+ Point theCell;
+ if (!PyArg_ParseTuple(_args, "bO&",
+ &setIt,
+ PyMac_GetPoint, &theCell))
+ return NULL;
+ LSetSelect(setIt,
+ theCell,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ListObj_LDraw(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point theCell;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &theCell))
+ return NULL;
+ LDraw(theCell,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ListObj_LGetCellDataLocation(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short offset;
+ short len;
+ Point theCell;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &theCell))
+ return NULL;
+ LGetCellDataLocation(&offset,
+ &len,
+ theCell,
+ _self->ob_itself);
+ _res = Py_BuildValue("hh",
+ offset,
+ len);
+ return _res;
+}
+
+static PyObject *ListObj_GetListPort(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetListPort(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ GrafObj_New, _rv);
+ return _res;
+}
+
+static PyObject *ListObj_GetListVerticalScrollBar(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ControlHandle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetListVerticalScrollBar(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, _rv);
+ return _res;
+}
+
+static PyObject *ListObj_GetListHorizontalScrollBar(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ControlHandle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetListHorizontalScrollBar(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, _rv);
+ return _res;
+}
+
+static PyObject *ListObj_GetListActive(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetListActive(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *ListObj_GetListClickTime(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetListClickTime(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *ListObj_GetListRefCon(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetListRefCon(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *ListObj_GetListDefinition(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetListDefinition(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *ListObj_GetListUserHandle(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetListUserHandle(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *ListObj_GetListDataHandle(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DataHandle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetListDataHandle(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *ListObj_GetListFlags(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OptionBits _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetListFlags(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *ListObj_GetListSelectionFlags(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OptionBits _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetListSelectionFlags(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *ListObj_as_Resource(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = as_Resource(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyMethodDef ListObj_methods[] = {
+ {"LAddColumn", (PyCFunction)ListObj_LAddColumn, 1,
+ PyDoc_STR("(short count, short colNum) -> (short _rv)")},
+ {"LAddRow", (PyCFunction)ListObj_LAddRow, 1,
+ PyDoc_STR("(short count, short rowNum) -> (short _rv)")},
+ {"LDelColumn", (PyCFunction)ListObj_LDelColumn, 1,
+ PyDoc_STR("(short count, short colNum) -> None")},
+ {"LDelRow", (PyCFunction)ListObj_LDelRow, 1,
+ PyDoc_STR("(short count, short rowNum) -> None")},
+ {"LGetSelect", (PyCFunction)ListObj_LGetSelect, 1,
+ PyDoc_STR("(Boolean next, Point theCell) -> (Boolean _rv, Point theCell)")},
+ {"LLastClick", (PyCFunction)ListObj_LLastClick, 1,
+ PyDoc_STR("() -> (Point _rv)")},
+ {"LNextCell", (PyCFunction)ListObj_LNextCell, 1,
+ PyDoc_STR("(Boolean hNext, Boolean vNext, Point theCell) -> (Boolean _rv, Point theCell)")},
+ {"LSize", (PyCFunction)ListObj_LSize, 1,
+ PyDoc_STR("(short listWidth, short listHeight) -> None")},
+ {"LSetDrawingMode", (PyCFunction)ListObj_LSetDrawingMode, 1,
+ PyDoc_STR("(Boolean drawIt) -> None")},
+ {"LScroll", (PyCFunction)ListObj_LScroll, 1,
+ PyDoc_STR("(short dCols, short dRows) -> None")},
+ {"LAutoScroll", (PyCFunction)ListObj_LAutoScroll, 1,
+ PyDoc_STR("() -> None")},
+ {"LUpdate", (PyCFunction)ListObj_LUpdate, 1,
+ PyDoc_STR("(RgnHandle theRgn) -> None")},
+ {"LActivate", (PyCFunction)ListObj_LActivate, 1,
+ PyDoc_STR("(Boolean act) -> None")},
+ {"LCellSize", (PyCFunction)ListObj_LCellSize, 1,
+ PyDoc_STR("(Point cSize) -> None")},
+ {"LClick", (PyCFunction)ListObj_LClick, 1,
+ PyDoc_STR("(Point pt, EventModifiers modifiers) -> (Boolean _rv)")},
+ {"LAddToCell", (PyCFunction)ListObj_LAddToCell, 1,
+ PyDoc_STR("(Buffer dataPtr, Point theCell) -> None")},
+ {"LClrCell", (PyCFunction)ListObj_LClrCell, 1,
+ PyDoc_STR("(Point theCell) -> None")},
+ {"LGetCell", (PyCFunction)ListObj_LGetCell, 1,
+ PyDoc_STR("(Buffer dataPtr, Point theCell) -> (Buffer dataPtr)")},
+ {"LRect", (PyCFunction)ListObj_LRect, 1,
+ PyDoc_STR("(Point theCell) -> (Rect cellRect)")},
+ {"LSetCell", (PyCFunction)ListObj_LSetCell, 1,
+ PyDoc_STR("(Buffer dataPtr, Point theCell) -> None")},
+ {"LSetSelect", (PyCFunction)ListObj_LSetSelect, 1,
+ PyDoc_STR("(Boolean setIt, Point theCell) -> None")},
+ {"LDraw", (PyCFunction)ListObj_LDraw, 1,
+ PyDoc_STR("(Point theCell) -> None")},
+ {"LGetCellDataLocation", (PyCFunction)ListObj_LGetCellDataLocation, 1,
+ PyDoc_STR("(Point theCell) -> (short offset, short len)")},
+ {"GetListPort", (PyCFunction)ListObj_GetListPort, 1,
+ PyDoc_STR("() -> (CGrafPtr _rv)")},
+ {"GetListVerticalScrollBar", (PyCFunction)ListObj_GetListVerticalScrollBar, 1,
+ PyDoc_STR("() -> (ControlHandle _rv)")},
+ {"GetListHorizontalScrollBar", (PyCFunction)ListObj_GetListHorizontalScrollBar, 1,
+ PyDoc_STR("() -> (ControlHandle _rv)")},
+ {"GetListActive", (PyCFunction)ListObj_GetListActive, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"GetListClickTime", (PyCFunction)ListObj_GetListClickTime, 1,
+ PyDoc_STR("() -> (SInt32 _rv)")},
+ {"GetListRefCon", (PyCFunction)ListObj_GetListRefCon, 1,
+ PyDoc_STR("() -> (SInt32 _rv)")},
+ {"GetListDefinition", (PyCFunction)ListObj_GetListDefinition, 1,
+ PyDoc_STR("() -> (Handle _rv)")},
+ {"GetListUserHandle", (PyCFunction)ListObj_GetListUserHandle, 1,
+ PyDoc_STR("() -> (Handle _rv)")},
+ {"GetListDataHandle", (PyCFunction)ListObj_GetListDataHandle, 1,
+ PyDoc_STR("() -> (DataHandle _rv)")},
+ {"GetListFlags", (PyCFunction)ListObj_GetListFlags, 1,
+ PyDoc_STR("() -> (OptionBits _rv)")},
+ {"GetListSelectionFlags", (PyCFunction)ListObj_GetListSelectionFlags, 1,
+ PyDoc_STR("() -> (OptionBits _rv)")},
+ {"as_Resource", (PyCFunction)ListObj_as_Resource, 1,
+ PyDoc_STR("() -> (Handle _rv)")},
+ {NULL, NULL, 0}
+};
+
+static PyObject *ListObj_get_listFlags(ListObject *self, void *closure)
+{
+ return Py_BuildValue("l", (long)GetListFlags(self->ob_itself) & 0xff);
+}
+
+static int ListObj_set_listFlags(ListObject *self, PyObject *v, void *closure)
+{
+ if (!PyArg_Parse(v, "B", &(*self->ob_itself)->listFlags)) return -1;
+ return 0;
+}
+
+static PyObject *ListObj_get_selFlags(ListObject *self, void *closure)
+{
+ return Py_BuildValue("l", (long)GetListSelectionFlags(self->ob_itself) & 0xff);
+}
+
+static int ListObj_set_selFlags(ListObject *self, PyObject *v, void *closure)
+{
+ if (!PyArg_Parse(v, "B", &(*self->ob_itself)->selFlags)) return -1;
+ return 0;
+}
+
+static PyObject *ListObj_get_cellSize(ListObject *self, void *closure)
+{
+ return Py_BuildValue("O&", PyMac_BuildPoint, (*self->ob_itself)->cellSize);
+}
+
+static int ListObj_set_cellSize(ListObject *self, PyObject *v, void *closure)
+{
+ if (!PyArg_Parse(v, "O&", PyMac_GetPoint, &(*self->ob_itself)->cellSize)) return -1;
+ return 0;
+}
+
+static PyGetSetDef ListObj_getsetlist[] = {
+ {"listFlags", (getter)ListObj_get_listFlags, (setter)ListObj_set_listFlags, NULL},
+ {"selFlags", (getter)ListObj_get_selFlags, (setter)ListObj_set_selFlags, NULL},
+ {"cellSize", (getter)ListObj_get_cellSize, (setter)ListObj_set_cellSize, NULL},
+ {NULL, NULL, NULL, NULL},
+};
+
+
+#define ListObj_compare NULL
+
+#define ListObj_repr NULL
+
+#define ListObj_hash NULL
+#define ListObj_tp_init 0
+
+#define ListObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *ListObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *_self;
+ ListHandle itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, ListObj_Convert, &itself)) return NULL;
+ if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((ListObject *)_self)->ob_itself = itself;
+ return _self;
+}
+
+#define ListObj_tp_free PyObject_Del
+
+
+PyTypeObject List_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_List.List", /*tp_name*/
+ sizeof(ListObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) ListObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) ListObj_compare, /*tp_compare*/
+ (reprfunc) ListObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) ListObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ ListObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ ListObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ ListObj_tp_init, /* tp_init */
+ ListObj_tp_alloc, /* tp_alloc */
+ ListObj_tp_new, /* tp_new */
+ ListObj_tp_free, /* tp_free */
+};
+
+/* ---------------------- End object type List ---------------------- */
+
+
+static PyObject *List_CreateCustomList(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect rView;
+ Rect dataBounds;
+ Point cellSize;
+
+ PyObject *listDefFunc;
+ ListDefSpec theSpec;
+ WindowPtr theWindow;
+ Boolean drawIt;
+ Boolean hasGrow;
+ Boolean scrollHoriz;
+ Boolean scrollVert;
+ ListHandle outList;
+
+ if (!PyArg_ParseTuple(_args, "O&O&O&(iO)O&bbbb",
+ PyMac_GetRect, &rView,
+ PyMac_GetRect, &dataBounds,
+ PyMac_GetPoint, &cellSize,
+ &theSpec.defType, &listDefFunc,
+ WinObj_Convert, &theWindow,
+ &drawIt,
+ &hasGrow,
+ &scrollHoriz,
+ &scrollVert))
+ return NULL;
+
+
+ /* Carbon applications use the CreateCustomList API */
+ theSpec.u.userProc = myListDefFunctionUPP;
+ CreateCustomList(&rView,
+ &dataBounds,
+ cellSize,
+ &theSpec,
+ theWindow,
+ drawIt,
+ hasGrow,
+ scrollHoriz,
+ scrollVert,
+ &outList);
+
+
+ _res = ListObj_New(outList);
+ if (_res == NULL)
+ return NULL;
+ Py_INCREF(listDefFunc);
+ ((ListObject*)_res)->ob_ldef_func = listDefFunc;
+ return _res;
+}
+
+static PyObject *List_LNew(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ListHandle _rv;
+ Rect rView;
+ Rect dataBounds;
+ Point cSize;
+ short theProc;
+ WindowPtr theWindow;
+ Boolean drawIt;
+ Boolean hasGrow;
+ Boolean scrollHoriz;
+ Boolean scrollVert;
+ if (!PyArg_ParseTuple(_args, "O&O&O&hO&bbbb",
+ PyMac_GetRect, &rView,
+ PyMac_GetRect, &dataBounds,
+ PyMac_GetPoint, &cSize,
+ &theProc,
+ WinObj_Convert, &theWindow,
+ &drawIt,
+ &hasGrow,
+ &scrollHoriz,
+ &scrollVert))
+ return NULL;
+ _rv = LNew(&rView,
+ &dataBounds,
+ cSize,
+ theProc,
+ theWindow,
+ drawIt,
+ hasGrow,
+ scrollHoriz,
+ scrollVert);
+ _res = Py_BuildValue("O&",
+ ListObj_New, _rv);
+ return _res;
+}
+
+static PyObject *List_SetListViewBounds(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ListHandle list;
+ Rect view;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ListObj_Convert, &list,
+ PyMac_GetRect, &view))
+ return NULL;
+ SetListViewBounds(list,
+ &view);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *List_SetListPort(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ListHandle list;
+ CGrafPtr port;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ListObj_Convert, &list,
+ GrafObj_Convert, &port))
+ return NULL;
+ SetListPort(list,
+ port);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *List_SetListCellIndent(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ListHandle list;
+ Point indent;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ListObj_Convert, &list,
+ PyMac_GetPoint, &indent))
+ return NULL;
+ SetListCellIndent(list,
+ &indent);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *List_SetListClickTime(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ListHandle list;
+ SInt32 time;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ ListObj_Convert, &list,
+ &time))
+ return NULL;
+ SetListClickTime(list,
+ time);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *List_SetListRefCon(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ListHandle list;
+ SInt32 refCon;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ ListObj_Convert, &list,
+ &refCon))
+ return NULL;
+ SetListRefCon(list,
+ refCon);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *List_SetListUserHandle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ListHandle list;
+ Handle userHandle;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ListObj_Convert, &list,
+ ResObj_Convert, &userHandle))
+ return NULL;
+ SetListUserHandle(list,
+ userHandle);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *List_SetListFlags(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ListHandle list;
+ OptionBits listFlags;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ ListObj_Convert, &list,
+ &listFlags))
+ return NULL;
+ SetListFlags(list,
+ listFlags);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *List_SetListSelectionFlags(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ListHandle list;
+ OptionBits selectionFlags;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ ListObj_Convert, &list,
+ &selectionFlags))
+ return NULL;
+ SetListSelectionFlags(list,
+ selectionFlags);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *List_as_List(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ Handle h;
+ ListObject *l;
+ if (!PyArg_ParseTuple(_args, "O&", ResObj_Convert, &h))
+ return NULL;
+ l = (ListObject *)ListObj_New(as_List(h));
+ l->ob_must_be_disposed = 0;
+ _res = Py_BuildValue("O", l);
+ 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,
+ PyDoc_STR("(Rect rView, Rect dataBounds, Point cSize, short theProc, WindowPtr theWindow, Boolean drawIt, Boolean hasGrow, Boolean scrollHoriz, Boolean scrollVert) -> (ListHandle _rv)")},
+ {"SetListViewBounds", (PyCFunction)List_SetListViewBounds, 1,
+ PyDoc_STR("(ListHandle list, Rect view) -> None")},
+ {"SetListPort", (PyCFunction)List_SetListPort, 1,
+ PyDoc_STR("(ListHandle list, CGrafPtr port) -> None")},
+ {"SetListCellIndent", (PyCFunction)List_SetListCellIndent, 1,
+ PyDoc_STR("(ListHandle list, Point indent) -> None")},
+ {"SetListClickTime", (PyCFunction)List_SetListClickTime, 1,
+ PyDoc_STR("(ListHandle list, SInt32 time) -> None")},
+ {"SetListRefCon", (PyCFunction)List_SetListRefCon, 1,
+ PyDoc_STR("(ListHandle list, SInt32 refCon) -> None")},
+ {"SetListUserHandle", (PyCFunction)List_SetListUserHandle, 1,
+ PyDoc_STR("(ListHandle list, Handle userHandle) -> None")},
+ {"SetListFlags", (PyCFunction)List_SetListFlags, 1,
+ PyDoc_STR("(ListHandle list, OptionBits listFlags) -> None")},
+ {"SetListSelectionFlags", (PyCFunction)List_SetListSelectionFlags, 1,
+ 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,
+ Boolean selected,
+ Rect *cellRect,
+ Cell theCell,
+ SInt16 dataOffset,
+ SInt16 dataLen,
+ ListHandle theList)
+{
+ PyObject *listDefFunc, *args, *rv=NULL;
+ ListObject *self;
+
+ self = (ListObject*)GetListRefCon(theList);
+ if (self == NULL || self->ob_itself != theList)
+ return; /* nothing we can do */
+ listDefFunc = self->ob_ldef_func;
+ if (listDefFunc == NULL)
+ return; /* nothing we can do */
+ args = Py_BuildValue("hbO&O&hhO", message,
+ selected,
+ PyMac_BuildRect, cellRect,
+ PyMac_BuildPoint, theCell,
+ dataOffset,
+ dataLen,
+ self);
+ if (args != NULL) {
+ rv = PyEval_CallObject(listDefFunc, args);
+ Py_DECREF(args);
+ }
+ if (rv == NULL) {
+ PySys_WriteStderr("error in list definition callback:\n");
+ PyErr_Print();
+ } else {
+ Py_DECREF(rv);
+ }
+}
+#endif /* __LP64__ */
+
+
+void init_List(void)
+{
+ PyObject *m;
+#ifndef __LP64__
+ PyObject *d;
+
+
+
+ myListDefFunctionUPP = NewListDefUPP((ListDefProcPtr)myListDefFunction);
+
+ 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 ||
+ PyDict_SetItemString(d, "Error", List_Error) != 0)
+ return;
+ List_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&List_Type) < 0) return;
+ Py_INCREF(&List_Type);
+ PyModule_AddObject(m, "List", (PyObject *)&List_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&List_Type);
+ PyModule_AddObject(m, "ListType", (PyObject *)&List_Type);
+#endif /* __LP64__ */
+}
+
+/* ======================== End module _List ======================== */
+
diff --git a/Mac/Modules/list/listscan.py b/Mac/Modules/list/listscan.py
new file mode 100644
index 0000000000..a0274595be
--- /dev/null
+++ b/Mac/Modules/list/listscan.py
@@ -0,0 +1,87 @@
+# Scan an Apple header file, generating a Python file of generator calls.
+
+import sys
+from bgenlocations import TOOLBOXDIR, BGENDIR
+sys.path.append(BGENDIR)
+from scantools import Scanner
+
+LONG = "Lists"
+SHORT = "list"
+OBJECT = "ListHandle"
+
+def main():
+ input = LONG + ".h"
+ output = SHORT + "gen.py"
+ defsoutput = TOOLBOXDIR + LONG + ".py"
+ scanner = MyScanner(input, output, defsoutput)
+ scanner.scan()
+ scanner.close()
+ print "=== Testing definitions output code ==="
+ execfile(defsoutput, {}, {})
+ print "=== Done scanning and generating, now importing the generated code... ==="
+ exec "import " + SHORT + "support"
+ print "=== Done. It's up to you to compile it now! ==="
+
+class MyScanner(Scanner):
+
+ def destination(self, type, name, arglist):
+ classname = "Function"
+ listname = "functions"
+ if arglist:
+ t, n, m = arglist[-1]
+ # This is non-functional today
+ if t in ('ListHandle', 'ListRef') and m == "InMode":
+ classname = "Method"
+ listname = "methods"
+ return classname, listname
+
+ def makeblacklistnames(self):
+ return [
+ "LDispose", # Done by removing the object
+ "LSearch", # We don't want to handle procs just yet
+ "CreateCustomList", # done manually
+ "SetListDefinitionProc",
+
+ # These have funny argument/return values
+ "GetListViewBounds",
+ "GetListCellIndent",
+ "GetListCellSize",
+ "GetListVisibleCells",
+ "GetListClickLocation",
+ "GetListMouseLocation",
+ "GetListDataBounds",
+ "SetListLastClick",
+ ]
+
+ def makeblacklisttypes(self):
+ return [
+ "ListClickLoopUPP", # Too difficult for now
+ "ListDefSpecPtr", # later
+ ]
+
+ def makerepairinstructions(self):
+ return [
+ ([('ListBounds_ptr', '*', 'InMode')],
+ [('Rect_ptr', '*', 'InMode')]),
+
+ ([("Cell", "theCell", "OutMode")],
+ [("Cell", "theCell", "InOutMode")]),
+
+ ([("void_ptr", "*", "InMode"), ("short", "*", "InMode")],
+ [("InBufferShortsize", "*", "*")]),
+
+ ([("void", "*", "OutMode"), ("short", "*", "OutMode")],
+ [("VarOutBufferShortsize", "*", "InOutMode")]),
+
+ # SetListCellIndent doesn't have const
+ ([("Point", "indent", "OutMode")],
+ [("Point_ptr", "indent", "InMode")]),
+
+ ]
+
+ def writeinitialdefs(self):
+ self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/Mac/Modules/list/listsupport.py b/Mac/Modules/list/listsupport.py
new file mode 100644
index 0000000000..93baede806
--- /dev/null
+++ b/Mac/Modules/list/listsupport.py
@@ -0,0 +1,255 @@
+# This script generates a Python interface for an Apple Macintosh Manager.
+# It uses the "bgen" package to generate C code.
+# The function specifications are generated by scanning the mamager's header file,
+# using the "scantools" package (customized for this particular manager).
+
+import string
+
+# Declarations that change for each manager
+MACHEADERFILE = 'Lists.h' # The Apple header file
+MODNAME = '_List' # The name of the module
+OBJECTNAME = 'List' # The basic name of the objects used here
+KIND = 'Handle' # Usually 'Ptr' or 'Handle'
+
+# The following is *usually* unchanged but may still require tuning
+MODPREFIX = 'List' # The prefix for module-wide routines
+OBJECTTYPE = "ListHandle" # The C type used to represent them
+OBJECTPREFIX = MODPREFIX + 'Obj' # The prefix for object methods
+INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner
+OUTPUTFILE = MODNAME + "module.c" # The file generated by this program
+
+from macsupport import *
+
+# Create the type objects
+ListHandle = OpaqueByValueType("ListHandle", "ListObj")
+ListRef = ListHandle # Obsolete, but used in Lists.h
+Cell = Point
+ListBounds = Rect
+ListBounds_ptr = Rect_ptr
+
+ListDefSpec = ListDefSpec_ptr = OpaqueType("ListDefSpec", "PyMac_BuildListDefSpec", "PyMac_GetListDefSpec")
+
+VarOutBufferShortsize = VarHeapOutputBufferType('char', 'short', 's') # (buf, &len)
+InBufferShortsize = VarInputBufferType('char', 'short', 's') # (buf, len)
+
+RgnHandle = OpaqueByValueType("RgnHandle", "ResObj")
+DataHandle = OpaqueByValueType("DataHandle", "ResObj")
+Handle = OpaqueByValueType("Handle", "ResObj")
+CGrafPtr = OpaqueByValueType("CGrafPtr", "GrafObj")
+EventModifiers = Type("EventModifiers", "H")
+
+includestuff = includestuff + """
+#include <Carbon/Carbon.h>
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_ListObj_New(ListHandle);
+extern int _ListObj_Convert(PyObject *, ListHandle *);
+
+#define ListObj_New _ListObj_New
+#define ListObj_Convert _ListObj_Convert
+#endif
+
+#define as_List(x) ((ListHandle)x)
+#define as_Resource(lh) ((Handle)lh)
+
+static ListDefUPP myListDefFunctionUPP;
+
+"""
+
+initstuff = initstuff + """
+myListDefFunctionUPP = NewListDefUPP((ListDefProcPtr)myListDefFunction);
+
+PyMac_INIT_TOOLBOX_OBJECT_NEW(ListHandle, ListObj_New);
+PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ListHandle, ListObj_Convert);
+"""
+
+class ListMethodGenerator(MethodGenerator):
+ """Similar to MethodGenerator, but has self as last argument"""
+
+ def parseArgumentList(self, args):
+ args, a0 = args[:-1], args[-1]
+ t0, n0, m0 = a0
+ if m0 != InMode:
+ raise ValueError, "method's 'self' must be 'InMode'"
+ self.itself = Variable(t0, "_self->ob_itself", SelfMode)
+ FunctionGenerator.parseArgumentList(self, args)
+ self.argumentList.append(self.itself)
+
+class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
+ # XXXX Should inherit from Resource
+ getsetlist = [(
+ 'listFlags',
+ 'return Py_BuildValue("l", (long)GetListFlags(self->ob_itself) & 0xff);',
+ 'if (!PyArg_Parse(v, "B", &(*self->ob_itself)->listFlags)) return -1;',
+ None,
+ ), (
+ 'selFlags',
+ 'return Py_BuildValue("l", (long)GetListSelectionFlags(self->ob_itself) & 0xff);',
+ 'if (!PyArg_Parse(v, "B", &(*self->ob_itself)->selFlags)) return -1;',
+ None,
+ ), (
+ 'cellSize',
+ 'return Py_BuildValue("O&", PyMac_BuildPoint, (*self->ob_itself)->cellSize);',
+ 'if (!PyArg_Parse(v, "O&", PyMac_GetPoint, &(*self->ob_itself)->cellSize)) return -1;',
+ None
+ )]
+
+ def outputStructMembers(self):
+ ObjectDefinition.outputStructMembers(self)
+ Output("PyObject *ob_ldef_func;")
+ Output("int ob_must_be_disposed;")
+
+ def outputCheckNewArg(self):
+ Output("""if (itself == NULL) {
+ PyErr_SetString(List_Error,"Cannot create null List");
+ return NULL;
+ }""")
+
+ def outputInitStructMembers(self):
+ ObjectDefinition.outputInitStructMembers(self)
+ Output("it->ob_ldef_func = NULL;")
+ Output("it->ob_must_be_disposed = 1;")
+ Output("SetListRefCon(itself, (long)it);")
+
+ def outputFreeIt(self, itselfname):
+ Output("Py_XDECREF(self->ob_ldef_func);")
+ Output("self->ob_ldef_func = NULL;")
+ Output("SetListRefCon(self->ob_itself, (long)0);")
+ Output("if (self->ob_must_be_disposed && %s) LDispose(%s);", itselfname, itselfname)
+
+# From here on it's basically all boiler plate...
+
+finalstuff = finalstuff + """
+static void myListDefFunction(SInt16 message,
+ Boolean selected,
+ Rect *cellRect,
+ Cell theCell,
+ SInt16 dataOffset,
+ SInt16 dataLen,
+ ListHandle theList)
+{
+ PyObject *listDefFunc, *args, *rv=NULL;
+ ListObject *self;
+
+ self = (ListObject*)GetListRefCon(theList);
+ if (self == NULL || self->ob_itself != theList)
+ return; /* nothing we can do */
+ listDefFunc = self->ob_ldef_func;
+ if (listDefFunc == NULL)
+ return; /* nothing we can do */
+ args = Py_BuildValue("hbO&O&hhO", message,
+ selected,
+ PyMac_BuildRect, cellRect,
+ PyMac_BuildPoint, theCell,
+ dataOffset,
+ dataLen,
+ self);
+ if (args != NULL) {
+ rv = PyEval_CallObject(listDefFunc, args);
+ Py_DECREF(args);
+ }
+ if (rv == NULL) {
+ PySys_WriteStderr("error in list definition callback:\\n");
+ PyErr_Print();
+ } else {
+ Py_DECREF(rv);
+ }
+}
+"""
+
+# Create the generator groups and link them
+module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff)
+object = MyObjectDefinition(OBJECTNAME, OBJECTPREFIX, OBJECTTYPE)
+module.addobject(object)
+
+# Create the generator classes used to populate the lists
+Function = FunctionGenerator
+Method = ListMethodGenerator
+
+# Create and populate the lists
+functions = []
+methods = []
+execfile(INPUTFILE)
+
+# Function to convert any handle to a list and vv.
+##f = Function(ListHandle, 'as_List', (Handle, 'h', InMode))
+as_List_body = """
+Handle h;
+ListObject *l;
+if (!PyArg_ParseTuple(_args, "O&", ResObj_Convert, &h))
+ return NULL;
+l = (ListObject *)ListObj_New(as_List(h));
+l->ob_must_be_disposed = 0;
+_res = Py_BuildValue("O", l);
+return _res;
+"""
+f = ManualGenerator("as_List", as_List_body)
+f.docstring = lambda: "(Resource)->List.\nReturns List object (which is not auto-freed!)"
+functions.append(f)
+
+f = Method(Handle, 'as_Resource', (ListHandle, 'lh', InMode))
+methods.append(f)
+
+# Manual generator for CreateCustomList, due to callback ideosyncracies
+CreateCustomList_body = """\
+Rect rView;
+Rect dataBounds;
+Point cellSize;
+
+PyObject *listDefFunc;
+ListDefSpec theSpec;
+WindowPtr theWindow;
+Boolean drawIt;
+Boolean hasGrow;
+Boolean scrollHoriz;
+Boolean scrollVert;
+ListHandle outList;
+
+if (!PyArg_ParseTuple(_args, "O&O&O&(iO)O&bbbb",
+ PyMac_GetRect, &rView,
+ PyMac_GetRect, &dataBounds,
+ PyMac_GetPoint, &cellSize,
+ &theSpec.defType, &listDefFunc,
+ WinObj_Convert, &theWindow,
+ &drawIt,
+ &hasGrow,
+ &scrollHoriz,
+ &scrollVert))
+ return NULL;
+
+
+/* Carbon applications use the CreateCustomList API */
+theSpec.u.userProc = myListDefFunctionUPP;
+CreateCustomList(&rView,
+ &dataBounds,
+ cellSize,
+ &theSpec,
+ theWindow,
+ drawIt,
+ hasGrow,
+ scrollHoriz,
+ scrollVert,
+ &outList);
+
+
+_res = ListObj_New(outList);
+if (_res == NULL)
+ return NULL;
+Py_INCREF(listDefFunc);
+((ListObject*)_res)->ob_ldef_func = listDefFunc;
+return _res;\
+"""
+
+f = ManualGenerator("CreateCustomList", CreateCustomList_body);
+f.docstring = lambda: "(Rect rView, Rect dataBounds, Point cellSize, ListDefSpec theSpec, WindowPtr theWindow, Boolean drawIt, Boolean hasGrow, Boolean scrollHoriz, Boolean scrollVert) -> (ListHandle outList)"
+module.add(f)
+
+# add the populated lists to the generator groups
+# (in a different wordl the scan program would generate this)
+for f in functions: module.add(f)
+for f in methods: object.add(f)
+
+
+# generate output (open the output file as late as possible)
+SetOutputFileName(OUTPUTFILE)
+module.generate()
diff --git a/Mac/Modules/menu/_Menumodule.c b/Mac/Modules/menu/_Menumodule.c
new file mode 100644
index 0000000000..dbb075c1d2
--- /dev/null
+++ b/Mac/Modules/menu/_Menumodule.c
@@ -0,0 +1,3477 @@
+
+/* ========================== Module _Menu ========================== */
+
+#include "Python.h"
+
+#ifndef __LP64__
+
+
+#include "pymactoolbox.h"
+
+/* Macro to test whether a weak-loaded CFM function exists */
+#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
+ PyErr_SetString(PyExc_NotImplementedError, \
+ "Not available in this shared library/OS version"); \
+ return NULL; \
+ }} while(0)
+
+
+#include <Carbon/Carbon.h>
+
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+
+extern PyObject *_MenuObj_New(MenuHandle);
+extern int _MenuObj_Convert(PyObject *, MenuHandle *);
+
+#define MenuObj_New _MenuObj_New
+#define MenuObj_Convert _MenuObj_Convert
+#endif
+
+#define as_Menu(h) ((MenuHandle)h)
+#define as_Resource(h) ((Handle)h)
+
+
+/* Alternative version of MenuObj_New, which returns None for NULL argument */
+PyObject *OptMenuObj_New(MenuRef itself)
+{
+ if (itself == NULL) {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+ return MenuObj_New(itself);
+}
+
+/* Alternative version of MenuObj_Convert, which returns NULL for a None argument */
+int OptMenuObj_Convert(PyObject *v, MenuRef *p_itself)
+{
+ if ( v == Py_None ) {
+ *p_itself = NULL;
+ return 1;
+ }
+ return MenuObj_Convert(v, p_itself);
+}
+
+static PyObject *Menu_Error;
+
+/* ------------------------ Object type Menu ------------------------ */
+
+PyTypeObject Menu_Type;
+
+#define MenuObj_Check(x) ((x)->ob_type == &Menu_Type || PyObject_TypeCheck((x), &Menu_Type))
+
+typedef struct MenuObject {
+ PyObject_HEAD
+ MenuHandle ob_itself;
+} MenuObject;
+
+PyObject *MenuObj_New(MenuHandle itself)
+{
+ MenuObject *it;
+ it = PyObject_NEW(MenuObject, &Menu_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+
+int MenuObj_Convert(PyObject *v, MenuHandle *p_itself)
+{
+ if (!MenuObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "Menu required");
+ return 0;
+ }
+ *p_itself = ((MenuObject *)v)->ob_itself;
+ return 1;
+}
+
+static void MenuObj_dealloc(MenuObject *self)
+{
+ /* Cleanup of self->ob_itself goes here */
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *MenuObj_DisposeMenu(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef DisposeMenu
+ PyMac_PRECHECK(DisposeMenu);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ DisposeMenu(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_CalcMenuSize(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef CalcMenuSize
+ PyMac_PRECHECK(CalcMenuSize);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ CalcMenuSize(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_CountMenuItems(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UInt16 _rv;
+#ifndef CountMenuItems
+ PyMac_PRECHECK(CountMenuItems);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CountMenuItems(_self->ob_itself);
+ _res = Py_BuildValue("H",
+ _rv);
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuFont(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ SInt16 outFontID;
+ UInt16 outFontSize;
+#ifndef GetMenuFont
+ PyMac_PRECHECK(GetMenuFont);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetMenuFont(_self->ob_itself,
+ &outFontID,
+ &outFontSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("hH",
+ outFontID,
+ outFontSize);
+ return _res;
+}
+
+static PyObject *MenuObj_SetMenuFont(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ SInt16 inFontID;
+ UInt16 inFontSize;
+#ifndef SetMenuFont
+ PyMac_PRECHECK(SetMenuFont);
+#endif
+ if (!PyArg_ParseTuple(_args, "hH",
+ &inFontID,
+ &inFontSize))
+ return NULL;
+ _err = SetMenuFont(_self->ob_itself,
+ inFontID,
+ inFontSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuExcludesMarkColumn(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef GetMenuExcludesMarkColumn
+ PyMac_PRECHECK(GetMenuExcludesMarkColumn);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMenuExcludesMarkColumn(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *MenuObj_SetMenuExcludesMarkColumn(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Boolean excludesMark;
+#ifndef SetMenuExcludesMarkColumn
+ PyMac_PRECHECK(SetMenuExcludesMarkColumn);
+#endif
+ if (!PyArg_ParseTuple(_args, "b",
+ &excludesMark))
+ return NULL;
+ _err = SetMenuExcludesMarkColumn(_self->ob_itself,
+ excludesMark);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_IsValidMenu(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef IsValidMenu
+ PyMac_PRECHECK(IsValidMenu);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsValidMenu(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuRetainCount(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ItemCount _rv;
+#ifndef GetMenuRetainCount
+ PyMac_PRECHECK(GetMenuRetainCount);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMenuRetainCount(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MenuObj_RetainMenu(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+#ifndef RetainMenu
+ PyMac_PRECHECK(RetainMenu);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = RetainMenu(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_ReleaseMenu(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+#ifndef ReleaseMenu
+ PyMac_PRECHECK(ReleaseMenu);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = ReleaseMenu(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_DuplicateMenu(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuHandle outMenu;
+#ifndef DuplicateMenu
+ PyMac_PRECHECK(DuplicateMenu);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = DuplicateMenu(_self->ob_itself,
+ &outMenu);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ MenuObj_New, outMenu);
+ return _res;
+}
+
+static PyObject *MenuObj_CopyMenuTitleAsCFString(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ CFStringRef outString;
+#ifndef CopyMenuTitleAsCFString
+ PyMac_PRECHECK(CopyMenuTitleAsCFString);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = CopyMenuTitleAsCFString(_self->ob_itself,
+ &outString);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, outString);
+ return _res;
+}
+
+static PyObject *MenuObj_SetMenuTitleWithCFString(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ CFStringRef inString;
+#ifndef SetMenuTitleWithCFString
+ PyMac_PRECHECK(SetMenuTitleWithCFString);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFStringRefObj_Convert, &inString))
+ return NULL;
+ _err = SetMenuTitleWithCFString(_self->ob_itself,
+ inString);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_InvalidateMenuSize(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+#ifndef InvalidateMenuSize
+ PyMac_PRECHECK(InvalidateMenuSize);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = InvalidateMenuSize(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_IsMenuSizeInvalid(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef IsMenuSizeInvalid
+ PyMac_PRECHECK(IsMenuSizeInvalid);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsMenuSizeInvalid(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *MenuObj_MacAppendMenu(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Str255 data;
+#ifndef MacAppendMenu
+ PyMac_PRECHECK(MacAppendMenu);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetStr255, data))
+ return NULL;
+ MacAppendMenu(_self->ob_itself,
+ data);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_InsertResMenu(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ResType theType;
+ short afterItem;
+#ifndef InsertResMenu
+ PyMac_PRECHECK(InsertResMenu);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ PyMac_GetOSType, &theType,
+ &afterItem))
+ return NULL;
+ InsertResMenu(_self->ob_itself,
+ theType,
+ afterItem);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_AppendResMenu(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ResType theType;
+#ifndef AppendResMenu
+ PyMac_PRECHECK(AppendResMenu);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &theType))
+ return NULL;
+ AppendResMenu(_self->ob_itself,
+ theType);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_MacInsertMenuItem(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Str255 itemString;
+ short afterItem;
+#ifndef MacInsertMenuItem
+ PyMac_PRECHECK(MacInsertMenuItem);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ PyMac_GetStr255, itemString,
+ &afterItem))
+ return NULL;
+ MacInsertMenuItem(_self->ob_itself,
+ itemString,
+ afterItem);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_DeleteMenuItem(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short item;
+#ifndef DeleteMenuItem
+ PyMac_PRECHECK(DeleteMenuItem);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &item))
+ return NULL;
+ DeleteMenuItem(_self->ob_itself,
+ item);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_InsertFontResMenu(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short afterItem;
+ short scriptFilter;
+#ifndef InsertFontResMenu
+ PyMac_PRECHECK(InsertFontResMenu);
+#endif
+ if (!PyArg_ParseTuple(_args, "hh",
+ &afterItem,
+ &scriptFilter))
+ return NULL;
+ InsertFontResMenu(_self->ob_itself,
+ afterItem,
+ scriptFilter);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_InsertIntlResMenu(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ResType theType;
+ short afterItem;
+ short scriptFilter;
+#ifndef InsertIntlResMenu
+ PyMac_PRECHECK(InsertIntlResMenu);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetOSType, &theType,
+ &afterItem,
+ &scriptFilter))
+ return NULL;
+ InsertIntlResMenu(_self->ob_itself,
+ theType,
+ afterItem,
+ scriptFilter);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_AppendMenuItemText(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Str255 inString;
+#ifndef AppendMenuItemText
+ PyMac_PRECHECK(AppendMenuItemText);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetStr255, inString))
+ return NULL;
+ _err = AppendMenuItemText(_self->ob_itself,
+ inString);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_InsertMenuItemText(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Str255 inString;
+ MenuItemIndex afterItem;
+#ifndef InsertMenuItemText
+ PyMac_PRECHECK(InsertMenuItemText);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ PyMac_GetStr255, inString,
+ &afterItem))
+ return NULL;
+ _err = InsertMenuItemText(_self->ob_itself,
+ inString,
+ afterItem);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_CopyMenuItems(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuItemIndex inFirstItem;
+ ItemCount inNumItems;
+ MenuHandle inDestMenu;
+ MenuItemIndex inInsertAfter;
+#ifndef CopyMenuItems
+ PyMac_PRECHECK(CopyMenuItems);
+#endif
+ if (!PyArg_ParseTuple(_args, "hlO&h",
+ &inFirstItem,
+ &inNumItems,
+ MenuObj_Convert, &inDestMenu,
+ &inInsertAfter))
+ return NULL;
+ _err = CopyMenuItems(_self->ob_itself,
+ inFirstItem,
+ inNumItems,
+ inDestMenu,
+ inInsertAfter);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_DeleteMenuItems(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuItemIndex inFirstItem;
+ ItemCount inNumItems;
+#ifndef DeleteMenuItems
+ PyMac_PRECHECK(DeleteMenuItems);
+#endif
+ if (!PyArg_ParseTuple(_args, "hl",
+ &inFirstItem,
+ &inNumItems))
+ return NULL;
+ _err = DeleteMenuItems(_self->ob_itself,
+ inFirstItem,
+ inNumItems);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_AppendMenuItemTextWithCFString(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ CFStringRef inString;
+ MenuItemAttributes inAttributes;
+ MenuCommand inCommandID;
+ MenuItemIndex outNewItem;
+#ifndef AppendMenuItemTextWithCFString
+ PyMac_PRECHECK(AppendMenuItemTextWithCFString);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ CFStringRefObj_Convert, &inString,
+ &inAttributes,
+ &inCommandID))
+ return NULL;
+ _err = AppendMenuItemTextWithCFString(_self->ob_itself,
+ inString,
+ inAttributes,
+ inCommandID,
+ &outNewItem);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ outNewItem);
+ return _res;
+}
+
+static PyObject *MenuObj_InsertMenuItemTextWithCFString(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ CFStringRef inString;
+ MenuItemIndex inAfterItem;
+ MenuItemAttributes inAttributes;
+ MenuCommand inCommandID;
+#ifndef InsertMenuItemTextWithCFString
+ PyMac_PRECHECK(InsertMenuItemTextWithCFString);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hll",
+ CFStringRefObj_Convert, &inString,
+ &inAfterItem,
+ &inAttributes,
+ &inCommandID))
+ return NULL;
+ _err = InsertMenuItemTextWithCFString(_self->ob_itself,
+ inString,
+ inAfterItem,
+ inAttributes,
+ inCommandID);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_PopUpMenuSelect(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ short top;
+ short left;
+ short popUpItem;
+#ifndef PopUpMenuSelect
+ PyMac_PRECHECK(PopUpMenuSelect);
+#endif
+ if (!PyArg_ParseTuple(_args, "hhh",
+ &top,
+ &left,
+ &popUpItem))
+ return NULL;
+ _rv = PopUpMenuSelect(_self->ob_itself,
+ top,
+ left,
+ popUpItem);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MenuObj_InvalidateMenuEnabling(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+#ifndef InvalidateMenuEnabling
+ PyMac_PRECHECK(InvalidateMenuEnabling);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = InvalidateMenuEnabling(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_IsMenuBarInvalid(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef IsMenuBarInvalid
+ PyMac_PRECHECK(IsMenuBarInvalid);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsMenuBarInvalid(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *MenuObj_MacInsertMenu(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuID beforeID;
+#ifndef MacInsertMenu
+ PyMac_PRECHECK(MacInsertMenu);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &beforeID))
+ return NULL;
+ MacInsertMenu(_self->ob_itself,
+ beforeID);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_SetRootMenu(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+#ifndef SetRootMenu
+ PyMac_PRECHECK(SetRootMenu);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = SetRootMenu(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_MacCheckMenuItem(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short item;
+ Boolean checked;
+#ifndef MacCheckMenuItem
+ PyMac_PRECHECK(MacCheckMenuItem);
+#endif
+ if (!PyArg_ParseTuple(_args, "hb",
+ &item,
+ &checked))
+ return NULL;
+ MacCheckMenuItem(_self->ob_itself,
+ item,
+ checked);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_SetMenuItemText(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short item;
+ Str255 itemString;
+#ifndef SetMenuItemText
+ PyMac_PRECHECK(SetMenuItemText);
+#endif
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &item,
+ PyMac_GetStr255, itemString))
+ return NULL;
+ SetMenuItemText(_self->ob_itself,
+ item,
+ itemString);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuItemText(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short item;
+ Str255 itemString;
+#ifndef GetMenuItemText
+ PyMac_PRECHECK(GetMenuItemText);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &item))
+ return NULL;
+ GetMenuItemText(_self->ob_itself,
+ item,
+ itemString);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildStr255, itemString);
+ return _res;
+}
+
+static PyObject *MenuObj_SetItemMark(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short item;
+ CharParameter markChar;
+#ifndef SetItemMark
+ PyMac_PRECHECK(SetItemMark);
+#endif
+ if (!PyArg_ParseTuple(_args, "hh",
+ &item,
+ &markChar))
+ return NULL;
+ SetItemMark(_self->ob_itself,
+ item,
+ markChar);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_GetItemMark(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short item;
+ CharParameter markChar;
+#ifndef GetItemMark
+ PyMac_PRECHECK(GetItemMark);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &item))
+ return NULL;
+ GetItemMark(_self->ob_itself,
+ item,
+ &markChar);
+ _res = Py_BuildValue("h",
+ markChar);
+ return _res;
+}
+
+static PyObject *MenuObj_SetItemCmd(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short item;
+ CharParameter cmdChar;
+#ifndef SetItemCmd
+ PyMac_PRECHECK(SetItemCmd);
+#endif
+ if (!PyArg_ParseTuple(_args, "hh",
+ &item,
+ &cmdChar))
+ return NULL;
+ SetItemCmd(_self->ob_itself,
+ item,
+ cmdChar);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_GetItemCmd(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short item;
+ CharParameter cmdChar;
+#ifndef GetItemCmd
+ PyMac_PRECHECK(GetItemCmd);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &item))
+ return NULL;
+ GetItemCmd(_self->ob_itself,
+ item,
+ &cmdChar);
+ _res = Py_BuildValue("h",
+ cmdChar);
+ return _res;
+}
+
+static PyObject *MenuObj_SetItemIcon(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short item;
+ short iconIndex;
+#ifndef SetItemIcon
+ PyMac_PRECHECK(SetItemIcon);
+#endif
+ if (!PyArg_ParseTuple(_args, "hh",
+ &item,
+ &iconIndex))
+ return NULL;
+ SetItemIcon(_self->ob_itself,
+ item,
+ iconIndex);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_GetItemIcon(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short item;
+ short iconIndex;
+#ifndef GetItemIcon
+ PyMac_PRECHECK(GetItemIcon);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &item))
+ return NULL;
+ GetItemIcon(_self->ob_itself,
+ item,
+ &iconIndex);
+ _res = Py_BuildValue("h",
+ iconIndex);
+ return _res;
+}
+
+static PyObject *MenuObj_SetItemStyle(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short item;
+ StyleParameter chStyle;
+#ifndef SetItemStyle
+ PyMac_PRECHECK(SetItemStyle);
+#endif
+ if (!PyArg_ParseTuple(_args, "hh",
+ &item,
+ &chStyle))
+ return NULL;
+ SetItemStyle(_self->ob_itself,
+ item,
+ chStyle);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_GetItemStyle(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short item;
+ Style chStyle;
+#ifndef GetItemStyle
+ PyMac_PRECHECK(GetItemStyle);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &item))
+ return NULL;
+ GetItemStyle(_self->ob_itself,
+ item,
+ &chStyle);
+ _res = Py_BuildValue("b",
+ chStyle);
+ return _res;
+}
+
+static PyObject *MenuObj_SetMenuItemCommandID(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItem;
+ MenuCommand inCommandID;
+#ifndef SetMenuItemCommandID
+ PyMac_PRECHECK(SetMenuItemCommandID);
+#endif
+ if (!PyArg_ParseTuple(_args, "hl",
+ &inItem,
+ &inCommandID))
+ return NULL;
+ _err = SetMenuItemCommandID(_self->ob_itself,
+ inItem,
+ inCommandID);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuItemCommandID(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItem;
+ MenuCommand outCommandID;
+#ifndef GetMenuItemCommandID
+ PyMac_PRECHECK(GetMenuItemCommandID);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &inItem))
+ return NULL;
+ _err = GetMenuItemCommandID(_self->ob_itself,
+ inItem,
+ &outCommandID);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outCommandID);
+ return _res;
+}
+
+static PyObject *MenuObj_SetMenuItemModifiers(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItem;
+ UInt8 inModifiers;
+#ifndef SetMenuItemModifiers
+ PyMac_PRECHECK(SetMenuItemModifiers);
+#endif
+ if (!PyArg_ParseTuple(_args, "hb",
+ &inItem,
+ &inModifiers))
+ return NULL;
+ _err = SetMenuItemModifiers(_self->ob_itself,
+ inItem,
+ inModifiers);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuItemModifiers(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItem;
+ UInt8 outModifiers;
+#ifndef GetMenuItemModifiers
+ PyMac_PRECHECK(GetMenuItemModifiers);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &inItem))
+ return NULL;
+ _err = GetMenuItemModifiers(_self->ob_itself,
+ inItem,
+ &outModifiers);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("b",
+ outModifiers);
+ return _res;
+}
+
+static PyObject *MenuObj_SetMenuItemIconHandle(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItem;
+ UInt8 inIconType;
+ Handle inIconHandle;
+#ifndef SetMenuItemIconHandle
+ PyMac_PRECHECK(SetMenuItemIconHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, "hbO&",
+ &inItem,
+ &inIconType,
+ ResObj_Convert, &inIconHandle))
+ return NULL;
+ _err = SetMenuItemIconHandle(_self->ob_itself,
+ inItem,
+ inIconType,
+ inIconHandle);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuItemIconHandle(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItem;
+ UInt8 outIconType;
+ Handle outIconHandle;
+#ifndef GetMenuItemIconHandle
+ PyMac_PRECHECK(GetMenuItemIconHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &inItem))
+ return NULL;
+ _err = GetMenuItemIconHandle(_self->ob_itself,
+ inItem,
+ &outIconType,
+ &outIconHandle);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("bO&",
+ outIconType,
+ ResObj_New, outIconHandle);
+ return _res;
+}
+
+static PyObject *MenuObj_SetMenuItemTextEncoding(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItem;
+ TextEncoding inScriptID;
+#ifndef SetMenuItemTextEncoding
+ PyMac_PRECHECK(SetMenuItemTextEncoding);
+#endif
+ if (!PyArg_ParseTuple(_args, "hl",
+ &inItem,
+ &inScriptID))
+ return NULL;
+ _err = SetMenuItemTextEncoding(_self->ob_itself,
+ inItem,
+ inScriptID);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuItemTextEncoding(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItem;
+ TextEncoding outScriptID;
+#ifndef GetMenuItemTextEncoding
+ PyMac_PRECHECK(GetMenuItemTextEncoding);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &inItem))
+ return NULL;
+ _err = GetMenuItemTextEncoding(_self->ob_itself,
+ inItem,
+ &outScriptID);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outScriptID);
+ return _res;
+}
+
+static PyObject *MenuObj_SetMenuItemHierarchicalID(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItem;
+ MenuID inHierID;
+#ifndef SetMenuItemHierarchicalID
+ PyMac_PRECHECK(SetMenuItemHierarchicalID);
+#endif
+ if (!PyArg_ParseTuple(_args, "hh",
+ &inItem,
+ &inHierID))
+ return NULL;
+ _err = SetMenuItemHierarchicalID(_self->ob_itself,
+ inItem,
+ inHierID);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuItemHierarchicalID(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItem;
+ MenuID outHierID;
+#ifndef GetMenuItemHierarchicalID
+ PyMac_PRECHECK(GetMenuItemHierarchicalID);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &inItem))
+ return NULL;
+ _err = GetMenuItemHierarchicalID(_self->ob_itself,
+ inItem,
+ &outHierID);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ outHierID);
+ return _res;
+}
+
+static PyObject *MenuObj_SetMenuItemFontID(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItem;
+ SInt16 inFontID;
+#ifndef SetMenuItemFontID
+ PyMac_PRECHECK(SetMenuItemFontID);
+#endif
+ if (!PyArg_ParseTuple(_args, "hh",
+ &inItem,
+ &inFontID))
+ return NULL;
+ _err = SetMenuItemFontID(_self->ob_itself,
+ inItem,
+ inFontID);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuItemFontID(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItem;
+ SInt16 outFontID;
+#ifndef GetMenuItemFontID
+ PyMac_PRECHECK(GetMenuItemFontID);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &inItem))
+ return NULL;
+ _err = GetMenuItemFontID(_self->ob_itself,
+ inItem,
+ &outFontID);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ outFontID);
+ return _res;
+}
+
+static PyObject *MenuObj_SetMenuItemRefCon(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItem;
+ UInt32 inRefCon;
+#ifndef SetMenuItemRefCon
+ PyMac_PRECHECK(SetMenuItemRefCon);
+#endif
+ if (!PyArg_ParseTuple(_args, "hl",
+ &inItem,
+ &inRefCon))
+ return NULL;
+ _err = SetMenuItemRefCon(_self->ob_itself,
+ inItem,
+ inRefCon);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuItemRefCon(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItem;
+ UInt32 outRefCon;
+#ifndef GetMenuItemRefCon
+ PyMac_PRECHECK(GetMenuItemRefCon);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &inItem))
+ return NULL;
+ _err = GetMenuItemRefCon(_self->ob_itself,
+ inItem,
+ &outRefCon);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outRefCon);
+ return _res;
+}
+
+static PyObject *MenuObj_SetMenuItemKeyGlyph(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItem;
+ SInt16 inGlyph;
+#ifndef SetMenuItemKeyGlyph
+ PyMac_PRECHECK(SetMenuItemKeyGlyph);
+#endif
+ if (!PyArg_ParseTuple(_args, "hh",
+ &inItem,
+ &inGlyph))
+ return NULL;
+ _err = SetMenuItemKeyGlyph(_self->ob_itself,
+ inItem,
+ inGlyph);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuItemKeyGlyph(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItem;
+ SInt16 outGlyph;
+#ifndef GetMenuItemKeyGlyph
+ PyMac_PRECHECK(GetMenuItemKeyGlyph);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &inItem))
+ return NULL;
+ _err = GetMenuItemKeyGlyph(_self->ob_itself,
+ inItem,
+ &outGlyph);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ outGlyph);
+ return _res;
+}
+
+static PyObject *MenuObj_MacEnableMenuItem(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuItemIndex item;
+#ifndef MacEnableMenuItem
+ PyMac_PRECHECK(MacEnableMenuItem);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &item))
+ return NULL;
+ MacEnableMenuItem(_self->ob_itself,
+ item);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_DisableMenuItem(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuItemIndex item;
+#ifndef DisableMenuItem
+ PyMac_PRECHECK(DisableMenuItem);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &item))
+ return NULL;
+ DisableMenuItem(_self->ob_itself,
+ item);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_IsMenuItemEnabled(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ MenuItemIndex item;
+#ifndef IsMenuItemEnabled
+ PyMac_PRECHECK(IsMenuItemEnabled);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &item))
+ return NULL;
+ _rv = IsMenuItemEnabled(_self->ob_itself,
+ item);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *MenuObj_EnableMenuItemIcon(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuItemIndex item;
+#ifndef EnableMenuItemIcon
+ PyMac_PRECHECK(EnableMenuItemIcon);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &item))
+ return NULL;
+ EnableMenuItemIcon(_self->ob_itself,
+ item);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_DisableMenuItemIcon(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuItemIndex item;
+#ifndef DisableMenuItemIcon
+ PyMac_PRECHECK(DisableMenuItemIcon);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &item))
+ return NULL;
+ DisableMenuItemIcon(_self->ob_itself,
+ item);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_IsMenuItemIconEnabled(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ MenuItemIndex item;
+#ifndef IsMenuItemIconEnabled
+ PyMac_PRECHECK(IsMenuItemIconEnabled);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &item))
+ return NULL;
+ _rv = IsMenuItemIconEnabled(_self->ob_itself,
+ item);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *MenuObj_SetMenuItemHierarchicalMenu(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuItemIndex inItem;
+ MenuHandle inHierMenu;
+#ifndef SetMenuItemHierarchicalMenu
+ PyMac_PRECHECK(SetMenuItemHierarchicalMenu);
+#endif
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &inItem,
+ MenuObj_Convert, &inHierMenu))
+ return NULL;
+ _err = SetMenuItemHierarchicalMenu(_self->ob_itself,
+ inItem,
+ inHierMenu);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuItemHierarchicalMenu(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuItemIndex inItem;
+ MenuHandle outHierMenu;
+#ifndef GetMenuItemHierarchicalMenu
+ PyMac_PRECHECK(GetMenuItemHierarchicalMenu);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &inItem))
+ return NULL;
+ _err = GetMenuItemHierarchicalMenu(_self->ob_itself,
+ inItem,
+ &outHierMenu);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ OptMenuObj_New, outHierMenu);
+ return _res;
+}
+
+static PyObject *MenuObj_CopyMenuItemTextAsCFString(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuItemIndex inItem;
+ CFStringRef outString;
+#ifndef CopyMenuItemTextAsCFString
+ PyMac_PRECHECK(CopyMenuItemTextAsCFString);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &inItem))
+ return NULL;
+ _err = CopyMenuItemTextAsCFString(_self->ob_itself,
+ inItem,
+ &outString);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, outString);
+ return _res;
+}
+
+static PyObject *MenuObj_SetMenuItemTextWithCFString(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuItemIndex inItem;
+ CFStringRef inString;
+#ifndef SetMenuItemTextWithCFString
+ PyMac_PRECHECK(SetMenuItemTextWithCFString);
+#endif
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &inItem,
+ CFStringRefObj_Convert, &inString))
+ return NULL;
+ _err = SetMenuItemTextWithCFString(_self->ob_itself,
+ inItem,
+ inString);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuItemIndent(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuItemIndex inItem;
+ UInt32 outIndent;
+#ifndef GetMenuItemIndent
+ PyMac_PRECHECK(GetMenuItemIndent);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &inItem))
+ return NULL;
+ _err = GetMenuItemIndent(_self->ob_itself,
+ inItem,
+ &outIndent);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outIndent);
+ return _res;
+}
+
+static PyObject *MenuObj_SetMenuItemIndent(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuItemIndex inItem;
+ UInt32 inIndent;
+#ifndef SetMenuItemIndent
+ PyMac_PRECHECK(SetMenuItemIndent);
+#endif
+ if (!PyArg_ParseTuple(_args, "hl",
+ &inItem,
+ &inIndent))
+ return NULL;
+ _err = SetMenuItemIndent(_self->ob_itself,
+ inItem,
+ inIndent);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuItemCommandKey(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuItemIndex inItem;
+ Boolean inGetVirtualKey;
+ UInt16 outKey;
+#ifndef GetMenuItemCommandKey
+ PyMac_PRECHECK(GetMenuItemCommandKey);
+#endif
+ if (!PyArg_ParseTuple(_args, "hb",
+ &inItem,
+ &inGetVirtualKey))
+ return NULL;
+ _err = GetMenuItemCommandKey(_self->ob_itself,
+ inItem,
+ inGetVirtualKey,
+ &outKey);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("H",
+ outKey);
+ return _res;
+}
+
+static PyObject *MenuObj_SetMenuItemCommandKey(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuItemIndex inItem;
+ Boolean inSetVirtualKey;
+ UInt16 inKey;
+#ifndef SetMenuItemCommandKey
+ PyMac_PRECHECK(SetMenuItemCommandKey);
+#endif
+ if (!PyArg_ParseTuple(_args, "hbH",
+ &inItem,
+ &inSetVirtualKey,
+ &inKey))
+ return NULL;
+ _err = SetMenuItemCommandKey(_self->ob_itself,
+ inItem,
+ inSetVirtualKey,
+ inKey);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuItemPropertyAttributes(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuItemIndex item;
+ OSType propertyCreator;
+ OSType propertyTag;
+ UInt32 attributes;
+#ifndef GetMenuItemPropertyAttributes
+ PyMac_PRECHECK(GetMenuItemPropertyAttributes);
+#endif
+ if (!PyArg_ParseTuple(_args, "hO&O&",
+ &item,
+ PyMac_GetOSType, &propertyCreator,
+ PyMac_GetOSType, &propertyTag))
+ return NULL;
+ _err = GetMenuItemPropertyAttributes(_self->ob_itself,
+ item,
+ propertyCreator,
+ propertyTag,
+ &attributes);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ attributes);
+ return _res;
+}
+
+static PyObject *MenuObj_ChangeMenuItemPropertyAttributes(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuItemIndex item;
+ OSType propertyCreator;
+ OSType propertyTag;
+ UInt32 attributesToSet;
+ UInt32 attributesToClear;
+#ifndef ChangeMenuItemPropertyAttributes
+ PyMac_PRECHECK(ChangeMenuItemPropertyAttributes);
+#endif
+ if (!PyArg_ParseTuple(_args, "hO&O&ll",
+ &item,
+ PyMac_GetOSType, &propertyCreator,
+ PyMac_GetOSType, &propertyTag,
+ &attributesToSet,
+ &attributesToClear))
+ return NULL;
+ _err = ChangeMenuItemPropertyAttributes(_self->ob_itself,
+ item,
+ propertyCreator,
+ propertyTag,
+ attributesToSet,
+ attributesToClear);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuAttributes(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuAttributes outAttributes;
+#ifndef GetMenuAttributes
+ PyMac_PRECHECK(GetMenuAttributes);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetMenuAttributes(_self->ob_itself,
+ &outAttributes);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outAttributes);
+ return _res;
+}
+
+static PyObject *MenuObj_ChangeMenuAttributes(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuAttributes setTheseAttributes;
+ MenuAttributes clearTheseAttributes;
+#ifndef ChangeMenuAttributes
+ PyMac_PRECHECK(ChangeMenuAttributes);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &setTheseAttributes,
+ &clearTheseAttributes))
+ return NULL;
+ _err = ChangeMenuAttributes(_self->ob_itself,
+ setTheseAttributes,
+ clearTheseAttributes);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuItemAttributes(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuItemIndex item;
+ MenuItemAttributes outAttributes;
+#ifndef GetMenuItemAttributes
+ PyMac_PRECHECK(GetMenuItemAttributes);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &item))
+ return NULL;
+ _err = GetMenuItemAttributes(_self->ob_itself,
+ item,
+ &outAttributes);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outAttributes);
+ return _res;
+}
+
+static PyObject *MenuObj_ChangeMenuItemAttributes(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuItemIndex item;
+ MenuItemAttributes setTheseAttributes;
+ MenuItemAttributes clearTheseAttributes;
+#ifndef ChangeMenuItemAttributes
+ PyMac_PRECHECK(ChangeMenuItemAttributes);
+#endif
+ if (!PyArg_ParseTuple(_args, "hll",
+ &item,
+ &setTheseAttributes,
+ &clearTheseAttributes))
+ return NULL;
+ _err = ChangeMenuItemAttributes(_self->ob_itself,
+ item,
+ setTheseAttributes,
+ clearTheseAttributes);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_DisableAllMenuItems(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef DisableAllMenuItems
+ PyMac_PRECHECK(DisableAllMenuItems);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ DisableAllMenuItems(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_EnableAllMenuItems(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef EnableAllMenuItems
+ PyMac_PRECHECK(EnableAllMenuItems);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ EnableAllMenuItems(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_MenuHasEnabledItems(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef MenuHasEnabledItems
+ PyMac_PRECHECK(MenuHasEnabledItems);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MenuHasEnabledItems(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuType(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt16 outType;
+#ifndef GetMenuType
+ PyMac_PRECHECK(GetMenuType);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetMenuType(_self->ob_itself,
+ &outType);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("H",
+ outType);
+ return _res;
+}
+
+static PyObject *MenuObj_CountMenuItemsWithCommandID(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ItemCount _rv;
+ MenuCommand inCommandID;
+#ifndef CountMenuItemsWithCommandID
+ PyMac_PRECHECK(CountMenuItemsWithCommandID);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &inCommandID))
+ return NULL;
+ _rv = CountMenuItemsWithCommandID(_self->ob_itself,
+ inCommandID);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MenuObj_GetIndMenuItemWithCommandID(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuCommand inCommandID;
+ UInt32 inItemIndex;
+ MenuHandle outMenu;
+ MenuItemIndex outIndex;
+#ifndef GetIndMenuItemWithCommandID
+ PyMac_PRECHECK(GetIndMenuItemWithCommandID);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &inCommandID,
+ &inItemIndex))
+ return NULL;
+ _err = GetIndMenuItemWithCommandID(_self->ob_itself,
+ inCommandID,
+ inItemIndex,
+ &outMenu,
+ &outIndex);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&h",
+ MenuObj_New, outMenu,
+ outIndex);
+ return _res;
+}
+
+static PyObject *MenuObj_EnableMenuCommand(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuCommand inCommandID;
+#ifndef EnableMenuCommand
+ PyMac_PRECHECK(EnableMenuCommand);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &inCommandID))
+ return NULL;
+ EnableMenuCommand(_self->ob_itself,
+ inCommandID);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_DisableMenuCommand(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuCommand inCommandID;
+#ifndef DisableMenuCommand
+ PyMac_PRECHECK(DisableMenuCommand);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &inCommandID))
+ return NULL;
+ DisableMenuCommand(_self->ob_itself,
+ inCommandID);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_IsMenuCommandEnabled(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ MenuCommand inCommandID;
+#ifndef IsMenuCommandEnabled
+ PyMac_PRECHECK(IsMenuCommandEnabled);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &inCommandID))
+ return NULL;
+ _rv = IsMenuCommandEnabled(_self->ob_itself,
+ inCommandID);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *MenuObj_SetMenuCommandMark(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuCommand inCommandID;
+ UniChar inMark;
+#ifndef SetMenuCommandMark
+ PyMac_PRECHECK(SetMenuCommandMark);
+#endif
+ if (!PyArg_ParseTuple(_args, "lh",
+ &inCommandID,
+ &inMark))
+ return NULL;
+ _err = SetMenuCommandMark(_self->ob_itself,
+ inCommandID,
+ inMark);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuCommandMark(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuCommand inCommandID;
+ UniChar outMark;
+#ifndef GetMenuCommandMark
+ PyMac_PRECHECK(GetMenuCommandMark);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &inCommandID))
+ return NULL;
+ _err = GetMenuCommandMark(_self->ob_itself,
+ inCommandID,
+ &outMark);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ outMark);
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuCommandPropertySize(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuCommand inCommandID;
+ OSType inPropertyCreator;
+ OSType inPropertyTag;
+ ByteCount outSize;
+#ifndef GetMenuCommandPropertySize
+ PyMac_PRECHECK(GetMenuCommandPropertySize);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&O&",
+ &inCommandID,
+ PyMac_GetOSType, &inPropertyCreator,
+ PyMac_GetOSType, &inPropertyTag))
+ return NULL;
+ _err = GetMenuCommandPropertySize(_self->ob_itself,
+ inCommandID,
+ inPropertyCreator,
+ inPropertyTag,
+ &outSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outSize);
+ return _res;
+}
+
+static PyObject *MenuObj_RemoveMenuCommandProperty(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuCommand inCommandID;
+ OSType inPropertyCreator;
+ OSType inPropertyTag;
+#ifndef RemoveMenuCommandProperty
+ PyMac_PRECHECK(RemoveMenuCommandProperty);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&O&",
+ &inCommandID,
+ PyMac_GetOSType, &inPropertyCreator,
+ PyMac_GetOSType, &inPropertyTag))
+ return NULL;
+ _err = RemoveMenuCommandProperty(_self->ob_itself,
+ inCommandID,
+ inPropertyCreator,
+ inPropertyTag);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_IsMenuItemInvalid(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ MenuItemIndex inItem;
+#ifndef IsMenuItemInvalid
+ PyMac_PRECHECK(IsMenuItemInvalid);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &inItem))
+ return NULL;
+ _rv = IsMenuItemInvalid(_self->ob_itself,
+ inItem);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *MenuObj_InvalidateMenuItems(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuItemIndex inFirstItem;
+ ItemCount inNumItems;
+#ifndef InvalidateMenuItems
+ PyMac_PRECHECK(InvalidateMenuItems);
+#endif
+ if (!PyArg_ParseTuple(_args, "hl",
+ &inFirstItem,
+ &inNumItems))
+ return NULL;
+ _err = InvalidateMenuItems(_self->ob_itself,
+ inFirstItem,
+ inNumItems);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_UpdateInvalidMenuItems(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+#ifndef UpdateInvalidMenuItems
+ PyMac_PRECHECK(UpdateInvalidMenuItems);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = UpdateInvalidMenuItems(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_CreateStandardFontMenu(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuItemIndex afterItem;
+ MenuID firstHierMenuID;
+ OptionBits options;
+ ItemCount outHierMenuCount;
+#ifndef CreateStandardFontMenu
+ PyMac_PRECHECK(CreateStandardFontMenu);
+#endif
+ if (!PyArg_ParseTuple(_args, "hhl",
+ &afterItem,
+ &firstHierMenuID,
+ &options))
+ return NULL;
+ _err = CreateStandardFontMenu(_self->ob_itself,
+ afterItem,
+ firstHierMenuID,
+ options,
+ &outHierMenuCount);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outHierMenuCount);
+ return _res;
+}
+
+static PyObject *MenuObj_UpdateStandardFontMenu(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ItemCount outHierMenuCount;
+#ifndef UpdateStandardFontMenu
+ PyMac_PRECHECK(UpdateStandardFontMenu);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = UpdateStandardFontMenu(_self->ob_itself,
+ &outHierMenuCount);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outHierMenuCount);
+ return _res;
+}
+
+static PyObject *MenuObj_GetFontFamilyFromMenuSelection(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuItemIndex item;
+ FMFontFamily outFontFamily;
+ FMFontStyle outStyle;
+#ifndef GetFontFamilyFromMenuSelection
+ PyMac_PRECHECK(GetFontFamilyFromMenuSelection);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &item))
+ return NULL;
+ _err = GetFontFamilyFromMenuSelection(_self->ob_itself,
+ item,
+ &outFontFamily,
+ &outStyle);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("hh",
+ outFontFamily,
+ outStyle);
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuID(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuID _rv;
+#ifndef GetMenuID
+ PyMac_PRECHECK(GetMenuID);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMenuID(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuWidth(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 _rv;
+#ifndef GetMenuWidth
+ PyMac_PRECHECK(GetMenuWidth);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMenuWidth(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuHeight(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 _rv;
+#ifndef GetMenuHeight
+ PyMac_PRECHECK(GetMenuHeight);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMenuHeight(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *MenuObj_SetMenuID(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuID menuID;
+#ifndef SetMenuID
+ PyMac_PRECHECK(SetMenuID);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &menuID))
+ return NULL;
+ SetMenuID(_self->ob_itself,
+ menuID);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_SetMenuWidth(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 width;
+#ifndef SetMenuWidth
+ PyMac_PRECHECK(SetMenuWidth);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &width))
+ return NULL;
+ SetMenuWidth(_self->ob_itself,
+ width);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_SetMenuHeight(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 height;
+#ifndef SetMenuHeight
+ PyMac_PRECHECK(SetMenuHeight);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &height))
+ return NULL;
+ SetMenuHeight(_self->ob_itself,
+ height);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_as_Resource(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+#ifndef as_Resource
+ PyMac_PRECHECK(as_Resource);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = as_Resource(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MenuObj_AppendMenu(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Str255 data;
+#ifndef AppendMenu
+ PyMac_PRECHECK(AppendMenu);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetStr255, data))
+ return NULL;
+ AppendMenu(_self->ob_itself,
+ data);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_InsertMenu(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short beforeID;
+#ifndef InsertMenu
+ PyMac_PRECHECK(InsertMenu);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &beforeID))
+ return NULL;
+ InsertMenu(_self->ob_itself,
+ beforeID);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_InsertMenuItem(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Str255 itemString;
+ short afterItem;
+#ifndef InsertMenuItem
+ PyMac_PRECHECK(InsertMenuItem);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ PyMac_GetStr255, itemString,
+ &afterItem))
+ return NULL;
+ InsertMenuItem(_self->ob_itself,
+ itemString,
+ afterItem);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_EnableMenuItem(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UInt16 item;
+#ifndef EnableMenuItem
+ PyMac_PRECHECK(EnableMenuItem);
+#endif
+ if (!PyArg_ParseTuple(_args, "H",
+ &item))
+ return NULL;
+ EnableMenuItem(_self->ob_itself,
+ item);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_CheckMenuItem(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short item;
+ Boolean checked;
+#ifndef CheckMenuItem
+ PyMac_PRECHECK(CheckMenuItem);
+#endif
+ if (!PyArg_ParseTuple(_args, "hb",
+ &item,
+ &checked))
+ return NULL;
+ CheckMenuItem(_self->ob_itself,
+ item,
+ checked);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyMethodDef MenuObj_methods[] = {
+ {"DisposeMenu", (PyCFunction)MenuObj_DisposeMenu, 1,
+ PyDoc_STR("() -> None")},
+ {"CalcMenuSize", (PyCFunction)MenuObj_CalcMenuSize, 1,
+ PyDoc_STR("() -> None")},
+ {"CountMenuItems", (PyCFunction)MenuObj_CountMenuItems, 1,
+ PyDoc_STR("() -> (UInt16 _rv)")},
+ {"GetMenuFont", (PyCFunction)MenuObj_GetMenuFont, 1,
+ PyDoc_STR("() -> (SInt16 outFontID, UInt16 outFontSize)")},
+ {"SetMenuFont", (PyCFunction)MenuObj_SetMenuFont, 1,
+ PyDoc_STR("(SInt16 inFontID, UInt16 inFontSize) -> None")},
+ {"GetMenuExcludesMarkColumn", (PyCFunction)MenuObj_GetMenuExcludesMarkColumn, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"SetMenuExcludesMarkColumn", (PyCFunction)MenuObj_SetMenuExcludesMarkColumn, 1,
+ PyDoc_STR("(Boolean excludesMark) -> None")},
+ {"IsValidMenu", (PyCFunction)MenuObj_IsValidMenu, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"GetMenuRetainCount", (PyCFunction)MenuObj_GetMenuRetainCount, 1,
+ PyDoc_STR("() -> (ItemCount _rv)")},
+ {"RetainMenu", (PyCFunction)MenuObj_RetainMenu, 1,
+ PyDoc_STR("() -> None")},
+ {"ReleaseMenu", (PyCFunction)MenuObj_ReleaseMenu, 1,
+ PyDoc_STR("() -> None")},
+ {"DuplicateMenu", (PyCFunction)MenuObj_DuplicateMenu, 1,
+ PyDoc_STR("() -> (MenuHandle outMenu)")},
+ {"CopyMenuTitleAsCFString", (PyCFunction)MenuObj_CopyMenuTitleAsCFString, 1,
+ PyDoc_STR("() -> (CFStringRef outString)")},
+ {"SetMenuTitleWithCFString", (PyCFunction)MenuObj_SetMenuTitleWithCFString, 1,
+ PyDoc_STR("(CFStringRef inString) -> None")},
+ {"InvalidateMenuSize", (PyCFunction)MenuObj_InvalidateMenuSize, 1,
+ PyDoc_STR("() -> None")},
+ {"IsMenuSizeInvalid", (PyCFunction)MenuObj_IsMenuSizeInvalid, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"MacAppendMenu", (PyCFunction)MenuObj_MacAppendMenu, 1,
+ PyDoc_STR("(Str255 data) -> None")},
+ {"InsertResMenu", (PyCFunction)MenuObj_InsertResMenu, 1,
+ PyDoc_STR("(ResType theType, short afterItem) -> None")},
+ {"AppendResMenu", (PyCFunction)MenuObj_AppendResMenu, 1,
+ PyDoc_STR("(ResType theType) -> None")},
+ {"MacInsertMenuItem", (PyCFunction)MenuObj_MacInsertMenuItem, 1,
+ PyDoc_STR("(Str255 itemString, short afterItem) -> None")},
+ {"DeleteMenuItem", (PyCFunction)MenuObj_DeleteMenuItem, 1,
+ PyDoc_STR("(short item) -> None")},
+ {"InsertFontResMenu", (PyCFunction)MenuObj_InsertFontResMenu, 1,
+ PyDoc_STR("(short afterItem, short scriptFilter) -> None")},
+ {"InsertIntlResMenu", (PyCFunction)MenuObj_InsertIntlResMenu, 1,
+ PyDoc_STR("(ResType theType, short afterItem, short scriptFilter) -> None")},
+ {"AppendMenuItemText", (PyCFunction)MenuObj_AppendMenuItemText, 1,
+ PyDoc_STR("(Str255 inString) -> None")},
+ {"InsertMenuItemText", (PyCFunction)MenuObj_InsertMenuItemText, 1,
+ PyDoc_STR("(Str255 inString, MenuItemIndex afterItem) -> None")},
+ {"CopyMenuItems", (PyCFunction)MenuObj_CopyMenuItems, 1,
+ PyDoc_STR("(MenuItemIndex inFirstItem, ItemCount inNumItems, MenuHandle inDestMenu, MenuItemIndex inInsertAfter) -> None")},
+ {"DeleteMenuItems", (PyCFunction)MenuObj_DeleteMenuItems, 1,
+ PyDoc_STR("(MenuItemIndex inFirstItem, ItemCount inNumItems) -> None")},
+ {"AppendMenuItemTextWithCFString", (PyCFunction)MenuObj_AppendMenuItemTextWithCFString, 1,
+ PyDoc_STR("(CFStringRef inString, MenuItemAttributes inAttributes, MenuCommand inCommandID) -> (MenuItemIndex outNewItem)")},
+ {"InsertMenuItemTextWithCFString", (PyCFunction)MenuObj_InsertMenuItemTextWithCFString, 1,
+ PyDoc_STR("(CFStringRef inString, MenuItemIndex inAfterItem, MenuItemAttributes inAttributes, MenuCommand inCommandID) -> None")},
+ {"PopUpMenuSelect", (PyCFunction)MenuObj_PopUpMenuSelect, 1,
+ PyDoc_STR("(short top, short left, short popUpItem) -> (long _rv)")},
+ {"InvalidateMenuEnabling", (PyCFunction)MenuObj_InvalidateMenuEnabling, 1,
+ PyDoc_STR("() -> None")},
+ {"IsMenuBarInvalid", (PyCFunction)MenuObj_IsMenuBarInvalid, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"MacInsertMenu", (PyCFunction)MenuObj_MacInsertMenu, 1,
+ PyDoc_STR("(MenuID beforeID) -> None")},
+ {"SetRootMenu", (PyCFunction)MenuObj_SetRootMenu, 1,
+ PyDoc_STR("() -> None")},
+ {"MacCheckMenuItem", (PyCFunction)MenuObj_MacCheckMenuItem, 1,
+ PyDoc_STR("(short item, Boolean checked) -> None")},
+ {"SetMenuItemText", (PyCFunction)MenuObj_SetMenuItemText, 1,
+ PyDoc_STR("(short item, Str255 itemString) -> None")},
+ {"GetMenuItemText", (PyCFunction)MenuObj_GetMenuItemText, 1,
+ PyDoc_STR("(short item) -> (Str255 itemString)")},
+ {"SetItemMark", (PyCFunction)MenuObj_SetItemMark, 1,
+ PyDoc_STR("(short item, CharParameter markChar) -> None")},
+ {"GetItemMark", (PyCFunction)MenuObj_GetItemMark, 1,
+ PyDoc_STR("(short item) -> (CharParameter markChar)")},
+ {"SetItemCmd", (PyCFunction)MenuObj_SetItemCmd, 1,
+ PyDoc_STR("(short item, CharParameter cmdChar) -> None")},
+ {"GetItemCmd", (PyCFunction)MenuObj_GetItemCmd, 1,
+ PyDoc_STR("(short item) -> (CharParameter cmdChar)")},
+ {"SetItemIcon", (PyCFunction)MenuObj_SetItemIcon, 1,
+ PyDoc_STR("(short item, short iconIndex) -> None")},
+ {"GetItemIcon", (PyCFunction)MenuObj_GetItemIcon, 1,
+ PyDoc_STR("(short item) -> (short iconIndex)")},
+ {"SetItemStyle", (PyCFunction)MenuObj_SetItemStyle, 1,
+ PyDoc_STR("(short item, StyleParameter chStyle) -> None")},
+ {"GetItemStyle", (PyCFunction)MenuObj_GetItemStyle, 1,
+ PyDoc_STR("(short item) -> (Style chStyle)")},
+ {"SetMenuItemCommandID", (PyCFunction)MenuObj_SetMenuItemCommandID, 1,
+ PyDoc_STR("(SInt16 inItem, MenuCommand inCommandID) -> None")},
+ {"GetMenuItemCommandID", (PyCFunction)MenuObj_GetMenuItemCommandID, 1,
+ PyDoc_STR("(SInt16 inItem) -> (MenuCommand outCommandID)")},
+ {"SetMenuItemModifiers", (PyCFunction)MenuObj_SetMenuItemModifiers, 1,
+ PyDoc_STR("(SInt16 inItem, UInt8 inModifiers) -> None")},
+ {"GetMenuItemModifiers", (PyCFunction)MenuObj_GetMenuItemModifiers, 1,
+ PyDoc_STR("(SInt16 inItem) -> (UInt8 outModifiers)")},
+ {"SetMenuItemIconHandle", (PyCFunction)MenuObj_SetMenuItemIconHandle, 1,
+ PyDoc_STR("(SInt16 inItem, UInt8 inIconType, Handle inIconHandle) -> None")},
+ {"GetMenuItemIconHandle", (PyCFunction)MenuObj_GetMenuItemIconHandle, 1,
+ PyDoc_STR("(SInt16 inItem) -> (UInt8 outIconType, Handle outIconHandle)")},
+ {"SetMenuItemTextEncoding", (PyCFunction)MenuObj_SetMenuItemTextEncoding, 1,
+ PyDoc_STR("(SInt16 inItem, TextEncoding inScriptID) -> None")},
+ {"GetMenuItemTextEncoding", (PyCFunction)MenuObj_GetMenuItemTextEncoding, 1,
+ PyDoc_STR("(SInt16 inItem) -> (TextEncoding outScriptID)")},
+ {"SetMenuItemHierarchicalID", (PyCFunction)MenuObj_SetMenuItemHierarchicalID, 1,
+ PyDoc_STR("(SInt16 inItem, MenuID inHierID) -> None")},
+ {"GetMenuItemHierarchicalID", (PyCFunction)MenuObj_GetMenuItemHierarchicalID, 1,
+ PyDoc_STR("(SInt16 inItem) -> (MenuID outHierID)")},
+ {"SetMenuItemFontID", (PyCFunction)MenuObj_SetMenuItemFontID, 1,
+ PyDoc_STR("(SInt16 inItem, SInt16 inFontID) -> None")},
+ {"GetMenuItemFontID", (PyCFunction)MenuObj_GetMenuItemFontID, 1,
+ PyDoc_STR("(SInt16 inItem) -> (SInt16 outFontID)")},
+ {"SetMenuItemRefCon", (PyCFunction)MenuObj_SetMenuItemRefCon, 1,
+ PyDoc_STR("(SInt16 inItem, UInt32 inRefCon) -> None")},
+ {"GetMenuItemRefCon", (PyCFunction)MenuObj_GetMenuItemRefCon, 1,
+ PyDoc_STR("(SInt16 inItem) -> (UInt32 outRefCon)")},
+ {"SetMenuItemKeyGlyph", (PyCFunction)MenuObj_SetMenuItemKeyGlyph, 1,
+ PyDoc_STR("(SInt16 inItem, SInt16 inGlyph) -> None")},
+ {"GetMenuItemKeyGlyph", (PyCFunction)MenuObj_GetMenuItemKeyGlyph, 1,
+ PyDoc_STR("(SInt16 inItem) -> (SInt16 outGlyph)")},
+ {"MacEnableMenuItem", (PyCFunction)MenuObj_MacEnableMenuItem, 1,
+ PyDoc_STR("(MenuItemIndex item) -> None")},
+ {"DisableMenuItem", (PyCFunction)MenuObj_DisableMenuItem, 1,
+ PyDoc_STR("(MenuItemIndex item) -> None")},
+ {"IsMenuItemEnabled", (PyCFunction)MenuObj_IsMenuItemEnabled, 1,
+ PyDoc_STR("(MenuItemIndex item) -> (Boolean _rv)")},
+ {"EnableMenuItemIcon", (PyCFunction)MenuObj_EnableMenuItemIcon, 1,
+ PyDoc_STR("(MenuItemIndex item) -> None")},
+ {"DisableMenuItemIcon", (PyCFunction)MenuObj_DisableMenuItemIcon, 1,
+ PyDoc_STR("(MenuItemIndex item) -> None")},
+ {"IsMenuItemIconEnabled", (PyCFunction)MenuObj_IsMenuItemIconEnabled, 1,
+ PyDoc_STR("(MenuItemIndex item) -> (Boolean _rv)")},
+ {"SetMenuItemHierarchicalMenu", (PyCFunction)MenuObj_SetMenuItemHierarchicalMenu, 1,
+ PyDoc_STR("(MenuItemIndex inItem, MenuHandle inHierMenu) -> None")},
+ {"GetMenuItemHierarchicalMenu", (PyCFunction)MenuObj_GetMenuItemHierarchicalMenu, 1,
+ PyDoc_STR("(MenuItemIndex inItem) -> (MenuHandle outHierMenu)")},
+ {"CopyMenuItemTextAsCFString", (PyCFunction)MenuObj_CopyMenuItemTextAsCFString, 1,
+ PyDoc_STR("(MenuItemIndex inItem) -> (CFStringRef outString)")},
+ {"SetMenuItemTextWithCFString", (PyCFunction)MenuObj_SetMenuItemTextWithCFString, 1,
+ PyDoc_STR("(MenuItemIndex inItem, CFStringRef inString) -> None")},
+ {"GetMenuItemIndent", (PyCFunction)MenuObj_GetMenuItemIndent, 1,
+ PyDoc_STR("(MenuItemIndex inItem) -> (UInt32 outIndent)")},
+ {"SetMenuItemIndent", (PyCFunction)MenuObj_SetMenuItemIndent, 1,
+ PyDoc_STR("(MenuItemIndex inItem, UInt32 inIndent) -> None")},
+ {"GetMenuItemCommandKey", (PyCFunction)MenuObj_GetMenuItemCommandKey, 1,
+ PyDoc_STR("(MenuItemIndex inItem, Boolean inGetVirtualKey) -> (UInt16 outKey)")},
+ {"SetMenuItemCommandKey", (PyCFunction)MenuObj_SetMenuItemCommandKey, 1,
+ PyDoc_STR("(MenuItemIndex inItem, Boolean inSetVirtualKey, UInt16 inKey) -> None")},
+ {"GetMenuItemPropertyAttributes", (PyCFunction)MenuObj_GetMenuItemPropertyAttributes, 1,
+ PyDoc_STR("(MenuItemIndex item, OSType propertyCreator, OSType propertyTag) -> (UInt32 attributes)")},
+ {"ChangeMenuItemPropertyAttributes", (PyCFunction)MenuObj_ChangeMenuItemPropertyAttributes, 1,
+ PyDoc_STR("(MenuItemIndex item, OSType propertyCreator, OSType propertyTag, UInt32 attributesToSet, UInt32 attributesToClear) -> None")},
+ {"GetMenuAttributes", (PyCFunction)MenuObj_GetMenuAttributes, 1,
+ PyDoc_STR("() -> (MenuAttributes outAttributes)")},
+ {"ChangeMenuAttributes", (PyCFunction)MenuObj_ChangeMenuAttributes, 1,
+ PyDoc_STR("(MenuAttributes setTheseAttributes, MenuAttributes clearTheseAttributes) -> None")},
+ {"GetMenuItemAttributes", (PyCFunction)MenuObj_GetMenuItemAttributes, 1,
+ PyDoc_STR("(MenuItemIndex item) -> (MenuItemAttributes outAttributes)")},
+ {"ChangeMenuItemAttributes", (PyCFunction)MenuObj_ChangeMenuItemAttributes, 1,
+ PyDoc_STR("(MenuItemIndex item, MenuItemAttributes setTheseAttributes, MenuItemAttributes clearTheseAttributes) -> None")},
+ {"DisableAllMenuItems", (PyCFunction)MenuObj_DisableAllMenuItems, 1,
+ PyDoc_STR("() -> None")},
+ {"EnableAllMenuItems", (PyCFunction)MenuObj_EnableAllMenuItems, 1,
+ PyDoc_STR("() -> None")},
+ {"MenuHasEnabledItems", (PyCFunction)MenuObj_MenuHasEnabledItems, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"GetMenuType", (PyCFunction)MenuObj_GetMenuType, 1,
+ PyDoc_STR("() -> (UInt16 outType)")},
+ {"CountMenuItemsWithCommandID", (PyCFunction)MenuObj_CountMenuItemsWithCommandID, 1,
+ PyDoc_STR("(MenuCommand inCommandID) -> (ItemCount _rv)")},
+ {"GetIndMenuItemWithCommandID", (PyCFunction)MenuObj_GetIndMenuItemWithCommandID, 1,
+ PyDoc_STR("(MenuCommand inCommandID, UInt32 inItemIndex) -> (MenuHandle outMenu, MenuItemIndex outIndex)")},
+ {"EnableMenuCommand", (PyCFunction)MenuObj_EnableMenuCommand, 1,
+ PyDoc_STR("(MenuCommand inCommandID) -> None")},
+ {"DisableMenuCommand", (PyCFunction)MenuObj_DisableMenuCommand, 1,
+ PyDoc_STR("(MenuCommand inCommandID) -> None")},
+ {"IsMenuCommandEnabled", (PyCFunction)MenuObj_IsMenuCommandEnabled, 1,
+ PyDoc_STR("(MenuCommand inCommandID) -> (Boolean _rv)")},
+ {"SetMenuCommandMark", (PyCFunction)MenuObj_SetMenuCommandMark, 1,
+ PyDoc_STR("(MenuCommand inCommandID, UniChar inMark) -> None")},
+ {"GetMenuCommandMark", (PyCFunction)MenuObj_GetMenuCommandMark, 1,
+ PyDoc_STR("(MenuCommand inCommandID) -> (UniChar outMark)")},
+ {"GetMenuCommandPropertySize", (PyCFunction)MenuObj_GetMenuCommandPropertySize, 1,
+ PyDoc_STR("(MenuCommand inCommandID, OSType inPropertyCreator, OSType inPropertyTag) -> (ByteCount outSize)")},
+ {"RemoveMenuCommandProperty", (PyCFunction)MenuObj_RemoveMenuCommandProperty, 1,
+ PyDoc_STR("(MenuCommand inCommandID, OSType inPropertyCreator, OSType inPropertyTag) -> None")},
+ {"IsMenuItemInvalid", (PyCFunction)MenuObj_IsMenuItemInvalid, 1,
+ PyDoc_STR("(MenuItemIndex inItem) -> (Boolean _rv)")},
+ {"InvalidateMenuItems", (PyCFunction)MenuObj_InvalidateMenuItems, 1,
+ PyDoc_STR("(MenuItemIndex inFirstItem, ItemCount inNumItems) -> None")},
+ {"UpdateInvalidMenuItems", (PyCFunction)MenuObj_UpdateInvalidMenuItems, 1,
+ PyDoc_STR("() -> None")},
+ {"CreateStandardFontMenu", (PyCFunction)MenuObj_CreateStandardFontMenu, 1,
+ PyDoc_STR("(MenuItemIndex afterItem, MenuID firstHierMenuID, OptionBits options) -> (ItemCount outHierMenuCount)")},
+ {"UpdateStandardFontMenu", (PyCFunction)MenuObj_UpdateStandardFontMenu, 1,
+ PyDoc_STR("() -> (ItemCount outHierMenuCount)")},
+ {"GetFontFamilyFromMenuSelection", (PyCFunction)MenuObj_GetFontFamilyFromMenuSelection, 1,
+ PyDoc_STR("(MenuItemIndex item) -> (FMFontFamily outFontFamily, FMFontStyle outStyle)")},
+ {"GetMenuID", (PyCFunction)MenuObj_GetMenuID, 1,
+ PyDoc_STR("() -> (MenuID _rv)")},
+ {"GetMenuWidth", (PyCFunction)MenuObj_GetMenuWidth, 1,
+ PyDoc_STR("() -> (SInt16 _rv)")},
+ {"GetMenuHeight", (PyCFunction)MenuObj_GetMenuHeight, 1,
+ PyDoc_STR("() -> (SInt16 _rv)")},
+ {"SetMenuID", (PyCFunction)MenuObj_SetMenuID, 1,
+ PyDoc_STR("(MenuID menuID) -> None")},
+ {"SetMenuWidth", (PyCFunction)MenuObj_SetMenuWidth, 1,
+ PyDoc_STR("(SInt16 width) -> None")},
+ {"SetMenuHeight", (PyCFunction)MenuObj_SetMenuHeight, 1,
+ PyDoc_STR("(SInt16 height) -> None")},
+ {"as_Resource", (PyCFunction)MenuObj_as_Resource, 1,
+ PyDoc_STR("() -> (Handle _rv)")},
+ {"AppendMenu", (PyCFunction)MenuObj_AppendMenu, 1,
+ PyDoc_STR("(Str255 data) -> None")},
+ {"InsertMenu", (PyCFunction)MenuObj_InsertMenu, 1,
+ PyDoc_STR("(short beforeID) -> None")},
+ {"InsertMenuItem", (PyCFunction)MenuObj_InsertMenuItem, 1,
+ PyDoc_STR("(Str255 itemString, short afterItem) -> None")},
+ {"EnableMenuItem", (PyCFunction)MenuObj_EnableMenuItem, 1,
+ PyDoc_STR("(UInt16 item) -> None")},
+ {"CheckMenuItem", (PyCFunction)MenuObj_CheckMenuItem, 1,
+ PyDoc_STR("(short item, Boolean checked) -> None")},
+ {NULL, NULL, 0}
+};
+
+#define MenuObj_getsetlist NULL
+
+
+#define MenuObj_compare NULL
+
+#define MenuObj_repr NULL
+
+#define MenuObj_hash NULL
+#define MenuObj_tp_init 0
+
+#define MenuObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *MenuObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *_self;
+ MenuHandle itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, MenuObj_Convert, &itself)) return NULL;
+ if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((MenuObject *)_self)->ob_itself = itself;
+ return _self;
+}
+
+#define MenuObj_tp_free PyObject_Del
+
+
+PyTypeObject Menu_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_Menu.Menu", /*tp_name*/
+ sizeof(MenuObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) MenuObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) MenuObj_compare, /*tp_compare*/
+ (reprfunc) MenuObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) MenuObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ MenuObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ MenuObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ MenuObj_tp_init, /* tp_init */
+ MenuObj_tp_alloc, /* tp_alloc */
+ MenuObj_tp_new, /* tp_new */
+ MenuObj_tp_free, /* tp_free */
+};
+
+/* ---------------------- End object type Menu ---------------------- */
+
+
+static PyObject *Menu_NewMenu(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuHandle _rv;
+ MenuID menuID;
+ Str255 menuTitle;
+#ifndef NewMenu
+ PyMac_PRECHECK(NewMenu);
+#endif
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &menuID,
+ PyMac_GetStr255, menuTitle))
+ return NULL;
+ _rv = NewMenu(menuID,
+ menuTitle);
+ _res = Py_BuildValue("O&",
+ MenuObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Menu_MacGetMenu(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuHandle _rv;
+ short resourceID;
+#ifndef MacGetMenu
+ PyMac_PRECHECK(MacGetMenu);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &resourceID))
+ return NULL;
+ _rv = MacGetMenu(resourceID);
+ _res = Py_BuildValue("O&",
+ MenuObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Menu_CreateNewMenu(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuID inMenuID;
+ MenuAttributes inMenuAttributes;
+ MenuHandle outMenuRef;
+#ifndef CreateNewMenu
+ PyMac_PRECHECK(CreateNewMenu);
+#endif
+ if (!PyArg_ParseTuple(_args, "hl",
+ &inMenuID,
+ &inMenuAttributes))
+ return NULL;
+ _err = CreateNewMenu(inMenuID,
+ inMenuAttributes,
+ &outMenuRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ MenuObj_New, outMenuRef);
+ return _res;
+}
+
+static PyObject *Menu_MenuKey(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ CharParameter ch;
+#ifndef MenuKey
+ PyMac_PRECHECK(MenuKey);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &ch))
+ return NULL;
+ _rv = MenuKey(ch);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Menu_MenuSelect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ Point startPt;
+#ifndef MenuSelect
+ PyMac_PRECHECK(MenuSelect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &startPt))
+ return NULL;
+ _rv = MenuSelect(startPt);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Menu_MenuChoice(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+#ifndef MenuChoice
+ PyMac_PRECHECK(MenuChoice);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MenuChoice();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Menu_MenuEvent(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UInt32 _rv;
+ EventRecord inEvent;
+#ifndef MenuEvent
+ PyMac_PRECHECK(MenuEvent);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetEventRecord, &inEvent))
+ return NULL;
+ _rv = MenuEvent(&inEvent);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Menu_GetMBarHeight(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+#ifndef GetMBarHeight
+ PyMac_PRECHECK(GetMBarHeight);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMBarHeight();
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Menu_MacDrawMenuBar(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef MacDrawMenuBar
+ PyMac_PRECHECK(MacDrawMenuBar);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ MacDrawMenuBar();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Menu_InvalMenuBar(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef InvalMenuBar
+ PyMac_PRECHECK(InvalMenuBar);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ InvalMenuBar();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Menu_HiliteMenu(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuID menuID;
+#ifndef HiliteMenu
+ PyMac_PRECHECK(HiliteMenu);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &menuID))
+ return NULL;
+ HiliteMenu(menuID);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Menu_GetNewMBar(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuBarHandle _rv;
+ short menuBarID;
+#ifndef GetNewMBar
+ PyMac_PRECHECK(GetNewMBar);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &menuBarID))
+ return NULL;
+ _rv = GetNewMBar(menuBarID);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Menu_GetMenuBar(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuBarHandle _rv;
+#ifndef GetMenuBar
+ PyMac_PRECHECK(GetMenuBar);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMenuBar();
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Menu_SetMenuBar(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuBarHandle mbar;
+#ifndef SetMenuBar
+ PyMac_PRECHECK(SetMenuBar);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &mbar))
+ return NULL;
+ SetMenuBar(mbar);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Menu_DuplicateMenuBar(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuBarHandle inMbar;
+ MenuBarHandle outMbar;
+#ifndef DuplicateMenuBar
+ PyMac_PRECHECK(DuplicateMenuBar);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &inMbar))
+ return NULL;
+ _err = DuplicateMenuBar(inMbar,
+ &outMbar);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, outMbar);
+ return _res;
+}
+
+static PyObject *Menu_DisposeMenuBar(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuBarHandle inMbar;
+#ifndef DisposeMenuBar
+ PyMac_PRECHECK(DisposeMenuBar);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &inMbar))
+ return NULL;
+ _err = DisposeMenuBar(inMbar);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Menu_GetMenuHandle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuHandle _rv;
+ MenuID menuID;
+#ifndef GetMenuHandle
+ PyMac_PRECHECK(GetMenuHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &menuID))
+ return NULL;
+ _rv = GetMenuHandle(menuID);
+ _res = Py_BuildValue("O&",
+ MenuObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Menu_MacDeleteMenu(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuID menuID;
+#ifndef MacDeleteMenu
+ PyMac_PRECHECK(MacDeleteMenu);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &menuID))
+ return NULL;
+ MacDeleteMenu(menuID);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Menu_ClearMenuBar(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef ClearMenuBar
+ PyMac_PRECHECK(ClearMenuBar);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ClearMenuBar();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Menu_SetMenuFlashCount(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short count;
+#ifndef SetMenuFlashCount
+ PyMac_PRECHECK(SetMenuFlashCount);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &count))
+ return NULL;
+ SetMenuFlashCount(count);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Menu_FlashMenuBar(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuID menuID;
+#ifndef FlashMenuBar
+ PyMac_PRECHECK(FlashMenuBar);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &menuID))
+ return NULL;
+ FlashMenuBar(menuID);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Menu_IsMenuBarVisible(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef IsMenuBarVisible
+ PyMac_PRECHECK(IsMenuBarVisible);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsMenuBarVisible();
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Menu_ShowMenuBar(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef ShowMenuBar
+ PyMac_PRECHECK(ShowMenuBar);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ShowMenuBar();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Menu_HideMenuBar(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef HideMenuBar
+ PyMac_PRECHECK(HideMenuBar);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ HideMenuBar();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Menu_AcquireRootMenu(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuHandle _rv;
+#ifndef AcquireRootMenu
+ PyMac_PRECHECK(AcquireRootMenu);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = AcquireRootMenu();
+ _res = Py_BuildValue("O&",
+ MenuObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Menu_DeleteMCEntries(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuID menuID;
+ short menuItem;
+#ifndef DeleteMCEntries
+ PyMac_PRECHECK(DeleteMCEntries);
+#endif
+ if (!PyArg_ParseTuple(_args, "hh",
+ &menuID,
+ &menuItem))
+ return NULL;
+ DeleteMCEntries(menuID,
+ menuItem);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Menu_InitContextualMenus(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+#ifndef InitContextualMenus
+ PyMac_PRECHECK(InitContextualMenus);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = InitContextualMenus();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Menu_IsShowContextualMenuClick(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ EventRecord inEvent;
+#ifndef IsShowContextualMenuClick
+ PyMac_PRECHECK(IsShowContextualMenuClick);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetEventRecord, &inEvent))
+ return NULL;
+ _rv = IsShowContextualMenuClick(&inEvent);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Menu_LMGetTheMenu(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 _rv;
+#ifndef LMGetTheMenu
+ PyMac_PRECHECK(LMGetTheMenu);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = LMGetTheMenu();
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Menu_as_Menu(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuHandle _rv;
+ Handle h;
+#ifndef as_Menu
+ PyMac_PRECHECK(as_Menu);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &h))
+ return NULL;
+ _rv = as_Menu(h);
+ _res = Py_BuildValue("O&",
+ MenuObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Menu_GetMenu(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuHandle _rv;
+ short resourceID;
+#ifndef GetMenu
+ PyMac_PRECHECK(GetMenu);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &resourceID))
+ return NULL;
+ _rv = GetMenu(resourceID);
+ _res = Py_BuildValue("O&",
+ MenuObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Menu_DeleteMenu(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short menuID;
+#ifndef DeleteMenu
+ PyMac_PRECHECK(DeleteMenu);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &menuID))
+ return NULL;
+ DeleteMenu(menuID);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Menu_DrawMenuBar(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef DrawMenuBar
+ PyMac_PRECHECK(DrawMenuBar);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ DrawMenuBar();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Menu_CountMenuItemsWithCommandID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ItemCount _rv;
+ MenuHandle inMenu;
+ MenuCommand inCommandID;
+#ifndef CountMenuItemsWithCommandID
+ PyMac_PRECHECK(CountMenuItemsWithCommandID);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ OptMenuObj_Convert, &inMenu,
+ &inCommandID))
+ return NULL;
+ _rv = CountMenuItemsWithCommandID(inMenu,
+ inCommandID);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Menu_GetIndMenuItemWithCommandID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuHandle inMenu;
+ MenuCommand inCommandID;
+ UInt32 inItemIndex;
+ MenuHandle outMenu;
+ MenuItemIndex outIndex;
+#ifndef GetIndMenuItemWithCommandID
+ PyMac_PRECHECK(GetIndMenuItemWithCommandID);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ OptMenuObj_Convert, &inMenu,
+ &inCommandID,
+ &inItemIndex))
+ return NULL;
+ _err = GetIndMenuItemWithCommandID(inMenu,
+ inCommandID,
+ inItemIndex,
+ &outMenu,
+ &outIndex);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&h",
+ MenuObj_New, outMenu,
+ outIndex);
+ return _res;
+}
+
+static PyObject *Menu_EnableMenuCommand(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuHandle inMenu;
+ MenuCommand inCommandID;
+#ifndef EnableMenuCommand
+ PyMac_PRECHECK(EnableMenuCommand);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ OptMenuObj_Convert, &inMenu,
+ &inCommandID))
+ return NULL;
+ EnableMenuCommand(inMenu,
+ inCommandID);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Menu_DisableMenuCommand(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuHandle inMenu;
+ MenuCommand inCommandID;
+#ifndef DisableMenuCommand
+ PyMac_PRECHECK(DisableMenuCommand);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ OptMenuObj_Convert, &inMenu,
+ &inCommandID))
+ return NULL;
+ DisableMenuCommand(inMenu,
+ inCommandID);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Menu_IsMenuCommandEnabled(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ MenuHandle inMenu;
+ MenuCommand inCommandID;
+#ifndef IsMenuCommandEnabled
+ PyMac_PRECHECK(IsMenuCommandEnabled);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ OptMenuObj_Convert, &inMenu,
+ &inCommandID))
+ return NULL;
+ _rv = IsMenuCommandEnabled(inMenu,
+ inCommandID);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Menu_SetMenuCommandMark(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuHandle inMenu;
+ MenuCommand inCommandID;
+ UniChar inMark;
+#ifndef SetMenuCommandMark
+ PyMac_PRECHECK(SetMenuCommandMark);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lh",
+ OptMenuObj_Convert, &inMenu,
+ &inCommandID,
+ &inMark))
+ return NULL;
+ _err = SetMenuCommandMark(inMenu,
+ inCommandID,
+ inMark);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Menu_GetMenuCommandMark(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuHandle inMenu;
+ MenuCommand inCommandID;
+ UniChar outMark;
+#ifndef GetMenuCommandMark
+ PyMac_PRECHECK(GetMenuCommandMark);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ OptMenuObj_Convert, &inMenu,
+ &inCommandID))
+ return NULL;
+ _err = GetMenuCommandMark(inMenu,
+ inCommandID,
+ &outMark);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ outMark);
+ return _res;
+}
+
+static PyObject *Menu_GetMenuCommandPropertySize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuHandle inMenu;
+ MenuCommand inCommandID;
+ OSType inPropertyCreator;
+ OSType inPropertyTag;
+ ByteCount outSize;
+#ifndef GetMenuCommandPropertySize
+ PyMac_PRECHECK(GetMenuCommandPropertySize);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lO&O&",
+ OptMenuObj_Convert, &inMenu,
+ &inCommandID,
+ PyMac_GetOSType, &inPropertyCreator,
+ PyMac_GetOSType, &inPropertyTag))
+ return NULL;
+ _err = GetMenuCommandPropertySize(inMenu,
+ inCommandID,
+ inPropertyCreator,
+ inPropertyTag,
+ &outSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outSize);
+ return _res;
+}
+
+static PyObject *Menu_RemoveMenuCommandProperty(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuHandle inMenu;
+ MenuCommand inCommandID;
+ OSType inPropertyCreator;
+ OSType inPropertyTag;
+#ifndef RemoveMenuCommandProperty
+ PyMac_PRECHECK(RemoveMenuCommandProperty);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lO&O&",
+ OptMenuObj_Convert, &inMenu,
+ &inCommandID,
+ PyMac_GetOSType, &inPropertyCreator,
+ PyMac_GetOSType, &inPropertyTag))
+ return NULL;
+ _err = RemoveMenuCommandProperty(inMenu,
+ inCommandID,
+ inPropertyCreator,
+ inPropertyTag);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _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,
+ PyDoc_STR("(short resourceID) -> (MenuHandle _rv)")},
+ {"CreateNewMenu", (PyCFunction)Menu_CreateNewMenu, 1,
+ PyDoc_STR("(MenuID inMenuID, MenuAttributes inMenuAttributes) -> (MenuHandle outMenuRef)")},
+ {"MenuKey", (PyCFunction)Menu_MenuKey, 1,
+ PyDoc_STR("(CharParameter ch) -> (long _rv)")},
+ {"MenuSelect", (PyCFunction)Menu_MenuSelect, 1,
+ PyDoc_STR("(Point startPt) -> (long _rv)")},
+ {"MenuChoice", (PyCFunction)Menu_MenuChoice, 1,
+ PyDoc_STR("() -> (long _rv)")},
+ {"MenuEvent", (PyCFunction)Menu_MenuEvent, 1,
+ PyDoc_STR("(EventRecord inEvent) -> (UInt32 _rv)")},
+ {"GetMBarHeight", (PyCFunction)Menu_GetMBarHeight, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"MacDrawMenuBar", (PyCFunction)Menu_MacDrawMenuBar, 1,
+ PyDoc_STR("() -> None")},
+ {"InvalMenuBar", (PyCFunction)Menu_InvalMenuBar, 1,
+ PyDoc_STR("() -> None")},
+ {"HiliteMenu", (PyCFunction)Menu_HiliteMenu, 1,
+ PyDoc_STR("(MenuID menuID) -> None")},
+ {"GetNewMBar", (PyCFunction)Menu_GetNewMBar, 1,
+ PyDoc_STR("(short menuBarID) -> (MenuBarHandle _rv)")},
+ {"GetMenuBar", (PyCFunction)Menu_GetMenuBar, 1,
+ PyDoc_STR("() -> (MenuBarHandle _rv)")},
+ {"SetMenuBar", (PyCFunction)Menu_SetMenuBar, 1,
+ PyDoc_STR("(MenuBarHandle mbar) -> None")},
+ {"DuplicateMenuBar", (PyCFunction)Menu_DuplicateMenuBar, 1,
+ PyDoc_STR("(MenuBarHandle inMbar) -> (MenuBarHandle outMbar)")},
+ {"DisposeMenuBar", (PyCFunction)Menu_DisposeMenuBar, 1,
+ PyDoc_STR("(MenuBarHandle inMbar) -> None")},
+ {"GetMenuHandle", (PyCFunction)Menu_GetMenuHandle, 1,
+ PyDoc_STR("(MenuID menuID) -> (MenuHandle _rv)")},
+ {"MacDeleteMenu", (PyCFunction)Menu_MacDeleteMenu, 1,
+ PyDoc_STR("(MenuID menuID) -> None")},
+ {"ClearMenuBar", (PyCFunction)Menu_ClearMenuBar, 1,
+ PyDoc_STR("() -> None")},
+ {"SetMenuFlashCount", (PyCFunction)Menu_SetMenuFlashCount, 1,
+ PyDoc_STR("(short count) -> None")},
+ {"FlashMenuBar", (PyCFunction)Menu_FlashMenuBar, 1,
+ PyDoc_STR("(MenuID menuID) -> None")},
+ {"IsMenuBarVisible", (PyCFunction)Menu_IsMenuBarVisible, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"ShowMenuBar", (PyCFunction)Menu_ShowMenuBar, 1,
+ PyDoc_STR("() -> None")},
+ {"HideMenuBar", (PyCFunction)Menu_HideMenuBar, 1,
+ PyDoc_STR("() -> None")},
+ {"AcquireRootMenu", (PyCFunction)Menu_AcquireRootMenu, 1,
+ PyDoc_STR("() -> (MenuHandle _rv)")},
+ {"DeleteMCEntries", (PyCFunction)Menu_DeleteMCEntries, 1,
+ PyDoc_STR("(MenuID menuID, short menuItem) -> None")},
+ {"InitContextualMenus", (PyCFunction)Menu_InitContextualMenus, 1,
+ PyDoc_STR("() -> None")},
+ {"IsShowContextualMenuClick", (PyCFunction)Menu_IsShowContextualMenuClick, 1,
+ PyDoc_STR("(EventRecord inEvent) -> (Boolean _rv)")},
+ {"LMGetTheMenu", (PyCFunction)Menu_LMGetTheMenu, 1,
+ PyDoc_STR("() -> (SInt16 _rv)")},
+ {"as_Menu", (PyCFunction)Menu_as_Menu, 1,
+ PyDoc_STR("(Handle h) -> (MenuHandle _rv)")},
+ {"GetMenu", (PyCFunction)Menu_GetMenu, 1,
+ PyDoc_STR("(short resourceID) -> (MenuHandle _rv)")},
+ {"DeleteMenu", (PyCFunction)Menu_DeleteMenu, 1,
+ PyDoc_STR("(short menuID) -> None")},
+ {"DrawMenuBar", (PyCFunction)Menu_DrawMenuBar, 1,
+ PyDoc_STR("() -> None")},
+ {"CountMenuItemsWithCommandID", (PyCFunction)Menu_CountMenuItemsWithCommandID, 1,
+ PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID) -> (ItemCount _rv)")},
+ {"GetIndMenuItemWithCommandID", (PyCFunction)Menu_GetIndMenuItemWithCommandID, 1,
+ PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID, UInt32 inItemIndex) -> (MenuHandle outMenu, MenuItemIndex outIndex)")},
+ {"EnableMenuCommand", (PyCFunction)Menu_EnableMenuCommand, 1,
+ PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID) -> None")},
+ {"DisableMenuCommand", (PyCFunction)Menu_DisableMenuCommand, 1,
+ PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID) -> None")},
+ {"IsMenuCommandEnabled", (PyCFunction)Menu_IsMenuCommandEnabled, 1,
+ PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID) -> (Boolean _rv)")},
+ {"SetMenuCommandMark", (PyCFunction)Menu_SetMenuCommandMark, 1,
+ PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID, UniChar inMark) -> None")},
+ {"GetMenuCommandMark", (PyCFunction)Menu_GetMenuCommandMark, 1,
+ PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID) -> (UniChar outMark)")},
+ {"GetMenuCommandPropertySize", (PyCFunction)Menu_GetMenuCommandPropertySize, 1,
+ 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}
+};
+
+
+
+
+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 ||
+ PyDict_SetItemString(d, "Error", Menu_Error) != 0)
+ return;
+ Menu_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&Menu_Type) < 0) return;
+ Py_INCREF(&Menu_Type);
+ PyModule_AddObject(m, "Menu", (PyObject *)&Menu_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&Menu_Type);
+ PyModule_AddObject(m, "MenuType", (PyObject *)&Menu_Type);
+#endif /* __LP64__ */
+}
+
+/* ======================== End module _Menu ======================== */
+
diff --git a/Mac/Modules/menu/menuedit.py b/Mac/Modules/menu/menuedit.py
new file mode 100644
index 0000000000..b74301d3a6
--- /dev/null
+++ b/Mac/Modules/menu/menuedit.py
@@ -0,0 +1,123 @@
+f = Function(MenuHandle, 'as_Menu', (Handle, 'h', InMode))
+functions.append(f)
+
+f = Method(Handle, 'as_Resource', (MenuHandle, 'h', InMode))
+methods.append(f)
+
+# The following have "Mac" prepended to their names in the include file
+# since UH 3.1, sigh...
+f = Function(MenuHandle, 'GetMenu',
+ (short, 'resourceID', InMode),
+)
+functions.append(f)
+
+f = Method(void, 'AppendMenu',
+ (MenuHandle, 'menu', InMode),
+ (ConstStr255Param, 'data', InMode),
+)
+methods.append(f)
+
+f = Method(void, 'InsertMenu',
+ (MenuHandle, 'theMenu', InMode),
+ (short, 'beforeID', InMode),
+)
+methods.append(f)
+
+f = Function(void, 'DeleteMenu',
+ (short, 'menuID', InMode),
+)
+functions.append(f)
+
+f = Method(void, 'InsertMenuItem',
+ (MenuHandle, 'theMenu', InMode),
+ (ConstStr255Param, 'itemString', InMode),
+ (short, 'afterItem', InMode),
+)
+methods.append(f)
+
+f = Method(void, 'EnableMenuItem',
+ (MenuHandle, 'theMenu', InMode),
+ (UInt16, 'item', InMode),
+)
+methods.append(f)
+
+f = Method(void, 'CheckMenuItem',
+ (MenuRef, 'theMenu', InMode),
+ (short, 'item', InMode),
+ (Boolean, 'checked', InMode),
+)
+methods.append(f)
+
+
+f = Function(void, 'DrawMenuBar',
+)
+functions.append(f)
+
+
+#
+# The following functions take an *optional* MenuRef as their first argument
+#
+
+f = Function(ItemCount, 'CountMenuItemsWithCommandID',
+ (OptMenuRef, 'inMenu', InMode),
+ (MenuCommand, 'inCommandID', InMode),
+)
+functions.append(f)
+
+f = Function(OSStatus, 'GetIndMenuItemWithCommandID',
+ (OptMenuRef, 'inMenu', InMode),
+ (MenuCommand, 'inCommandID', InMode),
+ (UInt32, 'inItemIndex', InMode),
+ (MenuRef, 'outMenu', OutMode),
+ (MenuItemIndex, 'outIndex', OutMode),
+)
+functions.append(f)
+
+f = Function(void, 'EnableMenuCommand',
+ (OptMenuRef, 'inMenu', InMode),
+ (MenuCommand, 'inCommandID', InMode),
+)
+functions.append(f)
+
+f = Function(void, 'DisableMenuCommand',
+ (OptMenuRef, 'inMenu', InMode),
+ (MenuCommand, 'inCommandID', InMode),
+)
+functions.append(f)
+
+f = Function(Boolean, 'IsMenuCommandEnabled',
+ (OptMenuRef, 'inMenu', InMode),
+ (MenuCommand, 'inCommandID', InMode),
+)
+functions.append(f)
+
+f = Function(OSStatus, 'SetMenuCommandMark',
+ (OptMenuRef, 'inMenu', InMode),
+ (MenuCommand, 'inCommandID', InMode),
+ (UniChar, 'inMark', InMode),
+)
+functions.append(f)
+
+f = Function(OSStatus, 'GetMenuCommandMark',
+ (OptMenuRef, 'inMenu', InMode),
+ (MenuCommand, 'inCommandID', InMode),
+ (UniChar, 'outMark', OutMode),
+)
+functions.append(f)
+
+f = Function(OSStatus, 'GetMenuCommandPropertySize',
+ (OptMenuRef, 'inMenu', InMode),
+ (MenuCommand, 'inCommandID', InMode),
+ (OSType, 'inPropertyCreator', InMode),
+ (OSType, 'inPropertyTag', InMode),
+ (ByteCount, 'outSize', OutMode),
+)
+functions.append(f)
+
+f = Function(OSStatus, 'RemoveMenuCommandProperty',
+ (OptMenuRef, 'inMenu', InMode),
+ (MenuCommand, 'inCommandID', InMode),
+ (OSType, 'inPropertyCreator', InMode),
+ (OSType, 'inPropertyTag', InMode),
+)
+functions.append(f)
diff --git a/Mac/Modules/menu/menuscan.py b/Mac/Modules/menu/menuscan.py
new file mode 100644
index 0000000000..8151581feb
--- /dev/null
+++ b/Mac/Modules/menu/menuscan.py
@@ -0,0 +1,96 @@
+# Scan <Menus.h>, generating menugen.py.
+import sys
+from bgenlocations import TOOLBOXDIR, BGENDIR
+sys.path.append(BGENDIR)
+
+from scantools import Scanner
+
+def main():
+ input = "Menus.h"
+ output = "menugen.py"
+ defsoutput = TOOLBOXDIR + "Menus.py"
+ scanner = MyScanner(input, output, defsoutput)
+ scanner.scan()
+ scanner.close()
+ print "=== Testing definitions output code ==="
+ execfile(defsoutput, {}, {})
+ print "=== Done scanning and generating, now doing 'import menusupport' ==="
+ import menusupport
+ print "=== Done. It's up to you to compile Menumodule.c ==="
+
+class MyScanner(Scanner):
+
+ def destination(self, type, name, arglist):
+ classname = "Function"
+ listname = "functions"
+ if arglist:
+ t, n, m = arglist[0]
+ if t in ("MenuHandle", "MenuRef") and m == "InMode":
+ classname = "Method"
+ listname = "methods"
+ return classname, listname
+
+ def makeblacklistnames(self):
+ return [
+## "IsShowContextualMenuClick", # Can't find it in the library
+## "InitContextualMenus", # ditto
+ "GetMenuItemProperty", # difficult for the moment
+ "GetMenuItemPropertySize",
+ "SetMenuItemProperty",
+ "RemoveMenuItemProperty",
+ "SetMenuCommandProperty",
+ "GetMenuCommandProperty",
+ "GetMenuTitle", # Funny arg/returnvalue
+ "SetMenuTitle",
+ "SetMenuTitleIcon", # void*
+ # OS8 calls:
+ 'GetMenuItemRefCon2',
+ 'SetMenuItemRefCon2',
+ 'EnableItem',
+ 'DisableItem',
+ 'CheckItem',
+ 'CountMItems',
+ 'OpenDeskAcc',
+ 'SystemEdit',
+ 'SystemMenu',
+ 'SetMenuFlash',
+ 'InitMenus',
+ 'InitProcMenu',
+ ]
+
+ def makeblacklisttypes(self):
+ return [
+ 'MCTableHandle',
+ 'MCEntryPtr',
+ 'MCTablePtr',
+ 'AEDesc_ptr', # For now: doable, but not easy
+ 'ProcessSerialNumber', # ditto
+ "MenuDefSpecPtr", # Too difficult for now
+ "MenuDefSpec_ptr", # ditto
+ "MenuTrackingData",
+ "void_ptr", # Don't know yet.
+ "EventRef", # For now, not exported yet.
+ "MenuItemDataPtr", # Not yet.
+ "MenuItemDataRec_ptr",
+ ]
+
+ def makerepairinstructions(self):
+ return [
+ ([("Str255", "itemString", "InMode")],
+ [("*", "*", "OutMode")]),
+
+ ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
+ [("InBuffer", "*", "*")]),
+
+ ([("void", "*", "OutMode"), ("long", "*", "InMode"),
+ ("long", "*", "OutMode")],
+ [("VarVarOutBuffer", "*", "InOutMode")]),
+ ([("MenuRef", 'outHierMenu', "OutMode")],
+ [("OptMenuRef", 'outHierMenu', "OutMode")]),
+ ]
+
+ def writeinitialdefs(self):
+ self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
+
+if __name__ == "__main__":
+ main()
diff --git a/Mac/Modules/menu/menusupport.py b/Mac/Modules/menu/menusupport.py
new file mode 100644
index 0000000000..a04b7553cb
--- /dev/null
+++ b/Mac/Modules/menu/menusupport.py
@@ -0,0 +1,108 @@
+# This script generates a Python interface for an Apple Macintosh Manager.
+# It uses the "bgen" package to generate C code.
+# The function specifications are generated by scanning the mamager's header file,
+# using the "scantools" package (customized for this particular manager).
+
+import string
+
+# Declarations that change for each manager
+MACHEADERFILE = 'Menus.h' # The Apple header file
+MODNAME = '_Menu' # The name of the module
+OBJECTNAME = 'Menu' # The basic name of the objects used here
+
+# The following is *usually* unchanged but may still require tuning
+MODPREFIX = 'Menu' # The prefix for module-wide routines
+OBJECTTYPE = OBJECTNAME + 'Handle' # The C type used to represent them
+OBJECTPREFIX = MODPREFIX + 'Obj' # The prefix for object methods
+INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner
+EXTRAFILE = string.lower(MODPREFIX) + 'edit.py' # A similar file but hand-made
+OUTPUTFILE = MODNAME + "module.c" # The file generated by this program
+
+from macsupport import *
+
+# Create the type objects
+
+MenuHandle = OpaqueByValueType(OBJECTTYPE, OBJECTPREFIX)
+MenuRef = MenuHandle
+OptMenuRef = OpaqueByValueType(OBJECTTYPE, "Opt" + OBJECTPREFIX)
+Handle = OpaqueByValueType("Handle", "ResObj")
+MenuBarHandle = OpaqueByValueType("MenuBarHandle", "ResObj")
+MenuID = Type("MenuID", "h")
+MenuItemIndex = Type("MenuItemIndex", "h")
+MenuItemID = Type("MenuItemID", "l")
+MenuCommand = Type("MenuCommand", "l")
+MenuAttributes = Type("MenuAttributes", "l")
+MenuItemAttributes = Type("MenuItemAttributes", "l")
+unsigned_char = Type('unsigned char', 'b')
+FMFontFamily = Type("FMFontFamily", "h")
+FMFontStyle = Type("FMFontStyle", "h")
+UniChar = Type("UniChar", "h")
+
+includestuff = includestuff + """
+#include <Carbon/Carbon.h>
+
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+
+extern PyObject *_MenuObj_New(MenuHandle);
+extern int _MenuObj_Convert(PyObject *, MenuHandle *);
+
+#define MenuObj_New _MenuObj_New
+#define MenuObj_Convert _MenuObj_Convert
+#endif
+
+#define as_Menu(h) ((MenuHandle)h)
+#define as_Resource(h) ((Handle)h)
+
+
+/* Alternative version of MenuObj_New, which returns None for NULL argument */
+PyObject *OptMenuObj_New(MenuRef itself)
+{
+ if (itself == NULL) {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+ return MenuObj_New(itself);
+}
+
+/* Alternative version of MenuObj_Convert, which returns NULL for a None argument */
+int OptMenuObj_Convert(PyObject *v, MenuRef *p_itself)
+{
+ if ( v == Py_None ) {
+ *p_itself = NULL;
+ return 1;
+ }
+ return MenuObj_Convert(v, p_itself);
+}
+"""
+
+initstuff = initstuff + """
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(MenuHandle, MenuObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MenuHandle, MenuObj_Convert);
+"""
+
+class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
+ pass
+
+# Create the generator groups and link them
+module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff)
+object = MyObjectDefinition(OBJECTNAME, OBJECTPREFIX, OBJECTTYPE)
+module.addobject(object)
+
+# Create the generator classes used to populate the lists
+Function = OSErrWeakLinkFunctionGenerator
+Method = OSErrWeakLinkMethodGenerator
+
+# Create and populate the lists
+functions = []
+methods = []
+execfile(INPUTFILE)
+execfile(EXTRAFILE)
+
+# add the populated lists to the generator groups
+for f in functions: module.add(f)
+for f in methods: object.add(f)
+
+# generate output (open the output file as late as possible)
+SetOutputFileName(OUTPUTFILE)
+module.generate()
diff --git a/Mac/Modules/mlte/_Mltemodule.c b/Mac/Modules/mlte/_Mltemodule.c
new file mode 100644
index 0000000000..cd698f4699
--- /dev/null
+++ b/Mac/Modules/mlte/_Mltemodule.c
@@ -0,0 +1,1690 @@
+
+/* ========================== Module _Mlte ========================== */
+
+#include "Python.h"
+
+#ifndef __LP64__
+
+
+#include "pymactoolbox.h"
+
+/* Macro to test whether a weak-loaded CFM function exists */
+#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
+ PyErr_SetString(PyExc_NotImplementedError, \
+ "Not available in this shared library/OS version"); \
+ return NULL; \
+ }} while(0)
+
+
+#include <Carbon/Carbon.h>
+
+/* For now we declare them forward here. They'll go to mactoolbox later */
+static PyObject *TXNObj_New(TXNObject);
+static int TXNObj_Convert(PyObject *, TXNObject *);
+static PyObject *TXNFontMenuObj_New(TXNFontMenuObject);
+static int TXNFontMenuObj_Convert(PyObject *, TXNFontMenuObject *);
+
+// ADD declarations
+#ifdef NOTYET_USE_TOOLBOX_OBJECT_GLUE
+//extern PyObject *_CFTypeRefObj_New(CFTypeRef);
+//extern int _CFTypeRefObj_Convert(PyObject *, CFTypeRef *);
+
+//#define CFTypeRefObj_New _CFTypeRefObj_New
+//#define CFTypeRefObj_Convert _CFTypeRefObj_Convert
+#endif
+
+/*
+** Parse an optional fsspec
+*/
+static int
+OptFSSpecPtr_Convert(PyObject *v, FSSpec **p_itself)
+{
+ static FSSpec fss;
+ if (v == Py_None)
+ {
+ *p_itself = NULL;
+ return 1;
+ }
+ *p_itself = &fss;
+ return PyMac_GetFSSpec(v, *p_itself);
+}
+
+/*
+** Parse an optional GWorld
+*/
+static int
+OptGWorldObj_Convert(PyObject *v, GWorldPtr *p_itself)
+{
+ if (v == Py_None)
+ {
+ *p_itself = NULL;
+ return 1;
+ }
+ return GWorldObj_Convert(v, p_itself);
+}
+
+
+static PyObject *Mlte_Error;
+
+/* --------------------- Object type TXNObject ---------------------- */
+
+PyTypeObject TXNObject_Type;
+
+#define TXNObj_Check(x) ((x)->ob_type == &TXNObject_Type || PyObject_TypeCheck((x), &TXNObject_Type))
+
+typedef struct TXNObjectObject {
+ PyObject_HEAD
+ TXNObject ob_itself;
+} TXNObjectObject;
+
+PyObject *TXNObj_New(TXNObject itself)
+{
+ TXNObjectObject *it;
+ if (itself == NULL) return PyMac_Error(resNotFound);
+ it = PyObject_NEW(TXNObjectObject, &TXNObject_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+
+int TXNObj_Convert(PyObject *v, TXNObject *p_itself)
+{
+ if (!TXNObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "TXNObject required");
+ return 0;
+ }
+ *p_itself = ((TXNObjectObject *)v)->ob_itself;
+ return 1;
+}
+
+static void TXNObj_dealloc(TXNObjectObject *self)
+{
+ /* Cleanup of self->ob_itself goes here */
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *TXNObj_TXNDeleteObject(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef TXNDeleteObject
+ PyMac_PRECHECK(TXNDeleteObject);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TXNDeleteObject(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNResizeFrame(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UInt32 iWidth;
+ UInt32 iHeight;
+ TXNFrameID iTXNFrameID;
+#ifndef TXNResizeFrame
+ PyMac_PRECHECK(TXNResizeFrame);
+#endif
+ if (!PyArg_ParseTuple(_args, "lll",
+ &iWidth,
+ &iHeight,
+ &iTXNFrameID))
+ return NULL;
+ TXNResizeFrame(_self->ob_itself,
+ iWidth,
+ iHeight,
+ iTXNFrameID);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNSetFrameBounds(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 iTop;
+ SInt32 iLeft;
+ SInt32 iBottom;
+ SInt32 iRight;
+ TXNFrameID iTXNFrameID;
+#ifndef TXNSetFrameBounds
+ PyMac_PRECHECK(TXNSetFrameBounds);
+#endif
+ if (!PyArg_ParseTuple(_args, "lllll",
+ &iTop,
+ &iLeft,
+ &iBottom,
+ &iRight,
+ &iTXNFrameID))
+ return NULL;
+ TXNSetFrameBounds(_self->ob_itself,
+ iTop,
+ iLeft,
+ iBottom,
+ iRight,
+ iTXNFrameID);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNKeyDown(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ EventRecord iEvent;
+#ifndef TXNKeyDown
+ PyMac_PRECHECK(TXNKeyDown);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetEventRecord, &iEvent))
+ return NULL;
+ TXNKeyDown(_self->ob_itself,
+ &iEvent);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNAdjustCursor(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle ioCursorRgn;
+#ifndef TXNAdjustCursor
+ PyMac_PRECHECK(TXNAdjustCursor);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ OptResObj_Convert, &ioCursorRgn))
+ return NULL;
+ TXNAdjustCursor(_self->ob_itself,
+ ioCursorRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNClick(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ EventRecord iEvent;
+#ifndef TXNClick
+ PyMac_PRECHECK(TXNClick);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetEventRecord, &iEvent))
+ return NULL;
+ TXNClick(_self->ob_itself,
+ &iEvent);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNSelectAll(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef TXNSelectAll
+ PyMac_PRECHECK(TXNSelectAll);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TXNSelectAll(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNFocus(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean iBecomingFocused;
+#ifndef TXNFocus
+ PyMac_PRECHECK(TXNFocus);
+#endif
+ if (!PyArg_ParseTuple(_args, "b",
+ &iBecomingFocused))
+ return NULL;
+ TXNFocus(_self->ob_itself,
+ iBecomingFocused);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNUpdate(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef TXNUpdate
+ PyMac_PRECHECK(TXNUpdate);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TXNUpdate(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNDraw(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GWorldPtr iDrawPort;
+#ifndef TXNDraw
+ PyMac_PRECHECK(TXNDraw);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ OptGWorldObj_Convert, &iDrawPort))
+ return NULL;
+ TXNDraw(_self->ob_itself,
+ iDrawPort);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNForceUpdate(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef TXNForceUpdate
+ PyMac_PRECHECK(TXNForceUpdate);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TXNForceUpdate(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNGetSleepTicks(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UInt32 _rv;
+#ifndef TXNGetSleepTicks
+ PyMac_PRECHECK(TXNGetSleepTicks);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = TXNGetSleepTicks(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *TXNObj_TXNIdle(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef TXNIdle
+ PyMac_PRECHECK(TXNIdle);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TXNIdle(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNGrowWindow(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ EventRecord iEvent;
+#ifndef TXNGrowWindow
+ PyMac_PRECHECK(TXNGrowWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetEventRecord, &iEvent))
+ return NULL;
+ TXNGrowWindow(_self->ob_itself,
+ &iEvent);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNZoomWindow(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 iPart;
+#ifndef TXNZoomWindow
+ PyMac_PRECHECK(TXNZoomWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &iPart))
+ return NULL;
+ TXNZoomWindow(_self->ob_itself,
+ iPart);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNCanUndo(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ TXNActionKey oTXNActionKey;
+#ifndef TXNCanUndo
+ PyMac_PRECHECK(TXNCanUndo);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = TXNCanUndo(_self->ob_itself,
+ &oTXNActionKey);
+ _res = Py_BuildValue("bl",
+ _rv,
+ oTXNActionKey);
+ return _res;
+}
+
+static PyObject *TXNObj_TXNUndo(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef TXNUndo
+ PyMac_PRECHECK(TXNUndo);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TXNUndo(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNCanRedo(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ TXNActionKey oTXNActionKey;
+#ifndef TXNCanRedo
+ PyMac_PRECHECK(TXNCanRedo);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = TXNCanRedo(_self->ob_itself,
+ &oTXNActionKey);
+ _res = Py_BuildValue("bl",
+ _rv,
+ oTXNActionKey);
+ return _res;
+}
+
+static PyObject *TXNObj_TXNRedo(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef TXNRedo
+ PyMac_PRECHECK(TXNRedo);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TXNRedo(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNCut(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+#ifndef TXNCut
+ PyMac_PRECHECK(TXNCut);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = TXNCut(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNCopy(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+#ifndef TXNCopy
+ PyMac_PRECHECK(TXNCopy);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = TXNCopy(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNPaste(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+#ifndef TXNPaste
+ PyMac_PRECHECK(TXNPaste);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = TXNPaste(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNClear(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+#ifndef TXNClear
+ PyMac_PRECHECK(TXNClear);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = TXNClear(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNGetSelection(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TXNOffset oStartOffset;
+ TXNOffset oEndOffset;
+#ifndef TXNGetSelection
+ PyMac_PRECHECK(TXNGetSelection);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TXNGetSelection(_self->ob_itself,
+ &oStartOffset,
+ &oEndOffset);
+ _res = Py_BuildValue("ll",
+ oStartOffset,
+ oEndOffset);
+ return _res;
+}
+
+static PyObject *TXNObj_TXNShowSelection(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean iShowEnd;
+#ifndef TXNShowSelection
+ PyMac_PRECHECK(TXNShowSelection);
+#endif
+ if (!PyArg_ParseTuple(_args, "b",
+ &iShowEnd))
+ return NULL;
+ TXNShowSelection(_self->ob_itself,
+ iShowEnd);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNIsSelectionEmpty(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef TXNIsSelectionEmpty
+ PyMac_PRECHECK(TXNIsSelectionEmpty);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = TXNIsSelectionEmpty(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *TXNObj_TXNSetSelection(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ TXNOffset iStartOffset;
+ TXNOffset iEndOffset;
+#ifndef TXNSetSelection
+ PyMac_PRECHECK(TXNSetSelection);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &iStartOffset,
+ &iEndOffset))
+ return NULL;
+ _err = TXNSetSelection(_self->ob_itself,
+ iStartOffset,
+ iEndOffset);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNCountRunsInRange(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ TXNOffset iStartOffset;
+ TXNOffset iEndOffset;
+ ItemCount oRunCount;
+#ifndef TXNCountRunsInRange
+ PyMac_PRECHECK(TXNCountRunsInRange);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &iStartOffset,
+ &iEndOffset))
+ return NULL;
+ _err = TXNCountRunsInRange(_self->ob_itself,
+ iStartOffset,
+ iEndOffset,
+ &oRunCount);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ oRunCount);
+ return _res;
+}
+
+static PyObject *TXNObj_TXNDataSize(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ByteCount _rv;
+#ifndef TXNDataSize
+ PyMac_PRECHECK(TXNDataSize);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = TXNDataSize(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *TXNObj_TXNGetData(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ TXNOffset iStartOffset;
+ TXNOffset iEndOffset;
+ Handle oDataHandle;
+#ifndef TXNGetData
+ PyMac_PRECHECK(TXNGetData);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &iStartOffset,
+ &iEndOffset))
+ return NULL;
+ _err = TXNGetData(_self->ob_itself,
+ iStartOffset,
+ iEndOffset,
+ &oDataHandle);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, oDataHandle);
+ return _res;
+}
+
+static PyObject *TXNObj_TXNGetDataEncoded(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ TXNOffset iStartOffset;
+ TXNOffset iEndOffset;
+ Handle oDataHandle;
+ TXNDataType iEncoding;
+#ifndef TXNGetDataEncoded
+ PyMac_PRECHECK(TXNGetDataEncoded);
+#endif
+ if (!PyArg_ParseTuple(_args, "llO&",
+ &iStartOffset,
+ &iEndOffset,
+ PyMac_GetOSType, &iEncoding))
+ return NULL;
+ _err = TXNGetDataEncoded(_self->ob_itself,
+ iStartOffset,
+ iEndOffset,
+ &oDataHandle,
+ iEncoding);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, oDataHandle);
+ return _res;
+}
+
+static PyObject *TXNObj_TXNSetDataFromFile(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ SInt16 iFileRefNum;
+ OSType iFileType;
+ ByteCount iFileLength;
+ TXNOffset iStartOffset;
+ TXNOffset iEndOffset;
+#ifndef TXNSetDataFromFile
+ PyMac_PRECHECK(TXNSetDataFromFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "hO&lll",
+ &iFileRefNum,
+ PyMac_GetOSType, &iFileType,
+ &iFileLength,
+ &iStartOffset,
+ &iEndOffset))
+ return NULL;
+ _err = TXNSetDataFromFile(_self->ob_itself,
+ iFileRefNum,
+ iFileType,
+ iFileLength,
+ iStartOffset,
+ iEndOffset);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNGetChangeCount(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ItemCount _rv;
+#ifndef TXNGetChangeCount
+ PyMac_PRECHECK(TXNGetChangeCount);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = TXNGetChangeCount(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *TXNObj_TXNSave(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ TXNFileType iType;
+ OSType iResType;
+ TXNPermanentTextEncodingType iPermanentEncoding;
+ FSSpec iFileSpecification;
+ SInt16 iDataReference;
+ SInt16 iResourceReference;
+#ifndef TXNSave
+ PyMac_PRECHECK(TXNSave);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&lO&hh",
+ PyMac_GetOSType, &iType,
+ PyMac_GetOSType, &iResType,
+ &iPermanentEncoding,
+ PyMac_GetFSSpec, &iFileSpecification,
+ &iDataReference,
+ &iResourceReference))
+ return NULL;
+ _err = TXNSave(_self->ob_itself,
+ iType,
+ iResType,
+ iPermanentEncoding,
+ &iFileSpecification,
+ iDataReference,
+ iResourceReference);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNRevert(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+#ifndef TXNRevert
+ PyMac_PRECHECK(TXNRevert);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = TXNRevert(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNPageSetup(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+#ifndef TXNPageSetup
+ PyMac_PRECHECK(TXNPageSetup);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = TXNPageSetup(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNPrint(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+#ifndef TXNPrint
+ PyMac_PRECHECK(TXNPrint);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = TXNPrint(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNGetViewRect(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect oViewRect;
+#ifndef TXNGetViewRect
+ PyMac_PRECHECK(TXNGetViewRect);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TXNGetViewRect(_self->ob_itself,
+ &oViewRect);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &oViewRect);
+ return _res;
+}
+
+static PyObject *TXNObj_TXNSetViewRect(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect iViewRect;
+#ifndef TXNSetViewRect
+ PyMac_PRECHECK(TXNSetViewRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &iViewRect))
+ return NULL;
+ TXNSetViewRect(_self->ob_itself,
+ &iViewRect);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNAttachObjectToWindow(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ GWorldPtr iWindow;
+ Boolean iIsActualWindow;
+#ifndef TXNAttachObjectToWindow
+ PyMac_PRECHECK(TXNAttachObjectToWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&b",
+ GWorldObj_Convert, &iWindow,
+ &iIsActualWindow))
+ return NULL;
+ _err = TXNAttachObjectToWindow(_self->ob_itself,
+ iWindow,
+ iIsActualWindow);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNIsObjectAttachedToWindow(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef TXNIsObjectAttachedToWindow
+ PyMac_PRECHECK(TXNIsObjectAttachedToWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = TXNIsObjectAttachedToWindow(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *TXNObj_TXNDragTracker(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ TXNFrameID iTXNFrameID;
+ DragTrackingMessage iMessage;
+ WindowPtr iWindow;
+ DragReference iDragReference;
+ Boolean iDifferentObjectSameWindow;
+#ifndef TXNDragTracker
+ PyMac_PRECHECK(TXNDragTracker);
+#endif
+ if (!PyArg_ParseTuple(_args, "lhO&O&b",
+ &iTXNFrameID,
+ &iMessage,
+ WinObj_Convert, &iWindow,
+ DragObj_Convert, &iDragReference,
+ &iDifferentObjectSameWindow))
+ return NULL;
+ _err = TXNDragTracker(_self->ob_itself,
+ iTXNFrameID,
+ iMessage,
+ iWindow,
+ iDragReference,
+ iDifferentObjectSameWindow);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNDragReceiver(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ TXNFrameID iTXNFrameID;
+ WindowPtr iWindow;
+ DragReference iDragReference;
+ Boolean iDifferentObjectSameWindow;
+#ifndef TXNDragReceiver
+ PyMac_PRECHECK(TXNDragReceiver);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&O&b",
+ &iTXNFrameID,
+ WinObj_Convert, &iWindow,
+ DragObj_Convert, &iDragReference,
+ &iDifferentObjectSameWindow))
+ return NULL;
+ _err = TXNDragReceiver(_self->ob_itself,
+ iTXNFrameID,
+ iWindow,
+ iDragReference,
+ iDifferentObjectSameWindow);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNActivate(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ TXNFrameID iTXNFrameID;
+ TXNScrollBarState iActiveState;
+#ifndef TXNActivate
+ PyMac_PRECHECK(TXNActivate);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &iTXNFrameID,
+ &iActiveState))
+ return NULL;
+ _err = TXNActivate(_self->ob_itself,
+ iTXNFrameID,
+ iActiveState);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNEchoMode(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UniChar iEchoCharacter;
+ TextEncoding iEncoding;
+ Boolean iOn;
+#ifndef TXNEchoMode
+ PyMac_PRECHECK(TXNEchoMode);
+#endif
+ if (!PyArg_ParseTuple(_args, "hlb",
+ &iEchoCharacter,
+ &iEncoding,
+ &iOn))
+ return NULL;
+ _err = TXNEchoMode(_self->ob_itself,
+ iEchoCharacter,
+ iEncoding,
+ iOn);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNDoFontMenuSelection(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ TXNFontMenuObject iTXNFontMenuObject;
+ SInt16 iMenuID;
+ SInt16 iMenuItem;
+#ifndef TXNDoFontMenuSelection
+ PyMac_PRECHECK(TXNDoFontMenuSelection);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ TXNFontMenuObj_Convert, &iTXNFontMenuObject,
+ &iMenuID,
+ &iMenuItem))
+ return NULL;
+ _err = TXNDoFontMenuSelection(_self->ob_itself,
+ iTXNFontMenuObject,
+ iMenuID,
+ iMenuItem);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNPrepareFontMenu(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ TXNFontMenuObject iTXNFontMenuObject;
+#ifndef TXNPrepareFontMenu
+ PyMac_PRECHECK(TXNPrepareFontMenu);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ TXNFontMenuObj_Convert, &iTXNFontMenuObject))
+ return NULL;
+ _err = TXNPrepareFontMenu(_self->ob_itself,
+ iTXNFontMenuObject);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNPointToOffset(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Point iPoint;
+ TXNOffset oOffset;
+#ifndef TXNPointToOffset
+ PyMac_PRECHECK(TXNPointToOffset);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &iPoint))
+ return NULL;
+ _err = TXNPointToOffset(_self->ob_itself,
+ iPoint,
+ &oOffset);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ oOffset);
+ return _res;
+}
+
+static PyObject *TXNObj_TXNOffsetToPoint(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ TXNOffset iOffset;
+ Point oPoint;
+#ifndef TXNOffsetToPoint
+ PyMac_PRECHECK(TXNOffsetToPoint);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &iOffset))
+ return NULL;
+ _err = TXNOffsetToPoint(_self->ob_itself,
+ iOffset,
+ &oPoint);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, oPoint);
+ return _res;
+}
+
+static PyObject *TXNObj_TXNGetLineCount(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ItemCount oLineTotal;
+#ifndef TXNGetLineCount
+ PyMac_PRECHECK(TXNGetLineCount);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = TXNGetLineCount(_self->ob_itself,
+ &oLineTotal);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ oLineTotal);
+ return _res;
+}
+
+static PyObject *TXNObj_TXNGetLineMetrics(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 iLineNumber;
+ Fixed oLineWidth;
+ Fixed oLineHeight;
+#ifndef TXNGetLineMetrics
+ PyMac_PRECHECK(TXNGetLineMetrics);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &iLineNumber))
+ return NULL;
+ _err = TXNGetLineMetrics(_self->ob_itself,
+ iLineNumber,
+ &oLineWidth,
+ &oLineHeight);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&O&",
+ PyMac_BuildFixed, oLineWidth,
+ PyMac_BuildFixed, oLineHeight);
+ return _res;
+}
+
+static PyObject *TXNObj_TXNIsObjectAttachedToSpecificWindow(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr iWindow;
+ Boolean oAttached;
+#ifndef TXNIsObjectAttachedToSpecificWindow
+ PyMac_PRECHECK(TXNIsObjectAttachedToSpecificWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &iWindow))
+ return NULL;
+ _err = TXNIsObjectAttachedToSpecificWindow(_self->ob_itself,
+ iWindow,
+ &oAttached);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("b",
+ oAttached);
+ return _res;
+}
+
+static PyObject *TXNObj_TXNRecalcTextLayout(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef TXNRecalcTextLayout
+ PyMac_PRECHECK(TXNRecalcTextLayout);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TXNRecalcTextLayout(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyMethodDef TXNObj_methods[] = {
+ {"TXNDeleteObject", (PyCFunction)TXNObj_TXNDeleteObject, 1,
+ PyDoc_STR("() -> None")},
+ {"TXNResizeFrame", (PyCFunction)TXNObj_TXNResizeFrame, 1,
+ PyDoc_STR("(UInt32 iWidth, UInt32 iHeight, TXNFrameID iTXNFrameID) -> None")},
+ {"TXNSetFrameBounds", (PyCFunction)TXNObj_TXNSetFrameBounds, 1,
+ PyDoc_STR("(SInt32 iTop, SInt32 iLeft, SInt32 iBottom, SInt32 iRight, TXNFrameID iTXNFrameID) -> None")},
+ {"TXNKeyDown", (PyCFunction)TXNObj_TXNKeyDown, 1,
+ PyDoc_STR("(EventRecord iEvent) -> None")},
+ {"TXNAdjustCursor", (PyCFunction)TXNObj_TXNAdjustCursor, 1,
+ PyDoc_STR("(RgnHandle ioCursorRgn) -> None")},
+ {"TXNClick", (PyCFunction)TXNObj_TXNClick, 1,
+ PyDoc_STR("(EventRecord iEvent) -> None")},
+ {"TXNSelectAll", (PyCFunction)TXNObj_TXNSelectAll, 1,
+ PyDoc_STR("() -> None")},
+ {"TXNFocus", (PyCFunction)TXNObj_TXNFocus, 1,
+ PyDoc_STR("(Boolean iBecomingFocused) -> None")},
+ {"TXNUpdate", (PyCFunction)TXNObj_TXNUpdate, 1,
+ PyDoc_STR("() -> None")},
+ {"TXNDraw", (PyCFunction)TXNObj_TXNDraw, 1,
+ PyDoc_STR("(GWorldPtr iDrawPort) -> None")},
+ {"TXNForceUpdate", (PyCFunction)TXNObj_TXNForceUpdate, 1,
+ PyDoc_STR("() -> None")},
+ {"TXNGetSleepTicks", (PyCFunction)TXNObj_TXNGetSleepTicks, 1,
+ PyDoc_STR("() -> (UInt32 _rv)")},
+ {"TXNIdle", (PyCFunction)TXNObj_TXNIdle, 1,
+ PyDoc_STR("() -> None")},
+ {"TXNGrowWindow", (PyCFunction)TXNObj_TXNGrowWindow, 1,
+ PyDoc_STR("(EventRecord iEvent) -> None")},
+ {"TXNZoomWindow", (PyCFunction)TXNObj_TXNZoomWindow, 1,
+ PyDoc_STR("(SInt16 iPart) -> None")},
+ {"TXNCanUndo", (PyCFunction)TXNObj_TXNCanUndo, 1,
+ PyDoc_STR("() -> (Boolean _rv, TXNActionKey oTXNActionKey)")},
+ {"TXNUndo", (PyCFunction)TXNObj_TXNUndo, 1,
+ PyDoc_STR("() -> None")},
+ {"TXNCanRedo", (PyCFunction)TXNObj_TXNCanRedo, 1,
+ PyDoc_STR("() -> (Boolean _rv, TXNActionKey oTXNActionKey)")},
+ {"TXNRedo", (PyCFunction)TXNObj_TXNRedo, 1,
+ PyDoc_STR("() -> None")},
+ {"TXNCut", (PyCFunction)TXNObj_TXNCut, 1,
+ PyDoc_STR("() -> None")},
+ {"TXNCopy", (PyCFunction)TXNObj_TXNCopy, 1,
+ PyDoc_STR("() -> None")},
+ {"TXNPaste", (PyCFunction)TXNObj_TXNPaste, 1,
+ PyDoc_STR("() -> None")},
+ {"TXNClear", (PyCFunction)TXNObj_TXNClear, 1,
+ PyDoc_STR("() -> None")},
+ {"TXNGetSelection", (PyCFunction)TXNObj_TXNGetSelection, 1,
+ PyDoc_STR("() -> (TXNOffset oStartOffset, TXNOffset oEndOffset)")},
+ {"TXNShowSelection", (PyCFunction)TXNObj_TXNShowSelection, 1,
+ PyDoc_STR("(Boolean iShowEnd) -> None")},
+ {"TXNIsSelectionEmpty", (PyCFunction)TXNObj_TXNIsSelectionEmpty, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"TXNSetSelection", (PyCFunction)TXNObj_TXNSetSelection, 1,
+ PyDoc_STR("(TXNOffset iStartOffset, TXNOffset iEndOffset) -> None")},
+ {"TXNCountRunsInRange", (PyCFunction)TXNObj_TXNCountRunsInRange, 1,
+ PyDoc_STR("(TXNOffset iStartOffset, TXNOffset iEndOffset) -> (ItemCount oRunCount)")},
+ {"TXNDataSize", (PyCFunction)TXNObj_TXNDataSize, 1,
+ PyDoc_STR("() -> (ByteCount _rv)")},
+ {"TXNGetData", (PyCFunction)TXNObj_TXNGetData, 1,
+ PyDoc_STR("(TXNOffset iStartOffset, TXNOffset iEndOffset) -> (Handle oDataHandle)")},
+ {"TXNGetDataEncoded", (PyCFunction)TXNObj_TXNGetDataEncoded, 1,
+ PyDoc_STR("(TXNOffset iStartOffset, TXNOffset iEndOffset, TXNDataType iEncoding) -> (Handle oDataHandle)")},
+ {"TXNSetDataFromFile", (PyCFunction)TXNObj_TXNSetDataFromFile, 1,
+ PyDoc_STR("(SInt16 iFileRefNum, OSType iFileType, ByteCount iFileLength, TXNOffset iStartOffset, TXNOffset iEndOffset) -> None")},
+ {"TXNGetChangeCount", (PyCFunction)TXNObj_TXNGetChangeCount, 1,
+ PyDoc_STR("() -> (ItemCount _rv)")},
+ {"TXNSave", (PyCFunction)TXNObj_TXNSave, 1,
+ PyDoc_STR("(TXNFileType iType, OSType iResType, TXNPermanentTextEncodingType iPermanentEncoding, FSSpec iFileSpecification, SInt16 iDataReference, SInt16 iResourceReference) -> None")},
+ {"TXNRevert", (PyCFunction)TXNObj_TXNRevert, 1,
+ PyDoc_STR("() -> None")},
+ {"TXNPageSetup", (PyCFunction)TXNObj_TXNPageSetup, 1,
+ PyDoc_STR("() -> None")},
+ {"TXNPrint", (PyCFunction)TXNObj_TXNPrint, 1,
+ PyDoc_STR("() -> None")},
+ {"TXNGetViewRect", (PyCFunction)TXNObj_TXNGetViewRect, 1,
+ PyDoc_STR("() -> (Rect oViewRect)")},
+ {"TXNSetViewRect", (PyCFunction)TXNObj_TXNSetViewRect, 1,
+ PyDoc_STR("(Rect iViewRect) -> None")},
+ {"TXNAttachObjectToWindow", (PyCFunction)TXNObj_TXNAttachObjectToWindow, 1,
+ PyDoc_STR("(GWorldPtr iWindow, Boolean iIsActualWindow) -> None")},
+ {"TXNIsObjectAttachedToWindow", (PyCFunction)TXNObj_TXNIsObjectAttachedToWindow, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"TXNDragTracker", (PyCFunction)TXNObj_TXNDragTracker, 1,
+ PyDoc_STR("(TXNFrameID iTXNFrameID, DragTrackingMessage iMessage, WindowPtr iWindow, DragReference iDragReference, Boolean iDifferentObjectSameWindow) -> None")},
+ {"TXNDragReceiver", (PyCFunction)TXNObj_TXNDragReceiver, 1,
+ PyDoc_STR("(TXNFrameID iTXNFrameID, WindowPtr iWindow, DragReference iDragReference, Boolean iDifferentObjectSameWindow) -> None")},
+ {"TXNActivate", (PyCFunction)TXNObj_TXNActivate, 1,
+ PyDoc_STR("(TXNFrameID iTXNFrameID, TXNScrollBarState iActiveState) -> None")},
+ {"TXNEchoMode", (PyCFunction)TXNObj_TXNEchoMode, 1,
+ PyDoc_STR("(UniChar iEchoCharacter, TextEncoding iEncoding, Boolean iOn) -> None")},
+ {"TXNDoFontMenuSelection", (PyCFunction)TXNObj_TXNDoFontMenuSelection, 1,
+ PyDoc_STR("(TXNFontMenuObject iTXNFontMenuObject, SInt16 iMenuID, SInt16 iMenuItem) -> None")},
+ {"TXNPrepareFontMenu", (PyCFunction)TXNObj_TXNPrepareFontMenu, 1,
+ PyDoc_STR("(TXNFontMenuObject iTXNFontMenuObject) -> None")},
+ {"TXNPointToOffset", (PyCFunction)TXNObj_TXNPointToOffset, 1,
+ PyDoc_STR("(Point iPoint) -> (TXNOffset oOffset)")},
+ {"TXNOffsetToPoint", (PyCFunction)TXNObj_TXNOffsetToPoint, 1,
+ PyDoc_STR("(TXNOffset iOffset) -> (Point oPoint)")},
+ {"TXNGetLineCount", (PyCFunction)TXNObj_TXNGetLineCount, 1,
+ PyDoc_STR("() -> (ItemCount oLineTotal)")},
+ {"TXNGetLineMetrics", (PyCFunction)TXNObj_TXNGetLineMetrics, 1,
+ PyDoc_STR("(UInt32 iLineNumber) -> (Fixed oLineWidth, Fixed oLineHeight)")},
+ {"TXNIsObjectAttachedToSpecificWindow", (PyCFunction)TXNObj_TXNIsObjectAttachedToSpecificWindow, 1,
+ PyDoc_STR("(WindowPtr iWindow) -> (Boolean oAttached)")},
+ {"TXNRecalcTextLayout", (PyCFunction)TXNObj_TXNRecalcTextLayout, 1,
+ PyDoc_STR("() -> None")},
+ {NULL, NULL, 0}
+};
+
+#define TXNObj_getsetlist NULL
+
+
+#define TXNObj_compare NULL
+
+#define TXNObj_repr NULL
+
+#define TXNObj_hash NULL
+#define TXNObj_tp_init 0
+
+#define TXNObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *TXNObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *_self;
+ TXNObject itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, TXNObj_Convert, &itself)) return NULL;
+ if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((TXNObjectObject *)_self)->ob_itself = itself;
+ return _self;
+}
+
+#define TXNObj_tp_free PyObject_Del
+
+
+PyTypeObject TXNObject_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_Mlte.TXNObject", /*tp_name*/
+ sizeof(TXNObjectObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) TXNObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) TXNObj_compare, /*tp_compare*/
+ (reprfunc) TXNObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) TXNObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ TXNObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ TXNObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ TXNObj_tp_init, /* tp_init */
+ TXNObj_tp_alloc, /* tp_alloc */
+ TXNObj_tp_new, /* tp_new */
+ TXNObj_tp_free, /* tp_free */
+};
+
+/* ------------------- End object type TXNObject -------------------- */
+
+
+/* ----------------- Object type TXNFontMenuObject ------------------ */
+
+PyTypeObject TXNFontMenuObject_Type;
+
+#define TXNFontMenuObj_Check(x) ((x)->ob_type == &TXNFontMenuObject_Type || PyObject_TypeCheck((x), &TXNFontMenuObject_Type))
+
+typedef struct TXNFontMenuObjectObject {
+ PyObject_HEAD
+ TXNFontMenuObject ob_itself;
+} TXNFontMenuObjectObject;
+
+PyObject *TXNFontMenuObj_New(TXNFontMenuObject itself)
+{
+ TXNFontMenuObjectObject *it;
+ if (itself == NULL) return PyMac_Error(resNotFound);
+ it = PyObject_NEW(TXNFontMenuObjectObject, &TXNFontMenuObject_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+
+int TXNFontMenuObj_Convert(PyObject *v, TXNFontMenuObject *p_itself)
+{
+ if (!TXNFontMenuObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "TXNFontMenuObject required");
+ return 0;
+ }
+ *p_itself = ((TXNFontMenuObjectObject *)v)->ob_itself;
+ return 1;
+}
+
+static void TXNFontMenuObj_dealloc(TXNFontMenuObjectObject *self)
+{
+ /* Cleanup of self->ob_itself goes here */
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *TXNFontMenuObj_TXNGetFontMenuHandle(TXNFontMenuObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuHandle oFontMenuHandle;
+#ifndef TXNGetFontMenuHandle
+ PyMac_PRECHECK(TXNGetFontMenuHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = TXNGetFontMenuHandle(_self->ob_itself,
+ &oFontMenuHandle);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ MenuObj_New, oFontMenuHandle);
+ return _res;
+}
+
+static PyObject *TXNFontMenuObj_TXNDisposeFontMenuObject(TXNFontMenuObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+#ifndef TXNDisposeFontMenuObject
+ PyMac_PRECHECK(TXNDisposeFontMenuObject);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = TXNDisposeFontMenuObject(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyMethodDef TXNFontMenuObj_methods[] = {
+ {"TXNGetFontMenuHandle", (PyCFunction)TXNFontMenuObj_TXNGetFontMenuHandle, 1,
+ PyDoc_STR("() -> (MenuHandle oFontMenuHandle)")},
+ {"TXNDisposeFontMenuObject", (PyCFunction)TXNFontMenuObj_TXNDisposeFontMenuObject, 1,
+ PyDoc_STR("() -> None")},
+ {NULL, NULL, 0}
+};
+
+#define TXNFontMenuObj_getsetlist NULL
+
+
+#define TXNFontMenuObj_compare NULL
+
+#define TXNFontMenuObj_repr NULL
+
+#define TXNFontMenuObj_hash NULL
+#define TXNFontMenuObj_tp_init 0
+
+#define TXNFontMenuObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *TXNFontMenuObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *_self;
+ TXNFontMenuObject itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, TXNFontMenuObj_Convert, &itself)) return NULL;
+ if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((TXNFontMenuObjectObject *)_self)->ob_itself = itself;
+ return _self;
+}
+
+#define TXNFontMenuObj_tp_free PyObject_Del
+
+
+PyTypeObject TXNFontMenuObject_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_Mlte.TXNFontMenuObject", /*tp_name*/
+ sizeof(TXNFontMenuObjectObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) TXNFontMenuObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) TXNFontMenuObj_compare, /*tp_compare*/
+ (reprfunc) TXNFontMenuObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) TXNFontMenuObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ TXNFontMenuObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ TXNFontMenuObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ TXNFontMenuObj_tp_init, /* tp_init */
+ TXNFontMenuObj_tp_alloc, /* tp_alloc */
+ TXNFontMenuObj_tp_new, /* tp_new */
+ TXNFontMenuObj_tp_free, /* tp_free */
+};
+
+/* --------------- End object type TXNFontMenuObject ---------------- */
+
+
+static PyObject *Mlte_TXNNewObject(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ FSSpec * iFileSpec;
+ WindowPtr iWindow;
+ Rect iFrame;
+ TXNFrameOptions iFrameOptions;
+ TXNFrameType iFrameType;
+ TXNFileType iFileType;
+ TXNPermanentTextEncodingType iPermanentEncoding;
+ TXNObject oTXNObject;
+ TXNFrameID oTXNFrameID;
+#ifndef TXNNewObject
+ PyMac_PRECHECK(TXNNewObject);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&llO&l",
+ OptFSSpecPtr_Convert, &iFileSpec,
+ WinObj_Convert, &iWindow,
+ PyMac_GetRect, &iFrame,
+ &iFrameOptions,
+ &iFrameType,
+ PyMac_GetOSType, &iFileType,
+ &iPermanentEncoding))
+ return NULL;
+ _err = TXNNewObject(iFileSpec,
+ iWindow,
+ &iFrame,
+ iFrameOptions,
+ iFrameType,
+ iFileType,
+ iPermanentEncoding,
+ &oTXNObject,
+ &oTXNFrameID,
+ (TXNObjectRefcon)0);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&l",
+ TXNObj_New, oTXNObject,
+ oTXNFrameID);
+ return _res;
+}
+
+static PyObject *Mlte_TXNTerminateTextension(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef TXNTerminateTextension
+ PyMac_PRECHECK(TXNTerminateTextension);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TXNTerminateTextension();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Mlte_TXNIsScrapPastable(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef TXNIsScrapPastable
+ PyMac_PRECHECK(TXNIsScrapPastable);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = TXNIsScrapPastable();
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Mlte_TXNConvertToPublicScrap(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+#ifndef TXNConvertToPublicScrap
+ PyMac_PRECHECK(TXNConvertToPublicScrap);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = TXNConvertToPublicScrap();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Mlte_TXNConvertFromPublicScrap(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+#ifndef TXNConvertFromPublicScrap
+ PyMac_PRECHECK(TXNConvertFromPublicScrap);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = TXNConvertFromPublicScrap();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Mlte_TXNNewFontMenuObject(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuHandle iFontMenuHandle;
+ SInt16 iMenuID;
+ SInt16 iStartHierMenuID;
+ TXNFontMenuObject oTXNFontMenuObject;
+#ifndef TXNNewFontMenuObject
+ PyMac_PRECHECK(TXNNewFontMenuObject);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ MenuObj_Convert, &iFontMenuHandle,
+ &iMenuID,
+ &iStartHierMenuID))
+ return NULL;
+ _err = TXNNewFontMenuObject(iFontMenuHandle,
+ iMenuID,
+ iStartHierMenuID,
+ &oTXNFontMenuObject);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ TXNFontMenuObj_New, oTXNFontMenuObject);
+ return _res;
+}
+
+static PyObject *Mlte_TXNVersionInformation(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TXNVersionValue _rv;
+ TXNFeatureBits oFeatureFlags;
+#ifndef TXNVersionInformation
+ PyMac_PRECHECK(TXNVersionInformation);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = TXNVersionInformation(&oFeatureFlags);
+ _res = Py_BuildValue("ll",
+ _rv,
+ oFeatureFlags);
+ return _res;
+}
+
+static PyObject *Mlte_TXNInitTextension(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ OSStatus _err;
+ TXNMacOSPreferredFontDescription * iDefaultFonts = NULL;
+ ItemCount iCountDefaultFonts = 0;
+ TXNInitOptions iUsageFlags;
+ PyMac_PRECHECK(TXNInitTextension);
+ if (!PyArg_ParseTuple(_args, "l", &iUsageFlags))
+ return NULL;
+ _err = TXNInitTextension(iDefaultFonts,
+ iCountDefaultFonts,
+ iUsageFlags);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+
+}
+
+#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,
+ PyDoc_STR("() -> None")},
+ {"TXNIsScrapPastable", (PyCFunction)Mlte_TXNIsScrapPastable, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"TXNConvertToPublicScrap", (PyCFunction)Mlte_TXNConvertToPublicScrap, 1,
+ PyDoc_STR("() -> None")},
+ {"TXNConvertFromPublicScrap", (PyCFunction)Mlte_TXNConvertFromPublicScrap, 1,
+ PyDoc_STR("() -> None")},
+ {"TXNNewFontMenuObject", (PyCFunction)Mlte_TXNNewFontMenuObject, 1,
+ PyDoc_STR("(MenuHandle iFontMenuHandle, SInt16 iMenuID, SInt16 iStartHierMenuID) -> (TXNFontMenuObject oTXNFontMenuObject)")},
+ {"TXNVersionInformation", (PyCFunction)Mlte_TXNVersionInformation, 1,
+ PyDoc_STR("() -> (TXNVersionValue _rv, TXNFeatureBits oFeatureFlags)")},
+ {"TXNInitTextension", (PyCFunction)Mlte_TXNInitTextension, 1,
+ PyDoc_STR("(TXNInitOptions) -> None")},
+#endif /* __LP64__ */
+ {NULL, NULL, 0}
+};
+
+
+
+
+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 ||
+ PyDict_SetItemString(d, "Error", Mlte_Error) != 0)
+ return;
+ TXNObject_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&TXNObject_Type) < 0) return;
+ Py_INCREF(&TXNObject_Type);
+ PyModule_AddObject(m, "TXNObject", (PyObject *)&TXNObject_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&TXNObject_Type);
+ PyModule_AddObject(m, "TXNObjectType", (PyObject *)&TXNObject_Type);
+ TXNFontMenuObject_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&TXNFontMenuObject_Type) < 0) return;
+ Py_INCREF(&TXNFontMenuObject_Type);
+ PyModule_AddObject(m, "TXNFontMenuObject", (PyObject *)&TXNFontMenuObject_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&TXNFontMenuObject_Type);
+ PyModule_AddObject(m, "TXNFontMenuObjectType", (PyObject *)&TXNFontMenuObject_Type);
+#endif /* __LP64__ */
+}
+
+/* ======================== End module _Mlte ======================== */
+
diff --git a/Mac/Modules/mlte/mltescan.py b/Mac/Modules/mlte/mltescan.py
new file mode 100644
index 0000000000..e48a229de7
--- /dev/null
+++ b/Mac/Modules/mlte/mltescan.py
@@ -0,0 +1,142 @@
+# Scan an Apple header file, generating a Python file of generator calls.
+
+import sys
+from bgenlocations import TOOLBOXDIR, BGENDIR
+sys.path.append(BGENDIR)
+from scantools import Scanner_OSX
+
+LONG = "MacTextEditor"
+SHORT = "mlte"
+OBJECTS = ("TXNObject", "TXNFontMenuObject")
+# ADD object typenames here
+
+def main():
+ input = "MacTextEditor.h"
+ output = SHORT + "gen.py"
+ defsoutput = TOOLBOXDIR + LONG + ".py"
+ scanner = MyScanner(input, output, defsoutput)
+ scanner.scan()
+ scanner.gentypetest(SHORT+"typetest.py")
+ scanner.close()
+ print "=== Testing definitions output code ==="
+ execfile(defsoutput, {}, {})
+ print "=== Done scanning and generating, now importing the generated code... ==="
+ exec "import " + SHORT + "support"
+ print "=== Done. It's up to you to compile it now! ==="
+
+class MyScanner(Scanner_OSX):
+
+ def destination(self, type, name, arglist):
+ classname = "Function"
+ listname = "functions"
+ if arglist:
+ t, n, m = arglist[0]
+ if t in OBJECTS and m == "InMode":
+ classname = "Method"
+ listname = t + "_methods"
+ return classname, listname
+
+ def writeinitialdefs(self):
+ self.defsfile.write("""
+def FOUR_CHAR_CODE(x): return x
+false = 0
+true = 1
+kTXNClearThisControl = 0xFFFFFFFF
+kTXNClearTheseFontFeatures = 0x80000000
+kTXNDontCareTypeSize = 0xFFFFFFFF
+kTXNDecrementTypeSize = 0x80000000
+kTXNUseCurrentSelection = 0xFFFFFFFF
+kTXNStartOffset = 0
+kTXNEndOffset = 0x7FFFFFFF
+MovieFileType = FOUR_CHAR_CODE('moov')
+kTXNUseEncodingWordRulesMask = 0x80000000
+kTXNFontSizeAttributeSize = 4
+normal = 0
+""")
+
+ def makeblacklistnames(self):
+ return [
+ "TXNGetFontDefaults", # Arg is too difficult
+ "TXNSetFontDefaults", # Arg is too difficult
+ "TXNInitTextension", # done manually
+
+ # Constants with funny definitions
+ "kTXNClearThisControl",
+ "kTXNClearTheseFontFeatures",
+ "kTXNDontCareTypeSize",
+ "kTXNDecrementTypeSize",
+ "kTXNUseCurrentSelection",
+ "kTXNStartOffset",
+ "kTXNEndOffset",
+ "kTXNQDFontNameAttributeSize",
+ "kTXNQDFontFamilyIDAttributeSize",
+ "kTXNQDFontSizeAttributeSize",
+ "kTXNQDFontStyleAttributeSize",
+ "kTXNQDFontColorAttributeSize",
+ "kTXNTextEncodingAttributeSize",
+ "kTXNUseEncodingWordRulesMask",
+ "kTXNFontSizeAttributeSize",
+ "status",
+ "justification",
+ 'TXNTSMCheck', # OS8
+ ]
+
+ def makeblacklisttypes(self):
+ return [
+ "TXNTab", # TBD
+ "TXNMargins", # TBD
+ "TXNControlData", #TBD
+ "TXNATSUIFeatures", #TBD
+ "TXNATSUIVariations", #TBD
+ "TXNAttributeData", #TBD
+ "TXNTypeAttributes", #TBD
+ "TXNMatchTextRecord", #TBD
+ "TXNBackground", #TBD
+ "TXNFindUPP",
+ "ATSUStyle", #TBD
+ "TXNBackground_ptr", #TBD
+ "TXNControlData_ptr", #TBD
+ "TXNControlTag_ptr", #TBD
+ "TXNLongRect", #TBD
+ "TXNLongRect_ptr", #TBD
+ "TXNTypeAttributes_ptr", #TBD
+
+ "TXNActionKeyMapperProcPtr",
+ "TXNActionKeyMapperUPP",
+ "TXNTextBoxOptionsData",
+ "TXNCountOptions",
+ "void_ptr",
+ ]
+
+ def makerepairinstructions(self):
+ return [
+ # TXNNewObject has a lot of optional parameters
+ ([("FSSpec_ptr", "iFileSpec", "InMode")],
+ [("OptFSSpecPtr", "*", "*")]),
+ ([("Rect", "iFrame", "OutMode")],
+ [("OptRectPtr", "*", "InMode")]),
+
+ # In UH 332 some of the "const" are missing for input parameters passed
+ # by reference. We fix that up here.
+ ([("EventRecord", "iEvent", "OutMode")],
+ [("EventRecord_ptr", "*", "InMode")]),
+ ([("FSSpec", "iFileSpecification", "OutMode")],
+ [("FSSpec_ptr", "*", "InMode")]),
+ ([("TXNMacOSPreferredFontDescription", "iFontDefaults", "OutMode")],
+ [("TXNMacOSPreferredFontDescription_ptr", "*", "InMode")]),
+
+ # In buffers are passed as void *
+ ([("void", "*", "OutMode"), ("ByteCount", "*", "InMode")],
+ [("MlteInBuffer", "*", "InMode")]),
+
+ # The AdjustCursor region handle is optional
+ ([("RgnHandle", "ioCursorRgn", "InMode")],
+ [("OptRgnHandle", "*", "*")]),
+
+ # The GWorld for TXNDraw is optional
+ ([('GWorldPtr', 'iDrawPort', 'InMode')],
+ [('OptGWorldPtr', '*', '*')]),
+ ]
+
+if __name__ == "__main__":
+ main()
diff --git a/Mac/Modules/mlte/mltesupport.py b/Mac/Modules/mlte/mltesupport.py
new file mode 100644
index 0000000000..8dcbed5bb6
--- /dev/null
+++ b/Mac/Modules/mlte/mltesupport.py
@@ -0,0 +1,202 @@
+# This script generates a Python interface for an Apple Macintosh Manager.
+# It uses the "bgen" package to generate C code.
+# The function specifications are generated by scanning the mamager's header file,
+# using the "scantools" package (customized for this particular manager).
+
+#error missing SetActionFilter
+
+import string
+
+# Declarations that change for each manager
+MODNAME = '_Mlte' # The name of the module
+
+# The following is *usually* unchanged but may still require tuning
+MODPREFIX = 'Mlte' # The prefix for module-wide routines
+INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner
+OUTPUTFILE = MODNAME + "module.c" # The file generated by this program
+
+from macsupport import *
+
+# Create the type objects
+
+includestuff = includestuff + """
+#include <Carbon/Carbon.h>
+
+/* For now we declare them forward here. They'll go to mactoolbox later */
+static PyObject *TXNObj_New(TXNObject);
+static int TXNObj_Convert(PyObject *, TXNObject *);
+static PyObject *TXNFontMenuObj_New(TXNFontMenuObject);
+static int TXNFontMenuObj_Convert(PyObject *, TXNFontMenuObject *);
+
+// ADD declarations
+#ifdef NOTYET_USE_TOOLBOX_OBJECT_GLUE
+//extern PyObject *_CFTypeRefObj_New(CFTypeRef);
+//extern int _CFTypeRefObj_Convert(PyObject *, CFTypeRef *);
+
+//#define CFTypeRefObj_New _CFTypeRefObj_New
+//#define CFTypeRefObj_Convert _CFTypeRefObj_Convert
+#endif
+
+/*
+** Parse an optional fsspec
+*/
+static int
+OptFSSpecPtr_Convert(PyObject *v, FSSpec **p_itself)
+{
+ static FSSpec fss;
+ if (v == Py_None)
+ {
+ *p_itself = NULL;
+ return 1;
+ }
+ *p_itself = &fss;
+ return PyMac_GetFSSpec(v, *p_itself);
+}
+
+/*
+** Parse an optional rect
+*/
+static int
+OptRectPtr_Convert(PyObject *v, Rect **p_itself)
+{
+ static Rect r;
+
+ if (v == Py_None)
+ {
+ *p_itself = NULL;
+ return 1;
+ }
+ *p_itself = &r;
+ return PyMac_GetRect(v, *p_itself);
+}
+
+/*
+** Parse an optional GWorld
+*/
+static int
+OptGWorldObj_Convert(PyObject *v, GWorldPtr *p_itself)
+{
+ if (v == Py_None)
+ {
+ *p_itself = NULL;
+ return 1;
+ }
+ return GWorldObj_Convert(v, p_itself);
+}
+
+"""
+
+initstuff = initstuff + """
+// PyMac_INIT_TOOLBOX_OBJECT_NEW(xxxx);
+"""
+TXNObject = OpaqueByValueType("TXNObject", "TXNObj")
+TXNFontMenuObject = OpaqueByValueType("TXNFontMenuObject", "TXNFontMenuObj")
+
+TXNFrameID = Type("TXNFrameID", "l")
+TXNVersionValue = Type("TXNVersionValue", "l")
+TXNFeatureBits = Type("TXNFeatureBits", "l")
+TXNInitOptions = Type("TXNInitOptions", "l")
+TXNFrameOptions = Type("TXNFrameOptions", "l")
+TXNContinuousFlags = Type("TXNContinuousFlags", "l")
+TXNMatchOptions = Type("TXNMatchOptions", "l")
+TXNFileType = OSTypeType("TXNFileType")
+TXNFrameType = Type("TXNFrameType", "l")
+TXNDataType = OSTypeType("TXNDataType")
+TXNControlTag = OSTypeType("TXNControlTag")
+TXNActionKey = Type("TXNActionKey", "l")
+TXNTabType = Type("TXNTabType", "b")
+TXNScrollBarState = Type("TXNScrollBarState", "l")
+TXNOffset = Type("TXNOffset", "l")
+TXNObjectRefcon = FakeType("(TXNObjectRefcon)0") # XXXX For now...
+TXNErrors = OSErrType("TXNErrors", "l")
+TXNTypeRunAttributes = OSTypeType("TXNTypeRunAttributes")
+TXNTypeRunAttributeSizes = Type("TXNTypeRunAttributeSizes", "l")
+TXNPermanentTextEncodingType = Type("TXNPermanentTextEncodingType", "l")
+TXTNTag = OSTypeType("TXTNTag")
+TXNBackgroundType = Type("TXNBackgroundType", "l")
+DragReference = OpaqueByValueType("DragReference", "DragObj")
+DragTrackingMessage = Type("DragTrackingMessage", "h")
+RgnHandle = OpaqueByValueType("RgnHandle", "ResObj")
+OptRgnHandle = OpaqueByValueType("RgnHandle", "OptResObj")
+GWorldPtr = OpaqueByValueType("GWorldPtr", "GWorldObj")
+OptGWorldPtr = OpaqueByValueType("GWorldPtr", "OptGWorldObj")
+MlteInBuffer = VarInputBufferType('void *', 'ByteCount', 'l')
+
+OptFSSpecPtr = OpaqueByValueType("FSSpec *", "OptFSSpecPtr")
+OptRectPtr = OpaqueByValueType("Rect *", "OptRectPtr")
+
+UniChar = Type("UniChar", "h") # XXXX For now...
+# ADD object type here
+
+execfile("mltetypetest.py")
+
+# Our (opaque) objects
+
+class TXNObjDefinition(PEP253Mixin, GlobalObjectDefinition):
+ def outputCheckNewArg(self):
+ Output("if (itself == NULL) return PyMac_Error(resNotFound);")
+
+class TXNFontMenuObjDefinition(PEP253Mixin, GlobalObjectDefinition):
+ def outputCheckNewArg(self):
+ Output("if (itself == NULL) return PyMac_Error(resNotFound);")
+
+
+# ADD object class here
+
+# From here on it's basically all boiler plate...
+
+# Create the generator groups and link them
+module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff)
+TXNObject_object = TXNObjDefinition("TXNObject", "TXNObj", "TXNObject")
+TXNFontMenuObject_object = TXNFontMenuObjDefinition("TXNFontMenuObject", "TXNFontMenuObj", "TXNFontMenuObject")
+
+# ADD object here
+
+module.addobject(TXNObject_object)
+module.addobject(TXNFontMenuObject_object)
+# ADD addobject call here
+
+# Create the generator classes used to populate the lists
+Function = OSErrWeakLinkFunctionGenerator
+Method = OSErrWeakLinkMethodGenerator
+
+# Create and populate the lists
+functions = []
+TXNObject_methods = []
+TXNFontMenuObject_methods = []
+
+# ADD _methods initializer here
+execfile(INPUTFILE)
+
+
+# add the populated lists to the generator groups
+# (in a different wordl the scan program would generate this)
+for f in functions: module.add(f)
+for f in TXNObject_methods: TXNObject_object.add(f)
+for f in TXNFontMenuObject_methods: TXNFontMenuObject_object.add(f)
+
+# ADD Manual generators here
+inittextension_body = """
+OSStatus _err;
+TXNMacOSPreferredFontDescription * iDefaultFonts = NULL;
+ItemCount iCountDefaultFonts = 0;
+TXNInitOptions iUsageFlags;
+PyMac_PRECHECK(TXNInitTextension);
+if (!PyArg_ParseTuple(_args, "l", &iUsageFlags))
+ return NULL;
+_err = TXNInitTextension(iDefaultFonts,
+ iCountDefaultFonts,
+ iUsageFlags);
+if (_err != noErr) return PyMac_Error(_err);
+Py_INCREF(Py_None);
+_res = Py_None;
+return _res;
+"""
+
+f = ManualGenerator("TXNInitTextension", inittextension_body);
+f.docstring = lambda: "(TXNInitOptions) -> None"
+module.add(f)
+
+# generate output (open the output file as late as possible)
+SetOutputFileName(OUTPUTFILE)
+module.generate()
diff --git a/Mac/Modules/osa/_OSAmodule.c b/Mac/Modules/osa/_OSAmodule.c
new file mode 100644
index 0000000000..10dd0ff05e
--- /dev/null
+++ b/Mac/Modules/osa/_OSAmodule.c
@@ -0,0 +1,899 @@
+
+/* ========================== Module _OSA =========================== */
+
+#include "Python.h"
+
+
+
+#include "pymactoolbox.h"
+
+/* Macro to test whether a weak-loaded CFM function exists */
+#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
+ PyErr_SetString(PyExc_NotImplementedError, \
+ "Not available in this shared library/OS version"); \
+ return NULL; \
+ }} while(0)
+
+
+#if PY_VERSION_HEX < 0x02040000
+PyObject *PyMac_GetOSErrException(void);
+#endif
+#include <Carbon/Carbon.h>
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_OSAObj_New(ComponentInstance);
+extern int _OSAObj_Convert(PyObject *, ComponentInstance *);
+
+#define OSAObj_New _OSAObj_New
+#define OSAObj_Convert _OSAObj_Convert
+#endif
+
+static PyObject *OSA_Error;
+
+/* ---------------- Object type OSAComponentInstance ---------------- */
+
+PyTypeObject OSAComponentInstance_Type;
+
+#define OSAObj_Check(x) ((x)->ob_type == &OSAComponentInstance_Type || PyObject_TypeCheck((x), &OSAComponentInstance_Type))
+
+typedef struct OSAComponentInstanceObject {
+ PyObject_HEAD
+ ComponentInstance ob_itself;
+} OSAComponentInstanceObject;
+
+PyObject *OSAObj_New(ComponentInstance itself)
+{
+ OSAComponentInstanceObject *it;
+ if (itself == NULL) {
+ PyErr_SetString(OSA_Error,"NULL ComponentInstance");
+ return NULL;
+ }
+ it = PyObject_NEW(OSAComponentInstanceObject, &OSAComponentInstance_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+
+int OSAObj_Convert(PyObject *v, ComponentInstance *p_itself)
+{
+
+ if (CmpInstObj_Convert(v, p_itself))
+ return 1;
+ PyErr_Clear();
+
+ if (!OSAObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "OSAComponentInstance required");
+ return 0;
+ }
+ *p_itself = ((OSAComponentInstanceObject *)v)->ob_itself;
+ return 1;
+}
+
+static void OSAObj_dealloc(OSAComponentInstanceObject *self)
+{
+ /* Cleanup of self->ob_itself goes here */
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *OSAObj_OSALoad(OSAComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSAError _err;
+ AEDesc scriptData;
+ long modeFlags;
+ OSAID resultingScriptID;
+#ifndef OSALoad
+ PyMac_PRECHECK(OSALoad);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ AEDesc_Convert, &scriptData,
+ &modeFlags))
+ return NULL;
+ _err = OSALoad(_self->ob_itself,
+ &scriptData,
+ modeFlags,
+ &resultingScriptID);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ resultingScriptID);
+ return _res;
+}
+
+static PyObject *OSAObj_OSAStore(OSAComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSAError _err;
+ OSAID scriptID;
+ DescType desiredType;
+ long modeFlags;
+ AEDesc resultingScriptData;
+#ifndef OSAStore
+ PyMac_PRECHECK(OSAStore);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&l",
+ &scriptID,
+ PyMac_GetOSType, &desiredType,
+ &modeFlags))
+ return NULL;
+ _err = OSAStore(_self->ob_itself,
+ scriptID,
+ desiredType,
+ modeFlags,
+ &resultingScriptData);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &resultingScriptData);
+ return _res;
+}
+
+static PyObject *OSAObj_OSAExecute(OSAComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSAError _err;
+ OSAID compiledScriptID;
+ OSAID contextID;
+ long modeFlags;
+ OSAID resultingScriptValueID;
+#ifndef OSAExecute
+ PyMac_PRECHECK(OSAExecute);
+#endif
+ if (!PyArg_ParseTuple(_args, "lll",
+ &compiledScriptID,
+ &contextID,
+ &modeFlags))
+ return NULL;
+ _err = OSAExecute(_self->ob_itself,
+ compiledScriptID,
+ contextID,
+ modeFlags,
+ &resultingScriptValueID);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ resultingScriptValueID);
+ return _res;
+}
+
+static PyObject *OSAObj_OSADisplay(OSAComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSAError _err;
+ OSAID scriptValueID;
+ DescType desiredType;
+ long modeFlags;
+ AEDesc resultingText;
+#ifndef OSADisplay
+ PyMac_PRECHECK(OSADisplay);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&l",
+ &scriptValueID,
+ PyMac_GetOSType, &desiredType,
+ &modeFlags))
+ return NULL;
+ _err = OSADisplay(_self->ob_itself,
+ scriptValueID,
+ desiredType,
+ modeFlags,
+ &resultingText);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &resultingText);
+ return _res;
+}
+
+static PyObject *OSAObj_OSAScriptError(OSAComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSAError _err;
+ OSType selector;
+ DescType desiredType;
+ AEDesc resultingErrorDescription;
+#ifndef OSAScriptError
+ PyMac_PRECHECK(OSAScriptError);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &selector,
+ PyMac_GetOSType, &desiredType))
+ return NULL;
+ _err = OSAScriptError(_self->ob_itself,
+ selector,
+ desiredType,
+ &resultingErrorDescription);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &resultingErrorDescription);
+ return _res;
+}
+
+static PyObject *OSAObj_OSADispose(OSAComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSAError _err;
+ OSAID scriptID;
+#ifndef OSADispose
+ PyMac_PRECHECK(OSADispose);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &scriptID))
+ return NULL;
+ _err = OSADispose(_self->ob_itself,
+ scriptID);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *OSAObj_OSASetScriptInfo(OSAComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSAError _err;
+ OSAID scriptID;
+ OSType selector;
+ long value;
+#ifndef OSASetScriptInfo
+ PyMac_PRECHECK(OSASetScriptInfo);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&l",
+ &scriptID,
+ PyMac_GetOSType, &selector,
+ &value))
+ return NULL;
+ _err = OSASetScriptInfo(_self->ob_itself,
+ scriptID,
+ selector,
+ value);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *OSAObj_OSAGetScriptInfo(OSAComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSAError _err;
+ OSAID scriptID;
+ OSType selector;
+ long result;
+#ifndef OSAGetScriptInfo
+ PyMac_PRECHECK(OSAGetScriptInfo);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&",
+ &scriptID,
+ PyMac_GetOSType, &selector))
+ return NULL;
+ _err = OSAGetScriptInfo(_self->ob_itself,
+ scriptID,
+ selector,
+ &result);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ result);
+ return _res;
+}
+
+static PyObject *OSAObj_OSAScriptingComponentName(OSAComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSAError _err;
+ AEDesc resultingScriptingComponentName;
+#ifndef OSAScriptingComponentName
+ PyMac_PRECHECK(OSAScriptingComponentName);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = OSAScriptingComponentName(_self->ob_itself,
+ &resultingScriptingComponentName);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &resultingScriptingComponentName);
+ return _res;
+}
+
+static PyObject *OSAObj_OSACompile(OSAComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSAError _err;
+ AEDesc sourceData;
+ long modeFlags;
+ OSAID previousAndResultingScriptID;
+#ifndef OSACompile
+ PyMac_PRECHECK(OSACompile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ AEDesc_Convert, &sourceData,
+ &modeFlags))
+ return NULL;
+ _err = OSACompile(_self->ob_itself,
+ &sourceData,
+ modeFlags,
+ &previousAndResultingScriptID);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ previousAndResultingScriptID);
+ return _res;
+}
+
+static PyObject *OSAObj_OSACopyID(OSAComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSAError _err;
+ OSAID fromID;
+ OSAID toID;
+#ifndef OSACopyID
+ PyMac_PRECHECK(OSACopyID);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &fromID))
+ return NULL;
+ _err = OSACopyID(_self->ob_itself,
+ fromID,
+ &toID);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ toID);
+ return _res;
+}
+
+static PyObject *OSAObj_OSAGetSource(OSAComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSAError _err;
+ OSAID scriptID;
+ DescType desiredType;
+ AEDesc resultingSourceData;
+#ifndef OSAGetSource
+ PyMac_PRECHECK(OSAGetSource);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&",
+ &scriptID,
+ PyMac_GetOSType, &desiredType))
+ return NULL;
+ _err = OSAGetSource(_self->ob_itself,
+ scriptID,
+ desiredType,
+ &resultingSourceData);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &resultingSourceData);
+ return _res;
+}
+
+static PyObject *OSAObj_OSACoerceFromDesc(OSAComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSAError _err;
+ AEDesc scriptData;
+ long modeFlags;
+ OSAID resultingScriptID;
+#ifndef OSACoerceFromDesc
+ PyMac_PRECHECK(OSACoerceFromDesc);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ AEDesc_Convert, &scriptData,
+ &modeFlags))
+ return NULL;
+ _err = OSACoerceFromDesc(_self->ob_itself,
+ &scriptData,
+ modeFlags,
+ &resultingScriptID);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ resultingScriptID);
+ return _res;
+}
+
+static PyObject *OSAObj_OSACoerceToDesc(OSAComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSAError _err;
+ OSAID scriptID;
+ DescType desiredType;
+ long modeFlags;
+ AEDesc result;
+#ifndef OSACoerceToDesc
+ PyMac_PRECHECK(OSACoerceToDesc);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&l",
+ &scriptID,
+ PyMac_GetOSType, &desiredType,
+ &modeFlags))
+ return NULL;
+ _err = OSACoerceToDesc(_self->ob_itself,
+ scriptID,
+ desiredType,
+ modeFlags,
+ &result);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &result);
+ return _res;
+}
+
+static PyObject *OSAObj_OSASetDefaultTarget(OSAComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSAError _err;
+ AEAddressDesc target;
+#ifndef OSASetDefaultTarget
+ PyMac_PRECHECK(OSASetDefaultTarget);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ AEDesc_Convert, &target))
+ return NULL;
+ _err = OSASetDefaultTarget(_self->ob_itself,
+ &target);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *OSAObj_OSAStartRecording(OSAComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSAError _err;
+ OSAID compiledScriptToModifyID;
+#ifndef OSAStartRecording
+ PyMac_PRECHECK(OSAStartRecording);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = OSAStartRecording(_self->ob_itself,
+ &compiledScriptToModifyID);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ compiledScriptToModifyID);
+ return _res;
+}
+
+static PyObject *OSAObj_OSAStopRecording(OSAComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSAError _err;
+ OSAID compiledScriptID;
+#ifndef OSAStopRecording
+ PyMac_PRECHECK(OSAStopRecording);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &compiledScriptID))
+ return NULL;
+ _err = OSAStopRecording(_self->ob_itself,
+ compiledScriptID);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *OSAObj_OSALoadExecute(OSAComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSAError _err;
+ AEDesc scriptData;
+ OSAID contextID;
+ long modeFlags;
+ OSAID resultingScriptValueID;
+#ifndef OSALoadExecute
+ PyMac_PRECHECK(OSALoadExecute);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ AEDesc_Convert, &scriptData,
+ &contextID,
+ &modeFlags))
+ return NULL;
+ _err = OSALoadExecute(_self->ob_itself,
+ &scriptData,
+ contextID,
+ modeFlags,
+ &resultingScriptValueID);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ resultingScriptValueID);
+ return _res;
+}
+
+static PyObject *OSAObj_OSACompileExecute(OSAComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSAError _err;
+ AEDesc sourceData;
+ OSAID contextID;
+ long modeFlags;
+ OSAID resultingScriptValueID;
+#ifndef OSACompileExecute
+ PyMac_PRECHECK(OSACompileExecute);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ AEDesc_Convert, &sourceData,
+ &contextID,
+ &modeFlags))
+ return NULL;
+ _err = OSACompileExecute(_self->ob_itself,
+ &sourceData,
+ contextID,
+ modeFlags,
+ &resultingScriptValueID);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ resultingScriptValueID);
+ return _res;
+}
+
+static PyObject *OSAObj_OSADoScript(OSAComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSAError _err;
+ AEDesc sourceData;
+ OSAID contextID;
+ DescType desiredType;
+ long modeFlags;
+ AEDesc resultingText;
+#ifndef OSADoScript
+ PyMac_PRECHECK(OSADoScript);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lO&l",
+ AEDesc_Convert, &sourceData,
+ &contextID,
+ PyMac_GetOSType, &desiredType,
+ &modeFlags))
+ return NULL;
+ _err = OSADoScript(_self->ob_itself,
+ &sourceData,
+ contextID,
+ desiredType,
+ modeFlags,
+ &resultingText);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &resultingText);
+ return _res;
+}
+
+static PyObject *OSAObj_OSASetCurrentDialect(OSAComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSAError _err;
+ short dialectCode;
+#ifndef OSASetCurrentDialect
+ PyMac_PRECHECK(OSASetCurrentDialect);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &dialectCode))
+ return NULL;
+ _err = OSASetCurrentDialect(_self->ob_itself,
+ dialectCode);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *OSAObj_OSAGetCurrentDialect(OSAComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSAError _err;
+ short resultingDialectCode;
+#ifndef OSAGetCurrentDialect
+ PyMac_PRECHECK(OSAGetCurrentDialect);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = OSAGetCurrentDialect(_self->ob_itself,
+ &resultingDialectCode);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ resultingDialectCode);
+ return _res;
+}
+
+static PyObject *OSAObj_OSAAvailableDialects(OSAComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSAError _err;
+ AEDesc resultingDialectInfoList;
+#ifndef OSAAvailableDialects
+ PyMac_PRECHECK(OSAAvailableDialects);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = OSAAvailableDialects(_self->ob_itself,
+ &resultingDialectInfoList);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &resultingDialectInfoList);
+ return _res;
+}
+
+static PyObject *OSAObj_OSAGetDialectInfo(OSAComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSAError _err;
+ short dialectCode;
+ OSType selector;
+ AEDesc resultingDialectInfo;
+#ifndef OSAGetDialectInfo
+ PyMac_PRECHECK(OSAGetDialectInfo);
+#endif
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &dialectCode,
+ PyMac_GetOSType, &selector))
+ return NULL;
+ _err = OSAGetDialectInfo(_self->ob_itself,
+ dialectCode,
+ selector,
+ &resultingDialectInfo);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &resultingDialectInfo);
+ return _res;
+}
+
+static PyObject *OSAObj_OSAAvailableDialectCodeList(OSAComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSAError _err;
+ AEDesc resultingDialectCodeList;
+#ifndef OSAAvailableDialectCodeList
+ PyMac_PRECHECK(OSAAvailableDialectCodeList);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = OSAAvailableDialectCodeList(_self->ob_itself,
+ &resultingDialectCodeList);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &resultingDialectCodeList);
+ return _res;
+}
+
+static PyObject *OSAObj_OSAExecuteEvent(OSAComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSAError _err;
+ AppleEvent theAppleEvent;
+ OSAID contextID;
+ long modeFlags;
+ OSAID resultingScriptValueID;
+#ifndef OSAExecuteEvent
+ PyMac_PRECHECK(OSAExecuteEvent);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ AEDesc_Convert, &theAppleEvent,
+ &contextID,
+ &modeFlags))
+ return NULL;
+ _err = OSAExecuteEvent(_self->ob_itself,
+ &theAppleEvent,
+ contextID,
+ modeFlags,
+ &resultingScriptValueID);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ resultingScriptValueID);
+ return _res;
+}
+
+static PyObject *OSAObj_OSADoEvent(OSAComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSAError _err;
+ AppleEvent theAppleEvent;
+ OSAID contextID;
+ long modeFlags;
+ AppleEvent reply;
+#ifndef OSADoEvent
+ PyMac_PRECHECK(OSADoEvent);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ AEDesc_Convert, &theAppleEvent,
+ &contextID,
+ &modeFlags))
+ return NULL;
+ _err = OSADoEvent(_self->ob_itself,
+ &theAppleEvent,
+ contextID,
+ modeFlags,
+ &reply);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &reply);
+ return _res;
+}
+
+static PyObject *OSAObj_OSAMakeContext(OSAComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSAError _err;
+ AEDesc contextName;
+ OSAID parentContext;
+ OSAID resultingContextID;
+#ifndef OSAMakeContext
+ PyMac_PRECHECK(OSAMakeContext);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ AEDesc_Convert, &contextName,
+ &parentContext))
+ return NULL;
+ _err = OSAMakeContext(_self->ob_itself,
+ &contextName,
+ parentContext,
+ &resultingContextID);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ resultingContextID);
+ return _res;
+}
+
+static PyMethodDef OSAObj_methods[] = {
+ {"OSALoad", (PyCFunction)OSAObj_OSALoad, 1,
+ PyDoc_STR("(AEDesc scriptData, long modeFlags) -> (OSAID resultingScriptID)")},
+ {"OSAStore", (PyCFunction)OSAObj_OSAStore, 1,
+ PyDoc_STR("(OSAID scriptID, DescType desiredType, long modeFlags) -> (AEDesc resultingScriptData)")},
+ {"OSAExecute", (PyCFunction)OSAObj_OSAExecute, 1,
+ PyDoc_STR("(OSAID compiledScriptID, OSAID contextID, long modeFlags) -> (OSAID resultingScriptValueID)")},
+ {"OSADisplay", (PyCFunction)OSAObj_OSADisplay, 1,
+ PyDoc_STR("(OSAID scriptValueID, DescType desiredType, long modeFlags) -> (AEDesc resultingText)")},
+ {"OSAScriptError", (PyCFunction)OSAObj_OSAScriptError, 1,
+ PyDoc_STR("(OSType selector, DescType desiredType) -> (AEDesc resultingErrorDescription)")},
+ {"OSADispose", (PyCFunction)OSAObj_OSADispose, 1,
+ PyDoc_STR("(OSAID scriptID) -> None")},
+ {"OSASetScriptInfo", (PyCFunction)OSAObj_OSASetScriptInfo, 1,
+ PyDoc_STR("(OSAID scriptID, OSType selector, long value) -> None")},
+ {"OSAGetScriptInfo", (PyCFunction)OSAObj_OSAGetScriptInfo, 1,
+ PyDoc_STR("(OSAID scriptID, OSType selector) -> (long result)")},
+ {"OSAScriptingComponentName", (PyCFunction)OSAObj_OSAScriptingComponentName, 1,
+ PyDoc_STR("() -> (AEDesc resultingScriptingComponentName)")},
+ {"OSACompile", (PyCFunction)OSAObj_OSACompile, 1,
+ PyDoc_STR("(AEDesc sourceData, long modeFlags) -> (OSAID previousAndResultingScriptID)")},
+ {"OSACopyID", (PyCFunction)OSAObj_OSACopyID, 1,
+ PyDoc_STR("(OSAID fromID) -> (OSAID toID)")},
+ {"OSAGetSource", (PyCFunction)OSAObj_OSAGetSource, 1,
+ PyDoc_STR("(OSAID scriptID, DescType desiredType) -> (AEDesc resultingSourceData)")},
+ {"OSACoerceFromDesc", (PyCFunction)OSAObj_OSACoerceFromDesc, 1,
+ PyDoc_STR("(AEDesc scriptData, long modeFlags) -> (OSAID resultingScriptID)")},
+ {"OSACoerceToDesc", (PyCFunction)OSAObj_OSACoerceToDesc, 1,
+ PyDoc_STR("(OSAID scriptID, DescType desiredType, long modeFlags) -> (AEDesc result)")},
+ {"OSASetDefaultTarget", (PyCFunction)OSAObj_OSASetDefaultTarget, 1,
+ PyDoc_STR("(AEAddressDesc target) -> None")},
+ {"OSAStartRecording", (PyCFunction)OSAObj_OSAStartRecording, 1,
+ PyDoc_STR("() -> (OSAID compiledScriptToModifyID)")},
+ {"OSAStopRecording", (PyCFunction)OSAObj_OSAStopRecording, 1,
+ PyDoc_STR("(OSAID compiledScriptID) -> None")},
+ {"OSALoadExecute", (PyCFunction)OSAObj_OSALoadExecute, 1,
+ PyDoc_STR("(AEDesc scriptData, OSAID contextID, long modeFlags) -> (OSAID resultingScriptValueID)")},
+ {"OSACompileExecute", (PyCFunction)OSAObj_OSACompileExecute, 1,
+ PyDoc_STR("(AEDesc sourceData, OSAID contextID, long modeFlags) -> (OSAID resultingScriptValueID)")},
+ {"OSADoScript", (PyCFunction)OSAObj_OSADoScript, 1,
+ PyDoc_STR("(AEDesc sourceData, OSAID contextID, DescType desiredType, long modeFlags) -> (AEDesc resultingText)")},
+ {"OSASetCurrentDialect", (PyCFunction)OSAObj_OSASetCurrentDialect, 1,
+ PyDoc_STR("(short dialectCode) -> None")},
+ {"OSAGetCurrentDialect", (PyCFunction)OSAObj_OSAGetCurrentDialect, 1,
+ PyDoc_STR("() -> (short resultingDialectCode)")},
+ {"OSAAvailableDialects", (PyCFunction)OSAObj_OSAAvailableDialects, 1,
+ PyDoc_STR("() -> (AEDesc resultingDialectInfoList)")},
+ {"OSAGetDialectInfo", (PyCFunction)OSAObj_OSAGetDialectInfo, 1,
+ PyDoc_STR("(short dialectCode, OSType selector) -> (AEDesc resultingDialectInfo)")},
+ {"OSAAvailableDialectCodeList", (PyCFunction)OSAObj_OSAAvailableDialectCodeList, 1,
+ PyDoc_STR("() -> (AEDesc resultingDialectCodeList)")},
+ {"OSAExecuteEvent", (PyCFunction)OSAObj_OSAExecuteEvent, 1,
+ PyDoc_STR("(AppleEvent theAppleEvent, OSAID contextID, long modeFlags) -> (OSAID resultingScriptValueID)")},
+ {"OSADoEvent", (PyCFunction)OSAObj_OSADoEvent, 1,
+ PyDoc_STR("(AppleEvent theAppleEvent, OSAID contextID, long modeFlags) -> (AppleEvent reply)")},
+ {"OSAMakeContext", (PyCFunction)OSAObj_OSAMakeContext, 1,
+ PyDoc_STR("(AEDesc contextName, OSAID parentContext) -> (OSAID resultingContextID)")},
+ {NULL, NULL, 0}
+};
+
+#define OSAObj_getsetlist NULL
+
+
+#define OSAObj_compare NULL
+
+#define OSAObj_repr NULL
+
+#define OSAObj_hash NULL
+#define OSAObj_tp_init 0
+
+#define OSAObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *OSAObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *_self;
+ ComponentInstance itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, OSAObj_Convert, &itself)) return NULL;
+ if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((OSAComponentInstanceObject *)_self)->ob_itself = itself;
+ return _self;
+}
+
+#define OSAObj_tp_free PyObject_Del
+
+
+PyTypeObject OSAComponentInstance_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_OSA.OSAComponentInstance", /*tp_name*/
+ sizeof(OSAComponentInstanceObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) OSAObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) OSAObj_compare, /*tp_compare*/
+ (reprfunc) OSAObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) OSAObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ OSAObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ OSAObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ OSAObj_tp_init, /* tp_init */
+ OSAObj_tp_alloc, /* tp_alloc */
+ OSAObj_tp_new, /* tp_new */
+ OSAObj_tp_free, /* tp_free */
+};
+
+/* -------------- End object type OSAComponentInstance -------------- */
+
+
+static PyMethodDef OSA_methods[] = {
+ {NULL, NULL, 0}
+};
+
+
+
+
+void init_OSA(void)
+{
+ PyObject *m;
+ PyObject *d;
+
+
+
+ /*
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(ComponentInstance, OSAObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ComponentInstance, OSAObj_Convert);
+ */
+
+
+ m = Py_InitModule("_OSA", OSA_methods);
+ d = PyModule_GetDict(m);
+ OSA_Error = PyMac_GetOSErrException();
+ if (OSA_Error == NULL ||
+ PyDict_SetItemString(d, "Error", OSA_Error) != 0)
+ return;
+ OSAComponentInstance_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&OSAComponentInstance_Type) < 0) return;
+ Py_INCREF(&OSAComponentInstance_Type);
+ PyModule_AddObject(m, "OSAComponentInstance", (PyObject *)&OSAComponentInstance_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&OSAComponentInstance_Type);
+ PyModule_AddObject(m, "OSAComponentInstanceType", (PyObject *)&OSAComponentInstance_Type);
+}
+
+/* ======================== End module _OSA ========================= */
+
diff --git a/Mac/Modules/osa/osascan.py b/Mac/Modules/osa/osascan.py
new file mode 100644
index 0000000000..5fc2e9f6f0
--- /dev/null
+++ b/Mac/Modules/osa/osascan.py
@@ -0,0 +1,61 @@
+# Scan an Apple header file, generating a Python file of generator calls.
+
+import sys
+from bgenlocations import TOOLBOXDIR, BGENDIR
+sys.path.append(BGENDIR)
+from scantools import Scanner
+
+LONG = "OSAconst"
+SHORT = "osa"
+
+def main():
+ input = "OSA.h"
+ output = SHORT + "gen.py"
+ defsoutput = TOOLBOXDIR + LONG + ".py"
+ scanner = MyScanner(input, output, defsoutput)
+ scanner.scan()
+ scanner.close()
+ scanner.gentypetest(SHORT+"typetest.py")
+ print "=== Testing definitions output code ==="
+ execfile(defsoutput, {}, {})
+ print "=== Done scanning and generating, now importing the generated code... ==="
+ exec "import " + SHORT + "support"
+ print "=== Done. It's up to you to compile it now! ==="
+
+class MyScanner(Scanner):
+
+ def destination(self, type, name, arglist):
+ classname = "Function"
+ listname = "functions"
+ if arglist:
+ t, n, m = arglist[0]
+ if t == "ComponentInstance" and m == "InMode":
+ classname = "Method"
+ listname = "methods"
+ return classname, listname
+
+ def writeinitialdefs(self):
+ self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
+ self.defsfile.write("from Carbon.AppleEvents import *\n")
+ self.defsfile.write("kAEUseStandardDispatch = -1\n")
+
+ def makeblacklistnames(self):
+ return [
+ "OSACopyScript",
+ ]
+
+ def makeblacklisttypes(self):
+ return [
+ "OSALocalOrGlobal",
+ "OSACreateAppleEventUPP",
+ "OSAActiveUPP",
+ "AEEventHandlerUPP",
+ "OSASendUPP",
+ ]
+
+ def makerepairinstructions(self):
+ return [
+ ]
+
+if __name__ == "__main__":
+ main()
diff --git a/Mac/Modules/osa/osasupport.py b/Mac/Modules/osa/osasupport.py
new file mode 100644
index 0000000000..8369932db0
--- /dev/null
+++ b/Mac/Modules/osa/osasupport.py
@@ -0,0 +1,105 @@
+# This script generates a Python interface for an Apple Macintosh Manager.
+# It uses the "bgen" package to generate C code.
+# The function specifications are generated by scanning the mamager's header file,
+# using the "scantools" package (customized for this particular manager).
+
+import string
+
+# Declarations that change for each manager
+MACHEADERFILE = 'OSA.h' # The Apple header file
+MODNAME = '_OSA' # The name of the module
+
+# The following is *usually* unchanged but may still require tuning
+MODPREFIX = 'OSA' # The prefix for module-wide routines
+OBJECTPREFIX = 'OSAObj' # The prefix for object methods
+INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner
+OUTPUTFILE = MODNAME + "module.c" # The file generated by this program
+
+from macsupport import *
+
+# Create the type objects
+
+includestuff = includestuff + """
+#if PY_VERSION_HEX < 0x02040000
+PyObject *PyMac_GetOSErrException(void);
+#endif
+#include <Carbon/Carbon.h>
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_OSAObj_New(ComponentInstance);
+extern int _OSAObj_Convert(PyObject *, ComponentInstance *);
+
+#define OSAObj_New _OSAObj_New
+#define OSAObj_Convert _OSAObj_Convert
+#endif
+"""
+
+initstuff = initstuff + """
+/*
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(ComponentInstance, OSAObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ComponentInstance, OSAObj_Convert);
+*/
+"""
+
+ComponentInstance = OpaqueByValueType('ComponentInstance', OBJECTPREFIX)
+OSAError = OSErrType("OSAError", "l")
+# OSALocalOrGlobal = Type("OSALocalOrGlobal", "l")
+OSAID = Type("OSAID", "l")
+OSADebugCallFrameRef = Type("OSADebugCallFrameRef", "l")
+OSADebugSessionRef = Type("OSADebugSessionRef", "l")
+OSADebugStepKind = Type("OSADebugStepKind", "l")
+DescType = OSTypeType("DescType")
+AEDesc = OpaqueType('AEDesc')
+AEDesc_ptr = OpaqueType('AEDesc')
+AEAddressDesc = OpaqueType('AEAddressDesc', 'AEDesc')
+AEAddressDesc_ptr = OpaqueType('AEAddressDesc', 'AEDesc')
+AEDescList = OpaqueType('AEDescList', 'AEDesc')
+AEDescList_ptr = OpaqueType('AEDescList', 'AEDesc')
+AERecord = OpaqueType('AERecord', 'AEDesc')
+AERecord_ptr = OpaqueType('AERecord', 'AEDesc')
+AppleEvent = OpaqueType('AppleEvent', 'AEDesc')
+AppleEvent_ptr = OpaqueType('AppleEvent', 'AEDesc')
+
+# NOTE: at the moment OSA.ComponentInstance is not a subclass
+# of Cm.ComponentInstance. If this is a problem it can be fixed.
+class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
+ def outputCheckNewArg(self):
+ Output("""if (itself == NULL) {
+ PyErr_SetString(OSA_Error,"NULL ComponentInstance");
+ return NULL;
+ }""")
+
+ def outputCheckConvertArg(self):
+ Output("""
+ if (CmpInstObj_Convert(v, p_itself))
+ return 1;
+ PyErr_Clear();
+ """)
+
+
+# Create the generator groups and link them
+module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff)
+object = MyObjectDefinition('OSAComponentInstance', OBJECTPREFIX,
+ 'ComponentInstance')
+module.addobject(object)
+
+# Create the generator classes used to populate the lists
+Function = OSErrWeakLinkFunctionGenerator
+Method = OSErrWeakLinkMethodGenerator
+
+# Test which types we are still missing.
+execfile(string.lower(MODPREFIX) + 'typetest.py')
+
+# Create and populate the lists
+functions = []
+methods = []
+execfile(INPUTFILE)
+
+# add the populated lists to the generator groups
+# (in a different wordl the scan program would generate this)
+for f in functions: module.add(f)
+for f in methods: object.add(f)
+
+# generate output (open the output file as late as possible)
+SetOutputFileName(OUTPUTFILE)
+module.generate()
diff --git a/Mac/Modules/osa/setup.py b/Mac/Modules/osa/setup.py
new file mode 100644
index 0000000000..635114ef24
--- /dev/null
+++ b/Mac/Modules/osa/setup.py
@@ -0,0 +1,13 @@
+# This is a temporary setup script to allow distribution of
+# MacPython 2.4 modules for MacPython 2.3.
+
+from distutils.core import Extension, setup
+
+setup(name="OSA", version="0.1",
+ ext_modules=[
+ Extension('_OSA', ['_OSAmodule.c'],
+ extra_link_args=['-framework', 'Carbon'])
+ ],
+ py_modules=['OSA.OSA', 'OSA.OSAconst'],
+ package_dir={'OSA':'../../../Lib/plat-mac/Carbon'}
+ )
diff --git a/Mac/Modules/qd/_Qdmodule.c b/Mac/Modules/qd/_Qdmodule.c
new file mode 100644
index 0000000000..c7594b9a73
--- /dev/null
+++ b/Mac/Modules/qd/_Qdmodule.c
@@ -0,0 +1,7154 @@
+
+/* =========================== Module _Qd =========================== */
+
+#include "Python.h"
+
+
+#ifndef __LP64__
+
+#include "pymactoolbox.h"
+
+/* Macro to test whether a weak-loaded CFM function exists */
+#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
+ PyErr_SetString(PyExc_NotImplementedError, \
+ "Not available in this shared library/OS version"); \
+ return NULL; \
+ }} while(0)
+
+
+#include <Carbon/Carbon.h>
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+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(RGBColorPtr);
+extern int _QdRGB_Convert(PyObject *, RGBColorPtr);
+
+#define GrafObj_New _GrafObj_New
+#define GrafObj_Convert _GrafObj_Convert
+#define BMObj_New _BMObj_New
+#define BMObj_Convert _BMObj_Convert
+#define QdRGB_New _QdRGB_New
+#define QdRGB_Convert _QdRGB_Convert
+#endif
+
+static PyObject *BMObj_NewCopied(BitMapPtr);
+
+/*
+** Parse/generate RGB records
+*/
+PyObject *QdRGB_New(RGBColorPtr itself)
+{
+
+ return Py_BuildValue("lll", (long)itself->red, (long)itself->green, (long)itself->blue);
+}
+
+int QdRGB_Convert(PyObject *v, RGBColorPtr p_itself)
+{
+ long red, green, blue;
+
+ if( !PyArg_ParseTuple(v, "lll", &red, &green, &blue) )
+ return 0;
+ p_itself->red = (unsigned short)red;
+ p_itself->green = (unsigned short)green;
+ p_itself->blue = (unsigned short)blue;
+ return 1;
+}
+
+/*
+** Generate FontInfo records
+*/
+static
+PyObject *QdFI_New(FontInfo *itself)
+{
+
+ return Py_BuildValue("hhhh", itself->ascent, itself->descent,
+ itself->widMax, itself->leading);
+}
+
+static PyObject *Qd_Error;
+
+/* ---------------------- Object type GrafPort ---------------------- */
+
+PyTypeObject GrafPort_Type;
+
+#define GrafObj_Check(x) ((x)->ob_type == &GrafPort_Type || PyObject_TypeCheck((x), &GrafPort_Type))
+
+typedef struct GrafPortObject {
+ PyObject_HEAD
+ GrafPtr ob_itself;
+} GrafPortObject;
+
+PyObject *GrafObj_New(GrafPtr itself)
+{
+ GrafPortObject *it;
+ if (itself == NULL) return PyMac_Error(resNotFound);
+ it = PyObject_NEW(GrafPortObject, &GrafPort_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+
+int GrafObj_Convert(PyObject *v, GrafPtr *p_itself)
+{
+#if 1
+ {
+ WindowRef win;
+ if (WinObj_Convert(v, &win) && v) {
+ *p_itself = (GrafPtr)GetWindowPort(win);
+ return 1;
+ }
+ PyErr_Clear();
+ }
+#else
+ if (DlgObj_Check(v)) {
+ DialogRef dlg = (DialogRef)((GrafPortObject *)v)->ob_itself;
+ *p_itself = (GrafPtr)GetWindowPort(GetDialogWindow(dlg));
+ return 1;
+ }
+ if (WinObj_Check(v)) {
+ WindowRef win = (WindowRef)((GrafPortObject *)v)->ob_itself;
+ *p_itself = (GrafPtr)GetWindowPort(win);
+ return 1;
+ }
+#endif
+ if (!GrafObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "GrafPort required");
+ return 0;
+ }
+ *p_itself = ((GrafPortObject *)v)->ob_itself;
+ return 1;
+}
+
+static void GrafObj_dealloc(GrafPortObject *self)
+{
+ /* Cleanup of self->ob_itself goes here */
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *GrafObj_MacSetPort(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef MacSetPort
+ PyMac_PRECHECK(MacSetPort);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ MacSetPort(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *GrafObj_QDSwapPort(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ CGrafPtr outOldPort;
+#ifndef QDSwapPort
+ PyMac_PRECHECK(QDSwapPort);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = QDSwapPort(_self->ob_itself,
+ &outOldPort);
+ _res = Py_BuildValue("bO&",
+ _rv,
+ GrafObj_New, outOldPort);
+ return _res;
+}
+
+static PyObject *GrafObj_IsValidPort(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef IsValidPort
+ PyMac_PRECHECK(IsValidPort);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsValidPort(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortPixMap(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixMapHandle _rv;
+#ifndef GetPortPixMap
+ PyMac_PRECHECK(GetPortPixMap);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetPortPixMap(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortBitMapForCopyBits(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ const BitMap * _rv;
+#ifndef GetPortBitMapForCopyBits
+ PyMac_PRECHECK(GetPortBitMapForCopyBits);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetPortBitMapForCopyBits(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ BMObj_New, _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortBounds(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect rect;
+#ifndef GetPortBounds
+ PyMac_PRECHECK(GetPortBounds);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetPortBounds(_self->ob_itself,
+ &rect);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &rect);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortForeColor(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RGBColor foreColor;
+#ifndef GetPortForeColor
+ PyMac_PRECHECK(GetPortForeColor);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetPortForeColor(_self->ob_itself,
+ &foreColor);
+ _res = Py_BuildValue("O&",
+ QdRGB_New, &foreColor);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortBackColor(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RGBColor backColor;
+#ifndef GetPortBackColor
+ PyMac_PRECHECK(GetPortBackColor);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetPortBackColor(_self->ob_itself,
+ &backColor);
+ _res = Py_BuildValue("O&",
+ QdRGB_New, &backColor);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortOpColor(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RGBColor opColor;
+#ifndef GetPortOpColor
+ PyMac_PRECHECK(GetPortOpColor);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetPortOpColor(_self->ob_itself,
+ &opColor);
+ _res = Py_BuildValue("O&",
+ QdRGB_New, &opColor);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortHiliteColor(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RGBColor hiliteColor;
+#ifndef GetPortHiliteColor
+ PyMac_PRECHECK(GetPortHiliteColor);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetPortHiliteColor(_self->ob_itself,
+ &hiliteColor);
+ _res = Py_BuildValue("O&",
+ QdRGB_New, &hiliteColor);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortTextFont(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+#ifndef GetPortTextFont
+ PyMac_PRECHECK(GetPortTextFont);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetPortTextFont(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortTextFace(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Style _rv;
+#ifndef GetPortTextFace
+ PyMac_PRECHECK(GetPortTextFace);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetPortTextFace(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortTextMode(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+#ifndef GetPortTextMode
+ PyMac_PRECHECK(GetPortTextMode);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetPortTextMode(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortTextSize(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+#ifndef GetPortTextSize
+ PyMac_PRECHECK(GetPortTextSize);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetPortTextSize(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortChExtra(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+#ifndef GetPortChExtra
+ PyMac_PRECHECK(GetPortChExtra);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetPortChExtra(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortFracHPenLocation(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+#ifndef GetPortFracHPenLocation
+ PyMac_PRECHECK(GetPortFracHPenLocation);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetPortFracHPenLocation(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortSpExtra(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Fixed _rv;
+#ifndef GetPortSpExtra
+ PyMac_PRECHECK(GetPortSpExtra);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetPortSpExtra(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildFixed, _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortPenVisibility(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+#ifndef GetPortPenVisibility
+ PyMac_PRECHECK(GetPortPenVisibility);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetPortPenVisibility(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortVisibleRegion(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle _rv;
+ RgnHandle visRgn;
+#ifndef GetPortVisibleRegion
+ PyMac_PRECHECK(GetPortVisibleRegion);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &visRgn))
+ return NULL;
+ _rv = GetPortVisibleRegion(_self->ob_itself,
+ visRgn);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortClipRegion(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle _rv;
+ RgnHandle clipRgn;
+#ifndef GetPortClipRegion
+ PyMac_PRECHECK(GetPortClipRegion);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &clipRgn))
+ return NULL;
+ _rv = GetPortClipRegion(_self->ob_itself,
+ clipRgn);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortBackPixPat(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixPatHandle _rv;
+ PixPatHandle backPattern;
+#ifndef GetPortBackPixPat
+ PyMac_PRECHECK(GetPortBackPixPat);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &backPattern))
+ return NULL;
+ _rv = GetPortBackPixPat(_self->ob_itself,
+ backPattern);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortPenPixPat(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixPatHandle _rv;
+ PixPatHandle penPattern;
+#ifndef GetPortPenPixPat
+ PyMac_PRECHECK(GetPortPenPixPat);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &penPattern))
+ return NULL;
+ _rv = GetPortPenPixPat(_self->ob_itself,
+ penPattern);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortFillPixPat(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixPatHandle _rv;
+ PixPatHandle fillPattern;
+#ifndef GetPortFillPixPat
+ PyMac_PRECHECK(GetPortFillPixPat);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &fillPattern))
+ return NULL;
+ _rv = GetPortFillPixPat(_self->ob_itself,
+ fillPattern);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortPenSize(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point penSize;
+#ifndef GetPortPenSize
+ PyMac_PRECHECK(GetPortPenSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &penSize))
+ return NULL;
+ GetPortPenSize(_self->ob_itself,
+ &penSize);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, penSize);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortPenMode(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 _rv;
+#ifndef GetPortPenMode
+ PyMac_PRECHECK(GetPortPenMode);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetPortPenMode(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_GetPortPenLocation(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point penLocation;
+#ifndef GetPortPenLocation
+ PyMac_PRECHECK(GetPortPenLocation);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &penLocation))
+ return NULL;
+ GetPortPenLocation(_self->ob_itself,
+ &penLocation);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, penLocation);
+ return _res;
+}
+
+static PyObject *GrafObj_IsPortRegionBeingDefined(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef IsPortRegionBeingDefined
+ PyMac_PRECHECK(IsPortRegionBeingDefined);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsPortRegionBeingDefined(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_IsPortPictureBeingDefined(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef IsPortPictureBeingDefined
+ PyMac_PRECHECK(IsPortPictureBeingDefined);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsPortPictureBeingDefined(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_IsPortPolyBeingDefined(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef IsPortPolyBeingDefined
+ PyMac_PRECHECK(IsPortPolyBeingDefined);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsPortPolyBeingDefined(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_IsPortOffscreen(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef IsPortOffscreen
+ PyMac_PRECHECK(IsPortOffscreen);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsPortOffscreen(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_IsPortColor(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef IsPortColor
+ PyMac_PRECHECK(IsPortColor);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsPortColor(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_IsPortVisibleRegionEmpty(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef IsPortVisibleRegionEmpty
+ PyMac_PRECHECK(IsPortVisibleRegionEmpty);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsPortVisibleRegionEmpty(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_IsPortClipRegionEmpty(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef IsPortClipRegionEmpty
+ PyMac_PRECHECK(IsPortClipRegionEmpty);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsPortClipRegionEmpty(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_SectRegionWithPortClipRegion(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle ioRegion;
+#ifndef SectRegionWithPortClipRegion
+ PyMac_PRECHECK(SectRegionWithPortClipRegion);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &ioRegion))
+ return NULL;
+ SectRegionWithPortClipRegion(_self->ob_itself,
+ ioRegion);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *GrafObj_SectRegionWithPortVisibleRegion(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle ioRegion;
+#ifndef SectRegionWithPortVisibleRegion
+ PyMac_PRECHECK(SectRegionWithPortVisibleRegion);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &ioRegion))
+ return NULL;
+ SectRegionWithPortVisibleRegion(_self->ob_itself,
+ ioRegion);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *GrafObj_SwapPortPicSaveHandle(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+ Handle inPicSaveHdl;
+#ifndef SwapPortPicSaveHandle
+ PyMac_PRECHECK(SwapPortPicSaveHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &inPicSaveHdl))
+ return NULL;
+ _rv = SwapPortPicSaveHandle(_self->ob_itself,
+ inPicSaveHdl);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_SwapPortPolySaveHandle(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+ Handle inPolySaveHdl;
+#ifndef SwapPortPolySaveHandle
+ PyMac_PRECHECK(SwapPortPolySaveHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &inPolySaveHdl))
+ return NULL;
+ _rv = SwapPortPolySaveHandle(_self->ob_itself,
+ inPolySaveHdl);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_SwapPortRegionSaveHandle(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+ Handle inRegionSaveHdl;
+#ifndef SwapPortRegionSaveHandle
+ PyMac_PRECHECK(SwapPortRegionSaveHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &inRegionSaveHdl))
+ return NULL;
+ _rv = SwapPortRegionSaveHandle(_self->ob_itself,
+ inRegionSaveHdl);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_SetPortBounds(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect rect;
+#ifndef SetPortBounds
+ PyMac_PRECHECK(SetPortBounds);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &rect))
+ return NULL;
+ SetPortBounds(_self->ob_itself,
+ &rect);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *GrafObj_SetPortOpColor(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RGBColor opColor;
+#ifndef SetPortOpColor
+ PyMac_PRECHECK(SetPortOpColor);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ QdRGB_Convert, &opColor))
+ return NULL;
+ SetPortOpColor(_self->ob_itself,
+ &opColor);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *GrafObj_SetPortTextFont(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short txFont;
+#ifndef SetPortTextFont
+ PyMac_PRECHECK(SetPortTextFont);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &txFont))
+ return NULL;
+ SetPortTextFont(_self->ob_itself,
+ txFont);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *GrafObj_SetPortTextSize(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short txSize;
+#ifndef SetPortTextSize
+ PyMac_PRECHECK(SetPortTextSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &txSize))
+ return NULL;
+ SetPortTextSize(_self->ob_itself,
+ txSize);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *GrafObj_SetPortTextFace(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ StyleParameter face;
+#ifndef SetPortTextFace
+ PyMac_PRECHECK(SetPortTextFace);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &face))
+ return NULL;
+ SetPortTextFace(_self->ob_itself,
+ face);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *GrafObj_SetPortTextMode(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short mode;
+#ifndef SetPortTextMode
+ PyMac_PRECHECK(SetPortTextMode);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &mode))
+ return NULL;
+ SetPortTextMode(_self->ob_itself,
+ mode);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *GrafObj_SetPortVisibleRegion(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle visRgn;
+#ifndef SetPortVisibleRegion
+ PyMac_PRECHECK(SetPortVisibleRegion);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &visRgn))
+ return NULL;
+ SetPortVisibleRegion(_self->ob_itself,
+ visRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *GrafObj_SetPortClipRegion(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle clipRgn;
+#ifndef SetPortClipRegion
+ PyMac_PRECHECK(SetPortClipRegion);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &clipRgn))
+ return NULL;
+ SetPortClipRegion(_self->ob_itself,
+ clipRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *GrafObj_SetPortPenPixPat(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixPatHandle penPattern;
+#ifndef SetPortPenPixPat
+ PyMac_PRECHECK(SetPortPenPixPat);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &penPattern))
+ return NULL;
+ SetPortPenPixPat(_self->ob_itself,
+ penPattern);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *GrafObj_SetPortFillPixPat(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixPatHandle penPattern;
+#ifndef SetPortFillPixPat
+ PyMac_PRECHECK(SetPortFillPixPat);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &penPattern))
+ return NULL;
+ SetPortFillPixPat(_self->ob_itself,
+ penPattern);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *GrafObj_SetPortBackPixPat(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixPatHandle backPattern;
+#ifndef SetPortBackPixPat
+ PyMac_PRECHECK(SetPortBackPixPat);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &backPattern))
+ return NULL;
+ SetPortBackPixPat(_self->ob_itself,
+ backPattern);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *GrafObj_SetPortPenSize(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point penSize;
+#ifndef SetPortPenSize
+ PyMac_PRECHECK(SetPortPenSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &penSize))
+ return NULL;
+ SetPortPenSize(_self->ob_itself,
+ penSize);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *GrafObj_SetPortPenMode(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 penMode;
+#ifndef SetPortPenMode
+ PyMac_PRECHECK(SetPortPenMode);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &penMode))
+ return NULL;
+ SetPortPenMode(_self->ob_itself,
+ penMode);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *GrafObj_SetPortFracHPenLocation(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short pnLocHFrac;
+#ifndef SetPortFracHPenLocation
+ PyMac_PRECHECK(SetPortFracHPenLocation);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &pnLocHFrac))
+ return NULL;
+ SetPortFracHPenLocation(_self->ob_itself,
+ pnLocHFrac);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *GrafObj_DisposePort(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef DisposePort
+ PyMac_PRECHECK(DisposePort);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ DisposePort(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *GrafObj_QDLocalToGlobalPoint(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point point;
+#ifndef QDLocalToGlobalPoint
+ PyMac_PRECHECK(QDLocalToGlobalPoint);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &point))
+ return NULL;
+ QDLocalToGlobalPoint(_self->ob_itself,
+ &point);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, point);
+ return _res;
+}
+
+static PyObject *GrafObj_QDGlobalToLocalPoint(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point point;
+#ifndef QDGlobalToLocalPoint
+ PyMac_PRECHECK(QDGlobalToLocalPoint);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &point))
+ return NULL;
+ QDGlobalToLocalPoint(_self->ob_itself,
+ &point);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, point);
+ return _res;
+}
+
+static PyObject *GrafObj_QDLocalToGlobalRect(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect bounds;
+#ifndef QDLocalToGlobalRect
+ PyMac_PRECHECK(QDLocalToGlobalRect);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ QDLocalToGlobalRect(_self->ob_itself,
+ &bounds);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &bounds);
+ return _res;
+}
+
+static PyObject *GrafObj_QDGlobalToLocalRect(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect bounds;
+#ifndef QDGlobalToLocalRect
+ PyMac_PRECHECK(QDGlobalToLocalRect);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ QDGlobalToLocalRect(_self->ob_itself,
+ &bounds);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &bounds);
+ return _res;
+}
+
+static PyObject *GrafObj_QDLocalToGlobalRegion(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle _rv;
+ RgnHandle region;
+#ifndef QDLocalToGlobalRegion
+ PyMac_PRECHECK(QDLocalToGlobalRegion);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &region))
+ return NULL;
+ _rv = QDLocalToGlobalRegion(_self->ob_itself,
+ region);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_QDGlobalToLocalRegion(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle _rv;
+ RgnHandle region;
+#ifndef QDGlobalToLocalRegion
+ PyMac_PRECHECK(QDGlobalToLocalRegion);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &region))
+ return NULL;
+ _rv = QDGlobalToLocalRegion(_self->ob_itself,
+ region);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_QDIsPortBuffered(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef QDIsPortBuffered
+ PyMac_PRECHECK(QDIsPortBuffered);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = QDIsPortBuffered(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_QDIsPortBufferDirty(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef QDIsPortBufferDirty
+ PyMac_PRECHECK(QDIsPortBufferDirty);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = QDIsPortBufferDirty(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *GrafObj_QDFlushPortBuffer(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle region;
+#ifndef QDFlushPortBuffer
+ PyMac_PRECHECK(QDFlushPortBuffer);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ OptResObj_Convert, &region))
+ return NULL;
+ QDFlushPortBuffer(_self->ob_itself,
+ region);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *GrafObj_QDGetDirtyRegion(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ RgnHandle rgn;
+#ifndef QDGetDirtyRegion
+ PyMac_PRECHECK(QDGetDirtyRegion);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &rgn))
+ return NULL;
+ _err = QDGetDirtyRegion(_self->ob_itself,
+ rgn);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *GrafObj_QDSetDirtyRegion(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ RgnHandle rgn;
+#ifndef QDSetDirtyRegion
+ PyMac_PRECHECK(QDSetDirtyRegion);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &rgn))
+ return NULL;
+ _err = QDSetDirtyRegion(_self->ob_itself,
+ rgn);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyMethodDef GrafObj_methods[] = {
+ {"MacSetPort", (PyCFunction)GrafObj_MacSetPort, 1,
+ PyDoc_STR("() -> None")},
+ {"QDSwapPort", (PyCFunction)GrafObj_QDSwapPort, 1,
+ PyDoc_STR("() -> (Boolean _rv, CGrafPtr outOldPort)")},
+ {"IsValidPort", (PyCFunction)GrafObj_IsValidPort, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"GetPortPixMap", (PyCFunction)GrafObj_GetPortPixMap, 1,
+ PyDoc_STR("() -> (PixMapHandle _rv)")},
+ {"GetPortBitMapForCopyBits", (PyCFunction)GrafObj_GetPortBitMapForCopyBits, 1,
+ PyDoc_STR("() -> (const BitMap * _rv)")},
+ {"GetPortBounds", (PyCFunction)GrafObj_GetPortBounds, 1,
+ PyDoc_STR("() -> (Rect rect)")},
+ {"GetPortForeColor", (PyCFunction)GrafObj_GetPortForeColor, 1,
+ PyDoc_STR("() -> (RGBColor foreColor)")},
+ {"GetPortBackColor", (PyCFunction)GrafObj_GetPortBackColor, 1,
+ PyDoc_STR("() -> (RGBColor backColor)")},
+ {"GetPortOpColor", (PyCFunction)GrafObj_GetPortOpColor, 1,
+ PyDoc_STR("() -> (RGBColor opColor)")},
+ {"GetPortHiliteColor", (PyCFunction)GrafObj_GetPortHiliteColor, 1,
+ PyDoc_STR("() -> (RGBColor hiliteColor)")},
+ {"GetPortTextFont", (PyCFunction)GrafObj_GetPortTextFont, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"GetPortTextFace", (PyCFunction)GrafObj_GetPortTextFace, 1,
+ PyDoc_STR("() -> (Style _rv)")},
+ {"GetPortTextMode", (PyCFunction)GrafObj_GetPortTextMode, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"GetPortTextSize", (PyCFunction)GrafObj_GetPortTextSize, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"GetPortChExtra", (PyCFunction)GrafObj_GetPortChExtra, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"GetPortFracHPenLocation", (PyCFunction)GrafObj_GetPortFracHPenLocation, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"GetPortSpExtra", (PyCFunction)GrafObj_GetPortSpExtra, 1,
+ PyDoc_STR("() -> (Fixed _rv)")},
+ {"GetPortPenVisibility", (PyCFunction)GrafObj_GetPortPenVisibility, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"GetPortVisibleRegion", (PyCFunction)GrafObj_GetPortVisibleRegion, 1,
+ PyDoc_STR("(RgnHandle visRgn) -> (RgnHandle _rv)")},
+ {"GetPortClipRegion", (PyCFunction)GrafObj_GetPortClipRegion, 1,
+ PyDoc_STR("(RgnHandle clipRgn) -> (RgnHandle _rv)")},
+ {"GetPortBackPixPat", (PyCFunction)GrafObj_GetPortBackPixPat, 1,
+ PyDoc_STR("(PixPatHandle backPattern) -> (PixPatHandle _rv)")},
+ {"GetPortPenPixPat", (PyCFunction)GrafObj_GetPortPenPixPat, 1,
+ PyDoc_STR("(PixPatHandle penPattern) -> (PixPatHandle _rv)")},
+ {"GetPortFillPixPat", (PyCFunction)GrafObj_GetPortFillPixPat, 1,
+ PyDoc_STR("(PixPatHandle fillPattern) -> (PixPatHandle _rv)")},
+ {"GetPortPenSize", (PyCFunction)GrafObj_GetPortPenSize, 1,
+ PyDoc_STR("(Point penSize) -> (Point penSize)")},
+ {"GetPortPenMode", (PyCFunction)GrafObj_GetPortPenMode, 1,
+ PyDoc_STR("() -> (SInt32 _rv)")},
+ {"GetPortPenLocation", (PyCFunction)GrafObj_GetPortPenLocation, 1,
+ PyDoc_STR("(Point penLocation) -> (Point penLocation)")},
+ {"IsPortRegionBeingDefined", (PyCFunction)GrafObj_IsPortRegionBeingDefined, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"IsPortPictureBeingDefined", (PyCFunction)GrafObj_IsPortPictureBeingDefined, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"IsPortPolyBeingDefined", (PyCFunction)GrafObj_IsPortPolyBeingDefined, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"IsPortOffscreen", (PyCFunction)GrafObj_IsPortOffscreen, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"IsPortColor", (PyCFunction)GrafObj_IsPortColor, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"IsPortVisibleRegionEmpty", (PyCFunction)GrafObj_IsPortVisibleRegionEmpty, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"IsPortClipRegionEmpty", (PyCFunction)GrafObj_IsPortClipRegionEmpty, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"SectRegionWithPortClipRegion", (PyCFunction)GrafObj_SectRegionWithPortClipRegion, 1,
+ PyDoc_STR("(RgnHandle ioRegion) -> None")},
+ {"SectRegionWithPortVisibleRegion", (PyCFunction)GrafObj_SectRegionWithPortVisibleRegion, 1,
+ PyDoc_STR("(RgnHandle ioRegion) -> None")},
+ {"SwapPortPicSaveHandle", (PyCFunction)GrafObj_SwapPortPicSaveHandle, 1,
+ PyDoc_STR("(Handle inPicSaveHdl) -> (Handle _rv)")},
+ {"SwapPortPolySaveHandle", (PyCFunction)GrafObj_SwapPortPolySaveHandle, 1,
+ PyDoc_STR("(Handle inPolySaveHdl) -> (Handle _rv)")},
+ {"SwapPortRegionSaveHandle", (PyCFunction)GrafObj_SwapPortRegionSaveHandle, 1,
+ PyDoc_STR("(Handle inRegionSaveHdl) -> (Handle _rv)")},
+ {"SetPortBounds", (PyCFunction)GrafObj_SetPortBounds, 1,
+ PyDoc_STR("(Rect rect) -> None")},
+ {"SetPortOpColor", (PyCFunction)GrafObj_SetPortOpColor, 1,
+ PyDoc_STR("(RGBColor opColor) -> None")},
+ {"SetPortTextFont", (PyCFunction)GrafObj_SetPortTextFont, 1,
+ PyDoc_STR("(short txFont) -> None")},
+ {"SetPortTextSize", (PyCFunction)GrafObj_SetPortTextSize, 1,
+ PyDoc_STR("(short txSize) -> None")},
+ {"SetPortTextFace", (PyCFunction)GrafObj_SetPortTextFace, 1,
+ PyDoc_STR("(StyleParameter face) -> None")},
+ {"SetPortTextMode", (PyCFunction)GrafObj_SetPortTextMode, 1,
+ PyDoc_STR("(short mode) -> None")},
+ {"SetPortVisibleRegion", (PyCFunction)GrafObj_SetPortVisibleRegion, 1,
+ PyDoc_STR("(RgnHandle visRgn) -> None")},
+ {"SetPortClipRegion", (PyCFunction)GrafObj_SetPortClipRegion, 1,
+ PyDoc_STR("(RgnHandle clipRgn) -> None")},
+ {"SetPortPenPixPat", (PyCFunction)GrafObj_SetPortPenPixPat, 1,
+ PyDoc_STR("(PixPatHandle penPattern) -> None")},
+ {"SetPortFillPixPat", (PyCFunction)GrafObj_SetPortFillPixPat, 1,
+ PyDoc_STR("(PixPatHandle penPattern) -> None")},
+ {"SetPortBackPixPat", (PyCFunction)GrafObj_SetPortBackPixPat, 1,
+ PyDoc_STR("(PixPatHandle backPattern) -> None")},
+ {"SetPortPenSize", (PyCFunction)GrafObj_SetPortPenSize, 1,
+ PyDoc_STR("(Point penSize) -> None")},
+ {"SetPortPenMode", (PyCFunction)GrafObj_SetPortPenMode, 1,
+ PyDoc_STR("(SInt32 penMode) -> None")},
+ {"SetPortFracHPenLocation", (PyCFunction)GrafObj_SetPortFracHPenLocation, 1,
+ PyDoc_STR("(short pnLocHFrac) -> None")},
+ {"DisposePort", (PyCFunction)GrafObj_DisposePort, 1,
+ PyDoc_STR("() -> None")},
+ {"QDLocalToGlobalPoint", (PyCFunction)GrafObj_QDLocalToGlobalPoint, 1,
+ PyDoc_STR("(Point point) -> (Point point)")},
+ {"QDGlobalToLocalPoint", (PyCFunction)GrafObj_QDGlobalToLocalPoint, 1,
+ PyDoc_STR("(Point point) -> (Point point)")},
+ {"QDLocalToGlobalRect", (PyCFunction)GrafObj_QDLocalToGlobalRect, 1,
+ PyDoc_STR("() -> (Rect bounds)")},
+ {"QDGlobalToLocalRect", (PyCFunction)GrafObj_QDGlobalToLocalRect, 1,
+ PyDoc_STR("() -> (Rect bounds)")},
+ {"QDLocalToGlobalRegion", (PyCFunction)GrafObj_QDLocalToGlobalRegion, 1,
+ PyDoc_STR("(RgnHandle region) -> (RgnHandle _rv)")},
+ {"QDGlobalToLocalRegion", (PyCFunction)GrafObj_QDGlobalToLocalRegion, 1,
+ PyDoc_STR("(RgnHandle region) -> (RgnHandle _rv)")},
+ {"QDIsPortBuffered", (PyCFunction)GrafObj_QDIsPortBuffered, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"QDIsPortBufferDirty", (PyCFunction)GrafObj_QDIsPortBufferDirty, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"QDFlushPortBuffer", (PyCFunction)GrafObj_QDFlushPortBuffer, 1,
+ PyDoc_STR("(RgnHandle region) -> None")},
+ {"QDGetDirtyRegion", (PyCFunction)GrafObj_QDGetDirtyRegion, 1,
+ PyDoc_STR("(RgnHandle rgn) -> None")},
+ {"QDSetDirtyRegion", (PyCFunction)GrafObj_QDSetDirtyRegion, 1,
+ PyDoc_STR("(RgnHandle rgn) -> None")},
+ {NULL, NULL, 0}
+};
+
+static PyObject *GrafObj_get_visRgn(GrafPortObject *self, void *closure)
+{
+ RgnHandle h=NewRgn(); /* XXXX wrong dispose routine */
+ return Py_BuildValue("O&", ResObj_New, (Handle)GetPortVisibleRegion(self->ob_itself, h));
+
+}
+
+#define GrafObj_set_visRgn NULL
+
+static PyObject *GrafObj_get_clipRgn(GrafPortObject *self, void *closure)
+{
+ RgnHandle h=NewRgn(); /* XXXX wrong dispose routine */
+ return Py_BuildValue("O&", ResObj_New, (Handle)GetPortClipRegion(self->ob_itself, h));
+
+}
+
+#define GrafObj_set_clipRgn NULL
+
+static PyGetSetDef GrafObj_getsetlist[] = {
+ {"visRgn", (getter)GrafObj_get_visRgn, (setter)GrafObj_set_visRgn, "Convenience attribute: return a copy of the visible region"},
+ {"clipRgn", (getter)GrafObj_get_clipRgn, (setter)GrafObj_set_clipRgn, "Convenience attribute: return a copy of the clipping region"},
+ {NULL, NULL, NULL, NULL},
+};
+
+
+#define GrafObj_compare NULL
+
+#define GrafObj_repr NULL
+
+#define GrafObj_hash NULL
+#define GrafObj_tp_init 0
+
+#define GrafObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *GrafObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *_self;
+ GrafPtr itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, GrafObj_Convert, &itself)) return NULL;
+ if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((GrafPortObject *)_self)->ob_itself = itself;
+ return _self;
+}
+
+#define GrafObj_tp_free PyObject_Del
+
+
+PyTypeObject GrafPort_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_Qd.GrafPort", /*tp_name*/
+ sizeof(GrafPortObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) GrafObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) GrafObj_compare, /*tp_compare*/
+ (reprfunc) GrafObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) GrafObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ GrafObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ GrafObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ GrafObj_tp_init, /* tp_init */
+ GrafObj_tp_alloc, /* tp_alloc */
+ GrafObj_tp_new, /* tp_new */
+ GrafObj_tp_free, /* tp_free */
+};
+
+/* -------------------- End object type GrafPort -------------------- */
+
+
+/* ----------------------- Object type BitMap ----------------------- */
+
+PyTypeObject BitMap_Type;
+
+#define BMObj_Check(x) ((x)->ob_type == &BitMap_Type || PyObject_TypeCheck((x), &BitMap_Type))
+
+typedef struct BitMapObject {
+ PyObject_HEAD
+ BitMapPtr ob_itself;
+ PyObject *referred_object;
+ BitMap *referred_bitmap;
+} BitMapObject;
+
+PyObject *BMObj_New(BitMapPtr itself)
+{
+ BitMapObject *it;
+ if (itself == NULL) return PyMac_Error(resNotFound);
+ it = PyObject_NEW(BitMapObject, &BitMap_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ it->referred_object = NULL;
+ it->referred_bitmap = NULL;
+ return (PyObject *)it;
+}
+
+int BMObj_Convert(PyObject *v, BitMapPtr *p_itself)
+{
+ if (!BMObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "BitMap required");
+ return 0;
+ }
+ *p_itself = ((BitMapObject *)v)->ob_itself;
+ return 1;
+}
+
+static void BMObj_dealloc(BitMapObject *self)
+{
+ Py_XDECREF(self->referred_object);
+ if (self->referred_bitmap) free(self->referred_bitmap);
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *BMObj_getdata(BitMapObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ int from, length;
+ char *cp;
+
+ if ( !PyArg_ParseTuple(_args, "ii", &from, &length) )
+ return NULL;
+ cp = _self->ob_itself->baseAddr+from;
+ _res = PyString_FromStringAndSize(cp, length);
+ return _res;
+
+}
+
+static PyObject *BMObj_putdata(BitMapObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ int from, length;
+ char *cp, *icp;
+
+ if ( !PyArg_ParseTuple(_args, "is#", &from, &icp, &length) )
+ return NULL;
+ cp = _self->ob_itself->baseAddr+from;
+ memcpy(cp, icp, length);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+
+}
+
+static PyMethodDef BMObj_methods[] = {
+ {"getdata", (PyCFunction)BMObj_getdata, 1,
+ PyDoc_STR("(int start, int size) -> string. Return bytes from the bitmap")},
+ {"putdata", (PyCFunction)BMObj_putdata, 1,
+ PyDoc_STR("(int start, string data). Store bytes into the bitmap")},
+ {NULL, NULL, 0}
+};
+
+static PyObject *BMObj_get_baseAddr(BitMapObject *self, void *closure)
+{
+ return PyInt_FromLong((long)self->ob_itself->baseAddr);
+}
+
+#define BMObj_set_baseAddr NULL
+
+static PyObject *BMObj_get_rowBytes(BitMapObject *self, void *closure)
+{
+ return PyInt_FromLong((long)self->ob_itself->rowBytes);
+}
+
+#define BMObj_set_rowBytes NULL
+
+static PyObject *BMObj_get_bounds(BitMapObject *self, void *closure)
+{
+ return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->bounds);
+}
+
+#define BMObj_set_bounds NULL
+
+static PyObject *BMObj_get_bitmap_data(BitMapObject *self, void *closure)
+{
+ return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(BitMap));
+}
+
+#define BMObj_set_bitmap_data NULL
+
+static PyObject *BMObj_get_pixmap_data(BitMapObject *self, void *closure)
+{
+ return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(PixMap));
+}
+
+#define BMObj_set_pixmap_data NULL
+
+static PyGetSetDef BMObj_getsetlist[] = {
+ {"baseAddr", (getter)BMObj_get_baseAddr, (setter)BMObj_set_baseAddr, NULL},
+ {"rowBytes", (getter)BMObj_get_rowBytes, (setter)BMObj_set_rowBytes, NULL},
+ {"bounds", (getter)BMObj_get_bounds, (setter)BMObj_set_bounds, NULL},
+ {"bitmap_data", (getter)BMObj_get_bitmap_data, (setter)BMObj_set_bitmap_data, NULL},
+ {"pixmap_data", (getter)BMObj_get_pixmap_data, (setter)BMObj_set_pixmap_data, NULL},
+ {NULL, NULL, NULL, NULL},
+};
+
+
+#define BMObj_compare NULL
+
+#define BMObj_repr NULL
+
+#define BMObj_hash NULL
+#define BMObj_tp_init 0
+
+#define BMObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *BMObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *_self;
+ BitMapPtr itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, BMObj_Convert, &itself)) return NULL;
+ if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((BitMapObject *)_self)->ob_itself = itself;
+ return _self;
+}
+
+#define BMObj_tp_free PyObject_Del
+
+
+PyTypeObject BitMap_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_Qd.BitMap", /*tp_name*/
+ sizeof(BitMapObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) BMObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) BMObj_compare, /*tp_compare*/
+ (reprfunc) BMObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) BMObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ BMObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ BMObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ BMObj_tp_init, /* tp_init */
+ BMObj_tp_alloc, /* tp_alloc */
+ BMObj_tp_new, /* tp_new */
+ BMObj_tp_free, /* tp_free */
+};
+
+/* --------------------- End object type BitMap --------------------- */
+
+
+static PyObject *Qd_GetPort(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GrafPtr port;
+#ifndef GetPort
+ PyMac_PRECHECK(GetPort);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetPort(&port);
+ _res = Py_BuildValue("O&",
+ GrafObj_New, port);
+ return _res;
+}
+
+static PyObject *Qd_GrafDevice(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short device;
+#ifndef GrafDevice
+ PyMac_PRECHECK(GrafDevice);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &device))
+ return NULL;
+ GrafDevice(device);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_SetPortBits(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ BitMapPtr bm;
+#ifndef SetPortBits
+ PyMac_PRECHECK(SetPortBits);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ BMObj_Convert, &bm))
+ return NULL;
+ SetPortBits(bm);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_PortSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short width;
+ short height;
+#ifndef PortSize
+ PyMac_PRECHECK(PortSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "hh",
+ &width,
+ &height))
+ return NULL;
+ PortSize(width,
+ height);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MovePortTo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short leftGlobal;
+ short topGlobal;
+#ifndef MovePortTo
+ PyMac_PRECHECK(MovePortTo);
+#endif
+ if (!PyArg_ParseTuple(_args, "hh",
+ &leftGlobal,
+ &topGlobal))
+ return NULL;
+ MovePortTo(leftGlobal,
+ topGlobal);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_SetOrigin(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short h;
+ short v;
+#ifndef SetOrigin
+ PyMac_PRECHECK(SetOrigin);
+#endif
+ if (!PyArg_ParseTuple(_args, "hh",
+ &h,
+ &v))
+ return NULL;
+ SetOrigin(h,
+ v);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_SetClip(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+#ifndef SetClip
+ PyMac_PRECHECK(SetClip);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &rgn))
+ return NULL;
+ SetClip(rgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_GetClip(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+#ifndef GetClip
+ PyMac_PRECHECK(GetClip);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &rgn))
+ return NULL;
+ GetClip(rgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_ClipRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+#ifndef ClipRect
+ PyMac_PRECHECK(ClipRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &r))
+ return NULL;
+ ClipRect(&r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_BackPat(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Pattern *pat__in__;
+ int pat__in_len__;
+#ifndef BackPat
+ PyMac_PRECHECK(BackPat);
+#endif
+ if (!PyArg_ParseTuple(_args, "s#",
+ (char **)&pat__in__, &pat__in_len__))
+ return NULL;
+ if (pat__in_len__ != sizeof(Pattern))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
+ goto pat__error__;
+ }
+ BackPat(pat__in__);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ pat__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_InitCursor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef InitCursor
+ PyMac_PRECHECK(InitCursor);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ InitCursor();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MacSetCursor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Cursor *crsr__in__;
+ int crsr__in_len__;
+#ifndef MacSetCursor
+ PyMac_PRECHECK(MacSetCursor);
+#endif
+ if (!PyArg_ParseTuple(_args, "s#",
+ (char **)&crsr__in__, &crsr__in_len__))
+ return NULL;
+ if (crsr__in_len__ != sizeof(Cursor))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Cursor)");
+ goto crsr__error__;
+ }
+ MacSetCursor(crsr__in__);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ crsr__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_HideCursor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef HideCursor
+ PyMac_PRECHECK(HideCursor);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ HideCursor();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MacShowCursor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef MacShowCursor
+ PyMac_PRECHECK(MacShowCursor);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ MacShowCursor();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_ObscureCursor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef ObscureCursor
+ PyMac_PRECHECK(ObscureCursor);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ObscureCursor();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_HidePen(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef HidePen
+ PyMac_PRECHECK(HidePen);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ HidePen();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_ShowPen(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef ShowPen
+ PyMac_PRECHECK(ShowPen);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ShowPen();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_GetPen(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point pt;
+#ifndef GetPen
+ PyMac_PRECHECK(GetPen);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetPen(&pt);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, pt);
+ return _res;
+}
+
+static PyObject *Qd_GetPenState(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PenState pnState__out__;
+#ifndef GetPenState
+ PyMac_PRECHECK(GetPenState);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetPenState(&pnState__out__);
+ _res = Py_BuildValue("s#",
+ (char *)&pnState__out__, (int)sizeof(PenState));
+ return _res;
+}
+
+static PyObject *Qd_SetPenState(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PenState *pnState__in__;
+ int pnState__in_len__;
+#ifndef SetPenState
+ PyMac_PRECHECK(SetPenState);
+#endif
+ if (!PyArg_ParseTuple(_args, "s#",
+ (char **)&pnState__in__, &pnState__in_len__))
+ return NULL;
+ if (pnState__in_len__ != sizeof(PenState))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(PenState)");
+ goto pnState__error__;
+ }
+ SetPenState(pnState__in__);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ pnState__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_PenSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short width;
+ short height;
+#ifndef PenSize
+ PyMac_PRECHECK(PenSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "hh",
+ &width,
+ &height))
+ return NULL;
+ PenSize(width,
+ height);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_PenMode(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short mode;
+#ifndef PenMode
+ PyMac_PRECHECK(PenMode);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &mode))
+ return NULL;
+ PenMode(mode);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_PenPat(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Pattern *pat__in__;
+ int pat__in_len__;
+#ifndef PenPat
+ PyMac_PRECHECK(PenPat);
+#endif
+ if (!PyArg_ParseTuple(_args, "s#",
+ (char **)&pat__in__, &pat__in_len__))
+ return NULL;
+ if (pat__in_len__ != sizeof(Pattern))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
+ goto pat__error__;
+ }
+ PenPat(pat__in__);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ pat__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_PenNormal(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef PenNormal
+ PyMac_PRECHECK(PenNormal);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ PenNormal();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MoveTo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short h;
+ short v;
+#ifndef MoveTo
+ PyMac_PRECHECK(MoveTo);
+#endif
+ if (!PyArg_ParseTuple(_args, "hh",
+ &h,
+ &v))
+ return NULL;
+ MoveTo(h,
+ v);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_Move(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short dh;
+ short dv;
+#ifndef Move
+ PyMac_PRECHECK(Move);
+#endif
+ if (!PyArg_ParseTuple(_args, "hh",
+ &dh,
+ &dv))
+ return NULL;
+ Move(dh,
+ dv);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MacLineTo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short h;
+ short v;
+#ifndef MacLineTo
+ PyMac_PRECHECK(MacLineTo);
+#endif
+ if (!PyArg_ParseTuple(_args, "hh",
+ &h,
+ &v))
+ return NULL;
+ MacLineTo(h,
+ v);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_Line(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short dh;
+ short dv;
+#ifndef Line
+ PyMac_PRECHECK(Line);
+#endif
+ if (!PyArg_ParseTuple(_args, "hh",
+ &dh,
+ &dv))
+ return NULL;
+ Line(dh,
+ dv);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_ForeColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long color;
+#ifndef ForeColor
+ PyMac_PRECHECK(ForeColor);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &color))
+ return NULL;
+ ForeColor(color);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_BackColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long color;
+#ifndef BackColor
+ PyMac_PRECHECK(BackColor);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &color))
+ return NULL;
+ BackColor(color);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_ColorBit(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short whichBit;
+#ifndef ColorBit
+ PyMac_PRECHECK(ColorBit);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &whichBit))
+ return NULL;
+ ColorBit(whichBit);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MacSetRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short left;
+ short top;
+ short right;
+ short bottom;
+#ifndef MacSetRect
+ PyMac_PRECHECK(MacSetRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "hhhh",
+ &left,
+ &top,
+ &right,
+ &bottom))
+ return NULL;
+ MacSetRect(&r,
+ left,
+ top,
+ right,
+ bottom);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &r);
+ return _res;
+}
+
+static PyObject *Qd_MacOffsetRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short dh;
+ short dv;
+#ifndef MacOffsetRect
+ PyMac_PRECHECK(MacOffsetRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetRect, &r,
+ &dh,
+ &dv))
+ return NULL;
+ MacOffsetRect(&r,
+ dh,
+ dv);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &r);
+ return _res;
+}
+
+static PyObject *Qd_MacInsetRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short dh;
+ short dv;
+#ifndef MacInsetRect
+ PyMac_PRECHECK(MacInsetRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetRect, &r,
+ &dh,
+ &dv))
+ return NULL;
+ MacInsetRect(&r,
+ dh,
+ dv);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &r);
+ return _res;
+}
+
+static PyObject *Qd_SectRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Rect src1;
+ Rect src2;
+ Rect dstRect;
+#ifndef SectRect
+ PyMac_PRECHECK(SectRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetRect, &src1,
+ PyMac_GetRect, &src2))
+ return NULL;
+ _rv = SectRect(&src1,
+ &src2,
+ &dstRect);
+ _res = Py_BuildValue("bO&",
+ _rv,
+ PyMac_BuildRect, &dstRect);
+ return _res;
+}
+
+static PyObject *Qd_MacUnionRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect src1;
+ Rect src2;
+ Rect dstRect;
+#ifndef MacUnionRect
+ PyMac_PRECHECK(MacUnionRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetRect, &src1,
+ PyMac_GetRect, &src2))
+ return NULL;
+ MacUnionRect(&src1,
+ &src2,
+ &dstRect);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &dstRect);
+ return _res;
+}
+
+static PyObject *Qd_MacEqualRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Rect rect1;
+ Rect rect2;
+#ifndef MacEqualRect
+ PyMac_PRECHECK(MacEqualRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetRect, &rect1,
+ PyMac_GetRect, &rect2))
+ return NULL;
+ _rv = MacEqualRect(&rect1,
+ &rect2);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_EmptyRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Rect r;
+#ifndef EmptyRect
+ PyMac_PRECHECK(EmptyRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &r))
+ return NULL;
+ _rv = EmptyRect(&r);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_MacFrameRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+#ifndef MacFrameRect
+ PyMac_PRECHECK(MacFrameRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &r))
+ return NULL;
+ MacFrameRect(&r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_PaintRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+#ifndef PaintRect
+ PyMac_PRECHECK(PaintRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &r))
+ return NULL;
+ PaintRect(&r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_EraseRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+#ifndef EraseRect
+ PyMac_PRECHECK(EraseRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &r))
+ return NULL;
+ EraseRect(&r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MacInvertRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+#ifndef MacInvertRect
+ PyMac_PRECHECK(MacInvertRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &r))
+ return NULL;
+ MacInvertRect(&r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MacFillRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ Pattern *pat__in__;
+ int pat__in_len__;
+#ifndef MacFillRect
+ PyMac_PRECHECK(MacFillRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&s#",
+ PyMac_GetRect, &r,
+ (char **)&pat__in__, &pat__in_len__))
+ return NULL;
+ if (pat__in_len__ != sizeof(Pattern))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
+ goto pat__error__;
+ }
+ MacFillRect(&r,
+ pat__in__);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ pat__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_FrameOval(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+#ifndef FrameOval
+ PyMac_PRECHECK(FrameOval);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &r))
+ return NULL;
+ FrameOval(&r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_PaintOval(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+#ifndef PaintOval
+ PyMac_PRECHECK(PaintOval);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &r))
+ return NULL;
+ PaintOval(&r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_EraseOval(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+#ifndef EraseOval
+ PyMac_PRECHECK(EraseOval);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &r))
+ return NULL;
+ EraseOval(&r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_InvertOval(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+#ifndef InvertOval
+ PyMac_PRECHECK(InvertOval);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &r))
+ return NULL;
+ InvertOval(&r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_FillOval(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ Pattern *pat__in__;
+ int pat__in_len__;
+#ifndef FillOval
+ PyMac_PRECHECK(FillOval);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&s#",
+ PyMac_GetRect, &r,
+ (char **)&pat__in__, &pat__in_len__))
+ return NULL;
+ if (pat__in_len__ != sizeof(Pattern))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
+ goto pat__error__;
+ }
+ FillOval(&r,
+ pat__in__);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ pat__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_FrameRoundRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short ovalWidth;
+ short ovalHeight;
+#ifndef FrameRoundRect
+ PyMac_PRECHECK(FrameRoundRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetRect, &r,
+ &ovalWidth,
+ &ovalHeight))
+ return NULL;
+ FrameRoundRect(&r,
+ ovalWidth,
+ ovalHeight);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_PaintRoundRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short ovalWidth;
+ short ovalHeight;
+#ifndef PaintRoundRect
+ PyMac_PRECHECK(PaintRoundRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetRect, &r,
+ &ovalWidth,
+ &ovalHeight))
+ return NULL;
+ PaintRoundRect(&r,
+ ovalWidth,
+ ovalHeight);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_EraseRoundRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short ovalWidth;
+ short ovalHeight;
+#ifndef EraseRoundRect
+ PyMac_PRECHECK(EraseRoundRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetRect, &r,
+ &ovalWidth,
+ &ovalHeight))
+ return NULL;
+ EraseRoundRect(&r,
+ ovalWidth,
+ ovalHeight);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_InvertRoundRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short ovalWidth;
+ short ovalHeight;
+#ifndef InvertRoundRect
+ PyMac_PRECHECK(InvertRoundRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetRect, &r,
+ &ovalWidth,
+ &ovalHeight))
+ return NULL;
+ InvertRoundRect(&r,
+ ovalWidth,
+ ovalHeight);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_FillRoundRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short ovalWidth;
+ short ovalHeight;
+ Pattern *pat__in__;
+ int pat__in_len__;
+#ifndef FillRoundRect
+ PyMac_PRECHECK(FillRoundRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hhs#",
+ PyMac_GetRect, &r,
+ &ovalWidth,
+ &ovalHeight,
+ (char **)&pat__in__, &pat__in_len__))
+ return NULL;
+ if (pat__in_len__ != sizeof(Pattern))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
+ goto pat__error__;
+ }
+ FillRoundRect(&r,
+ ovalWidth,
+ ovalHeight,
+ pat__in__);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ pat__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_FrameArc(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short startAngle;
+ short arcAngle;
+#ifndef FrameArc
+ PyMac_PRECHECK(FrameArc);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetRect, &r,
+ &startAngle,
+ &arcAngle))
+ return NULL;
+ FrameArc(&r,
+ startAngle,
+ arcAngle);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_PaintArc(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short startAngle;
+ short arcAngle;
+#ifndef PaintArc
+ PyMac_PRECHECK(PaintArc);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetRect, &r,
+ &startAngle,
+ &arcAngle))
+ return NULL;
+ PaintArc(&r,
+ startAngle,
+ arcAngle);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_EraseArc(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short startAngle;
+ short arcAngle;
+#ifndef EraseArc
+ PyMac_PRECHECK(EraseArc);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetRect, &r,
+ &startAngle,
+ &arcAngle))
+ return NULL;
+ EraseArc(&r,
+ startAngle,
+ arcAngle);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_InvertArc(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short startAngle;
+ short arcAngle;
+#ifndef InvertArc
+ PyMac_PRECHECK(InvertArc);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetRect, &r,
+ &startAngle,
+ &arcAngle))
+ return NULL;
+ InvertArc(&r,
+ startAngle,
+ arcAngle);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_FillArc(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short startAngle;
+ short arcAngle;
+ Pattern *pat__in__;
+ int pat__in_len__;
+#ifndef FillArc
+ PyMac_PRECHECK(FillArc);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hhs#",
+ PyMac_GetRect, &r,
+ &startAngle,
+ &arcAngle,
+ (char **)&pat__in__, &pat__in_len__))
+ return NULL;
+ if (pat__in_len__ != sizeof(Pattern))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
+ goto pat__error__;
+ }
+ FillArc(&r,
+ startAngle,
+ arcAngle,
+ pat__in__);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ pat__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_NewRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle _rv;
+#ifndef NewRgn
+ PyMac_PRECHECK(NewRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = NewRgn();
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_OpenRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef OpenRgn
+ PyMac_PRECHECK(OpenRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ OpenRgn();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_CloseRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle dstRgn;
+#ifndef CloseRgn
+ PyMac_PRECHECK(CloseRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &dstRgn))
+ return NULL;
+ CloseRgn(dstRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_BitMapToRegion(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ RgnHandle region;
+ BitMapPtr bMap;
+#ifndef BitMapToRegion
+ PyMac_PRECHECK(BitMapToRegion);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &region,
+ BMObj_Convert, &bMap))
+ return NULL;
+ _err = BitMapToRegion(region,
+ bMap);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_RgnToHandle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle region;
+ Handle flattenedRgnDataHdl;
+#ifndef RgnToHandle
+ PyMac_PRECHECK(RgnToHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &region,
+ ResObj_Convert, &flattenedRgnDataHdl))
+ return NULL;
+ RgnToHandle(region,
+ flattenedRgnDataHdl);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_DisposeRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+#ifndef DisposeRgn
+ PyMac_PRECHECK(DisposeRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &rgn))
+ return NULL;
+ DisposeRgn(rgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MacCopyRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle srcRgn;
+ RgnHandle dstRgn;
+#ifndef MacCopyRgn
+ PyMac_PRECHECK(MacCopyRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &srcRgn,
+ ResObj_Convert, &dstRgn))
+ return NULL;
+ MacCopyRgn(srcRgn,
+ dstRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_SetEmptyRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+#ifndef SetEmptyRgn
+ PyMac_PRECHECK(SetEmptyRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &rgn))
+ return NULL;
+ SetEmptyRgn(rgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MacSetRectRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+ short left;
+ short top;
+ short right;
+ short bottom;
+#ifndef MacSetRectRgn
+ PyMac_PRECHECK(MacSetRectRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hhhh",
+ ResObj_Convert, &rgn,
+ &left,
+ &top,
+ &right,
+ &bottom))
+ return NULL;
+ MacSetRectRgn(rgn,
+ left,
+ top,
+ right,
+ bottom);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_RectRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+ Rect r;
+#ifndef RectRgn
+ PyMac_PRECHECK(RectRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &rgn,
+ PyMac_GetRect, &r))
+ return NULL;
+ RectRgn(rgn,
+ &r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MacOffsetRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+ short dh;
+ short dv;
+#ifndef MacOffsetRgn
+ PyMac_PRECHECK(MacOffsetRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ ResObj_Convert, &rgn,
+ &dh,
+ &dv))
+ return NULL;
+ MacOffsetRgn(rgn,
+ dh,
+ dv);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_InsetRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+ short dh;
+ short dv;
+#ifndef InsetRgn
+ PyMac_PRECHECK(InsetRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ ResObj_Convert, &rgn,
+ &dh,
+ &dv))
+ return NULL;
+ InsetRgn(rgn,
+ dh,
+ dv);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_SectRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle srcRgnA;
+ RgnHandle srcRgnB;
+ RgnHandle dstRgn;
+#ifndef SectRgn
+ PyMac_PRECHECK(SectRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ ResObj_Convert, &srcRgnA,
+ ResObj_Convert, &srcRgnB,
+ ResObj_Convert, &dstRgn))
+ return NULL;
+ SectRgn(srcRgnA,
+ srcRgnB,
+ dstRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MacUnionRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle srcRgnA;
+ RgnHandle srcRgnB;
+ RgnHandle dstRgn;
+#ifndef MacUnionRgn
+ PyMac_PRECHECK(MacUnionRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ ResObj_Convert, &srcRgnA,
+ ResObj_Convert, &srcRgnB,
+ ResObj_Convert, &dstRgn))
+ return NULL;
+ MacUnionRgn(srcRgnA,
+ srcRgnB,
+ dstRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_DiffRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle srcRgnA;
+ RgnHandle srcRgnB;
+ RgnHandle dstRgn;
+#ifndef DiffRgn
+ PyMac_PRECHECK(DiffRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ ResObj_Convert, &srcRgnA,
+ ResObj_Convert, &srcRgnB,
+ ResObj_Convert, &dstRgn))
+ return NULL;
+ DiffRgn(srcRgnA,
+ srcRgnB,
+ dstRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MacXorRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle srcRgnA;
+ RgnHandle srcRgnB;
+ RgnHandle dstRgn;
+#ifndef MacXorRgn
+ PyMac_PRECHECK(MacXorRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ ResObj_Convert, &srcRgnA,
+ ResObj_Convert, &srcRgnB,
+ ResObj_Convert, &dstRgn))
+ return NULL;
+ MacXorRgn(srcRgnA,
+ srcRgnB,
+ dstRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_RectInRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Rect r;
+ RgnHandle rgn;
+#ifndef RectInRgn
+ PyMac_PRECHECK(RectInRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetRect, &r,
+ ResObj_Convert, &rgn))
+ return NULL;
+ _rv = RectInRgn(&r,
+ rgn);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_MacEqualRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ RgnHandle rgnA;
+ RgnHandle rgnB;
+#ifndef MacEqualRgn
+ PyMac_PRECHECK(MacEqualRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &rgnA,
+ ResObj_Convert, &rgnB))
+ return NULL;
+ _rv = MacEqualRgn(rgnA,
+ rgnB);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_EmptyRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ RgnHandle rgn;
+#ifndef EmptyRgn
+ PyMac_PRECHECK(EmptyRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &rgn))
+ return NULL;
+ _rv = EmptyRgn(rgn);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_MacFrameRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+#ifndef MacFrameRgn
+ PyMac_PRECHECK(MacFrameRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &rgn))
+ return NULL;
+ MacFrameRgn(rgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MacPaintRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+#ifndef MacPaintRgn
+ PyMac_PRECHECK(MacPaintRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &rgn))
+ return NULL;
+ MacPaintRgn(rgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_EraseRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+#ifndef EraseRgn
+ PyMac_PRECHECK(EraseRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &rgn))
+ return NULL;
+ EraseRgn(rgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MacInvertRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+#ifndef MacInvertRgn
+ PyMac_PRECHECK(MacInvertRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &rgn))
+ return NULL;
+ MacInvertRgn(rgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MacFillRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+ Pattern *pat__in__;
+ int pat__in_len__;
+#ifndef MacFillRgn
+ PyMac_PRECHECK(MacFillRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&s#",
+ ResObj_Convert, &rgn,
+ (char **)&pat__in__, &pat__in_len__))
+ return NULL;
+ if (pat__in_len__ != sizeof(Pattern))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
+ goto pat__error__;
+ }
+ MacFillRgn(rgn,
+ pat__in__);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ pat__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_ScrollRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short dh;
+ short dv;
+ RgnHandle updateRgn;
+#ifndef ScrollRect
+ PyMac_PRECHECK(ScrollRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hhO&",
+ PyMac_GetRect, &r,
+ &dh,
+ &dv,
+ ResObj_Convert, &updateRgn))
+ return NULL;
+ ScrollRect(&r,
+ dh,
+ dv,
+ updateRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_CopyBits(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ BitMapPtr srcBits;
+ BitMapPtr dstBits;
+ Rect srcRect;
+ Rect dstRect;
+ short mode;
+ RgnHandle maskRgn;
+#ifndef CopyBits
+ PyMac_PRECHECK(CopyBits);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&hO&",
+ BMObj_Convert, &srcBits,
+ BMObj_Convert, &dstBits,
+ PyMac_GetRect, &srcRect,
+ PyMac_GetRect, &dstRect,
+ &mode,
+ OptResObj_Convert, &maskRgn))
+ return NULL;
+ CopyBits(srcBits,
+ dstBits,
+ &srcRect,
+ &dstRect,
+ mode,
+ maskRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_CopyMask(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ BitMapPtr srcBits;
+ BitMapPtr maskBits;
+ BitMapPtr dstBits;
+ Rect srcRect;
+ Rect maskRect;
+ Rect dstRect;
+#ifndef CopyMask
+ PyMac_PRECHECK(CopyMask);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&O&O&",
+ BMObj_Convert, &srcBits,
+ BMObj_Convert, &maskBits,
+ BMObj_Convert, &dstBits,
+ PyMac_GetRect, &srcRect,
+ PyMac_GetRect, &maskRect,
+ PyMac_GetRect, &dstRect))
+ return NULL;
+ CopyMask(srcBits,
+ maskBits,
+ dstBits,
+ &srcRect,
+ &maskRect,
+ &dstRect);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_OpenPicture(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PicHandle _rv;
+ Rect picFrame;
+#ifndef OpenPicture
+ PyMac_PRECHECK(OpenPicture);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &picFrame))
+ return NULL;
+ _rv = OpenPicture(&picFrame);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_PicComment(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short kind;
+ short dataSize;
+ Handle dataHandle;
+#ifndef PicComment
+ PyMac_PRECHECK(PicComment);
+#endif
+ if (!PyArg_ParseTuple(_args, "hhO&",
+ &kind,
+ &dataSize,
+ ResObj_Convert, &dataHandle))
+ return NULL;
+ PicComment(kind,
+ dataSize,
+ dataHandle);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_ClosePicture(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef ClosePicture
+ PyMac_PRECHECK(ClosePicture);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ClosePicture();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_DrawPicture(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PicHandle myPicture;
+ Rect dstRect;
+#ifndef DrawPicture
+ PyMac_PRECHECK(DrawPicture);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &myPicture,
+ PyMac_GetRect, &dstRect))
+ return NULL;
+ DrawPicture(myPicture,
+ &dstRect);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_KillPicture(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PicHandle myPicture;
+#ifndef KillPicture
+ PyMac_PRECHECK(KillPicture);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &myPicture))
+ return NULL;
+ KillPicture(myPicture);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_OpenPoly(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PolyHandle _rv;
+#ifndef OpenPoly
+ PyMac_PRECHECK(OpenPoly);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = OpenPoly();
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_ClosePoly(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef ClosePoly
+ PyMac_PRECHECK(ClosePoly);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ClosePoly();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_KillPoly(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PolyHandle poly;
+#ifndef KillPoly
+ PyMac_PRECHECK(KillPoly);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &poly))
+ return NULL;
+ KillPoly(poly);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_OffsetPoly(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PolyHandle poly;
+ short dh;
+ short dv;
+#ifndef OffsetPoly
+ PyMac_PRECHECK(OffsetPoly);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ ResObj_Convert, &poly,
+ &dh,
+ &dv))
+ return NULL;
+ OffsetPoly(poly,
+ dh,
+ dv);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_FramePoly(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PolyHandle poly;
+#ifndef FramePoly
+ PyMac_PRECHECK(FramePoly);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &poly))
+ return NULL;
+ FramePoly(poly);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_PaintPoly(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PolyHandle poly;
+#ifndef PaintPoly
+ PyMac_PRECHECK(PaintPoly);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &poly))
+ return NULL;
+ PaintPoly(poly);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_ErasePoly(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PolyHandle poly;
+#ifndef ErasePoly
+ PyMac_PRECHECK(ErasePoly);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &poly))
+ return NULL;
+ ErasePoly(poly);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_InvertPoly(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PolyHandle poly;
+#ifndef InvertPoly
+ PyMac_PRECHECK(InvertPoly);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &poly))
+ return NULL;
+ InvertPoly(poly);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_FillPoly(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PolyHandle poly;
+ Pattern *pat__in__;
+ int pat__in_len__;
+#ifndef FillPoly
+ PyMac_PRECHECK(FillPoly);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&s#",
+ ResObj_Convert, &poly,
+ (char **)&pat__in__, &pat__in_len__))
+ return NULL;
+ if (pat__in_len__ != sizeof(Pattern))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
+ goto pat__error__;
+ }
+ FillPoly(poly,
+ pat__in__);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ pat__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_SetPt(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point pt;
+ short h;
+ short v;
+#ifndef SetPt
+ PyMac_PRECHECK(SetPt);
+#endif
+ if (!PyArg_ParseTuple(_args, "hh",
+ &h,
+ &v))
+ return NULL;
+ SetPt(&pt,
+ h,
+ v);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, pt);
+ return _res;
+}
+
+static PyObject *Qd_LocalToGlobal(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point pt;
+#ifndef LocalToGlobal
+ PyMac_PRECHECK(LocalToGlobal);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &pt))
+ return NULL;
+ LocalToGlobal(&pt);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, pt);
+ return _res;
+}
+
+static PyObject *Qd_GlobalToLocal(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point pt;
+#ifndef GlobalToLocal
+ PyMac_PRECHECK(GlobalToLocal);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &pt))
+ return NULL;
+ GlobalToLocal(&pt);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, pt);
+ return _res;
+}
+
+static PyObject *Qd_Random(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+#ifndef Random
+ PyMac_PRECHECK(Random);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = Random();
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_MacGetPixel(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ short h;
+ short v;
+#ifndef MacGetPixel
+ PyMac_PRECHECK(MacGetPixel);
+#endif
+ if (!PyArg_ParseTuple(_args, "hh",
+ &h,
+ &v))
+ return NULL;
+ _rv = MacGetPixel(h,
+ v);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_ScalePt(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point pt;
+ Rect srcRect;
+ Rect dstRect;
+#ifndef ScalePt
+ PyMac_PRECHECK(ScalePt);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ PyMac_GetPoint, &pt,
+ PyMac_GetRect, &srcRect,
+ PyMac_GetRect, &dstRect))
+ return NULL;
+ ScalePt(&pt,
+ &srcRect,
+ &dstRect);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, pt);
+ return _res;
+}
+
+static PyObject *Qd_MapPt(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point pt;
+ Rect srcRect;
+ Rect dstRect;
+#ifndef MapPt
+ PyMac_PRECHECK(MapPt);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ PyMac_GetPoint, &pt,
+ PyMac_GetRect, &srcRect,
+ PyMac_GetRect, &dstRect))
+ return NULL;
+ MapPt(&pt,
+ &srcRect,
+ &dstRect);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, pt);
+ return _res;
+}
+
+static PyObject *Qd_MapRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ Rect srcRect;
+ Rect dstRect;
+#ifndef MapRect
+ PyMac_PRECHECK(MapRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ PyMac_GetRect, &r,
+ PyMac_GetRect, &srcRect,
+ PyMac_GetRect, &dstRect))
+ return NULL;
+ MapRect(&r,
+ &srcRect,
+ &dstRect);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &r);
+ return _res;
+}
+
+static PyObject *Qd_MapRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+ Rect srcRect;
+ Rect dstRect;
+#ifndef MapRgn
+ PyMac_PRECHECK(MapRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ ResObj_Convert, &rgn,
+ PyMac_GetRect, &srcRect,
+ PyMac_GetRect, &dstRect))
+ return NULL;
+ MapRgn(rgn,
+ &srcRect,
+ &dstRect);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MapPoly(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PolyHandle poly;
+ Rect srcRect;
+ Rect dstRect;
+#ifndef MapPoly
+ PyMac_PRECHECK(MapPoly);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ ResObj_Convert, &poly,
+ PyMac_GetRect, &srcRect,
+ PyMac_GetRect, &dstRect))
+ return NULL;
+ MapPoly(poly,
+ &srcRect,
+ &dstRect);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_StdBits(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ BitMapPtr srcBits;
+ Rect srcRect;
+ Rect dstRect;
+ short mode;
+ RgnHandle maskRgn;
+#ifndef StdBits
+ PyMac_PRECHECK(StdBits);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&hO&",
+ BMObj_Convert, &srcBits,
+ PyMac_GetRect, &srcRect,
+ PyMac_GetRect, &dstRect,
+ &mode,
+ OptResObj_Convert, &maskRgn))
+ return NULL;
+ StdBits(srcBits,
+ &srcRect,
+ &dstRect,
+ mode,
+ maskRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_AddPt(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point src;
+ Point dst;
+#ifndef AddPt
+ PyMac_PRECHECK(AddPt);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetPoint, &src,
+ PyMac_GetPoint, &dst))
+ return NULL;
+ AddPt(src,
+ &dst);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, dst);
+ return _res;
+}
+
+static PyObject *Qd_EqualPt(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Point pt1;
+ Point pt2;
+#ifndef EqualPt
+ PyMac_PRECHECK(EqualPt);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetPoint, &pt1,
+ PyMac_GetPoint, &pt2))
+ return NULL;
+ _rv = EqualPt(pt1,
+ pt2);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_MacPtInRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Point pt;
+ Rect r;
+#ifndef MacPtInRect
+ PyMac_PRECHECK(MacPtInRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetPoint, &pt,
+ PyMac_GetRect, &r))
+ return NULL;
+ _rv = MacPtInRect(pt,
+ &r);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_Pt2Rect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point pt1;
+ Point pt2;
+ Rect dstRect;
+#ifndef Pt2Rect
+ PyMac_PRECHECK(Pt2Rect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetPoint, &pt1,
+ PyMac_GetPoint, &pt2))
+ return NULL;
+ Pt2Rect(pt1,
+ pt2,
+ &dstRect);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &dstRect);
+ return _res;
+}
+
+static PyObject *Qd_PtToAngle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ Point pt;
+ short angle;
+#ifndef PtToAngle
+ PyMac_PRECHECK(PtToAngle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetRect, &r,
+ PyMac_GetPoint, &pt))
+ return NULL;
+ PtToAngle(&r,
+ pt,
+ &angle);
+ _res = Py_BuildValue("h",
+ angle);
+ return _res;
+}
+
+static PyObject *Qd_SubPt(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point src;
+ Point dst;
+#ifndef SubPt
+ PyMac_PRECHECK(SubPt);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetPoint, &src,
+ PyMac_GetPoint, &dst))
+ return NULL;
+ SubPt(src,
+ &dst);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, dst);
+ return _res;
+}
+
+static PyObject *Qd_PtInRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Point pt;
+ RgnHandle rgn;
+#ifndef PtInRgn
+ PyMac_PRECHECK(PtInRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetPoint, &pt,
+ ResObj_Convert, &rgn))
+ return NULL;
+ _rv = PtInRgn(pt,
+ rgn);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_NewPixMap(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixMapHandle _rv;
+#ifndef NewPixMap
+ PyMac_PRECHECK(NewPixMap);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = NewPixMap();
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_DisposePixMap(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixMapHandle pm;
+#ifndef DisposePixMap
+ PyMac_PRECHECK(DisposePixMap);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &pm))
+ return NULL;
+ DisposePixMap(pm);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_CopyPixMap(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixMapHandle srcPM;
+ PixMapHandle dstPM;
+#ifndef CopyPixMap
+ PyMac_PRECHECK(CopyPixMap);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &srcPM,
+ ResObj_Convert, &dstPM))
+ return NULL;
+ CopyPixMap(srcPM,
+ dstPM);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_NewPixPat(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixPatHandle _rv;
+#ifndef NewPixPat
+ PyMac_PRECHECK(NewPixPat);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = NewPixPat();
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_DisposePixPat(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixPatHandle pp;
+#ifndef DisposePixPat
+ PyMac_PRECHECK(DisposePixPat);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &pp))
+ return NULL;
+ DisposePixPat(pp);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_CopyPixPat(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixPatHandle srcPP;
+ PixPatHandle dstPP;
+#ifndef CopyPixPat
+ PyMac_PRECHECK(CopyPixPat);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &srcPP,
+ ResObj_Convert, &dstPP))
+ return NULL;
+ CopyPixPat(srcPP,
+ dstPP);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_PenPixPat(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixPatHandle pp;
+#ifndef PenPixPat
+ PyMac_PRECHECK(PenPixPat);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &pp))
+ return NULL;
+ PenPixPat(pp);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_BackPixPat(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixPatHandle pp;
+#ifndef BackPixPat
+ PyMac_PRECHECK(BackPixPat);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &pp))
+ return NULL;
+ BackPixPat(pp);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_GetPixPat(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixPatHandle _rv;
+ short patID;
+#ifndef GetPixPat
+ PyMac_PRECHECK(GetPixPat);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &patID))
+ return NULL;
+ _rv = GetPixPat(patID);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_MakeRGBPat(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixPatHandle pp;
+ RGBColor myColor;
+#ifndef MakeRGBPat
+ PyMac_PRECHECK(MakeRGBPat);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &pp,
+ QdRGB_Convert, &myColor))
+ return NULL;
+ MakeRGBPat(pp,
+ &myColor);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_FillCRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ PixPatHandle pp;
+#ifndef FillCRect
+ PyMac_PRECHECK(FillCRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetRect, &r,
+ ResObj_Convert, &pp))
+ return NULL;
+ FillCRect(&r,
+ pp);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_FillCOval(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ PixPatHandle pp;
+#ifndef FillCOval
+ PyMac_PRECHECK(FillCOval);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetRect, &r,
+ ResObj_Convert, &pp))
+ return NULL;
+ FillCOval(&r,
+ pp);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_FillCRoundRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short ovalWidth;
+ short ovalHeight;
+ PixPatHandle pp;
+#ifndef FillCRoundRect
+ PyMac_PRECHECK(FillCRoundRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hhO&",
+ PyMac_GetRect, &r,
+ &ovalWidth,
+ &ovalHeight,
+ ResObj_Convert, &pp))
+ return NULL;
+ FillCRoundRect(&r,
+ ovalWidth,
+ ovalHeight,
+ pp);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_FillCArc(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short startAngle;
+ short arcAngle;
+ PixPatHandle pp;
+#ifndef FillCArc
+ PyMac_PRECHECK(FillCArc);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hhO&",
+ PyMac_GetRect, &r,
+ &startAngle,
+ &arcAngle,
+ ResObj_Convert, &pp))
+ return NULL;
+ FillCArc(&r,
+ startAngle,
+ arcAngle,
+ pp);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_FillCRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+ PixPatHandle pp;
+#ifndef FillCRgn
+ PyMac_PRECHECK(FillCRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &rgn,
+ ResObj_Convert, &pp))
+ return NULL;
+ FillCRgn(rgn,
+ pp);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_FillCPoly(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PolyHandle poly;
+ PixPatHandle pp;
+#ifndef FillCPoly
+ PyMac_PRECHECK(FillCPoly);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &poly,
+ ResObj_Convert, &pp))
+ return NULL;
+ FillCPoly(poly,
+ pp);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_RGBForeColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RGBColor color;
+#ifndef RGBForeColor
+ PyMac_PRECHECK(RGBForeColor);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ QdRGB_Convert, &color))
+ return NULL;
+ RGBForeColor(&color);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_RGBBackColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RGBColor color;
+#ifndef RGBBackColor
+ PyMac_PRECHECK(RGBBackColor);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ QdRGB_Convert, &color))
+ return NULL;
+ RGBBackColor(&color);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_SetCPixel(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short h;
+ short v;
+ RGBColor cPix;
+#ifndef SetCPixel
+ PyMac_PRECHECK(SetCPixel);
+#endif
+ if (!PyArg_ParseTuple(_args, "hhO&",
+ &h,
+ &v,
+ QdRGB_Convert, &cPix))
+ return NULL;
+ SetCPixel(h,
+ v,
+ &cPix);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_SetPortPix(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixMapHandle pm;
+#ifndef SetPortPix
+ PyMac_PRECHECK(SetPortPix);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &pm))
+ return NULL;
+ SetPortPix(pm);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_GetCPixel(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short h;
+ short v;
+ RGBColor cPix;
+#ifndef GetCPixel
+ PyMac_PRECHECK(GetCPixel);
+#endif
+ if (!PyArg_ParseTuple(_args, "hh",
+ &h,
+ &v))
+ return NULL;
+ GetCPixel(h,
+ v,
+ &cPix);
+ _res = Py_BuildValue("O&",
+ QdRGB_New, &cPix);
+ return _res;
+}
+
+static PyObject *Qd_GetForeColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RGBColor color;
+#ifndef GetForeColor
+ PyMac_PRECHECK(GetForeColor);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetForeColor(&color);
+ _res = Py_BuildValue("O&",
+ QdRGB_New, &color);
+ return _res;
+}
+
+static PyObject *Qd_GetBackColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RGBColor color;
+#ifndef GetBackColor
+ PyMac_PRECHECK(GetBackColor);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetBackColor(&color);
+ _res = Py_BuildValue("O&",
+ QdRGB_New, &color);
+ return _res;
+}
+
+static PyObject *Qd_OpColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RGBColor color;
+#ifndef OpColor
+ PyMac_PRECHECK(OpColor);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ QdRGB_Convert, &color))
+ return NULL;
+ OpColor(&color);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_HiliteColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RGBColor color;
+#ifndef HiliteColor
+ PyMac_PRECHECK(HiliteColor);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ QdRGB_Convert, &color))
+ return NULL;
+ HiliteColor(&color);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_DisposeCTable(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CTabHandle cTable;
+#ifndef DisposeCTable
+ PyMac_PRECHECK(DisposeCTable);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &cTable))
+ return NULL;
+ DisposeCTable(cTable);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_GetCTable(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CTabHandle _rv;
+ short ctID;
+#ifndef GetCTable
+ PyMac_PRECHECK(GetCTable);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &ctID))
+ return NULL;
+ _rv = GetCTable(ctID);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_GetCCursor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CCrsrHandle _rv;
+ short crsrID;
+#ifndef GetCCursor
+ PyMac_PRECHECK(GetCCursor);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &crsrID))
+ return NULL;
+ _rv = GetCCursor(crsrID);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_SetCCursor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CCrsrHandle cCrsr;
+#ifndef SetCCursor
+ PyMac_PRECHECK(SetCCursor);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &cCrsr))
+ return NULL;
+ SetCCursor(cCrsr);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_AllocCursor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef AllocCursor
+ PyMac_PRECHECK(AllocCursor);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ AllocCursor();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_DisposeCCursor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CCrsrHandle cCrsr;
+#ifndef DisposeCCursor
+ PyMac_PRECHECK(DisposeCCursor);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &cCrsr))
+ return NULL;
+ DisposeCCursor(cCrsr);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_GetMaxDevice(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GDHandle _rv;
+ Rect globalRect;
+#ifndef GetMaxDevice
+ PyMac_PRECHECK(GetMaxDevice);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &globalRect))
+ return NULL;
+ _rv = GetMaxDevice(&globalRect);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_GetCTSeed(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+#ifndef GetCTSeed
+ PyMac_PRECHECK(GetCTSeed);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetCTSeed();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_GetDeviceList(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GDHandle _rv;
+#ifndef GetDeviceList
+ PyMac_PRECHECK(GetDeviceList);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetDeviceList();
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_GetMainDevice(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GDHandle _rv;
+#ifndef GetMainDevice
+ PyMac_PRECHECK(GetMainDevice);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMainDevice();
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_GetNextDevice(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GDHandle _rv;
+ GDHandle curDevice;
+#ifndef GetNextDevice
+ PyMac_PRECHECK(GetNextDevice);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &curDevice))
+ return NULL;
+ _rv = GetNextDevice(curDevice);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_TestDeviceAttribute(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ GDHandle gdh;
+ short attribute;
+#ifndef TestDeviceAttribute
+ PyMac_PRECHECK(TestDeviceAttribute);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ ResObj_Convert, &gdh,
+ &attribute))
+ return NULL;
+ _rv = TestDeviceAttribute(gdh,
+ attribute);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_SetDeviceAttribute(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GDHandle gdh;
+ short attribute;
+ Boolean value;
+#ifndef SetDeviceAttribute
+ PyMac_PRECHECK(SetDeviceAttribute);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hb",
+ ResObj_Convert, &gdh,
+ &attribute,
+ &value))
+ return NULL;
+ SetDeviceAttribute(gdh,
+ attribute,
+ value);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_InitGDevice(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short qdRefNum;
+ long mode;
+ GDHandle gdh;
+#ifndef InitGDevice
+ PyMac_PRECHECK(InitGDevice);
+#endif
+ if (!PyArg_ParseTuple(_args, "hlO&",
+ &qdRefNum,
+ &mode,
+ ResObj_Convert, &gdh))
+ return NULL;
+ InitGDevice(qdRefNum,
+ mode,
+ gdh);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_NewGDevice(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GDHandle _rv;
+ short refNum;
+ long mode;
+#ifndef NewGDevice
+ PyMac_PRECHECK(NewGDevice);
+#endif
+ if (!PyArg_ParseTuple(_args, "hl",
+ &refNum,
+ &mode))
+ return NULL;
+ _rv = NewGDevice(refNum,
+ mode);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_DisposeGDevice(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GDHandle gdh;
+#ifndef DisposeGDevice
+ PyMac_PRECHECK(DisposeGDevice);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &gdh))
+ return NULL;
+ DisposeGDevice(gdh);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_SetGDevice(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GDHandle gd;
+#ifndef SetGDevice
+ PyMac_PRECHECK(SetGDevice);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &gd))
+ return NULL;
+ SetGDevice(gd);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_GetGDevice(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GDHandle _rv;
+#ifndef GetGDevice
+ PyMac_PRECHECK(GetGDevice);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetGDevice();
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_Color2Index(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ RGBColor myColor;
+#ifndef Color2Index
+ PyMac_PRECHECK(Color2Index);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ QdRGB_Convert, &myColor))
+ return NULL;
+ _rv = Color2Index(&myColor);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_Index2Color(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long index;
+ RGBColor aColor;
+#ifndef Index2Color
+ PyMac_PRECHECK(Index2Color);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &index))
+ return NULL;
+ Index2Color(index,
+ &aColor);
+ _res = Py_BuildValue("O&",
+ QdRGB_New, &aColor);
+ return _res;
+}
+
+static PyObject *Qd_InvertColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RGBColor myColor;
+#ifndef InvertColor
+ PyMac_PRECHECK(InvertColor);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ InvertColor(&myColor);
+ _res = Py_BuildValue("O&",
+ QdRGB_New, &myColor);
+ return _res;
+}
+
+static PyObject *Qd_RealColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ RGBColor color;
+#ifndef RealColor
+ PyMac_PRECHECK(RealColor);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ QdRGB_Convert, &color))
+ return NULL;
+ _rv = RealColor(&color);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_GetSubTable(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CTabHandle myColors;
+ short iTabRes;
+ CTabHandle targetTbl;
+#ifndef GetSubTable
+ PyMac_PRECHECK(GetSubTable);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hO&",
+ ResObj_Convert, &myColors,
+ &iTabRes,
+ ResObj_Convert, &targetTbl))
+ return NULL;
+ GetSubTable(myColors,
+ iTabRes,
+ targetTbl);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MakeITable(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CTabHandle cTabH;
+ ITabHandle iTabH;
+ short res;
+#ifndef MakeITable
+ PyMac_PRECHECK(MakeITable);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&h",
+ ResObj_Convert, &cTabH,
+ ResObj_Convert, &iTabH,
+ &res))
+ return NULL;
+ MakeITable(cTabH,
+ iTabH,
+ res);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_SetClientID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short id;
+#ifndef SetClientID
+ PyMac_PRECHECK(SetClientID);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &id))
+ return NULL;
+ SetClientID(id);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_ProtectEntry(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short index;
+ Boolean protect;
+#ifndef ProtectEntry
+ PyMac_PRECHECK(ProtectEntry);
+#endif
+ if (!PyArg_ParseTuple(_args, "hb",
+ &index,
+ &protect))
+ return NULL;
+ ProtectEntry(index,
+ protect);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_ReserveEntry(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short index;
+ Boolean reserve;
+#ifndef ReserveEntry
+ PyMac_PRECHECK(ReserveEntry);
+#endif
+ if (!PyArg_ParseTuple(_args, "hb",
+ &index,
+ &reserve))
+ return NULL;
+ ReserveEntry(index,
+ reserve);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_QDError(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+#ifndef QDError
+ PyMac_PRECHECK(QDError);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = QDError();
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_CopyDeepMask(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ BitMapPtr srcBits;
+ BitMapPtr maskBits;
+ BitMapPtr dstBits;
+ Rect srcRect;
+ Rect maskRect;
+ Rect dstRect;
+ short mode;
+ RgnHandle maskRgn;
+#ifndef CopyDeepMask
+ PyMac_PRECHECK(CopyDeepMask);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&O&O&hO&",
+ BMObj_Convert, &srcBits,
+ BMObj_Convert, &maskBits,
+ BMObj_Convert, &dstBits,
+ PyMac_GetRect, &srcRect,
+ PyMac_GetRect, &maskRect,
+ PyMac_GetRect, &dstRect,
+ &mode,
+ OptResObj_Convert, &maskRgn))
+ return NULL;
+ CopyDeepMask(srcBits,
+ maskBits,
+ dstBits,
+ &srcRect,
+ &maskRect,
+ &dstRect,
+ mode,
+ maskRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_GetPattern(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PatHandle _rv;
+ short patternID;
+#ifndef GetPattern
+ PyMac_PRECHECK(GetPattern);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &patternID))
+ return NULL;
+ _rv = GetPattern(patternID);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_MacGetCursor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CursHandle _rv;
+ short cursorID;
+#ifndef MacGetCursor
+ PyMac_PRECHECK(MacGetCursor);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &cursorID))
+ return NULL;
+ _rv = MacGetCursor(cursorID);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_GetPicture(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PicHandle _rv;
+ short pictureID;
+#ifndef GetPicture
+ PyMac_PRECHECK(GetPicture);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &pictureID))
+ return NULL;
+ _rv = GetPicture(pictureID);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_DeltaPoint(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ Point ptA;
+ Point ptB;
+#ifndef DeltaPoint
+ PyMac_PRECHECK(DeltaPoint);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetPoint, &ptA,
+ PyMac_GetPoint, &ptB))
+ return NULL;
+ _rv = DeltaPoint(ptA,
+ ptB);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_ShieldCursor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect shieldRect;
+ Point offsetPt;
+#ifndef ShieldCursor
+ PyMac_PRECHECK(ShieldCursor);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetRect, &shieldRect,
+ PyMac_GetPoint, &offsetPt))
+ return NULL;
+ ShieldCursor(&shieldRect,
+ offsetPt);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_ScreenRes(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short scrnHRes;
+ short scrnVRes;
+#ifndef ScreenRes
+ PyMac_PRECHECK(ScreenRes);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ScreenRes(&scrnHRes,
+ &scrnVRes);
+ _res = Py_BuildValue("hh",
+ scrnHRes,
+ scrnVRes);
+ return _res;
+}
+
+static PyObject *Qd_GetIndPattern(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Pattern thePat__out__;
+ short patternListID;
+ short index;
+#ifndef GetIndPattern
+ PyMac_PRECHECK(GetIndPattern);
+#endif
+ if (!PyArg_ParseTuple(_args, "hh",
+ &patternListID,
+ &index))
+ return NULL;
+ GetIndPattern(&thePat__out__,
+ patternListID,
+ index);
+ _res = Py_BuildValue("s#",
+ (char *)&thePat__out__, (int)sizeof(Pattern));
+ return _res;
+}
+
+static PyObject *Qd_SlopeFromAngle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Fixed _rv;
+ short angle;
+#ifndef SlopeFromAngle
+ PyMac_PRECHECK(SlopeFromAngle);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &angle))
+ return NULL;
+ _rv = SlopeFromAngle(angle);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildFixed, _rv);
+ return _res;
+}
+
+static PyObject *Qd_AngleFromSlope(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ Fixed slope;
+#ifndef AngleFromSlope
+ PyMac_PRECHECK(AngleFromSlope);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetFixed, &slope))
+ return NULL;
+ _rv = AngleFromSlope(slope);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_GetPixBounds(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixMapHandle pixMap;
+ Rect bounds;
+#ifndef GetPixBounds
+ PyMac_PRECHECK(GetPixBounds);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &pixMap))
+ return NULL;
+ GetPixBounds(pixMap,
+ &bounds);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &bounds);
+ return _res;
+}
+
+static PyObject *Qd_GetPixDepth(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ PixMapHandle pixMap;
+#ifndef GetPixDepth
+ PyMac_PRECHECK(GetPixDepth);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &pixMap))
+ return NULL;
+ _rv = GetPixDepth(pixMap);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_GetQDGlobalsRandomSeed(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+#ifndef GetQDGlobalsRandomSeed
+ PyMac_PRECHECK(GetQDGlobalsRandomSeed);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetQDGlobalsRandomSeed();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_GetQDGlobalsScreenBits(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ BitMap screenBits;
+#ifndef GetQDGlobalsScreenBits
+ PyMac_PRECHECK(GetQDGlobalsScreenBits);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetQDGlobalsScreenBits(&screenBits);
+ _res = Py_BuildValue("O&",
+ BMObj_NewCopied, &screenBits);
+ return _res;
+}
+
+static PyObject *Qd_GetQDGlobalsArrow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Cursor arrow__out__;
+#ifndef GetQDGlobalsArrow
+ PyMac_PRECHECK(GetQDGlobalsArrow);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetQDGlobalsArrow(&arrow__out__);
+ _res = Py_BuildValue("s#",
+ (char *)&arrow__out__, (int)sizeof(Cursor));
+ return _res;
+}
+
+static PyObject *Qd_GetQDGlobalsDarkGray(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Pattern dkGray__out__;
+#ifndef GetQDGlobalsDarkGray
+ PyMac_PRECHECK(GetQDGlobalsDarkGray);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetQDGlobalsDarkGray(&dkGray__out__);
+ _res = Py_BuildValue("s#",
+ (char *)&dkGray__out__, (int)sizeof(Pattern));
+ return _res;
+}
+
+static PyObject *Qd_GetQDGlobalsLightGray(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Pattern ltGray__out__;
+#ifndef GetQDGlobalsLightGray
+ PyMac_PRECHECK(GetQDGlobalsLightGray);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetQDGlobalsLightGray(&ltGray__out__);
+ _res = Py_BuildValue("s#",
+ (char *)&ltGray__out__, (int)sizeof(Pattern));
+ return _res;
+}
+
+static PyObject *Qd_GetQDGlobalsGray(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Pattern gray__out__;
+#ifndef GetQDGlobalsGray
+ PyMac_PRECHECK(GetQDGlobalsGray);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetQDGlobalsGray(&gray__out__);
+ _res = Py_BuildValue("s#",
+ (char *)&gray__out__, (int)sizeof(Pattern));
+ return _res;
+}
+
+static PyObject *Qd_GetQDGlobalsBlack(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Pattern black__out__;
+#ifndef GetQDGlobalsBlack
+ PyMac_PRECHECK(GetQDGlobalsBlack);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetQDGlobalsBlack(&black__out__);
+ _res = Py_BuildValue("s#",
+ (char *)&black__out__, (int)sizeof(Pattern));
+ return _res;
+}
+
+static PyObject *Qd_GetQDGlobalsWhite(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Pattern white__out__;
+#ifndef GetQDGlobalsWhite
+ PyMac_PRECHECK(GetQDGlobalsWhite);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetQDGlobalsWhite(&white__out__);
+ _res = Py_BuildValue("s#",
+ (char *)&white__out__, (int)sizeof(Pattern));
+ return _res;
+}
+
+static PyObject *Qd_GetQDGlobalsThePort(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr _rv;
+#ifndef GetQDGlobalsThePort
+ PyMac_PRECHECK(GetQDGlobalsThePort);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetQDGlobalsThePort();
+ _res = Py_BuildValue("O&",
+ GrafObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_SetQDGlobalsRandomSeed(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long randomSeed;
+#ifndef SetQDGlobalsRandomSeed
+ PyMac_PRECHECK(SetQDGlobalsRandomSeed);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &randomSeed))
+ return NULL;
+ SetQDGlobalsRandomSeed(randomSeed);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_SetQDGlobalsArrow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Cursor *arrow__in__;
+ int arrow__in_len__;
+#ifndef SetQDGlobalsArrow
+ PyMac_PRECHECK(SetQDGlobalsArrow);
+#endif
+ if (!PyArg_ParseTuple(_args, "s#",
+ (char **)&arrow__in__, &arrow__in_len__))
+ return NULL;
+ if (arrow__in_len__ != sizeof(Cursor))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Cursor)");
+ goto arrow__error__;
+ }
+ SetQDGlobalsArrow(arrow__in__);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ arrow__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_GetRegionBounds(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle region;
+ Rect bounds;
+#ifndef GetRegionBounds
+ PyMac_PRECHECK(GetRegionBounds);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &region))
+ return NULL;
+ GetRegionBounds(region,
+ &bounds);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &bounds);
+ return _res;
+}
+
+static PyObject *Qd_IsRegionRectangular(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ RgnHandle region;
+#ifndef IsRegionRectangular
+ PyMac_PRECHECK(IsRegionRectangular);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &region))
+ return NULL;
+ _rv = IsRegionRectangular(region);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_CreateNewPort(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr _rv;
+#ifndef CreateNewPort
+ PyMac_PRECHECK(CreateNewPort);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CreateNewPort();
+ _res = Py_BuildValue("O&",
+ GrafObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_SetQDError(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr err;
+#ifndef SetQDError
+ PyMac_PRECHECK(SetQDError);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &err))
+ return NULL;
+ SetQDError(err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_LMGetScrVRes(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 _rv;
+#ifndef LMGetScrVRes
+ PyMac_PRECHECK(LMGetScrVRes);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = LMGetScrVRes();
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_LMSetScrVRes(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 value;
+#ifndef LMSetScrVRes
+ PyMac_PRECHECK(LMSetScrVRes);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &value))
+ return NULL;
+ LMSetScrVRes(value);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_LMGetScrHRes(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 _rv;
+#ifndef LMGetScrHRes
+ PyMac_PRECHECK(LMGetScrHRes);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = LMGetScrHRes();
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_LMSetScrHRes(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 value;
+#ifndef LMSetScrHRes
+ PyMac_PRECHECK(LMSetScrHRes);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &value))
+ return NULL;
+ LMSetScrHRes(value);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_LMGetMainDevice(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GDHandle _rv;
+#ifndef LMGetMainDevice
+ PyMac_PRECHECK(LMGetMainDevice);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = LMGetMainDevice();
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_LMSetMainDevice(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GDHandle value;
+#ifndef LMSetMainDevice
+ PyMac_PRECHECK(LMSetMainDevice);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &value))
+ return NULL;
+ LMSetMainDevice(value);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_LMGetDeviceList(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GDHandle _rv;
+#ifndef LMGetDeviceList
+ PyMac_PRECHECK(LMGetDeviceList);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = LMGetDeviceList();
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_LMSetDeviceList(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GDHandle value;
+#ifndef LMSetDeviceList
+ PyMac_PRECHECK(LMSetDeviceList);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &value))
+ return NULL;
+ LMSetDeviceList(value);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_LMGetQDColors(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+#ifndef LMGetQDColors
+ PyMac_PRECHECK(LMGetQDColors);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = LMGetQDColors();
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_LMSetQDColors(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle value;
+#ifndef LMSetQDColors
+ PyMac_PRECHECK(LMSetQDColors);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &value))
+ return NULL;
+ LMSetQDColors(value);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_LMGetWidthListHand(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+#ifndef LMGetWidthListHand
+ PyMac_PRECHECK(LMGetWidthListHand);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = LMGetWidthListHand();
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_LMSetWidthListHand(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle value;
+#ifndef LMSetWidthListHand
+ PyMac_PRECHECK(LMSetWidthListHand);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &value))
+ return NULL;
+ LMSetWidthListHand(value);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_LMGetHiliteMode(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UInt8 _rv;
+#ifndef LMGetHiliteMode
+ PyMac_PRECHECK(LMGetHiliteMode);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = LMGetHiliteMode();
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_LMSetHiliteMode(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UInt8 value;
+#ifndef LMSetHiliteMode
+ PyMac_PRECHECK(LMSetHiliteMode);
+#endif
+ if (!PyArg_ParseTuple(_args, "b",
+ &value))
+ return NULL;
+ LMSetHiliteMode(value);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_LMGetWidthTabHandle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+#ifndef LMGetWidthTabHandle
+ PyMac_PRECHECK(LMGetWidthTabHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = LMGetWidthTabHandle();
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_LMSetWidthTabHandle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle value;
+#ifndef LMSetWidthTabHandle
+ PyMac_PRECHECK(LMSetWidthTabHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &value))
+ return NULL;
+ LMSetWidthTabHandle(value);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_LMGetLastSPExtra(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 _rv;
+#ifndef LMGetLastSPExtra
+ PyMac_PRECHECK(LMGetLastSPExtra);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = LMGetLastSPExtra();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_LMSetLastSPExtra(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 value;
+#ifndef LMSetLastSPExtra
+ PyMac_PRECHECK(LMSetLastSPExtra);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &value))
+ return NULL;
+ LMSetLastSPExtra(value);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_LMGetLastFOND(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+#ifndef LMGetLastFOND
+ PyMac_PRECHECK(LMGetLastFOND);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = LMGetLastFOND();
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_LMSetLastFOND(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle value;
+#ifndef LMSetLastFOND
+ PyMac_PRECHECK(LMSetLastFOND);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &value))
+ return NULL;
+ LMSetLastFOND(value);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_LMGetFractEnable(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UInt8 _rv;
+#ifndef LMGetFractEnable
+ PyMac_PRECHECK(LMGetFractEnable);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = LMGetFractEnable();
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_LMSetFractEnable(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UInt8 value;
+#ifndef LMSetFractEnable
+ PyMac_PRECHECK(LMSetFractEnable);
+#endif
+ if (!PyArg_ParseTuple(_args, "b",
+ &value))
+ return NULL;
+ LMSetFractEnable(value);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_LMGetTheGDevice(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GDHandle _rv;
+#ifndef LMGetTheGDevice
+ PyMac_PRECHECK(LMGetTheGDevice);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = LMGetTheGDevice();
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_LMSetTheGDevice(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GDHandle value;
+#ifndef LMSetTheGDevice
+ PyMac_PRECHECK(LMSetTheGDevice);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &value))
+ return NULL;
+ LMSetTheGDevice(value);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_LMGetHiliteRGB(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RGBColor hiliteRGBValue;
+#ifndef LMGetHiliteRGB
+ PyMac_PRECHECK(LMGetHiliteRGB);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ LMGetHiliteRGB(&hiliteRGBValue);
+ _res = Py_BuildValue("O&",
+ QdRGB_New, &hiliteRGBValue);
+ return _res;
+}
+
+static PyObject *Qd_LMSetHiliteRGB(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RGBColor hiliteRGBValue;
+#ifndef LMSetHiliteRGB
+ PyMac_PRECHECK(LMSetHiliteRGB);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ QdRGB_Convert, &hiliteRGBValue))
+ return NULL;
+ LMSetHiliteRGB(&hiliteRGBValue);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_LMGetCursorNew(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef LMGetCursorNew
+ PyMac_PRECHECK(LMGetCursorNew);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = LMGetCursorNew();
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_LMSetCursorNew(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean value;
+#ifndef LMSetCursorNew
+ PyMac_PRECHECK(LMSetCursorNew);
+#endif
+ if (!PyArg_ParseTuple(_args, "b",
+ &value))
+ return NULL;
+ LMSetCursorNew(value);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_TextFont(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short font;
+#ifndef TextFont
+ PyMac_PRECHECK(TextFont);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &font))
+ return NULL;
+ TextFont(font);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_TextFace(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ StyleParameter face;
+#ifndef TextFace
+ PyMac_PRECHECK(TextFace);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &face))
+ return NULL;
+ TextFace(face);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_TextMode(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short mode;
+#ifndef TextMode
+ PyMac_PRECHECK(TextMode);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &mode))
+ return NULL;
+ TextMode(mode);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_TextSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short size;
+#ifndef TextSize
+ PyMac_PRECHECK(TextSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &size))
+ return NULL;
+ TextSize(size);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_SpaceExtra(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Fixed extra;
+#ifndef SpaceExtra
+ PyMac_PRECHECK(SpaceExtra);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetFixed, &extra))
+ return NULL;
+ SpaceExtra(extra);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_DrawChar(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CharParameter ch;
+#ifndef DrawChar
+ PyMac_PRECHECK(DrawChar);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &ch))
+ return NULL;
+ DrawChar(ch);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_DrawString(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Str255 s;
+#ifndef DrawString
+ PyMac_PRECHECK(DrawString);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetStr255, s))
+ return NULL;
+ DrawString(s);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MacDrawText(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ char *textBuf__in__;
+ int textBuf__in_len__;
+ short firstByte;
+ short byteCount;
+#ifndef MacDrawText
+ PyMac_PRECHECK(MacDrawText);
+#endif
+ if (!PyArg_ParseTuple(_args, "s#hh",
+ &textBuf__in__, &textBuf__in_len__,
+ &firstByte,
+ &byteCount))
+ return NULL;
+ /* Fool compiler warnings */
+ textBuf__in_len__ = textBuf__in_len__;
+ MacDrawText(textBuf__in__,
+ firstByte,
+ byteCount);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_CharWidth(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ CharParameter ch;
+#ifndef CharWidth
+ PyMac_PRECHECK(CharWidth);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &ch))
+ return NULL;
+ _rv = CharWidth(ch);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_StringWidth(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ Str255 s;
+#ifndef StringWidth
+ PyMac_PRECHECK(StringWidth);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetStr255, s))
+ return NULL;
+ _rv = StringWidth(s);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_TextWidth(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ char *textBuf__in__;
+ int textBuf__in_len__;
+ short firstByte;
+ short byteCount;
+#ifndef TextWidth
+ PyMac_PRECHECK(TextWidth);
+#endif
+ if (!PyArg_ParseTuple(_args, "s#hh",
+ &textBuf__in__, &textBuf__in_len__,
+ &firstByte,
+ &byteCount))
+ return NULL;
+ /* Fool compiler warnings */
+ textBuf__in_len__ = textBuf__in_len__;
+ _rv = TextWidth(textBuf__in__,
+ firstByte,
+ byteCount);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_GetFontInfo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ FontInfo info;
+#ifndef GetFontInfo
+ PyMac_PRECHECK(GetFontInfo);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetFontInfo(&info);
+ _res = Py_BuildValue("O&",
+ QdFI_New, &info);
+ return _res;
+}
+
+static PyObject *Qd_CharExtra(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Fixed extra;
+#ifndef CharExtra
+ PyMac_PRECHECK(CharExtra);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetFixed, &extra))
+ return NULL;
+ CharExtra(extra);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_TruncString(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ short width;
+ Str255 theString;
+ TruncCode truncWhere;
+#ifndef TruncString
+ PyMac_PRECHECK(TruncString);
+#endif
+ if (!PyArg_ParseTuple(_args, "hO&h",
+ &width,
+ PyMac_GetStr255, theString,
+ &truncWhere))
+ return NULL;
+ _rv = TruncString(width,
+ theString,
+ truncWhere);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_SetPort(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GrafPtr thePort;
+#ifndef SetPort
+ PyMac_PRECHECK(SetPort);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ GrafObj_Convert, &thePort))
+ return NULL;
+ SetPort(thePort);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_GetCursor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CursHandle _rv;
+ short cursorID;
+#ifndef GetCursor
+ PyMac_PRECHECK(GetCursor);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &cursorID))
+ return NULL;
+ _rv = GetCursor(cursorID);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_SetCursor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Cursor *crsr__in__;
+ int crsr__in_len__;
+#ifndef SetCursor
+ PyMac_PRECHECK(SetCursor);
+#endif
+ if (!PyArg_ParseTuple(_args, "s#",
+ (char **)&crsr__in__, &crsr__in_len__))
+ return NULL;
+ if (crsr__in_len__ != sizeof(Cursor))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Cursor)");
+ goto crsr__error__;
+ }
+ SetCursor(crsr__in__);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ crsr__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_ShowCursor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef ShowCursor
+ PyMac_PRECHECK(ShowCursor);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ShowCursor();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_LineTo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short h;
+ short v;
+#ifndef LineTo
+ PyMac_PRECHECK(LineTo);
+#endif
+ if (!PyArg_ParseTuple(_args, "hh",
+ &h,
+ &v))
+ return NULL;
+ LineTo(h,
+ v);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_SetRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short left;
+ short top;
+ short right;
+ short bottom;
+#ifndef SetRect
+ PyMac_PRECHECK(SetRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "hhhh",
+ &left,
+ &top,
+ &right,
+ &bottom))
+ return NULL;
+ SetRect(&r,
+ left,
+ top,
+ right,
+ bottom);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &r);
+ return _res;
+}
+
+static PyObject *Qd_OffsetRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short dh;
+ short dv;
+#ifndef OffsetRect
+ PyMac_PRECHECK(OffsetRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetRect, &r,
+ &dh,
+ &dv))
+ return NULL;
+ OffsetRect(&r,
+ dh,
+ dv);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &r);
+ return _res;
+}
+
+static PyObject *Qd_InsetRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short dh;
+ short dv;
+#ifndef InsetRect
+ PyMac_PRECHECK(InsetRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetRect, &r,
+ &dh,
+ &dv))
+ return NULL;
+ InsetRect(&r,
+ dh,
+ dv);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &r);
+ return _res;
+}
+
+static PyObject *Qd_UnionRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect src1;
+ Rect src2;
+ Rect dstRect;
+#ifndef UnionRect
+ PyMac_PRECHECK(UnionRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetRect, &src1,
+ PyMac_GetRect, &src2))
+ return NULL;
+ UnionRect(&src1,
+ &src2,
+ &dstRect);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &dstRect);
+ return _res;
+}
+
+static PyObject *Qd_EqualRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Rect rect1;
+ Rect rect2;
+#ifndef EqualRect
+ PyMac_PRECHECK(EqualRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetRect, &rect1,
+ PyMac_GetRect, &rect2))
+ return NULL;
+ _rv = EqualRect(&rect1,
+ &rect2);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_FrameRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+#ifndef FrameRect
+ PyMac_PRECHECK(FrameRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &r))
+ return NULL;
+ FrameRect(&r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_InvertRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+#ifndef InvertRect
+ PyMac_PRECHECK(InvertRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &r))
+ return NULL;
+ InvertRect(&r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_FillRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ Pattern *pat__in__;
+ int pat__in_len__;
+#ifndef FillRect
+ PyMac_PRECHECK(FillRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&s#",
+ PyMac_GetRect, &r,
+ (char **)&pat__in__, &pat__in_len__))
+ return NULL;
+ if (pat__in_len__ != sizeof(Pattern))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
+ goto pat__error__;
+ }
+ FillRect(&r,
+ pat__in__);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ pat__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_CopyRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle srcRgn;
+ RgnHandle dstRgn;
+#ifndef CopyRgn
+ PyMac_PRECHECK(CopyRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &srcRgn,
+ ResObj_Convert, &dstRgn))
+ return NULL;
+ CopyRgn(srcRgn,
+ dstRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_SetRectRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+ short left;
+ short top;
+ short right;
+ short bottom;
+#ifndef SetRectRgn
+ PyMac_PRECHECK(SetRectRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hhhh",
+ ResObj_Convert, &rgn,
+ &left,
+ &top,
+ &right,
+ &bottom))
+ return NULL;
+ SetRectRgn(rgn,
+ left,
+ top,
+ right,
+ bottom);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_OffsetRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+ short dh;
+ short dv;
+#ifndef OffsetRgn
+ PyMac_PRECHECK(OffsetRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ ResObj_Convert, &rgn,
+ &dh,
+ &dv))
+ return NULL;
+ OffsetRgn(rgn,
+ dh,
+ dv);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_UnionRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle srcRgnA;
+ RgnHandle srcRgnB;
+ RgnHandle dstRgn;
+#ifndef UnionRgn
+ PyMac_PRECHECK(UnionRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ ResObj_Convert, &srcRgnA,
+ ResObj_Convert, &srcRgnB,
+ ResObj_Convert, &dstRgn))
+ return NULL;
+ UnionRgn(srcRgnA,
+ srcRgnB,
+ dstRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_XorRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle srcRgnA;
+ RgnHandle srcRgnB;
+ RgnHandle dstRgn;
+#ifndef XorRgn
+ PyMac_PRECHECK(XorRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ ResObj_Convert, &srcRgnA,
+ ResObj_Convert, &srcRgnB,
+ ResObj_Convert, &dstRgn))
+ return NULL;
+ XorRgn(srcRgnA,
+ srcRgnB,
+ dstRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_EqualRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ RgnHandle rgnA;
+ RgnHandle rgnB;
+#ifndef EqualRgn
+ PyMac_PRECHECK(EqualRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &rgnA,
+ ResObj_Convert, &rgnB))
+ return NULL;
+ _rv = EqualRgn(rgnA,
+ rgnB);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_FrameRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+#ifndef FrameRgn
+ PyMac_PRECHECK(FrameRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &rgn))
+ return NULL;
+ FrameRgn(rgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_PaintRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+#ifndef PaintRgn
+ PyMac_PRECHECK(PaintRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &rgn))
+ return NULL;
+ PaintRgn(rgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_InvertRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+#ifndef InvertRgn
+ PyMac_PRECHECK(InvertRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &rgn))
+ return NULL;
+ InvertRgn(rgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_FillRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+ Pattern *pat__in__;
+ int pat__in_len__;
+#ifndef FillRgn
+ PyMac_PRECHECK(FillRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&s#",
+ ResObj_Convert, &rgn,
+ (char **)&pat__in__, &pat__in_len__))
+ return NULL;
+ if (pat__in_len__ != sizeof(Pattern))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
+ goto pat__error__;
+ }
+ FillRgn(rgn,
+ pat__in__);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ pat__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_GetPixel(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ short h;
+ short v;
+#ifndef GetPixel
+ PyMac_PRECHECK(GetPixel);
+#endif
+ if (!PyArg_ParseTuple(_args, "hh",
+ &h,
+ &v))
+ return NULL;
+ _rv = GetPixel(h,
+ v);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_PtInRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Point pt;
+ Rect r;
+#ifndef PtInRect
+ PyMac_PRECHECK(PtInRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetPoint, &pt,
+ PyMac_GetRect, &r))
+ return NULL;
+ _rv = PtInRect(pt,
+ &r);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_DrawText(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ char *textBuf__in__;
+ int textBuf__in_len__;
+ short firstByte;
+ short byteCount;
+#ifndef DrawText
+ PyMac_PRECHECK(DrawText);
+#endif
+ if (!PyArg_ParseTuple(_args, "s#hh",
+ &textBuf__in__, &textBuf__in_len__,
+ &firstByte,
+ &byteCount))
+ return NULL;
+ /* Fool compiler warnings */
+ textBuf__in_len__ = textBuf__in_len__;
+ DrawText(textBuf__in__,
+ firstByte,
+ byteCount);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_BitMap(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ BitMap *ptr;
+ PyObject *source;
+ Rect bounds;
+ int rowbytes;
+ char *data;
+
+ if ( !PyArg_ParseTuple(_args, "O!iO&", &PyString_Type, &source, &rowbytes, PyMac_GetRect,
+ &bounds) )
+ return NULL;
+ data = PyString_AsString(source);
+ if ((ptr=(BitMap *)malloc(sizeof(BitMap))) == NULL )
+ return PyErr_NoMemory();
+ ptr->baseAddr = (Ptr)data;
+ ptr->rowBytes = rowbytes;
+ ptr->bounds = bounds;
+ if ( (_res = BMObj_New(ptr)) == NULL ) {
+ free(ptr);
+ return NULL;
+ }
+ ((BitMapObject *)_res)->referred_object = source;
+ Py_INCREF(source);
+ ((BitMapObject *)_res)->referred_bitmap = ptr;
+ return _res;
+
+}
+
+static PyObject *Qd_RawBitMap(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ BitMap *ptr;
+ PyObject *source;
+
+ if ( !PyArg_ParseTuple(_args, "O!", &PyString_Type, &source) )
+ return NULL;
+ if ( PyString_Size(source) != sizeof(BitMap) && PyString_Size(source) != sizeof(PixMap) ) {
+ PyErr_Format(PyExc_TypeError,
+ "Argument size was %ld, should be %lu (sizeof BitMap) or %lu (sizeof PixMap)",
+ PyString_Size(source), sizeof(BitMap), sizeof(PixMap));
+ return NULL;
+ }
+ ptr = (BitMapPtr)PyString_AsString(source);
+ if ( (_res = BMObj_New(ptr)) == NULL ) {
+ return NULL;
+ }
+ ((BitMapObject *)_res)->referred_object = source;
+ Py_INCREF(source);
+ return _res;
+
+}
+#endif /* __LP64__ */
+
+static PyMethodDef Qd_methods[] = {
+#ifndef __LP64__
+ {"GetPort", (PyCFunction)Qd_GetPort, 1,
+ PyDoc_STR("() -> (GrafPtr port)")},
+ {"GrafDevice", (PyCFunction)Qd_GrafDevice, 1,
+ PyDoc_STR("(short device) -> None")},
+ {"SetPortBits", (PyCFunction)Qd_SetPortBits, 1,
+ PyDoc_STR("(BitMapPtr bm) -> None")},
+ {"PortSize", (PyCFunction)Qd_PortSize, 1,
+ PyDoc_STR("(short width, short height) -> None")},
+ {"MovePortTo", (PyCFunction)Qd_MovePortTo, 1,
+ PyDoc_STR("(short leftGlobal, short topGlobal) -> None")},
+ {"SetOrigin", (PyCFunction)Qd_SetOrigin, 1,
+ PyDoc_STR("(short h, short v) -> None")},
+ {"SetClip", (PyCFunction)Qd_SetClip, 1,
+ PyDoc_STR("(RgnHandle rgn) -> None")},
+ {"GetClip", (PyCFunction)Qd_GetClip, 1,
+ PyDoc_STR("(RgnHandle rgn) -> None")},
+ {"ClipRect", (PyCFunction)Qd_ClipRect, 1,
+ PyDoc_STR("(Rect r) -> None")},
+ {"BackPat", (PyCFunction)Qd_BackPat, 1,
+ PyDoc_STR("(Pattern pat) -> None")},
+ {"InitCursor", (PyCFunction)Qd_InitCursor, 1,
+ PyDoc_STR("() -> None")},
+ {"MacSetCursor", (PyCFunction)Qd_MacSetCursor, 1,
+ PyDoc_STR("(Cursor crsr) -> None")},
+ {"HideCursor", (PyCFunction)Qd_HideCursor, 1,
+ PyDoc_STR("() -> None")},
+ {"MacShowCursor", (PyCFunction)Qd_MacShowCursor, 1,
+ PyDoc_STR("() -> None")},
+ {"ObscureCursor", (PyCFunction)Qd_ObscureCursor, 1,
+ PyDoc_STR("() -> None")},
+ {"HidePen", (PyCFunction)Qd_HidePen, 1,
+ PyDoc_STR("() -> None")},
+ {"ShowPen", (PyCFunction)Qd_ShowPen, 1,
+ PyDoc_STR("() -> None")},
+ {"GetPen", (PyCFunction)Qd_GetPen, 1,
+ PyDoc_STR("() -> (Point pt)")},
+ {"GetPenState", (PyCFunction)Qd_GetPenState, 1,
+ PyDoc_STR("() -> (PenState pnState)")},
+ {"SetPenState", (PyCFunction)Qd_SetPenState, 1,
+ PyDoc_STR("(PenState pnState) -> None")},
+ {"PenSize", (PyCFunction)Qd_PenSize, 1,
+ PyDoc_STR("(short width, short height) -> None")},
+ {"PenMode", (PyCFunction)Qd_PenMode, 1,
+ PyDoc_STR("(short mode) -> None")},
+ {"PenPat", (PyCFunction)Qd_PenPat, 1,
+ PyDoc_STR("(Pattern pat) -> None")},
+ {"PenNormal", (PyCFunction)Qd_PenNormal, 1,
+ PyDoc_STR("() -> None")},
+ {"MoveTo", (PyCFunction)Qd_MoveTo, 1,
+ PyDoc_STR("(short h, short v) -> None")},
+ {"Move", (PyCFunction)Qd_Move, 1,
+ PyDoc_STR("(short dh, short dv) -> None")},
+ {"MacLineTo", (PyCFunction)Qd_MacLineTo, 1,
+ PyDoc_STR("(short h, short v) -> None")},
+ {"Line", (PyCFunction)Qd_Line, 1,
+ PyDoc_STR("(short dh, short dv) -> None")},
+ {"ForeColor", (PyCFunction)Qd_ForeColor, 1,
+ PyDoc_STR("(long color) -> None")},
+ {"BackColor", (PyCFunction)Qd_BackColor, 1,
+ PyDoc_STR("(long color) -> None")},
+ {"ColorBit", (PyCFunction)Qd_ColorBit, 1,
+ PyDoc_STR("(short whichBit) -> None")},
+ {"MacSetRect", (PyCFunction)Qd_MacSetRect, 1,
+ PyDoc_STR("(short left, short top, short right, short bottom) -> (Rect r)")},
+ {"MacOffsetRect", (PyCFunction)Qd_MacOffsetRect, 1,
+ PyDoc_STR("(Rect r, short dh, short dv) -> (Rect r)")},
+ {"MacInsetRect", (PyCFunction)Qd_MacInsetRect, 1,
+ PyDoc_STR("(Rect r, short dh, short dv) -> (Rect r)")},
+ {"SectRect", (PyCFunction)Qd_SectRect, 1,
+ PyDoc_STR("(Rect src1, Rect src2) -> (Boolean _rv, Rect dstRect)")},
+ {"MacUnionRect", (PyCFunction)Qd_MacUnionRect, 1,
+ PyDoc_STR("(Rect src1, Rect src2) -> (Rect dstRect)")},
+ {"MacEqualRect", (PyCFunction)Qd_MacEqualRect, 1,
+ PyDoc_STR("(Rect rect1, Rect rect2) -> (Boolean _rv)")},
+ {"EmptyRect", (PyCFunction)Qd_EmptyRect, 1,
+ PyDoc_STR("(Rect r) -> (Boolean _rv)")},
+ {"MacFrameRect", (PyCFunction)Qd_MacFrameRect, 1,
+ PyDoc_STR("(Rect r) -> None")},
+ {"PaintRect", (PyCFunction)Qd_PaintRect, 1,
+ PyDoc_STR("(Rect r) -> None")},
+ {"EraseRect", (PyCFunction)Qd_EraseRect, 1,
+ PyDoc_STR("(Rect r) -> None")},
+ {"MacInvertRect", (PyCFunction)Qd_MacInvertRect, 1,
+ PyDoc_STR("(Rect r) -> None")},
+ {"MacFillRect", (PyCFunction)Qd_MacFillRect, 1,
+ PyDoc_STR("(Rect r, Pattern pat) -> None")},
+ {"FrameOval", (PyCFunction)Qd_FrameOval, 1,
+ PyDoc_STR("(Rect r) -> None")},
+ {"PaintOval", (PyCFunction)Qd_PaintOval, 1,
+ PyDoc_STR("(Rect r) -> None")},
+ {"EraseOval", (PyCFunction)Qd_EraseOval, 1,
+ PyDoc_STR("(Rect r) -> None")},
+ {"InvertOval", (PyCFunction)Qd_InvertOval, 1,
+ PyDoc_STR("(Rect r) -> None")},
+ {"FillOval", (PyCFunction)Qd_FillOval, 1,
+ PyDoc_STR("(Rect r, Pattern pat) -> None")},
+ {"FrameRoundRect", (PyCFunction)Qd_FrameRoundRect, 1,
+ PyDoc_STR("(Rect r, short ovalWidth, short ovalHeight) -> None")},
+ {"PaintRoundRect", (PyCFunction)Qd_PaintRoundRect, 1,
+ PyDoc_STR("(Rect r, short ovalWidth, short ovalHeight) -> None")},
+ {"EraseRoundRect", (PyCFunction)Qd_EraseRoundRect, 1,
+ PyDoc_STR("(Rect r, short ovalWidth, short ovalHeight) -> None")},
+ {"InvertRoundRect", (PyCFunction)Qd_InvertRoundRect, 1,
+ PyDoc_STR("(Rect r, short ovalWidth, short ovalHeight) -> None")},
+ {"FillRoundRect", (PyCFunction)Qd_FillRoundRect, 1,
+ PyDoc_STR("(Rect r, short ovalWidth, short ovalHeight, Pattern pat) -> None")},
+ {"FrameArc", (PyCFunction)Qd_FrameArc, 1,
+ PyDoc_STR("(Rect r, short startAngle, short arcAngle) -> None")},
+ {"PaintArc", (PyCFunction)Qd_PaintArc, 1,
+ PyDoc_STR("(Rect r, short startAngle, short arcAngle) -> None")},
+ {"EraseArc", (PyCFunction)Qd_EraseArc, 1,
+ PyDoc_STR("(Rect r, short startAngle, short arcAngle) -> None")},
+ {"InvertArc", (PyCFunction)Qd_InvertArc, 1,
+ PyDoc_STR("(Rect r, short startAngle, short arcAngle) -> None")},
+ {"FillArc", (PyCFunction)Qd_FillArc, 1,
+ PyDoc_STR("(Rect r, short startAngle, short arcAngle, Pattern pat) -> None")},
+ {"NewRgn", (PyCFunction)Qd_NewRgn, 1,
+ PyDoc_STR("() -> (RgnHandle _rv)")},
+ {"OpenRgn", (PyCFunction)Qd_OpenRgn, 1,
+ PyDoc_STR("() -> None")},
+ {"CloseRgn", (PyCFunction)Qd_CloseRgn, 1,
+ PyDoc_STR("(RgnHandle dstRgn) -> None")},
+ {"BitMapToRegion", (PyCFunction)Qd_BitMapToRegion, 1,
+ PyDoc_STR("(RgnHandle region, BitMapPtr bMap) -> None")},
+ {"RgnToHandle", (PyCFunction)Qd_RgnToHandle, 1,
+ PyDoc_STR("(RgnHandle region, Handle flattenedRgnDataHdl) -> None")},
+ {"DisposeRgn", (PyCFunction)Qd_DisposeRgn, 1,
+ PyDoc_STR("(RgnHandle rgn) -> None")},
+ {"MacCopyRgn", (PyCFunction)Qd_MacCopyRgn, 1,
+ PyDoc_STR("(RgnHandle srcRgn, RgnHandle dstRgn) -> None")},
+ {"SetEmptyRgn", (PyCFunction)Qd_SetEmptyRgn, 1,
+ PyDoc_STR("(RgnHandle rgn) -> None")},
+ {"MacSetRectRgn", (PyCFunction)Qd_MacSetRectRgn, 1,
+ PyDoc_STR("(RgnHandle rgn, short left, short top, short right, short bottom) -> None")},
+ {"RectRgn", (PyCFunction)Qd_RectRgn, 1,
+ PyDoc_STR("(RgnHandle rgn, Rect r) -> None")},
+ {"MacOffsetRgn", (PyCFunction)Qd_MacOffsetRgn, 1,
+ PyDoc_STR("(RgnHandle rgn, short dh, short dv) -> None")},
+ {"InsetRgn", (PyCFunction)Qd_InsetRgn, 1,
+ PyDoc_STR("(RgnHandle rgn, short dh, short dv) -> None")},
+ {"SectRgn", (PyCFunction)Qd_SectRgn, 1,
+ PyDoc_STR("(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None")},
+ {"MacUnionRgn", (PyCFunction)Qd_MacUnionRgn, 1,
+ PyDoc_STR("(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None")},
+ {"DiffRgn", (PyCFunction)Qd_DiffRgn, 1,
+ PyDoc_STR("(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None")},
+ {"MacXorRgn", (PyCFunction)Qd_MacXorRgn, 1,
+ PyDoc_STR("(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None")},
+ {"RectInRgn", (PyCFunction)Qd_RectInRgn, 1,
+ PyDoc_STR("(Rect r, RgnHandle rgn) -> (Boolean _rv)")},
+ {"MacEqualRgn", (PyCFunction)Qd_MacEqualRgn, 1,
+ PyDoc_STR("(RgnHandle rgnA, RgnHandle rgnB) -> (Boolean _rv)")},
+ {"EmptyRgn", (PyCFunction)Qd_EmptyRgn, 1,
+ PyDoc_STR("(RgnHandle rgn) -> (Boolean _rv)")},
+ {"MacFrameRgn", (PyCFunction)Qd_MacFrameRgn, 1,
+ PyDoc_STR("(RgnHandle rgn) -> None")},
+ {"MacPaintRgn", (PyCFunction)Qd_MacPaintRgn, 1,
+ PyDoc_STR("(RgnHandle rgn) -> None")},
+ {"EraseRgn", (PyCFunction)Qd_EraseRgn, 1,
+ PyDoc_STR("(RgnHandle rgn) -> None")},
+ {"MacInvertRgn", (PyCFunction)Qd_MacInvertRgn, 1,
+ PyDoc_STR("(RgnHandle rgn) -> None")},
+ {"MacFillRgn", (PyCFunction)Qd_MacFillRgn, 1,
+ PyDoc_STR("(RgnHandle rgn, Pattern pat) -> None")},
+ {"ScrollRect", (PyCFunction)Qd_ScrollRect, 1,
+ PyDoc_STR("(Rect r, short dh, short dv, RgnHandle updateRgn) -> None")},
+ {"CopyBits", (PyCFunction)Qd_CopyBits, 1,
+ PyDoc_STR("(BitMapPtr srcBits, BitMapPtr dstBits, Rect srcRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None")},
+ {"CopyMask", (PyCFunction)Qd_CopyMask, 1,
+ PyDoc_STR("(BitMapPtr srcBits, BitMapPtr maskBits, BitMapPtr dstBits, Rect srcRect, Rect maskRect, Rect dstRect) -> None")},
+ {"OpenPicture", (PyCFunction)Qd_OpenPicture, 1,
+ PyDoc_STR("(Rect picFrame) -> (PicHandle _rv)")},
+ {"PicComment", (PyCFunction)Qd_PicComment, 1,
+ PyDoc_STR("(short kind, short dataSize, Handle dataHandle) -> None")},
+ {"ClosePicture", (PyCFunction)Qd_ClosePicture, 1,
+ PyDoc_STR("() -> None")},
+ {"DrawPicture", (PyCFunction)Qd_DrawPicture, 1,
+ PyDoc_STR("(PicHandle myPicture, Rect dstRect) -> None")},
+ {"KillPicture", (PyCFunction)Qd_KillPicture, 1,
+ PyDoc_STR("(PicHandle myPicture) -> None")},
+ {"OpenPoly", (PyCFunction)Qd_OpenPoly, 1,
+ PyDoc_STR("() -> (PolyHandle _rv)")},
+ {"ClosePoly", (PyCFunction)Qd_ClosePoly, 1,
+ PyDoc_STR("() -> None")},
+ {"KillPoly", (PyCFunction)Qd_KillPoly, 1,
+ PyDoc_STR("(PolyHandle poly) -> None")},
+ {"OffsetPoly", (PyCFunction)Qd_OffsetPoly, 1,
+ PyDoc_STR("(PolyHandle poly, short dh, short dv) -> None")},
+ {"FramePoly", (PyCFunction)Qd_FramePoly, 1,
+ PyDoc_STR("(PolyHandle poly) -> None")},
+ {"PaintPoly", (PyCFunction)Qd_PaintPoly, 1,
+ PyDoc_STR("(PolyHandle poly) -> None")},
+ {"ErasePoly", (PyCFunction)Qd_ErasePoly, 1,
+ PyDoc_STR("(PolyHandle poly) -> None")},
+ {"InvertPoly", (PyCFunction)Qd_InvertPoly, 1,
+ PyDoc_STR("(PolyHandle poly) -> None")},
+ {"FillPoly", (PyCFunction)Qd_FillPoly, 1,
+ PyDoc_STR("(PolyHandle poly, Pattern pat) -> None")},
+ {"SetPt", (PyCFunction)Qd_SetPt, 1,
+ PyDoc_STR("(short h, short v) -> (Point pt)")},
+ {"LocalToGlobal", (PyCFunction)Qd_LocalToGlobal, 1,
+ PyDoc_STR("(Point pt) -> (Point pt)")},
+ {"GlobalToLocal", (PyCFunction)Qd_GlobalToLocal, 1,
+ PyDoc_STR("(Point pt) -> (Point pt)")},
+ {"Random", (PyCFunction)Qd_Random, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"MacGetPixel", (PyCFunction)Qd_MacGetPixel, 1,
+ PyDoc_STR("(short h, short v) -> (Boolean _rv)")},
+ {"ScalePt", (PyCFunction)Qd_ScalePt, 1,
+ PyDoc_STR("(Point pt, Rect srcRect, Rect dstRect) -> (Point pt)")},
+ {"MapPt", (PyCFunction)Qd_MapPt, 1,
+ PyDoc_STR("(Point pt, Rect srcRect, Rect dstRect) -> (Point pt)")},
+ {"MapRect", (PyCFunction)Qd_MapRect, 1,
+ PyDoc_STR("(Rect r, Rect srcRect, Rect dstRect) -> (Rect r)")},
+ {"MapRgn", (PyCFunction)Qd_MapRgn, 1,
+ PyDoc_STR("(RgnHandle rgn, Rect srcRect, Rect dstRect) -> None")},
+ {"MapPoly", (PyCFunction)Qd_MapPoly, 1,
+ PyDoc_STR("(PolyHandle poly, Rect srcRect, Rect dstRect) -> None")},
+ {"StdBits", (PyCFunction)Qd_StdBits, 1,
+ PyDoc_STR("(BitMapPtr srcBits, Rect srcRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None")},
+ {"AddPt", (PyCFunction)Qd_AddPt, 1,
+ PyDoc_STR("(Point src, Point dst) -> (Point dst)")},
+ {"EqualPt", (PyCFunction)Qd_EqualPt, 1,
+ PyDoc_STR("(Point pt1, Point pt2) -> (Boolean _rv)")},
+ {"MacPtInRect", (PyCFunction)Qd_MacPtInRect, 1,
+ PyDoc_STR("(Point pt, Rect r) -> (Boolean _rv)")},
+ {"Pt2Rect", (PyCFunction)Qd_Pt2Rect, 1,
+ PyDoc_STR("(Point pt1, Point pt2) -> (Rect dstRect)")},
+ {"PtToAngle", (PyCFunction)Qd_PtToAngle, 1,
+ PyDoc_STR("(Rect r, Point pt) -> (short angle)")},
+ {"SubPt", (PyCFunction)Qd_SubPt, 1,
+ PyDoc_STR("(Point src, Point dst) -> (Point dst)")},
+ {"PtInRgn", (PyCFunction)Qd_PtInRgn, 1,
+ PyDoc_STR("(Point pt, RgnHandle rgn) -> (Boolean _rv)")},
+ {"NewPixMap", (PyCFunction)Qd_NewPixMap, 1,
+ PyDoc_STR("() -> (PixMapHandle _rv)")},
+ {"DisposePixMap", (PyCFunction)Qd_DisposePixMap, 1,
+ PyDoc_STR("(PixMapHandle pm) -> None")},
+ {"CopyPixMap", (PyCFunction)Qd_CopyPixMap, 1,
+ PyDoc_STR("(PixMapHandle srcPM, PixMapHandle dstPM) -> None")},
+ {"NewPixPat", (PyCFunction)Qd_NewPixPat, 1,
+ PyDoc_STR("() -> (PixPatHandle _rv)")},
+ {"DisposePixPat", (PyCFunction)Qd_DisposePixPat, 1,
+ PyDoc_STR("(PixPatHandle pp) -> None")},
+ {"CopyPixPat", (PyCFunction)Qd_CopyPixPat, 1,
+ PyDoc_STR("(PixPatHandle srcPP, PixPatHandle dstPP) -> None")},
+ {"PenPixPat", (PyCFunction)Qd_PenPixPat, 1,
+ PyDoc_STR("(PixPatHandle pp) -> None")},
+ {"BackPixPat", (PyCFunction)Qd_BackPixPat, 1,
+ PyDoc_STR("(PixPatHandle pp) -> None")},
+ {"GetPixPat", (PyCFunction)Qd_GetPixPat, 1,
+ PyDoc_STR("(short patID) -> (PixPatHandle _rv)")},
+ {"MakeRGBPat", (PyCFunction)Qd_MakeRGBPat, 1,
+ PyDoc_STR("(PixPatHandle pp, RGBColor myColor) -> None")},
+ {"FillCRect", (PyCFunction)Qd_FillCRect, 1,
+ PyDoc_STR("(Rect r, PixPatHandle pp) -> None")},
+ {"FillCOval", (PyCFunction)Qd_FillCOval, 1,
+ PyDoc_STR("(Rect r, PixPatHandle pp) -> None")},
+ {"FillCRoundRect", (PyCFunction)Qd_FillCRoundRect, 1,
+ PyDoc_STR("(Rect r, short ovalWidth, short ovalHeight, PixPatHandle pp) -> None")},
+ {"FillCArc", (PyCFunction)Qd_FillCArc, 1,
+ PyDoc_STR("(Rect r, short startAngle, short arcAngle, PixPatHandle pp) -> None")},
+ {"FillCRgn", (PyCFunction)Qd_FillCRgn, 1,
+ PyDoc_STR("(RgnHandle rgn, PixPatHandle pp) -> None")},
+ {"FillCPoly", (PyCFunction)Qd_FillCPoly, 1,
+ PyDoc_STR("(PolyHandle poly, PixPatHandle pp) -> None")},
+ {"RGBForeColor", (PyCFunction)Qd_RGBForeColor, 1,
+ PyDoc_STR("(RGBColor color) -> None")},
+ {"RGBBackColor", (PyCFunction)Qd_RGBBackColor, 1,
+ PyDoc_STR("(RGBColor color) -> None")},
+ {"SetCPixel", (PyCFunction)Qd_SetCPixel, 1,
+ PyDoc_STR("(short h, short v, RGBColor cPix) -> None")},
+ {"SetPortPix", (PyCFunction)Qd_SetPortPix, 1,
+ PyDoc_STR("(PixMapHandle pm) -> None")},
+ {"GetCPixel", (PyCFunction)Qd_GetCPixel, 1,
+ PyDoc_STR("(short h, short v) -> (RGBColor cPix)")},
+ {"GetForeColor", (PyCFunction)Qd_GetForeColor, 1,
+ PyDoc_STR("() -> (RGBColor color)")},
+ {"GetBackColor", (PyCFunction)Qd_GetBackColor, 1,
+ PyDoc_STR("() -> (RGBColor color)")},
+ {"OpColor", (PyCFunction)Qd_OpColor, 1,
+ PyDoc_STR("(RGBColor color) -> None")},
+ {"HiliteColor", (PyCFunction)Qd_HiliteColor, 1,
+ PyDoc_STR("(RGBColor color) -> None")},
+ {"DisposeCTable", (PyCFunction)Qd_DisposeCTable, 1,
+ PyDoc_STR("(CTabHandle cTable) -> None")},
+ {"GetCTable", (PyCFunction)Qd_GetCTable, 1,
+ PyDoc_STR("(short ctID) -> (CTabHandle _rv)")},
+ {"GetCCursor", (PyCFunction)Qd_GetCCursor, 1,
+ PyDoc_STR("(short crsrID) -> (CCrsrHandle _rv)")},
+ {"SetCCursor", (PyCFunction)Qd_SetCCursor, 1,
+ PyDoc_STR("(CCrsrHandle cCrsr) -> None")},
+ {"AllocCursor", (PyCFunction)Qd_AllocCursor, 1,
+ PyDoc_STR("() -> None")},
+ {"DisposeCCursor", (PyCFunction)Qd_DisposeCCursor, 1,
+ PyDoc_STR("(CCrsrHandle cCrsr) -> None")},
+ {"GetMaxDevice", (PyCFunction)Qd_GetMaxDevice, 1,
+ PyDoc_STR("(Rect globalRect) -> (GDHandle _rv)")},
+ {"GetCTSeed", (PyCFunction)Qd_GetCTSeed, 1,
+ PyDoc_STR("() -> (long _rv)")},
+ {"GetDeviceList", (PyCFunction)Qd_GetDeviceList, 1,
+ PyDoc_STR("() -> (GDHandle _rv)")},
+ {"GetMainDevice", (PyCFunction)Qd_GetMainDevice, 1,
+ PyDoc_STR("() -> (GDHandle _rv)")},
+ {"GetNextDevice", (PyCFunction)Qd_GetNextDevice, 1,
+ PyDoc_STR("(GDHandle curDevice) -> (GDHandle _rv)")},
+ {"TestDeviceAttribute", (PyCFunction)Qd_TestDeviceAttribute, 1,
+ PyDoc_STR("(GDHandle gdh, short attribute) -> (Boolean _rv)")},
+ {"SetDeviceAttribute", (PyCFunction)Qd_SetDeviceAttribute, 1,
+ PyDoc_STR("(GDHandle gdh, short attribute, Boolean value) -> None")},
+ {"InitGDevice", (PyCFunction)Qd_InitGDevice, 1,
+ PyDoc_STR("(short qdRefNum, long mode, GDHandle gdh) -> None")},
+ {"NewGDevice", (PyCFunction)Qd_NewGDevice, 1,
+ PyDoc_STR("(short refNum, long mode) -> (GDHandle _rv)")},
+ {"DisposeGDevice", (PyCFunction)Qd_DisposeGDevice, 1,
+ PyDoc_STR("(GDHandle gdh) -> None")},
+ {"SetGDevice", (PyCFunction)Qd_SetGDevice, 1,
+ PyDoc_STR("(GDHandle gd) -> None")},
+ {"GetGDevice", (PyCFunction)Qd_GetGDevice, 1,
+ PyDoc_STR("() -> (GDHandle _rv)")},
+ {"Color2Index", (PyCFunction)Qd_Color2Index, 1,
+ PyDoc_STR("(RGBColor myColor) -> (long _rv)")},
+ {"Index2Color", (PyCFunction)Qd_Index2Color, 1,
+ PyDoc_STR("(long index) -> (RGBColor aColor)")},
+ {"InvertColor", (PyCFunction)Qd_InvertColor, 1,
+ PyDoc_STR("() -> (RGBColor myColor)")},
+ {"RealColor", (PyCFunction)Qd_RealColor, 1,
+ PyDoc_STR("(RGBColor color) -> (Boolean _rv)")},
+ {"GetSubTable", (PyCFunction)Qd_GetSubTable, 1,
+ PyDoc_STR("(CTabHandle myColors, short iTabRes, CTabHandle targetTbl) -> None")},
+ {"MakeITable", (PyCFunction)Qd_MakeITable, 1,
+ PyDoc_STR("(CTabHandle cTabH, ITabHandle iTabH, short res) -> None")},
+ {"SetClientID", (PyCFunction)Qd_SetClientID, 1,
+ PyDoc_STR("(short id) -> None")},
+ {"ProtectEntry", (PyCFunction)Qd_ProtectEntry, 1,
+ PyDoc_STR("(short index, Boolean protect) -> None")},
+ {"ReserveEntry", (PyCFunction)Qd_ReserveEntry, 1,
+ PyDoc_STR("(short index, Boolean reserve) -> None")},
+ {"QDError", (PyCFunction)Qd_QDError, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"CopyDeepMask", (PyCFunction)Qd_CopyDeepMask, 1,
+ PyDoc_STR("(BitMapPtr srcBits, BitMapPtr maskBits, BitMapPtr dstBits, Rect srcRect, Rect maskRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None")},
+ {"GetPattern", (PyCFunction)Qd_GetPattern, 1,
+ PyDoc_STR("(short patternID) -> (PatHandle _rv)")},
+ {"MacGetCursor", (PyCFunction)Qd_MacGetCursor, 1,
+ PyDoc_STR("(short cursorID) -> (CursHandle _rv)")},
+ {"GetPicture", (PyCFunction)Qd_GetPicture, 1,
+ PyDoc_STR("(short pictureID) -> (PicHandle _rv)")},
+ {"DeltaPoint", (PyCFunction)Qd_DeltaPoint, 1,
+ PyDoc_STR("(Point ptA, Point ptB) -> (long _rv)")},
+ {"ShieldCursor", (PyCFunction)Qd_ShieldCursor, 1,
+ PyDoc_STR("(Rect shieldRect, Point offsetPt) -> None")},
+ {"ScreenRes", (PyCFunction)Qd_ScreenRes, 1,
+ PyDoc_STR("() -> (short scrnHRes, short scrnVRes)")},
+ {"GetIndPattern", (PyCFunction)Qd_GetIndPattern, 1,
+ PyDoc_STR("(short patternListID, short index) -> (Pattern thePat)")},
+ {"SlopeFromAngle", (PyCFunction)Qd_SlopeFromAngle, 1,
+ PyDoc_STR("(short angle) -> (Fixed _rv)")},
+ {"AngleFromSlope", (PyCFunction)Qd_AngleFromSlope, 1,
+ PyDoc_STR("(Fixed slope) -> (short _rv)")},
+ {"GetPixBounds", (PyCFunction)Qd_GetPixBounds, 1,
+ PyDoc_STR("(PixMapHandle pixMap) -> (Rect bounds)")},
+ {"GetPixDepth", (PyCFunction)Qd_GetPixDepth, 1,
+ PyDoc_STR("(PixMapHandle pixMap) -> (short _rv)")},
+ {"GetQDGlobalsRandomSeed", (PyCFunction)Qd_GetQDGlobalsRandomSeed, 1,
+ PyDoc_STR("() -> (long _rv)")},
+ {"GetQDGlobalsScreenBits", (PyCFunction)Qd_GetQDGlobalsScreenBits, 1,
+ PyDoc_STR("() -> (BitMap screenBits)")},
+ {"GetQDGlobalsArrow", (PyCFunction)Qd_GetQDGlobalsArrow, 1,
+ PyDoc_STR("() -> (Cursor arrow)")},
+ {"GetQDGlobalsDarkGray", (PyCFunction)Qd_GetQDGlobalsDarkGray, 1,
+ PyDoc_STR("() -> (Pattern dkGray)")},
+ {"GetQDGlobalsLightGray", (PyCFunction)Qd_GetQDGlobalsLightGray, 1,
+ PyDoc_STR("() -> (Pattern ltGray)")},
+ {"GetQDGlobalsGray", (PyCFunction)Qd_GetQDGlobalsGray, 1,
+ PyDoc_STR("() -> (Pattern gray)")},
+ {"GetQDGlobalsBlack", (PyCFunction)Qd_GetQDGlobalsBlack, 1,
+ PyDoc_STR("() -> (Pattern black)")},
+ {"GetQDGlobalsWhite", (PyCFunction)Qd_GetQDGlobalsWhite, 1,
+ PyDoc_STR("() -> (Pattern white)")},
+ {"GetQDGlobalsThePort", (PyCFunction)Qd_GetQDGlobalsThePort, 1,
+ PyDoc_STR("() -> (CGrafPtr _rv)")},
+ {"SetQDGlobalsRandomSeed", (PyCFunction)Qd_SetQDGlobalsRandomSeed, 1,
+ PyDoc_STR("(long randomSeed) -> None")},
+ {"SetQDGlobalsArrow", (PyCFunction)Qd_SetQDGlobalsArrow, 1,
+ PyDoc_STR("(Cursor arrow) -> None")},
+ {"GetRegionBounds", (PyCFunction)Qd_GetRegionBounds, 1,
+ PyDoc_STR("(RgnHandle region) -> (Rect bounds)")},
+ {"IsRegionRectangular", (PyCFunction)Qd_IsRegionRectangular, 1,
+ PyDoc_STR("(RgnHandle region) -> (Boolean _rv)")},
+ {"CreateNewPort", (PyCFunction)Qd_CreateNewPort, 1,
+ PyDoc_STR("() -> (CGrafPtr _rv)")},
+ {"SetQDError", (PyCFunction)Qd_SetQDError, 1,
+ PyDoc_STR("(OSErr err) -> None")},
+ {"LMGetScrVRes", (PyCFunction)Qd_LMGetScrVRes, 1,
+ PyDoc_STR("() -> (SInt16 _rv)")},
+ {"LMSetScrVRes", (PyCFunction)Qd_LMSetScrVRes, 1,
+ PyDoc_STR("(SInt16 value) -> None")},
+ {"LMGetScrHRes", (PyCFunction)Qd_LMGetScrHRes, 1,
+ PyDoc_STR("() -> (SInt16 _rv)")},
+ {"LMSetScrHRes", (PyCFunction)Qd_LMSetScrHRes, 1,
+ PyDoc_STR("(SInt16 value) -> None")},
+ {"LMGetMainDevice", (PyCFunction)Qd_LMGetMainDevice, 1,
+ PyDoc_STR("() -> (GDHandle _rv)")},
+ {"LMSetMainDevice", (PyCFunction)Qd_LMSetMainDevice, 1,
+ PyDoc_STR("(GDHandle value) -> None")},
+ {"LMGetDeviceList", (PyCFunction)Qd_LMGetDeviceList, 1,
+ PyDoc_STR("() -> (GDHandle _rv)")},
+ {"LMSetDeviceList", (PyCFunction)Qd_LMSetDeviceList, 1,
+ PyDoc_STR("(GDHandle value) -> None")},
+ {"LMGetQDColors", (PyCFunction)Qd_LMGetQDColors, 1,
+ PyDoc_STR("() -> (Handle _rv)")},
+ {"LMSetQDColors", (PyCFunction)Qd_LMSetQDColors, 1,
+ PyDoc_STR("(Handle value) -> None")},
+ {"LMGetWidthListHand", (PyCFunction)Qd_LMGetWidthListHand, 1,
+ PyDoc_STR("() -> (Handle _rv)")},
+ {"LMSetWidthListHand", (PyCFunction)Qd_LMSetWidthListHand, 1,
+ PyDoc_STR("(Handle value) -> None")},
+ {"LMGetHiliteMode", (PyCFunction)Qd_LMGetHiliteMode, 1,
+ PyDoc_STR("() -> (UInt8 _rv)")},
+ {"LMSetHiliteMode", (PyCFunction)Qd_LMSetHiliteMode, 1,
+ PyDoc_STR("(UInt8 value) -> None")},
+ {"LMGetWidthTabHandle", (PyCFunction)Qd_LMGetWidthTabHandle, 1,
+ PyDoc_STR("() -> (Handle _rv)")},
+ {"LMSetWidthTabHandle", (PyCFunction)Qd_LMSetWidthTabHandle, 1,
+ PyDoc_STR("(Handle value) -> None")},
+ {"LMGetLastSPExtra", (PyCFunction)Qd_LMGetLastSPExtra, 1,
+ PyDoc_STR("() -> (SInt32 _rv)")},
+ {"LMSetLastSPExtra", (PyCFunction)Qd_LMSetLastSPExtra, 1,
+ PyDoc_STR("(SInt32 value) -> None")},
+ {"LMGetLastFOND", (PyCFunction)Qd_LMGetLastFOND, 1,
+ PyDoc_STR("() -> (Handle _rv)")},
+ {"LMSetLastFOND", (PyCFunction)Qd_LMSetLastFOND, 1,
+ PyDoc_STR("(Handle value) -> None")},
+ {"LMGetFractEnable", (PyCFunction)Qd_LMGetFractEnable, 1,
+ PyDoc_STR("() -> (UInt8 _rv)")},
+ {"LMSetFractEnable", (PyCFunction)Qd_LMSetFractEnable, 1,
+ PyDoc_STR("(UInt8 value) -> None")},
+ {"LMGetTheGDevice", (PyCFunction)Qd_LMGetTheGDevice, 1,
+ PyDoc_STR("() -> (GDHandle _rv)")},
+ {"LMSetTheGDevice", (PyCFunction)Qd_LMSetTheGDevice, 1,
+ PyDoc_STR("(GDHandle value) -> None")},
+ {"LMGetHiliteRGB", (PyCFunction)Qd_LMGetHiliteRGB, 1,
+ PyDoc_STR("() -> (RGBColor hiliteRGBValue)")},
+ {"LMSetHiliteRGB", (PyCFunction)Qd_LMSetHiliteRGB, 1,
+ PyDoc_STR("(RGBColor hiliteRGBValue) -> None")},
+ {"LMGetCursorNew", (PyCFunction)Qd_LMGetCursorNew, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"LMSetCursorNew", (PyCFunction)Qd_LMSetCursorNew, 1,
+ PyDoc_STR("(Boolean value) -> None")},
+ {"TextFont", (PyCFunction)Qd_TextFont, 1,
+ PyDoc_STR("(short font) -> None")},
+ {"TextFace", (PyCFunction)Qd_TextFace, 1,
+ PyDoc_STR("(StyleParameter face) -> None")},
+ {"TextMode", (PyCFunction)Qd_TextMode, 1,
+ PyDoc_STR("(short mode) -> None")},
+ {"TextSize", (PyCFunction)Qd_TextSize, 1,
+ PyDoc_STR("(short size) -> None")},
+ {"SpaceExtra", (PyCFunction)Qd_SpaceExtra, 1,
+ PyDoc_STR("(Fixed extra) -> None")},
+ {"DrawChar", (PyCFunction)Qd_DrawChar, 1,
+ PyDoc_STR("(CharParameter ch) -> None")},
+ {"DrawString", (PyCFunction)Qd_DrawString, 1,
+ PyDoc_STR("(Str255 s) -> None")},
+ {"MacDrawText", (PyCFunction)Qd_MacDrawText, 1,
+ PyDoc_STR("(Buffer textBuf, short firstByte, short byteCount) -> None")},
+ {"CharWidth", (PyCFunction)Qd_CharWidth, 1,
+ PyDoc_STR("(CharParameter ch) -> (short _rv)")},
+ {"StringWidth", (PyCFunction)Qd_StringWidth, 1,
+ PyDoc_STR("(Str255 s) -> (short _rv)")},
+ {"TextWidth", (PyCFunction)Qd_TextWidth, 1,
+ PyDoc_STR("(Buffer textBuf, short firstByte, short byteCount) -> (short _rv)")},
+ {"GetFontInfo", (PyCFunction)Qd_GetFontInfo, 1,
+ PyDoc_STR("() -> (FontInfo info)")},
+ {"CharExtra", (PyCFunction)Qd_CharExtra, 1,
+ PyDoc_STR("(Fixed extra) -> None")},
+ {"TruncString", (PyCFunction)Qd_TruncString, 1,
+ PyDoc_STR("(short width, Str255 theString, TruncCode truncWhere) -> (short _rv)")},
+ {"SetPort", (PyCFunction)Qd_SetPort, 1,
+ PyDoc_STR("(GrafPtr thePort) -> None")},
+ {"GetCursor", (PyCFunction)Qd_GetCursor, 1,
+ PyDoc_STR("(short cursorID) -> (CursHandle _rv)")},
+ {"SetCursor", (PyCFunction)Qd_SetCursor, 1,
+ PyDoc_STR("(Cursor crsr) -> None")},
+ {"ShowCursor", (PyCFunction)Qd_ShowCursor, 1,
+ PyDoc_STR("() -> None")},
+ {"LineTo", (PyCFunction)Qd_LineTo, 1,
+ PyDoc_STR("(short h, short v) -> None")},
+ {"SetRect", (PyCFunction)Qd_SetRect, 1,
+ PyDoc_STR("(short left, short top, short right, short bottom) -> (Rect r)")},
+ {"OffsetRect", (PyCFunction)Qd_OffsetRect, 1,
+ PyDoc_STR("(Rect r, short dh, short dv) -> (Rect r)")},
+ {"InsetRect", (PyCFunction)Qd_InsetRect, 1,
+ PyDoc_STR("(Rect r, short dh, short dv) -> (Rect r)")},
+ {"UnionRect", (PyCFunction)Qd_UnionRect, 1,
+ PyDoc_STR("(Rect src1, Rect src2) -> (Rect dstRect)")},
+ {"EqualRect", (PyCFunction)Qd_EqualRect, 1,
+ PyDoc_STR("(Rect rect1, Rect rect2) -> (Boolean _rv)")},
+ {"FrameRect", (PyCFunction)Qd_FrameRect, 1,
+ PyDoc_STR("(Rect r) -> None")},
+ {"InvertRect", (PyCFunction)Qd_InvertRect, 1,
+ PyDoc_STR("(Rect r) -> None")},
+ {"FillRect", (PyCFunction)Qd_FillRect, 1,
+ PyDoc_STR("(Rect r, Pattern pat) -> None")},
+ {"CopyRgn", (PyCFunction)Qd_CopyRgn, 1,
+ PyDoc_STR("(RgnHandle srcRgn, RgnHandle dstRgn) -> None")},
+ {"SetRectRgn", (PyCFunction)Qd_SetRectRgn, 1,
+ PyDoc_STR("(RgnHandle rgn, short left, short top, short right, short bottom) -> None")},
+ {"OffsetRgn", (PyCFunction)Qd_OffsetRgn, 1,
+ PyDoc_STR("(RgnHandle rgn, short dh, short dv) -> None")},
+ {"UnionRgn", (PyCFunction)Qd_UnionRgn, 1,
+ PyDoc_STR("(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None")},
+ {"XorRgn", (PyCFunction)Qd_XorRgn, 1,
+ PyDoc_STR("(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None")},
+ {"EqualRgn", (PyCFunction)Qd_EqualRgn, 1,
+ PyDoc_STR("(RgnHandle rgnA, RgnHandle rgnB) -> (Boolean _rv)")},
+ {"FrameRgn", (PyCFunction)Qd_FrameRgn, 1,
+ PyDoc_STR("(RgnHandle rgn) -> None")},
+ {"PaintRgn", (PyCFunction)Qd_PaintRgn, 1,
+ PyDoc_STR("(RgnHandle rgn) -> None")},
+ {"InvertRgn", (PyCFunction)Qd_InvertRgn, 1,
+ PyDoc_STR("(RgnHandle rgn) -> None")},
+ {"FillRgn", (PyCFunction)Qd_FillRgn, 1,
+ PyDoc_STR("(RgnHandle rgn, Pattern pat) -> None")},
+ {"GetPixel", (PyCFunction)Qd_GetPixel, 1,
+ PyDoc_STR("(short h, short v) -> (Boolean _rv)")},
+ {"PtInRect", (PyCFunction)Qd_PtInRect, 1,
+ PyDoc_STR("(Point pt, Rect r) -> (Boolean _rv)")},
+ {"DrawText", (PyCFunction)Qd_DrawText, 1,
+ PyDoc_STR("(Buffer textBuf, short firstByte, short byteCount) -> None")},
+ {"BitMap", (PyCFunction)Qd_BitMap, 1,
+ 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)
+*/
+PyObject *BMObj_NewCopied(BitMapPtr itself)
+{
+ BitMapObject *it;
+ BitMapPtr itself_copy;
+
+ if ((itself_copy=(BitMapPtr)malloc(sizeof(BitMap))) == NULL)
+ return PyErr_NoMemory();
+ *itself_copy = *itself;
+ it = (BitMapObject *)BMObj_New(itself_copy);
+ it->referred_bitmap = itself_copy;
+ return (PyObject *)it;
+}
+
+#endif /* __LP64__ */
+
+
+void init_Qd(void)
+{
+ PyObject *m;
+#ifndef __LP64__
+ PyObject *d;
+
+
+
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(BitMapPtr, BMObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(BitMapPtr, BMObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(GrafPtr, GrafObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(GrafPtr, GrafObj_Convert);
+ 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 ||
+ PyDict_SetItemString(d, "Error", Qd_Error) != 0)
+ return;
+ GrafPort_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&GrafPort_Type) < 0) return;
+ Py_INCREF(&GrafPort_Type);
+ PyModule_AddObject(m, "GrafPort", (PyObject *)&GrafPort_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&GrafPort_Type);
+ PyModule_AddObject(m, "GrafPortType", (PyObject *)&GrafPort_Type);
+ BitMap_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&BitMap_Type) < 0) return;
+ Py_INCREF(&BitMap_Type);
+ PyModule_AddObject(m, "BitMap", (PyObject *)&BitMap_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&BitMap_Type);
+ PyModule_AddObject(m, "BitMapType", (PyObject *)&BitMap_Type);
+#endif /* __LP64__ */
+}
+
+/* ========================= End module _Qd ========================= */
+
diff --git a/Mac/Modules/qd/qdedit.py b/Mac/Modules/qd/qdedit.py
new file mode 100644
index 0000000000..83d81edc92
--- /dev/null
+++ b/Mac/Modules/qd/qdedit.py
@@ -0,0 +1,158 @@
+f = Function(void, 'SetPort',
+ (GrafPtr, 'thePort', InMode),
+)
+functions.append(f)
+
+f = Function(CursHandle, 'GetCursor',
+ (short, 'cursorID', InMode),
+)
+functions.append(f)
+
+f = Function(void, 'SetCursor',
+ (Cursor_ptr, 'crsr', InMode),
+)
+functions.append(f)
+
+f = Function(void, 'ShowCursor',
+)
+functions.append(f)
+
+f = Function(void, 'LineTo',
+ (short, 'h', InMode),
+ (short, 'v', InMode),
+)
+functions.append(f)
+
+f = Function(void, 'SetRect',
+ (Rect, 'r', OutMode),
+ (short, 'left', InMode),
+ (short, 'top', InMode),
+ (short, 'right', InMode),
+ (short, 'bottom', InMode),
+)
+functions.append(f)
+
+f = Function(void, 'OffsetRect',
+ (Rect, 'r', InOutMode),
+ (short, 'dh', InMode),
+ (short, 'dv', InMode),
+)
+functions.append(f)
+
+f = Function(void, 'InsetRect',
+ (Rect, 'r', InOutMode),
+ (short, 'dh', InMode),
+ (short, 'dv', InMode),
+)
+functions.append(f)
+
+f = Function(void, 'UnionRect',
+ (Rect_ptr, 'src1', InMode),
+ (Rect_ptr, 'src2', InMode),
+ (Rect, 'dstRect', OutMode),
+)
+functions.append(f)
+
+f = Function(Boolean, 'EqualRect',
+ (Rect_ptr, 'rect1', InMode),
+ (Rect_ptr, 'rect2', InMode),
+)
+functions.append(f)
+
+f = Function(void, 'FrameRect',
+ (Rect_ptr, 'r', InMode),
+)
+functions.append(f)
+
+f = Function(void, 'InvertRect',
+ (Rect_ptr, 'r', InMode),
+)
+functions.append(f)
+
+f = Function(void, 'FillRect',
+ (Rect_ptr, 'r', InMode),
+ (Pattern_ptr, 'pat', InMode),
+)
+functions.append(f)
+
+f = Function(void, 'CopyRgn',
+ (RgnHandle, 'srcRgn', InMode),
+ (RgnHandle, 'dstRgn', InMode),
+)
+functions.append(f)
+
+f = Function(void, 'SetRectRgn',
+ (RgnHandle, 'rgn', InMode),
+ (short, 'left', InMode),
+ (short, 'top', InMode),
+ (short, 'right', InMode),
+ (short, 'bottom', InMode),
+)
+functions.append(f)
+
+f = Function(void, 'OffsetRgn',
+ (RgnHandle, 'rgn', InMode),
+ (short, 'dh', InMode),
+ (short, 'dv', InMode),
+)
+functions.append(f)
+
+f = Function(void, 'UnionRgn',
+ (RgnHandle, 'srcRgnA', InMode),
+ (RgnHandle, 'srcRgnB', InMode),
+ (RgnHandle, 'dstRgn', InMode),
+)
+functions.append(f)
+
+f = Function(void, 'XorRgn',
+ (RgnHandle, 'srcRgnA', InMode),
+ (RgnHandle, 'srcRgnB', InMode),
+ (RgnHandle, 'dstRgn', InMode),
+)
+functions.append(f)
+
+f = Function(Boolean, 'EqualRgn',
+ (RgnHandle, 'rgnA', InMode),
+ (RgnHandle, 'rgnB', InMode),
+)
+functions.append(f)
+
+f = Function(void, 'FrameRgn',
+ (RgnHandle, 'rgn', InMode),
+)
+functions.append(f)
+
+f = Function(void, 'PaintRgn',
+ (RgnHandle, 'rgn', InMode),
+)
+functions.append(f)
+
+f = Function(void, 'InvertRgn',
+ (RgnHandle, 'rgn', InMode),
+)
+functions.append(f)
+
+f = Function(void, 'FillRgn',
+ (RgnHandle, 'rgn', InMode),
+ (Pattern_ptr, 'pat', InMode),
+)
+functions.append(f)
+
+f = Function(Boolean, 'GetPixel',
+ (short, 'h', InMode),
+ (short, 'v', InMode),
+)
+functions.append(f)
+
+f = Function(Boolean, 'PtInRect',
+ (Point, 'pt', InMode),
+ (Rect_ptr, 'r', InMode),
+)
+functions.append(f)
+
+f = Function(void, 'DrawText',
+ (TextThingie, 'textBuf', InMode),
+ (short, 'firstByte', InMode),
+ (short, 'byteCount', InMode),
+)
+functions.append(f)
diff --git a/Mac/Modules/qd/qdscan.py b/Mac/Modules/qd/qdscan.py
new file mode 100644
index 0000000000..24fbb74f88
--- /dev/null
+++ b/Mac/Modules/qd/qdscan.py
@@ -0,0 +1,234 @@
+# Scan an Apple header file, generating a Python file of generator calls.
+
+import sys
+from bgenlocations import TOOLBOXDIR, BGENDIR
+sys.path.append(BGENDIR)
+
+from scantools import Scanner
+
+def main():
+ input = "QuickDraw.h"
+ output = "qdgen.py"
+ defsoutput = TOOLBOXDIR + "QuickDraw.py"
+ scanner = MyScanner(input, output, defsoutput)
+ scanner.scan()
+ scanner.close()
+
+ # Grmpf. Universal Headers have Text-stuff in a different include file...
+ input = "QuickDrawText.h"
+ output = "@qdgentext.py"
+ defsoutput = "@QuickDrawText.py"
+ have_extra = 0
+ try:
+ scanner = MyScanner(input, output, defsoutput)
+ scanner.scan()
+ scanner.close()
+ have_extra = 1
+ except IOError:
+ pass
+ if have_extra:
+ print "=== Copying QuickDrawText stuff into main files... ==="
+ ifp = open("@qdgentext.py")
+ ofp = open("qdgen.py", "a")
+ ofp.write(ifp.read())
+ ifp.close()
+ ofp.close()
+ ifp = open("@QuickDrawText.py")
+ ofp = open(TOOLBOXDIR + "QuickDraw.py", "a")
+ ofp.write(ifp.read())
+ ifp.close()
+ ofp.close()
+
+ print "=== Testing definitions output code ==="
+ execfile(defsoutput, {}, {})
+ print "=== Done scanning and generating, now importing the generated code... ==="
+ import qdsupport
+ print "=== Done. It's up to you to compile it now! ==="
+
+class MyScanner(Scanner):
+
+ def destination(self, type, name, arglist):
+ classname = "Function"
+ listname = "functions"
+ if arglist:
+ t, n, m = arglist[0]
+ if t in ('GrafPtr', 'CGrafPtr') and m == 'InMode':
+ classname = "Method"
+ listname = "gr_methods"
+ elif t == 'BitMapPtr' and m == 'InMode':
+ classname = "Method"
+ listname = "bm_methods"
+## elif t == "PolyHandle" and m == "InMode":
+## classname = "Method"
+## listname = "p_methods"
+## elif t == "RgnHandle" and m == "InMode":
+## classname = "Method"
+## listname = "r_methods"
+ return classname, listname
+
+
+ def writeinitialdefs(self):
+ self.defsfile.write("""
+def FOUR_CHAR_CODE(x): return x
+normal = 0
+bold = 1
+italic = 2
+underline = 4
+outline = 8
+shadow = 0x10
+condense = 0x20
+extend = 0x40
+""")
+
+ def makeblacklistnames(self):
+ return [
+ 'InitGraf',
+ 'StuffHex',
+ 'StdLine',
+ 'StdComment',
+ 'StdGetPic',
+ 'OpenPort',
+ 'InitPort',
+ 'ClosePort',
+ 'OpenCPort',
+ 'InitCPort',
+ 'CloseCPort',
+ 'BitMapToRegionGlue',
+ 'StdOpcode', # XXXX Missing from library...
+ # The following are for non-macos use:
+ 'LockPortBits',
+ 'UnlockPortBits',
+ 'UpdatePort',
+ 'GetPortNativeWindow',
+ 'GetNativeWindowPort',
+ 'NativeRegionToMacRegion',
+ 'MacRegionToNativeRegion',
+ 'GetPortHWND',
+ 'GetHWNDPort',
+ 'GetPICTFromDIB',
+
+ 'HandleToRgn', # Funny signature
+
+ # Need Cm, which we don't want to drag in just yet
+ 'OpenCursorComponent',
+ 'CloseCursorComponent',
+ 'SetCursorComponent',
+ 'CursorComponentChanged',
+ 'CursorComponentSetData',
+ ]
+
+ def makeblacklisttypes(self):
+ return [
+ "QDRegionBitsRef", # Should do this, but too lazy now.
+ 'CIconHandle', # Obsolete
+ 'CQDProcs',
+ 'CQDProcsPtr',
+ 'CSpecArray',
+ 'ColorComplementProcPtr',
+ 'ColorComplementUPP',
+ 'ColorSearchProcPtr',
+ 'ColorSearchUPP',
+ 'ConstPatternParam',
+ 'DeviceLoopDrawingProcPtr',
+ 'DeviceLoopFlags',
+ 'GrafVerb',
+ 'OpenCPicParams_ptr',
+ 'Ptr',
+ 'QDProcs',
+ 'ReqListRec',
+ 'void_ptr',
+ 'CustomXFerProcPtr',
+ ]
+
+ def makerepairinstructions(self):
+ return [
+ ([('void_ptr', 'textBuf', 'InMode'),
+ ('short', 'firstByte', 'InMode'),
+ ('short', 'byteCount', 'InMode')],
+ [('TextThingie', '*', '*'), ('*', '*', '*'), ('*', '*', '*')]),
+
+ # GetPen and SetPt use a point-pointer as output-only:
+ ('GetPen', [('Point', '*', 'OutMode')], [('*', '*', 'OutMode')]),
+ ('SetPt', [('Point', '*', 'OutMode')], [('*', '*', 'OutMode')]),
+
+ # All others use it as input/output:
+ ([('Point', '*', 'OutMode')],
+ [('*', '*', 'InOutMode')]),
+
+ # InsetRect, OffsetRect
+ ([('Rect', 'r', 'OutMode'),
+ ('short', 'dh', 'InMode'),
+ ('short', 'dv', 'InMode')],
+ [('Rect', 'r', 'InOutMode'),
+ ('short', 'dh', 'InMode'),
+ ('short', 'dv', 'InMode')]),
+
+ # MapRect
+ ([('Rect', 'r', 'OutMode'),
+ ('Rect_ptr', 'srcRect', 'InMode'),
+ ('Rect_ptr', 'dstRect', 'InMode')],
+ [('Rect', 'r', 'InOutMode'),
+ ('Rect_ptr', 'srcRect', 'InMode'),
+ ('Rect_ptr', 'dstRect', 'InMode')]),
+
+ # CopyBits and friends
+ ([('RgnHandle', 'maskRgn', 'InMode')],
+ [('OptRgnHandle', 'maskRgn', 'InMode')]),
+
+ ('QDFlushPortBuffer',
+ [('RgnHandle', '*', 'InMode')],
+ [('OptRgnHandle', '*', 'InMode')]),
+
+ # Accessors with reference argument also returned.
+ ([('Rect_ptr', 'GetPortBounds', 'ReturnMode')],
+ [('void', '*', 'ReturnMode')]),
+
+ ([('RGBColor_ptr', 'GetPortForeColor', 'ReturnMode')],
+ [('void', '*', 'ReturnMode')]),
+
+ ([('RGBColor_ptr', 'GetPortBackColor', 'ReturnMode')],
+ [('void', '*', 'ReturnMode')]),
+
+ ([('RGBColor_ptr', 'GetPortOpColor', 'ReturnMode')],
+ [('void', '*', 'ReturnMode')]),
+
+ ([('RGBColor_ptr', 'GetPortHiliteColor', 'ReturnMode')],
+ [('void', '*', 'ReturnMode')]),
+
+ ([('Point_ptr', 'GetPortPenSize', 'ReturnMode')],
+ [('void', '*', 'ReturnMode')]),
+
+ ([('Point_ptr', 'GetPortPenLocation', 'ReturnMode')],
+ [('void', '*', 'ReturnMode')]),
+
+ ([('Rect_ptr', 'GetPixBounds', 'ReturnMode')],
+ [('void', '*', 'ReturnMode')]),
+
+ ([('BitMap_ptr', 'GetQDGlobalsScreenBits', 'ReturnMode')],
+ [('void', '*', 'ReturnMode')]),
+
+ ([('Cursor_ptr', 'GetQDGlobalsArrow', 'ReturnMode')],
+ [('void', '*', 'ReturnMode')]),
+
+ ([('Rect_ptr', 'GetRegionBounds', 'ReturnMode')],
+ [('void', '*', 'ReturnMode')]),
+
+ ([('Pattern_ptr', '*', 'ReturnMode')],
+ [('void', '*', 'ReturnMode')]),
+
+ ([('Point_ptr', 'QDLocalToGlobalPoint', 'ReturnMode')],
+ [('void', '*', 'ReturnMode')]),
+
+ ([('Rect_ptr', 'QDLocalToGlobalRect', 'ReturnMode')],
+ [('void', '*', 'ReturnMode')]),
+
+ ([('Point_ptr', 'QDGlobalToLocalPoint', 'ReturnMode')],
+ [('void', '*', 'ReturnMode')]),
+
+ ([('Rect_ptr', 'QDGlobalToLocalRect', 'ReturnMode')],
+ [('void', '*', 'ReturnMode')]),
+
+ ]
+
+if __name__ == "__main__":
+ main()
diff --git a/Mac/Modules/qd/qdsupport.py b/Mac/Modules/qd/qdsupport.py
new file mode 100644
index 0000000000..d078ac6cda
--- /dev/null
+++ b/Mac/Modules/qd/qdsupport.py
@@ -0,0 +1,377 @@
+# This script generates a Python interface for an Apple Macintosh Manager.
+# It uses the "bgen" package to generate C code.
+# The function specifications are generated by scanning the mamager's header file,
+# using the "scantools" package (customized for this particular manager).
+
+import string
+
+# Declarations that change for each manager
+MACHEADERFILE = 'QuickDraw.h' # The Apple header file
+MODNAME = '_Qd' # The name of the module
+OBJECTNAME = 'Graf' # The basic name of the objects used here
+
+# The following is *usually* unchanged but may still require tuning
+MODPREFIX = 'Qd' # The prefix for module-wide routines
+OBJECTTYPE = OBJECTNAME + 'Ptr' # The C type used to represent them
+OBJECTPREFIX = MODPREFIX + 'Obj' # The prefix for object methods
+INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner
+EXTRAFILE = string.lower(MODPREFIX) + 'edit.py' # A similar file but hand-made
+OUTPUTFILE = MODNAME + "module.c" # The file generated by this program
+
+from macsupport import *
+
+# Create the type objects
+
+class TextThingieClass(FixedInputBufferType):
+ def getargsCheck(self, name):
+ Output("/* Fool compiler warnings */")
+ Output("%s__in_len__ = %s__in_len__;", name, name)
+
+ def declareSize(self, name):
+ Output("int %s__in_len__;", name)
+
+TextThingie = TextThingieClass(None)
+
+# These are temporary!
+RgnHandle = OpaqueByValueType("RgnHandle", "ResObj")
+OptRgnHandle = OpaqueByValueType("RgnHandle", "OptResObj")
+PicHandle = OpaqueByValueType("PicHandle", "ResObj")
+PolyHandle = OpaqueByValueType("PolyHandle", "ResObj")
+PixMapHandle = OpaqueByValueType("PixMapHandle", "ResObj")
+PixPatHandle = OpaqueByValueType("PixPatHandle", "ResObj")
+PatHandle = OpaqueByValueType("PatHandle", "ResObj")
+CursHandle = OpaqueByValueType("CursHandle", "ResObj")
+CCrsrHandle = OpaqueByValueType("CCrsrHandle", "ResObj")
+CIconHandle = OpaqueByValueType("CIconHandle", "ResObj")
+CTabHandle = OpaqueByValueType("CTabHandle", "ResObj")
+ITabHandle = OpaqueByValueType("ITabHandle", "ResObj")
+GDHandle = OpaqueByValueType("GDHandle", "ResObj")
+CGrafPtr = OpaqueByValueType("CGrafPtr", "GrafObj")
+GrafPtr = OpaqueByValueType("GrafPtr", "GrafObj")
+BitMap_ptr = OpaqueByValueType("BitMapPtr", "BMObj")
+const_BitMap_ptr = OpaqueByValueType("const BitMap *", "BMObj")
+BitMap = OpaqueType("BitMap", "BMObj_NewCopied", "BUG")
+RGBColor = OpaqueType('RGBColor', 'QdRGB')
+RGBColor_ptr = RGBColor
+FontInfo = OpaqueType('FontInfo', 'QdFI')
+Component = OpaqueByValueType('Component', 'CmpObj')
+ComponentInstance = OpaqueByValueType('ComponentInstance', 'CmpInstObj')
+
+Cursor = StructOutputBufferType('Cursor')
+Cursor_ptr = StructInputBufferType('Cursor')
+Pattern = StructOutputBufferType('Pattern')
+Pattern_ptr = StructInputBufferType('Pattern')
+PenState = StructOutputBufferType('PenState')
+PenState_ptr = StructInputBufferType('PenState')
+TruncCode = Type("TruncCode", "h")
+
+includestuff = includestuff + """
+#include <Carbon/Carbon.h>
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+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(RGBColorPtr);
+extern int _QdRGB_Convert(PyObject *, RGBColorPtr);
+
+#define GrafObj_New _GrafObj_New
+#define GrafObj_Convert _GrafObj_Convert
+#define BMObj_New _BMObj_New
+#define BMObj_Convert _BMObj_Convert
+#define QdRGB_New _QdRGB_New
+#define QdRGB_Convert _QdRGB_Convert
+#endif
+
+static PyObject *BMObj_NewCopied(BitMapPtr);
+
+/*
+** Parse/generate RGB records
+*/
+PyObject *QdRGB_New(RGBColorPtr itself)
+{
+
+ return Py_BuildValue("lll", (long)itself->red, (long)itself->green, (long)itself->blue);
+}
+
+int QdRGB_Convert(PyObject *v, RGBColorPtr p_itself)
+{
+ long red, green, blue;
+
+ if( !PyArg_ParseTuple(v, "lll", &red, &green, &blue) )
+ return 0;
+ p_itself->red = (unsigned short)red;
+ p_itself->green = (unsigned short)green;
+ p_itself->blue = (unsigned short)blue;
+ return 1;
+}
+
+/*
+** Generate FontInfo records
+*/
+static
+PyObject *QdFI_New(FontInfo *itself)
+{
+
+ return Py_BuildValue("hhhh", itself->ascent, itself->descent,
+ itself->widMax, itself->leading);
+}
+"""
+
+finalstuff = finalstuff + """
+/* Like BMObj_New, but the original bitmap data structure is copied (and
+** released when the object is released)
+*/
+PyObject *BMObj_NewCopied(BitMapPtr itself)
+{
+ BitMapObject *it;
+ BitMapPtr itself_copy;
+
+ if ((itself_copy=(BitMapPtr)malloc(sizeof(BitMap))) == NULL)
+ return PyErr_NoMemory();
+ *itself_copy = *itself;
+ it = (BitMapObject *)BMObj_New(itself_copy);
+ it->referred_bitmap = itself_copy;
+ return (PyObject *)it;
+}
+
+"""
+
+variablestuff = ""
+
+initstuff = initstuff + """
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(BitMapPtr, BMObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(BitMapPtr, BMObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(GrafPtr, GrafObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(GrafPtr, GrafObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(RGBColorPtr, QdRGB_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(RGBColor, QdRGB_Convert);
+"""
+
+## not yet...
+##
+##class Region_ObjectDefinition(GlobalObjectDefinition):
+## def outputCheckNewArg(self):
+## Output("if (itself == NULL) return PyMac_Error(resNotFound);")
+## def outputFreeIt(self, itselfname):
+## Output("DisposeRegion(%s);", itselfname)
+##
+##class Polygon_ObjectDefinition(GlobalObjectDefinition):
+## def outputCheckNewArg(self):
+## Output("if (itself == NULL) return PyMac_Error(resNotFound);")
+## def outputFreeIt(self, itselfname):
+## Output("KillPoly(%s);", itselfname)
+
+class MyGRObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
+ getsetlist = [
+ ('visRgn',
+ """RgnHandle h=NewRgn(); /* XXXX wrong dispose routine */
+ return Py_BuildValue("O&", ResObj_New, (Handle)GetPortVisibleRegion(self->ob_itself, h));
+ """,
+ None,
+ "Convenience attribute: return a copy of the visible region"
+ ), (
+ 'clipRgn',
+ """RgnHandle h=NewRgn(); /* XXXX wrong dispose routine */
+ return Py_BuildValue("O&", ResObj_New, (Handle)GetPortClipRegion(self->ob_itself, h));
+ """,
+ None,
+ "Convenience attribute: return a copy of the clipping region"
+ )]
+ def outputCheckNewArg(self):
+ Output("if (itself == NULL) return PyMac_Error(resNotFound);")
+ def outputCheckConvertArg(self):
+ Output("#if 1")
+ OutLbrace()
+ Output("WindowRef win;")
+ OutLbrace("if (WinObj_Convert(v, &win) && v)")
+ Output("*p_itself = (GrafPtr)GetWindowPort(win);")
+ Output("return 1;")
+ OutRbrace()
+ Output("PyErr_Clear();")
+ OutRbrace()
+ Output("#else")
+ OutLbrace("if (DlgObj_Check(v))")
+ Output("DialogRef dlg = (DialogRef)((GrafPortObject *)v)->ob_itself;")
+ Output("*p_itself = (GrafPtr)GetWindowPort(GetDialogWindow(dlg));")
+ Output("return 1;")
+ OutRbrace()
+ OutLbrace("if (WinObj_Check(v))")
+ Output("WindowRef win = (WindowRef)((GrafPortObject *)v)->ob_itself;")
+ Output("*p_itself = (GrafPtr)GetWindowPort(win);")
+ Output("return 1;")
+ OutRbrace()
+ Output("#endif")
+
+class MyBMObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
+ getsetlist = [
+ (
+ 'baseAddr',
+ 'return PyInt_FromLong((long)self->ob_itself->baseAddr);',
+ None,
+ None
+ ), (
+ 'rowBytes',
+ 'return PyInt_FromLong((long)self->ob_itself->rowBytes);',
+ None,
+ None
+ ), (
+ 'bounds',
+ 'return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->bounds);',
+ None,
+ None
+ ), (
+ 'bitmap_data',
+ 'return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(BitMap));',
+ None,
+ None
+ ), (
+ 'pixmap_data',
+ 'return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(PixMap));',
+ None,
+ None
+ )]
+ def outputCheckNewArg(self):
+ Output("if (itself == NULL) return PyMac_Error(resNotFound);")
+ def outputStructMembers(self):
+ # We need to more items: a pointer to privately allocated data
+ # and a python object we're referring to.
+ Output("%s ob_itself;", self.itselftype)
+ Output("PyObject *referred_object;")
+ Output("BitMap *referred_bitmap;")
+ def outputInitStructMembers(self):
+ Output("it->ob_itself = %sitself;", self.argref)
+ Output("it->referred_object = NULL;")
+ Output("it->referred_bitmap = NULL;")
+ def outputCleanupStructMembers(self):
+ Output("Py_XDECREF(self->referred_object);")
+ Output("if (self->referred_bitmap) free(self->referred_bitmap);")
+
+# Create the generator groups and link them
+module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff, variablestuff)
+##r_object = Region_ObjectDefinition('Region', 'QdRgn', 'RgnHandle')
+##po_object = Polygon_ObjectDefinition('Polygon', 'QdPgn', 'PolyHandle')
+##module.addobject(r_object)
+##module.addobject(po_object)
+gr_object = MyGRObjectDefinition("GrafPort", "GrafObj", "GrafPtr")
+module.addobject(gr_object)
+bm_object = MyBMObjectDefinition("BitMap", "BMObj", "BitMapPtr")
+module.addobject(bm_object)
+
+
+# Create the generator classes used to populate the lists
+Function = OSErrWeakLinkFunctionGenerator
+Method = OSErrWeakLinkMethodGenerator
+
+# Create and populate the lists
+functions = []
+gr_methods = []
+bm_methods = []
+#methods = []
+execfile(INPUTFILE)
+execfile(EXTRAFILE)
+
+# add the populated lists to the generator groups
+# (in a different wordl the scan program would generate this)
+for f in functions: module.add(f)
+for f in gr_methods: gr_object.add(f)
+for f in bm_methods: bm_object.add(f)
+
+# Manual generator: get data out of a bitmap
+getdata_body = """
+int from, length;
+char *cp;
+
+if ( !PyArg_ParseTuple(_args, "ii", &from, &length) )
+ return NULL;
+cp = _self->ob_itself->baseAddr+from;
+_res = PyString_FromStringAndSize(cp, length);
+return _res;
+"""
+f = ManualGenerator("getdata", getdata_body)
+f.docstring = lambda: """(int start, int size) -> string. Return bytes from the bitmap"""
+bm_object.add(f)
+
+# Manual generator: store data in a bitmap
+putdata_body = """
+int from, length;
+char *cp, *icp;
+
+if ( !PyArg_ParseTuple(_args, "is#", &from, &icp, &length) )
+ return NULL;
+cp = _self->ob_itself->baseAddr+from;
+memcpy(cp, icp, length);
+Py_INCREF(Py_None);
+_res = Py_None;
+return _res;
+"""
+f = ManualGenerator("putdata", putdata_body)
+f.docstring = lambda: """(int start, string data). Store bytes into the bitmap"""
+bm_object.add(f)
+
+#
+# We manually generate a routine to create a BitMap from python data.
+#
+BitMap_body = """
+BitMap *ptr;
+PyObject *source;
+Rect bounds;
+int rowbytes;
+char *data;
+
+if ( !PyArg_ParseTuple(_args, "O!iO&", &PyString_Type, &source, &rowbytes, PyMac_GetRect,
+ &bounds) )
+ return NULL;
+data = PyString_AsString(source);
+if ((ptr=(BitMap *)malloc(sizeof(BitMap))) == NULL )
+ return PyErr_NoMemory();
+ptr->baseAddr = (Ptr)data;
+ptr->rowBytes = rowbytes;
+ptr->bounds = bounds;
+if ( (_res = BMObj_New(ptr)) == NULL ) {
+ free(ptr);
+ return NULL;
+}
+((BitMapObject *)_res)->referred_object = source;
+Py_INCREF(source);
+((BitMapObject *)_res)->referred_bitmap = ptr;
+return _res;
+"""
+
+f = ManualGenerator("BitMap", BitMap_body)
+f.docstring = lambda: """Take (string, int, Rect) argument and create BitMap"""
+module.add(f)
+
+#
+# And again, for turning a correctly-formatted structure into the object
+#
+RawBitMap_body = """
+BitMap *ptr;
+PyObject *source;
+
+if ( !PyArg_ParseTuple(_args, "O!", &PyString_Type, &source) )
+ return NULL;
+if ( PyString_Size(source) != sizeof(BitMap) && PyString_Size(source) != sizeof(PixMap) ) {
+ PyErr_Format(PyExc_TypeError,
+ "Argument size was %d, should be %d (sizeof BitMap) or %d (sizeof PixMap)",
+ PyString_Size(source), sizeof(BitMap), sizeof(PixMap));
+ return NULL;
+}
+ptr = (BitMapPtr)PyString_AsString(source);
+if ( (_res = BMObj_New(ptr)) == NULL ) {
+ return NULL;
+}
+((BitMapObject *)_res)->referred_object = source;
+Py_INCREF(source);
+return _res;
+"""
+
+f = ManualGenerator("RawBitMap", RawBitMap_body)
+f.docstring = lambda: """Take string BitMap and turn into BitMap object"""
+module.add(f)
+
+# generate output (open the output file as late as possible)
+SetOutputFileName(OUTPUTFILE)
+module.generate()
+SetOutputFile() # Close it
diff --git a/Mac/Modules/qdoffs/_Qdoffsmodule.c b/Mac/Modules/qdoffs/_Qdoffsmodule.c
new file mode 100644
index 0000000000..686eca45f7
--- /dev/null
+++ b/Mac/Modules/qdoffs/_Qdoffsmodule.c
@@ -0,0 +1,722 @@
+
+/* ========================= Module _Qdoffs ========================= */
+
+#include "Python.h"
+
+
+#ifndef __LP64__
+
+#include "pymactoolbox.h"
+
+/* Macro to test whether a weak-loaded CFM function exists */
+#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
+ PyErr_SetString(PyExc_NotImplementedError, \
+ "Not available in this shared library/OS version"); \
+ return NULL; \
+ }} while(0)
+
+
+#include <Carbon/Carbon.h>
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_GWorldObj_New(GWorldPtr);
+extern int _GWorldObj_Convert(PyObject *, GWorldPtr *);
+
+#define GWorldObj_New _GWorldObj_New
+#define GWorldObj_Convert _GWorldObj_Convert
+#endif
+
+#define as_GrafPtr(gworld) ((GrafPtr)(gworld))
+
+
+static PyObject *Qdoffs_Error;
+
+/* ----------------------- Object type GWorld ----------------------- */
+
+PyTypeObject GWorld_Type;
+
+#define GWorldObj_Check(x) ((x)->ob_type == &GWorld_Type || PyObject_TypeCheck((x), &GWorld_Type))
+
+typedef struct GWorldObject {
+ PyObject_HEAD
+ GWorldPtr ob_itself;
+} GWorldObject;
+
+PyObject *GWorldObj_New(GWorldPtr itself)
+{
+ GWorldObject *it;
+ if (itself == NULL) return PyMac_Error(resNotFound);
+ it = PyObject_NEW(GWorldObject, &GWorld_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+
+int GWorldObj_Convert(PyObject *v, GWorldPtr *p_itself)
+{
+ if (!GWorldObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "GWorld required");
+ return 0;
+ }
+ *p_itself = ((GWorldObject *)v)->ob_itself;
+ return 1;
+}
+
+static void GWorldObj_dealloc(GWorldObject *self)
+{
+ DisposeGWorld(self->ob_itself);
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *GWorldObj_GetGWorldDevice(GWorldObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GDHandle _rv;
+#ifndef GetGWorldDevice
+ PyMac_PRECHECK(GetGWorldDevice);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetGWorldDevice(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *GWorldObj_GetGWorldPixMap(GWorldObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixMapHandle _rv;
+#ifndef GetGWorldPixMap
+ PyMac_PRECHECK(GetGWorldPixMap);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetGWorldPixMap(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *GWorldObj_as_GrafPtr(GWorldObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GrafPtr _rv;
+#ifndef as_GrafPtr
+ PyMac_PRECHECK(as_GrafPtr);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = as_GrafPtr(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ GrafObj_New, _rv);
+ return _res;
+}
+
+static PyMethodDef GWorldObj_methods[] = {
+ {"GetGWorldDevice", (PyCFunction)GWorldObj_GetGWorldDevice, 1,
+ PyDoc_STR("() -> (GDHandle _rv)")},
+ {"GetGWorldPixMap", (PyCFunction)GWorldObj_GetGWorldPixMap, 1,
+ PyDoc_STR("() -> (PixMapHandle _rv)")},
+ {"as_GrafPtr", (PyCFunction)GWorldObj_as_GrafPtr, 1,
+ PyDoc_STR("() -> (GrafPtr _rv)")},
+ {NULL, NULL, 0}
+};
+
+#define GWorldObj_getsetlist NULL
+
+
+#define GWorldObj_compare NULL
+
+#define GWorldObj_repr NULL
+
+#define GWorldObj_hash NULL
+#define GWorldObj_tp_init 0
+
+#define GWorldObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *GWorldObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *_self;
+ GWorldPtr itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, GWorldObj_Convert, &itself)) return NULL;
+ if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((GWorldObject *)_self)->ob_itself = itself;
+ return _self;
+}
+
+#define GWorldObj_tp_free PyObject_Del
+
+
+PyTypeObject GWorld_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_Qdoffs.GWorld", /*tp_name*/
+ sizeof(GWorldObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) GWorldObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) GWorldObj_compare, /*tp_compare*/
+ (reprfunc) GWorldObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) GWorldObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ GWorldObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ GWorldObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ GWorldObj_tp_init, /* tp_init */
+ GWorldObj_tp_alloc, /* tp_alloc */
+ GWorldObj_tp_new, /* tp_new */
+ GWorldObj_tp_free, /* tp_free */
+};
+
+/* --------------------- End object type GWorld --------------------- */
+
+
+static PyObject *Qdoffs_NewGWorld(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ QDErr _err;
+ GWorldPtr offscreenGWorld;
+ short PixelDepth;
+ Rect boundsRect;
+ CTabHandle cTable;
+ GDHandle aGDevice;
+ GWorldFlags flags;
+#ifndef NewGWorld
+ PyMac_PRECHECK(NewGWorld);
+#endif
+ if (!PyArg_ParseTuple(_args, "hO&O&O&l",
+ &PixelDepth,
+ PyMac_GetRect, &boundsRect,
+ OptResObj_Convert, &cTable,
+ OptResObj_Convert, &aGDevice,
+ &flags))
+ return NULL;
+ _err = NewGWorld(&offscreenGWorld,
+ PixelDepth,
+ &boundsRect,
+ cTable,
+ aGDevice,
+ flags);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ GWorldObj_New, offscreenGWorld);
+ return _res;
+}
+
+static PyObject *Qdoffs_LockPixels(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ PixMapHandle pm;
+#ifndef LockPixels
+ PyMac_PRECHECK(LockPixels);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &pm))
+ return NULL;
+ _rv = LockPixels(pm);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qdoffs_UnlockPixels(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixMapHandle pm;
+#ifndef UnlockPixels
+ PyMac_PRECHECK(UnlockPixels);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &pm))
+ return NULL;
+ UnlockPixels(pm);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qdoffs_UpdateGWorld(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GWorldFlags _rv;
+ GWorldPtr offscreenGWorld;
+ short pixelDepth;
+ Rect boundsRect;
+ CTabHandle cTable;
+ GDHandle aGDevice;
+ GWorldFlags flags;
+#ifndef UpdateGWorld
+ PyMac_PRECHECK(UpdateGWorld);
+#endif
+ if (!PyArg_ParseTuple(_args, "hO&O&O&l",
+ &pixelDepth,
+ PyMac_GetRect, &boundsRect,
+ OptResObj_Convert, &cTable,
+ OptResObj_Convert, &aGDevice,
+ &flags))
+ return NULL;
+ _rv = UpdateGWorld(&offscreenGWorld,
+ pixelDepth,
+ &boundsRect,
+ cTable,
+ aGDevice,
+ flags);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ GWorldObj_New, offscreenGWorld);
+ return _res;
+}
+
+static PyObject *Qdoffs_GetGWorld(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr port;
+ GDHandle gdh;
+#ifndef GetGWorld
+ PyMac_PRECHECK(GetGWorld);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetGWorld(&port,
+ &gdh);
+ _res = Py_BuildValue("O&O&",
+ GrafObj_New, port,
+ ResObj_New, gdh);
+ return _res;
+}
+
+static PyObject *Qdoffs_SetGWorld(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr port;
+ GDHandle gdh;
+#ifndef SetGWorld
+ PyMac_PRECHECK(SetGWorld);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ GrafObj_Convert, &port,
+ OptResObj_Convert, &gdh))
+ return NULL;
+ SetGWorld(port,
+ gdh);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qdoffs_CTabChanged(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CTabHandle ctab;
+#ifndef CTabChanged
+ PyMac_PRECHECK(CTabChanged);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ OptResObj_Convert, &ctab))
+ return NULL;
+ CTabChanged(ctab);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qdoffs_PixPatChanged(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixPatHandle ppat;
+#ifndef PixPatChanged
+ PyMac_PRECHECK(PixPatChanged);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &ppat))
+ return NULL;
+ PixPatChanged(ppat);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qdoffs_PortChanged(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GrafPtr port;
+#ifndef PortChanged
+ PyMac_PRECHECK(PortChanged);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ GrafObj_Convert, &port))
+ return NULL;
+ PortChanged(port);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qdoffs_GDeviceChanged(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GDHandle gdh;
+#ifndef GDeviceChanged
+ PyMac_PRECHECK(GDeviceChanged);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ OptResObj_Convert, &gdh))
+ return NULL;
+ GDeviceChanged(gdh);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qdoffs_AllowPurgePixels(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixMapHandle pm;
+#ifndef AllowPurgePixels
+ PyMac_PRECHECK(AllowPurgePixels);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &pm))
+ return NULL;
+ AllowPurgePixels(pm);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qdoffs_NoPurgePixels(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixMapHandle pm;
+#ifndef NoPurgePixels
+ PyMac_PRECHECK(NoPurgePixels);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &pm))
+ return NULL;
+ NoPurgePixels(pm);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qdoffs_GetPixelsState(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GWorldFlags _rv;
+ PixMapHandle pm;
+#ifndef GetPixelsState
+ PyMac_PRECHECK(GetPixelsState);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &pm))
+ return NULL;
+ _rv = GetPixelsState(pm);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qdoffs_SetPixelsState(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixMapHandle pm;
+ GWorldFlags state;
+#ifndef SetPixelsState
+ PyMac_PRECHECK(SetPixelsState);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ ResObj_Convert, &pm,
+ &state))
+ return NULL;
+ SetPixelsState(pm,
+ state);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qdoffs_GetPixRowBytes(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ PixMapHandle pm;
+#ifndef GetPixRowBytes
+ PyMac_PRECHECK(GetPixRowBytes);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &pm))
+ return NULL;
+ _rv = GetPixRowBytes(pm);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qdoffs_NewScreenBuffer(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ QDErr _err;
+ Rect globalRect;
+ Boolean purgeable;
+ GDHandle gdh;
+ PixMapHandle offscreenPixMap;
+#ifndef NewScreenBuffer
+ PyMac_PRECHECK(NewScreenBuffer);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&b",
+ PyMac_GetRect, &globalRect,
+ &purgeable))
+ return NULL;
+ _err = NewScreenBuffer(&globalRect,
+ purgeable,
+ &gdh,
+ &offscreenPixMap);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&O&",
+ ResObj_New, gdh,
+ ResObj_New, offscreenPixMap);
+ return _res;
+}
+
+static PyObject *Qdoffs_DisposeScreenBuffer(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixMapHandle offscreenPixMap;
+#ifndef DisposeScreenBuffer
+ PyMac_PRECHECK(DisposeScreenBuffer);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &offscreenPixMap))
+ return NULL;
+ DisposeScreenBuffer(offscreenPixMap);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qdoffs_QDDone(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ GrafPtr port;
+#ifndef QDDone
+ PyMac_PRECHECK(QDDone);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ GrafObj_Convert, &port))
+ return NULL;
+ _rv = QDDone(port);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qdoffs_OffscreenVersion(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+#ifndef OffscreenVersion
+ PyMac_PRECHECK(OffscreenVersion);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = OffscreenVersion();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qdoffs_NewTempScreenBuffer(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ QDErr _err;
+ Rect globalRect;
+ Boolean purgeable;
+ GDHandle gdh;
+ PixMapHandle offscreenPixMap;
+#ifndef NewTempScreenBuffer
+ PyMac_PRECHECK(NewTempScreenBuffer);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&b",
+ PyMac_GetRect, &globalRect,
+ &purgeable))
+ return NULL;
+ _err = NewTempScreenBuffer(&globalRect,
+ purgeable,
+ &gdh,
+ &offscreenPixMap);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&O&",
+ ResObj_New, gdh,
+ ResObj_New, offscreenPixMap);
+ return _res;
+}
+
+static PyObject *Qdoffs_PixMap32Bit(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ PixMapHandle pmHandle;
+#ifndef PixMap32Bit
+ PyMac_PRECHECK(PixMap32Bit);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &pmHandle))
+ return NULL;
+ _rv = PixMap32Bit(pmHandle);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qdoffs_GetPixMapBytes(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ PixMapHandle pm;
+ int from, length;
+ char *cp;
+
+ if ( !PyArg_ParseTuple(_args, "O&ii", ResObj_Convert, &pm, &from, &length) )
+ return NULL;
+ cp = GetPixBaseAddr(pm)+from;
+ _res = PyString_FromStringAndSize(cp, length);
+ return _res;
+
+}
+
+static PyObject *Qdoffs_PutPixMapBytes(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ PixMapHandle pm;
+ int from, length;
+ char *cp, *icp;
+
+ if ( !PyArg_ParseTuple(_args, "O&is#", ResObj_Convert, &pm, &from, &icp, &length) )
+ return NULL;
+ cp = GetPixBaseAddr(pm)+from;
+ memcpy(cp, icp, length);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ 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,
+ PyDoc_STR("(PixMapHandle pm) -> (Boolean _rv)")},
+ {"UnlockPixels", (PyCFunction)Qdoffs_UnlockPixels, 1,
+ PyDoc_STR("(PixMapHandle pm) -> None")},
+ {"UpdateGWorld", (PyCFunction)Qdoffs_UpdateGWorld, 1,
+ PyDoc_STR("(short pixelDepth, Rect boundsRect, CTabHandle cTable, GDHandle aGDevice, GWorldFlags flags) -> (GWorldFlags _rv, GWorldPtr offscreenGWorld)")},
+ {"GetGWorld", (PyCFunction)Qdoffs_GetGWorld, 1,
+ PyDoc_STR("() -> (CGrafPtr port, GDHandle gdh)")},
+ {"SetGWorld", (PyCFunction)Qdoffs_SetGWorld, 1,
+ PyDoc_STR("(CGrafPtr port, GDHandle gdh) -> None")},
+ {"CTabChanged", (PyCFunction)Qdoffs_CTabChanged, 1,
+ PyDoc_STR("(CTabHandle ctab) -> None")},
+ {"PixPatChanged", (PyCFunction)Qdoffs_PixPatChanged, 1,
+ PyDoc_STR("(PixPatHandle ppat) -> None")},
+ {"PortChanged", (PyCFunction)Qdoffs_PortChanged, 1,
+ PyDoc_STR("(GrafPtr port) -> None")},
+ {"GDeviceChanged", (PyCFunction)Qdoffs_GDeviceChanged, 1,
+ PyDoc_STR("(GDHandle gdh) -> None")},
+ {"AllowPurgePixels", (PyCFunction)Qdoffs_AllowPurgePixels, 1,
+ PyDoc_STR("(PixMapHandle pm) -> None")},
+ {"NoPurgePixels", (PyCFunction)Qdoffs_NoPurgePixels, 1,
+ PyDoc_STR("(PixMapHandle pm) -> None")},
+ {"GetPixelsState", (PyCFunction)Qdoffs_GetPixelsState, 1,
+ PyDoc_STR("(PixMapHandle pm) -> (GWorldFlags _rv)")},
+ {"SetPixelsState", (PyCFunction)Qdoffs_SetPixelsState, 1,
+ PyDoc_STR("(PixMapHandle pm, GWorldFlags state) -> None")},
+ {"GetPixRowBytes", (PyCFunction)Qdoffs_GetPixRowBytes, 1,
+ PyDoc_STR("(PixMapHandle pm) -> (long _rv)")},
+ {"NewScreenBuffer", (PyCFunction)Qdoffs_NewScreenBuffer, 1,
+ PyDoc_STR("(Rect globalRect, Boolean purgeable) -> (GDHandle gdh, PixMapHandle offscreenPixMap)")},
+ {"DisposeScreenBuffer", (PyCFunction)Qdoffs_DisposeScreenBuffer, 1,
+ PyDoc_STR("(PixMapHandle offscreenPixMap) -> None")},
+ {"QDDone", (PyCFunction)Qdoffs_QDDone, 1,
+ PyDoc_STR("(GrafPtr port) -> (Boolean _rv)")},
+ {"OffscreenVersion", (PyCFunction)Qdoffs_OffscreenVersion, 1,
+ PyDoc_STR("() -> (long _rv)")},
+ {"NewTempScreenBuffer", (PyCFunction)Qdoffs_NewTempScreenBuffer, 1,
+ PyDoc_STR("(Rect globalRect, Boolean purgeable) -> (GDHandle gdh, PixMapHandle offscreenPixMap)")},
+ {"PixMap32Bit", (PyCFunction)Qdoffs_PixMap32Bit, 1,
+ PyDoc_STR("(PixMapHandle pmHandle) -> (Boolean _rv)")},
+ {"GetPixMapBytes", (PyCFunction)Qdoffs_GetPixMapBytes, 1,
+ 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}
+};
+
+
+
+
+void init_Qdoffs(void)
+{
+ PyObject *m;
+#ifndef __LP64__
+ PyObject *d;
+
+
+
+ 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 ||
+ PyDict_SetItemString(d, "Error", Qdoffs_Error) != 0)
+ return;
+ GWorld_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&GWorld_Type) < 0) return;
+ Py_INCREF(&GWorld_Type);
+ PyModule_AddObject(m, "GWorld", (PyObject *)&GWorld_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&GWorld_Type);
+ PyModule_AddObject(m, "GWorldType", (PyObject *)&GWorld_Type);
+#endif /* __LP64__ */
+}
+
+/* ======================= End module _Qdoffs ======================= */
+
diff --git a/Mac/Modules/qdoffs/qdoffsscan.py b/Mac/Modules/qdoffs/qdoffsscan.py
new file mode 100644
index 0000000000..0ad98028b4
--- /dev/null
+++ b/Mac/Modules/qdoffs/qdoffsscan.py
@@ -0,0 +1,65 @@
+# Scan an Apple header file, generating a Python file of generator calls.
+import sys
+from bgenlocations import TOOLBOXDIR, BGENDIR
+sys.path.append(BGENDIR)
+
+from scantools import Scanner
+
+def main():
+ input = "QDOffscreen.h"
+ output = "qdoffsgen.py"
+ defsoutput = TOOLBOXDIR + "QDOffscreen.py"
+ scanner = MyScanner(input, output, defsoutput)
+ scanner.scan()
+ scanner.close()
+ print "=== Testing definitions output code ==="
+ execfile(defsoutput, {}, {})
+ print "=== Done scanning and generating, now importing the generated code... ==="
+ import qdoffssupport
+ print "=== Done. It's up to you to compile it now! ==="
+
+class MyScanner(Scanner):
+
+ def destination(self, type, name, arglist):
+ classname = "Function"
+ listname = "functions"
+ if arglist:
+ t, n, m = arglist[0]
+ if t == "GWorldPtr" and m in ("InMode", "InOutMode"):
+ classname = "Method"
+ listname = "methods"
+ return classname, listname
+
+ def writeinitialdefs(self):
+ self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
+
+ def makeblacklistnames(self):
+ return [
+ 'DisposeGWorld', # Implied when the object is deleted
+ 'NewGWorldFromHBITMAP', # Don't know what the args do
+ 'GetGDeviceAttributes', # Windows-only
+ ]
+
+ def makeblacklisttypes(self):
+ return [
+ "void_ptr", # GetGDeviceSurface, blacklisted for now
+ "Ptr", # Again, for now (array is probably ok here)
+ ]
+
+ def makerepairinstructions(self):
+ return [
+
+## ("UpdateGWorld",
+## [("GWorldPtr", "*", "OutMode")],
+## [("*", "*", "InOutMode")]),
+
+ # This one is incorrect: we say that all input gdevices are
+ # optional, but some are not. Most are, however, so users passing
+ # None for non-optional gdevices will get a qd error, I guess, in
+ # stead of a python argument error.
+ ([("GDHandle", "*", "InMode")],
+ [("OptGDHandle", "*", "InMode")]),
+ ]
+
+if __name__ == "__main__":
+ main()
diff --git a/Mac/Modules/qdoffs/qdoffssupport.py b/Mac/Modules/qdoffs/qdoffssupport.py
new file mode 100644
index 0000000000..16177733d5
--- /dev/null
+++ b/Mac/Modules/qdoffs/qdoffssupport.py
@@ -0,0 +1,139 @@
+# This script generates a Python interface for an Apple Macintosh Manager.
+# It uses the "bgen" package to generate C code.
+# The function specifications are generated by scanning the mamager's header file,
+# using the "scantools" package (customized for this particular manager).
+
+import string
+
+# Declarations that change for each manager
+MACHEADERFILE = 'QDOffscreen.h' # The Apple header file
+MODNAME = '_Qdoffs' # The name of the module
+OBJECTNAME = 'GWorld' # The basic name of the objects used here
+
+# The following is *usually* unchanged but may still require tuning
+MODPREFIX = 'Qdoffs' # The prefix for module-wide routines
+OBJECTTYPE = OBJECTNAME + 'Ptr' # The C type used to represent them
+OBJECTPREFIX = OBJECTNAME + 'Obj' # The prefix for object methods
+INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner
+#EDITFILE = string.lower(MODPREFIX) + 'edit.py' # The manual definitions
+OUTPUTFILE = MODNAME + "module.c" # The file generated by this program
+
+from macsupport import *
+
+# Create the type objects
+
+GWorldPtr = OpaqueByValueType(OBJECTTYPE, OBJECTPREFIX)
+GWorldFlags = Type("GWorldFlags", "l")
+GDHandle = OpaqueByValueType("GDHandle", "ResObj")
+OptGDHandle = OpaqueByValueType("GDHandle", "OptResObj")
+CTabHandle = OpaqueByValueType("CTabHandle", "OptResObj")
+PixPatHandle = OpaqueByValueType("PixPatHandle", "ResObj")
+PixMapHandle = OpaqueByValueType("PixMapHandle", "ResObj")
+CGrafPtr = OpaqueByValueType("CGrafPtr", "GrafObj")
+GrafPtr = OpaqueByValueType("GrafPtr", "GrafObj")
+QDErr = OSErrType("QDErr", 'h')
+
+includestuff = includestuff + """
+#include <Carbon/Carbon.h>
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_GWorldObj_New(GWorldPtr);
+extern int _GWorldObj_Convert(PyObject *, GWorldPtr *);
+
+#define GWorldObj_New _GWorldObj_New
+#define GWorldObj_Convert _GWorldObj_Convert
+#endif
+
+#define as_GrafPtr(gworld) ((GrafPtr)(gworld))
+
+"""
+
+initstuff = initstuff + """
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(GWorldPtr, GWorldObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(GWorldPtr, GWorldObj_Convert);
+"""
+
+class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
+ # XXXX Should inherit from GrafPtr?
+ def outputCheckNewArg(self):
+ Output("if (itself == NULL) return PyMac_Error(resNotFound);")
+## def outputInitStructMembers(self):
+## GlobalObjectDefinition.outputInitStructMembers(self)
+## Output("SetWRefCon(itself, (long)it);")
+## def outputCheckConvertArg(self):
+## OutLbrace("if (DlgObj_Check(v))")
+## Output("*p_itself = ((WindowObject *)v)->ob_itself;")
+## Output("return 1;")
+## OutRbrace()
+## Out("""
+## if (v == Py_None) { *p_itself = NULL; return 1; }
+## if (PyInt_Check(v)) { *p_itself = (WindowPtr)PyInt_AsLong(v); return 1; }
+## """)
+ def outputFreeIt(self, itselfname):
+ Output("DisposeGWorld(%s);", itselfname)
+# From here on it's basically all boiler plate...
+
+# Create the generator groups and link them
+module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff)
+object = MyObjectDefinition(OBJECTNAME, OBJECTPREFIX, OBJECTTYPE)
+module.addobject(object)
+
+
+# Create the generator classes used to populate the lists
+Function = OSErrWeakLinkFunctionGenerator
+Method = OSErrWeakLinkMethodGenerator
+
+# Create and populate the lists
+functions = []
+methods = []
+execfile(INPUTFILE)
+
+# A method to convert a GWorldPtr to a GrafPtr
+f = Method(GrafPtr, 'as_GrafPtr', (GWorldPtr, 'p', InMode))
+methods.append(f)
+
+#
+# Manual generator: get data out of a pixmap
+pixmapgetbytes_body = """
+PixMapHandle pm;
+int from, length;
+char *cp;
+
+if ( !PyArg_ParseTuple(_args, "O&ii", ResObj_Convert, &pm, &from, &length) )
+ return NULL;
+cp = GetPixBaseAddr(pm)+from;
+_res = PyString_FromStringAndSize(cp, length);
+return _res;
+"""
+f = ManualGenerator("GetPixMapBytes", pixmapgetbytes_body)
+f.docstring = lambda: """(pixmap, int start, int size) -> string. Return bytes from the pixmap"""
+functions.append(f)
+
+# Manual generator: store data in a pixmap
+pixmapputbytes_body = """
+PixMapHandle pm;
+int from, length;
+char *cp, *icp;
+
+if ( !PyArg_ParseTuple(_args, "O&is#", ResObj_Convert, &pm, &from, &icp, &length) )
+ return NULL;
+cp = GetPixBaseAddr(pm)+from;
+memcpy(cp, icp, length);
+Py_INCREF(Py_None);
+_res = Py_None;
+return _res;
+"""
+f = ManualGenerator("PutPixMapBytes", pixmapputbytes_body)
+f.docstring = lambda: """(pixmap, int start, string data). Store bytes into the pixmap"""
+functions.append(f)
+
+# add the populated lists to the generator groups
+# (in a different wordl the scan program would generate this)
+for f in functions: module.add(f)
+for f in methods: object.add(f)
+
+
+
+# generate output (open the output file as late as possible)
+SetOutputFileName(OUTPUTFILE)
+module.generate()
diff --git a/Mac/Modules/qt/_Qtmodule.c b/Mac/Modules/qt/_Qtmodule.c
new file mode 100644
index 0000000000..bf67cdaedf
--- /dev/null
+++ b/Mac/Modules/qt/_Qtmodule.c
@@ -0,0 +1,28091 @@
+
+/* =========================== Module _Qt =========================== */
+
+#include "Python.h"
+
+
+#ifndef __LP64__
+
+#include "pymactoolbox.h"
+
+/* Macro to test whether a weak-loaded CFM function exists */
+#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
+ PyErr_SetString(PyExc_NotImplementedError, \
+ "Not available in this shared library/OS version"); \
+ return NULL; \
+ }} while(0)
+
+
+#include <QuickTime/QuickTime.h>
+
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_TrackObj_New(Track);
+extern int _TrackObj_Convert(PyObject *, Track *);
+extern PyObject *_MovieObj_New(Movie);
+extern int _MovieObj_Convert(PyObject *, Movie *);
+extern PyObject *_MovieCtlObj_New(MovieController);
+extern int _MovieCtlObj_Convert(PyObject *, MovieController *);
+extern PyObject *_TimeBaseObj_New(TimeBase);
+extern int _TimeBaseObj_Convert(PyObject *, TimeBase *);
+extern PyObject *_UserDataObj_New(UserData);
+extern int _UserDataObj_Convert(PyObject *, UserData *);
+extern PyObject *_MediaObj_New(Media);
+extern int _MediaObj_Convert(PyObject *, Media *);
+
+#define TrackObj_New _TrackObj_New
+#define TrackObj_Convert _TrackObj_Convert
+#define MovieObj_New _MovieObj_New
+#define MovieObj_Convert _MovieObj_Convert
+#define MovieCtlObj_New _MovieCtlObj_New
+#define MovieCtlObj_Convert _MovieCtlObj_Convert
+#define TimeBaseObj_New _TimeBaseObj_New
+#define TimeBaseObj_Convert _TimeBaseObj_Convert
+#define UserDataObj_New _UserDataObj_New
+#define UserDataObj_Convert _UserDataObj_Convert
+#define MediaObj_New _MediaObj_New
+#define MediaObj_Convert _MediaObj_Convert
+#endif
+
+/* Macro to allow us to GetNextInterestingTime without duration */
+#define GetMediaNextInterestingTimeOnly(media, flags, time, rate, rv) GetMediaNextInterestingTime(media, flags, time, rate, rv, NULL)
+
+/*
+** Parse/generate time records
+*/
+static PyObject *
+QtTimeRecord_New(TimeRecord *itself)
+{
+ if (itself->base)
+ return Py_BuildValue("O&lO&", PyMac_Buildwide, &itself->value, itself->scale,
+ TimeBaseObj_New, itself->base);
+ else
+ return Py_BuildValue("O&lO", PyMac_Buildwide, &itself->value, itself->scale,
+ Py_None);
+}
+
+static int
+QtTimeRecord_Convert(PyObject *v, TimeRecord *p_itself)
+{
+ PyObject *base = NULL;
+ if( !PyArg_ParseTuple(v, "O&l|O", PyMac_Getwide, &p_itself->value, &p_itself->scale,
+ &base) )
+ return 0;
+ if ( base == NULL || base == Py_None )
+ p_itself->base = NULL;
+ else
+ if ( !TimeBaseObj_Convert(base, &p_itself->base) )
+ return 0;
+ return 1;
+}
+
+static int
+QtMusicMIDIPacket_Convert(PyObject *v, MusicMIDIPacket *p_itself)
+{
+ int dummy;
+
+ if( !PyArg_ParseTuple(v, "hls#", &p_itself->length, &p_itself->reserved, p_itself->data, dummy) )
+ return 0;
+ return 1;
+}
+
+
+
+
+static PyObject *Qt_Error;
+
+/* -------------------- Object type IdleManager --------------------- */
+
+PyTypeObject IdleManager_Type;
+
+#define IdleManagerObj_Check(x) ((x)->ob_type == &IdleManager_Type || PyObject_TypeCheck((x), &IdleManager_Type))
+
+typedef struct IdleManagerObject {
+ PyObject_HEAD
+ IdleManager ob_itself;
+} IdleManagerObject;
+
+PyObject *IdleManagerObj_New(IdleManager itself)
+{
+ IdleManagerObject *it;
+ if (itself == NULL) {
+ PyErr_SetString(Qt_Error,"Cannot create IdleManager from NULL pointer");
+ return NULL;
+ }
+ it = PyObject_NEW(IdleManagerObject, &IdleManager_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+
+int IdleManagerObj_Convert(PyObject *v, IdleManager *p_itself)
+{
+ if (v == Py_None)
+ {
+ *p_itself = NULL;
+ return 1;
+ }
+ if (!IdleManagerObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "IdleManager required");
+ return 0;
+ }
+ *p_itself = ((IdleManagerObject *)v)->ob_itself;
+ return 1;
+}
+
+static void IdleManagerObj_dealloc(IdleManagerObject *self)
+{
+ /* Cleanup of self->ob_itself goes here */
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyMethodDef IdleManagerObj_methods[] = {
+ {NULL, NULL, 0}
+};
+
+#define IdleManagerObj_getsetlist NULL
+
+
+#define IdleManagerObj_compare NULL
+
+#define IdleManagerObj_repr NULL
+
+#define IdleManagerObj_hash NULL
+#define IdleManagerObj_tp_init 0
+
+#define IdleManagerObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *IdleManagerObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *_self;
+ IdleManager itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, IdleManagerObj_Convert, &itself)) return NULL;
+ if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((IdleManagerObject *)_self)->ob_itself = itself;
+ return _self;
+}
+
+#define IdleManagerObj_tp_free PyObject_Del
+
+
+PyTypeObject IdleManager_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_Qt.IdleManager", /*tp_name*/
+ sizeof(IdleManagerObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) IdleManagerObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) IdleManagerObj_compare, /*tp_compare*/
+ (reprfunc) IdleManagerObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) IdleManagerObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ IdleManagerObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ IdleManagerObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ IdleManagerObj_tp_init, /* tp_init */
+ IdleManagerObj_tp_alloc, /* tp_alloc */
+ IdleManagerObj_tp_new, /* tp_new */
+ IdleManagerObj_tp_free, /* tp_free */
+};
+
+/* ------------------ End object type IdleManager ------------------- */
+
+
+/* ------------------ Object type MovieController ------------------- */
+
+PyTypeObject MovieController_Type;
+
+#define MovieCtlObj_Check(x) ((x)->ob_type == &MovieController_Type || PyObject_TypeCheck((x), &MovieController_Type))
+
+typedef struct MovieControllerObject {
+ PyObject_HEAD
+ MovieController ob_itself;
+} MovieControllerObject;
+
+PyObject *MovieCtlObj_New(MovieController itself)
+{
+ MovieControllerObject *it;
+ if (itself == NULL) {
+ PyErr_SetString(Qt_Error,"Cannot create MovieController from NULL pointer");
+ return NULL;
+ }
+ it = PyObject_NEW(MovieControllerObject, &MovieController_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+
+int MovieCtlObj_Convert(PyObject *v, MovieController *p_itself)
+{
+ if (v == Py_None)
+ {
+ *p_itself = NULL;
+ return 1;
+ }
+ if (!MovieCtlObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "MovieController required");
+ return 0;
+ }
+ *p_itself = ((MovieControllerObject *)v)->ob_itself;
+ return 1;
+}
+
+static void MovieCtlObj_dealloc(MovieControllerObject *self)
+{
+ if (self->ob_itself) DisposeMovieController(self->ob_itself);
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *MovieCtlObj_MCSetMovie(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ Movie theMovie;
+ WindowPtr movieWindow;
+ Point where;
+#ifndef MCSetMovie
+ PyMac_PRECHECK(MCSetMovie);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ MovieObj_Convert, &theMovie,
+ WinObj_Convert, &movieWindow,
+ PyMac_GetPoint, &where))
+ return NULL;
+ _rv = MCSetMovie(_self->ob_itself,
+ theMovie,
+ movieWindow,
+ where);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCGetIndMovie(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Movie _rv;
+ short index;
+#ifndef MCGetIndMovie
+ PyMac_PRECHECK(MCGetIndMovie);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &index))
+ return NULL;
+ _rv = MCGetIndMovie(_self->ob_itself,
+ index);
+ _res = Py_BuildValue("O&",
+ MovieObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCRemoveAllMovies(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+#ifndef MCRemoveAllMovies
+ PyMac_PRECHECK(MCRemoveAllMovies);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MCRemoveAllMovies(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCRemoveAMovie(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ Movie m;
+#ifndef MCRemoveAMovie
+ PyMac_PRECHECK(MCRemoveAMovie);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ MovieObj_Convert, &m))
+ return NULL;
+ _rv = MCRemoveAMovie(_self->ob_itself,
+ m);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCRemoveMovie(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+#ifndef MCRemoveMovie
+ PyMac_PRECHECK(MCRemoveMovie);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MCRemoveMovie(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCIsPlayerEvent(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ EventRecord e;
+#ifndef MCIsPlayerEvent
+ PyMac_PRECHECK(MCIsPlayerEvent);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetEventRecord, &e))
+ return NULL;
+ _rv = MCIsPlayerEvent(_self->ob_itself,
+ &e);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCDoAction(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ short action;
+ void * params;
+#ifndef MCDoAction
+ PyMac_PRECHECK(MCDoAction);
+#endif
+ if (!PyArg_ParseTuple(_args, "hs",
+ &action,
+ &params))
+ return NULL;
+ _rv = MCDoAction(_self->ob_itself,
+ action,
+ params);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCSetControllerAttached(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ Boolean attach;
+#ifndef MCSetControllerAttached
+ PyMac_PRECHECK(MCSetControllerAttached);
+#endif
+ if (!PyArg_ParseTuple(_args, "b",
+ &attach))
+ return NULL;
+ _rv = MCSetControllerAttached(_self->ob_itself,
+ attach);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCIsControllerAttached(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+#ifndef MCIsControllerAttached
+ PyMac_PRECHECK(MCIsControllerAttached);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MCIsControllerAttached(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCSetControllerPort(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ CGrafPtr gp;
+#ifndef MCSetControllerPort
+ PyMac_PRECHECK(MCSetControllerPort);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ GrafObj_Convert, &gp))
+ return NULL;
+ _rv = MCSetControllerPort(_self->ob_itself,
+ gp);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCGetControllerPort(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr _rv;
+#ifndef MCGetControllerPort
+ PyMac_PRECHECK(MCGetControllerPort);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MCGetControllerPort(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ GrafObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCSetVisible(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ Boolean visible;
+#ifndef MCSetVisible
+ PyMac_PRECHECK(MCSetVisible);
+#endif
+ if (!PyArg_ParseTuple(_args, "b",
+ &visible))
+ return NULL;
+ _rv = MCSetVisible(_self->ob_itself,
+ visible);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCGetVisible(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+#ifndef MCGetVisible
+ PyMac_PRECHECK(MCGetVisible);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MCGetVisible(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCGetControllerBoundsRect(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ Rect bounds;
+#ifndef MCGetControllerBoundsRect
+ PyMac_PRECHECK(MCGetControllerBoundsRect);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MCGetControllerBoundsRect(_self->ob_itself,
+ &bounds);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildRect, &bounds);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCSetControllerBoundsRect(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ Rect bounds;
+#ifndef MCSetControllerBoundsRect
+ PyMac_PRECHECK(MCSetControllerBoundsRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &bounds))
+ return NULL;
+ _rv = MCSetControllerBoundsRect(_self->ob_itself,
+ &bounds);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCGetControllerBoundsRgn(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle _rv;
+#ifndef MCGetControllerBoundsRgn
+ PyMac_PRECHECK(MCGetControllerBoundsRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MCGetControllerBoundsRgn(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCGetWindowRgn(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle _rv;
+ WindowPtr w;
+#ifndef MCGetWindowRgn
+ PyMac_PRECHECK(MCGetWindowRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &w))
+ return NULL;
+ _rv = MCGetWindowRgn(_self->ob_itself,
+ w);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCMovieChanged(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ Movie m;
+#ifndef MCMovieChanged
+ PyMac_PRECHECK(MCMovieChanged);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ MovieObj_Convert, &m))
+ return NULL;
+ _rv = MCMovieChanged(_self->ob_itself,
+ m);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCSetDuration(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ TimeValue duration;
+#ifndef MCSetDuration
+ PyMac_PRECHECK(MCSetDuration);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &duration))
+ return NULL;
+ _rv = MCSetDuration(_self->ob_itself,
+ duration);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCGetCurrentTime(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue _rv;
+ TimeScale scale;
+#ifndef MCGetCurrentTime
+ PyMac_PRECHECK(MCGetCurrentTime);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MCGetCurrentTime(_self->ob_itself,
+ &scale);
+ _res = Py_BuildValue("ll",
+ _rv,
+ scale);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCNewAttachedController(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ Movie theMovie;
+ WindowPtr w;
+ Point where;
+#ifndef MCNewAttachedController
+ PyMac_PRECHECK(MCNewAttachedController);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ MovieObj_Convert, &theMovie,
+ WinObj_Convert, &w,
+ PyMac_GetPoint, &where))
+ return NULL;
+ _rv = MCNewAttachedController(_self->ob_itself,
+ theMovie,
+ w,
+ where);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCDraw(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ WindowPtr w;
+#ifndef MCDraw
+ PyMac_PRECHECK(MCDraw);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &w))
+ return NULL;
+ _rv = MCDraw(_self->ob_itself,
+ w);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCActivate(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ WindowPtr w;
+ Boolean activate;
+#ifndef MCActivate
+ PyMac_PRECHECK(MCActivate);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&b",
+ WinObj_Convert, &w,
+ &activate))
+ return NULL;
+ _rv = MCActivate(_self->ob_itself,
+ w,
+ activate);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCIdle(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+#ifndef MCIdle
+ PyMac_PRECHECK(MCIdle);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MCIdle(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCKey(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SInt8 key;
+ long modifiers;
+#ifndef MCKey
+ PyMac_PRECHECK(MCKey);
+#endif
+ if (!PyArg_ParseTuple(_args, "bl",
+ &key,
+ &modifiers))
+ return NULL;
+ _rv = MCKey(_self->ob_itself,
+ key,
+ modifiers);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCClick(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ WindowPtr w;
+ Point where;
+ long when;
+ long modifiers;
+#ifndef MCClick
+ PyMac_PRECHECK(MCClick);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&ll",
+ WinObj_Convert, &w,
+ PyMac_GetPoint, &where,
+ &when,
+ &modifiers))
+ return NULL;
+ _rv = MCClick(_self->ob_itself,
+ w,
+ where,
+ when,
+ modifiers);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCEnableEditing(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ Boolean enabled;
+#ifndef MCEnableEditing
+ PyMac_PRECHECK(MCEnableEditing);
+#endif
+ if (!PyArg_ParseTuple(_args, "b",
+ &enabled))
+ return NULL;
+ _rv = MCEnableEditing(_self->ob_itself,
+ enabled);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCIsEditingEnabled(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+#ifndef MCIsEditingEnabled
+ PyMac_PRECHECK(MCIsEditingEnabled);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MCIsEditingEnabled(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCCopy(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Movie _rv;
+#ifndef MCCopy
+ PyMac_PRECHECK(MCCopy);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MCCopy(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ MovieObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCCut(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Movie _rv;
+#ifndef MCCut
+ PyMac_PRECHECK(MCCut);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MCCut(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ MovieObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCPaste(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ Movie srcMovie;
+#ifndef MCPaste
+ PyMac_PRECHECK(MCPaste);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ MovieObj_Convert, &srcMovie))
+ return NULL;
+ _rv = MCPaste(_self->ob_itself,
+ srcMovie);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCClear(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+#ifndef MCClear
+ PyMac_PRECHECK(MCClear);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MCClear(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCUndo(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+#ifndef MCUndo
+ PyMac_PRECHECK(MCUndo);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MCUndo(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCPositionController(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ Rect movieRect;
+ Rect controllerRect;
+ long someFlags;
+#ifndef MCPositionController
+ PyMac_PRECHECK(MCPositionController);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&l",
+ PyMac_GetRect, &movieRect,
+ PyMac_GetRect, &controllerRect,
+ &someFlags))
+ return NULL;
+ _rv = MCPositionController(_self->ob_itself,
+ &movieRect,
+ &controllerRect,
+ someFlags);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCGetControllerInfo(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ long someFlags;
+#ifndef MCGetControllerInfo
+ PyMac_PRECHECK(MCGetControllerInfo);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MCGetControllerInfo(_self->ob_itself,
+ &someFlags);
+ _res = Py_BuildValue("ll",
+ _rv,
+ someFlags);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCSetClip(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ RgnHandle theClip;
+ RgnHandle movieClip;
+#ifndef MCSetClip
+ PyMac_PRECHECK(MCSetClip);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &theClip,
+ ResObj_Convert, &movieClip))
+ return NULL;
+ _rv = MCSetClip(_self->ob_itself,
+ theClip,
+ movieClip);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCGetClip(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ RgnHandle theClip;
+ RgnHandle movieClip;
+#ifndef MCGetClip
+ PyMac_PRECHECK(MCGetClip);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MCGetClip(_self->ob_itself,
+ &theClip,
+ &movieClip);
+ _res = Py_BuildValue("lO&O&",
+ _rv,
+ ResObj_New, theClip,
+ ResObj_New, movieClip);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCDrawBadge(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ RgnHandle movieRgn;
+ RgnHandle badgeRgn;
+#ifndef MCDrawBadge
+ PyMac_PRECHECK(MCDrawBadge);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &movieRgn))
+ return NULL;
+ _rv = MCDrawBadge(_self->ob_itself,
+ movieRgn,
+ &badgeRgn);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, badgeRgn);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCSetUpEditMenu(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ long modifiers;
+ MenuHandle mh;
+#ifndef MCSetUpEditMenu
+ PyMac_PRECHECK(MCSetUpEditMenu);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&",
+ &modifiers,
+ MenuObj_Convert, &mh))
+ return NULL;
+ _rv = MCSetUpEditMenu(_self->ob_itself,
+ modifiers,
+ mh);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCGetMenuString(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ long modifiers;
+ short item;
+ Str255 aString;
+#ifndef MCGetMenuString
+ PyMac_PRECHECK(MCGetMenuString);
+#endif
+ if (!PyArg_ParseTuple(_args, "lhO&",
+ &modifiers,
+ &item,
+ PyMac_GetStr255, aString))
+ return NULL;
+ _rv = MCGetMenuString(_self->ob_itself,
+ modifiers,
+ item,
+ aString);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCPtInController(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ Point thePt;
+ Boolean inController;
+#ifndef MCPtInController
+ PyMac_PRECHECK(MCPtInController);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &thePt))
+ return NULL;
+ _rv = MCPtInController(_self->ob_itself,
+ thePt,
+ &inController);
+ _res = Py_BuildValue("lb",
+ _rv,
+ inController);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCInvalidate(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ WindowPtr w;
+ RgnHandle invalidRgn;
+#ifndef MCInvalidate
+ PyMac_PRECHECK(MCInvalidate);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ WinObj_Convert, &w,
+ ResObj_Convert, &invalidRgn))
+ return NULL;
+ _rv = MCInvalidate(_self->ob_itself,
+ w,
+ invalidRgn);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCAdjustCursor(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ WindowPtr w;
+ Point where;
+ long modifiers;
+#ifndef MCAdjustCursor
+ PyMac_PRECHECK(MCAdjustCursor);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&l",
+ WinObj_Convert, &w,
+ PyMac_GetPoint, &where,
+ &modifiers))
+ return NULL;
+ _rv = MCAdjustCursor(_self->ob_itself,
+ w,
+ where,
+ modifiers);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCGetInterfaceElement(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MCInterfaceElement whichElement;
+ void * element;
+#ifndef MCGetInterfaceElement
+ PyMac_PRECHECK(MCGetInterfaceElement);
+#endif
+ if (!PyArg_ParseTuple(_args, "ls",
+ &whichElement,
+ &element))
+ return NULL;
+ _rv = MCGetInterfaceElement(_self->ob_itself,
+ whichElement,
+ element);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCAddMovieSegment(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ Movie srcMovie;
+ Boolean scaled;
+#ifndef MCAddMovieSegment
+ PyMac_PRECHECK(MCAddMovieSegment);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&b",
+ MovieObj_Convert, &srcMovie,
+ &scaled))
+ return NULL;
+ _rv = MCAddMovieSegment(_self->ob_itself,
+ srcMovie,
+ scaled);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCTrimMovieSegment(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+#ifndef MCTrimMovieSegment
+ PyMac_PRECHECK(MCTrimMovieSegment);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MCTrimMovieSegment(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCSetIdleManager(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ IdleManager im;
+#ifndef MCSetIdleManager
+ PyMac_PRECHECK(MCSetIdleManager);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ IdleManagerObj_Convert, &im))
+ return NULL;
+ _rv = MCSetIdleManager(_self->ob_itself,
+ im);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCSetControllerCapabilities(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ long flags;
+ long flagsMask;
+#ifndef MCSetControllerCapabilities
+ PyMac_PRECHECK(MCSetControllerCapabilities);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &flags,
+ &flagsMask))
+ return NULL;
+ _rv = MCSetControllerCapabilities(_self->ob_itself,
+ flags,
+ flagsMask);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyMethodDef MovieCtlObj_methods[] = {
+ {"MCSetMovie", (PyCFunction)MovieCtlObj_MCSetMovie, 1,
+ PyDoc_STR("(Movie theMovie, WindowPtr movieWindow, Point where) -> (ComponentResult _rv)")},
+ {"MCGetIndMovie", (PyCFunction)MovieCtlObj_MCGetIndMovie, 1,
+ PyDoc_STR("(short index) -> (Movie _rv)")},
+ {"MCRemoveAllMovies", (PyCFunction)MovieCtlObj_MCRemoveAllMovies, 1,
+ PyDoc_STR("() -> (ComponentResult _rv)")},
+ {"MCRemoveAMovie", (PyCFunction)MovieCtlObj_MCRemoveAMovie, 1,
+ PyDoc_STR("(Movie m) -> (ComponentResult _rv)")},
+ {"MCRemoveMovie", (PyCFunction)MovieCtlObj_MCRemoveMovie, 1,
+ PyDoc_STR("() -> (ComponentResult _rv)")},
+ {"MCIsPlayerEvent", (PyCFunction)MovieCtlObj_MCIsPlayerEvent, 1,
+ PyDoc_STR("(EventRecord e) -> (ComponentResult _rv)")},
+ {"MCDoAction", (PyCFunction)MovieCtlObj_MCDoAction, 1,
+ PyDoc_STR("(short action, void * params) -> (ComponentResult _rv)")},
+ {"MCSetControllerAttached", (PyCFunction)MovieCtlObj_MCSetControllerAttached, 1,
+ PyDoc_STR("(Boolean attach) -> (ComponentResult _rv)")},
+ {"MCIsControllerAttached", (PyCFunction)MovieCtlObj_MCIsControllerAttached, 1,
+ PyDoc_STR("() -> (ComponentResult _rv)")},
+ {"MCSetControllerPort", (PyCFunction)MovieCtlObj_MCSetControllerPort, 1,
+ PyDoc_STR("(CGrafPtr gp) -> (ComponentResult _rv)")},
+ {"MCGetControllerPort", (PyCFunction)MovieCtlObj_MCGetControllerPort, 1,
+ PyDoc_STR("() -> (CGrafPtr _rv)")},
+ {"MCSetVisible", (PyCFunction)MovieCtlObj_MCSetVisible, 1,
+ PyDoc_STR("(Boolean visible) -> (ComponentResult _rv)")},
+ {"MCGetVisible", (PyCFunction)MovieCtlObj_MCGetVisible, 1,
+ PyDoc_STR("() -> (ComponentResult _rv)")},
+ {"MCGetControllerBoundsRect", (PyCFunction)MovieCtlObj_MCGetControllerBoundsRect, 1,
+ PyDoc_STR("() -> (ComponentResult _rv, Rect bounds)")},
+ {"MCSetControllerBoundsRect", (PyCFunction)MovieCtlObj_MCSetControllerBoundsRect, 1,
+ PyDoc_STR("(Rect bounds) -> (ComponentResult _rv)")},
+ {"MCGetControllerBoundsRgn", (PyCFunction)MovieCtlObj_MCGetControllerBoundsRgn, 1,
+ PyDoc_STR("() -> (RgnHandle _rv)")},
+ {"MCGetWindowRgn", (PyCFunction)MovieCtlObj_MCGetWindowRgn, 1,
+ PyDoc_STR("(WindowPtr w) -> (RgnHandle _rv)")},
+ {"MCMovieChanged", (PyCFunction)MovieCtlObj_MCMovieChanged, 1,
+ PyDoc_STR("(Movie m) -> (ComponentResult _rv)")},
+ {"MCSetDuration", (PyCFunction)MovieCtlObj_MCSetDuration, 1,
+ PyDoc_STR("(TimeValue duration) -> (ComponentResult _rv)")},
+ {"MCGetCurrentTime", (PyCFunction)MovieCtlObj_MCGetCurrentTime, 1,
+ PyDoc_STR("() -> (TimeValue _rv, TimeScale scale)")},
+ {"MCNewAttachedController", (PyCFunction)MovieCtlObj_MCNewAttachedController, 1,
+ PyDoc_STR("(Movie theMovie, WindowPtr w, Point where) -> (ComponentResult _rv)")},
+ {"MCDraw", (PyCFunction)MovieCtlObj_MCDraw, 1,
+ PyDoc_STR("(WindowPtr w) -> (ComponentResult _rv)")},
+ {"MCActivate", (PyCFunction)MovieCtlObj_MCActivate, 1,
+ PyDoc_STR("(WindowPtr w, Boolean activate) -> (ComponentResult _rv)")},
+ {"MCIdle", (PyCFunction)MovieCtlObj_MCIdle, 1,
+ PyDoc_STR("() -> (ComponentResult _rv)")},
+ {"MCKey", (PyCFunction)MovieCtlObj_MCKey, 1,
+ PyDoc_STR("(SInt8 key, long modifiers) -> (ComponentResult _rv)")},
+ {"MCClick", (PyCFunction)MovieCtlObj_MCClick, 1,
+ PyDoc_STR("(WindowPtr w, Point where, long when, long modifiers) -> (ComponentResult _rv)")},
+ {"MCEnableEditing", (PyCFunction)MovieCtlObj_MCEnableEditing, 1,
+ PyDoc_STR("(Boolean enabled) -> (ComponentResult _rv)")},
+ {"MCIsEditingEnabled", (PyCFunction)MovieCtlObj_MCIsEditingEnabled, 1,
+ PyDoc_STR("() -> (long _rv)")},
+ {"MCCopy", (PyCFunction)MovieCtlObj_MCCopy, 1,
+ PyDoc_STR("() -> (Movie _rv)")},
+ {"MCCut", (PyCFunction)MovieCtlObj_MCCut, 1,
+ PyDoc_STR("() -> (Movie _rv)")},
+ {"MCPaste", (PyCFunction)MovieCtlObj_MCPaste, 1,
+ PyDoc_STR("(Movie srcMovie) -> (ComponentResult _rv)")},
+ {"MCClear", (PyCFunction)MovieCtlObj_MCClear, 1,
+ PyDoc_STR("() -> (ComponentResult _rv)")},
+ {"MCUndo", (PyCFunction)MovieCtlObj_MCUndo, 1,
+ PyDoc_STR("() -> (ComponentResult _rv)")},
+ {"MCPositionController", (PyCFunction)MovieCtlObj_MCPositionController, 1,
+ PyDoc_STR("(Rect movieRect, Rect controllerRect, long someFlags) -> (ComponentResult _rv)")},
+ {"MCGetControllerInfo", (PyCFunction)MovieCtlObj_MCGetControllerInfo, 1,
+ PyDoc_STR("() -> (ComponentResult _rv, long someFlags)")},
+ {"MCSetClip", (PyCFunction)MovieCtlObj_MCSetClip, 1,
+ PyDoc_STR("(RgnHandle theClip, RgnHandle movieClip) -> (ComponentResult _rv)")},
+ {"MCGetClip", (PyCFunction)MovieCtlObj_MCGetClip, 1,
+ PyDoc_STR("() -> (ComponentResult _rv, RgnHandle theClip, RgnHandle movieClip)")},
+ {"MCDrawBadge", (PyCFunction)MovieCtlObj_MCDrawBadge, 1,
+ PyDoc_STR("(RgnHandle movieRgn) -> (ComponentResult _rv, RgnHandle badgeRgn)")},
+ {"MCSetUpEditMenu", (PyCFunction)MovieCtlObj_MCSetUpEditMenu, 1,
+ PyDoc_STR("(long modifiers, MenuHandle mh) -> (ComponentResult _rv)")},
+ {"MCGetMenuString", (PyCFunction)MovieCtlObj_MCGetMenuString, 1,
+ PyDoc_STR("(long modifiers, short item, Str255 aString) -> (ComponentResult _rv)")},
+ {"MCPtInController", (PyCFunction)MovieCtlObj_MCPtInController, 1,
+ PyDoc_STR("(Point thePt) -> (ComponentResult _rv, Boolean inController)")},
+ {"MCInvalidate", (PyCFunction)MovieCtlObj_MCInvalidate, 1,
+ PyDoc_STR("(WindowPtr w, RgnHandle invalidRgn) -> (ComponentResult _rv)")},
+ {"MCAdjustCursor", (PyCFunction)MovieCtlObj_MCAdjustCursor, 1,
+ PyDoc_STR("(WindowPtr w, Point where, long modifiers) -> (ComponentResult _rv)")},
+ {"MCGetInterfaceElement", (PyCFunction)MovieCtlObj_MCGetInterfaceElement, 1,
+ PyDoc_STR("(MCInterfaceElement whichElement, void * element) -> (ComponentResult _rv)")},
+ {"MCAddMovieSegment", (PyCFunction)MovieCtlObj_MCAddMovieSegment, 1,
+ PyDoc_STR("(Movie srcMovie, Boolean scaled) -> (ComponentResult _rv)")},
+ {"MCTrimMovieSegment", (PyCFunction)MovieCtlObj_MCTrimMovieSegment, 1,
+ PyDoc_STR("() -> (ComponentResult _rv)")},
+ {"MCSetIdleManager", (PyCFunction)MovieCtlObj_MCSetIdleManager, 1,
+ PyDoc_STR("(IdleManager im) -> (ComponentResult _rv)")},
+ {"MCSetControllerCapabilities", (PyCFunction)MovieCtlObj_MCSetControllerCapabilities, 1,
+ PyDoc_STR("(long flags, long flagsMask) -> (ComponentResult _rv)")},
+ {NULL, NULL, 0}
+};
+
+#define MovieCtlObj_getsetlist NULL
+
+
+#define MovieCtlObj_compare NULL
+
+#define MovieCtlObj_repr NULL
+
+#define MovieCtlObj_hash NULL
+#define MovieCtlObj_tp_init 0
+
+#define MovieCtlObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *MovieCtlObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *_self;
+ MovieController itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, MovieCtlObj_Convert, &itself)) return NULL;
+ if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((MovieControllerObject *)_self)->ob_itself = itself;
+ return _self;
+}
+
+#define MovieCtlObj_tp_free PyObject_Del
+
+
+PyTypeObject MovieController_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_Qt.MovieController", /*tp_name*/
+ sizeof(MovieControllerObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) MovieCtlObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) MovieCtlObj_compare, /*tp_compare*/
+ (reprfunc) MovieCtlObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) MovieCtlObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ MovieCtlObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ MovieCtlObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ MovieCtlObj_tp_init, /* tp_init */
+ MovieCtlObj_tp_alloc, /* tp_alloc */
+ MovieCtlObj_tp_new, /* tp_new */
+ MovieCtlObj_tp_free, /* tp_free */
+};
+
+/* ---------------- End object type MovieController ----------------- */
+
+
+/* ---------------------- Object type TimeBase ---------------------- */
+
+PyTypeObject TimeBase_Type;
+
+#define TimeBaseObj_Check(x) ((x)->ob_type == &TimeBase_Type || PyObject_TypeCheck((x), &TimeBase_Type))
+
+typedef struct TimeBaseObject {
+ PyObject_HEAD
+ TimeBase ob_itself;
+} TimeBaseObject;
+
+PyObject *TimeBaseObj_New(TimeBase itself)
+{
+ TimeBaseObject *it;
+ if (itself == NULL) {
+ PyErr_SetString(Qt_Error,"Cannot create TimeBase from NULL pointer");
+ return NULL;
+ }
+ it = PyObject_NEW(TimeBaseObject, &TimeBase_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+
+int TimeBaseObj_Convert(PyObject *v, TimeBase *p_itself)
+{
+ if (v == Py_None)
+ {
+ *p_itself = NULL;
+ return 1;
+ }
+ if (!TimeBaseObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "TimeBase required");
+ return 0;
+ }
+ *p_itself = ((TimeBaseObject *)v)->ob_itself;
+ return 1;
+}
+
+static void TimeBaseObj_dealloc(TimeBaseObject *self)
+{
+ /* Cleanup of self->ob_itself goes here */
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *TimeBaseObj_DisposeTimeBase(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef DisposeTimeBase
+ PyMac_PRECHECK(DisposeTimeBase);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ DisposeTimeBase(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TimeBaseObj_GetTimeBaseTime(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue _rv;
+ TimeScale s;
+ TimeRecord tr;
+#ifndef GetTimeBaseTime
+ PyMac_PRECHECK(GetTimeBaseTime);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &s))
+ return NULL;
+ _rv = GetTimeBaseTime(_self->ob_itself,
+ s,
+ &tr);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ QtTimeRecord_New, &tr);
+ return _res;
+}
+
+static PyObject *TimeBaseObj_SetTimeBaseTime(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeRecord tr;
+#ifndef SetTimeBaseTime
+ PyMac_PRECHECK(SetTimeBaseTime);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ QtTimeRecord_Convert, &tr))
+ return NULL;
+ SetTimeBaseTime(_self->ob_itself,
+ &tr);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TimeBaseObj_SetTimeBaseValue(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue t;
+ TimeScale s;
+#ifndef SetTimeBaseValue
+ PyMac_PRECHECK(SetTimeBaseValue);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &t,
+ &s))
+ return NULL;
+ SetTimeBaseValue(_self->ob_itself,
+ t,
+ s);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TimeBaseObj_GetTimeBaseRate(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Fixed _rv;
+#ifndef GetTimeBaseRate
+ PyMac_PRECHECK(GetTimeBaseRate);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTimeBaseRate(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildFixed, _rv);
+ return _res;
+}
+
+static PyObject *TimeBaseObj_SetTimeBaseRate(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Fixed r;
+#ifndef SetTimeBaseRate
+ PyMac_PRECHECK(SetTimeBaseRate);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetFixed, &r))
+ return NULL;
+ SetTimeBaseRate(_self->ob_itself,
+ r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TimeBaseObj_GetTimeBaseStartTime(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue _rv;
+ TimeScale s;
+ TimeRecord tr;
+#ifndef GetTimeBaseStartTime
+ PyMac_PRECHECK(GetTimeBaseStartTime);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &s))
+ return NULL;
+ _rv = GetTimeBaseStartTime(_self->ob_itself,
+ s,
+ &tr);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ QtTimeRecord_New, &tr);
+ return _res;
+}
+
+static PyObject *TimeBaseObj_SetTimeBaseStartTime(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeRecord tr;
+#ifndef SetTimeBaseStartTime
+ PyMac_PRECHECK(SetTimeBaseStartTime);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ QtTimeRecord_Convert, &tr))
+ return NULL;
+ SetTimeBaseStartTime(_self->ob_itself,
+ &tr);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TimeBaseObj_GetTimeBaseStopTime(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue _rv;
+ TimeScale s;
+ TimeRecord tr;
+#ifndef GetTimeBaseStopTime
+ PyMac_PRECHECK(GetTimeBaseStopTime);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &s))
+ return NULL;
+ _rv = GetTimeBaseStopTime(_self->ob_itself,
+ s,
+ &tr);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ QtTimeRecord_New, &tr);
+ return _res;
+}
+
+static PyObject *TimeBaseObj_SetTimeBaseStopTime(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeRecord tr;
+#ifndef SetTimeBaseStopTime
+ PyMac_PRECHECK(SetTimeBaseStopTime);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ QtTimeRecord_Convert, &tr))
+ return NULL;
+ SetTimeBaseStopTime(_self->ob_itself,
+ &tr);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TimeBaseObj_GetTimeBaseFlags(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+#ifndef GetTimeBaseFlags
+ PyMac_PRECHECK(GetTimeBaseFlags);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTimeBaseFlags(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *TimeBaseObj_SetTimeBaseFlags(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long timeBaseFlags;
+#ifndef SetTimeBaseFlags
+ PyMac_PRECHECK(SetTimeBaseFlags);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &timeBaseFlags))
+ return NULL;
+ SetTimeBaseFlags(_self->ob_itself,
+ timeBaseFlags);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TimeBaseObj_SetTimeBaseMasterTimeBase(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeBase master;
+ TimeRecord slaveZero;
+#ifndef SetTimeBaseMasterTimeBase
+ PyMac_PRECHECK(SetTimeBaseMasterTimeBase);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ TimeBaseObj_Convert, &master,
+ QtTimeRecord_Convert, &slaveZero))
+ return NULL;
+ SetTimeBaseMasterTimeBase(_self->ob_itself,
+ master,
+ &slaveZero);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TimeBaseObj_GetTimeBaseMasterTimeBase(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeBase _rv;
+#ifndef GetTimeBaseMasterTimeBase
+ PyMac_PRECHECK(GetTimeBaseMasterTimeBase);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTimeBaseMasterTimeBase(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ TimeBaseObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TimeBaseObj_SetTimeBaseMasterClock(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Component clockMeister;
+ TimeRecord slaveZero;
+#ifndef SetTimeBaseMasterClock
+ PyMac_PRECHECK(SetTimeBaseMasterClock);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpObj_Convert, &clockMeister,
+ QtTimeRecord_Convert, &slaveZero))
+ return NULL;
+ SetTimeBaseMasterClock(_self->ob_itself,
+ clockMeister,
+ &slaveZero);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TimeBaseObj_GetTimeBaseMasterClock(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentInstance _rv;
+#ifndef GetTimeBaseMasterClock
+ PyMac_PRECHECK(GetTimeBaseMasterClock);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTimeBaseMasterClock(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CmpInstObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TimeBaseObj_GetTimeBaseStatus(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ TimeRecord unpinnedTime;
+#ifndef GetTimeBaseStatus
+ PyMac_PRECHECK(GetTimeBaseStatus);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTimeBaseStatus(_self->ob_itself,
+ &unpinnedTime);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ QtTimeRecord_New, &unpinnedTime);
+ return _res;
+}
+
+static PyObject *TimeBaseObj_SetTimeBaseZero(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeRecord zero;
+#ifndef SetTimeBaseZero
+ PyMac_PRECHECK(SetTimeBaseZero);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ QtTimeRecord_Convert, &zero))
+ return NULL;
+ SetTimeBaseZero(_self->ob_itself,
+ &zero);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TimeBaseObj_GetTimeBaseEffectiveRate(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Fixed _rv;
+#ifndef GetTimeBaseEffectiveRate
+ PyMac_PRECHECK(GetTimeBaseEffectiveRate);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTimeBaseEffectiveRate(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildFixed, _rv);
+ return _res;
+}
+
+static PyMethodDef TimeBaseObj_methods[] = {
+ {"DisposeTimeBase", (PyCFunction)TimeBaseObj_DisposeTimeBase, 1,
+ PyDoc_STR("() -> None")},
+ {"GetTimeBaseTime", (PyCFunction)TimeBaseObj_GetTimeBaseTime, 1,
+ PyDoc_STR("(TimeScale s) -> (TimeValue _rv, TimeRecord tr)")},
+ {"SetTimeBaseTime", (PyCFunction)TimeBaseObj_SetTimeBaseTime, 1,
+ PyDoc_STR("(TimeRecord tr) -> None")},
+ {"SetTimeBaseValue", (PyCFunction)TimeBaseObj_SetTimeBaseValue, 1,
+ PyDoc_STR("(TimeValue t, TimeScale s) -> None")},
+ {"GetTimeBaseRate", (PyCFunction)TimeBaseObj_GetTimeBaseRate, 1,
+ PyDoc_STR("() -> (Fixed _rv)")},
+ {"SetTimeBaseRate", (PyCFunction)TimeBaseObj_SetTimeBaseRate, 1,
+ PyDoc_STR("(Fixed r) -> None")},
+ {"GetTimeBaseStartTime", (PyCFunction)TimeBaseObj_GetTimeBaseStartTime, 1,
+ PyDoc_STR("(TimeScale s) -> (TimeValue _rv, TimeRecord tr)")},
+ {"SetTimeBaseStartTime", (PyCFunction)TimeBaseObj_SetTimeBaseStartTime, 1,
+ PyDoc_STR("(TimeRecord tr) -> None")},
+ {"GetTimeBaseStopTime", (PyCFunction)TimeBaseObj_GetTimeBaseStopTime, 1,
+ PyDoc_STR("(TimeScale s) -> (TimeValue _rv, TimeRecord tr)")},
+ {"SetTimeBaseStopTime", (PyCFunction)TimeBaseObj_SetTimeBaseStopTime, 1,
+ PyDoc_STR("(TimeRecord tr) -> None")},
+ {"GetTimeBaseFlags", (PyCFunction)TimeBaseObj_GetTimeBaseFlags, 1,
+ PyDoc_STR("() -> (long _rv)")},
+ {"SetTimeBaseFlags", (PyCFunction)TimeBaseObj_SetTimeBaseFlags, 1,
+ PyDoc_STR("(long timeBaseFlags) -> None")},
+ {"SetTimeBaseMasterTimeBase", (PyCFunction)TimeBaseObj_SetTimeBaseMasterTimeBase, 1,
+ PyDoc_STR("(TimeBase master, TimeRecord slaveZero) -> None")},
+ {"GetTimeBaseMasterTimeBase", (PyCFunction)TimeBaseObj_GetTimeBaseMasterTimeBase, 1,
+ PyDoc_STR("() -> (TimeBase _rv)")},
+ {"SetTimeBaseMasterClock", (PyCFunction)TimeBaseObj_SetTimeBaseMasterClock, 1,
+ PyDoc_STR("(Component clockMeister, TimeRecord slaveZero) -> None")},
+ {"GetTimeBaseMasterClock", (PyCFunction)TimeBaseObj_GetTimeBaseMasterClock, 1,
+ PyDoc_STR("() -> (ComponentInstance _rv)")},
+ {"GetTimeBaseStatus", (PyCFunction)TimeBaseObj_GetTimeBaseStatus, 1,
+ PyDoc_STR("() -> (long _rv, TimeRecord unpinnedTime)")},
+ {"SetTimeBaseZero", (PyCFunction)TimeBaseObj_SetTimeBaseZero, 1,
+ PyDoc_STR("(TimeRecord zero) -> None")},
+ {"GetTimeBaseEffectiveRate", (PyCFunction)TimeBaseObj_GetTimeBaseEffectiveRate, 1,
+ PyDoc_STR("() -> (Fixed _rv)")},
+ {NULL, NULL, 0}
+};
+
+#define TimeBaseObj_getsetlist NULL
+
+
+#define TimeBaseObj_compare NULL
+
+#define TimeBaseObj_repr NULL
+
+#define TimeBaseObj_hash NULL
+#define TimeBaseObj_tp_init 0
+
+#define TimeBaseObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *TimeBaseObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *_self;
+ TimeBase itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, TimeBaseObj_Convert, &itself)) return NULL;
+ if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((TimeBaseObject *)_self)->ob_itself = itself;
+ return _self;
+}
+
+#define TimeBaseObj_tp_free PyObject_Del
+
+
+PyTypeObject TimeBase_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_Qt.TimeBase", /*tp_name*/
+ sizeof(TimeBaseObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) TimeBaseObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) TimeBaseObj_compare, /*tp_compare*/
+ (reprfunc) TimeBaseObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) TimeBaseObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ TimeBaseObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ TimeBaseObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ TimeBaseObj_tp_init, /* tp_init */
+ TimeBaseObj_tp_alloc, /* tp_alloc */
+ TimeBaseObj_tp_new, /* tp_new */
+ TimeBaseObj_tp_free, /* tp_free */
+};
+
+/* -------------------- End object type TimeBase -------------------- */
+
+
+/* ---------------------- Object type UserData ---------------------- */
+
+PyTypeObject UserData_Type;
+
+#define UserDataObj_Check(x) ((x)->ob_type == &UserData_Type || PyObject_TypeCheck((x), &UserData_Type))
+
+typedef struct UserDataObject {
+ PyObject_HEAD
+ UserData ob_itself;
+} UserDataObject;
+
+PyObject *UserDataObj_New(UserData itself)
+{
+ UserDataObject *it;
+ if (itself == NULL) {
+ PyErr_SetString(Qt_Error,"Cannot create UserData from NULL pointer");
+ return NULL;
+ }
+ it = PyObject_NEW(UserDataObject, &UserData_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+
+int UserDataObj_Convert(PyObject *v, UserData *p_itself)
+{
+ if (v == Py_None)
+ {
+ *p_itself = NULL;
+ return 1;
+ }
+ if (!UserDataObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "UserData required");
+ return 0;
+ }
+ *p_itself = ((UserDataObject *)v)->ob_itself;
+ return 1;
+}
+
+static void UserDataObj_dealloc(UserDataObject *self)
+{
+ if (self->ob_itself) DisposeUserData(self->ob_itself);
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *UserDataObj_GetUserData(UserDataObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle data;
+ OSType udType;
+ long index;
+#ifndef GetUserData
+ PyMac_PRECHECK(GetUserData);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&l",
+ ResObj_Convert, &data,
+ PyMac_GetOSType, &udType,
+ &index))
+ return NULL;
+ _err = GetUserData(_self->ob_itself,
+ data,
+ udType,
+ index);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *UserDataObj_AddUserData(UserDataObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle data;
+ OSType udType;
+#ifndef AddUserData
+ PyMac_PRECHECK(AddUserData);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &data,
+ PyMac_GetOSType, &udType))
+ return NULL;
+ _err = AddUserData(_self->ob_itself,
+ data,
+ udType);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *UserDataObj_RemoveUserData(UserDataObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType udType;
+ long index;
+#ifndef RemoveUserData
+ PyMac_PRECHECK(RemoveUserData);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetOSType, &udType,
+ &index))
+ return NULL;
+ _err = RemoveUserData(_self->ob_itself,
+ udType,
+ index);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *UserDataObj_CountUserDataType(UserDataObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ OSType udType;
+#ifndef CountUserDataType
+ PyMac_PRECHECK(CountUserDataType);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &udType))
+ return NULL;
+ _rv = CountUserDataType(_self->ob_itself,
+ udType);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *UserDataObj_GetNextUserDataType(UserDataObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ OSType udType;
+#ifndef GetNextUserDataType
+ PyMac_PRECHECK(GetNextUserDataType);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &udType))
+ return NULL;
+ _rv = GetNextUserDataType(_self->ob_itself,
+ udType);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *UserDataObj_AddUserDataText(UserDataObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle data;
+ OSType udType;
+ long index;
+ short itlRegionTag;
+#ifndef AddUserDataText
+ PyMac_PRECHECK(AddUserDataText);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&lh",
+ ResObj_Convert, &data,
+ PyMac_GetOSType, &udType,
+ &index,
+ &itlRegionTag))
+ return NULL;
+ _err = AddUserDataText(_self->ob_itself,
+ data,
+ udType,
+ index,
+ itlRegionTag);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *UserDataObj_GetUserDataText(UserDataObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle data;
+ OSType udType;
+ long index;
+ short itlRegionTag;
+#ifndef GetUserDataText
+ PyMac_PRECHECK(GetUserDataText);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&lh",
+ ResObj_Convert, &data,
+ PyMac_GetOSType, &udType,
+ &index,
+ &itlRegionTag))
+ return NULL;
+ _err = GetUserDataText(_self->ob_itself,
+ data,
+ udType,
+ index,
+ itlRegionTag);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *UserDataObj_RemoveUserDataText(UserDataObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType udType;
+ long index;
+ short itlRegionTag;
+#ifndef RemoveUserDataText
+ PyMac_PRECHECK(RemoveUserDataText);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lh",
+ PyMac_GetOSType, &udType,
+ &index,
+ &itlRegionTag))
+ return NULL;
+ _err = RemoveUserDataText(_self->ob_itself,
+ udType,
+ index,
+ itlRegionTag);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *UserDataObj_PutUserDataIntoHandle(UserDataObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle h;
+#ifndef PutUserDataIntoHandle
+ PyMac_PRECHECK(PutUserDataIntoHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &h))
+ return NULL;
+ _err = PutUserDataIntoHandle(_self->ob_itself,
+ h);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *UserDataObj_CopyUserData(UserDataObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ UserData dstUserData;
+ OSType copyRule;
+#ifndef CopyUserData
+ PyMac_PRECHECK(CopyUserData);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ UserDataObj_Convert, &dstUserData,
+ PyMac_GetOSType, &copyRule))
+ return NULL;
+ _err = CopyUserData(_self->ob_itself,
+ dstUserData,
+ copyRule);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyMethodDef UserDataObj_methods[] = {
+ {"GetUserData", (PyCFunction)UserDataObj_GetUserData, 1,
+ PyDoc_STR("(Handle data, OSType udType, long index) -> None")},
+ {"AddUserData", (PyCFunction)UserDataObj_AddUserData, 1,
+ PyDoc_STR("(Handle data, OSType udType) -> None")},
+ {"RemoveUserData", (PyCFunction)UserDataObj_RemoveUserData, 1,
+ PyDoc_STR("(OSType udType, long index) -> None")},
+ {"CountUserDataType", (PyCFunction)UserDataObj_CountUserDataType, 1,
+ PyDoc_STR("(OSType udType) -> (short _rv)")},
+ {"GetNextUserDataType", (PyCFunction)UserDataObj_GetNextUserDataType, 1,
+ PyDoc_STR("(OSType udType) -> (long _rv)")},
+ {"AddUserDataText", (PyCFunction)UserDataObj_AddUserDataText, 1,
+ PyDoc_STR("(Handle data, OSType udType, long index, short itlRegionTag) -> None")},
+ {"GetUserDataText", (PyCFunction)UserDataObj_GetUserDataText, 1,
+ PyDoc_STR("(Handle data, OSType udType, long index, short itlRegionTag) -> None")},
+ {"RemoveUserDataText", (PyCFunction)UserDataObj_RemoveUserDataText, 1,
+ PyDoc_STR("(OSType udType, long index, short itlRegionTag) -> None")},
+ {"PutUserDataIntoHandle", (PyCFunction)UserDataObj_PutUserDataIntoHandle, 1,
+ PyDoc_STR("(Handle h) -> None")},
+ {"CopyUserData", (PyCFunction)UserDataObj_CopyUserData, 1,
+ PyDoc_STR("(UserData dstUserData, OSType copyRule) -> None")},
+ {NULL, NULL, 0}
+};
+
+#define UserDataObj_getsetlist NULL
+
+
+#define UserDataObj_compare NULL
+
+#define UserDataObj_repr NULL
+
+#define UserDataObj_hash NULL
+#define UserDataObj_tp_init 0
+
+#define UserDataObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *UserDataObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *_self;
+ UserData itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, UserDataObj_Convert, &itself)) return NULL;
+ if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((UserDataObject *)_self)->ob_itself = itself;
+ return _self;
+}
+
+#define UserDataObj_tp_free PyObject_Del
+
+
+PyTypeObject UserData_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_Qt.UserData", /*tp_name*/
+ sizeof(UserDataObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) UserDataObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) UserDataObj_compare, /*tp_compare*/
+ (reprfunc) UserDataObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) UserDataObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ UserDataObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ UserDataObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ UserDataObj_tp_init, /* tp_init */
+ UserDataObj_tp_alloc, /* tp_alloc */
+ UserDataObj_tp_new, /* tp_new */
+ UserDataObj_tp_free, /* tp_free */
+};
+
+/* -------------------- End object type UserData -------------------- */
+
+
+/* ----------------------- Object type Media ------------------------ */
+
+PyTypeObject Media_Type;
+
+#define MediaObj_Check(x) ((x)->ob_type == &Media_Type || PyObject_TypeCheck((x), &Media_Type))
+
+typedef struct MediaObject {
+ PyObject_HEAD
+ Media ob_itself;
+} MediaObject;
+
+PyObject *MediaObj_New(Media itself)
+{
+ MediaObject *it;
+ if (itself == NULL) {
+ PyErr_SetString(Qt_Error,"Cannot create Media from NULL pointer");
+ return NULL;
+ }
+ it = PyObject_NEW(MediaObject, &Media_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+
+int MediaObj_Convert(PyObject *v, Media *p_itself)
+{
+ if (v == Py_None)
+ {
+ *p_itself = NULL;
+ return 1;
+ }
+ if (!MediaObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "Media required");
+ return 0;
+ }
+ *p_itself = ((MediaObject *)v)->ob_itself;
+ return 1;
+}
+
+static void MediaObj_dealloc(MediaObject *self)
+{
+ if (self->ob_itself) DisposeTrackMedia(self->ob_itself);
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *MediaObj_LoadMediaIntoRam(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ TimeValue time;
+ TimeValue duration;
+ long flags;
+#ifndef LoadMediaIntoRam
+ PyMac_PRECHECK(LoadMediaIntoRam);
+#endif
+ if (!PyArg_ParseTuple(_args, "lll",
+ &time,
+ &duration,
+ &flags))
+ return NULL;
+ _err = LoadMediaIntoRam(_self->ob_itself,
+ time,
+ duration,
+ flags);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaTrack(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Track _rv;
+#ifndef GetMediaTrack
+ PyMac_PRECHECK(GetMediaTrack);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMediaTrack(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ TrackObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaCreationTime(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ unsigned long _rv;
+#ifndef GetMediaCreationTime
+ PyMac_PRECHECK(GetMediaCreationTime);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMediaCreationTime(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaModificationTime(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ unsigned long _rv;
+#ifndef GetMediaModificationTime
+ PyMac_PRECHECK(GetMediaModificationTime);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMediaModificationTime(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaTimeScale(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeScale _rv;
+#ifndef GetMediaTimeScale
+ PyMac_PRECHECK(GetMediaTimeScale);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMediaTimeScale(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MediaObj_SetMediaTimeScale(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeScale timeScale;
+#ifndef SetMediaTimeScale
+ PyMac_PRECHECK(SetMediaTimeScale);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &timeScale))
+ return NULL;
+ SetMediaTimeScale(_self->ob_itself,
+ timeScale);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaDuration(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue _rv;
+#ifndef GetMediaDuration
+ PyMac_PRECHECK(GetMediaDuration);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMediaDuration(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaLanguage(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+#ifndef GetMediaLanguage
+ PyMac_PRECHECK(GetMediaLanguage);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMediaLanguage(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *MediaObj_SetMediaLanguage(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short language;
+#ifndef SetMediaLanguage
+ PyMac_PRECHECK(SetMediaLanguage);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &language))
+ return NULL;
+ SetMediaLanguage(_self->ob_itself,
+ language);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaQuality(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+#ifndef GetMediaQuality
+ PyMac_PRECHECK(GetMediaQuality);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMediaQuality(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *MediaObj_SetMediaQuality(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short quality;
+#ifndef SetMediaQuality
+ PyMac_PRECHECK(SetMediaQuality);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &quality))
+ return NULL;
+ SetMediaQuality(_self->ob_itself,
+ quality);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaHandlerDescription(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSType mediaType;
+ Str255 creatorName;
+ OSType creatorManufacturer;
+#ifndef GetMediaHandlerDescription
+ PyMac_PRECHECK(GetMediaHandlerDescription);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetStr255, creatorName))
+ return NULL;
+ GetMediaHandlerDescription(_self->ob_itself,
+ &mediaType,
+ creatorName,
+ &creatorManufacturer);
+ _res = Py_BuildValue("O&O&",
+ PyMac_BuildOSType, mediaType,
+ PyMac_BuildOSType, creatorManufacturer);
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaUserData(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UserData _rv;
+#ifndef GetMediaUserData
+ PyMac_PRECHECK(GetMediaUserData);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMediaUserData(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ UserDataObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaHandler(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MediaHandler _rv;
+#ifndef GetMediaHandler
+ PyMac_PRECHECK(GetMediaHandler);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMediaHandler(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CmpInstObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MediaObj_SetMediaHandler(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ MediaHandlerComponent mH;
+#ifndef SetMediaHandler
+ PyMac_PRECHECK(SetMediaHandler);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpObj_Convert, &mH))
+ return NULL;
+ _err = SetMediaHandler(_self->ob_itself,
+ mH);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MediaObj_BeginMediaEdits(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+#ifndef BeginMediaEdits
+ PyMac_PRECHECK(BeginMediaEdits);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = BeginMediaEdits(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MediaObj_EndMediaEdits(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+#ifndef EndMediaEdits
+ PyMac_PRECHECK(EndMediaEdits);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = EndMediaEdits(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MediaObj_SetMediaDefaultDataRefIndex(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short index;
+#ifndef SetMediaDefaultDataRefIndex
+ PyMac_PRECHECK(SetMediaDefaultDataRefIndex);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &index))
+ return NULL;
+ _err = SetMediaDefaultDataRefIndex(_self->ob_itself,
+ index);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaDataHandlerDescription(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short index;
+ OSType dhType;
+ Str255 creatorName;
+ OSType creatorManufacturer;
+#ifndef GetMediaDataHandlerDescription
+ PyMac_PRECHECK(GetMediaDataHandlerDescription);
+#endif
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &index,
+ PyMac_GetStr255, creatorName))
+ return NULL;
+ GetMediaDataHandlerDescription(_self->ob_itself,
+ index,
+ &dhType,
+ creatorName,
+ &creatorManufacturer);
+ _res = Py_BuildValue("O&O&",
+ PyMac_BuildOSType, dhType,
+ PyMac_BuildOSType, creatorManufacturer);
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaDataHandler(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DataHandler _rv;
+ short index;
+#ifndef GetMediaDataHandler
+ PyMac_PRECHECK(GetMediaDataHandler);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &index))
+ return NULL;
+ _rv = GetMediaDataHandler(_self->ob_itself,
+ index);
+ _res = Py_BuildValue("O&",
+ CmpInstObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MediaObj_SetMediaDataHandler(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short index;
+ DataHandlerComponent dataHandler;
+#ifndef SetMediaDataHandler
+ PyMac_PRECHECK(SetMediaDataHandler);
+#endif
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &index,
+ CmpObj_Convert, &dataHandler))
+ return NULL;
+ _err = SetMediaDataHandler(_self->ob_itself,
+ index,
+ dataHandler);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaSampleDescriptionCount(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+#ifndef GetMediaSampleDescriptionCount
+ PyMac_PRECHECK(GetMediaSampleDescriptionCount);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMediaSampleDescriptionCount(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaSampleDescription(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long index;
+ SampleDescriptionHandle descH;
+#ifndef GetMediaSampleDescription
+ PyMac_PRECHECK(GetMediaSampleDescription);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&",
+ &index,
+ ResObj_Convert, &descH))
+ return NULL;
+ GetMediaSampleDescription(_self->ob_itself,
+ index,
+ descH);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MediaObj_SetMediaSampleDescription(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long index;
+ SampleDescriptionHandle descH;
+#ifndef SetMediaSampleDescription
+ PyMac_PRECHECK(SetMediaSampleDescription);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&",
+ &index,
+ ResObj_Convert, &descH))
+ return NULL;
+ _err = SetMediaSampleDescription(_self->ob_itself,
+ index,
+ descH);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaSampleCount(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+#ifndef GetMediaSampleCount
+ PyMac_PRECHECK(GetMediaSampleCount);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMediaSampleCount(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaSyncSampleCount(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+#ifndef GetMediaSyncSampleCount
+ PyMac_PRECHECK(GetMediaSyncSampleCount);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMediaSyncSampleCount(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MediaObj_SampleNumToMediaTime(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long logicalSampleNum;
+ TimeValue sampleTime;
+ TimeValue sampleDuration;
+#ifndef SampleNumToMediaTime
+ PyMac_PRECHECK(SampleNumToMediaTime);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &logicalSampleNum))
+ return NULL;
+ SampleNumToMediaTime(_self->ob_itself,
+ logicalSampleNum,
+ &sampleTime,
+ &sampleDuration);
+ _res = Py_BuildValue("ll",
+ sampleTime,
+ sampleDuration);
+ return _res;
+}
+
+static PyObject *MediaObj_MediaTimeToSampleNum(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue time;
+ long sampleNum;
+ TimeValue sampleTime;
+ TimeValue sampleDuration;
+#ifndef MediaTimeToSampleNum
+ PyMac_PRECHECK(MediaTimeToSampleNum);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &time))
+ return NULL;
+ MediaTimeToSampleNum(_self->ob_itself,
+ time,
+ &sampleNum,
+ &sampleTime,
+ &sampleDuration);
+ _res = Py_BuildValue("lll",
+ sampleNum,
+ sampleTime,
+ sampleDuration);
+ return _res;
+}
+
+static PyObject *MediaObj_AddMediaSample(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle dataIn;
+ long inOffset;
+ unsigned long size;
+ TimeValue durationPerSample;
+ SampleDescriptionHandle sampleDescriptionH;
+ long numberOfSamples;
+ short sampleFlags;
+ TimeValue sampleTime;
+#ifndef AddMediaSample
+ PyMac_PRECHECK(AddMediaSample);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lllO&lh",
+ ResObj_Convert, &dataIn,
+ &inOffset,
+ &size,
+ &durationPerSample,
+ ResObj_Convert, &sampleDescriptionH,
+ &numberOfSamples,
+ &sampleFlags))
+ return NULL;
+ _err = AddMediaSample(_self->ob_itself,
+ dataIn,
+ inOffset,
+ size,
+ durationPerSample,
+ sampleDescriptionH,
+ numberOfSamples,
+ sampleFlags,
+ &sampleTime);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ sampleTime);
+ return _res;
+}
+
+static PyObject *MediaObj_AddMediaSampleReference(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long dataOffset;
+ unsigned long size;
+ TimeValue durationPerSample;
+ SampleDescriptionHandle sampleDescriptionH;
+ long numberOfSamples;
+ short sampleFlags;
+ TimeValue sampleTime;
+#ifndef AddMediaSampleReference
+ PyMac_PRECHECK(AddMediaSampleReference);
+#endif
+ if (!PyArg_ParseTuple(_args, "lllO&lh",
+ &dataOffset,
+ &size,
+ &durationPerSample,
+ ResObj_Convert, &sampleDescriptionH,
+ &numberOfSamples,
+ &sampleFlags))
+ return NULL;
+ _err = AddMediaSampleReference(_self->ob_itself,
+ dataOffset,
+ size,
+ durationPerSample,
+ sampleDescriptionH,
+ numberOfSamples,
+ sampleFlags,
+ &sampleTime);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ sampleTime);
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaSample(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle dataOut;
+ long maxSizeToGrow;
+ long size;
+ TimeValue time;
+ TimeValue sampleTime;
+ TimeValue durationPerSample;
+ SampleDescriptionHandle sampleDescriptionH;
+ long sampleDescriptionIndex;
+ long maxNumberOfSamples;
+ long numberOfSamples;
+ short sampleFlags;
+#ifndef GetMediaSample
+ PyMac_PRECHECK(GetMediaSample);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&llO&l",
+ ResObj_Convert, &dataOut,
+ &maxSizeToGrow,
+ &time,
+ ResObj_Convert, &sampleDescriptionH,
+ &maxNumberOfSamples))
+ return NULL;
+ _err = GetMediaSample(_self->ob_itself,
+ dataOut,
+ maxSizeToGrow,
+ &size,
+ time,
+ &sampleTime,
+ &durationPerSample,
+ sampleDescriptionH,
+ &sampleDescriptionIndex,
+ maxNumberOfSamples,
+ &numberOfSamples,
+ &sampleFlags);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("lllllh",
+ size,
+ sampleTime,
+ durationPerSample,
+ sampleDescriptionIndex,
+ numberOfSamples,
+ sampleFlags);
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaSampleReference(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long dataOffset;
+ long size;
+ TimeValue time;
+ TimeValue sampleTime;
+ TimeValue durationPerSample;
+ SampleDescriptionHandle sampleDescriptionH;
+ long sampleDescriptionIndex;
+ long maxNumberOfSamples;
+ long numberOfSamples;
+ short sampleFlags;
+#ifndef GetMediaSampleReference
+ PyMac_PRECHECK(GetMediaSampleReference);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&l",
+ &time,
+ ResObj_Convert, &sampleDescriptionH,
+ &maxNumberOfSamples))
+ return NULL;
+ _err = GetMediaSampleReference(_self->ob_itself,
+ &dataOffset,
+ &size,
+ time,
+ &sampleTime,
+ &durationPerSample,
+ sampleDescriptionH,
+ &sampleDescriptionIndex,
+ maxNumberOfSamples,
+ &numberOfSamples,
+ &sampleFlags);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("llllllh",
+ dataOffset,
+ size,
+ sampleTime,
+ durationPerSample,
+ sampleDescriptionIndex,
+ numberOfSamples,
+ sampleFlags);
+ return _res;
+}
+
+static PyObject *MediaObj_SetMediaPreferredChunkSize(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long maxChunkSize;
+#ifndef SetMediaPreferredChunkSize
+ PyMac_PRECHECK(SetMediaPreferredChunkSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &maxChunkSize))
+ return NULL;
+ _err = SetMediaPreferredChunkSize(_self->ob_itself,
+ maxChunkSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaPreferredChunkSize(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long maxChunkSize;
+#ifndef GetMediaPreferredChunkSize
+ PyMac_PRECHECK(GetMediaPreferredChunkSize);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetMediaPreferredChunkSize(_self->ob_itself,
+ &maxChunkSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ maxChunkSize);
+ return _res;
+}
+
+static PyObject *MediaObj_SetMediaShadowSync(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long frameDiffSampleNum;
+ long syncSampleNum;
+#ifndef SetMediaShadowSync
+ PyMac_PRECHECK(SetMediaShadowSync);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &frameDiffSampleNum,
+ &syncSampleNum))
+ return NULL;
+ _err = SetMediaShadowSync(_self->ob_itself,
+ frameDiffSampleNum,
+ syncSampleNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaShadowSync(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long frameDiffSampleNum;
+ long syncSampleNum;
+#ifndef GetMediaShadowSync
+ PyMac_PRECHECK(GetMediaShadowSync);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &frameDiffSampleNum))
+ return NULL;
+ _err = GetMediaShadowSync(_self->ob_itself,
+ frameDiffSampleNum,
+ &syncSampleNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ syncSampleNum);
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaDataSize(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ TimeValue startTime;
+ TimeValue duration;
+#ifndef GetMediaDataSize
+ PyMac_PRECHECK(GetMediaDataSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &startTime,
+ &duration))
+ return NULL;
+ _rv = GetMediaDataSize(_self->ob_itself,
+ startTime,
+ duration);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaDataSize64(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ TimeValue startTime;
+ TimeValue duration;
+ wide dataSize;
+#ifndef GetMediaDataSize64
+ PyMac_PRECHECK(GetMediaDataSize64);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &startTime,
+ &duration))
+ return NULL;
+ _err = GetMediaDataSize64(_self->ob_itself,
+ startTime,
+ duration,
+ &dataSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_Buildwide, dataSize);
+ return _res;
+}
+
+static PyObject *MediaObj_CopyMediaUserData(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Media dstMedia;
+ OSType copyRule;
+#ifndef CopyMediaUserData
+ PyMac_PRECHECK(CopyMediaUserData);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ MediaObj_Convert, &dstMedia,
+ PyMac_GetOSType, &copyRule))
+ return NULL;
+ _err = CopyMediaUserData(_self->ob_itself,
+ dstMedia,
+ copyRule);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaNextInterestingTime(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short interestingTimeFlags;
+ TimeValue time;
+ Fixed rate;
+ TimeValue interestingTime;
+ TimeValue interestingDuration;
+#ifndef GetMediaNextInterestingTime
+ PyMac_PRECHECK(GetMediaNextInterestingTime);
+#endif
+ if (!PyArg_ParseTuple(_args, "hlO&",
+ &interestingTimeFlags,
+ &time,
+ PyMac_GetFixed, &rate))
+ return NULL;
+ GetMediaNextInterestingTime(_self->ob_itself,
+ interestingTimeFlags,
+ time,
+ rate,
+ &interestingTime,
+ &interestingDuration);
+ _res = Py_BuildValue("ll",
+ interestingTime,
+ interestingDuration);
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaDataRef(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short index;
+ Handle dataRef;
+ OSType dataRefType;
+ long dataRefAttributes;
+#ifndef GetMediaDataRef
+ PyMac_PRECHECK(GetMediaDataRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &index))
+ return NULL;
+ _err = GetMediaDataRef(_self->ob_itself,
+ index,
+ &dataRef,
+ &dataRefType,
+ &dataRefAttributes);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&O&l",
+ ResObj_New, dataRef,
+ PyMac_BuildOSType, dataRefType,
+ dataRefAttributes);
+ return _res;
+}
+
+static PyObject *MediaObj_SetMediaDataRef(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short index;
+ Handle dataRef;
+ OSType dataRefType;
+#ifndef SetMediaDataRef
+ PyMac_PRECHECK(SetMediaDataRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "hO&O&",
+ &index,
+ ResObj_Convert, &dataRef,
+ PyMac_GetOSType, &dataRefType))
+ return NULL;
+ _err = SetMediaDataRef(_self->ob_itself,
+ index,
+ dataRef,
+ dataRefType);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MediaObj_SetMediaDataRefAttributes(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short index;
+ long dataRefAttributes;
+#ifndef SetMediaDataRefAttributes
+ PyMac_PRECHECK(SetMediaDataRefAttributes);
+#endif
+ if (!PyArg_ParseTuple(_args, "hl",
+ &index,
+ &dataRefAttributes))
+ return NULL;
+ _err = SetMediaDataRefAttributes(_self->ob_itself,
+ index,
+ dataRefAttributes);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MediaObj_AddMediaDataRef(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short index;
+ Handle dataRef;
+ OSType dataRefType;
+#ifndef AddMediaDataRef
+ PyMac_PRECHECK(AddMediaDataRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &dataRef,
+ PyMac_GetOSType, &dataRefType))
+ return NULL;
+ _err = AddMediaDataRef(_self->ob_itself,
+ &index,
+ dataRef,
+ dataRefType);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ index);
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaDataRefCount(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short count;
+#ifndef GetMediaDataRefCount
+ PyMac_PRECHECK(GetMediaDataRefCount);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetMediaDataRefCount(_self->ob_itself,
+ &count);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ count);
+ return _res;
+}
+
+static PyObject *MediaObj_SetMediaPlayHints(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long flags;
+ long flagsMask;
+#ifndef SetMediaPlayHints
+ PyMac_PRECHECK(SetMediaPlayHints);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &flags,
+ &flagsMask))
+ return NULL;
+ SetMediaPlayHints(_self->ob_itself,
+ flags,
+ flagsMask);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaPlayHints(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long flags;
+#ifndef GetMediaPlayHints
+ PyMac_PRECHECK(GetMediaPlayHints);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetMediaPlayHints(_self->ob_itself,
+ &flags);
+ _res = Py_BuildValue("l",
+ flags);
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaNextInterestingTimeOnly(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short interestingTimeFlags;
+ TimeValue time;
+ Fixed rate;
+ TimeValue interestingTime;
+#ifndef GetMediaNextInterestingTimeOnly
+ PyMac_PRECHECK(GetMediaNextInterestingTimeOnly);
+#endif
+ if (!PyArg_ParseTuple(_args, "hlO&",
+ &interestingTimeFlags,
+ &time,
+ PyMac_GetFixed, &rate))
+ return NULL;
+ GetMediaNextInterestingTimeOnly(_self->ob_itself,
+ interestingTimeFlags,
+ time,
+ rate,
+ &interestingTime);
+ _res = Py_BuildValue("l",
+ interestingTime);
+ return _res;
+}
+
+static PyMethodDef MediaObj_methods[] = {
+ {"LoadMediaIntoRam", (PyCFunction)MediaObj_LoadMediaIntoRam, 1,
+ PyDoc_STR("(TimeValue time, TimeValue duration, long flags) -> None")},
+ {"GetMediaTrack", (PyCFunction)MediaObj_GetMediaTrack, 1,
+ PyDoc_STR("() -> (Track _rv)")},
+ {"GetMediaCreationTime", (PyCFunction)MediaObj_GetMediaCreationTime, 1,
+ PyDoc_STR("() -> (unsigned long _rv)")},
+ {"GetMediaModificationTime", (PyCFunction)MediaObj_GetMediaModificationTime, 1,
+ PyDoc_STR("() -> (unsigned long _rv)")},
+ {"GetMediaTimeScale", (PyCFunction)MediaObj_GetMediaTimeScale, 1,
+ PyDoc_STR("() -> (TimeScale _rv)")},
+ {"SetMediaTimeScale", (PyCFunction)MediaObj_SetMediaTimeScale, 1,
+ PyDoc_STR("(TimeScale timeScale) -> None")},
+ {"GetMediaDuration", (PyCFunction)MediaObj_GetMediaDuration, 1,
+ PyDoc_STR("() -> (TimeValue _rv)")},
+ {"GetMediaLanguage", (PyCFunction)MediaObj_GetMediaLanguage, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"SetMediaLanguage", (PyCFunction)MediaObj_SetMediaLanguage, 1,
+ PyDoc_STR("(short language) -> None")},
+ {"GetMediaQuality", (PyCFunction)MediaObj_GetMediaQuality, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"SetMediaQuality", (PyCFunction)MediaObj_SetMediaQuality, 1,
+ PyDoc_STR("(short quality) -> None")},
+ {"GetMediaHandlerDescription", (PyCFunction)MediaObj_GetMediaHandlerDescription, 1,
+ PyDoc_STR("(Str255 creatorName) -> (OSType mediaType, OSType creatorManufacturer)")},
+ {"GetMediaUserData", (PyCFunction)MediaObj_GetMediaUserData, 1,
+ PyDoc_STR("() -> (UserData _rv)")},
+ {"GetMediaHandler", (PyCFunction)MediaObj_GetMediaHandler, 1,
+ PyDoc_STR("() -> (MediaHandler _rv)")},
+ {"SetMediaHandler", (PyCFunction)MediaObj_SetMediaHandler, 1,
+ PyDoc_STR("(MediaHandlerComponent mH) -> None")},
+ {"BeginMediaEdits", (PyCFunction)MediaObj_BeginMediaEdits, 1,
+ PyDoc_STR("() -> None")},
+ {"EndMediaEdits", (PyCFunction)MediaObj_EndMediaEdits, 1,
+ PyDoc_STR("() -> None")},
+ {"SetMediaDefaultDataRefIndex", (PyCFunction)MediaObj_SetMediaDefaultDataRefIndex, 1,
+ PyDoc_STR("(short index) -> None")},
+ {"GetMediaDataHandlerDescription", (PyCFunction)MediaObj_GetMediaDataHandlerDescription, 1,
+ PyDoc_STR("(short index, Str255 creatorName) -> (OSType dhType, OSType creatorManufacturer)")},
+ {"GetMediaDataHandler", (PyCFunction)MediaObj_GetMediaDataHandler, 1,
+ PyDoc_STR("(short index) -> (DataHandler _rv)")},
+ {"SetMediaDataHandler", (PyCFunction)MediaObj_SetMediaDataHandler, 1,
+ PyDoc_STR("(short index, DataHandlerComponent dataHandler) -> None")},
+ {"GetMediaSampleDescriptionCount", (PyCFunction)MediaObj_GetMediaSampleDescriptionCount, 1,
+ PyDoc_STR("() -> (long _rv)")},
+ {"GetMediaSampleDescription", (PyCFunction)MediaObj_GetMediaSampleDescription, 1,
+ PyDoc_STR("(long index, SampleDescriptionHandle descH) -> None")},
+ {"SetMediaSampleDescription", (PyCFunction)MediaObj_SetMediaSampleDescription, 1,
+ PyDoc_STR("(long index, SampleDescriptionHandle descH) -> None")},
+ {"GetMediaSampleCount", (PyCFunction)MediaObj_GetMediaSampleCount, 1,
+ PyDoc_STR("() -> (long _rv)")},
+ {"GetMediaSyncSampleCount", (PyCFunction)MediaObj_GetMediaSyncSampleCount, 1,
+ PyDoc_STR("() -> (long _rv)")},
+ {"SampleNumToMediaTime", (PyCFunction)MediaObj_SampleNumToMediaTime, 1,
+ PyDoc_STR("(long logicalSampleNum) -> (TimeValue sampleTime, TimeValue sampleDuration)")},
+ {"MediaTimeToSampleNum", (PyCFunction)MediaObj_MediaTimeToSampleNum, 1,
+ PyDoc_STR("(TimeValue time) -> (long sampleNum, TimeValue sampleTime, TimeValue sampleDuration)")},
+ {"AddMediaSample", (PyCFunction)MediaObj_AddMediaSample, 1,
+ PyDoc_STR("(Handle dataIn, long inOffset, unsigned long size, TimeValue durationPerSample, SampleDescriptionHandle sampleDescriptionH, long numberOfSamples, short sampleFlags) -> (TimeValue sampleTime)")},
+ {"AddMediaSampleReference", (PyCFunction)MediaObj_AddMediaSampleReference, 1,
+ PyDoc_STR("(long dataOffset, unsigned long size, TimeValue durationPerSample, SampleDescriptionHandle sampleDescriptionH, long numberOfSamples, short sampleFlags) -> (TimeValue sampleTime)")},
+ {"GetMediaSample", (PyCFunction)MediaObj_GetMediaSample, 1,
+ PyDoc_STR("(Handle dataOut, long maxSizeToGrow, TimeValue time, SampleDescriptionHandle sampleDescriptionH, long maxNumberOfSamples) -> (long size, TimeValue sampleTime, TimeValue durationPerSample, long sampleDescriptionIndex, long numberOfSamples, short sampleFlags)")},
+ {"GetMediaSampleReference", (PyCFunction)MediaObj_GetMediaSampleReference, 1,
+ PyDoc_STR("(TimeValue time, SampleDescriptionHandle sampleDescriptionH, long maxNumberOfSamples) -> (long dataOffset, long size, TimeValue sampleTime, TimeValue durationPerSample, long sampleDescriptionIndex, long numberOfSamples, short sampleFlags)")},
+ {"SetMediaPreferredChunkSize", (PyCFunction)MediaObj_SetMediaPreferredChunkSize, 1,
+ PyDoc_STR("(long maxChunkSize) -> None")},
+ {"GetMediaPreferredChunkSize", (PyCFunction)MediaObj_GetMediaPreferredChunkSize, 1,
+ PyDoc_STR("() -> (long maxChunkSize)")},
+ {"SetMediaShadowSync", (PyCFunction)MediaObj_SetMediaShadowSync, 1,
+ PyDoc_STR("(long frameDiffSampleNum, long syncSampleNum) -> None")},
+ {"GetMediaShadowSync", (PyCFunction)MediaObj_GetMediaShadowSync, 1,
+ PyDoc_STR("(long frameDiffSampleNum) -> (long syncSampleNum)")},
+ {"GetMediaDataSize", (PyCFunction)MediaObj_GetMediaDataSize, 1,
+ PyDoc_STR("(TimeValue startTime, TimeValue duration) -> (long _rv)")},
+ {"GetMediaDataSize64", (PyCFunction)MediaObj_GetMediaDataSize64, 1,
+ PyDoc_STR("(TimeValue startTime, TimeValue duration) -> (wide dataSize)")},
+ {"CopyMediaUserData", (PyCFunction)MediaObj_CopyMediaUserData, 1,
+ PyDoc_STR("(Media dstMedia, OSType copyRule) -> None")},
+ {"GetMediaNextInterestingTime", (PyCFunction)MediaObj_GetMediaNextInterestingTime, 1,
+ PyDoc_STR("(short interestingTimeFlags, TimeValue time, Fixed rate) -> (TimeValue interestingTime, TimeValue interestingDuration)")},
+ {"GetMediaDataRef", (PyCFunction)MediaObj_GetMediaDataRef, 1,
+ PyDoc_STR("(short index) -> (Handle dataRef, OSType dataRefType, long dataRefAttributes)")},
+ {"SetMediaDataRef", (PyCFunction)MediaObj_SetMediaDataRef, 1,
+ PyDoc_STR("(short index, Handle dataRef, OSType dataRefType) -> None")},
+ {"SetMediaDataRefAttributes", (PyCFunction)MediaObj_SetMediaDataRefAttributes, 1,
+ PyDoc_STR("(short index, long dataRefAttributes) -> None")},
+ {"AddMediaDataRef", (PyCFunction)MediaObj_AddMediaDataRef, 1,
+ PyDoc_STR("(Handle dataRef, OSType dataRefType) -> (short index)")},
+ {"GetMediaDataRefCount", (PyCFunction)MediaObj_GetMediaDataRefCount, 1,
+ PyDoc_STR("() -> (short count)")},
+ {"SetMediaPlayHints", (PyCFunction)MediaObj_SetMediaPlayHints, 1,
+ PyDoc_STR("(long flags, long flagsMask) -> None")},
+ {"GetMediaPlayHints", (PyCFunction)MediaObj_GetMediaPlayHints, 1,
+ PyDoc_STR("() -> (long flags)")},
+ {"GetMediaNextInterestingTimeOnly", (PyCFunction)MediaObj_GetMediaNextInterestingTimeOnly, 1,
+ PyDoc_STR("(short interestingTimeFlags, TimeValue time, Fixed rate) -> (TimeValue interestingTime)")},
+ {NULL, NULL, 0}
+};
+
+#define MediaObj_getsetlist NULL
+
+
+#define MediaObj_compare NULL
+
+#define MediaObj_repr NULL
+
+#define MediaObj_hash NULL
+#define MediaObj_tp_init 0
+
+#define MediaObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *MediaObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *_self;
+ Media itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, MediaObj_Convert, &itself)) return NULL;
+ if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((MediaObject *)_self)->ob_itself = itself;
+ return _self;
+}
+
+#define MediaObj_tp_free PyObject_Del
+
+
+PyTypeObject Media_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_Qt.Media", /*tp_name*/
+ sizeof(MediaObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) MediaObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) MediaObj_compare, /*tp_compare*/
+ (reprfunc) MediaObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) MediaObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ MediaObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ MediaObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ MediaObj_tp_init, /* tp_init */
+ MediaObj_tp_alloc, /* tp_alloc */
+ MediaObj_tp_new, /* tp_new */
+ MediaObj_tp_free, /* tp_free */
+};
+
+/* --------------------- End object type Media ---------------------- */
+
+
+/* ----------------------- Object type Track ------------------------ */
+
+PyTypeObject Track_Type;
+
+#define TrackObj_Check(x) ((x)->ob_type == &Track_Type || PyObject_TypeCheck((x), &Track_Type))
+
+typedef struct TrackObject {
+ PyObject_HEAD
+ Track ob_itself;
+} TrackObject;
+
+PyObject *TrackObj_New(Track itself)
+{
+ TrackObject *it;
+ if (itself == NULL) {
+ PyErr_SetString(Qt_Error,"Cannot create Track from NULL pointer");
+ return NULL;
+ }
+ it = PyObject_NEW(TrackObject, &Track_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+
+int TrackObj_Convert(PyObject *v, Track *p_itself)
+{
+ if (v == Py_None)
+ {
+ *p_itself = NULL;
+ return 1;
+ }
+ if (!TrackObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "Track required");
+ return 0;
+ }
+ *p_itself = ((TrackObject *)v)->ob_itself;
+ return 1;
+}
+
+static void TrackObj_dealloc(TrackObject *self)
+{
+ if (self->ob_itself) DisposeMovieTrack(self->ob_itself);
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *TrackObj_LoadTrackIntoRam(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ TimeValue time;
+ TimeValue duration;
+ long flags;
+#ifndef LoadTrackIntoRam
+ PyMac_PRECHECK(LoadTrackIntoRam);
+#endif
+ if (!PyArg_ParseTuple(_args, "lll",
+ &time,
+ &duration,
+ &flags))
+ return NULL;
+ _err = LoadTrackIntoRam(_self->ob_itself,
+ time,
+ duration,
+ flags);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackPict(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PicHandle _rv;
+ TimeValue time;
+#ifndef GetTrackPict
+ PyMac_PRECHECK(GetTrackPict);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &time))
+ return NULL;
+ _rv = GetTrackPict(_self->ob_itself,
+ time);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackClipRgn(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle _rv;
+#ifndef GetTrackClipRgn
+ PyMac_PRECHECK(GetTrackClipRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackClipRgn(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_SetTrackClipRgn(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle theClip;
+#ifndef SetTrackClipRgn
+ PyMac_PRECHECK(SetTrackClipRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &theClip))
+ return NULL;
+ SetTrackClipRgn(_self->ob_itself,
+ theClip);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackDisplayBoundsRgn(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle _rv;
+#ifndef GetTrackDisplayBoundsRgn
+ PyMac_PRECHECK(GetTrackDisplayBoundsRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackDisplayBoundsRgn(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackMovieBoundsRgn(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle _rv;
+#ifndef GetTrackMovieBoundsRgn
+ PyMac_PRECHECK(GetTrackMovieBoundsRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackMovieBoundsRgn(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackBoundsRgn(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle _rv;
+#ifndef GetTrackBoundsRgn
+ PyMac_PRECHECK(GetTrackBoundsRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackBoundsRgn(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackMatte(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixMapHandle _rv;
+#ifndef GetTrackMatte
+ PyMac_PRECHECK(GetTrackMatte);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackMatte(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_SetTrackMatte(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixMapHandle theMatte;
+#ifndef SetTrackMatte
+ PyMac_PRECHECK(SetTrackMatte);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &theMatte))
+ return NULL;
+ SetTrackMatte(_self->ob_itself,
+ theMatte);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackID(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+#ifndef GetTrackID
+ PyMac_PRECHECK(GetTrackID);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackID(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackMovie(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Movie _rv;
+#ifndef GetTrackMovie
+ PyMac_PRECHECK(GetTrackMovie);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackMovie(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ MovieObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackCreationTime(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ unsigned long _rv;
+#ifndef GetTrackCreationTime
+ PyMac_PRECHECK(GetTrackCreationTime);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackCreationTime(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackModificationTime(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ unsigned long _rv;
+#ifndef GetTrackModificationTime
+ PyMac_PRECHECK(GetTrackModificationTime);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackModificationTime(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackEnabled(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef GetTrackEnabled
+ PyMac_PRECHECK(GetTrackEnabled);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackEnabled(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_SetTrackEnabled(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean isEnabled;
+#ifndef SetTrackEnabled
+ PyMac_PRECHECK(SetTrackEnabled);
+#endif
+ if (!PyArg_ParseTuple(_args, "b",
+ &isEnabled))
+ return NULL;
+ SetTrackEnabled(_self->ob_itself,
+ isEnabled);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackUsage(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+#ifndef GetTrackUsage
+ PyMac_PRECHECK(GetTrackUsage);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackUsage(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_SetTrackUsage(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long usage;
+#ifndef SetTrackUsage
+ PyMac_PRECHECK(SetTrackUsage);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &usage))
+ return NULL;
+ SetTrackUsage(_self->ob_itself,
+ usage);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackDuration(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue _rv;
+#ifndef GetTrackDuration
+ PyMac_PRECHECK(GetTrackDuration);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackDuration(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackOffset(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue _rv;
+#ifndef GetTrackOffset
+ PyMac_PRECHECK(GetTrackOffset);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackOffset(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_SetTrackOffset(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue movieOffsetTime;
+#ifndef SetTrackOffset
+ PyMac_PRECHECK(SetTrackOffset);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &movieOffsetTime))
+ return NULL;
+ SetTrackOffset(_self->ob_itself,
+ movieOffsetTime);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackLayer(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+#ifndef GetTrackLayer
+ PyMac_PRECHECK(GetTrackLayer);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackLayer(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_SetTrackLayer(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short layer;
+#ifndef SetTrackLayer
+ PyMac_PRECHECK(SetTrackLayer);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &layer))
+ return NULL;
+ SetTrackLayer(_self->ob_itself,
+ layer);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackAlternate(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Track _rv;
+#ifndef GetTrackAlternate
+ PyMac_PRECHECK(GetTrackAlternate);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackAlternate(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ TrackObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_SetTrackAlternate(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Track alternateT;
+#ifndef SetTrackAlternate
+ PyMac_PRECHECK(SetTrackAlternate);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ TrackObj_Convert, &alternateT))
+ return NULL;
+ SetTrackAlternate(_self->ob_itself,
+ alternateT);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackVolume(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+#ifndef GetTrackVolume
+ PyMac_PRECHECK(GetTrackVolume);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackVolume(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_SetTrackVolume(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short volume;
+#ifndef SetTrackVolume
+ PyMac_PRECHECK(SetTrackVolume);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &volume))
+ return NULL;
+ SetTrackVolume(_self->ob_itself,
+ volume);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackDimensions(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Fixed width;
+ Fixed height;
+#ifndef GetTrackDimensions
+ PyMac_PRECHECK(GetTrackDimensions);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetTrackDimensions(_self->ob_itself,
+ &width,
+ &height);
+ _res = Py_BuildValue("O&O&",
+ PyMac_BuildFixed, width,
+ PyMac_BuildFixed, height);
+ return _res;
+}
+
+static PyObject *TrackObj_SetTrackDimensions(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Fixed width;
+ Fixed height;
+#ifndef SetTrackDimensions
+ PyMac_PRECHECK(SetTrackDimensions);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetFixed, &width,
+ PyMac_GetFixed, &height))
+ return NULL;
+ SetTrackDimensions(_self->ob_itself,
+ width,
+ height);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackUserData(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UserData _rv;
+#ifndef GetTrackUserData
+ PyMac_PRECHECK(GetTrackUserData);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackUserData(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ UserDataObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackSoundLocalizationSettings(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle settings;
+#ifndef GetTrackSoundLocalizationSettings
+ PyMac_PRECHECK(GetTrackSoundLocalizationSettings);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetTrackSoundLocalizationSettings(_self->ob_itself,
+ &settings);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, settings);
+ return _res;
+}
+
+static PyObject *TrackObj_SetTrackSoundLocalizationSettings(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle settings;
+#ifndef SetTrackSoundLocalizationSettings
+ PyMac_PRECHECK(SetTrackSoundLocalizationSettings);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &settings))
+ return NULL;
+ _err = SetTrackSoundLocalizationSettings(_self->ob_itself,
+ settings);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_NewTrackMedia(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Media _rv;
+ OSType mediaType;
+ TimeScale timeScale;
+ Handle dataRef;
+ OSType dataRefType;
+#ifndef NewTrackMedia
+ PyMac_PRECHECK(NewTrackMedia);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lO&O&",
+ PyMac_GetOSType, &mediaType,
+ &timeScale,
+ ResObj_Convert, &dataRef,
+ PyMac_GetOSType, &dataRefType))
+ return NULL;
+ _rv = NewTrackMedia(_self->ob_itself,
+ mediaType,
+ timeScale,
+ dataRef,
+ dataRefType);
+ _res = Py_BuildValue("O&",
+ MediaObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackMedia(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Media _rv;
+#ifndef GetTrackMedia
+ PyMac_PRECHECK(GetTrackMedia);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackMedia(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ MediaObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_InsertMediaIntoTrack(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ TimeValue trackStart;
+ TimeValue mediaTime;
+ TimeValue mediaDuration;
+ Fixed mediaRate;
+#ifndef InsertMediaIntoTrack
+ PyMac_PRECHECK(InsertMediaIntoTrack);
+#endif
+ if (!PyArg_ParseTuple(_args, "lllO&",
+ &trackStart,
+ &mediaTime,
+ &mediaDuration,
+ PyMac_GetFixed, &mediaRate))
+ return NULL;
+ _err = InsertMediaIntoTrack(_self->ob_itself,
+ trackStart,
+ mediaTime,
+ mediaDuration,
+ mediaRate);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_InsertTrackSegment(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Track dstTrack;
+ TimeValue srcIn;
+ TimeValue srcDuration;
+ TimeValue dstIn;
+#ifndef InsertTrackSegment
+ PyMac_PRECHECK(InsertTrackSegment);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lll",
+ TrackObj_Convert, &dstTrack,
+ &srcIn,
+ &srcDuration,
+ &dstIn))
+ return NULL;
+ _err = InsertTrackSegment(_self->ob_itself,
+ dstTrack,
+ srcIn,
+ srcDuration,
+ dstIn);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_InsertEmptyTrackSegment(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ TimeValue dstIn;
+ TimeValue dstDuration;
+#ifndef InsertEmptyTrackSegment
+ PyMac_PRECHECK(InsertEmptyTrackSegment);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &dstIn,
+ &dstDuration))
+ return NULL;
+ _err = InsertEmptyTrackSegment(_self->ob_itself,
+ dstIn,
+ dstDuration);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_DeleteTrackSegment(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ TimeValue startTime;
+ TimeValue duration;
+#ifndef DeleteTrackSegment
+ PyMac_PRECHECK(DeleteTrackSegment);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &startTime,
+ &duration))
+ return NULL;
+ _err = DeleteTrackSegment(_self->ob_itself,
+ startTime,
+ duration);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_ScaleTrackSegment(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ TimeValue startTime;
+ TimeValue oldDuration;
+ TimeValue newDuration;
+#ifndef ScaleTrackSegment
+ PyMac_PRECHECK(ScaleTrackSegment);
+#endif
+ if (!PyArg_ParseTuple(_args, "lll",
+ &startTime,
+ &oldDuration,
+ &newDuration))
+ return NULL;
+ _err = ScaleTrackSegment(_self->ob_itself,
+ startTime,
+ oldDuration,
+ newDuration);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_IsScrapMovie(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Component _rv;
+#ifndef IsScrapMovie
+ PyMac_PRECHECK(IsScrapMovie);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsScrapMovie(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CmpObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_CopyTrackSettings(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Track dstTrack;
+#ifndef CopyTrackSettings
+ PyMac_PRECHECK(CopyTrackSettings);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ TrackObj_Convert, &dstTrack))
+ return NULL;
+ _err = CopyTrackSettings(_self->ob_itself,
+ dstTrack);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_AddEmptyTrackToMovie(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Movie dstMovie;
+ Handle dataRef;
+ OSType dataRefType;
+ Track dstTrack;
+#ifndef AddEmptyTrackToMovie
+ PyMac_PRECHECK(AddEmptyTrackToMovie);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ MovieObj_Convert, &dstMovie,
+ ResObj_Convert, &dataRef,
+ PyMac_GetOSType, &dataRefType))
+ return NULL;
+ _err = AddEmptyTrackToMovie(_self->ob_itself,
+ dstMovie,
+ dataRef,
+ dataRefType,
+ &dstTrack);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ TrackObj_New, dstTrack);
+ return _res;
+}
+
+static PyObject *TrackObj_AddClonedTrackToMovie(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Movie dstMovie;
+ long flags;
+ Track dstTrack;
+#ifndef AddClonedTrackToMovie
+ PyMac_PRECHECK(AddClonedTrackToMovie);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ MovieObj_Convert, &dstMovie,
+ &flags))
+ return NULL;
+ _err = AddClonedTrackToMovie(_self->ob_itself,
+ dstMovie,
+ flags,
+ &dstTrack);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ TrackObj_New, dstTrack);
+ return _res;
+}
+
+static PyObject *TrackObj_AddTrackReference(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Track refTrack;
+ OSType refType;
+ long addedIndex;
+#ifndef AddTrackReference
+ PyMac_PRECHECK(AddTrackReference);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ TrackObj_Convert, &refTrack,
+ PyMac_GetOSType, &refType))
+ return NULL;
+ _err = AddTrackReference(_self->ob_itself,
+ refTrack,
+ refType,
+ &addedIndex);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ addedIndex);
+ return _res;
+}
+
+static PyObject *TrackObj_DeleteTrackReference(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType refType;
+ long index;
+#ifndef DeleteTrackReference
+ PyMac_PRECHECK(DeleteTrackReference);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetOSType, &refType,
+ &index))
+ return NULL;
+ _err = DeleteTrackReference(_self->ob_itself,
+ refType,
+ index);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_SetTrackReference(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Track refTrack;
+ OSType refType;
+ long index;
+#ifndef SetTrackReference
+ PyMac_PRECHECK(SetTrackReference);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&l",
+ TrackObj_Convert, &refTrack,
+ PyMac_GetOSType, &refType,
+ &index))
+ return NULL;
+ _err = SetTrackReference(_self->ob_itself,
+ refTrack,
+ refType,
+ index);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackReference(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Track _rv;
+ OSType refType;
+ long index;
+#ifndef GetTrackReference
+ PyMac_PRECHECK(GetTrackReference);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetOSType, &refType,
+ &index))
+ return NULL;
+ _rv = GetTrackReference(_self->ob_itself,
+ refType,
+ index);
+ _res = Py_BuildValue("O&",
+ TrackObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_GetNextTrackReferenceType(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSType _rv;
+ OSType refType;
+#ifndef GetNextTrackReferenceType
+ PyMac_PRECHECK(GetNextTrackReferenceType);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &refType))
+ return NULL;
+ _rv = GetNextTrackReferenceType(_self->ob_itself,
+ refType);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildOSType, _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackReferenceCount(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ OSType refType;
+#ifndef GetTrackReferenceCount
+ PyMac_PRECHECK(GetTrackReferenceCount);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &refType))
+ return NULL;
+ _rv = GetTrackReferenceCount(_self->ob_itself,
+ refType);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackEditRate(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Fixed _rv;
+ TimeValue atTime;
+#ifndef GetTrackEditRate
+ PyMac_PRECHECK(GetTrackEditRate);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &atTime))
+ return NULL;
+ _rv = GetTrackEditRate(_self->ob_itself,
+ atTime);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildFixed, _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackDataSize(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ TimeValue startTime;
+ TimeValue duration;
+#ifndef GetTrackDataSize
+ PyMac_PRECHECK(GetTrackDataSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &startTime,
+ &duration))
+ return NULL;
+ _rv = GetTrackDataSize(_self->ob_itself,
+ startTime,
+ duration);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackDataSize64(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ TimeValue startTime;
+ TimeValue duration;
+ wide dataSize;
+#ifndef GetTrackDataSize64
+ PyMac_PRECHECK(GetTrackDataSize64);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &startTime,
+ &duration))
+ return NULL;
+ _err = GetTrackDataSize64(_self->ob_itself,
+ startTime,
+ duration,
+ &dataSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_Buildwide, dataSize);
+ return _res;
+}
+
+static PyObject *TrackObj_PtInTrack(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Point pt;
+#ifndef PtInTrack
+ PyMac_PRECHECK(PtInTrack);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &pt))
+ return NULL;
+ _rv = PtInTrack(_self->ob_itself,
+ pt);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_CopyTrackUserData(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Track dstTrack;
+ OSType copyRule;
+#ifndef CopyTrackUserData
+ PyMac_PRECHECK(CopyTrackUserData);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ TrackObj_Convert, &dstTrack,
+ PyMac_GetOSType, &copyRule))
+ return NULL;
+ _err = CopyTrackUserData(_self->ob_itself,
+ dstTrack,
+ copyRule);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackNextInterestingTime(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short interestingTimeFlags;
+ TimeValue time;
+ Fixed rate;
+ TimeValue interestingTime;
+ TimeValue interestingDuration;
+#ifndef GetTrackNextInterestingTime
+ PyMac_PRECHECK(GetTrackNextInterestingTime);
+#endif
+ if (!PyArg_ParseTuple(_args, "hlO&",
+ &interestingTimeFlags,
+ &time,
+ PyMac_GetFixed, &rate))
+ return NULL;
+ GetTrackNextInterestingTime(_self->ob_itself,
+ interestingTimeFlags,
+ time,
+ rate,
+ &interestingTime,
+ &interestingDuration);
+ _res = Py_BuildValue("ll",
+ interestingTime,
+ interestingDuration);
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackSegmentDisplayBoundsRgn(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle _rv;
+ TimeValue time;
+ TimeValue duration;
+#ifndef GetTrackSegmentDisplayBoundsRgn
+ PyMac_PRECHECK(GetTrackSegmentDisplayBoundsRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &time,
+ &duration))
+ return NULL;
+ _rv = GetTrackSegmentDisplayBoundsRgn(_self->ob_itself,
+ time,
+ duration);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackStatus(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+#ifndef GetTrackStatus
+ PyMac_PRECHECK(GetTrackStatus);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackStatus(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_SetTrackLoadSettings(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue preloadTime;
+ TimeValue preloadDuration;
+ long preloadFlags;
+ long defaultHints;
+#ifndef SetTrackLoadSettings
+ PyMac_PRECHECK(SetTrackLoadSettings);
+#endif
+ if (!PyArg_ParseTuple(_args, "llll",
+ &preloadTime,
+ &preloadDuration,
+ &preloadFlags,
+ &defaultHints))
+ return NULL;
+ SetTrackLoadSettings(_self->ob_itself,
+ preloadTime,
+ preloadDuration,
+ preloadFlags,
+ defaultHints);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackLoadSettings(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue preloadTime;
+ TimeValue preloadDuration;
+ long preloadFlags;
+ long defaultHints;
+#ifndef GetTrackLoadSettings
+ PyMac_PRECHECK(GetTrackLoadSettings);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetTrackLoadSettings(_self->ob_itself,
+ &preloadTime,
+ &preloadDuration,
+ &preloadFlags,
+ &defaultHints);
+ _res = Py_BuildValue("llll",
+ preloadTime,
+ preloadDuration,
+ preloadFlags,
+ defaultHints);
+ return _res;
+}
+
+static PyMethodDef TrackObj_methods[] = {
+ {"LoadTrackIntoRam", (PyCFunction)TrackObj_LoadTrackIntoRam, 1,
+ PyDoc_STR("(TimeValue time, TimeValue duration, long flags) -> None")},
+ {"GetTrackPict", (PyCFunction)TrackObj_GetTrackPict, 1,
+ PyDoc_STR("(TimeValue time) -> (PicHandle _rv)")},
+ {"GetTrackClipRgn", (PyCFunction)TrackObj_GetTrackClipRgn, 1,
+ PyDoc_STR("() -> (RgnHandle _rv)")},
+ {"SetTrackClipRgn", (PyCFunction)TrackObj_SetTrackClipRgn, 1,
+ PyDoc_STR("(RgnHandle theClip) -> None")},
+ {"GetTrackDisplayBoundsRgn", (PyCFunction)TrackObj_GetTrackDisplayBoundsRgn, 1,
+ PyDoc_STR("() -> (RgnHandle _rv)")},
+ {"GetTrackMovieBoundsRgn", (PyCFunction)TrackObj_GetTrackMovieBoundsRgn, 1,
+ PyDoc_STR("() -> (RgnHandle _rv)")},
+ {"GetTrackBoundsRgn", (PyCFunction)TrackObj_GetTrackBoundsRgn, 1,
+ PyDoc_STR("() -> (RgnHandle _rv)")},
+ {"GetTrackMatte", (PyCFunction)TrackObj_GetTrackMatte, 1,
+ PyDoc_STR("() -> (PixMapHandle _rv)")},
+ {"SetTrackMatte", (PyCFunction)TrackObj_SetTrackMatte, 1,
+ PyDoc_STR("(PixMapHandle theMatte) -> None")},
+ {"GetTrackID", (PyCFunction)TrackObj_GetTrackID, 1,
+ PyDoc_STR("() -> (long _rv)")},
+ {"GetTrackMovie", (PyCFunction)TrackObj_GetTrackMovie, 1,
+ PyDoc_STR("() -> (Movie _rv)")},
+ {"GetTrackCreationTime", (PyCFunction)TrackObj_GetTrackCreationTime, 1,
+ PyDoc_STR("() -> (unsigned long _rv)")},
+ {"GetTrackModificationTime", (PyCFunction)TrackObj_GetTrackModificationTime, 1,
+ PyDoc_STR("() -> (unsigned long _rv)")},
+ {"GetTrackEnabled", (PyCFunction)TrackObj_GetTrackEnabled, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"SetTrackEnabled", (PyCFunction)TrackObj_SetTrackEnabled, 1,
+ PyDoc_STR("(Boolean isEnabled) -> None")},
+ {"GetTrackUsage", (PyCFunction)TrackObj_GetTrackUsage, 1,
+ PyDoc_STR("() -> (long _rv)")},
+ {"SetTrackUsage", (PyCFunction)TrackObj_SetTrackUsage, 1,
+ PyDoc_STR("(long usage) -> None")},
+ {"GetTrackDuration", (PyCFunction)TrackObj_GetTrackDuration, 1,
+ PyDoc_STR("() -> (TimeValue _rv)")},
+ {"GetTrackOffset", (PyCFunction)TrackObj_GetTrackOffset, 1,
+ PyDoc_STR("() -> (TimeValue _rv)")},
+ {"SetTrackOffset", (PyCFunction)TrackObj_SetTrackOffset, 1,
+ PyDoc_STR("(TimeValue movieOffsetTime) -> None")},
+ {"GetTrackLayer", (PyCFunction)TrackObj_GetTrackLayer, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"SetTrackLayer", (PyCFunction)TrackObj_SetTrackLayer, 1,
+ PyDoc_STR("(short layer) -> None")},
+ {"GetTrackAlternate", (PyCFunction)TrackObj_GetTrackAlternate, 1,
+ PyDoc_STR("() -> (Track _rv)")},
+ {"SetTrackAlternate", (PyCFunction)TrackObj_SetTrackAlternate, 1,
+ PyDoc_STR("(Track alternateT) -> None")},
+ {"GetTrackVolume", (PyCFunction)TrackObj_GetTrackVolume, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"SetTrackVolume", (PyCFunction)TrackObj_SetTrackVolume, 1,
+ PyDoc_STR("(short volume) -> None")},
+ {"GetTrackDimensions", (PyCFunction)TrackObj_GetTrackDimensions, 1,
+ PyDoc_STR("() -> (Fixed width, Fixed height)")},
+ {"SetTrackDimensions", (PyCFunction)TrackObj_SetTrackDimensions, 1,
+ PyDoc_STR("(Fixed width, Fixed height) -> None")},
+ {"GetTrackUserData", (PyCFunction)TrackObj_GetTrackUserData, 1,
+ PyDoc_STR("() -> (UserData _rv)")},
+ {"GetTrackSoundLocalizationSettings", (PyCFunction)TrackObj_GetTrackSoundLocalizationSettings, 1,
+ PyDoc_STR("() -> (Handle settings)")},
+ {"SetTrackSoundLocalizationSettings", (PyCFunction)TrackObj_SetTrackSoundLocalizationSettings, 1,
+ PyDoc_STR("(Handle settings) -> None")},
+ {"NewTrackMedia", (PyCFunction)TrackObj_NewTrackMedia, 1,
+ PyDoc_STR("(OSType mediaType, TimeScale timeScale, Handle dataRef, OSType dataRefType) -> (Media _rv)")},
+ {"GetTrackMedia", (PyCFunction)TrackObj_GetTrackMedia, 1,
+ PyDoc_STR("() -> (Media _rv)")},
+ {"InsertMediaIntoTrack", (PyCFunction)TrackObj_InsertMediaIntoTrack, 1,
+ PyDoc_STR("(TimeValue trackStart, TimeValue mediaTime, TimeValue mediaDuration, Fixed mediaRate) -> None")},
+ {"InsertTrackSegment", (PyCFunction)TrackObj_InsertTrackSegment, 1,
+ PyDoc_STR("(Track dstTrack, TimeValue srcIn, TimeValue srcDuration, TimeValue dstIn) -> None")},
+ {"InsertEmptyTrackSegment", (PyCFunction)TrackObj_InsertEmptyTrackSegment, 1,
+ PyDoc_STR("(TimeValue dstIn, TimeValue dstDuration) -> None")},
+ {"DeleteTrackSegment", (PyCFunction)TrackObj_DeleteTrackSegment, 1,
+ PyDoc_STR("(TimeValue startTime, TimeValue duration) -> None")},
+ {"ScaleTrackSegment", (PyCFunction)TrackObj_ScaleTrackSegment, 1,
+ PyDoc_STR("(TimeValue startTime, TimeValue oldDuration, TimeValue newDuration) -> None")},
+ {"IsScrapMovie", (PyCFunction)TrackObj_IsScrapMovie, 1,
+ PyDoc_STR("() -> (Component _rv)")},
+ {"CopyTrackSettings", (PyCFunction)TrackObj_CopyTrackSettings, 1,
+ PyDoc_STR("(Track dstTrack) -> None")},
+ {"AddEmptyTrackToMovie", (PyCFunction)TrackObj_AddEmptyTrackToMovie, 1,
+ PyDoc_STR("(Movie dstMovie, Handle dataRef, OSType dataRefType) -> (Track dstTrack)")},
+ {"AddClonedTrackToMovie", (PyCFunction)TrackObj_AddClonedTrackToMovie, 1,
+ PyDoc_STR("(Movie dstMovie, long flags) -> (Track dstTrack)")},
+ {"AddTrackReference", (PyCFunction)TrackObj_AddTrackReference, 1,
+ PyDoc_STR("(Track refTrack, OSType refType) -> (long addedIndex)")},
+ {"DeleteTrackReference", (PyCFunction)TrackObj_DeleteTrackReference, 1,
+ PyDoc_STR("(OSType refType, long index) -> None")},
+ {"SetTrackReference", (PyCFunction)TrackObj_SetTrackReference, 1,
+ PyDoc_STR("(Track refTrack, OSType refType, long index) -> None")},
+ {"GetTrackReference", (PyCFunction)TrackObj_GetTrackReference, 1,
+ PyDoc_STR("(OSType refType, long index) -> (Track _rv)")},
+ {"GetNextTrackReferenceType", (PyCFunction)TrackObj_GetNextTrackReferenceType, 1,
+ PyDoc_STR("(OSType refType) -> (OSType _rv)")},
+ {"GetTrackReferenceCount", (PyCFunction)TrackObj_GetTrackReferenceCount, 1,
+ PyDoc_STR("(OSType refType) -> (long _rv)")},
+ {"GetTrackEditRate", (PyCFunction)TrackObj_GetTrackEditRate, 1,
+ PyDoc_STR("(TimeValue atTime) -> (Fixed _rv)")},
+ {"GetTrackDataSize", (PyCFunction)TrackObj_GetTrackDataSize, 1,
+ PyDoc_STR("(TimeValue startTime, TimeValue duration) -> (long _rv)")},
+ {"GetTrackDataSize64", (PyCFunction)TrackObj_GetTrackDataSize64, 1,
+ PyDoc_STR("(TimeValue startTime, TimeValue duration) -> (wide dataSize)")},
+ {"PtInTrack", (PyCFunction)TrackObj_PtInTrack, 1,
+ PyDoc_STR("(Point pt) -> (Boolean _rv)")},
+ {"CopyTrackUserData", (PyCFunction)TrackObj_CopyTrackUserData, 1,
+ PyDoc_STR("(Track dstTrack, OSType copyRule) -> None")},
+ {"GetTrackNextInterestingTime", (PyCFunction)TrackObj_GetTrackNextInterestingTime, 1,
+ PyDoc_STR("(short interestingTimeFlags, TimeValue time, Fixed rate) -> (TimeValue interestingTime, TimeValue interestingDuration)")},
+ {"GetTrackSegmentDisplayBoundsRgn", (PyCFunction)TrackObj_GetTrackSegmentDisplayBoundsRgn, 1,
+ PyDoc_STR("(TimeValue time, TimeValue duration) -> (RgnHandle _rv)")},
+ {"GetTrackStatus", (PyCFunction)TrackObj_GetTrackStatus, 1,
+ PyDoc_STR("() -> (ComponentResult _rv)")},
+ {"SetTrackLoadSettings", (PyCFunction)TrackObj_SetTrackLoadSettings, 1,
+ PyDoc_STR("(TimeValue preloadTime, TimeValue preloadDuration, long preloadFlags, long defaultHints) -> None")},
+ {"GetTrackLoadSettings", (PyCFunction)TrackObj_GetTrackLoadSettings, 1,
+ PyDoc_STR("() -> (TimeValue preloadTime, TimeValue preloadDuration, long preloadFlags, long defaultHints)")},
+ {NULL, NULL, 0}
+};
+
+#define TrackObj_getsetlist NULL
+
+
+#define TrackObj_compare NULL
+
+#define TrackObj_repr NULL
+
+#define TrackObj_hash NULL
+#define TrackObj_tp_init 0
+
+#define TrackObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *TrackObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *_self;
+ Track itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, TrackObj_Convert, &itself)) return NULL;
+ if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((TrackObject *)_self)->ob_itself = itself;
+ return _self;
+}
+
+#define TrackObj_tp_free PyObject_Del
+
+
+PyTypeObject Track_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_Qt.Track", /*tp_name*/
+ sizeof(TrackObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) TrackObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) TrackObj_compare, /*tp_compare*/
+ (reprfunc) TrackObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) TrackObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ TrackObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ TrackObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ TrackObj_tp_init, /* tp_init */
+ TrackObj_tp_alloc, /* tp_alloc */
+ TrackObj_tp_new, /* tp_new */
+ TrackObj_tp_free, /* tp_free */
+};
+
+/* --------------------- End object type Track ---------------------- */
+
+
+/* ----------------------- Object type Movie ------------------------ */
+
+PyTypeObject Movie_Type;
+
+#define MovieObj_Check(x) ((x)->ob_type == &Movie_Type || PyObject_TypeCheck((x), &Movie_Type))
+
+typedef struct MovieObject {
+ PyObject_HEAD
+ Movie ob_itself;
+} MovieObject;
+
+PyObject *MovieObj_New(Movie itself)
+{
+ MovieObject *it;
+ if (itself == NULL) {
+ PyErr_SetString(Qt_Error,"Cannot create Movie from NULL pointer");
+ return NULL;
+ }
+ it = PyObject_NEW(MovieObject, &Movie_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+
+int MovieObj_Convert(PyObject *v, Movie *p_itself)
+{
+ if (v == Py_None)
+ {
+ *p_itself = NULL;
+ return 1;
+ }
+ if (!MovieObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "Movie required");
+ return 0;
+ }
+ *p_itself = ((MovieObject *)v)->ob_itself;
+ return 1;
+}
+
+static void MovieObj_dealloc(MovieObject *self)
+{
+ if (self->ob_itself) DisposeMovie(self->ob_itself);
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *MovieObj_MoviesTask(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long maxMilliSecToUse;
+#ifndef MoviesTask
+ PyMac_PRECHECK(MoviesTask);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &maxMilliSecToUse))
+ return NULL;
+ MoviesTask(_self->ob_itself,
+ maxMilliSecToUse);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_PrerollMovie(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ TimeValue time;
+ Fixed Rate;
+#ifndef PrerollMovie
+ PyMac_PRECHECK(PrerollMovie);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&",
+ &time,
+ PyMac_GetFixed, &Rate))
+ return NULL;
+ _err = PrerollMovie(_self->ob_itself,
+ time,
+ Rate);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_AbortPrePrerollMovie(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr err;
+#ifndef AbortPrePrerollMovie
+ PyMac_PRECHECK(AbortPrePrerollMovie);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &err))
+ return NULL;
+ AbortPrePrerollMovie(_self->ob_itself,
+ err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_LoadMovieIntoRam(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ TimeValue time;
+ TimeValue duration;
+ long flags;
+#ifndef LoadMovieIntoRam
+ PyMac_PRECHECK(LoadMovieIntoRam);
+#endif
+ if (!PyArg_ParseTuple(_args, "lll",
+ &time,
+ &duration,
+ &flags))
+ return NULL;
+ _err = LoadMovieIntoRam(_self->ob_itself,
+ time,
+ duration,
+ flags);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_SetMovieActive(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean active;
+#ifndef SetMovieActive
+ PyMac_PRECHECK(SetMovieActive);
+#endif
+ if (!PyArg_ParseTuple(_args, "b",
+ &active))
+ return NULL;
+ SetMovieActive(_self->ob_itself,
+ active);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieActive(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef GetMovieActive
+ PyMac_PRECHECK(GetMovieActive);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMovieActive(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_StartMovie(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef StartMovie
+ PyMac_PRECHECK(StartMovie);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ StartMovie(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_StopMovie(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef StopMovie
+ PyMac_PRECHECK(StopMovie);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ StopMovie(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GoToBeginningOfMovie(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef GoToBeginningOfMovie
+ PyMac_PRECHECK(GoToBeginningOfMovie);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GoToBeginningOfMovie(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GoToEndOfMovie(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef GoToEndOfMovie
+ PyMac_PRECHECK(GoToEndOfMovie);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GoToEndOfMovie(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_IsMovieDone(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef IsMovieDone
+ PyMac_PRECHECK(IsMovieDone);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsMovieDone(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_GetMoviePreviewMode(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef GetMoviePreviewMode
+ PyMac_PRECHECK(GetMoviePreviewMode);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMoviePreviewMode(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_SetMoviePreviewMode(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean usePreview;
+#ifndef SetMoviePreviewMode
+ PyMac_PRECHECK(SetMoviePreviewMode);
+#endif
+ if (!PyArg_ParseTuple(_args, "b",
+ &usePreview))
+ return NULL;
+ SetMoviePreviewMode(_self->ob_itself,
+ usePreview);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_ShowMoviePoster(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef ShowMoviePoster
+ PyMac_PRECHECK(ShowMoviePoster);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ShowMoviePoster(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieTimeBase(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeBase _rv;
+#ifndef GetMovieTimeBase
+ PyMac_PRECHECK(GetMovieTimeBase);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMovieTimeBase(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ TimeBaseObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_SetMovieMasterTimeBase(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeBase tb;
+ TimeRecord slaveZero;
+#ifndef SetMovieMasterTimeBase
+ PyMac_PRECHECK(SetMovieMasterTimeBase);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ TimeBaseObj_Convert, &tb,
+ QtTimeRecord_Convert, &slaveZero))
+ return NULL;
+ SetMovieMasterTimeBase(_self->ob_itself,
+ tb,
+ &slaveZero);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_SetMovieMasterClock(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Component clockMeister;
+ TimeRecord slaveZero;
+#ifndef SetMovieMasterClock
+ PyMac_PRECHECK(SetMovieMasterClock);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpObj_Convert, &clockMeister,
+ QtTimeRecord_Convert, &slaveZero))
+ return NULL;
+ SetMovieMasterClock(_self->ob_itself,
+ clockMeister,
+ &slaveZero);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_ChooseMovieClock(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long flags;
+#ifndef ChooseMovieClock
+ PyMac_PRECHECK(ChooseMovieClock);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &flags))
+ return NULL;
+ ChooseMovieClock(_self->ob_itself,
+ flags);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieGWorld(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr port;
+ GDHandle gdh;
+#ifndef GetMovieGWorld
+ PyMac_PRECHECK(GetMovieGWorld);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetMovieGWorld(_self->ob_itself,
+ &port,
+ &gdh);
+ _res = Py_BuildValue("O&O&",
+ GrafObj_New, port,
+ OptResObj_New, gdh);
+ return _res;
+}
+
+static PyObject *MovieObj_SetMovieGWorld(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr port;
+ GDHandle gdh;
+#ifndef SetMovieGWorld
+ PyMac_PRECHECK(SetMovieGWorld);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ GrafObj_Convert, &port,
+ OptResObj_Convert, &gdh))
+ return NULL;
+ SetMovieGWorld(_self->ob_itself,
+ port,
+ gdh);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieNaturalBoundsRect(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect naturalBounds;
+#ifndef GetMovieNaturalBoundsRect
+ PyMac_PRECHECK(GetMovieNaturalBoundsRect);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetMovieNaturalBoundsRect(_self->ob_itself,
+ &naturalBounds);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &naturalBounds);
+ return _res;
+}
+
+static PyObject *MovieObj_GetNextTrackForCompositing(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Track _rv;
+ Track theTrack;
+#ifndef GetNextTrackForCompositing
+ PyMac_PRECHECK(GetNextTrackForCompositing);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ TrackObj_Convert, &theTrack))
+ return NULL;
+ _rv = GetNextTrackForCompositing(_self->ob_itself,
+ theTrack);
+ _res = Py_BuildValue("O&",
+ TrackObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_GetPrevTrackForCompositing(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Track _rv;
+ Track theTrack;
+#ifndef GetPrevTrackForCompositing
+ PyMac_PRECHECK(GetPrevTrackForCompositing);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ TrackObj_Convert, &theTrack))
+ return NULL;
+ _rv = GetPrevTrackForCompositing(_self->ob_itself,
+ theTrack);
+ _res = Py_BuildValue("O&",
+ TrackObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_GetMoviePict(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PicHandle _rv;
+ TimeValue time;
+#ifndef GetMoviePict
+ PyMac_PRECHECK(GetMoviePict);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &time))
+ return NULL;
+ _rv = GetMoviePict(_self->ob_itself,
+ time);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_GetMoviePosterPict(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PicHandle _rv;
+#ifndef GetMoviePosterPict
+ PyMac_PRECHECK(GetMoviePosterPict);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMoviePosterPict(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_UpdateMovie(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+#ifndef UpdateMovie
+ PyMac_PRECHECK(UpdateMovie);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = UpdateMovie(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_InvalidateMovieRegion(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ RgnHandle invalidRgn;
+#ifndef InvalidateMovieRegion
+ PyMac_PRECHECK(InvalidateMovieRegion);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &invalidRgn))
+ return NULL;
+ _err = InvalidateMovieRegion(_self->ob_itself,
+ invalidRgn);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieBox(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect boxRect;
+#ifndef GetMovieBox
+ PyMac_PRECHECK(GetMovieBox);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetMovieBox(_self->ob_itself,
+ &boxRect);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &boxRect);
+ return _res;
+}
+
+static PyObject *MovieObj_SetMovieBox(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect boxRect;
+#ifndef SetMovieBox
+ PyMac_PRECHECK(SetMovieBox);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &boxRect))
+ return NULL;
+ SetMovieBox(_self->ob_itself,
+ &boxRect);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieDisplayClipRgn(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle _rv;
+#ifndef GetMovieDisplayClipRgn
+ PyMac_PRECHECK(GetMovieDisplayClipRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMovieDisplayClipRgn(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_SetMovieDisplayClipRgn(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle theClip;
+#ifndef SetMovieDisplayClipRgn
+ PyMac_PRECHECK(SetMovieDisplayClipRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &theClip))
+ return NULL;
+ SetMovieDisplayClipRgn(_self->ob_itself,
+ theClip);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieClipRgn(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle _rv;
+#ifndef GetMovieClipRgn
+ PyMac_PRECHECK(GetMovieClipRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMovieClipRgn(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_SetMovieClipRgn(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle theClip;
+#ifndef SetMovieClipRgn
+ PyMac_PRECHECK(SetMovieClipRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &theClip))
+ return NULL;
+ SetMovieClipRgn(_self->ob_itself,
+ theClip);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieDisplayBoundsRgn(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle _rv;
+#ifndef GetMovieDisplayBoundsRgn
+ PyMac_PRECHECK(GetMovieDisplayBoundsRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMovieDisplayBoundsRgn(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieBoundsRgn(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle _rv;
+#ifndef GetMovieBoundsRgn
+ PyMac_PRECHECK(GetMovieBoundsRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMovieBoundsRgn(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_SetMovieVideoOutput(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentInstance vout;
+#ifndef SetMovieVideoOutput
+ PyMac_PRECHECK(SetMovieVideoOutput);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &vout))
+ return NULL;
+ SetMovieVideoOutput(_self->ob_itself,
+ vout);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_PutMovieIntoHandle(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle publicMovie;
+#ifndef PutMovieIntoHandle
+ PyMac_PRECHECK(PutMovieIntoHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &publicMovie))
+ return NULL;
+ _err = PutMovieIntoHandle(_self->ob_itself,
+ publicMovie);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_PutMovieIntoDataFork(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short fRefNum;
+ long offset;
+ long maxSize;
+#ifndef PutMovieIntoDataFork
+ PyMac_PRECHECK(PutMovieIntoDataFork);
+#endif
+ if (!PyArg_ParseTuple(_args, "hll",
+ &fRefNum,
+ &offset,
+ &maxSize))
+ return NULL;
+ _err = PutMovieIntoDataFork(_self->ob_itself,
+ fRefNum,
+ offset,
+ maxSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_PutMovieIntoDataFork64(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long fRefNum;
+ wide offset;
+ unsigned long maxSize;
+#ifndef PutMovieIntoDataFork64
+ PyMac_PRECHECK(PutMovieIntoDataFork64);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&l",
+ &fRefNum,
+ PyMac_Getwide, &offset,
+ &maxSize))
+ return NULL;
+ _err = PutMovieIntoDataFork64(_self->ob_itself,
+ fRefNum,
+ &offset,
+ maxSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_PutMovieIntoStorage(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ DataHandler dh;
+ wide offset;
+ unsigned long maxSize;
+#ifndef PutMovieIntoStorage
+ PyMac_PRECHECK(PutMovieIntoStorage);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&l",
+ CmpInstObj_Convert, &dh,
+ PyMac_Getwide, &offset,
+ &maxSize))
+ return NULL;
+ _err = PutMovieIntoStorage(_self->ob_itself,
+ dh,
+ &offset,
+ maxSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_PutMovieForDataRefIntoHandle(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle dataRef;
+ OSType dataRefType;
+ Handle publicMovie;
+#ifndef PutMovieForDataRefIntoHandle
+ PyMac_PRECHECK(PutMovieForDataRefIntoHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ ResObj_Convert, &dataRef,
+ PyMac_GetOSType, &dataRefType,
+ ResObj_Convert, &publicMovie))
+ return NULL;
+ _err = PutMovieForDataRefIntoHandle(_self->ob_itself,
+ dataRef,
+ dataRefType,
+ publicMovie);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieCreationTime(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ unsigned long _rv;
+#ifndef GetMovieCreationTime
+ PyMac_PRECHECK(GetMovieCreationTime);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMovieCreationTime(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieModificationTime(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ unsigned long _rv;
+#ifndef GetMovieModificationTime
+ PyMac_PRECHECK(GetMovieModificationTime);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMovieModificationTime(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieTimeScale(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeScale _rv;
+#ifndef GetMovieTimeScale
+ PyMac_PRECHECK(GetMovieTimeScale);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMovieTimeScale(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_SetMovieTimeScale(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeScale timeScale;
+#ifndef SetMovieTimeScale
+ PyMac_PRECHECK(SetMovieTimeScale);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &timeScale))
+ return NULL;
+ SetMovieTimeScale(_self->ob_itself,
+ timeScale);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieDuration(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue _rv;
+#ifndef GetMovieDuration
+ PyMac_PRECHECK(GetMovieDuration);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMovieDuration(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieRate(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Fixed _rv;
+#ifndef GetMovieRate
+ PyMac_PRECHECK(GetMovieRate);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMovieRate(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildFixed, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_SetMovieRate(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Fixed rate;
+#ifndef SetMovieRate
+ PyMac_PRECHECK(SetMovieRate);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetFixed, &rate))
+ return NULL;
+ SetMovieRate(_self->ob_itself,
+ rate);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMoviePreferredRate(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Fixed _rv;
+#ifndef GetMoviePreferredRate
+ PyMac_PRECHECK(GetMoviePreferredRate);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMoviePreferredRate(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildFixed, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_SetMoviePreferredRate(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Fixed rate;
+#ifndef SetMoviePreferredRate
+ PyMac_PRECHECK(SetMoviePreferredRate);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetFixed, &rate))
+ return NULL;
+ SetMoviePreferredRate(_self->ob_itself,
+ rate);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMoviePreferredVolume(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+#ifndef GetMoviePreferredVolume
+ PyMac_PRECHECK(GetMoviePreferredVolume);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMoviePreferredVolume(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_SetMoviePreferredVolume(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short volume;
+#ifndef SetMoviePreferredVolume
+ PyMac_PRECHECK(SetMoviePreferredVolume);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &volume))
+ return NULL;
+ SetMoviePreferredVolume(_self->ob_itself,
+ volume);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieVolume(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+#ifndef GetMovieVolume
+ PyMac_PRECHECK(GetMovieVolume);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMovieVolume(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_SetMovieVolume(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short volume;
+#ifndef SetMovieVolume
+ PyMac_PRECHECK(SetMovieVolume);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &volume))
+ return NULL;
+ SetMovieVolume(_self->ob_itself,
+ volume);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMoviePreviewTime(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue previewTime;
+ TimeValue previewDuration;
+#ifndef GetMoviePreviewTime
+ PyMac_PRECHECK(GetMoviePreviewTime);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetMoviePreviewTime(_self->ob_itself,
+ &previewTime,
+ &previewDuration);
+ _res = Py_BuildValue("ll",
+ previewTime,
+ previewDuration);
+ return _res;
+}
+
+static PyObject *MovieObj_SetMoviePreviewTime(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue previewTime;
+ TimeValue previewDuration;
+#ifndef SetMoviePreviewTime
+ PyMac_PRECHECK(SetMoviePreviewTime);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &previewTime,
+ &previewDuration))
+ return NULL;
+ SetMoviePreviewTime(_self->ob_itself,
+ previewTime,
+ previewDuration);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMoviePosterTime(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue _rv;
+#ifndef GetMoviePosterTime
+ PyMac_PRECHECK(GetMoviePosterTime);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMoviePosterTime(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_SetMoviePosterTime(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue posterTime;
+#ifndef SetMoviePosterTime
+ PyMac_PRECHECK(SetMoviePosterTime);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &posterTime))
+ return NULL;
+ SetMoviePosterTime(_self->ob_itself,
+ posterTime);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieSelection(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue selectionTime;
+ TimeValue selectionDuration;
+#ifndef GetMovieSelection
+ PyMac_PRECHECK(GetMovieSelection);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetMovieSelection(_self->ob_itself,
+ &selectionTime,
+ &selectionDuration);
+ _res = Py_BuildValue("ll",
+ selectionTime,
+ selectionDuration);
+ return _res;
+}
+
+static PyObject *MovieObj_SetMovieSelection(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue selectionTime;
+ TimeValue selectionDuration;
+#ifndef SetMovieSelection
+ PyMac_PRECHECK(SetMovieSelection);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &selectionTime,
+ &selectionDuration))
+ return NULL;
+ SetMovieSelection(_self->ob_itself,
+ selectionTime,
+ selectionDuration);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_SetMovieActiveSegment(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue startTime;
+ TimeValue duration;
+#ifndef SetMovieActiveSegment
+ PyMac_PRECHECK(SetMovieActiveSegment);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &startTime,
+ &duration))
+ return NULL;
+ SetMovieActiveSegment(_self->ob_itself,
+ startTime,
+ duration);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieActiveSegment(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue startTime;
+ TimeValue duration;
+#ifndef GetMovieActiveSegment
+ PyMac_PRECHECK(GetMovieActiveSegment);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetMovieActiveSegment(_self->ob_itself,
+ &startTime,
+ &duration);
+ _res = Py_BuildValue("ll",
+ startTime,
+ duration);
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieTime(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue _rv;
+ TimeRecord currentTime;
+#ifndef GetMovieTime
+ PyMac_PRECHECK(GetMovieTime);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMovieTime(_self->ob_itself,
+ &currentTime);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ QtTimeRecord_New, &currentTime);
+ return _res;
+}
+
+static PyObject *MovieObj_SetMovieTime(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeRecord newtime;
+#ifndef SetMovieTime
+ PyMac_PRECHECK(SetMovieTime);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ QtTimeRecord_Convert, &newtime))
+ return NULL;
+ SetMovieTime(_self->ob_itself,
+ &newtime);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_SetMovieTimeValue(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue newtime;
+#ifndef SetMovieTimeValue
+ PyMac_PRECHECK(SetMovieTimeValue);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &newtime))
+ return NULL;
+ SetMovieTimeValue(_self->ob_itself,
+ newtime);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieUserData(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UserData _rv;
+#ifndef GetMovieUserData
+ PyMac_PRECHECK(GetMovieUserData);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMovieUserData(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ UserDataObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieTrackCount(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+#ifndef GetMovieTrackCount
+ PyMac_PRECHECK(GetMovieTrackCount);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMovieTrackCount(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieTrack(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Track _rv;
+ long trackID;
+#ifndef GetMovieTrack
+ PyMac_PRECHECK(GetMovieTrack);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &trackID))
+ return NULL;
+ _rv = GetMovieTrack(_self->ob_itself,
+ trackID);
+ _res = Py_BuildValue("O&",
+ TrackObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieIndTrack(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Track _rv;
+ long index;
+#ifndef GetMovieIndTrack
+ PyMac_PRECHECK(GetMovieIndTrack);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &index))
+ return NULL;
+ _rv = GetMovieIndTrack(_self->ob_itself,
+ index);
+ _res = Py_BuildValue("O&",
+ TrackObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieIndTrackType(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Track _rv;
+ long index;
+ OSType trackType;
+ long flags;
+#ifndef GetMovieIndTrackType
+ PyMac_PRECHECK(GetMovieIndTrackType);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&l",
+ &index,
+ PyMac_GetOSType, &trackType,
+ &flags))
+ return NULL;
+ _rv = GetMovieIndTrackType(_self->ob_itself,
+ index,
+ trackType,
+ flags);
+ _res = Py_BuildValue("O&",
+ TrackObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_NewMovieTrack(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Track _rv;
+ Fixed width;
+ Fixed height;
+ short trackVolume;
+#ifndef NewMovieTrack
+ PyMac_PRECHECK(NewMovieTrack);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&h",
+ PyMac_GetFixed, &width,
+ PyMac_GetFixed, &height,
+ &trackVolume))
+ return NULL;
+ _rv = NewMovieTrack(_self->ob_itself,
+ width,
+ height,
+ trackVolume);
+ _res = Py_BuildValue("O&",
+ TrackObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_SetAutoTrackAlternatesEnabled(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean enable;
+#ifndef SetAutoTrackAlternatesEnabled
+ PyMac_PRECHECK(SetAutoTrackAlternatesEnabled);
+#endif
+ if (!PyArg_ParseTuple(_args, "b",
+ &enable))
+ return NULL;
+ SetAutoTrackAlternatesEnabled(_self->ob_itself,
+ enable);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_SelectMovieAlternates(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef SelectMovieAlternates
+ PyMac_PRECHECK(SelectMovieAlternates);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ SelectMovieAlternates(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_InsertMovieSegment(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Movie dstMovie;
+ TimeValue srcIn;
+ TimeValue srcDuration;
+ TimeValue dstIn;
+#ifndef InsertMovieSegment
+ PyMac_PRECHECK(InsertMovieSegment);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lll",
+ MovieObj_Convert, &dstMovie,
+ &srcIn,
+ &srcDuration,
+ &dstIn))
+ return NULL;
+ _err = InsertMovieSegment(_self->ob_itself,
+ dstMovie,
+ srcIn,
+ srcDuration,
+ dstIn);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_InsertEmptyMovieSegment(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ TimeValue dstIn;
+ TimeValue dstDuration;
+#ifndef InsertEmptyMovieSegment
+ PyMac_PRECHECK(InsertEmptyMovieSegment);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &dstIn,
+ &dstDuration))
+ return NULL;
+ _err = InsertEmptyMovieSegment(_self->ob_itself,
+ dstIn,
+ dstDuration);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_DeleteMovieSegment(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ TimeValue startTime;
+ TimeValue duration;
+#ifndef DeleteMovieSegment
+ PyMac_PRECHECK(DeleteMovieSegment);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &startTime,
+ &duration))
+ return NULL;
+ _err = DeleteMovieSegment(_self->ob_itself,
+ startTime,
+ duration);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_ScaleMovieSegment(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ TimeValue startTime;
+ TimeValue oldDuration;
+ TimeValue newDuration;
+#ifndef ScaleMovieSegment
+ PyMac_PRECHECK(ScaleMovieSegment);
+#endif
+ if (!PyArg_ParseTuple(_args, "lll",
+ &startTime,
+ &oldDuration,
+ &newDuration))
+ return NULL;
+ _err = ScaleMovieSegment(_self->ob_itself,
+ startTime,
+ oldDuration,
+ newDuration);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_CutMovieSelection(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Movie _rv;
+#ifndef CutMovieSelection
+ PyMac_PRECHECK(CutMovieSelection);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CutMovieSelection(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ MovieObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_CopyMovieSelection(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Movie _rv;
+#ifndef CopyMovieSelection
+ PyMac_PRECHECK(CopyMovieSelection);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CopyMovieSelection(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ MovieObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_PasteMovieSelection(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Movie src;
+#ifndef PasteMovieSelection
+ PyMac_PRECHECK(PasteMovieSelection);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ MovieObj_Convert, &src))
+ return NULL;
+ PasteMovieSelection(_self->ob_itself,
+ src);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_AddMovieSelection(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Movie src;
+#ifndef AddMovieSelection
+ PyMac_PRECHECK(AddMovieSelection);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ MovieObj_Convert, &src))
+ return NULL;
+ AddMovieSelection(_self->ob_itself,
+ src);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_ClearMovieSelection(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef ClearMovieSelection
+ PyMac_PRECHECK(ClearMovieSelection);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ClearMovieSelection(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_PutMovieIntoTypedHandle(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Track targetTrack;
+ OSType handleType;
+ Handle publicMovie;
+ TimeValue start;
+ TimeValue dur;
+ long flags;
+ ComponentInstance userComp;
+#ifndef PutMovieIntoTypedHandle
+ PyMac_PRECHECK(PutMovieIntoTypedHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&lllO&",
+ TrackObj_Convert, &targetTrack,
+ PyMac_GetOSType, &handleType,
+ ResObj_Convert, &publicMovie,
+ &start,
+ &dur,
+ &flags,
+ CmpInstObj_Convert, &userComp))
+ return NULL;
+ _err = PutMovieIntoTypedHandle(_self->ob_itself,
+ targetTrack,
+ handleType,
+ publicMovie,
+ start,
+ dur,
+ flags,
+ userComp);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_CopyMovieSettings(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Movie dstMovie;
+#ifndef CopyMovieSettings
+ PyMac_PRECHECK(CopyMovieSettings);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ MovieObj_Convert, &dstMovie))
+ return NULL;
+ _err = CopyMovieSettings(_self->ob_itself,
+ dstMovie);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_ConvertMovieToFile(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Track onlyTrack;
+ FSSpec outputFile;
+ OSType fileType;
+ OSType creator;
+ ScriptCode scriptTag;
+ short resID;
+ long flags;
+ ComponentInstance userComp;
+#ifndef ConvertMovieToFile
+ PyMac_PRECHECK(ConvertMovieToFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&hlO&",
+ TrackObj_Convert, &onlyTrack,
+ PyMac_GetFSSpec, &outputFile,
+ PyMac_GetOSType, &fileType,
+ PyMac_GetOSType, &creator,
+ &scriptTag,
+ &flags,
+ CmpInstObj_Convert, &userComp))
+ return NULL;
+ _err = ConvertMovieToFile(_self->ob_itself,
+ onlyTrack,
+ &outputFile,
+ fileType,
+ creator,
+ scriptTag,
+ &resID,
+ flags,
+ userComp);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ resID);
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieDataSize(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ TimeValue startTime;
+ TimeValue duration;
+#ifndef GetMovieDataSize
+ PyMac_PRECHECK(GetMovieDataSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &startTime,
+ &duration))
+ return NULL;
+ _rv = GetMovieDataSize(_self->ob_itself,
+ startTime,
+ duration);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieDataSize64(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ TimeValue startTime;
+ TimeValue duration;
+ wide dataSize;
+#ifndef GetMovieDataSize64
+ PyMac_PRECHECK(GetMovieDataSize64);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &startTime,
+ &duration))
+ return NULL;
+ _err = GetMovieDataSize64(_self->ob_itself,
+ startTime,
+ duration,
+ &dataSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_Buildwide, dataSize);
+ return _res;
+}
+
+static PyObject *MovieObj_PtInMovie(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Point pt;
+#ifndef PtInMovie
+ PyMac_PRECHECK(PtInMovie);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &pt))
+ return NULL;
+ _rv = PtInMovie(_self->ob_itself,
+ pt);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_SetMovieLanguage(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long language;
+#ifndef SetMovieLanguage
+ PyMac_PRECHECK(SetMovieLanguage);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &language))
+ return NULL;
+ SetMovieLanguage(_self->ob_itself,
+ language);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_CopyMovieUserData(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Movie dstMovie;
+ OSType copyRule;
+#ifndef CopyMovieUserData
+ PyMac_PRECHECK(CopyMovieUserData);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ MovieObj_Convert, &dstMovie,
+ PyMac_GetOSType, &copyRule))
+ return NULL;
+ _err = CopyMovieUserData(_self->ob_itself,
+ dstMovie,
+ copyRule);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieNextInterestingTime(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short interestingTimeFlags;
+ short numMediaTypes;
+ OSType whichMediaTypes;
+ TimeValue time;
+ Fixed rate;
+ TimeValue interestingTime;
+ TimeValue interestingDuration;
+#ifndef GetMovieNextInterestingTime
+ PyMac_PRECHECK(GetMovieNextInterestingTime);
+#endif
+ if (!PyArg_ParseTuple(_args, "hhO&lO&",
+ &interestingTimeFlags,
+ &numMediaTypes,
+ PyMac_GetOSType, &whichMediaTypes,
+ &time,
+ PyMac_GetFixed, &rate))
+ return NULL;
+ GetMovieNextInterestingTime(_self->ob_itself,
+ interestingTimeFlags,
+ numMediaTypes,
+ &whichMediaTypes,
+ time,
+ rate,
+ &interestingTime,
+ &interestingDuration);
+ _res = Py_BuildValue("ll",
+ interestingTime,
+ interestingDuration);
+ return _res;
+}
+
+static PyObject *MovieObj_AddMovieResource(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short resRefNum;
+ short resId;
+ Str255 resName;
+#ifndef AddMovieResource
+ PyMac_PRECHECK(AddMovieResource);
+#endif
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &resRefNum,
+ PyMac_GetStr255, resName))
+ return NULL;
+ _err = AddMovieResource(_self->ob_itself,
+ resRefNum,
+ &resId,
+ resName);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ resId);
+ return _res;
+}
+
+static PyObject *MovieObj_UpdateMovieResource(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short resRefNum;
+ short resId;
+ Str255 resName;
+#ifndef UpdateMovieResource
+ PyMac_PRECHECK(UpdateMovieResource);
+#endif
+ if (!PyArg_ParseTuple(_args, "hhO&",
+ &resRefNum,
+ &resId,
+ PyMac_GetStr255, resName))
+ return NULL;
+ _err = UpdateMovieResource(_self->ob_itself,
+ resRefNum,
+ resId,
+ resName);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_AddMovieToStorage(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ DataHandler dh;
+#ifndef AddMovieToStorage
+ PyMac_PRECHECK(AddMovieToStorage);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &dh))
+ return NULL;
+ _err = AddMovieToStorage(_self->ob_itself,
+ dh);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_UpdateMovieInStorage(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ DataHandler dh;
+#ifndef UpdateMovieInStorage
+ PyMac_PRECHECK(UpdateMovieInStorage);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &dh))
+ return NULL;
+ _err = UpdateMovieInStorage(_self->ob_itself,
+ dh);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_HasMovieChanged(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef HasMovieChanged
+ PyMac_PRECHECK(HasMovieChanged);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = HasMovieChanged(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_ClearMovieChanged(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef ClearMovieChanged
+ PyMac_PRECHECK(ClearMovieChanged);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ClearMovieChanged(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_SetMovieDefaultDataRef(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle dataRef;
+ OSType dataRefType;
+#ifndef SetMovieDefaultDataRef
+ PyMac_PRECHECK(SetMovieDefaultDataRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &dataRef,
+ PyMac_GetOSType, &dataRefType))
+ return NULL;
+ _err = SetMovieDefaultDataRef(_self->ob_itself,
+ dataRef,
+ dataRefType);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieDefaultDataRef(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle dataRef;
+ OSType dataRefType;
+#ifndef GetMovieDefaultDataRef
+ PyMac_PRECHECK(GetMovieDefaultDataRef);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetMovieDefaultDataRef(_self->ob_itself,
+ &dataRef,
+ &dataRefType);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&O&",
+ ResObj_New, dataRef,
+ PyMac_BuildOSType, dataRefType);
+ return _res;
+}
+
+static PyObject *MovieObj_SetMovieColorTable(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ CTabHandle ctab;
+#ifndef SetMovieColorTable
+ PyMac_PRECHECK(SetMovieColorTable);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &ctab))
+ return NULL;
+ _err = SetMovieColorTable(_self->ob_itself,
+ ctab);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieColorTable(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ CTabHandle ctab;
+#ifndef GetMovieColorTable
+ PyMac_PRECHECK(GetMovieColorTable);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetMovieColorTable(_self->ob_itself,
+ &ctab);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, ctab);
+ return _res;
+}
+
+static PyObject *MovieObj_FlattenMovie(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long movieFlattenFlags;
+ FSSpec theFile;
+ OSType creator;
+ ScriptCode scriptTag;
+ long createMovieFileFlags;
+ short resId;
+ Str255 resName;
+#ifndef FlattenMovie
+ PyMac_PRECHECK(FlattenMovie);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&O&hlO&",
+ &movieFlattenFlags,
+ PyMac_GetFSSpec, &theFile,
+ PyMac_GetOSType, &creator,
+ &scriptTag,
+ &createMovieFileFlags,
+ PyMac_GetStr255, resName))
+ return NULL;
+ FlattenMovie(_self->ob_itself,
+ movieFlattenFlags,
+ &theFile,
+ creator,
+ scriptTag,
+ createMovieFileFlags,
+ &resId,
+ resName);
+ _res = Py_BuildValue("h",
+ resId);
+ return _res;
+}
+
+static PyObject *MovieObj_FlattenMovieData(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Movie _rv;
+ long movieFlattenFlags;
+ FSSpec theFile;
+ OSType creator;
+ ScriptCode scriptTag;
+ long createMovieFileFlags;
+#ifndef FlattenMovieData
+ PyMac_PRECHECK(FlattenMovieData);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&O&hl",
+ &movieFlattenFlags,
+ PyMac_GetFSSpec, &theFile,
+ PyMac_GetOSType, &creator,
+ &scriptTag,
+ &createMovieFileFlags))
+ return NULL;
+ _rv = FlattenMovieData(_self->ob_itself,
+ movieFlattenFlags,
+ &theFile,
+ creator,
+ scriptTag,
+ createMovieFileFlags);
+ _res = Py_BuildValue("O&",
+ MovieObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_FlattenMovieDataToDataRef(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Movie _rv;
+ long movieFlattenFlags;
+ Handle dataRef;
+ OSType dataRefType;
+ OSType creator;
+ ScriptCode scriptTag;
+ long createMovieFileFlags;
+#ifndef FlattenMovieDataToDataRef
+ PyMac_PRECHECK(FlattenMovieDataToDataRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&O&O&hl",
+ &movieFlattenFlags,
+ ResObj_Convert, &dataRef,
+ PyMac_GetOSType, &dataRefType,
+ PyMac_GetOSType, &creator,
+ &scriptTag,
+ &createMovieFileFlags))
+ return NULL;
+ _rv = FlattenMovieDataToDataRef(_self->ob_itself,
+ movieFlattenFlags,
+ dataRef,
+ dataRefType,
+ creator,
+ scriptTag,
+ createMovieFileFlags);
+ _res = Py_BuildValue("O&",
+ MovieObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_MovieSearchText(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Ptr text;
+ long size;
+ long searchFlags;
+ Track searchTrack;
+ TimeValue searchTime;
+ long searchOffset;
+#ifndef MovieSearchText
+ PyMac_PRECHECK(MovieSearchText);
+#endif
+ if (!PyArg_ParseTuple(_args, "sll",
+ &text,
+ &size,
+ &searchFlags))
+ return NULL;
+ _err = MovieSearchText(_self->ob_itself,
+ text,
+ size,
+ searchFlags,
+ &searchTrack,
+ &searchTime,
+ &searchOffset);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&ll",
+ TrackObj_New, searchTrack,
+ searchTime,
+ searchOffset);
+ return _res;
+}
+
+static PyObject *MovieObj_GetPosterBox(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect boxRect;
+#ifndef GetPosterBox
+ PyMac_PRECHECK(GetPosterBox);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetPosterBox(_self->ob_itself,
+ &boxRect);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &boxRect);
+ return _res;
+}
+
+static PyObject *MovieObj_SetPosterBox(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect boxRect;
+#ifndef SetPosterBox
+ PyMac_PRECHECK(SetPosterBox);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &boxRect))
+ return NULL;
+ SetPosterBox(_self->ob_itself,
+ &boxRect);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieSegmentDisplayBoundsRgn(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle _rv;
+ TimeValue time;
+ TimeValue duration;
+#ifndef GetMovieSegmentDisplayBoundsRgn
+ PyMac_PRECHECK(GetMovieSegmentDisplayBoundsRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &time,
+ &duration))
+ return NULL;
+ _rv = GetMovieSegmentDisplayBoundsRgn(_self->ob_itself,
+ time,
+ duration);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieStatus(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ Track firstProblemTrack;
+#ifndef GetMovieStatus
+ PyMac_PRECHECK(GetMovieStatus);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMovieStatus(_self->ob_itself,
+ &firstProblemTrack);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ TrackObj_New, firstProblemTrack);
+ return _res;
+}
+
+static PyObject *MovieObj_NewMovieController(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MovieController _rv;
+ Rect movieRect;
+ long someFlags;
+#ifndef NewMovieController
+ PyMac_PRECHECK(NewMovieController);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetRect, &movieRect,
+ &someFlags))
+ return NULL;
+ _rv = NewMovieController(_self->ob_itself,
+ &movieRect,
+ someFlags);
+ _res = Py_BuildValue("O&",
+ MovieCtlObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_PutMovieOnScrap(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long movieScrapFlags;
+#ifndef PutMovieOnScrap
+ PyMac_PRECHECK(PutMovieOnScrap);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &movieScrapFlags))
+ return NULL;
+ _err = PutMovieOnScrap(_self->ob_itself,
+ movieScrapFlags);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_SetMoviePlayHints(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long flags;
+ long flagsMask;
+#ifndef SetMoviePlayHints
+ PyMac_PRECHECK(SetMoviePlayHints);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &flags,
+ &flagsMask))
+ return NULL;
+ SetMoviePlayHints(_self->ob_itself,
+ flags,
+ flagsMask);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMaxLoadedTimeInMovie(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ TimeValue time;
+#ifndef GetMaxLoadedTimeInMovie
+ PyMac_PRECHECK(GetMaxLoadedTimeInMovie);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetMaxLoadedTimeInMovie(_self->ob_itself,
+ &time);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ time);
+ return _res;
+}
+
+static PyObject *MovieObj_QTMovieNeedsTimeTable(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Boolean needsTimeTable;
+#ifndef QTMovieNeedsTimeTable
+ PyMac_PRECHECK(QTMovieNeedsTimeTable);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = QTMovieNeedsTimeTable(_self->ob_itself,
+ &needsTimeTable);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("b",
+ needsTimeTable);
+ return _res;
+}
+
+static PyObject *MovieObj_QTGetDataRefMaxFileOffset(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType dataRefType;
+ Handle dataRef;
+ long offset;
+#ifndef QTGetDataRefMaxFileOffset
+ PyMac_PRECHECK(QTGetDataRefMaxFileOffset);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &dataRefType,
+ ResObj_Convert, &dataRef))
+ return NULL;
+ _err = QTGetDataRefMaxFileOffset(_self->ob_itself,
+ dataRefType,
+ dataRef,
+ &offset);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ offset);
+ return _res;
+}
+
+static PyMethodDef MovieObj_methods[] = {
+ {"MoviesTask", (PyCFunction)MovieObj_MoviesTask, 1,
+ PyDoc_STR("(long maxMilliSecToUse) -> None")},
+ {"PrerollMovie", (PyCFunction)MovieObj_PrerollMovie, 1,
+ PyDoc_STR("(TimeValue time, Fixed Rate) -> None")},
+ {"AbortPrePrerollMovie", (PyCFunction)MovieObj_AbortPrePrerollMovie, 1,
+ PyDoc_STR("(OSErr err) -> None")},
+ {"LoadMovieIntoRam", (PyCFunction)MovieObj_LoadMovieIntoRam, 1,
+ PyDoc_STR("(TimeValue time, TimeValue duration, long flags) -> None")},
+ {"SetMovieActive", (PyCFunction)MovieObj_SetMovieActive, 1,
+ PyDoc_STR("(Boolean active) -> None")},
+ {"GetMovieActive", (PyCFunction)MovieObj_GetMovieActive, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"StartMovie", (PyCFunction)MovieObj_StartMovie, 1,
+ PyDoc_STR("() -> None")},
+ {"StopMovie", (PyCFunction)MovieObj_StopMovie, 1,
+ PyDoc_STR("() -> None")},
+ {"GoToBeginningOfMovie", (PyCFunction)MovieObj_GoToBeginningOfMovie, 1,
+ PyDoc_STR("() -> None")},
+ {"GoToEndOfMovie", (PyCFunction)MovieObj_GoToEndOfMovie, 1,
+ PyDoc_STR("() -> None")},
+ {"IsMovieDone", (PyCFunction)MovieObj_IsMovieDone, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"GetMoviePreviewMode", (PyCFunction)MovieObj_GetMoviePreviewMode, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"SetMoviePreviewMode", (PyCFunction)MovieObj_SetMoviePreviewMode, 1,
+ PyDoc_STR("(Boolean usePreview) -> None")},
+ {"ShowMoviePoster", (PyCFunction)MovieObj_ShowMoviePoster, 1,
+ PyDoc_STR("() -> None")},
+ {"GetMovieTimeBase", (PyCFunction)MovieObj_GetMovieTimeBase, 1,
+ PyDoc_STR("() -> (TimeBase _rv)")},
+ {"SetMovieMasterTimeBase", (PyCFunction)MovieObj_SetMovieMasterTimeBase, 1,
+ PyDoc_STR("(TimeBase tb, TimeRecord slaveZero) -> None")},
+ {"SetMovieMasterClock", (PyCFunction)MovieObj_SetMovieMasterClock, 1,
+ PyDoc_STR("(Component clockMeister, TimeRecord slaveZero) -> None")},
+ {"ChooseMovieClock", (PyCFunction)MovieObj_ChooseMovieClock, 1,
+ PyDoc_STR("(long flags) -> None")},
+ {"GetMovieGWorld", (PyCFunction)MovieObj_GetMovieGWorld, 1,
+ PyDoc_STR("() -> (CGrafPtr port, GDHandle gdh)")},
+ {"SetMovieGWorld", (PyCFunction)MovieObj_SetMovieGWorld, 1,
+ PyDoc_STR("(CGrafPtr port, GDHandle gdh) -> None")},
+ {"GetMovieNaturalBoundsRect", (PyCFunction)MovieObj_GetMovieNaturalBoundsRect, 1,
+ PyDoc_STR("() -> (Rect naturalBounds)")},
+ {"GetNextTrackForCompositing", (PyCFunction)MovieObj_GetNextTrackForCompositing, 1,
+ PyDoc_STR("(Track theTrack) -> (Track _rv)")},
+ {"GetPrevTrackForCompositing", (PyCFunction)MovieObj_GetPrevTrackForCompositing, 1,
+ PyDoc_STR("(Track theTrack) -> (Track _rv)")},
+ {"GetMoviePict", (PyCFunction)MovieObj_GetMoviePict, 1,
+ PyDoc_STR("(TimeValue time) -> (PicHandle _rv)")},
+ {"GetMoviePosterPict", (PyCFunction)MovieObj_GetMoviePosterPict, 1,
+ PyDoc_STR("() -> (PicHandle _rv)")},
+ {"UpdateMovie", (PyCFunction)MovieObj_UpdateMovie, 1,
+ PyDoc_STR("() -> None")},
+ {"InvalidateMovieRegion", (PyCFunction)MovieObj_InvalidateMovieRegion, 1,
+ PyDoc_STR("(RgnHandle invalidRgn) -> None")},
+ {"GetMovieBox", (PyCFunction)MovieObj_GetMovieBox, 1,
+ PyDoc_STR("() -> (Rect boxRect)")},
+ {"SetMovieBox", (PyCFunction)MovieObj_SetMovieBox, 1,
+ PyDoc_STR("(Rect boxRect) -> None")},
+ {"GetMovieDisplayClipRgn", (PyCFunction)MovieObj_GetMovieDisplayClipRgn, 1,
+ PyDoc_STR("() -> (RgnHandle _rv)")},
+ {"SetMovieDisplayClipRgn", (PyCFunction)MovieObj_SetMovieDisplayClipRgn, 1,
+ PyDoc_STR("(RgnHandle theClip) -> None")},
+ {"GetMovieClipRgn", (PyCFunction)MovieObj_GetMovieClipRgn, 1,
+ PyDoc_STR("() -> (RgnHandle _rv)")},
+ {"SetMovieClipRgn", (PyCFunction)MovieObj_SetMovieClipRgn, 1,
+ PyDoc_STR("(RgnHandle theClip) -> None")},
+ {"GetMovieDisplayBoundsRgn", (PyCFunction)MovieObj_GetMovieDisplayBoundsRgn, 1,
+ PyDoc_STR("() -> (RgnHandle _rv)")},
+ {"GetMovieBoundsRgn", (PyCFunction)MovieObj_GetMovieBoundsRgn, 1,
+ PyDoc_STR("() -> (RgnHandle _rv)")},
+ {"SetMovieVideoOutput", (PyCFunction)MovieObj_SetMovieVideoOutput, 1,
+ PyDoc_STR("(ComponentInstance vout) -> None")},
+ {"PutMovieIntoHandle", (PyCFunction)MovieObj_PutMovieIntoHandle, 1,
+ PyDoc_STR("(Handle publicMovie) -> None")},
+ {"PutMovieIntoDataFork", (PyCFunction)MovieObj_PutMovieIntoDataFork, 1,
+ PyDoc_STR("(short fRefNum, long offset, long maxSize) -> None")},
+ {"PutMovieIntoDataFork64", (PyCFunction)MovieObj_PutMovieIntoDataFork64, 1,
+ PyDoc_STR("(long fRefNum, wide offset, unsigned long maxSize) -> None")},
+ {"PutMovieIntoStorage", (PyCFunction)MovieObj_PutMovieIntoStorage, 1,
+ PyDoc_STR("(DataHandler dh, wide offset, unsigned long maxSize) -> None")},
+ {"PutMovieForDataRefIntoHandle", (PyCFunction)MovieObj_PutMovieForDataRefIntoHandle, 1,
+ PyDoc_STR("(Handle dataRef, OSType dataRefType, Handle publicMovie) -> None")},
+ {"GetMovieCreationTime", (PyCFunction)MovieObj_GetMovieCreationTime, 1,
+ PyDoc_STR("() -> (unsigned long _rv)")},
+ {"GetMovieModificationTime", (PyCFunction)MovieObj_GetMovieModificationTime, 1,
+ PyDoc_STR("() -> (unsigned long _rv)")},
+ {"GetMovieTimeScale", (PyCFunction)MovieObj_GetMovieTimeScale, 1,
+ PyDoc_STR("() -> (TimeScale _rv)")},
+ {"SetMovieTimeScale", (PyCFunction)MovieObj_SetMovieTimeScale, 1,
+ PyDoc_STR("(TimeScale timeScale) -> None")},
+ {"GetMovieDuration", (PyCFunction)MovieObj_GetMovieDuration, 1,
+ PyDoc_STR("() -> (TimeValue _rv)")},
+ {"GetMovieRate", (PyCFunction)MovieObj_GetMovieRate, 1,
+ PyDoc_STR("() -> (Fixed _rv)")},
+ {"SetMovieRate", (PyCFunction)MovieObj_SetMovieRate, 1,
+ PyDoc_STR("(Fixed rate) -> None")},
+ {"GetMoviePreferredRate", (PyCFunction)MovieObj_GetMoviePreferredRate, 1,
+ PyDoc_STR("() -> (Fixed _rv)")},
+ {"SetMoviePreferredRate", (PyCFunction)MovieObj_SetMoviePreferredRate, 1,
+ PyDoc_STR("(Fixed rate) -> None")},
+ {"GetMoviePreferredVolume", (PyCFunction)MovieObj_GetMoviePreferredVolume, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"SetMoviePreferredVolume", (PyCFunction)MovieObj_SetMoviePreferredVolume, 1,
+ PyDoc_STR("(short volume) -> None")},
+ {"GetMovieVolume", (PyCFunction)MovieObj_GetMovieVolume, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"SetMovieVolume", (PyCFunction)MovieObj_SetMovieVolume, 1,
+ PyDoc_STR("(short volume) -> None")},
+ {"GetMoviePreviewTime", (PyCFunction)MovieObj_GetMoviePreviewTime, 1,
+ PyDoc_STR("() -> (TimeValue previewTime, TimeValue previewDuration)")},
+ {"SetMoviePreviewTime", (PyCFunction)MovieObj_SetMoviePreviewTime, 1,
+ PyDoc_STR("(TimeValue previewTime, TimeValue previewDuration) -> None")},
+ {"GetMoviePosterTime", (PyCFunction)MovieObj_GetMoviePosterTime, 1,
+ PyDoc_STR("() -> (TimeValue _rv)")},
+ {"SetMoviePosterTime", (PyCFunction)MovieObj_SetMoviePosterTime, 1,
+ PyDoc_STR("(TimeValue posterTime) -> None")},
+ {"GetMovieSelection", (PyCFunction)MovieObj_GetMovieSelection, 1,
+ PyDoc_STR("() -> (TimeValue selectionTime, TimeValue selectionDuration)")},
+ {"SetMovieSelection", (PyCFunction)MovieObj_SetMovieSelection, 1,
+ PyDoc_STR("(TimeValue selectionTime, TimeValue selectionDuration) -> None")},
+ {"SetMovieActiveSegment", (PyCFunction)MovieObj_SetMovieActiveSegment, 1,
+ PyDoc_STR("(TimeValue startTime, TimeValue duration) -> None")},
+ {"GetMovieActiveSegment", (PyCFunction)MovieObj_GetMovieActiveSegment, 1,
+ PyDoc_STR("() -> (TimeValue startTime, TimeValue duration)")},
+ {"GetMovieTime", (PyCFunction)MovieObj_GetMovieTime, 1,
+ PyDoc_STR("() -> (TimeValue _rv, TimeRecord currentTime)")},
+ {"SetMovieTime", (PyCFunction)MovieObj_SetMovieTime, 1,
+ PyDoc_STR("(TimeRecord newtime) -> None")},
+ {"SetMovieTimeValue", (PyCFunction)MovieObj_SetMovieTimeValue, 1,
+ PyDoc_STR("(TimeValue newtime) -> None")},
+ {"GetMovieUserData", (PyCFunction)MovieObj_GetMovieUserData, 1,
+ PyDoc_STR("() -> (UserData _rv)")},
+ {"GetMovieTrackCount", (PyCFunction)MovieObj_GetMovieTrackCount, 1,
+ PyDoc_STR("() -> (long _rv)")},
+ {"GetMovieTrack", (PyCFunction)MovieObj_GetMovieTrack, 1,
+ PyDoc_STR("(long trackID) -> (Track _rv)")},
+ {"GetMovieIndTrack", (PyCFunction)MovieObj_GetMovieIndTrack, 1,
+ PyDoc_STR("(long index) -> (Track _rv)")},
+ {"GetMovieIndTrackType", (PyCFunction)MovieObj_GetMovieIndTrackType, 1,
+ PyDoc_STR("(long index, OSType trackType, long flags) -> (Track _rv)")},
+ {"NewMovieTrack", (PyCFunction)MovieObj_NewMovieTrack, 1,
+ PyDoc_STR("(Fixed width, Fixed height, short trackVolume) -> (Track _rv)")},
+ {"SetAutoTrackAlternatesEnabled", (PyCFunction)MovieObj_SetAutoTrackAlternatesEnabled, 1,
+ PyDoc_STR("(Boolean enable) -> None")},
+ {"SelectMovieAlternates", (PyCFunction)MovieObj_SelectMovieAlternates, 1,
+ PyDoc_STR("() -> None")},
+ {"InsertMovieSegment", (PyCFunction)MovieObj_InsertMovieSegment, 1,
+ PyDoc_STR("(Movie dstMovie, TimeValue srcIn, TimeValue srcDuration, TimeValue dstIn) -> None")},
+ {"InsertEmptyMovieSegment", (PyCFunction)MovieObj_InsertEmptyMovieSegment, 1,
+ PyDoc_STR("(TimeValue dstIn, TimeValue dstDuration) -> None")},
+ {"DeleteMovieSegment", (PyCFunction)MovieObj_DeleteMovieSegment, 1,
+ PyDoc_STR("(TimeValue startTime, TimeValue duration) -> None")},
+ {"ScaleMovieSegment", (PyCFunction)MovieObj_ScaleMovieSegment, 1,
+ PyDoc_STR("(TimeValue startTime, TimeValue oldDuration, TimeValue newDuration) -> None")},
+ {"CutMovieSelection", (PyCFunction)MovieObj_CutMovieSelection, 1,
+ PyDoc_STR("() -> (Movie _rv)")},
+ {"CopyMovieSelection", (PyCFunction)MovieObj_CopyMovieSelection, 1,
+ PyDoc_STR("() -> (Movie _rv)")},
+ {"PasteMovieSelection", (PyCFunction)MovieObj_PasteMovieSelection, 1,
+ PyDoc_STR("(Movie src) -> None")},
+ {"AddMovieSelection", (PyCFunction)MovieObj_AddMovieSelection, 1,
+ PyDoc_STR("(Movie src) -> None")},
+ {"ClearMovieSelection", (PyCFunction)MovieObj_ClearMovieSelection, 1,
+ PyDoc_STR("() -> None")},
+ {"PutMovieIntoTypedHandle", (PyCFunction)MovieObj_PutMovieIntoTypedHandle, 1,
+ PyDoc_STR("(Track targetTrack, OSType handleType, Handle publicMovie, TimeValue start, TimeValue dur, long flags, ComponentInstance userComp) -> None")},
+ {"CopyMovieSettings", (PyCFunction)MovieObj_CopyMovieSettings, 1,
+ PyDoc_STR("(Movie dstMovie) -> None")},
+ {"ConvertMovieToFile", (PyCFunction)MovieObj_ConvertMovieToFile, 1,
+ PyDoc_STR("(Track onlyTrack, FSSpec outputFile, OSType fileType, OSType creator, ScriptCode scriptTag, long flags, ComponentInstance userComp) -> (short resID)")},
+ {"GetMovieDataSize", (PyCFunction)MovieObj_GetMovieDataSize, 1,
+ PyDoc_STR("(TimeValue startTime, TimeValue duration) -> (long _rv)")},
+ {"GetMovieDataSize64", (PyCFunction)MovieObj_GetMovieDataSize64, 1,
+ PyDoc_STR("(TimeValue startTime, TimeValue duration) -> (wide dataSize)")},
+ {"PtInMovie", (PyCFunction)MovieObj_PtInMovie, 1,
+ PyDoc_STR("(Point pt) -> (Boolean _rv)")},
+ {"SetMovieLanguage", (PyCFunction)MovieObj_SetMovieLanguage, 1,
+ PyDoc_STR("(long language) -> None")},
+ {"CopyMovieUserData", (PyCFunction)MovieObj_CopyMovieUserData, 1,
+ PyDoc_STR("(Movie dstMovie, OSType copyRule) -> None")},
+ {"GetMovieNextInterestingTime", (PyCFunction)MovieObj_GetMovieNextInterestingTime, 1,
+ PyDoc_STR("(short interestingTimeFlags, short numMediaTypes, OSType whichMediaTypes, TimeValue time, Fixed rate) -> (TimeValue interestingTime, TimeValue interestingDuration)")},
+ {"AddMovieResource", (PyCFunction)MovieObj_AddMovieResource, 1,
+ PyDoc_STR("(short resRefNum, Str255 resName) -> (short resId)")},
+ {"UpdateMovieResource", (PyCFunction)MovieObj_UpdateMovieResource, 1,
+ PyDoc_STR("(short resRefNum, short resId, Str255 resName) -> None")},
+ {"AddMovieToStorage", (PyCFunction)MovieObj_AddMovieToStorage, 1,
+ PyDoc_STR("(DataHandler dh) -> None")},
+ {"UpdateMovieInStorage", (PyCFunction)MovieObj_UpdateMovieInStorage, 1,
+ PyDoc_STR("(DataHandler dh) -> None")},
+ {"HasMovieChanged", (PyCFunction)MovieObj_HasMovieChanged, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"ClearMovieChanged", (PyCFunction)MovieObj_ClearMovieChanged, 1,
+ PyDoc_STR("() -> None")},
+ {"SetMovieDefaultDataRef", (PyCFunction)MovieObj_SetMovieDefaultDataRef, 1,
+ PyDoc_STR("(Handle dataRef, OSType dataRefType) -> None")},
+ {"GetMovieDefaultDataRef", (PyCFunction)MovieObj_GetMovieDefaultDataRef, 1,
+ PyDoc_STR("() -> (Handle dataRef, OSType dataRefType)")},
+ {"SetMovieColorTable", (PyCFunction)MovieObj_SetMovieColorTable, 1,
+ PyDoc_STR("(CTabHandle ctab) -> None")},
+ {"GetMovieColorTable", (PyCFunction)MovieObj_GetMovieColorTable, 1,
+ PyDoc_STR("() -> (CTabHandle ctab)")},
+ {"FlattenMovie", (PyCFunction)MovieObj_FlattenMovie, 1,
+ PyDoc_STR("(long movieFlattenFlags, FSSpec theFile, OSType creator, ScriptCode scriptTag, long createMovieFileFlags, Str255 resName) -> (short resId)")},
+ {"FlattenMovieData", (PyCFunction)MovieObj_FlattenMovieData, 1,
+ PyDoc_STR("(long movieFlattenFlags, FSSpec theFile, OSType creator, ScriptCode scriptTag, long createMovieFileFlags) -> (Movie _rv)")},
+ {"FlattenMovieDataToDataRef", (PyCFunction)MovieObj_FlattenMovieDataToDataRef, 1,
+ PyDoc_STR("(long movieFlattenFlags, Handle dataRef, OSType dataRefType, OSType creator, ScriptCode scriptTag, long createMovieFileFlags) -> (Movie _rv)")},
+ {"MovieSearchText", (PyCFunction)MovieObj_MovieSearchText, 1,
+ PyDoc_STR("(Ptr text, long size, long searchFlags) -> (Track searchTrack, TimeValue searchTime, long searchOffset)")},
+ {"GetPosterBox", (PyCFunction)MovieObj_GetPosterBox, 1,
+ PyDoc_STR("() -> (Rect boxRect)")},
+ {"SetPosterBox", (PyCFunction)MovieObj_SetPosterBox, 1,
+ PyDoc_STR("(Rect boxRect) -> None")},
+ {"GetMovieSegmentDisplayBoundsRgn", (PyCFunction)MovieObj_GetMovieSegmentDisplayBoundsRgn, 1,
+ PyDoc_STR("(TimeValue time, TimeValue duration) -> (RgnHandle _rv)")},
+ {"GetMovieStatus", (PyCFunction)MovieObj_GetMovieStatus, 1,
+ PyDoc_STR("() -> (ComponentResult _rv, Track firstProblemTrack)")},
+ {"NewMovieController", (PyCFunction)MovieObj_NewMovieController, 1,
+ PyDoc_STR("(Rect movieRect, long someFlags) -> (MovieController _rv)")},
+ {"PutMovieOnScrap", (PyCFunction)MovieObj_PutMovieOnScrap, 1,
+ PyDoc_STR("(long movieScrapFlags) -> None")},
+ {"SetMoviePlayHints", (PyCFunction)MovieObj_SetMoviePlayHints, 1,
+ PyDoc_STR("(long flags, long flagsMask) -> None")},
+ {"GetMaxLoadedTimeInMovie", (PyCFunction)MovieObj_GetMaxLoadedTimeInMovie, 1,
+ PyDoc_STR("() -> (TimeValue time)")},
+ {"QTMovieNeedsTimeTable", (PyCFunction)MovieObj_QTMovieNeedsTimeTable, 1,
+ PyDoc_STR("() -> (Boolean needsTimeTable)")},
+ {"QTGetDataRefMaxFileOffset", (PyCFunction)MovieObj_QTGetDataRefMaxFileOffset, 1,
+ PyDoc_STR("(OSType dataRefType, Handle dataRef) -> (long offset)")},
+ {NULL, NULL, 0}
+};
+
+#define MovieObj_getsetlist NULL
+
+
+#define MovieObj_compare NULL
+
+#define MovieObj_repr NULL
+
+#define MovieObj_hash NULL
+#define MovieObj_tp_init 0
+
+#define MovieObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *MovieObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *_self;
+ Movie itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, MovieObj_Convert, &itself)) return NULL;
+ if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((MovieObject *)_self)->ob_itself = itself;
+ return _self;
+}
+
+#define MovieObj_tp_free PyObject_Del
+
+
+PyTypeObject Movie_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_Qt.Movie", /*tp_name*/
+ sizeof(MovieObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) MovieObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) MovieObj_compare, /*tp_compare*/
+ (reprfunc) MovieObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) MovieObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ MovieObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ MovieObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ MovieObj_tp_init, /* tp_init */
+ MovieObj_tp_alloc, /* tp_alloc */
+ MovieObj_tp_new, /* tp_new */
+ MovieObj_tp_free, /* tp_free */
+};
+
+/* --------------------- End object type Movie ---------------------- */
+
+
+/* ---------------------- Object type SGOutput ---------------------- */
+
+PyTypeObject SGOutput_Type;
+
+#define SGOutputObj_Check(x) ((x)->ob_type == &SGOutput_Type || PyObject_TypeCheck((x), &SGOutput_Type))
+
+typedef struct SGOutputObject {
+ PyObject_HEAD
+ SGOutput ob_itself;
+} SGOutputObject;
+
+PyObject *SGOutputObj_New(SGOutput itself)
+{
+ SGOutputObject *it;
+ if (itself == NULL) {
+ PyErr_SetString(Qt_Error,"Cannot create SGOutput from NULL pointer");
+ return NULL;
+ }
+ it = PyObject_NEW(SGOutputObject, &SGOutput_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+
+int SGOutputObj_Convert(PyObject *v, SGOutput *p_itself)
+{
+ if (v == Py_None)
+ {
+ *p_itself = NULL;
+ return 1;
+ }
+ if (!SGOutputObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "SGOutput required");
+ return 0;
+ }
+ *p_itself = ((SGOutputObject *)v)->ob_itself;
+ return 1;
+}
+
+static void SGOutputObj_dealloc(SGOutputObject *self)
+{
+ /* Cleanup of self->ob_itself goes here */
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyMethodDef SGOutputObj_methods[] = {
+ {NULL, NULL, 0}
+};
+
+#define SGOutputObj_getsetlist NULL
+
+
+#define SGOutputObj_compare NULL
+
+#define SGOutputObj_repr NULL
+
+#define SGOutputObj_hash NULL
+#define SGOutputObj_tp_init 0
+
+#define SGOutputObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *SGOutputObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *_self;
+ SGOutput itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, SGOutputObj_Convert, &itself)) return NULL;
+ if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((SGOutputObject *)_self)->ob_itself = itself;
+ return _self;
+}
+
+#define SGOutputObj_tp_free PyObject_Del
+
+
+PyTypeObject SGOutput_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_Qt.SGOutput", /*tp_name*/
+ sizeof(SGOutputObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) SGOutputObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) SGOutputObj_compare, /*tp_compare*/
+ (reprfunc) SGOutputObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) SGOutputObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ SGOutputObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ SGOutputObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ SGOutputObj_tp_init, /* tp_init */
+ SGOutputObj_tp_alloc, /* tp_alloc */
+ SGOutputObj_tp_new, /* tp_new */
+ SGOutputObj_tp_free, /* tp_free */
+};
+
+/* -------------------- End object type SGOutput -------------------- */
+
+
+static PyObject *Qt_EnterMovies(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+#ifndef EnterMovies
+ PyMac_PRECHECK(EnterMovies);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = EnterMovies();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_ExitMovies(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef ExitMovies
+ PyMac_PRECHECK(ExitMovies);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ExitMovies();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_GetMoviesError(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+#ifndef GetMoviesError
+ PyMac_PRECHECK(GetMoviesError);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetMoviesError();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_ClearMoviesStickyError(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef ClearMoviesStickyError
+ PyMac_PRECHECK(ClearMoviesStickyError);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ClearMoviesStickyError();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_GetMoviesStickyError(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+#ifndef GetMoviesStickyError
+ PyMac_PRECHECK(GetMoviesStickyError);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetMoviesStickyError();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_QTGetWallClockTimeBase(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ TimeBase wallClockTimeBase;
+#ifndef QTGetWallClockTimeBase
+ PyMac_PRECHECK(QTGetWallClockTimeBase);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = QTGetWallClockTimeBase(&wallClockTimeBase);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ TimeBaseObj_New, wallClockTimeBase);
+ return _res;
+}
+
+static PyObject *Qt_QTIdleManagerOpen(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ IdleManager _rv;
+#ifndef QTIdleManagerOpen
+ PyMac_PRECHECK(QTIdleManagerOpen);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = QTIdleManagerOpen();
+ _res = Py_BuildValue("O&",
+ IdleManagerObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qt_CreateMovieControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ WindowPtr theWindow;
+ Rect localRect;
+ Movie theMovie;
+ UInt32 options;
+ ControlHandle returnedControl;
+#ifndef CreateMovieControl
+ PyMac_PRECHECK(CreateMovieControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&l",
+ WinObj_Convert, &theWindow,
+ MovieObj_Convert, &theMovie,
+ &options))
+ return NULL;
+ _err = CreateMovieControl(theWindow,
+ &localRect,
+ theMovie,
+ options,
+ &returnedControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&O&",
+ PyMac_BuildRect, &localRect,
+ CtlObj_New, returnedControl);
+ return _res;
+}
+
+static PyObject *Qt_DisposeMatte(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixMapHandle theMatte;
+#ifndef DisposeMatte
+ PyMac_PRECHECK(DisposeMatte);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &theMatte))
+ return NULL;
+ DisposeMatte(theMatte);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_NewMovie(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Movie _rv;
+ long flags;
+#ifndef NewMovie
+ PyMac_PRECHECK(NewMovie);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &flags))
+ return NULL;
+ _rv = NewMovie(flags);
+ _res = Py_BuildValue("O&",
+ MovieObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qt_QTGetTimeUntilNextTask(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long duration;
+ long scale;
+#ifndef QTGetTimeUntilNextTask
+ PyMac_PRECHECK(QTGetTimeUntilNextTask);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &scale))
+ return NULL;
+ _err = QTGetTimeUntilNextTask(&duration,
+ scale);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ duration);
+ return _res;
+}
+
+static PyObject *Qt_GetDataHandler(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Component _rv;
+ Handle dataRef;
+ OSType dataHandlerSubType;
+ long flags;
+#ifndef GetDataHandler
+ PyMac_PRECHECK(GetDataHandler);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&l",
+ ResObj_Convert, &dataRef,
+ PyMac_GetOSType, &dataHandlerSubType,
+ &flags))
+ return NULL;
+ _rv = GetDataHandler(dataRef,
+ dataHandlerSubType,
+ flags);
+ _res = Py_BuildValue("O&",
+ CmpObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qt_PasteHandleIntoMovie(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle h;
+ OSType handleType;
+ Movie theMovie;
+ long flags;
+ ComponentInstance userComp;
+#ifndef PasteHandleIntoMovie
+ PyMac_PRECHECK(PasteHandleIntoMovie);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&lO&",
+ ResObj_Convert, &h,
+ PyMac_GetOSType, &handleType,
+ MovieObj_Convert, &theMovie,
+ &flags,
+ CmpInstObj_Convert, &userComp))
+ return NULL;
+ _err = PasteHandleIntoMovie(h,
+ handleType,
+ theMovie,
+ flags,
+ userComp);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_GetMovieImporterForDataRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType dataRefType;
+ Handle dataRef;
+ long flags;
+ Component importer;
+#ifndef GetMovieImporterForDataRef
+ PyMac_PRECHECK(GetMovieImporterForDataRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&l",
+ PyMac_GetOSType, &dataRefType,
+ ResObj_Convert, &dataRef,
+ &flags))
+ return NULL;
+ _err = GetMovieImporterForDataRef(dataRefType,
+ dataRef,
+ flags,
+ &importer);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CmpObj_New, importer);
+ return _res;
+}
+
+static PyObject *Qt_QTGetMIMETypeInfo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ char* mimeStringStart;
+ short mimeStringLength;
+ OSType infoSelector;
+ void * infoDataPtr;
+ long infoDataSize;
+#ifndef QTGetMIMETypeInfo
+ PyMac_PRECHECK(QTGetMIMETypeInfo);
+#endif
+ if (!PyArg_ParseTuple(_args, "shO&s",
+ &mimeStringStart,
+ &mimeStringLength,
+ PyMac_GetOSType, &infoSelector,
+ &infoDataPtr))
+ return NULL;
+ _err = QTGetMIMETypeInfo(mimeStringStart,
+ mimeStringLength,
+ infoSelector,
+ infoDataPtr,
+ &infoDataSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ infoDataSize);
+ return _res;
+}
+
+static PyObject *Qt_TrackTimeToMediaTime(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue _rv;
+ TimeValue value;
+ Track theTrack;
+#ifndef TrackTimeToMediaTime
+ PyMac_PRECHECK(TrackTimeToMediaTime);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&",
+ &value,
+ TrackObj_Convert, &theTrack))
+ return NULL;
+ _rv = TrackTimeToMediaTime(value,
+ theTrack);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_NewUserData(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ UserData theUserData;
+#ifndef NewUserData
+ PyMac_PRECHECK(NewUserData);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = NewUserData(&theUserData);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ UserDataObj_New, theUserData);
+ return _res;
+}
+
+static PyObject *Qt_NewUserDataFromHandle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle h;
+ UserData theUserData;
+#ifndef NewUserDataFromHandle
+ PyMac_PRECHECK(NewUserDataFromHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &h))
+ return NULL;
+ _err = NewUserDataFromHandle(h,
+ &theUserData);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ UserDataObj_New, theUserData);
+ return _res;
+}
+
+static PyObject *Qt_CreateMovieFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSSpec fileSpec;
+ OSType creator;
+ ScriptCode scriptTag;
+ long createMovieFileFlags;
+ short resRefNum;
+ Movie newmovie;
+#ifndef CreateMovieFile
+ PyMac_PRECHECK(CreateMovieFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&hl",
+ PyMac_GetFSSpec, &fileSpec,
+ PyMac_GetOSType, &creator,
+ &scriptTag,
+ &createMovieFileFlags))
+ return NULL;
+ _err = CreateMovieFile(&fileSpec,
+ creator,
+ scriptTag,
+ createMovieFileFlags,
+ &resRefNum,
+ &newmovie);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("hO&",
+ resRefNum,
+ MovieObj_New, newmovie);
+ return _res;
+}
+
+static PyObject *Qt_OpenMovieFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSSpec fileSpec;
+ short resRefNum;
+ SInt8 permission;
+#ifndef OpenMovieFile
+ PyMac_PRECHECK(OpenMovieFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&b",
+ PyMac_GetFSSpec, &fileSpec,
+ &permission))
+ return NULL;
+ _err = OpenMovieFile(&fileSpec,
+ &resRefNum,
+ permission);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ resRefNum);
+ return _res;
+}
+
+static PyObject *Qt_CloseMovieFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short resRefNum;
+#ifndef CloseMovieFile
+ PyMac_PRECHECK(CloseMovieFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &resRefNum))
+ return NULL;
+ _err = CloseMovieFile(resRefNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_DeleteMovieFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSSpec fileSpec;
+#ifndef DeleteMovieFile
+ PyMac_PRECHECK(DeleteMovieFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetFSSpec, &fileSpec))
+ return NULL;
+ _err = DeleteMovieFile(&fileSpec);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_NewMovieFromFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Movie theMovie;
+ short resRefNum;
+ short resId;
+ short newMovieFlags;
+ Boolean dataRefWasChanged;
+#ifndef NewMovieFromFile
+ PyMac_PRECHECK(NewMovieFromFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "hhh",
+ &resRefNum,
+ &resId,
+ &newMovieFlags))
+ return NULL;
+ _err = NewMovieFromFile(&theMovie,
+ resRefNum,
+ &resId,
+ (StringPtr)0,
+ newMovieFlags,
+ &dataRefWasChanged);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&hb",
+ MovieObj_New, theMovie,
+ resId,
+ dataRefWasChanged);
+ return _res;
+}
+
+static PyObject *Qt_NewMovieFromHandle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Movie theMovie;
+ Handle h;
+ short newMovieFlags;
+ Boolean dataRefWasChanged;
+#ifndef NewMovieFromHandle
+ PyMac_PRECHECK(NewMovieFromHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ ResObj_Convert, &h,
+ &newMovieFlags))
+ return NULL;
+ _err = NewMovieFromHandle(&theMovie,
+ h,
+ newMovieFlags,
+ &dataRefWasChanged);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&b",
+ MovieObj_New, theMovie,
+ dataRefWasChanged);
+ return _res;
+}
+
+static PyObject *Qt_NewMovieFromDataFork(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Movie theMovie;
+ short fRefNum;
+ long fileOffset;
+ short newMovieFlags;
+ Boolean dataRefWasChanged;
+#ifndef NewMovieFromDataFork
+ PyMac_PRECHECK(NewMovieFromDataFork);
+#endif
+ if (!PyArg_ParseTuple(_args, "hlh",
+ &fRefNum,
+ &fileOffset,
+ &newMovieFlags))
+ return NULL;
+ _err = NewMovieFromDataFork(&theMovie,
+ fRefNum,
+ fileOffset,
+ newMovieFlags,
+ &dataRefWasChanged);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&b",
+ MovieObj_New, theMovie,
+ dataRefWasChanged);
+ return _res;
+}
+
+static PyObject *Qt_NewMovieFromDataFork64(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Movie theMovie;
+ long fRefNum;
+ wide fileOffset;
+ short newMovieFlags;
+ Boolean dataRefWasChanged;
+#ifndef NewMovieFromDataFork64
+ PyMac_PRECHECK(NewMovieFromDataFork64);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&h",
+ &fRefNum,
+ PyMac_Getwide, &fileOffset,
+ &newMovieFlags))
+ return NULL;
+ _err = NewMovieFromDataFork64(&theMovie,
+ fRefNum,
+ &fileOffset,
+ newMovieFlags,
+ &dataRefWasChanged);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&b",
+ MovieObj_New, theMovie,
+ dataRefWasChanged);
+ return _res;
+}
+
+static PyObject *Qt_NewMovieFromDataRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Movie m;
+ short flags;
+ short id;
+ Handle dataRef;
+ OSType dtaRefType;
+#ifndef NewMovieFromDataRef
+ PyMac_PRECHECK(NewMovieFromDataRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "hO&O&",
+ &flags,
+ ResObj_Convert, &dataRef,
+ PyMac_GetOSType, &dtaRefType))
+ return NULL;
+ _err = NewMovieFromDataRef(&m,
+ flags,
+ &id,
+ dataRef,
+ dtaRefType);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&h",
+ MovieObj_New, m,
+ id);
+ return _res;
+}
+
+static PyObject *Qt_NewMovieFromStorageOffset(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Movie theMovie;
+ DataHandler dh;
+ wide fileOffset;
+ short newMovieFlags;
+ Boolean dataRefWasCataRefType;
+#ifndef NewMovieFromStorageOffset
+ PyMac_PRECHECK(NewMovieFromStorageOffset);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&h",
+ CmpInstObj_Convert, &dh,
+ PyMac_Getwide, &fileOffset,
+ &newMovieFlags))
+ return NULL;
+ _err = NewMovieFromStorageOffset(&theMovie,
+ dh,
+ &fileOffset,
+ newMovieFlags,
+ &dataRefWasCataRefType);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&b",
+ MovieObj_New, theMovie,
+ dataRefWasCataRefType);
+ return _res;
+}
+
+static PyObject *Qt_NewMovieForDataRefFromHandle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Movie theMovie;
+ Handle h;
+ short newMovieFlags;
+ Boolean dataRefWasChanged;
+ Handle dataRef;
+ OSType dataRefType;
+#ifndef NewMovieForDataRefFromHandle
+ PyMac_PRECHECK(NewMovieForDataRefFromHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hO&O&",
+ ResObj_Convert, &h,
+ &newMovieFlags,
+ ResObj_Convert, &dataRef,
+ PyMac_GetOSType, &dataRefType))
+ return NULL;
+ _err = NewMovieForDataRefFromHandle(&theMovie,
+ h,
+ newMovieFlags,
+ &dataRefWasChanged,
+ dataRef,
+ dataRefType);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&b",
+ MovieObj_New, theMovie,
+ dataRefWasChanged);
+ return _res;
+}
+
+static PyObject *Qt_RemoveMovieResource(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short resRefNum;
+ short resId;
+#ifndef RemoveMovieResource
+ PyMac_PRECHECK(RemoveMovieResource);
+#endif
+ if (!PyArg_ParseTuple(_args, "hh",
+ &resRefNum,
+ &resId))
+ return NULL;
+ _err = RemoveMovieResource(resRefNum,
+ resId);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_CreateMovieStorage(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle dataRef;
+ OSType dataRefType;
+ OSType creator;
+ ScriptCode scriptTag;
+ long createMovieFileFlags;
+ DataHandler outDataHandler;
+ Movie newmovie;
+#ifndef CreateMovieStorage
+ PyMac_PRECHECK(CreateMovieStorage);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&hl",
+ ResObj_Convert, &dataRef,
+ PyMac_GetOSType, &dataRefType,
+ PyMac_GetOSType, &creator,
+ &scriptTag,
+ &createMovieFileFlags))
+ return NULL;
+ _err = CreateMovieStorage(dataRef,
+ dataRefType,
+ creator,
+ scriptTag,
+ createMovieFileFlags,
+ &outDataHandler,
+ &newmovie);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&O&",
+ CmpInstObj_New, outDataHandler,
+ MovieObj_New, newmovie);
+ return _res;
+}
+
+static PyObject *Qt_OpenMovieStorage(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle dataRef;
+ OSType dataRefType;
+ long flags;
+ DataHandler outDataHandler;
+#ifndef OpenMovieStorage
+ PyMac_PRECHECK(OpenMovieStorage);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&l",
+ ResObj_Convert, &dataRef,
+ PyMac_GetOSType, &dataRefType,
+ &flags))
+ return NULL;
+ _err = OpenMovieStorage(dataRef,
+ dataRefType,
+ flags,
+ &outDataHandler);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CmpInstObj_New, outDataHandler);
+ return _res;
+}
+
+static PyObject *Qt_CloseMovieStorage(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ DataHandler dh;
+#ifndef CloseMovieStorage
+ PyMac_PRECHECK(CloseMovieStorage);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &dh))
+ return NULL;
+ _err = CloseMovieStorage(dh);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_DeleteMovieStorage(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle dataRef;
+ OSType dataRefType;
+#ifndef DeleteMovieStorage
+ PyMac_PRECHECK(DeleteMovieStorage);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &dataRef,
+ PyMac_GetOSType, &dataRefType))
+ return NULL;
+ _err = DeleteMovieStorage(dataRef,
+ dataRefType);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_CreateShortcutMovieFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSSpec fileSpec;
+ OSType creator;
+ ScriptCode scriptTag;
+ long createMovieFileFlags;
+ Handle targetDataRef;
+ OSType targetDataRefType;
+#ifndef CreateShortcutMovieFile
+ PyMac_PRECHECK(CreateShortcutMovieFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&hlO&O&",
+ PyMac_GetFSSpec, &fileSpec,
+ PyMac_GetOSType, &creator,
+ &scriptTag,
+ &createMovieFileFlags,
+ ResObj_Convert, &targetDataRef,
+ PyMac_GetOSType, &targetDataRefType))
+ return NULL;
+ _err = CreateShortcutMovieFile(&fileSpec,
+ creator,
+ scriptTag,
+ createMovieFileFlags,
+ targetDataRef,
+ targetDataRefType);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_CanQuickTimeOpenFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSSpec fileSpec;
+ OSType fileType;
+ OSType fileNameExtension;
+ Boolean outCanOpenWithGraphicsImporter;
+ Boolean outCanOpenAsMovie;
+ Boolean outPreferGraphicsImporter;
+ UInt32 inFlags;
+#ifndef CanQuickTimeOpenFile
+ PyMac_PRECHECK(CanQuickTimeOpenFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&l",
+ PyMac_GetFSSpec, &fileSpec,
+ PyMac_GetOSType, &fileType,
+ PyMac_GetOSType, &fileNameExtension,
+ &inFlags))
+ return NULL;
+ _err = CanQuickTimeOpenFile(&fileSpec,
+ fileType,
+ fileNameExtension,
+ &outCanOpenWithGraphicsImporter,
+ &outCanOpenAsMovie,
+ &outPreferGraphicsImporter,
+ inFlags);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("bbb",
+ outCanOpenWithGraphicsImporter,
+ outCanOpenAsMovie,
+ outPreferGraphicsImporter);
+ return _res;
+}
+
+static PyObject *Qt_CanQuickTimeOpenDataRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle dataRef;
+ OSType dataRefType;
+ Boolean outCanOpenWithGraphicsImporter;
+ Boolean outCanOpenAsMovie;
+ Boolean outPreferGraphicsImporter;
+ UInt32 inFlags;
+#ifndef CanQuickTimeOpenDataRef
+ PyMac_PRECHECK(CanQuickTimeOpenDataRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&l",
+ ResObj_Convert, &dataRef,
+ PyMac_GetOSType, &dataRefType,
+ &inFlags))
+ return NULL;
+ _err = CanQuickTimeOpenDataRef(dataRef,
+ dataRefType,
+ &outCanOpenWithGraphicsImporter,
+ &outCanOpenAsMovie,
+ &outPreferGraphicsImporter,
+ inFlags);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("bbb",
+ outCanOpenWithGraphicsImporter,
+ outCanOpenAsMovie,
+ outPreferGraphicsImporter);
+ return _res;
+}
+
+static PyObject *Qt_NewMovieFromScrap(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Movie _rv;
+ long newMovieFlags;
+#ifndef NewMovieFromScrap
+ PyMac_PRECHECK(NewMovieFromScrap);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &newMovieFlags))
+ return NULL;
+ _rv = NewMovieFromScrap(newMovieFlags);
+ _res = Py_BuildValue("O&",
+ MovieObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qt_QTNewAlias(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSSpec fss;
+ AliasHandle alias;
+ Boolean minimal;
+#ifndef QTNewAlias
+ PyMac_PRECHECK(QTNewAlias);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&b",
+ PyMac_GetFSSpec, &fss,
+ &minimal))
+ return NULL;
+ _err = QTNewAlias(&fss,
+ &alias,
+ minimal);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, alias);
+ return _res;
+}
+
+static PyObject *Qt_EndFullScreen(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Ptr fullState;
+ long flags;
+#ifndef EndFullScreen
+ PyMac_PRECHECK(EndFullScreen);
+#endif
+ if (!PyArg_ParseTuple(_args, "sl",
+ &fullState,
+ &flags))
+ return NULL;
+ _err = EndFullScreen(fullState,
+ flags);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_AddSoundDescriptionExtension(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SoundDescriptionHandle desc;
+ Handle extension;
+ OSType idType;
+#ifndef AddSoundDescriptionExtension
+ PyMac_PRECHECK(AddSoundDescriptionExtension);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ ResObj_Convert, &desc,
+ ResObj_Convert, &extension,
+ PyMac_GetOSType, &idType))
+ return NULL;
+ _err = AddSoundDescriptionExtension(desc,
+ extension,
+ idType);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_GetSoundDescriptionExtension(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SoundDescriptionHandle desc;
+ Handle extension;
+ OSType idType;
+#ifndef GetSoundDescriptionExtension
+ PyMac_PRECHECK(GetSoundDescriptionExtension);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &desc,
+ PyMac_GetOSType, &idType))
+ return NULL;
+ _err = GetSoundDescriptionExtension(desc,
+ &extension,
+ idType);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, extension);
+ return _res;
+}
+
+static PyObject *Qt_RemoveSoundDescriptionExtension(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SoundDescriptionHandle desc;
+ OSType idType;
+#ifndef RemoveSoundDescriptionExtension
+ PyMac_PRECHECK(RemoveSoundDescriptionExtension);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &desc,
+ PyMac_GetOSType, &idType))
+ return NULL;
+ _err = RemoveSoundDescriptionExtension(desc,
+ idType);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_QTIsStandardParameterDialogEvent(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ EventRecord pEvent;
+ QTParameterDialog createdDialog;
+#ifndef QTIsStandardParameterDialogEvent
+ PyMac_PRECHECK(QTIsStandardParameterDialogEvent);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &createdDialog))
+ return NULL;
+ _err = QTIsStandardParameterDialogEvent(&pEvent,
+ createdDialog);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildEventRecord, &pEvent);
+ return _res;
+}
+
+static PyObject *Qt_QTDismissStandardParameterDialog(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ QTParameterDialog createdDialog;
+#ifndef QTDismissStandardParameterDialog
+ PyMac_PRECHECK(QTDismissStandardParameterDialog);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &createdDialog))
+ return NULL;
+ _err = QTDismissStandardParameterDialog(createdDialog);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_QTStandardParameterDialogDoAction(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ QTParameterDialog createdDialog;
+ long action;
+ void * params;
+#ifndef QTStandardParameterDialogDoAction
+ PyMac_PRECHECK(QTStandardParameterDialogDoAction);
+#endif
+ if (!PyArg_ParseTuple(_args, "lls",
+ &createdDialog,
+ &action,
+ &params))
+ return NULL;
+ _err = QTStandardParameterDialogDoAction(createdDialog,
+ action,
+ params);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_QTRegisterAccessKey(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Str255 accessKeyType;
+ long flags;
+ Handle accessKey;
+#ifndef QTRegisterAccessKey
+ PyMac_PRECHECK(QTRegisterAccessKey);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lO&",
+ PyMac_GetStr255, accessKeyType,
+ &flags,
+ ResObj_Convert, &accessKey))
+ return NULL;
+ _err = QTRegisterAccessKey(accessKeyType,
+ flags,
+ accessKey);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_QTUnregisterAccessKey(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Str255 accessKeyType;
+ long flags;
+ Handle accessKey;
+#ifndef QTUnregisterAccessKey
+ PyMac_PRECHECK(QTUnregisterAccessKey);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lO&",
+ PyMac_GetStr255, accessKeyType,
+ &flags,
+ ResObj_Convert, &accessKey))
+ return NULL;
+ _err = QTUnregisterAccessKey(accessKeyType,
+ flags,
+ accessKey);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_QTGetSupportedRestrictions(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType inRestrictionClass;
+ UInt32 outRestrictionIDs;
+#ifndef QTGetSupportedRestrictions
+ PyMac_PRECHECK(QTGetSupportedRestrictions);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &inRestrictionClass))
+ return NULL;
+ _err = QTGetSupportedRestrictions(inRestrictionClass,
+ &outRestrictionIDs);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outRestrictionIDs);
+ return _res;
+}
+
+static PyObject *Qt_QTTextToNativeText(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle theText;
+ long encoding;
+ long flags;
+#ifndef QTTextToNativeText
+ PyMac_PRECHECK(QTTextToNativeText);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ ResObj_Convert, &theText,
+ &encoding,
+ &flags))
+ return NULL;
+ _err = QTTextToNativeText(theText,
+ encoding,
+ flags);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_VideoMediaResetStatistics(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+#ifndef VideoMediaResetStatistics
+ PyMac_PRECHECK(VideoMediaResetStatistics);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = VideoMediaResetStatistics(mh);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VideoMediaGetStatistics(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+#ifndef VideoMediaGetStatistics
+ PyMac_PRECHECK(VideoMediaGetStatistics);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = VideoMediaGetStatistics(mh);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VideoMediaGetStallCount(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ unsigned long stalls;
+#ifndef VideoMediaGetStallCount
+ PyMac_PRECHECK(VideoMediaGetStallCount);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = VideoMediaGetStallCount(mh,
+ &stalls);
+ _res = Py_BuildValue("ll",
+ _rv,
+ stalls);
+ return _res;
+}
+
+static PyObject *Qt_VideoMediaSetCodecParameter(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ CodecType cType;
+ OSType parameterID;
+ long parameterChangeSeed;
+ void * dataPtr;
+ long dataSize;
+#ifndef VideoMediaSetCodecParameter
+ PyMac_PRECHECK(VideoMediaSetCodecParameter);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&lsl",
+ CmpInstObj_Convert, &mh,
+ PyMac_GetOSType, &cType,
+ PyMac_GetOSType, &parameterID,
+ &parameterChangeSeed,
+ &dataPtr,
+ &dataSize))
+ return NULL;
+ _rv = VideoMediaSetCodecParameter(mh,
+ cType,
+ parameterID,
+ parameterChangeSeed,
+ dataPtr,
+ dataSize);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VideoMediaGetCodecParameter(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ CodecType cType;
+ OSType parameterID;
+ Handle outParameterData;
+#ifndef VideoMediaGetCodecParameter
+ PyMac_PRECHECK(VideoMediaGetCodecParameter);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&",
+ CmpInstObj_Convert, &mh,
+ PyMac_GetOSType, &cType,
+ PyMac_GetOSType, &parameterID,
+ ResObj_Convert, &outParameterData))
+ return NULL;
+ _rv = VideoMediaGetCodecParameter(mh,
+ cType,
+ parameterID,
+ outParameterData);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_TextMediaAddTextSample(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ Ptr text;
+ unsigned long size;
+ short fontNumber;
+ short fontSize;
+ Style textFace;
+ RGBColor textColor;
+ RGBColor backColor;
+ short textJustification;
+ Rect textBox;
+ long displayFlags;
+ TimeValue scrollDelay;
+ short hiliteStart;
+ short hiliteEnd;
+ RGBColor rgbHiliteColor;
+ TimeValue duration;
+ TimeValue sampleTime;
+#ifndef TextMediaAddTextSample
+ PyMac_PRECHECK(TextMediaAddTextSample);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&slhhbhllhhl",
+ CmpInstObj_Convert, &mh,
+ &text,
+ &size,
+ &fontNumber,
+ &fontSize,
+ &textFace,
+ &textJustification,
+ &displayFlags,
+ &scrollDelay,
+ &hiliteStart,
+ &hiliteEnd,
+ &duration))
+ return NULL;
+ _rv = TextMediaAddTextSample(mh,
+ text,
+ size,
+ fontNumber,
+ fontSize,
+ textFace,
+ &textColor,
+ &backColor,
+ textJustification,
+ &textBox,
+ displayFlags,
+ scrollDelay,
+ hiliteStart,
+ hiliteEnd,
+ &rgbHiliteColor,
+ duration,
+ &sampleTime);
+ _res = Py_BuildValue("lO&O&O&O&l",
+ _rv,
+ QdRGB_New, &textColor,
+ QdRGB_New, &backColor,
+ PyMac_BuildRect, &textBox,
+ QdRGB_New, &rgbHiliteColor,
+ sampleTime);
+ return _res;
+}
+
+static PyObject *Qt_TextMediaAddTESample(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ TEHandle hTE;
+ RGBColor backColor;
+ short textJustification;
+ Rect textBox;
+ long displayFlags;
+ TimeValue scrollDelay;
+ short hiliteStart;
+ short hiliteEnd;
+ RGBColor rgbHiliteColor;
+ TimeValue duration;
+ TimeValue sampleTime;
+#ifndef TextMediaAddTESample
+ PyMac_PRECHECK(TextMediaAddTESample);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&hllhhl",
+ CmpInstObj_Convert, &mh,
+ ResObj_Convert, &hTE,
+ &textJustification,
+ &displayFlags,
+ &scrollDelay,
+ &hiliteStart,
+ &hiliteEnd,
+ &duration))
+ return NULL;
+ _rv = TextMediaAddTESample(mh,
+ hTE,
+ &backColor,
+ textJustification,
+ &textBox,
+ displayFlags,
+ scrollDelay,
+ hiliteStart,
+ hiliteEnd,
+ &rgbHiliteColor,
+ duration,
+ &sampleTime);
+ _res = Py_BuildValue("lO&O&O&l",
+ _rv,
+ QdRGB_New, &backColor,
+ PyMac_BuildRect, &textBox,
+ QdRGB_New, &rgbHiliteColor,
+ sampleTime);
+ return _res;
+}
+
+static PyObject *Qt_TextMediaAddHiliteSample(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ short hiliteStart;
+ short hiliteEnd;
+ RGBColor rgbHiliteColor;
+ TimeValue duration;
+ TimeValue sampleTime;
+#ifndef TextMediaAddHiliteSample
+ PyMac_PRECHECK(TextMediaAddHiliteSample);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hhl",
+ CmpInstObj_Convert, &mh,
+ &hiliteStart,
+ &hiliteEnd,
+ &duration))
+ return NULL;
+ _rv = TextMediaAddHiliteSample(mh,
+ hiliteStart,
+ hiliteEnd,
+ &rgbHiliteColor,
+ duration,
+ &sampleTime);
+ _res = Py_BuildValue("lO&l",
+ _rv,
+ QdRGB_New, &rgbHiliteColor,
+ sampleTime);
+ return _res;
+}
+
+static PyObject *Qt_TextMediaDrawRaw(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ GWorldPtr gw;
+ GDHandle gd;
+ void * data;
+ long dataSize;
+ TextDescriptionHandle tdh;
+#ifndef TextMediaDrawRaw
+ PyMac_PRECHECK(TextMediaDrawRaw);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&slO&",
+ CmpInstObj_Convert, &mh,
+ GWorldObj_Convert, &gw,
+ OptResObj_Convert, &gd,
+ &data,
+ &dataSize,
+ ResObj_Convert, &tdh))
+ return NULL;
+ _rv = TextMediaDrawRaw(mh,
+ gw,
+ gd,
+ data,
+ dataSize,
+ tdh);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_TextMediaSetTextProperty(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ TimeValue atMediaTime;
+ long propertyType;
+ void * data;
+ long dataSize;
+#ifndef TextMediaSetTextProperty
+ PyMac_PRECHECK(TextMediaSetTextProperty);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&llsl",
+ CmpInstObj_Convert, &mh,
+ &atMediaTime,
+ &propertyType,
+ &data,
+ &dataSize))
+ return NULL;
+ _rv = TextMediaSetTextProperty(mh,
+ atMediaTime,
+ propertyType,
+ data,
+ dataSize);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_TextMediaRawSetup(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ GWorldPtr gw;
+ GDHandle gd;
+ void * data;
+ long dataSize;
+ TextDescriptionHandle tdh;
+ TimeValue sampleDuration;
+#ifndef TextMediaRawSetup
+ PyMac_PRECHECK(TextMediaRawSetup);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&slO&l",
+ CmpInstObj_Convert, &mh,
+ GWorldObj_Convert, &gw,
+ OptResObj_Convert, &gd,
+ &data,
+ &dataSize,
+ ResObj_Convert, &tdh,
+ &sampleDuration))
+ return NULL;
+ _rv = TextMediaRawSetup(mh,
+ gw,
+ gd,
+ data,
+ dataSize,
+ tdh,
+ sampleDuration);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_TextMediaRawIdle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ GWorldPtr gw;
+ GDHandle gd;
+ TimeValue sampleTime;
+ long flagsIn;
+ long flagsOut;
+#ifndef TextMediaRawIdle
+ PyMac_PRECHECK(TextMediaRawIdle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&ll",
+ CmpInstObj_Convert, &mh,
+ GWorldObj_Convert, &gw,
+ OptResObj_Convert, &gd,
+ &sampleTime,
+ &flagsIn))
+ return NULL;
+ _rv = TextMediaRawIdle(mh,
+ gw,
+ gd,
+ sampleTime,
+ flagsIn,
+ &flagsOut);
+ _res = Py_BuildValue("ll",
+ _rv,
+ flagsOut);
+ return _res;
+}
+
+static PyObject *Qt_TextMediaGetTextProperty(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ TimeValue atMediaTime;
+ long propertyType;
+ void * data;
+ long dataSize;
+#ifndef TextMediaGetTextProperty
+ PyMac_PRECHECK(TextMediaGetTextProperty);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&llsl",
+ CmpInstObj_Convert, &mh,
+ &atMediaTime,
+ &propertyType,
+ &data,
+ &dataSize))
+ return NULL;
+ _rv = TextMediaGetTextProperty(mh,
+ atMediaTime,
+ propertyType,
+ data,
+ dataSize);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_TextMediaFindNextText(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ Ptr text;
+ long size;
+ short findFlags;
+ TimeValue startTime;
+ TimeValue foundTime;
+ TimeValue foundDuration;
+ long offset;
+#ifndef TextMediaFindNextText
+ PyMac_PRECHECK(TextMediaFindNextText);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&slhl",
+ CmpInstObj_Convert, &mh,
+ &text,
+ &size,
+ &findFlags,
+ &startTime))
+ return NULL;
+ _rv = TextMediaFindNextText(mh,
+ text,
+ size,
+ findFlags,
+ startTime,
+ &foundTime,
+ &foundDuration,
+ &offset);
+ _res = Py_BuildValue("llll",
+ _rv,
+ foundTime,
+ foundDuration,
+ offset);
+ return _res;
+}
+
+static PyObject *Qt_TextMediaHiliteTextSample(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ TimeValue sampleTime;
+ short hiliteStart;
+ short hiliteEnd;
+ RGBColor rgbHiliteColor;
+#ifndef TextMediaHiliteTextSample
+ PyMac_PRECHECK(TextMediaHiliteTextSample);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lhh",
+ CmpInstObj_Convert, &mh,
+ &sampleTime,
+ &hiliteStart,
+ &hiliteEnd))
+ return NULL;
+ _rv = TextMediaHiliteTextSample(mh,
+ sampleTime,
+ hiliteStart,
+ hiliteEnd,
+ &rgbHiliteColor);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ QdRGB_New, &rgbHiliteColor);
+ return _res;
+}
+
+static PyObject *Qt_TextMediaSetTextSampleData(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ void * data;
+ OSType dataType;
+#ifndef TextMediaSetTextSampleData
+ PyMac_PRECHECK(TextMediaSetTextSampleData);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&sO&",
+ CmpInstObj_Convert, &mh,
+ &data,
+ PyMac_GetOSType, &dataType))
+ return NULL;
+ _rv = TextMediaSetTextSampleData(mh,
+ data,
+ dataType);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaSetProperty(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ short spriteIndex;
+ long propertyType;
+ void * propertyValue;
+#ifndef SpriteMediaSetProperty
+ PyMac_PRECHECK(SpriteMediaSetProperty);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hls",
+ CmpInstObj_Convert, &mh,
+ &spriteIndex,
+ &propertyType,
+ &propertyValue))
+ return NULL;
+ _rv = SpriteMediaSetProperty(mh,
+ spriteIndex,
+ propertyType,
+ propertyValue);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaGetProperty(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ short spriteIndex;
+ long propertyType;
+ void * propertyValue;
+#ifndef SpriteMediaGetProperty
+ PyMac_PRECHECK(SpriteMediaGetProperty);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hls",
+ CmpInstObj_Convert, &mh,
+ &spriteIndex,
+ &propertyType,
+ &propertyValue))
+ return NULL;
+ _rv = SpriteMediaGetProperty(mh,
+ spriteIndex,
+ propertyType,
+ propertyValue);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaHitTestSprites(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long flags;
+ Point loc;
+ short spriteHitIndex;
+#ifndef SpriteMediaHitTestSprites
+ PyMac_PRECHECK(SpriteMediaHitTestSprites);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lO&",
+ CmpInstObj_Convert, &mh,
+ &flags,
+ PyMac_GetPoint, &loc))
+ return NULL;
+ _rv = SpriteMediaHitTestSprites(mh,
+ flags,
+ loc,
+ &spriteHitIndex);
+ _res = Py_BuildValue("lh",
+ _rv,
+ spriteHitIndex);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaCountSprites(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ short numSprites;
+#ifndef SpriteMediaCountSprites
+ PyMac_PRECHECK(SpriteMediaCountSprites);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = SpriteMediaCountSprites(mh,
+ &numSprites);
+ _res = Py_BuildValue("lh",
+ _rv,
+ numSprites);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaCountImages(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ short numImages;
+#ifndef SpriteMediaCountImages
+ PyMac_PRECHECK(SpriteMediaCountImages);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = SpriteMediaCountImages(mh,
+ &numImages);
+ _res = Py_BuildValue("lh",
+ _rv,
+ numImages);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaGetIndImageDescription(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ short imageIndex;
+ ImageDescriptionHandle imageDescription;
+#ifndef SpriteMediaGetIndImageDescription
+ PyMac_PRECHECK(SpriteMediaGetIndImageDescription);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hO&",
+ CmpInstObj_Convert, &mh,
+ &imageIndex,
+ ResObj_Convert, &imageDescription))
+ return NULL;
+ _rv = SpriteMediaGetIndImageDescription(mh,
+ imageIndex,
+ imageDescription);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaGetDisplayedSampleNumber(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long sampleNum;
+#ifndef SpriteMediaGetDisplayedSampleNumber
+ PyMac_PRECHECK(SpriteMediaGetDisplayedSampleNumber);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = SpriteMediaGetDisplayedSampleNumber(mh,
+ &sampleNum);
+ _res = Py_BuildValue("ll",
+ _rv,
+ sampleNum);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaGetSpriteName(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ QTAtomID spriteID;
+ Str255 spriteName;
+#ifndef SpriteMediaGetSpriteName
+ PyMac_PRECHECK(SpriteMediaGetSpriteName);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lO&",
+ CmpInstObj_Convert, &mh,
+ &spriteID,
+ PyMac_GetStr255, spriteName))
+ return NULL;
+ _rv = SpriteMediaGetSpriteName(mh,
+ spriteID,
+ spriteName);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaGetImageName(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ short imageIndex;
+ Str255 imageName;
+#ifndef SpriteMediaGetImageName
+ PyMac_PRECHECK(SpriteMediaGetImageName);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hO&",
+ CmpInstObj_Convert, &mh,
+ &imageIndex,
+ PyMac_GetStr255, imageName))
+ return NULL;
+ _rv = SpriteMediaGetImageName(mh,
+ imageIndex,
+ imageName);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaSetSpriteProperty(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ QTAtomID spriteID;
+ long propertyType;
+ void * propertyValue;
+#ifndef SpriteMediaSetSpriteProperty
+ PyMac_PRECHECK(SpriteMediaSetSpriteProperty);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lls",
+ CmpInstObj_Convert, &mh,
+ &spriteID,
+ &propertyType,
+ &propertyValue))
+ return NULL;
+ _rv = SpriteMediaSetSpriteProperty(mh,
+ spriteID,
+ propertyType,
+ propertyValue);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaGetSpriteProperty(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ QTAtomID spriteID;
+ long propertyType;
+ void * propertyValue;
+#ifndef SpriteMediaGetSpriteProperty
+ PyMac_PRECHECK(SpriteMediaGetSpriteProperty);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lls",
+ CmpInstObj_Convert, &mh,
+ &spriteID,
+ &propertyType,
+ &propertyValue))
+ return NULL;
+ _rv = SpriteMediaGetSpriteProperty(mh,
+ spriteID,
+ propertyType,
+ propertyValue);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaHitTestAllSprites(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long flags;
+ Point loc;
+ QTAtomID spriteHitID;
+#ifndef SpriteMediaHitTestAllSprites
+ PyMac_PRECHECK(SpriteMediaHitTestAllSprites);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lO&",
+ CmpInstObj_Convert, &mh,
+ &flags,
+ PyMac_GetPoint, &loc))
+ return NULL;
+ _rv = SpriteMediaHitTestAllSprites(mh,
+ flags,
+ loc,
+ &spriteHitID);
+ _res = Py_BuildValue("ll",
+ _rv,
+ spriteHitID);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaHitTestOneSprite(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ QTAtomID spriteID;
+ long flags;
+ Point loc;
+ Boolean wasHit;
+#ifndef SpriteMediaHitTestOneSprite
+ PyMac_PRECHECK(SpriteMediaHitTestOneSprite);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&llO&",
+ CmpInstObj_Convert, &mh,
+ &spriteID,
+ &flags,
+ PyMac_GetPoint, &loc))
+ return NULL;
+ _rv = SpriteMediaHitTestOneSprite(mh,
+ spriteID,
+ flags,
+ loc,
+ &wasHit);
+ _res = Py_BuildValue("lb",
+ _rv,
+ wasHit);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaSpriteIndexToID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ short spriteIndex;
+ QTAtomID spriteID;
+#ifndef SpriteMediaSpriteIndexToID
+ PyMac_PRECHECK(SpriteMediaSpriteIndexToID);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ CmpInstObj_Convert, &mh,
+ &spriteIndex))
+ return NULL;
+ _rv = SpriteMediaSpriteIndexToID(mh,
+ spriteIndex,
+ &spriteID);
+ _res = Py_BuildValue("ll",
+ _rv,
+ spriteID);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaSpriteIDToIndex(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ QTAtomID spriteID;
+ short spriteIndex;
+#ifndef SpriteMediaSpriteIDToIndex
+ PyMac_PRECHECK(SpriteMediaSpriteIDToIndex);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mh,
+ &spriteID))
+ return NULL;
+ _rv = SpriteMediaSpriteIDToIndex(mh,
+ spriteID,
+ &spriteIndex);
+ _res = Py_BuildValue("lh",
+ _rv,
+ spriteIndex);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaSetActionVariable(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ QTAtomID variableID;
+ float value;
+#ifndef SpriteMediaSetActionVariable
+ PyMac_PRECHECK(SpriteMediaSetActionVariable);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lf",
+ CmpInstObj_Convert, &mh,
+ &variableID,
+ &value))
+ return NULL;
+ _rv = SpriteMediaSetActionVariable(mh,
+ variableID,
+ &value);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaGetActionVariable(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ QTAtomID variableID;
+ float value;
+#ifndef SpriteMediaGetActionVariable
+ PyMac_PRECHECK(SpriteMediaGetActionVariable);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mh,
+ &variableID))
+ return NULL;
+ _rv = SpriteMediaGetActionVariable(mh,
+ variableID,
+ &value);
+ _res = Py_BuildValue("lf",
+ _rv,
+ value);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaDisposeSprite(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ QTAtomID spriteID;
+#ifndef SpriteMediaDisposeSprite
+ PyMac_PRECHECK(SpriteMediaDisposeSprite);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mh,
+ &spriteID))
+ return NULL;
+ _rv = SpriteMediaDisposeSprite(mh,
+ spriteID);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaSetActionVariableToString(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ QTAtomID variableID;
+ Ptr theCString;
+#ifndef SpriteMediaSetActionVariableToString
+ PyMac_PRECHECK(SpriteMediaSetActionVariableToString);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ls",
+ CmpInstObj_Convert, &mh,
+ &variableID,
+ &theCString))
+ return NULL;
+ _rv = SpriteMediaSetActionVariableToString(mh,
+ variableID,
+ theCString);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaGetActionVariableAsString(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ QTAtomID variableID;
+ Handle theCString;
+#ifndef SpriteMediaGetActionVariableAsString
+ PyMac_PRECHECK(SpriteMediaGetActionVariableAsString);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mh,
+ &variableID))
+ return NULL;
+ _rv = SpriteMediaGetActionVariableAsString(mh,
+ variableID,
+ &theCString);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, theCString);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaNewImage(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ Handle dataRef;
+ OSType dataRefType;
+ QTAtomID desiredID;
+#ifndef SpriteMediaNewImage
+ PyMac_PRECHECK(SpriteMediaNewImage);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&l",
+ CmpInstObj_Convert, &mh,
+ ResObj_Convert, &dataRef,
+ PyMac_GetOSType, &dataRefType,
+ &desiredID))
+ return NULL;
+ _rv = SpriteMediaNewImage(mh,
+ dataRef,
+ dataRefType,
+ desiredID);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaDisposeImage(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ short imageIndex;
+#ifndef SpriteMediaDisposeImage
+ PyMac_PRECHECK(SpriteMediaDisposeImage);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ CmpInstObj_Convert, &mh,
+ &imageIndex))
+ return NULL;
+ _rv = SpriteMediaDisposeImage(mh,
+ imageIndex);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaImageIndexToID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ short imageIndex;
+ QTAtomID imageID;
+#ifndef SpriteMediaImageIndexToID
+ PyMac_PRECHECK(SpriteMediaImageIndexToID);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ CmpInstObj_Convert, &mh,
+ &imageIndex))
+ return NULL;
+ _rv = SpriteMediaImageIndexToID(mh,
+ imageIndex,
+ &imageID);
+ _res = Py_BuildValue("ll",
+ _rv,
+ imageID);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaImageIDToIndex(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ QTAtomID imageID;
+ short imageIndex;
+#ifndef SpriteMediaImageIDToIndex
+ PyMac_PRECHECK(SpriteMediaImageIDToIndex);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mh,
+ &imageID))
+ return NULL;
+ _rv = SpriteMediaImageIDToIndex(mh,
+ imageID,
+ &imageIndex);
+ _res = Py_BuildValue("lh",
+ _rv,
+ imageIndex);
+ return _res;
+}
+
+static PyObject *Qt_FlashMediaSetPan(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ short xPercent;
+ short yPercent;
+#ifndef FlashMediaSetPan
+ PyMac_PRECHECK(FlashMediaSetPan);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ CmpInstObj_Convert, &mh,
+ &xPercent,
+ &yPercent))
+ return NULL;
+ _rv = FlashMediaSetPan(mh,
+ xPercent,
+ yPercent);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_FlashMediaSetZoom(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ short factor;
+#ifndef FlashMediaSetZoom
+ PyMac_PRECHECK(FlashMediaSetZoom);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ CmpInstObj_Convert, &mh,
+ &factor))
+ return NULL;
+ _rv = FlashMediaSetZoom(mh,
+ factor);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_FlashMediaSetZoomRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long left;
+ long top;
+ long right;
+ long bottom;
+#ifndef FlashMediaSetZoomRect
+ PyMac_PRECHECK(FlashMediaSetZoomRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&llll",
+ CmpInstObj_Convert, &mh,
+ &left,
+ &top,
+ &right,
+ &bottom))
+ return NULL;
+ _rv = FlashMediaSetZoomRect(mh,
+ left,
+ top,
+ right,
+ bottom);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_FlashMediaGetRefConBounds(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long refCon;
+ long left;
+ long top;
+ long right;
+ long bottom;
+#ifndef FlashMediaGetRefConBounds
+ PyMac_PRECHECK(FlashMediaGetRefConBounds);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mh,
+ &refCon))
+ return NULL;
+ _rv = FlashMediaGetRefConBounds(mh,
+ refCon,
+ &left,
+ &top,
+ &right,
+ &bottom);
+ _res = Py_BuildValue("lllll",
+ _rv,
+ left,
+ top,
+ right,
+ bottom);
+ return _res;
+}
+
+static PyObject *Qt_FlashMediaGetRefConID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long refCon;
+ long refConID;
+#ifndef FlashMediaGetRefConID
+ PyMac_PRECHECK(FlashMediaGetRefConID);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mh,
+ &refCon))
+ return NULL;
+ _rv = FlashMediaGetRefConID(mh,
+ refCon,
+ &refConID);
+ _res = Py_BuildValue("ll",
+ _rv,
+ refConID);
+ return _res;
+}
+
+static PyObject *Qt_FlashMediaIDToRefCon(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long refConID;
+ long refCon;
+#ifndef FlashMediaIDToRefCon
+ PyMac_PRECHECK(FlashMediaIDToRefCon);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mh,
+ &refConID))
+ return NULL;
+ _rv = FlashMediaIDToRefCon(mh,
+ refConID,
+ &refCon);
+ _res = Py_BuildValue("ll",
+ _rv,
+ refCon);
+ return _res;
+}
+
+static PyObject *Qt_FlashMediaGetDisplayedFrameNumber(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long flashFrameNumber;
+#ifndef FlashMediaGetDisplayedFrameNumber
+ PyMac_PRECHECK(FlashMediaGetDisplayedFrameNumber);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = FlashMediaGetDisplayedFrameNumber(mh,
+ &flashFrameNumber);
+ _res = Py_BuildValue("ll",
+ _rv,
+ flashFrameNumber);
+ return _res;
+}
+
+static PyObject *Qt_FlashMediaFrameNumberToMovieTime(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long flashFrameNumber;
+ TimeValue movieTime;
+#ifndef FlashMediaFrameNumberToMovieTime
+ PyMac_PRECHECK(FlashMediaFrameNumberToMovieTime);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mh,
+ &flashFrameNumber))
+ return NULL;
+ _rv = FlashMediaFrameNumberToMovieTime(mh,
+ flashFrameNumber,
+ &movieTime);
+ _res = Py_BuildValue("ll",
+ _rv,
+ movieTime);
+ return _res;
+}
+
+static PyObject *Qt_FlashMediaFrameLabelToMovieTime(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ Ptr theLabel;
+ TimeValue movieTime;
+#ifndef FlashMediaFrameLabelToMovieTime
+ PyMac_PRECHECK(FlashMediaFrameLabelToMovieTime);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&s",
+ CmpInstObj_Convert, &mh,
+ &theLabel))
+ return NULL;
+ _rv = FlashMediaFrameLabelToMovieTime(mh,
+ theLabel,
+ &movieTime);
+ _res = Py_BuildValue("ll",
+ _rv,
+ movieTime);
+ return _res;
+}
+
+static PyObject *Qt_FlashMediaGetFlashVariable(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ char path;
+ char name;
+ Handle theVariableCStringOut;
+#ifndef FlashMediaGetFlashVariable
+ PyMac_PRECHECK(FlashMediaGetFlashVariable);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = FlashMediaGetFlashVariable(mh,
+ &path,
+ &name,
+ &theVariableCStringOut);
+ _res = Py_BuildValue("lccO&",
+ _rv,
+ path,
+ name,
+ ResObj_New, theVariableCStringOut);
+ return _res;
+}
+
+static PyObject *Qt_FlashMediaSetFlashVariable(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ char path;
+ char name;
+ char value;
+ Boolean updateFocus;
+#ifndef FlashMediaSetFlashVariable
+ PyMac_PRECHECK(FlashMediaSetFlashVariable);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&b",
+ CmpInstObj_Convert, &mh,
+ &updateFocus))
+ return NULL;
+ _rv = FlashMediaSetFlashVariable(mh,
+ &path,
+ &name,
+ &value,
+ updateFocus);
+ _res = Py_BuildValue("lccc",
+ _rv,
+ path,
+ name,
+ value);
+ return _res;
+}
+
+static PyObject *Qt_FlashMediaDoButtonActions(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ char path;
+ long buttonID;
+ long transition;
+#ifndef FlashMediaDoButtonActions
+ PyMac_PRECHECK(FlashMediaDoButtonActions);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ CmpInstObj_Convert, &mh,
+ &buttonID,
+ &transition))
+ return NULL;
+ _rv = FlashMediaDoButtonActions(mh,
+ &path,
+ buttonID,
+ transition);
+ _res = Py_BuildValue("lc",
+ _rv,
+ path);
+ return _res;
+}
+
+static PyObject *Qt_FlashMediaGetSupportedSwfVersion(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ UInt8 swfVersion;
+#ifndef FlashMediaGetSupportedSwfVersion
+ PyMac_PRECHECK(FlashMediaGetSupportedSwfVersion);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = FlashMediaGetSupportedSwfVersion(mh,
+ &swfVersion);
+ _res = Py_BuildValue("lb",
+ _rv,
+ swfVersion);
+ return _res;
+}
+
+static PyObject *Qt_Media3DGetCurrentGroup(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ void * group;
+#ifndef Media3DGetCurrentGroup
+ PyMac_PRECHECK(Media3DGetCurrentGroup);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&s",
+ CmpInstObj_Convert, &mh,
+ &group))
+ return NULL;
+ _rv = Media3DGetCurrentGroup(mh,
+ group);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_Media3DTranslateNamedObjectTo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ char objectName;
+ Fixed x;
+ Fixed y;
+ Fixed z;
+#ifndef Media3DTranslateNamedObjectTo
+ PyMac_PRECHECK(Media3DTranslateNamedObjectTo);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&",
+ CmpInstObj_Convert, &mh,
+ PyMac_GetFixed, &x,
+ PyMac_GetFixed, &y,
+ PyMac_GetFixed, &z))
+ return NULL;
+ _rv = Media3DTranslateNamedObjectTo(mh,
+ &objectName,
+ x,
+ y,
+ z);
+ _res = Py_BuildValue("lc",
+ _rv,
+ objectName);
+ return _res;
+}
+
+static PyObject *Qt_Media3DScaleNamedObjectTo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ char objectName;
+ Fixed xScale;
+ Fixed yScale;
+ Fixed zScale;
+#ifndef Media3DScaleNamedObjectTo
+ PyMac_PRECHECK(Media3DScaleNamedObjectTo);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&",
+ CmpInstObj_Convert, &mh,
+ PyMac_GetFixed, &xScale,
+ PyMac_GetFixed, &yScale,
+ PyMac_GetFixed, &zScale))
+ return NULL;
+ _rv = Media3DScaleNamedObjectTo(mh,
+ &objectName,
+ xScale,
+ yScale,
+ zScale);
+ _res = Py_BuildValue("lc",
+ _rv,
+ objectName);
+ return _res;
+}
+
+static PyObject *Qt_Media3DRotateNamedObjectTo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ char objectName;
+ Fixed xDegrees;
+ Fixed yDegrees;
+ Fixed zDegrees;
+#ifndef Media3DRotateNamedObjectTo
+ PyMac_PRECHECK(Media3DRotateNamedObjectTo);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&",
+ CmpInstObj_Convert, &mh,
+ PyMac_GetFixed, &xDegrees,
+ PyMac_GetFixed, &yDegrees,
+ PyMac_GetFixed, &zDegrees))
+ return NULL;
+ _rv = Media3DRotateNamedObjectTo(mh,
+ &objectName,
+ xDegrees,
+ yDegrees,
+ zDegrees);
+ _res = Py_BuildValue("lc",
+ _rv,
+ objectName);
+ return _res;
+}
+
+static PyObject *Qt_Media3DSetCameraData(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ void * cameraData;
+#ifndef Media3DSetCameraData
+ PyMac_PRECHECK(Media3DSetCameraData);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&s",
+ CmpInstObj_Convert, &mh,
+ &cameraData))
+ return NULL;
+ _rv = Media3DSetCameraData(mh,
+ cameraData);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_Media3DGetCameraData(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ void * cameraData;
+#ifndef Media3DGetCameraData
+ PyMac_PRECHECK(Media3DGetCameraData);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&s",
+ CmpInstObj_Convert, &mh,
+ &cameraData))
+ return NULL;
+ _rv = Media3DGetCameraData(mh,
+ cameraData);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_Media3DSetCameraAngleAspect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ QTFloatSingle fov;
+ QTFloatSingle aspectRatioXToY;
+#ifndef Media3DSetCameraAngleAspect
+ PyMac_PRECHECK(Media3DSetCameraAngleAspect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ff",
+ CmpInstObj_Convert, &mh,
+ &fov,
+ &aspectRatioXToY))
+ return NULL;
+ _rv = Media3DSetCameraAngleAspect(mh,
+ fov,
+ aspectRatioXToY);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_Media3DGetCameraAngleAspect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ QTFloatSingle fov;
+ QTFloatSingle aspectRatioXToY;
+#ifndef Media3DGetCameraAngleAspect
+ PyMac_PRECHECK(Media3DGetCameraAngleAspect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = Media3DGetCameraAngleAspect(mh,
+ &fov,
+ &aspectRatioXToY);
+ _res = Py_BuildValue("lff",
+ _rv,
+ fov,
+ aspectRatioXToY);
+ return _res;
+}
+
+static PyObject *Qt_Media3DSetCameraRange(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ void * tQ3CameraRange;
+#ifndef Media3DSetCameraRange
+ PyMac_PRECHECK(Media3DSetCameraRange);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&s",
+ CmpInstObj_Convert, &mh,
+ &tQ3CameraRange))
+ return NULL;
+ _rv = Media3DSetCameraRange(mh,
+ tQ3CameraRange);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_Media3DGetCameraRange(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ void * tQ3CameraRange;
+#ifndef Media3DGetCameraRange
+ PyMac_PRECHECK(Media3DGetCameraRange);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&s",
+ CmpInstObj_Convert, &mh,
+ &tQ3CameraRange))
+ return NULL;
+ _rv = Media3DGetCameraRange(mh,
+ tQ3CameraRange);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_NewTimeBase(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeBase _rv;
+#ifndef NewTimeBase
+ PyMac_PRECHECK(NewTimeBase);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = NewTimeBase();
+ _res = Py_BuildValue("O&",
+ TimeBaseObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qt_ConvertTime(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeRecord theTime;
+ TimeBase newBase;
+#ifndef ConvertTime
+ PyMac_PRECHECK(ConvertTime);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ QtTimeRecord_Convert, &theTime,
+ TimeBaseObj_Convert, &newBase))
+ return NULL;
+ ConvertTime(&theTime,
+ newBase);
+ _res = Py_BuildValue("O&",
+ QtTimeRecord_New, &theTime);
+ return _res;
+}
+
+static PyObject *Qt_ConvertTimeScale(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeRecord theTime;
+ TimeScale newScale;
+#ifndef ConvertTimeScale
+ PyMac_PRECHECK(ConvertTimeScale);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ QtTimeRecord_Convert, &theTime,
+ &newScale))
+ return NULL;
+ ConvertTimeScale(&theTime,
+ newScale);
+ _res = Py_BuildValue("O&",
+ QtTimeRecord_New, &theTime);
+ return _res;
+}
+
+static PyObject *Qt_AddTime(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeRecord dst;
+ TimeRecord src;
+#ifndef AddTime
+ PyMac_PRECHECK(AddTime);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ QtTimeRecord_Convert, &dst,
+ QtTimeRecord_Convert, &src))
+ return NULL;
+ AddTime(&dst,
+ &src);
+ _res = Py_BuildValue("O&",
+ QtTimeRecord_New, &dst);
+ return _res;
+}
+
+static PyObject *Qt_SubtractTime(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeRecord dst;
+ TimeRecord src;
+#ifndef SubtractTime
+ PyMac_PRECHECK(SubtractTime);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ QtTimeRecord_Convert, &dst,
+ QtTimeRecord_Convert, &src))
+ return NULL;
+ SubtractTime(&dst,
+ &src);
+ _res = Py_BuildValue("O&",
+ QtTimeRecord_New, &dst);
+ return _res;
+}
+
+static PyObject *Qt_MusicMediaGetIndexedTunePlayer(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ComponentInstance ti;
+ long sampleDescIndex;
+ ComponentInstance tp;
+#ifndef MusicMediaGetIndexedTunePlayer
+ PyMac_PRECHECK(MusicMediaGetIndexedTunePlayer);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &ti,
+ &sampleDescIndex))
+ return NULL;
+ _rv = MusicMediaGetIndexedTunePlayer(ti,
+ sampleDescIndex,
+ &tp);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ CmpInstObj_New, tp);
+ return _res;
+}
+
+static PyObject *Qt_CodecManagerVersion(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long version;
+#ifndef CodecManagerVersion
+ PyMac_PRECHECK(CodecManagerVersion);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = CodecManagerVersion(&version);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ version);
+ return _res;
+}
+
+static PyObject *Qt_GetMaxCompressionSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ PixMapHandle src;
+ Rect srcRect;
+ short colorDepth;
+ CodecQ quality;
+ CodecType cType;
+ CompressorComponent codec;
+ long size;
+#ifndef GetMaxCompressionSize
+ PyMac_PRECHECK(GetMaxCompressionSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&hlO&O&",
+ ResObj_Convert, &src,
+ PyMac_GetRect, &srcRect,
+ &colorDepth,
+ &quality,
+ PyMac_GetOSType, &cType,
+ CmpObj_Convert, &codec))
+ return NULL;
+ _err = GetMaxCompressionSize(src,
+ &srcRect,
+ colorDepth,
+ quality,
+ cType,
+ codec,
+ &size);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ size);
+ return _res;
+}
+
+static PyObject *Qt_GetCompressionTime(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ PixMapHandle src;
+ Rect srcRect;
+ short colorDepth;
+ CodecType cType;
+ CompressorComponent codec;
+ CodecQ spatialQuality;
+ CodecQ temporalQuality;
+ unsigned long compressTime;
+#ifndef GetCompressionTime
+ PyMac_PRECHECK(GetCompressionTime);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&hO&O&",
+ ResObj_Convert, &src,
+ PyMac_GetRect, &srcRect,
+ &colorDepth,
+ PyMac_GetOSType, &cType,
+ CmpObj_Convert, &codec))
+ return NULL;
+ _err = GetCompressionTime(src,
+ &srcRect,
+ colorDepth,
+ cType,
+ codec,
+ &spatialQuality,
+ &temporalQuality,
+ &compressTime);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("lll",
+ spatialQuality,
+ temporalQuality,
+ compressTime);
+ return _res;
+}
+
+static PyObject *Qt_CompressImage(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ PixMapHandle src;
+ Rect srcRect;
+ CodecQ quality;
+ CodecType cType;
+ ImageDescriptionHandle desc;
+ Ptr data;
+#ifndef CompressImage
+ PyMac_PRECHECK(CompressImage);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&lO&O&s",
+ ResObj_Convert, &src,
+ PyMac_GetRect, &srcRect,
+ &quality,
+ PyMac_GetOSType, &cType,
+ ResObj_Convert, &desc,
+ &data))
+ return NULL;
+ _err = CompressImage(src,
+ &srcRect,
+ quality,
+ cType,
+ desc,
+ data);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_DecompressImage(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Ptr data;
+ ImageDescriptionHandle desc;
+ PixMapHandle dst;
+ Rect srcRect;
+ Rect dstRect;
+ short mode;
+ RgnHandle mask;
+#ifndef DecompressImage
+ PyMac_PRECHECK(DecompressImage);
+#endif
+ if (!PyArg_ParseTuple(_args, "sO&O&O&O&hO&",
+ &data,
+ ResObj_Convert, &desc,
+ ResObj_Convert, &dst,
+ PyMac_GetRect, &srcRect,
+ PyMac_GetRect, &dstRect,
+ &mode,
+ ResObj_Convert, &mask))
+ return NULL;
+ _err = DecompressImage(data,
+ desc,
+ dst,
+ &srcRect,
+ &dstRect,
+ mode,
+ mask);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_GetSimilarity(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ PixMapHandle src;
+ Rect srcRect;
+ ImageDescriptionHandle desc;
+ Ptr data;
+ Fixed similarity;
+#ifndef GetSimilarity
+ PyMac_PRECHECK(GetSimilarity);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&s",
+ ResObj_Convert, &src,
+ PyMac_GetRect, &srcRect,
+ ResObj_Convert, &desc,
+ &data))
+ return NULL;
+ _err = GetSimilarity(src,
+ &srcRect,
+ desc,
+ data,
+ &similarity);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildFixed, similarity);
+ return _res;
+}
+
+static PyObject *Qt_GetImageDescriptionCTable(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ImageDescriptionHandle desc;
+ CTabHandle ctable;
+#ifndef GetImageDescriptionCTable
+ PyMac_PRECHECK(GetImageDescriptionCTable);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &desc))
+ return NULL;
+ _err = GetImageDescriptionCTable(desc,
+ &ctable);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, ctable);
+ return _res;
+}
+
+static PyObject *Qt_SetImageDescriptionCTable(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ImageDescriptionHandle desc;
+ CTabHandle ctable;
+#ifndef SetImageDescriptionCTable
+ PyMac_PRECHECK(SetImageDescriptionCTable);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &desc,
+ ResObj_Convert, &ctable))
+ return NULL;
+ _err = SetImageDescriptionCTable(desc,
+ ctable);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_GetImageDescriptionExtension(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ImageDescriptionHandle desc;
+ Handle extension;
+ long idType;
+ long index;
+#ifndef GetImageDescriptionExtension
+ PyMac_PRECHECK(GetImageDescriptionExtension);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ ResObj_Convert, &desc,
+ &idType,
+ &index))
+ return NULL;
+ _err = GetImageDescriptionExtension(desc,
+ &extension,
+ idType,
+ index);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, extension);
+ return _res;
+}
+
+static PyObject *Qt_AddImageDescriptionExtension(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ImageDescriptionHandle desc;
+ Handle extension;
+ long idType;
+#ifndef AddImageDescriptionExtension
+ PyMac_PRECHECK(AddImageDescriptionExtension);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&l",
+ ResObj_Convert, &desc,
+ ResObj_Convert, &extension,
+ &idType))
+ return NULL;
+ _err = AddImageDescriptionExtension(desc,
+ extension,
+ idType);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_RemoveImageDescriptionExtension(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ImageDescriptionHandle desc;
+ long idType;
+ long index;
+#ifndef RemoveImageDescriptionExtension
+ PyMac_PRECHECK(RemoveImageDescriptionExtension);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ ResObj_Convert, &desc,
+ &idType,
+ &index))
+ return NULL;
+ _err = RemoveImageDescriptionExtension(desc,
+ idType,
+ index);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_CountImageDescriptionExtensionType(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ImageDescriptionHandle desc;
+ long idType;
+ long count;
+#ifndef CountImageDescriptionExtensionType
+ PyMac_PRECHECK(CountImageDescriptionExtensionType);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ ResObj_Convert, &desc,
+ &idType))
+ return NULL;
+ _err = CountImageDescriptionExtensionType(desc,
+ idType,
+ &count);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ count);
+ return _res;
+}
+
+static PyObject *Qt_GetNextImageDescriptionExtensionType(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ImageDescriptionHandle desc;
+ long idType;
+#ifndef GetNextImageDescriptionExtensionType
+ PyMac_PRECHECK(GetNextImageDescriptionExtensionType);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &desc))
+ return NULL;
+ _err = GetNextImageDescriptionExtensionType(desc,
+ &idType);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ idType);
+ return _res;
+}
+
+static PyObject *Qt_FindCodec(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ CodecType cType;
+ CodecComponent specCodec;
+ CompressorComponent compressor;
+ DecompressorComponent decompressor;
+#ifndef FindCodec
+ PyMac_PRECHECK(FindCodec);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &cType,
+ CmpObj_Convert, &specCodec))
+ return NULL;
+ _err = FindCodec(cType,
+ specCodec,
+ &compressor,
+ &decompressor);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&O&",
+ CmpObj_New, compressor,
+ CmpObj_New, decompressor);
+ return _res;
+}
+
+static PyObject *Qt_CompressPicture(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ PicHandle srcPicture;
+ PicHandle dstPicture;
+ CodecQ quality;
+ CodecType cType;
+#ifndef CompressPicture
+ PyMac_PRECHECK(CompressPicture);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&lO&",
+ ResObj_Convert, &srcPicture,
+ ResObj_Convert, &dstPicture,
+ &quality,
+ PyMac_GetOSType, &cType))
+ return NULL;
+ _err = CompressPicture(srcPicture,
+ dstPicture,
+ quality,
+ cType);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_CompressPictureFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short srcRefNum;
+ short dstRefNum;
+ CodecQ quality;
+ CodecType cType;
+#ifndef CompressPictureFile
+ PyMac_PRECHECK(CompressPictureFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "hhlO&",
+ &srcRefNum,
+ &dstRefNum,
+ &quality,
+ PyMac_GetOSType, &cType))
+ return NULL;
+ _err = CompressPictureFile(srcRefNum,
+ dstRefNum,
+ quality,
+ cType);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_ConvertImage(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ImageDescriptionHandle srcDD;
+ Ptr srcData;
+ short colorDepth;
+ CTabHandle ctable;
+ CodecQ accuracy;
+ CodecQ quality;
+ CodecType cType;
+ CodecComponent codec;
+ ImageDescriptionHandle dstDD;
+ Ptr dstData;
+#ifndef ConvertImage
+ PyMac_PRECHECK(ConvertImage);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&shO&llO&O&O&s",
+ ResObj_Convert, &srcDD,
+ &srcData,
+ &colorDepth,
+ ResObj_Convert, &ctable,
+ &accuracy,
+ &quality,
+ PyMac_GetOSType, &cType,
+ CmpObj_Convert, &codec,
+ ResObj_Convert, &dstDD,
+ &dstData))
+ return NULL;
+ _err = ConvertImage(srcDD,
+ srcData,
+ colorDepth,
+ ctable,
+ accuracy,
+ quality,
+ cType,
+ codec,
+ dstDD,
+ dstData);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_AddFilePreview(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short resRefNum;
+ OSType previewType;
+ Handle previewData;
+#ifndef AddFilePreview
+ PyMac_PRECHECK(AddFilePreview);
+#endif
+ if (!PyArg_ParseTuple(_args, "hO&O&",
+ &resRefNum,
+ PyMac_GetOSType, &previewType,
+ ResObj_Convert, &previewData))
+ return NULL;
+ _err = AddFilePreview(resRefNum,
+ previewType,
+ previewData);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_GetBestDeviceRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ GDHandle gdh;
+ Rect rp;
+#ifndef GetBestDeviceRect
+ PyMac_PRECHECK(GetBestDeviceRect);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetBestDeviceRect(&gdh,
+ &rp);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&O&",
+ OptResObj_New, gdh,
+ PyMac_BuildRect, &rp);
+ return _res;
+}
+
+static PyObject *Qt_GDHasScale(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ GDHandle gdh;
+ short depth;
+ Fixed scale;
+#ifndef GDHasScale
+ PyMac_PRECHECK(GDHasScale);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ OptResObj_Convert, &gdh,
+ &depth))
+ return NULL;
+ _err = GDHasScale(gdh,
+ depth,
+ &scale);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildFixed, scale);
+ return _res;
+}
+
+static PyObject *Qt_GDGetScale(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ GDHandle gdh;
+ Fixed scale;
+ short flags;
+#ifndef GDGetScale
+ PyMac_PRECHECK(GDGetScale);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ OptResObj_Convert, &gdh))
+ return NULL;
+ _err = GDGetScale(gdh,
+ &scale,
+ &flags);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&h",
+ PyMac_BuildFixed, scale,
+ flags);
+ return _res;
+}
+
+static PyObject *Qt_GDSetScale(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ GDHandle gdh;
+ Fixed scale;
+ short flags;
+#ifndef GDSetScale
+ PyMac_PRECHECK(GDSetScale);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&h",
+ OptResObj_Convert, &gdh,
+ PyMac_GetFixed, &scale,
+ &flags))
+ return NULL;
+ _err = GDSetScale(gdh,
+ scale,
+ flags);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_GetGraphicsImporterForFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSSpec theFile;
+ ComponentInstance gi;
+#ifndef GetGraphicsImporterForFile
+ PyMac_PRECHECK(GetGraphicsImporterForFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetFSSpec, &theFile))
+ return NULL;
+ _err = GetGraphicsImporterForFile(&theFile,
+ &gi);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CmpInstObj_New, gi);
+ return _res;
+}
+
+static PyObject *Qt_GetGraphicsImporterForDataRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle dataRef;
+ OSType dataRefType;
+ ComponentInstance gi;
+#ifndef GetGraphicsImporterForDataRef
+ PyMac_PRECHECK(GetGraphicsImporterForDataRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &dataRef,
+ PyMac_GetOSType, &dataRefType))
+ return NULL;
+ _err = GetGraphicsImporterForDataRef(dataRef,
+ dataRefType,
+ &gi);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CmpInstObj_New, gi);
+ return _res;
+}
+
+static PyObject *Qt_GetGraphicsImporterForFileWithFlags(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSSpec theFile;
+ ComponentInstance gi;
+ long flags;
+#ifndef GetGraphicsImporterForFileWithFlags
+ PyMac_PRECHECK(GetGraphicsImporterForFileWithFlags);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetFSSpec, &theFile,
+ &flags))
+ return NULL;
+ _err = GetGraphicsImporterForFileWithFlags(&theFile,
+ &gi,
+ flags);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CmpInstObj_New, gi);
+ return _res;
+}
+
+static PyObject *Qt_GetGraphicsImporterForDataRefWithFlags(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle dataRef;
+ OSType dataRefType;
+ ComponentInstance gi;
+ long flags;
+#ifndef GetGraphicsImporterForDataRefWithFlags
+ PyMac_PRECHECK(GetGraphicsImporterForDataRefWithFlags);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&l",
+ ResObj_Convert, &dataRef,
+ PyMac_GetOSType, &dataRefType,
+ &flags))
+ return NULL;
+ _err = GetGraphicsImporterForDataRefWithFlags(dataRef,
+ dataRefType,
+ &gi,
+ flags);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CmpInstObj_New, gi);
+ return _res;
+}
+
+static PyObject *Qt_MakeImageDescriptionForPixMap(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ PixMapHandle pixmap;
+ ImageDescriptionHandle idh;
+#ifndef MakeImageDescriptionForPixMap
+ PyMac_PRECHECK(MakeImageDescriptionForPixMap);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &pixmap))
+ return NULL;
+ _err = MakeImageDescriptionForPixMap(pixmap,
+ &idh);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, idh);
+ return _res;
+}
+
+static PyObject *Qt_MakeImageDescriptionForEffect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType effectType;
+ ImageDescriptionHandle idh;
+#ifndef MakeImageDescriptionForEffect
+ PyMac_PRECHECK(MakeImageDescriptionForEffect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &effectType))
+ return NULL;
+ _err = MakeImageDescriptionForEffect(effectType,
+ &idh);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, idh);
+ return _res;
+}
+
+static PyObject *Qt_QTGetPixelSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ OSType PixelFormat;
+#ifndef QTGetPixelSize
+ PyMac_PRECHECK(QTGetPixelSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &PixelFormat))
+ return NULL;
+ _rv = QTGetPixelSize(PixelFormat);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_QTGetPixelFormatDepthForImageDescription(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ OSType PixelFormat;
+#ifndef QTGetPixelFormatDepthForImageDescription
+ PyMac_PRECHECK(QTGetPixelFormatDepthForImageDescription);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &PixelFormat))
+ return NULL;
+ _rv = QTGetPixelFormatDepthForImageDescription(PixelFormat);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_QTGetPixMapHandleRowBytes(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ PixMapHandle pm;
+#ifndef QTGetPixMapHandleRowBytes
+ PyMac_PRECHECK(QTGetPixMapHandleRowBytes);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &pm))
+ return NULL;
+ _rv = QTGetPixMapHandleRowBytes(pm);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_QTSetPixMapHandleRowBytes(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ PixMapHandle pm;
+ long rowBytes;
+#ifndef QTSetPixMapHandleRowBytes
+ PyMac_PRECHECK(QTSetPixMapHandleRowBytes);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ ResObj_Convert, &pm,
+ &rowBytes))
+ return NULL;
+ _err = QTSetPixMapHandleRowBytes(pm,
+ rowBytes);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_QTGetPixMapHandleGammaLevel(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Fixed _rv;
+ PixMapHandle pm;
+#ifndef QTGetPixMapHandleGammaLevel
+ PyMac_PRECHECK(QTGetPixMapHandleGammaLevel);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &pm))
+ return NULL;
+ _rv = QTGetPixMapHandleGammaLevel(pm);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildFixed, _rv);
+ return _res;
+}
+
+static PyObject *Qt_QTSetPixMapHandleGammaLevel(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ PixMapHandle pm;
+ Fixed gammaLevel;
+#ifndef QTSetPixMapHandleGammaLevel
+ PyMac_PRECHECK(QTSetPixMapHandleGammaLevel);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &pm,
+ PyMac_GetFixed, &gammaLevel))
+ return NULL;
+ _err = QTSetPixMapHandleGammaLevel(pm,
+ gammaLevel);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_QTGetPixMapHandleRequestedGammaLevel(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Fixed _rv;
+ PixMapHandle pm;
+#ifndef QTGetPixMapHandleRequestedGammaLevel
+ PyMac_PRECHECK(QTGetPixMapHandleRequestedGammaLevel);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &pm))
+ return NULL;
+ _rv = QTGetPixMapHandleRequestedGammaLevel(pm);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildFixed, _rv);
+ return _res;
+}
+
+static PyObject *Qt_QTSetPixMapHandleRequestedGammaLevel(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ PixMapHandle pm;
+ Fixed requestedGammaLevel;
+#ifndef QTSetPixMapHandleRequestedGammaLevel
+ PyMac_PRECHECK(QTSetPixMapHandleRequestedGammaLevel);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &pm,
+ PyMac_GetFixed, &requestedGammaLevel))
+ return NULL;
+ _err = QTSetPixMapHandleRequestedGammaLevel(pm,
+ requestedGammaLevel);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_CompAdd(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ wide src;
+ wide dst;
+#ifndef CompAdd
+ PyMac_PRECHECK(CompAdd);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ CompAdd(&src,
+ &dst);
+ _res = Py_BuildValue("O&O&",
+ PyMac_Buildwide, src,
+ PyMac_Buildwide, dst);
+ return _res;
+}
+
+static PyObject *Qt_CompSub(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ wide src;
+ wide dst;
+#ifndef CompSub
+ PyMac_PRECHECK(CompSub);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ CompSub(&src,
+ &dst);
+ _res = Py_BuildValue("O&O&",
+ PyMac_Buildwide, src,
+ PyMac_Buildwide, dst);
+ return _res;
+}
+
+static PyObject *Qt_CompNeg(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ wide dst;
+#ifndef CompNeg
+ PyMac_PRECHECK(CompNeg);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ CompNeg(&dst);
+ _res = Py_BuildValue("O&",
+ PyMac_Buildwide, dst);
+ return _res;
+}
+
+static PyObject *Qt_CompShift(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ wide src;
+ short shift;
+#ifndef CompShift
+ PyMac_PRECHECK(CompShift);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &shift))
+ return NULL;
+ CompShift(&src,
+ shift);
+ _res = Py_BuildValue("O&",
+ PyMac_Buildwide, src);
+ return _res;
+}
+
+static PyObject *Qt_CompMul(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long src1;
+ long src2;
+ wide dst;
+#ifndef CompMul
+ PyMac_PRECHECK(CompMul);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &src1,
+ &src2))
+ return NULL;
+ CompMul(src1,
+ src2,
+ &dst);
+ _res = Py_BuildValue("O&",
+ PyMac_Buildwide, dst);
+ return _res;
+}
+
+static PyObject *Qt_CompDiv(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ wide numerator;
+ long denominator;
+ long remainder;
+#ifndef CompDiv
+ PyMac_PRECHECK(CompDiv);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &denominator))
+ return NULL;
+ _rv = CompDiv(&numerator,
+ denominator,
+ &remainder);
+ _res = Py_BuildValue("lO&l",
+ _rv,
+ PyMac_Buildwide, numerator,
+ remainder);
+ return _res;
+}
+
+static PyObject *Qt_CompFixMul(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ wide compSrc;
+ Fixed fixSrc;
+ wide compDst;
+#ifndef CompFixMul
+ PyMac_PRECHECK(CompFixMul);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetFixed, &fixSrc))
+ return NULL;
+ CompFixMul(&compSrc,
+ fixSrc,
+ &compDst);
+ _res = Py_BuildValue("O&O&",
+ PyMac_Buildwide, compSrc,
+ PyMac_Buildwide, compDst);
+ return _res;
+}
+
+static PyObject *Qt_CompMulDiv(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ wide co;
+ long mul;
+ long divisor;
+#ifndef CompMulDiv
+ PyMac_PRECHECK(CompMulDiv);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &mul,
+ &divisor))
+ return NULL;
+ CompMulDiv(&co,
+ mul,
+ divisor);
+ _res = Py_BuildValue("O&",
+ PyMac_Buildwide, co);
+ return _res;
+}
+
+static PyObject *Qt_CompMulDivTrunc(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ wide co;
+ long mul;
+ long divisor;
+ long remainder;
+#ifndef CompMulDivTrunc
+ PyMac_PRECHECK(CompMulDivTrunc);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &mul,
+ &divisor))
+ return NULL;
+ CompMulDivTrunc(&co,
+ mul,
+ divisor,
+ &remainder);
+ _res = Py_BuildValue("O&l",
+ PyMac_Buildwide, co,
+ remainder);
+ return _res;
+}
+
+static PyObject *Qt_CompCompare(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ wide a;
+ wide minusb;
+#ifndef CompCompare
+ PyMac_PRECHECK(CompCompare);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_Getwide, &a,
+ PyMac_Getwide, &minusb))
+ return NULL;
+ _rv = CompCompare(&a,
+ &minusb);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_CompSquareRoot(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ unsigned long _rv;
+ wide src;
+#ifndef CompSquareRoot
+ PyMac_PRECHECK(CompSquareRoot);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_Getwide, &src))
+ return NULL;
+ _rv = CompSquareRoot(&src);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_FixMulDiv(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Fixed _rv;
+ Fixed src;
+ Fixed mul;
+ Fixed divisor;
+#ifndef FixMulDiv
+ PyMac_PRECHECK(FixMulDiv);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ PyMac_GetFixed, &src,
+ PyMac_GetFixed, &mul,
+ PyMac_GetFixed, &divisor))
+ return NULL;
+ _rv = FixMulDiv(src,
+ mul,
+ divisor);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildFixed, _rv);
+ return _res;
+}
+
+static PyObject *Qt_UnsignedFixMulDiv(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Fixed _rv;
+ Fixed src;
+ Fixed mul;
+ Fixed divisor;
+#ifndef UnsignedFixMulDiv
+ PyMac_PRECHECK(UnsignedFixMulDiv);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ PyMac_GetFixed, &src,
+ PyMac_GetFixed, &mul,
+ PyMac_GetFixed, &divisor))
+ return NULL;
+ _rv = UnsignedFixMulDiv(src,
+ mul,
+ divisor);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildFixed, _rv);
+ return _res;
+}
+
+static PyObject *Qt_FixExp2(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Fixed _rv;
+ Fixed src;
+#ifndef FixExp2
+ PyMac_PRECHECK(FixExp2);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetFixed, &src))
+ return NULL;
+ _rv = FixExp2(src);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildFixed, _rv);
+ return _res;
+}
+
+static PyObject *Qt_FixLog2(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Fixed _rv;
+ Fixed src;
+#ifndef FixLog2
+ PyMac_PRECHECK(FixLog2);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetFixed, &src))
+ return NULL;
+ _rv = FixLog2(src);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildFixed, _rv);
+ return _res;
+}
+
+static PyObject *Qt_FixPow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Fixed _rv;
+ Fixed base;
+ Fixed exp;
+#ifndef FixPow
+ PyMac_PRECHECK(FixPow);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetFixed, &base,
+ PyMac_GetFixed, &exp))
+ return NULL;
+ _rv = FixPow(base,
+ exp);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildFixed, _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportSetDataReference(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ Handle dataRef;
+ OSType dataReType;
+#ifndef GraphicsImportSetDataReference
+ PyMac_PRECHECK(GraphicsImportSetDataReference);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CmpInstObj_Convert, &ci,
+ ResObj_Convert, &dataRef,
+ PyMac_GetOSType, &dataReType))
+ return NULL;
+ _rv = GraphicsImportSetDataReference(ci,
+ dataRef,
+ dataReType);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportGetDataReference(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ Handle dataRef;
+ OSType dataReType;
+#ifndef GraphicsImportGetDataReference
+ PyMac_PRECHECK(GraphicsImportGetDataReference);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsImportGetDataReference(ci,
+ &dataRef,
+ &dataReType);
+ _res = Py_BuildValue("lO&O&",
+ _rv,
+ ResObj_New, dataRef,
+ PyMac_BuildOSType, dataReType);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportSetDataFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ FSSpec theFile;
+#ifndef GraphicsImportSetDataFile
+ PyMac_PRECHECK(GraphicsImportSetDataFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &ci,
+ PyMac_GetFSSpec, &theFile))
+ return NULL;
+ _rv = GraphicsImportSetDataFile(ci,
+ &theFile);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportGetDataFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ FSSpec theFile;
+#ifndef GraphicsImportGetDataFile
+ PyMac_PRECHECK(GraphicsImportGetDataFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &ci,
+ PyMac_GetFSSpec, &theFile))
+ return NULL;
+ _rv = GraphicsImportGetDataFile(ci,
+ &theFile);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportSetDataHandle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ Handle h;
+#ifndef GraphicsImportSetDataHandle
+ PyMac_PRECHECK(GraphicsImportSetDataHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &ci,
+ ResObj_Convert, &h))
+ return NULL;
+ _rv = GraphicsImportSetDataHandle(ci,
+ h);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportGetDataHandle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ Handle h;
+#ifndef GraphicsImportGetDataHandle
+ PyMac_PRECHECK(GraphicsImportGetDataHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsImportGetDataHandle(ci,
+ &h);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, h);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportGetImageDescription(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ ImageDescriptionHandle desc;
+#ifndef GraphicsImportGetImageDescription
+ PyMac_PRECHECK(GraphicsImportGetImageDescription);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsImportGetImageDescription(ci,
+ &desc);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, desc);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportGetDataOffsetAndSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ unsigned long offset;
+ unsigned long size;
+#ifndef GraphicsImportGetDataOffsetAndSize
+ PyMac_PRECHECK(GraphicsImportGetDataOffsetAndSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsImportGetDataOffsetAndSize(ci,
+ &offset,
+ &size);
+ _res = Py_BuildValue("lll",
+ _rv,
+ offset,
+ size);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportReadData(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ void * dataPtr;
+ unsigned long dataOffset;
+ unsigned long dataSize;
+#ifndef GraphicsImportReadData
+ PyMac_PRECHECK(GraphicsImportReadData);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&sll",
+ CmpInstObj_Convert, &ci,
+ &dataPtr,
+ &dataOffset,
+ &dataSize))
+ return NULL;
+ _rv = GraphicsImportReadData(ci,
+ dataPtr,
+ dataOffset,
+ dataSize);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportSetClip(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ RgnHandle clipRgn;
+#ifndef GraphicsImportSetClip
+ PyMac_PRECHECK(GraphicsImportSetClip);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &ci,
+ ResObj_Convert, &clipRgn))
+ return NULL;
+ _rv = GraphicsImportSetClip(ci,
+ clipRgn);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportGetClip(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ RgnHandle clipRgn;
+#ifndef GraphicsImportGetClip
+ PyMac_PRECHECK(GraphicsImportGetClip);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsImportGetClip(ci,
+ &clipRgn);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, clipRgn);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportSetSourceRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ Rect sourceRect;
+#ifndef GraphicsImportSetSourceRect
+ PyMac_PRECHECK(GraphicsImportSetSourceRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &ci,
+ PyMac_GetRect, &sourceRect))
+ return NULL;
+ _rv = GraphicsImportSetSourceRect(ci,
+ &sourceRect);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportGetSourceRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ Rect sourceRect;
+#ifndef GraphicsImportGetSourceRect
+ PyMac_PRECHECK(GraphicsImportGetSourceRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsImportGetSourceRect(ci,
+ &sourceRect);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildRect, &sourceRect);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportGetNaturalBounds(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ Rect naturalBounds;
+#ifndef GraphicsImportGetNaturalBounds
+ PyMac_PRECHECK(GraphicsImportGetNaturalBounds);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsImportGetNaturalBounds(ci,
+ &naturalBounds);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildRect, &naturalBounds);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportDraw(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+#ifndef GraphicsImportDraw
+ PyMac_PRECHECK(GraphicsImportDraw);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsImportDraw(ci);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportSetGWorld(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ CGrafPtr port;
+ GDHandle gd;
+#ifndef GraphicsImportSetGWorld
+ PyMac_PRECHECK(GraphicsImportSetGWorld);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CmpInstObj_Convert, &ci,
+ GrafObj_Convert, &port,
+ OptResObj_Convert, &gd))
+ return NULL;
+ _rv = GraphicsImportSetGWorld(ci,
+ port,
+ gd);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportGetGWorld(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ CGrafPtr port;
+ GDHandle gd;
+#ifndef GraphicsImportGetGWorld
+ PyMac_PRECHECK(GraphicsImportGetGWorld);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsImportGetGWorld(ci,
+ &port,
+ &gd);
+ _res = Py_BuildValue("lO&O&",
+ _rv,
+ GrafObj_New, port,
+ OptResObj_New, gd);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportSetBoundsRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ Rect bounds;
+#ifndef GraphicsImportSetBoundsRect
+ PyMac_PRECHECK(GraphicsImportSetBoundsRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &ci,
+ PyMac_GetRect, &bounds))
+ return NULL;
+ _rv = GraphicsImportSetBoundsRect(ci,
+ &bounds);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportGetBoundsRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ Rect bounds;
+#ifndef GraphicsImportGetBoundsRect
+ PyMac_PRECHECK(GraphicsImportGetBoundsRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsImportGetBoundsRect(ci,
+ &bounds);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildRect, &bounds);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportSaveAsPicture(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ FSSpec fss;
+ ScriptCode scriptTag;
+#ifndef GraphicsImportSaveAsPicture
+ PyMac_PRECHECK(GraphicsImportSaveAsPicture);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&h",
+ CmpInstObj_Convert, &ci,
+ PyMac_GetFSSpec, &fss,
+ &scriptTag))
+ return NULL;
+ _rv = GraphicsImportSaveAsPicture(ci,
+ &fss,
+ scriptTag);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportSetGraphicsMode(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ long graphicsMode;
+ RGBColor opColor;
+#ifndef GraphicsImportSetGraphicsMode
+ PyMac_PRECHECK(GraphicsImportSetGraphicsMode);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lO&",
+ CmpInstObj_Convert, &ci,
+ &graphicsMode,
+ QdRGB_Convert, &opColor))
+ return NULL;
+ _rv = GraphicsImportSetGraphicsMode(ci,
+ graphicsMode,
+ &opColor);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportGetGraphicsMode(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ long graphicsMode;
+ RGBColor opColor;
+#ifndef GraphicsImportGetGraphicsMode
+ PyMac_PRECHECK(GraphicsImportGetGraphicsMode);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsImportGetGraphicsMode(ci,
+ &graphicsMode,
+ &opColor);
+ _res = Py_BuildValue("llO&",
+ _rv,
+ graphicsMode,
+ QdRGB_New, &opColor);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportSetQuality(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ CodecQ quality;
+#ifndef GraphicsImportSetQuality
+ PyMac_PRECHECK(GraphicsImportSetQuality);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &ci,
+ &quality))
+ return NULL;
+ _rv = GraphicsImportSetQuality(ci,
+ quality);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportGetQuality(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ CodecQ quality;
+#ifndef GraphicsImportGetQuality
+ PyMac_PRECHECK(GraphicsImportGetQuality);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsImportGetQuality(ci,
+ &quality);
+ _res = Py_BuildValue("ll",
+ _rv,
+ quality);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportSaveAsQuickTimeImageFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ FSSpec fss;
+ ScriptCode scriptTag;
+#ifndef GraphicsImportSaveAsQuickTimeImageFile
+ PyMac_PRECHECK(GraphicsImportSaveAsQuickTimeImageFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&h",
+ CmpInstObj_Convert, &ci,
+ PyMac_GetFSSpec, &fss,
+ &scriptTag))
+ return NULL;
+ _rv = GraphicsImportSaveAsQuickTimeImageFile(ci,
+ &fss,
+ scriptTag);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportSetDataReferenceOffsetAndLimit(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ unsigned long offset;
+ unsigned long limit;
+#ifndef GraphicsImportSetDataReferenceOffsetAndLimit
+ PyMac_PRECHECK(GraphicsImportSetDataReferenceOffsetAndLimit);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ CmpInstObj_Convert, &ci,
+ &offset,
+ &limit))
+ return NULL;
+ _rv = GraphicsImportSetDataReferenceOffsetAndLimit(ci,
+ offset,
+ limit);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportGetDataReferenceOffsetAndLimit(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ unsigned long offset;
+ unsigned long limit;
+#ifndef GraphicsImportGetDataReferenceOffsetAndLimit
+ PyMac_PRECHECK(GraphicsImportGetDataReferenceOffsetAndLimit);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsImportGetDataReferenceOffsetAndLimit(ci,
+ &offset,
+ &limit);
+ _res = Py_BuildValue("lll",
+ _rv,
+ offset,
+ limit);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportGetAliasedDataReference(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ Handle dataRef;
+ OSType dataRefType;
+#ifndef GraphicsImportGetAliasedDataReference
+ PyMac_PRECHECK(GraphicsImportGetAliasedDataReference);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsImportGetAliasedDataReference(ci,
+ &dataRef,
+ &dataRefType);
+ _res = Py_BuildValue("lO&O&",
+ _rv,
+ ResObj_New, dataRef,
+ PyMac_BuildOSType, dataRefType);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportValidate(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ Boolean valid;
+#ifndef GraphicsImportValidate
+ PyMac_PRECHECK(GraphicsImportValidate);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsImportValidate(ci,
+ &valid);
+ _res = Py_BuildValue("lb",
+ _rv,
+ valid);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportGetMetaData(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ void * userData;
+#ifndef GraphicsImportGetMetaData
+ PyMac_PRECHECK(GraphicsImportGetMetaData);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&s",
+ CmpInstObj_Convert, &ci,
+ &userData))
+ return NULL;
+ _rv = GraphicsImportGetMetaData(ci,
+ userData);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportGetMIMETypeList(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ void * qtAtomContainerPtr;
+#ifndef GraphicsImportGetMIMETypeList
+ PyMac_PRECHECK(GraphicsImportGetMIMETypeList);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&s",
+ CmpInstObj_Convert, &ci,
+ &qtAtomContainerPtr))
+ return NULL;
+ _rv = GraphicsImportGetMIMETypeList(ci,
+ qtAtomContainerPtr);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportDoesDrawAllPixels(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ short drawsAllPixels;
+#ifndef GraphicsImportDoesDrawAllPixels
+ PyMac_PRECHECK(GraphicsImportDoesDrawAllPixels);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsImportDoesDrawAllPixels(ci,
+ &drawsAllPixels);
+ _res = Py_BuildValue("lh",
+ _rv,
+ drawsAllPixels);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportGetAsPicture(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ PicHandle picture;
+#ifndef GraphicsImportGetAsPicture
+ PyMac_PRECHECK(GraphicsImportGetAsPicture);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsImportGetAsPicture(ci,
+ &picture);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, picture);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportExportImageFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ OSType fileType;
+ OSType fileCreator;
+ FSSpec fss;
+ ScriptCode scriptTag;
+#ifndef GraphicsImportExportImageFile
+ PyMac_PRECHECK(GraphicsImportExportImageFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&h",
+ CmpInstObj_Convert, &ci,
+ PyMac_GetOSType, &fileType,
+ PyMac_GetOSType, &fileCreator,
+ PyMac_GetFSSpec, &fss,
+ &scriptTag))
+ return NULL;
+ _rv = GraphicsImportExportImageFile(ci,
+ fileType,
+ fileCreator,
+ &fss,
+ scriptTag);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportGetExportImageTypeList(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ void * qtAtomContainerPtr;
+#ifndef GraphicsImportGetExportImageTypeList
+ PyMac_PRECHECK(GraphicsImportGetExportImageTypeList);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&s",
+ CmpInstObj_Convert, &ci,
+ &qtAtomContainerPtr))
+ return NULL;
+ _rv = GraphicsImportGetExportImageTypeList(ci,
+ qtAtomContainerPtr);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportGetExportSettingsAsAtomContainer(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ void * qtAtomContainerPtr;
+#ifndef GraphicsImportGetExportSettingsAsAtomContainer
+ PyMac_PRECHECK(GraphicsImportGetExportSettingsAsAtomContainer);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&s",
+ CmpInstObj_Convert, &ci,
+ &qtAtomContainerPtr))
+ return NULL;
+ _rv = GraphicsImportGetExportSettingsAsAtomContainer(ci,
+ qtAtomContainerPtr);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportSetExportSettingsFromAtomContainer(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ void * qtAtomContainer;
+#ifndef GraphicsImportSetExportSettingsFromAtomContainer
+ PyMac_PRECHECK(GraphicsImportSetExportSettingsFromAtomContainer);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&s",
+ CmpInstObj_Convert, &ci,
+ &qtAtomContainer))
+ return NULL;
+ _rv = GraphicsImportSetExportSettingsFromAtomContainer(ci,
+ qtAtomContainer);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportGetImageCount(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ unsigned long imageCount;
+#ifndef GraphicsImportGetImageCount
+ PyMac_PRECHECK(GraphicsImportGetImageCount);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsImportGetImageCount(ci,
+ &imageCount);
+ _res = Py_BuildValue("ll",
+ _rv,
+ imageCount);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportSetImageIndex(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ unsigned long imageIndex;
+#ifndef GraphicsImportSetImageIndex
+ PyMac_PRECHECK(GraphicsImportSetImageIndex);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &ci,
+ &imageIndex))
+ return NULL;
+ _rv = GraphicsImportSetImageIndex(ci,
+ imageIndex);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportGetImageIndex(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ unsigned long imageIndex;
+#ifndef GraphicsImportGetImageIndex
+ PyMac_PRECHECK(GraphicsImportGetImageIndex);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsImportGetImageIndex(ci,
+ &imageIndex);
+ _res = Py_BuildValue("ll",
+ _rv,
+ imageIndex);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportGetDataOffsetAndSize64(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ wide offset;
+ wide size;
+#ifndef GraphicsImportGetDataOffsetAndSize64
+ PyMac_PRECHECK(GraphicsImportGetDataOffsetAndSize64);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsImportGetDataOffsetAndSize64(ci,
+ &offset,
+ &size);
+ _res = Py_BuildValue("lO&O&",
+ _rv,
+ PyMac_Buildwide, offset,
+ PyMac_Buildwide, size);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportReadData64(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ void * dataPtr;
+ wide dataOffset;
+ unsigned long dataSize;
+#ifndef GraphicsImportReadData64
+ PyMac_PRECHECK(GraphicsImportReadData64);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&sO&l",
+ CmpInstObj_Convert, &ci,
+ &dataPtr,
+ PyMac_Getwide, &dataOffset,
+ &dataSize))
+ return NULL;
+ _rv = GraphicsImportReadData64(ci,
+ dataPtr,
+ &dataOffset,
+ dataSize);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportSetDataReferenceOffsetAndLimit64(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ wide offset;
+ wide limit;
+#ifndef GraphicsImportSetDataReferenceOffsetAndLimit64
+ PyMac_PRECHECK(GraphicsImportSetDataReferenceOffsetAndLimit64);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CmpInstObj_Convert, &ci,
+ PyMac_Getwide, &offset,
+ PyMac_Getwide, &limit))
+ return NULL;
+ _rv = GraphicsImportSetDataReferenceOffsetAndLimit64(ci,
+ &offset,
+ &limit);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportGetDataReferenceOffsetAndLimit64(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ wide offset;
+ wide limit;
+#ifndef GraphicsImportGetDataReferenceOffsetAndLimit64
+ PyMac_PRECHECK(GraphicsImportGetDataReferenceOffsetAndLimit64);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsImportGetDataReferenceOffsetAndLimit64(ci,
+ &offset,
+ &limit);
+ _res = Py_BuildValue("lO&O&",
+ _rv,
+ PyMac_Buildwide, offset,
+ PyMac_Buildwide, limit);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportGetDefaultClip(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ RgnHandle defaultRgn;
+#ifndef GraphicsImportGetDefaultClip
+ PyMac_PRECHECK(GraphicsImportGetDefaultClip);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsImportGetDefaultClip(ci,
+ &defaultRgn);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, defaultRgn);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportGetDefaultGraphicsMode(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ long defaultGraphicsMode;
+ RGBColor defaultOpColor;
+#ifndef GraphicsImportGetDefaultGraphicsMode
+ PyMac_PRECHECK(GraphicsImportGetDefaultGraphicsMode);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsImportGetDefaultGraphicsMode(ci,
+ &defaultGraphicsMode,
+ &defaultOpColor);
+ _res = Py_BuildValue("llO&",
+ _rv,
+ defaultGraphicsMode,
+ QdRGB_New, &defaultOpColor);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportGetDefaultSourceRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ Rect defaultSourceRect;
+#ifndef GraphicsImportGetDefaultSourceRect
+ PyMac_PRECHECK(GraphicsImportGetDefaultSourceRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsImportGetDefaultSourceRect(ci,
+ &defaultSourceRect);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildRect, &defaultSourceRect);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportGetColorSyncProfile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ Handle profile;
+#ifndef GraphicsImportGetColorSyncProfile
+ PyMac_PRECHECK(GraphicsImportGetColorSyncProfile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsImportGetColorSyncProfile(ci,
+ &profile);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, profile);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportSetDestRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ Rect destRect;
+#ifndef GraphicsImportSetDestRect
+ PyMac_PRECHECK(GraphicsImportSetDestRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &ci,
+ PyMac_GetRect, &destRect))
+ return NULL;
+ _rv = GraphicsImportSetDestRect(ci,
+ &destRect);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportGetDestRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ Rect destRect;
+#ifndef GraphicsImportGetDestRect
+ PyMac_PRECHECK(GraphicsImportGetDestRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsImportGetDestRect(ci,
+ &destRect);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildRect, &destRect);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportSetFlags(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ long flags;
+#ifndef GraphicsImportSetFlags
+ PyMac_PRECHECK(GraphicsImportSetFlags);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &ci,
+ &flags))
+ return NULL;
+ _rv = GraphicsImportSetFlags(ci,
+ flags);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportGetFlags(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ long flags;
+#ifndef GraphicsImportGetFlags
+ PyMac_PRECHECK(GraphicsImportGetFlags);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsImportGetFlags(ci,
+ &flags);
+ _res = Py_BuildValue("ll",
+ _rv,
+ flags);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportGetBaseDataOffsetAndSize64(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+ wide offset;
+ wide size;
+#ifndef GraphicsImportGetBaseDataOffsetAndSize64
+ PyMac_PRECHECK(GraphicsImportGetBaseDataOffsetAndSize64);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsImportGetBaseDataOffsetAndSize64(ci,
+ &offset,
+ &size);
+ _res = Py_BuildValue("lO&O&",
+ _rv,
+ PyMac_Buildwide, offset,
+ PyMac_Buildwide, size);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImportSetImageIndexToThumbnail(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsImportComponent ci;
+#ifndef GraphicsImportSetImageIndexToThumbnail
+ PyMac_PRECHECK(GraphicsImportSetImageIndexToThumbnail);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsImportSetImageIndexToThumbnail(ci);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportDoExport(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ unsigned long actualSizeWritten;
+#ifndef GraphicsExportDoExport
+ PyMac_PRECHECK(GraphicsExportDoExport);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsExportDoExport(ci,
+ &actualSizeWritten);
+ _res = Py_BuildValue("ll",
+ _rv,
+ actualSizeWritten);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportCanTranscode(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ Boolean canTranscode;
+#ifndef GraphicsExportCanTranscode
+ PyMac_PRECHECK(GraphicsExportCanTranscode);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsExportCanTranscode(ci,
+ &canTranscode);
+ _res = Py_BuildValue("lb",
+ _rv,
+ canTranscode);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportDoTranscode(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+#ifndef GraphicsExportDoTranscode
+ PyMac_PRECHECK(GraphicsExportDoTranscode);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsExportDoTranscode(ci);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportCanUseCompressor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ Boolean canUseCompressor;
+ void * codecSettingsAtomContainerPtr;
+#ifndef GraphicsExportCanUseCompressor
+ PyMac_PRECHECK(GraphicsExportCanUseCompressor);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&s",
+ CmpInstObj_Convert, &ci,
+ &codecSettingsAtomContainerPtr))
+ return NULL;
+ _rv = GraphicsExportCanUseCompressor(ci,
+ &canUseCompressor,
+ codecSettingsAtomContainerPtr);
+ _res = Py_BuildValue("lb",
+ _rv,
+ canUseCompressor);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportDoUseCompressor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ void * codecSettingsAtomContainer;
+ ImageDescriptionHandle outDesc;
+#ifndef GraphicsExportDoUseCompressor
+ PyMac_PRECHECK(GraphicsExportDoUseCompressor);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&s",
+ CmpInstObj_Convert, &ci,
+ &codecSettingsAtomContainer))
+ return NULL;
+ _rv = GraphicsExportDoUseCompressor(ci,
+ codecSettingsAtomContainer,
+ &outDesc);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, outDesc);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportDoStandaloneExport(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+#ifndef GraphicsExportDoStandaloneExport
+ PyMac_PRECHECK(GraphicsExportDoStandaloneExport);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsExportDoStandaloneExport(ci);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportGetDefaultFileTypeAndCreator(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ OSType fileType;
+ OSType fileCreator;
+#ifndef GraphicsExportGetDefaultFileTypeAndCreator
+ PyMac_PRECHECK(GraphicsExportGetDefaultFileTypeAndCreator);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsExportGetDefaultFileTypeAndCreator(ci,
+ &fileType,
+ &fileCreator);
+ _res = Py_BuildValue("lO&O&",
+ _rv,
+ PyMac_BuildOSType, fileType,
+ PyMac_BuildOSType, fileCreator);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportGetDefaultFileNameExtension(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ OSType fileNameExtension;
+#ifndef GraphicsExportGetDefaultFileNameExtension
+ PyMac_PRECHECK(GraphicsExportGetDefaultFileNameExtension);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsExportGetDefaultFileNameExtension(ci,
+ &fileNameExtension);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildOSType, fileNameExtension);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportGetMIMETypeList(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ void * qtAtomContainerPtr;
+#ifndef GraphicsExportGetMIMETypeList
+ PyMac_PRECHECK(GraphicsExportGetMIMETypeList);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&s",
+ CmpInstObj_Convert, &ci,
+ &qtAtomContainerPtr))
+ return NULL;
+ _rv = GraphicsExportGetMIMETypeList(ci,
+ qtAtomContainerPtr);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportSetSettingsFromAtomContainer(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ void * qtAtomContainer;
+#ifndef GraphicsExportSetSettingsFromAtomContainer
+ PyMac_PRECHECK(GraphicsExportSetSettingsFromAtomContainer);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&s",
+ CmpInstObj_Convert, &ci,
+ &qtAtomContainer))
+ return NULL;
+ _rv = GraphicsExportSetSettingsFromAtomContainer(ci,
+ qtAtomContainer);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportGetSettingsAsAtomContainer(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ void * qtAtomContainerPtr;
+#ifndef GraphicsExportGetSettingsAsAtomContainer
+ PyMac_PRECHECK(GraphicsExportGetSettingsAsAtomContainer);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&s",
+ CmpInstObj_Convert, &ci,
+ &qtAtomContainerPtr))
+ return NULL;
+ _rv = GraphicsExportGetSettingsAsAtomContainer(ci,
+ qtAtomContainerPtr);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportGetSettingsAsText(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ Handle theText;
+#ifndef GraphicsExportGetSettingsAsText
+ PyMac_PRECHECK(GraphicsExportGetSettingsAsText);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsExportGetSettingsAsText(ci,
+ &theText);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, theText);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportSetDontRecompress(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ Boolean dontRecompress;
+#ifndef GraphicsExportSetDontRecompress
+ PyMac_PRECHECK(GraphicsExportSetDontRecompress);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&b",
+ CmpInstObj_Convert, &ci,
+ &dontRecompress))
+ return NULL;
+ _rv = GraphicsExportSetDontRecompress(ci,
+ dontRecompress);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportGetDontRecompress(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ Boolean dontRecompress;
+#ifndef GraphicsExportGetDontRecompress
+ PyMac_PRECHECK(GraphicsExportGetDontRecompress);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsExportGetDontRecompress(ci,
+ &dontRecompress);
+ _res = Py_BuildValue("lb",
+ _rv,
+ dontRecompress);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportSetInterlaceStyle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ unsigned long interlaceStyle;
+#ifndef GraphicsExportSetInterlaceStyle
+ PyMac_PRECHECK(GraphicsExportSetInterlaceStyle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &ci,
+ &interlaceStyle))
+ return NULL;
+ _rv = GraphicsExportSetInterlaceStyle(ci,
+ interlaceStyle);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportGetInterlaceStyle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ unsigned long interlaceStyle;
+#ifndef GraphicsExportGetInterlaceStyle
+ PyMac_PRECHECK(GraphicsExportGetInterlaceStyle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsExportGetInterlaceStyle(ci,
+ &interlaceStyle);
+ _res = Py_BuildValue("ll",
+ _rv,
+ interlaceStyle);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportSetMetaData(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ void * userData;
+#ifndef GraphicsExportSetMetaData
+ PyMac_PRECHECK(GraphicsExportSetMetaData);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&s",
+ CmpInstObj_Convert, &ci,
+ &userData))
+ return NULL;
+ _rv = GraphicsExportSetMetaData(ci,
+ userData);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportGetMetaData(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ void * userData;
+#ifndef GraphicsExportGetMetaData
+ PyMac_PRECHECK(GraphicsExportGetMetaData);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&s",
+ CmpInstObj_Convert, &ci,
+ &userData))
+ return NULL;
+ _rv = GraphicsExportGetMetaData(ci,
+ userData);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportSetTargetDataSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ unsigned long targetDataSize;
+#ifndef GraphicsExportSetTargetDataSize
+ PyMac_PRECHECK(GraphicsExportSetTargetDataSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &ci,
+ &targetDataSize))
+ return NULL;
+ _rv = GraphicsExportSetTargetDataSize(ci,
+ targetDataSize);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportGetTargetDataSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ unsigned long targetDataSize;
+#ifndef GraphicsExportGetTargetDataSize
+ PyMac_PRECHECK(GraphicsExportGetTargetDataSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsExportGetTargetDataSize(ci,
+ &targetDataSize);
+ _res = Py_BuildValue("ll",
+ _rv,
+ targetDataSize);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportSetCompressionMethod(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ long compressionMethod;
+#ifndef GraphicsExportSetCompressionMethod
+ PyMac_PRECHECK(GraphicsExportSetCompressionMethod);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &ci,
+ &compressionMethod))
+ return NULL;
+ _rv = GraphicsExportSetCompressionMethod(ci,
+ compressionMethod);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportGetCompressionMethod(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ long compressionMethod;
+#ifndef GraphicsExportGetCompressionMethod
+ PyMac_PRECHECK(GraphicsExportGetCompressionMethod);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsExportGetCompressionMethod(ci,
+ &compressionMethod);
+ _res = Py_BuildValue("ll",
+ _rv,
+ compressionMethod);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportSetCompressionQuality(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ CodecQ spatialQuality;
+#ifndef GraphicsExportSetCompressionQuality
+ PyMac_PRECHECK(GraphicsExportSetCompressionQuality);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &ci,
+ &spatialQuality))
+ return NULL;
+ _rv = GraphicsExportSetCompressionQuality(ci,
+ spatialQuality);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportGetCompressionQuality(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ CodecQ spatialQuality;
+#ifndef GraphicsExportGetCompressionQuality
+ PyMac_PRECHECK(GraphicsExportGetCompressionQuality);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsExportGetCompressionQuality(ci,
+ &spatialQuality);
+ _res = Py_BuildValue("ll",
+ _rv,
+ spatialQuality);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportSetResolution(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ Fixed horizontalResolution;
+ Fixed verticalResolution;
+#ifndef GraphicsExportSetResolution
+ PyMac_PRECHECK(GraphicsExportSetResolution);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CmpInstObj_Convert, &ci,
+ PyMac_GetFixed, &horizontalResolution,
+ PyMac_GetFixed, &verticalResolution))
+ return NULL;
+ _rv = GraphicsExportSetResolution(ci,
+ horizontalResolution,
+ verticalResolution);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportGetResolution(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ Fixed horizontalResolution;
+ Fixed verticalResolution;
+#ifndef GraphicsExportGetResolution
+ PyMac_PRECHECK(GraphicsExportGetResolution);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsExportGetResolution(ci,
+ &horizontalResolution,
+ &verticalResolution);
+ _res = Py_BuildValue("lO&O&",
+ _rv,
+ PyMac_BuildFixed, horizontalResolution,
+ PyMac_BuildFixed, verticalResolution);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportSetDepth(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ long depth;
+#ifndef GraphicsExportSetDepth
+ PyMac_PRECHECK(GraphicsExportSetDepth);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &ci,
+ &depth))
+ return NULL;
+ _rv = GraphicsExportSetDepth(ci,
+ depth);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportGetDepth(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ long depth;
+#ifndef GraphicsExportGetDepth
+ PyMac_PRECHECK(GraphicsExportGetDepth);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsExportGetDepth(ci,
+ &depth);
+ _res = Py_BuildValue("ll",
+ _rv,
+ depth);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportSetColorSyncProfile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ Handle colorSyncProfile;
+#ifndef GraphicsExportSetColorSyncProfile
+ PyMac_PRECHECK(GraphicsExportSetColorSyncProfile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &ci,
+ ResObj_Convert, &colorSyncProfile))
+ return NULL;
+ _rv = GraphicsExportSetColorSyncProfile(ci,
+ colorSyncProfile);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportGetColorSyncProfile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ Handle colorSyncProfile;
+#ifndef GraphicsExportGetColorSyncProfile
+ PyMac_PRECHECK(GraphicsExportGetColorSyncProfile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsExportGetColorSyncProfile(ci,
+ &colorSyncProfile);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, colorSyncProfile);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportSetInputDataReference(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ Handle dataRef;
+ OSType dataRefType;
+ ImageDescriptionHandle desc;
+#ifndef GraphicsExportSetInputDataReference
+ PyMac_PRECHECK(GraphicsExportSetInputDataReference);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&",
+ CmpInstObj_Convert, &ci,
+ ResObj_Convert, &dataRef,
+ PyMac_GetOSType, &dataRefType,
+ ResObj_Convert, &desc))
+ return NULL;
+ _rv = GraphicsExportSetInputDataReference(ci,
+ dataRef,
+ dataRefType,
+ desc);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportGetInputDataReference(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ Handle dataRef;
+ OSType dataRefType;
+#ifndef GraphicsExportGetInputDataReference
+ PyMac_PRECHECK(GraphicsExportGetInputDataReference);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsExportGetInputDataReference(ci,
+ &dataRef,
+ &dataRefType);
+ _res = Py_BuildValue("lO&O&",
+ _rv,
+ ResObj_New, dataRef,
+ PyMac_BuildOSType, dataRefType);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportSetInputFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ FSSpec theFile;
+ ImageDescriptionHandle desc;
+#ifndef GraphicsExportSetInputFile
+ PyMac_PRECHECK(GraphicsExportSetInputFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CmpInstObj_Convert, &ci,
+ PyMac_GetFSSpec, &theFile,
+ ResObj_Convert, &desc))
+ return NULL;
+ _rv = GraphicsExportSetInputFile(ci,
+ &theFile,
+ desc);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportGetInputFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ FSSpec theFile;
+#ifndef GraphicsExportGetInputFile
+ PyMac_PRECHECK(GraphicsExportGetInputFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &ci,
+ PyMac_GetFSSpec, &theFile))
+ return NULL;
+ _rv = GraphicsExportGetInputFile(ci,
+ &theFile);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportSetInputHandle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ Handle h;
+ ImageDescriptionHandle desc;
+#ifndef GraphicsExportSetInputHandle
+ PyMac_PRECHECK(GraphicsExportSetInputHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CmpInstObj_Convert, &ci,
+ ResObj_Convert, &h,
+ ResObj_Convert, &desc))
+ return NULL;
+ _rv = GraphicsExportSetInputHandle(ci,
+ h,
+ desc);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportGetInputHandle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ Handle h;
+#ifndef GraphicsExportGetInputHandle
+ PyMac_PRECHECK(GraphicsExportGetInputHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsExportGetInputHandle(ci,
+ &h);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, h);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportSetInputPtr(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ Ptr p;
+ unsigned long size;
+ ImageDescriptionHandle desc;
+#ifndef GraphicsExportSetInputPtr
+ PyMac_PRECHECK(GraphicsExportSetInputPtr);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&slO&",
+ CmpInstObj_Convert, &ci,
+ &p,
+ &size,
+ ResObj_Convert, &desc))
+ return NULL;
+ _rv = GraphicsExportSetInputPtr(ci,
+ p,
+ size,
+ desc);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportSetInputGraphicsImporter(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ GraphicsImportComponent grip;
+#ifndef GraphicsExportSetInputGraphicsImporter
+ PyMac_PRECHECK(GraphicsExportSetInputGraphicsImporter);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &ci,
+ CmpInstObj_Convert, &grip))
+ return NULL;
+ _rv = GraphicsExportSetInputGraphicsImporter(ci,
+ grip);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportGetInputGraphicsImporter(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ GraphicsImportComponent grip;
+#ifndef GraphicsExportGetInputGraphicsImporter
+ PyMac_PRECHECK(GraphicsExportGetInputGraphicsImporter);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsExportGetInputGraphicsImporter(ci,
+ &grip);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ CmpInstObj_New, grip);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportSetInputPicture(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ PicHandle picture;
+#ifndef GraphicsExportSetInputPicture
+ PyMac_PRECHECK(GraphicsExportSetInputPicture);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &ci,
+ ResObj_Convert, &picture))
+ return NULL;
+ _rv = GraphicsExportSetInputPicture(ci,
+ picture);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportGetInputPicture(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ PicHandle picture;
+#ifndef GraphicsExportGetInputPicture
+ PyMac_PRECHECK(GraphicsExportGetInputPicture);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsExportGetInputPicture(ci,
+ &picture);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, picture);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportSetInputGWorld(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ GWorldPtr gworld;
+#ifndef GraphicsExportSetInputGWorld
+ PyMac_PRECHECK(GraphicsExportSetInputGWorld);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &ci,
+ GWorldObj_Convert, &gworld))
+ return NULL;
+ _rv = GraphicsExportSetInputGWorld(ci,
+ gworld);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportGetInputGWorld(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ GWorldPtr gworld;
+#ifndef GraphicsExportGetInputGWorld
+ PyMac_PRECHECK(GraphicsExportGetInputGWorld);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsExportGetInputGWorld(ci,
+ &gworld);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ GWorldObj_New, gworld);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportSetInputPixmap(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ PixMapHandle pixmap;
+#ifndef GraphicsExportSetInputPixmap
+ PyMac_PRECHECK(GraphicsExportSetInputPixmap);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &ci,
+ ResObj_Convert, &pixmap))
+ return NULL;
+ _rv = GraphicsExportSetInputPixmap(ci,
+ pixmap);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportGetInputPixmap(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ PixMapHandle pixmap;
+#ifndef GraphicsExportGetInputPixmap
+ PyMac_PRECHECK(GraphicsExportGetInputPixmap);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsExportGetInputPixmap(ci,
+ &pixmap);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, pixmap);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportSetInputOffsetAndLimit(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ unsigned long offset;
+ unsigned long limit;
+#ifndef GraphicsExportSetInputOffsetAndLimit
+ PyMac_PRECHECK(GraphicsExportSetInputOffsetAndLimit);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ CmpInstObj_Convert, &ci,
+ &offset,
+ &limit))
+ return NULL;
+ _rv = GraphicsExportSetInputOffsetAndLimit(ci,
+ offset,
+ limit);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportGetInputOffsetAndLimit(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ unsigned long offset;
+ unsigned long limit;
+#ifndef GraphicsExportGetInputOffsetAndLimit
+ PyMac_PRECHECK(GraphicsExportGetInputOffsetAndLimit);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsExportGetInputOffsetAndLimit(ci,
+ &offset,
+ &limit);
+ _res = Py_BuildValue("lll",
+ _rv,
+ offset,
+ limit);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportMayExporterReadInputData(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ Boolean mayReadInputData;
+#ifndef GraphicsExportMayExporterReadInputData
+ PyMac_PRECHECK(GraphicsExportMayExporterReadInputData);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsExportMayExporterReadInputData(ci,
+ &mayReadInputData);
+ _res = Py_BuildValue("lb",
+ _rv,
+ mayReadInputData);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportGetInputDataSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ unsigned long size;
+#ifndef GraphicsExportGetInputDataSize
+ PyMac_PRECHECK(GraphicsExportGetInputDataSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsExportGetInputDataSize(ci,
+ &size);
+ _res = Py_BuildValue("ll",
+ _rv,
+ size);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportReadInputData(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ void * dataPtr;
+ unsigned long dataOffset;
+ unsigned long dataSize;
+#ifndef GraphicsExportReadInputData
+ PyMac_PRECHECK(GraphicsExportReadInputData);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&sll",
+ CmpInstObj_Convert, &ci,
+ &dataPtr,
+ &dataOffset,
+ &dataSize))
+ return NULL;
+ _rv = GraphicsExportReadInputData(ci,
+ dataPtr,
+ dataOffset,
+ dataSize);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportGetInputImageDescription(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ ImageDescriptionHandle desc;
+#ifndef GraphicsExportGetInputImageDescription
+ PyMac_PRECHECK(GraphicsExportGetInputImageDescription);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsExportGetInputImageDescription(ci,
+ &desc);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, desc);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportGetInputImageDimensions(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ Rect dimensions;
+#ifndef GraphicsExportGetInputImageDimensions
+ PyMac_PRECHECK(GraphicsExportGetInputImageDimensions);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsExportGetInputImageDimensions(ci,
+ &dimensions);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildRect, &dimensions);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportGetInputImageDepth(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ long inputDepth;
+#ifndef GraphicsExportGetInputImageDepth
+ PyMac_PRECHECK(GraphicsExportGetInputImageDepth);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsExportGetInputImageDepth(ci,
+ &inputDepth);
+ _res = Py_BuildValue("ll",
+ _rv,
+ inputDepth);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportDrawInputImage(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ CGrafPtr gw;
+ GDHandle gd;
+ Rect srcRect;
+ Rect dstRect;
+#ifndef GraphicsExportDrawInputImage
+ PyMac_PRECHECK(GraphicsExportDrawInputImage);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&O&",
+ CmpInstObj_Convert, &ci,
+ GrafObj_Convert, &gw,
+ OptResObj_Convert, &gd,
+ PyMac_GetRect, &srcRect,
+ PyMac_GetRect, &dstRect))
+ return NULL;
+ _rv = GraphicsExportDrawInputImage(ci,
+ gw,
+ gd,
+ &srcRect,
+ &dstRect);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportSetOutputDataReference(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ Handle dataRef;
+ OSType dataRefType;
+#ifndef GraphicsExportSetOutputDataReference
+ PyMac_PRECHECK(GraphicsExportSetOutputDataReference);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CmpInstObj_Convert, &ci,
+ ResObj_Convert, &dataRef,
+ PyMac_GetOSType, &dataRefType))
+ return NULL;
+ _rv = GraphicsExportSetOutputDataReference(ci,
+ dataRef,
+ dataRefType);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportGetOutputDataReference(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ Handle dataRef;
+ OSType dataRefType;
+#ifndef GraphicsExportGetOutputDataReference
+ PyMac_PRECHECK(GraphicsExportGetOutputDataReference);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsExportGetOutputDataReference(ci,
+ &dataRef,
+ &dataRefType);
+ _res = Py_BuildValue("lO&O&",
+ _rv,
+ ResObj_New, dataRef,
+ PyMac_BuildOSType, dataRefType);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportSetOutputFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ FSSpec theFile;
+#ifndef GraphicsExportSetOutputFile
+ PyMac_PRECHECK(GraphicsExportSetOutputFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &ci,
+ PyMac_GetFSSpec, &theFile))
+ return NULL;
+ _rv = GraphicsExportSetOutputFile(ci,
+ &theFile);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportGetOutputFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ FSSpec theFile;
+#ifndef GraphicsExportGetOutputFile
+ PyMac_PRECHECK(GraphicsExportGetOutputFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &ci,
+ PyMac_GetFSSpec, &theFile))
+ return NULL;
+ _rv = GraphicsExportGetOutputFile(ci,
+ &theFile);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportSetOutputHandle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ Handle h;
+#ifndef GraphicsExportSetOutputHandle
+ PyMac_PRECHECK(GraphicsExportSetOutputHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &ci,
+ ResObj_Convert, &h))
+ return NULL;
+ _rv = GraphicsExportSetOutputHandle(ci,
+ h);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportGetOutputHandle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ Handle h;
+#ifndef GraphicsExportGetOutputHandle
+ PyMac_PRECHECK(GraphicsExportGetOutputHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsExportGetOutputHandle(ci,
+ &h);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, h);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportSetOutputOffsetAndMaxSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ unsigned long offset;
+ unsigned long maxSize;
+ Boolean truncateFile;
+#ifndef GraphicsExportSetOutputOffsetAndMaxSize
+ PyMac_PRECHECK(GraphicsExportSetOutputOffsetAndMaxSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&llb",
+ CmpInstObj_Convert, &ci,
+ &offset,
+ &maxSize,
+ &truncateFile))
+ return NULL;
+ _rv = GraphicsExportSetOutputOffsetAndMaxSize(ci,
+ offset,
+ maxSize,
+ truncateFile);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportGetOutputOffsetAndMaxSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ unsigned long offset;
+ unsigned long maxSize;
+ Boolean truncateFile;
+#ifndef GraphicsExportGetOutputOffsetAndMaxSize
+ PyMac_PRECHECK(GraphicsExportGetOutputOffsetAndMaxSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsExportGetOutputOffsetAndMaxSize(ci,
+ &offset,
+ &maxSize,
+ &truncateFile);
+ _res = Py_BuildValue("lllb",
+ _rv,
+ offset,
+ maxSize,
+ truncateFile);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportSetOutputFileTypeAndCreator(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ OSType fileType;
+ OSType fileCreator;
+#ifndef GraphicsExportSetOutputFileTypeAndCreator
+ PyMac_PRECHECK(GraphicsExportSetOutputFileTypeAndCreator);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CmpInstObj_Convert, &ci,
+ PyMac_GetOSType, &fileType,
+ PyMac_GetOSType, &fileCreator))
+ return NULL;
+ _rv = GraphicsExportSetOutputFileTypeAndCreator(ci,
+ fileType,
+ fileCreator);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportGetOutputFileTypeAndCreator(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ OSType fileType;
+ OSType fileCreator;
+#ifndef GraphicsExportGetOutputFileTypeAndCreator
+ PyMac_PRECHECK(GraphicsExportGetOutputFileTypeAndCreator);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsExportGetOutputFileTypeAndCreator(ci,
+ &fileType,
+ &fileCreator);
+ _res = Py_BuildValue("lO&O&",
+ _rv,
+ PyMac_BuildOSType, fileType,
+ PyMac_BuildOSType, fileCreator);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportSetOutputMark(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ unsigned long mark;
+#ifndef GraphicsExportSetOutputMark
+ PyMac_PRECHECK(GraphicsExportSetOutputMark);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &ci,
+ &mark))
+ return NULL;
+ _rv = GraphicsExportSetOutputMark(ci,
+ mark);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportGetOutputMark(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ unsigned long mark;
+#ifndef GraphicsExportGetOutputMark
+ PyMac_PRECHECK(GraphicsExportGetOutputMark);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsExportGetOutputMark(ci,
+ &mark);
+ _res = Py_BuildValue("ll",
+ _rv,
+ mark);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportReadOutputData(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ void * dataPtr;
+ unsigned long dataOffset;
+ unsigned long dataSize;
+#ifndef GraphicsExportReadOutputData
+ PyMac_PRECHECK(GraphicsExportReadOutputData);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&sll",
+ CmpInstObj_Convert, &ci,
+ &dataPtr,
+ &dataOffset,
+ &dataSize))
+ return NULL;
+ _rv = GraphicsExportReadOutputData(ci,
+ dataPtr,
+ dataOffset,
+ dataSize);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportSetThumbnailEnabled(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ Boolean enableThumbnail;
+ long maxThumbnailWidth;
+ long maxThumbnailHeight;
+#ifndef GraphicsExportSetThumbnailEnabled
+ PyMac_PRECHECK(GraphicsExportSetThumbnailEnabled);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&bll",
+ CmpInstObj_Convert, &ci,
+ &enableThumbnail,
+ &maxThumbnailWidth,
+ &maxThumbnailHeight))
+ return NULL;
+ _rv = GraphicsExportSetThumbnailEnabled(ci,
+ enableThumbnail,
+ maxThumbnailWidth,
+ maxThumbnailHeight);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportGetThumbnailEnabled(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ Boolean thumbnailEnabled;
+ long maxThumbnailWidth;
+ long maxThumbnailHeight;
+#ifndef GraphicsExportGetThumbnailEnabled
+ PyMac_PRECHECK(GraphicsExportGetThumbnailEnabled);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsExportGetThumbnailEnabled(ci,
+ &thumbnailEnabled,
+ &maxThumbnailWidth,
+ &maxThumbnailHeight);
+ _res = Py_BuildValue("lbll",
+ _rv,
+ thumbnailEnabled,
+ maxThumbnailWidth,
+ maxThumbnailHeight);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportSetExifEnabled(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ Boolean enableExif;
+#ifndef GraphicsExportSetExifEnabled
+ PyMac_PRECHECK(GraphicsExportSetExifEnabled);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&b",
+ CmpInstObj_Convert, &ci,
+ &enableExif))
+ return NULL;
+ _rv = GraphicsExportSetExifEnabled(ci,
+ enableExif);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsExportGetExifEnabled(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicsExportComponent ci;
+ Boolean exifEnabled;
+#ifndef GraphicsExportGetExifEnabled
+ PyMac_PRECHECK(GraphicsExportGetExifEnabled);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsExportGetExifEnabled(ci,
+ &exifEnabled);
+ _res = Py_BuildValue("lb",
+ _rv,
+ exifEnabled);
+ return _res;
+}
+
+static PyObject *Qt_ImageTranscoderBeginSequence(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ImageTranscoderComponent itc;
+ ImageDescriptionHandle srcDesc;
+ ImageDescriptionHandle dstDesc;
+ void * data;
+ long dataSize;
+#ifndef ImageTranscoderBeginSequence
+ PyMac_PRECHECK(ImageTranscoderBeginSequence);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&sl",
+ CmpInstObj_Convert, &itc,
+ ResObj_Convert, &srcDesc,
+ &data,
+ &dataSize))
+ return NULL;
+ _rv = ImageTranscoderBeginSequence(itc,
+ srcDesc,
+ &dstDesc,
+ data,
+ dataSize);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, dstDesc);
+ return _res;
+}
+
+static PyObject *Qt_ImageTranscoderDisposeData(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ImageTranscoderComponent itc;
+ void * dstData;
+#ifndef ImageTranscoderDisposeData
+ PyMac_PRECHECK(ImageTranscoderDisposeData);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&s",
+ CmpInstObj_Convert, &itc,
+ &dstData))
+ return NULL;
+ _rv = ImageTranscoderDisposeData(itc,
+ dstData);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_ImageTranscoderEndSequence(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ImageTranscoderComponent itc;
+#ifndef ImageTranscoderEndSequence
+ PyMac_PRECHECK(ImageTranscoderEndSequence);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &itc))
+ return NULL;
+ _rv = ImageTranscoderEndSequence(itc);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_ClockGetTime(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ComponentInstance aClock;
+ TimeRecord out;
+#ifndef ClockGetTime
+ PyMac_PRECHECK(ClockGetTime);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &aClock))
+ return NULL;
+ _rv = ClockGetTime(aClock,
+ &out);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ QtTimeRecord_New, &out);
+ return _res;
+}
+
+static PyObject *Qt_ClockSetTimeBase(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ComponentInstance aClock;
+ TimeBase tb;
+#ifndef ClockSetTimeBase
+ PyMac_PRECHECK(ClockSetTimeBase);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &aClock,
+ TimeBaseObj_Convert, &tb))
+ return NULL;
+ _rv = ClockSetTimeBase(aClock,
+ tb);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_ClockGetRate(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ComponentInstance aClock;
+ Fixed rate;
+#ifndef ClockGetRate
+ PyMac_PRECHECK(ClockGetRate);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &aClock))
+ return NULL;
+ _rv = ClockGetRate(aClock,
+ &rate);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildFixed, rate);
+ return _res;
+}
+
+static PyObject *Qt_SCPositionRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ComponentInstance ci;
+ Rect rp;
+ Point where;
+#ifndef SCPositionRect
+ PyMac_PRECHECK(SCPositionRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = SCPositionRect(ci,
+ &rp,
+ &where);
+ _res = Py_BuildValue("lO&O&",
+ _rv,
+ PyMac_BuildRect, &rp,
+ PyMac_BuildPoint, where);
+ return _res;
+}
+
+static PyObject *Qt_SCPositionDialog(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ComponentInstance ci;
+ short id;
+ Point where;
+#ifndef SCPositionDialog
+ PyMac_PRECHECK(SCPositionDialog);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ CmpInstObj_Convert, &ci,
+ &id))
+ return NULL;
+ _rv = SCPositionDialog(ci,
+ id,
+ &where);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildPoint, where);
+ return _res;
+}
+
+static PyObject *Qt_SCSetTestImagePictHandle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ComponentInstance ci;
+ PicHandle testPict;
+ Rect testRect;
+ short testFlags;
+#ifndef SCSetTestImagePictHandle
+ PyMac_PRECHECK(SCSetTestImagePictHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&h",
+ CmpInstObj_Convert, &ci,
+ ResObj_Convert, &testPict,
+ &testFlags))
+ return NULL;
+ _rv = SCSetTestImagePictHandle(ci,
+ testPict,
+ &testRect,
+ testFlags);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildRect, &testRect);
+ return _res;
+}
+
+static PyObject *Qt_SCSetTestImagePictFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ComponentInstance ci;
+ short testFileRef;
+ Rect testRect;
+ short testFlags;
+#ifndef SCSetTestImagePictFile
+ PyMac_PRECHECK(SCSetTestImagePictFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ CmpInstObj_Convert, &ci,
+ &testFileRef,
+ &testFlags))
+ return NULL;
+ _rv = SCSetTestImagePictFile(ci,
+ testFileRef,
+ &testRect,
+ testFlags);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildRect, &testRect);
+ return _res;
+}
+
+static PyObject *Qt_SCSetTestImagePixMap(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ComponentInstance ci;
+ PixMapHandle testPixMap;
+ Rect testRect;
+ short testFlags;
+#ifndef SCSetTestImagePixMap
+ PyMac_PRECHECK(SCSetTestImagePixMap);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&h",
+ CmpInstObj_Convert, &ci,
+ ResObj_Convert, &testPixMap,
+ &testFlags))
+ return NULL;
+ _rv = SCSetTestImagePixMap(ci,
+ testPixMap,
+ &testRect,
+ testFlags);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildRect, &testRect);
+ return _res;
+}
+
+static PyObject *Qt_SCGetBestDeviceRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ComponentInstance ci;
+ Rect r;
+#ifndef SCGetBestDeviceRect
+ PyMac_PRECHECK(SCGetBestDeviceRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = SCGetBestDeviceRect(ci,
+ &r);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildRect, &r);
+ return _res;
+}
+
+static PyObject *Qt_SCRequestImageSettings(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ComponentInstance ci;
+#ifndef SCRequestImageSettings
+ PyMac_PRECHECK(SCRequestImageSettings);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = SCRequestImageSettings(ci);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SCCompressImage(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ComponentInstance ci;
+ PixMapHandle src;
+ Rect srcRect;
+ ImageDescriptionHandle desc;
+ Handle data;
+#ifndef SCCompressImage
+ PyMac_PRECHECK(SCCompressImage);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CmpInstObj_Convert, &ci,
+ ResObj_Convert, &src,
+ PyMac_GetRect, &srcRect))
+ return NULL;
+ _rv = SCCompressImage(ci,
+ src,
+ &srcRect,
+ &desc,
+ &data);
+ _res = Py_BuildValue("lO&O&",
+ _rv,
+ ResObj_New, desc,
+ ResObj_New, data);
+ return _res;
+}
+
+static PyObject *Qt_SCCompressPicture(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ComponentInstance ci;
+ PicHandle srcPicture;
+ PicHandle dstPicture;
+#ifndef SCCompressPicture
+ PyMac_PRECHECK(SCCompressPicture);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CmpInstObj_Convert, &ci,
+ ResObj_Convert, &srcPicture,
+ ResObj_Convert, &dstPicture))
+ return NULL;
+ _rv = SCCompressPicture(ci,
+ srcPicture,
+ dstPicture);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SCCompressPictureFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ComponentInstance ci;
+ short srcRefNum;
+ short dstRefNum;
+#ifndef SCCompressPictureFile
+ PyMac_PRECHECK(SCCompressPictureFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ CmpInstObj_Convert, &ci,
+ &srcRefNum,
+ &dstRefNum))
+ return NULL;
+ _rv = SCCompressPictureFile(ci,
+ srcRefNum,
+ dstRefNum);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SCRequestSequenceSettings(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ComponentInstance ci;
+#ifndef SCRequestSequenceSettings
+ PyMac_PRECHECK(SCRequestSequenceSettings);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = SCRequestSequenceSettings(ci);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SCCompressSequenceBegin(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ComponentInstance ci;
+ PixMapHandle src;
+ Rect srcRect;
+ ImageDescriptionHandle desc;
+#ifndef SCCompressSequenceBegin
+ PyMac_PRECHECK(SCCompressSequenceBegin);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CmpInstObj_Convert, &ci,
+ ResObj_Convert, &src,
+ PyMac_GetRect, &srcRect))
+ return NULL;
+ _rv = SCCompressSequenceBegin(ci,
+ src,
+ &srcRect,
+ &desc);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, desc);
+ return _res;
+}
+
+static PyObject *Qt_SCCompressSequenceFrame(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ComponentInstance ci;
+ PixMapHandle src;
+ Rect srcRect;
+ Handle data;
+ long dataSize;
+ short notSyncFlag;
+#ifndef SCCompressSequenceFrame
+ PyMac_PRECHECK(SCCompressSequenceFrame);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CmpInstObj_Convert, &ci,
+ ResObj_Convert, &src,
+ PyMac_GetRect, &srcRect))
+ return NULL;
+ _rv = SCCompressSequenceFrame(ci,
+ src,
+ &srcRect,
+ &data,
+ &dataSize,
+ &notSyncFlag);
+ _res = Py_BuildValue("lO&lh",
+ _rv,
+ ResObj_New, data,
+ dataSize,
+ notSyncFlag);
+ return _res;
+}
+
+static PyObject *Qt_SCCompressSequenceEnd(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ComponentInstance ci;
+#ifndef SCCompressSequenceEnd
+ PyMac_PRECHECK(SCCompressSequenceEnd);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = SCCompressSequenceEnd(ci);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SCDefaultPictHandleSettings(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ComponentInstance ci;
+ PicHandle srcPicture;
+ short motion;
+#ifndef SCDefaultPictHandleSettings
+ PyMac_PRECHECK(SCDefaultPictHandleSettings);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&h",
+ CmpInstObj_Convert, &ci,
+ ResObj_Convert, &srcPicture,
+ &motion))
+ return NULL;
+ _rv = SCDefaultPictHandleSettings(ci,
+ srcPicture,
+ motion);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SCDefaultPictFileSettings(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ComponentInstance ci;
+ short srcRef;
+ short motion;
+#ifndef SCDefaultPictFileSettings
+ PyMac_PRECHECK(SCDefaultPictFileSettings);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ CmpInstObj_Convert, &ci,
+ &srcRef,
+ &motion))
+ return NULL;
+ _rv = SCDefaultPictFileSettings(ci,
+ srcRef,
+ motion);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SCDefaultPixMapSettings(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ComponentInstance ci;
+ PixMapHandle src;
+ short motion;
+#ifndef SCDefaultPixMapSettings
+ PyMac_PRECHECK(SCDefaultPixMapSettings);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&h",
+ CmpInstObj_Convert, &ci,
+ ResObj_Convert, &src,
+ &motion))
+ return NULL;
+ _rv = SCDefaultPixMapSettings(ci,
+ src,
+ motion);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SCGetInfo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ComponentInstance ci;
+ OSType infoType;
+ void * info;
+#ifndef SCGetInfo
+ PyMac_PRECHECK(SCGetInfo);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&s",
+ CmpInstObj_Convert, &ci,
+ PyMac_GetOSType, &infoType,
+ &info))
+ return NULL;
+ _rv = SCGetInfo(ci,
+ infoType,
+ info);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SCSetInfo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ComponentInstance ci;
+ OSType infoType;
+ void * info;
+#ifndef SCSetInfo
+ PyMac_PRECHECK(SCSetInfo);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&s",
+ CmpInstObj_Convert, &ci,
+ PyMac_GetOSType, &infoType,
+ &info))
+ return NULL;
+ _rv = SCSetInfo(ci,
+ infoType,
+ info);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SCSetCompressFlags(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ComponentInstance ci;
+ long flags;
+#ifndef SCSetCompressFlags
+ PyMac_PRECHECK(SCSetCompressFlags);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &ci,
+ &flags))
+ return NULL;
+ _rv = SCSetCompressFlags(ci,
+ flags);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SCGetCompressFlags(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ComponentInstance ci;
+ long flags;
+#ifndef SCGetCompressFlags
+ PyMac_PRECHECK(SCGetCompressFlags);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = SCGetCompressFlags(ci,
+ &flags);
+ _res = Py_BuildValue("ll",
+ _rv,
+ flags);
+ return _res;
+}
+
+static PyObject *Qt_SCGetSettingsAsText(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ComponentInstance ci;
+ Handle text;
+#ifndef SCGetSettingsAsText
+ PyMac_PRECHECK(SCGetSettingsAsText);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = SCGetSettingsAsText(ci,
+ &text);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, text);
+ return _res;
+}
+
+static PyObject *Qt_SCAsyncIdle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ComponentInstance ci;
+#ifndef SCAsyncIdle
+ PyMac_PRECHECK(SCAsyncIdle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = SCAsyncIdle(ci);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_TweenerReset(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ TweenerComponent tc;
+#ifndef TweenerReset
+ PyMac_PRECHECK(TweenerReset);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &tc))
+ return NULL;
+ _rv = TweenerReset(tc);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_TCGetSourceRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ HandlerError _rv;
+ MediaHandler mh;
+ TimeCodeDescriptionHandle tcdH;
+ UserData srefH;
+#ifndef TCGetSourceRef
+ PyMac_PRECHECK(TCGetSourceRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &mh,
+ ResObj_Convert, &tcdH))
+ return NULL;
+ _rv = TCGetSourceRef(mh,
+ tcdH,
+ &srefH);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ UserDataObj_New, srefH);
+ return _res;
+}
+
+static PyObject *Qt_TCSetSourceRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ HandlerError _rv;
+ MediaHandler mh;
+ TimeCodeDescriptionHandle tcdH;
+ UserData srefH;
+#ifndef TCSetSourceRef
+ PyMac_PRECHECK(TCSetSourceRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CmpInstObj_Convert, &mh,
+ ResObj_Convert, &tcdH,
+ UserDataObj_Convert, &srefH))
+ return NULL;
+ _rv = TCSetSourceRef(mh,
+ tcdH,
+ srefH);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_TCSetTimeCodeFlags(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ HandlerError _rv;
+ MediaHandler mh;
+ long flags;
+ long flagsMask;
+#ifndef TCSetTimeCodeFlags
+ PyMac_PRECHECK(TCSetTimeCodeFlags);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ CmpInstObj_Convert, &mh,
+ &flags,
+ &flagsMask))
+ return NULL;
+ _rv = TCSetTimeCodeFlags(mh,
+ flags,
+ flagsMask);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_TCGetTimeCodeFlags(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ HandlerError _rv;
+ MediaHandler mh;
+ long flags;
+#ifndef TCGetTimeCodeFlags
+ PyMac_PRECHECK(TCGetTimeCodeFlags);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = TCGetTimeCodeFlags(mh,
+ &flags);
+ _res = Py_BuildValue("ll",
+ _rv,
+ flags);
+ return _res;
+}
+
+static PyObject *Qt_MovieImportHandle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieImportComponent ci;
+ Handle dataH;
+ Movie theMovie;
+ Track targetTrack;
+ Track usedTrack;
+ TimeValue atTime;
+ TimeValue addedDuration;
+ long inFlags;
+ long outFlags;
+#ifndef MovieImportHandle
+ PyMac_PRECHECK(MovieImportHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&ll",
+ CmpInstObj_Convert, &ci,
+ ResObj_Convert, &dataH,
+ MovieObj_Convert, &theMovie,
+ TrackObj_Convert, &targetTrack,
+ &atTime,
+ &inFlags))
+ return NULL;
+ _rv = MovieImportHandle(ci,
+ dataH,
+ theMovie,
+ targetTrack,
+ &usedTrack,
+ atTime,
+ &addedDuration,
+ inFlags,
+ &outFlags);
+ _res = Py_BuildValue("lO&ll",
+ _rv,
+ TrackObj_New, usedTrack,
+ addedDuration,
+ outFlags);
+ return _res;
+}
+
+static PyObject *Qt_MovieImportFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieImportComponent ci;
+ FSSpec theFile;
+ Movie theMovie;
+ Track targetTrack;
+ Track usedTrack;
+ TimeValue atTime;
+ TimeValue addedDuration;
+ long inFlags;
+ long outFlags;
+#ifndef MovieImportFile
+ PyMac_PRECHECK(MovieImportFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&ll",
+ CmpInstObj_Convert, &ci,
+ PyMac_GetFSSpec, &theFile,
+ MovieObj_Convert, &theMovie,
+ TrackObj_Convert, &targetTrack,
+ &atTime,
+ &inFlags))
+ return NULL;
+ _rv = MovieImportFile(ci,
+ &theFile,
+ theMovie,
+ targetTrack,
+ &usedTrack,
+ atTime,
+ &addedDuration,
+ inFlags,
+ &outFlags);
+ _res = Py_BuildValue("lO&ll",
+ _rv,
+ TrackObj_New, usedTrack,
+ addedDuration,
+ outFlags);
+ return _res;
+}
+
+static PyObject *Qt_MovieImportSetSampleDuration(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieImportComponent ci;
+ TimeValue duration;
+ TimeScale scale;
+#ifndef MovieImportSetSampleDuration
+ PyMac_PRECHECK(MovieImportSetSampleDuration);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ CmpInstObj_Convert, &ci,
+ &duration,
+ &scale))
+ return NULL;
+ _rv = MovieImportSetSampleDuration(ci,
+ duration,
+ scale);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MovieImportSetSampleDescription(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieImportComponent ci;
+ SampleDescriptionHandle desc;
+ OSType mediaType;
+#ifndef MovieImportSetSampleDescription
+ PyMac_PRECHECK(MovieImportSetSampleDescription);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CmpInstObj_Convert, &ci,
+ ResObj_Convert, &desc,
+ PyMac_GetOSType, &mediaType))
+ return NULL;
+ _rv = MovieImportSetSampleDescription(ci,
+ desc,
+ mediaType);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MovieImportSetMediaFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieImportComponent ci;
+ AliasHandle alias;
+#ifndef MovieImportSetMediaFile
+ PyMac_PRECHECK(MovieImportSetMediaFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &ci,
+ ResObj_Convert, &alias))
+ return NULL;
+ _rv = MovieImportSetMediaFile(ci,
+ alias);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MovieImportSetDimensions(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieImportComponent ci;
+ Fixed width;
+ Fixed height;
+#ifndef MovieImportSetDimensions
+ PyMac_PRECHECK(MovieImportSetDimensions);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CmpInstObj_Convert, &ci,
+ PyMac_GetFixed, &width,
+ PyMac_GetFixed, &height))
+ return NULL;
+ _rv = MovieImportSetDimensions(ci,
+ width,
+ height);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MovieImportSetChunkSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieImportComponent ci;
+ long chunkSize;
+#ifndef MovieImportSetChunkSize
+ PyMac_PRECHECK(MovieImportSetChunkSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &ci,
+ &chunkSize))
+ return NULL;
+ _rv = MovieImportSetChunkSize(ci,
+ chunkSize);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MovieImportSetAuxiliaryData(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieImportComponent ci;
+ Handle data;
+ OSType handleType;
+#ifndef MovieImportSetAuxiliaryData
+ PyMac_PRECHECK(MovieImportSetAuxiliaryData);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CmpInstObj_Convert, &ci,
+ ResObj_Convert, &data,
+ PyMac_GetOSType, &handleType))
+ return NULL;
+ _rv = MovieImportSetAuxiliaryData(ci,
+ data,
+ handleType);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MovieImportSetFromScrap(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieImportComponent ci;
+ Boolean fromScrap;
+#ifndef MovieImportSetFromScrap
+ PyMac_PRECHECK(MovieImportSetFromScrap);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&b",
+ CmpInstObj_Convert, &ci,
+ &fromScrap))
+ return NULL;
+ _rv = MovieImportSetFromScrap(ci,
+ fromScrap);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MovieImportDoUserDialog(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieImportComponent ci;
+ FSSpec theFile;
+ Handle theData;
+ Boolean canceled;
+#ifndef MovieImportDoUserDialog
+ PyMac_PRECHECK(MovieImportDoUserDialog);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CmpInstObj_Convert, &ci,
+ PyMac_GetFSSpec, &theFile,
+ ResObj_Convert, &theData))
+ return NULL;
+ _rv = MovieImportDoUserDialog(ci,
+ &theFile,
+ theData,
+ &canceled);
+ _res = Py_BuildValue("lb",
+ _rv,
+ canceled);
+ return _res;
+}
+
+static PyObject *Qt_MovieImportSetDuration(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieImportComponent ci;
+ TimeValue duration;
+#ifndef MovieImportSetDuration
+ PyMac_PRECHECK(MovieImportSetDuration);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &ci,
+ &duration))
+ return NULL;
+ _rv = MovieImportSetDuration(ci,
+ duration);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MovieImportGetAuxiliaryDataType(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieImportComponent ci;
+ OSType auxType;
+#ifndef MovieImportGetAuxiliaryDataType
+ PyMac_PRECHECK(MovieImportGetAuxiliaryDataType);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = MovieImportGetAuxiliaryDataType(ci,
+ &auxType);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildOSType, auxType);
+ return _res;
+}
+
+static PyObject *Qt_MovieImportValidate(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieImportComponent ci;
+ FSSpec theFile;
+ Handle theData;
+ Boolean valid;
+#ifndef MovieImportValidate
+ PyMac_PRECHECK(MovieImportValidate);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CmpInstObj_Convert, &ci,
+ PyMac_GetFSSpec, &theFile,
+ ResObj_Convert, &theData))
+ return NULL;
+ _rv = MovieImportValidate(ci,
+ &theFile,
+ theData,
+ &valid);
+ _res = Py_BuildValue("lb",
+ _rv,
+ valid);
+ return _res;
+}
+
+static PyObject *Qt_MovieImportGetFileType(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieImportComponent ci;
+ OSType fileType;
+#ifndef MovieImportGetFileType
+ PyMac_PRECHECK(MovieImportGetFileType);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = MovieImportGetFileType(ci,
+ &fileType);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildOSType, fileType);
+ return _res;
+}
+
+static PyObject *Qt_MovieImportDataRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieImportComponent ci;
+ Handle dataRef;
+ OSType dataRefType;
+ Movie theMovie;
+ Track targetTrack;
+ Track usedTrack;
+ TimeValue atTime;
+ TimeValue addedDuration;
+ long inFlags;
+ long outFlags;
+#ifndef MovieImportDataRef
+ PyMac_PRECHECK(MovieImportDataRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&O&ll",
+ CmpInstObj_Convert, &ci,
+ ResObj_Convert, &dataRef,
+ PyMac_GetOSType, &dataRefType,
+ MovieObj_Convert, &theMovie,
+ TrackObj_Convert, &targetTrack,
+ &atTime,
+ &inFlags))
+ return NULL;
+ _rv = MovieImportDataRef(ci,
+ dataRef,
+ dataRefType,
+ theMovie,
+ targetTrack,
+ &usedTrack,
+ atTime,
+ &addedDuration,
+ inFlags,
+ &outFlags);
+ _res = Py_BuildValue("lO&ll",
+ _rv,
+ TrackObj_New, usedTrack,
+ addedDuration,
+ outFlags);
+ return _res;
+}
+
+static PyObject *Qt_MovieImportGetSampleDescription(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieImportComponent ci;
+ SampleDescriptionHandle desc;
+ OSType mediaType;
+#ifndef MovieImportGetSampleDescription
+ PyMac_PRECHECK(MovieImportGetSampleDescription);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = MovieImportGetSampleDescription(ci,
+ &desc,
+ &mediaType);
+ _res = Py_BuildValue("lO&O&",
+ _rv,
+ ResObj_New, desc,
+ PyMac_BuildOSType, mediaType);
+ return _res;
+}
+
+static PyObject *Qt_MovieImportSetOffsetAndLimit(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieImportComponent ci;
+ unsigned long offset;
+ unsigned long limit;
+#ifndef MovieImportSetOffsetAndLimit
+ PyMac_PRECHECK(MovieImportSetOffsetAndLimit);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ CmpInstObj_Convert, &ci,
+ &offset,
+ &limit))
+ return NULL;
+ _rv = MovieImportSetOffsetAndLimit(ci,
+ offset,
+ limit);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MovieImportSetOffsetAndLimit64(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieImportComponent ci;
+ wide offset;
+ wide limit;
+#ifndef MovieImportSetOffsetAndLimit64
+ PyMac_PRECHECK(MovieImportSetOffsetAndLimit64);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CmpInstObj_Convert, &ci,
+ PyMac_Getwide, &offset,
+ PyMac_Getwide, &limit))
+ return NULL;
+ _rv = MovieImportSetOffsetAndLimit64(ci,
+ &offset,
+ &limit);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MovieImportIdle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieImportComponent ci;
+ long inFlags;
+ long outFlags;
+#ifndef MovieImportIdle
+ PyMac_PRECHECK(MovieImportIdle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &ci,
+ &inFlags))
+ return NULL;
+ _rv = MovieImportIdle(ci,
+ inFlags,
+ &outFlags);
+ _res = Py_BuildValue("ll",
+ _rv,
+ outFlags);
+ return _res;
+}
+
+static PyObject *Qt_MovieImportValidateDataRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieImportComponent ci;
+ Handle dataRef;
+ OSType dataRefType;
+ UInt8 valid;
+#ifndef MovieImportValidateDataRef
+ PyMac_PRECHECK(MovieImportValidateDataRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CmpInstObj_Convert, &ci,
+ ResObj_Convert, &dataRef,
+ PyMac_GetOSType, &dataRefType))
+ return NULL;
+ _rv = MovieImportValidateDataRef(ci,
+ dataRef,
+ dataRefType,
+ &valid);
+ _res = Py_BuildValue("lb",
+ _rv,
+ valid);
+ return _res;
+}
+
+static PyObject *Qt_MovieImportGetLoadState(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieImportComponent ci;
+ long importerLoadState;
+#ifndef MovieImportGetLoadState
+ PyMac_PRECHECK(MovieImportGetLoadState);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = MovieImportGetLoadState(ci,
+ &importerLoadState);
+ _res = Py_BuildValue("ll",
+ _rv,
+ importerLoadState);
+ return _res;
+}
+
+static PyObject *Qt_MovieImportGetMaxLoadedTime(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieImportComponent ci;
+ TimeValue time;
+#ifndef MovieImportGetMaxLoadedTime
+ PyMac_PRECHECK(MovieImportGetMaxLoadedTime);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = MovieImportGetMaxLoadedTime(ci,
+ &time);
+ _res = Py_BuildValue("ll",
+ _rv,
+ time);
+ return _res;
+}
+
+static PyObject *Qt_MovieImportEstimateCompletionTime(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieImportComponent ci;
+ TimeRecord time;
+#ifndef MovieImportEstimateCompletionTime
+ PyMac_PRECHECK(MovieImportEstimateCompletionTime);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = MovieImportEstimateCompletionTime(ci,
+ &time);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ QtTimeRecord_New, &time);
+ return _res;
+}
+
+static PyObject *Qt_MovieImportSetDontBlock(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieImportComponent ci;
+ Boolean dontBlock;
+#ifndef MovieImportSetDontBlock
+ PyMac_PRECHECK(MovieImportSetDontBlock);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&b",
+ CmpInstObj_Convert, &ci,
+ &dontBlock))
+ return NULL;
+ _rv = MovieImportSetDontBlock(ci,
+ dontBlock);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MovieImportGetDontBlock(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieImportComponent ci;
+ Boolean willBlock;
+#ifndef MovieImportGetDontBlock
+ PyMac_PRECHECK(MovieImportGetDontBlock);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = MovieImportGetDontBlock(ci,
+ &willBlock);
+ _res = Py_BuildValue("lb",
+ _rv,
+ willBlock);
+ return _res;
+}
+
+static PyObject *Qt_MovieImportSetIdleManager(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieImportComponent ci;
+ IdleManager im;
+#ifndef MovieImportSetIdleManager
+ PyMac_PRECHECK(MovieImportSetIdleManager);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &ci,
+ IdleManagerObj_Convert, &im))
+ return NULL;
+ _rv = MovieImportSetIdleManager(ci,
+ im);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MovieImportSetNewMovieFlags(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieImportComponent ci;
+ long newMovieFlags;
+#ifndef MovieImportSetNewMovieFlags
+ PyMac_PRECHECK(MovieImportSetNewMovieFlags);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &ci,
+ &newMovieFlags))
+ return NULL;
+ _rv = MovieImportSetNewMovieFlags(ci,
+ newMovieFlags);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MovieImportGetDestinationMediaType(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieImportComponent ci;
+ OSType mediaType;
+#ifndef MovieImportGetDestinationMediaType
+ PyMac_PRECHECK(MovieImportGetDestinationMediaType);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = MovieImportGetDestinationMediaType(ci,
+ &mediaType);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildOSType, mediaType);
+ return _res;
+}
+
+static PyObject *Qt_MovieExportToHandle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieExportComponent ci;
+ Handle dataH;
+ Movie theMovie;
+ Track onlyThisTrack;
+ TimeValue startTime;
+ TimeValue duration;
+#ifndef MovieExportToHandle
+ PyMac_PRECHECK(MovieExportToHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&ll",
+ CmpInstObj_Convert, &ci,
+ ResObj_Convert, &dataH,
+ MovieObj_Convert, &theMovie,
+ TrackObj_Convert, &onlyThisTrack,
+ &startTime,
+ &duration))
+ return NULL;
+ _rv = MovieExportToHandle(ci,
+ dataH,
+ theMovie,
+ onlyThisTrack,
+ startTime,
+ duration);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MovieExportToFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieExportComponent ci;
+ FSSpec theFile;
+ Movie theMovie;
+ Track onlyThisTrack;
+ TimeValue startTime;
+ TimeValue duration;
+#ifndef MovieExportToFile
+ PyMac_PRECHECK(MovieExportToFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&ll",
+ CmpInstObj_Convert, &ci,
+ PyMac_GetFSSpec, &theFile,
+ MovieObj_Convert, &theMovie,
+ TrackObj_Convert, &onlyThisTrack,
+ &startTime,
+ &duration))
+ return NULL;
+ _rv = MovieExportToFile(ci,
+ &theFile,
+ theMovie,
+ onlyThisTrack,
+ startTime,
+ duration);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MovieExportGetAuxiliaryData(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieExportComponent ci;
+ Handle dataH;
+ OSType handleType;
+#ifndef MovieExportGetAuxiliaryData
+ PyMac_PRECHECK(MovieExportGetAuxiliaryData);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &ci,
+ ResObj_Convert, &dataH))
+ return NULL;
+ _rv = MovieExportGetAuxiliaryData(ci,
+ dataH,
+ &handleType);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildOSType, handleType);
+ return _res;
+}
+
+static PyObject *Qt_MovieExportSetSampleDescription(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieExportComponent ci;
+ SampleDescriptionHandle desc;
+ OSType mediaType;
+#ifndef MovieExportSetSampleDescription
+ PyMac_PRECHECK(MovieExportSetSampleDescription);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CmpInstObj_Convert, &ci,
+ ResObj_Convert, &desc,
+ PyMac_GetOSType, &mediaType))
+ return NULL;
+ _rv = MovieExportSetSampleDescription(ci,
+ desc,
+ mediaType);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MovieExportDoUserDialog(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieExportComponent ci;
+ Movie theMovie;
+ Track onlyThisTrack;
+ TimeValue startTime;
+ TimeValue duration;
+ Boolean canceled;
+#ifndef MovieExportDoUserDialog
+ PyMac_PRECHECK(MovieExportDoUserDialog);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&ll",
+ CmpInstObj_Convert, &ci,
+ MovieObj_Convert, &theMovie,
+ TrackObj_Convert, &onlyThisTrack,
+ &startTime,
+ &duration))
+ return NULL;
+ _rv = MovieExportDoUserDialog(ci,
+ theMovie,
+ onlyThisTrack,
+ startTime,
+ duration,
+ &canceled);
+ _res = Py_BuildValue("lb",
+ _rv,
+ canceled);
+ return _res;
+}
+
+static PyObject *Qt_MovieExportGetCreatorType(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieExportComponent ci;
+ OSType creator;
+#ifndef MovieExportGetCreatorType
+ PyMac_PRECHECK(MovieExportGetCreatorType);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = MovieExportGetCreatorType(ci,
+ &creator);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildOSType, creator);
+ return _res;
+}
+
+static PyObject *Qt_MovieExportToDataRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieExportComponent ci;
+ Handle dataRef;
+ OSType dataRefType;
+ Movie theMovie;
+ Track onlyThisTrack;
+ TimeValue startTime;
+ TimeValue duration;
+#ifndef MovieExportToDataRef
+ PyMac_PRECHECK(MovieExportToDataRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&O&ll",
+ CmpInstObj_Convert, &ci,
+ ResObj_Convert, &dataRef,
+ PyMac_GetOSType, &dataRefType,
+ MovieObj_Convert, &theMovie,
+ TrackObj_Convert, &onlyThisTrack,
+ &startTime,
+ &duration))
+ return NULL;
+ _rv = MovieExportToDataRef(ci,
+ dataRef,
+ dataRefType,
+ theMovie,
+ onlyThisTrack,
+ startTime,
+ duration);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MovieExportFromProceduresToDataRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieExportComponent ci;
+ Handle dataRef;
+ OSType dataRefType;
+#ifndef MovieExportFromProceduresToDataRef
+ PyMac_PRECHECK(MovieExportFromProceduresToDataRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CmpInstObj_Convert, &ci,
+ ResObj_Convert, &dataRef,
+ PyMac_GetOSType, &dataRefType))
+ return NULL;
+ _rv = MovieExportFromProceduresToDataRef(ci,
+ dataRef,
+ dataRefType);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MovieExportValidate(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieExportComponent ci;
+ Movie theMovie;
+ Track onlyThisTrack;
+ Boolean valid;
+#ifndef MovieExportValidate
+ PyMac_PRECHECK(MovieExportValidate);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CmpInstObj_Convert, &ci,
+ MovieObj_Convert, &theMovie,
+ TrackObj_Convert, &onlyThisTrack))
+ return NULL;
+ _rv = MovieExportValidate(ci,
+ theMovie,
+ onlyThisTrack,
+ &valid);
+ _res = Py_BuildValue("lb",
+ _rv,
+ valid);
+ return _res;
+}
+
+static PyObject *Qt_MovieExportGetFileNameExtension(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieExportComponent ci;
+ OSType extension;
+#ifndef MovieExportGetFileNameExtension
+ PyMac_PRECHECK(MovieExportGetFileNameExtension);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = MovieExportGetFileNameExtension(ci,
+ &extension);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildOSType, extension);
+ return _res;
+}
+
+static PyObject *Qt_MovieExportGetShortFileTypeString(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieExportComponent ci;
+ Str255 typeString;
+#ifndef MovieExportGetShortFileTypeString
+ PyMac_PRECHECK(MovieExportGetShortFileTypeString);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &ci,
+ PyMac_GetStr255, typeString))
+ return NULL;
+ _rv = MovieExportGetShortFileTypeString(ci,
+ typeString);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MovieExportGetSourceMediaType(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MovieExportComponent ci;
+ OSType mediaType;
+#ifndef MovieExportGetSourceMediaType
+ PyMac_PRECHECK(MovieExportGetSourceMediaType);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = MovieExportGetSourceMediaType(ci,
+ &mediaType);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildOSType, mediaType);
+ return _res;
+}
+
+static PyObject *Qt_TextExportGetTimeFraction(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ TextExportComponent ci;
+ long movieTimeFraction;
+#ifndef TextExportGetTimeFraction
+ PyMac_PRECHECK(TextExportGetTimeFraction);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = TextExportGetTimeFraction(ci,
+ &movieTimeFraction);
+ _res = Py_BuildValue("ll",
+ _rv,
+ movieTimeFraction);
+ return _res;
+}
+
+static PyObject *Qt_TextExportSetTimeFraction(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ TextExportComponent ci;
+ long movieTimeFraction;
+#ifndef TextExportSetTimeFraction
+ PyMac_PRECHECK(TextExportSetTimeFraction);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &ci,
+ &movieTimeFraction))
+ return NULL;
+ _rv = TextExportSetTimeFraction(ci,
+ movieTimeFraction);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_TextExportGetSettings(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ TextExportComponent ci;
+ long setting;
+#ifndef TextExportGetSettings
+ PyMac_PRECHECK(TextExportGetSettings);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = TextExportGetSettings(ci,
+ &setting);
+ _res = Py_BuildValue("ll",
+ _rv,
+ setting);
+ return _res;
+}
+
+static PyObject *Qt_TextExportSetSettings(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ TextExportComponent ci;
+ long setting;
+#ifndef TextExportSetSettings
+ PyMac_PRECHECK(TextExportSetSettings);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &ci,
+ &setting))
+ return NULL;
+ _rv = TextExportSetSettings(ci,
+ setting);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MIDIImportGetSettings(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ TextExportComponent ci;
+ long setting;
+#ifndef MIDIImportGetSettings
+ PyMac_PRECHECK(MIDIImportGetSettings);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = MIDIImportGetSettings(ci,
+ &setting);
+ _res = Py_BuildValue("ll",
+ _rv,
+ setting);
+ return _res;
+}
+
+static PyObject *Qt_MIDIImportSetSettings(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ TextExportComponent ci;
+ long setting;
+#ifndef MIDIImportSetSettings
+ PyMac_PRECHECK(MIDIImportSetSettings);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &ci,
+ &setting))
+ return NULL;
+ _rv = MIDIImportSetSettings(ci,
+ setting);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImageImportSetSequenceEnabled(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicImageMovieImportComponent ci;
+ Boolean enable;
+#ifndef GraphicsImageImportSetSequenceEnabled
+ PyMac_PRECHECK(GraphicsImageImportSetSequenceEnabled);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&b",
+ CmpInstObj_Convert, &ci,
+ &enable))
+ return NULL;
+ _rv = GraphicsImageImportSetSequenceEnabled(ci,
+ enable);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_GraphicsImageImportGetSequenceEnabled(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ GraphicImageMovieImportComponent ci;
+ Boolean enable;
+#ifndef GraphicsImageImportGetSequenceEnabled
+ PyMac_PRECHECK(GraphicsImageImportGetSequenceEnabled);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = GraphicsImageImportGetSequenceEnabled(ci,
+ &enable);
+ _res = Py_BuildValue("lb",
+ _rv,
+ enable);
+ return _res;
+}
+
+static PyObject *Qt_PreviewShowData(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ pnotComponent p;
+ OSType dataType;
+ Handle data;
+ Rect inHere;
+#ifndef PreviewShowData
+ PyMac_PRECHECK(PreviewShowData);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&",
+ CmpInstObj_Convert, &p,
+ PyMac_GetOSType, &dataType,
+ ResObj_Convert, &data,
+ PyMac_GetRect, &inHere))
+ return NULL;
+ _rv = PreviewShowData(p,
+ dataType,
+ data,
+ &inHere);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_PreviewMakePreviewReference(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ pnotComponent p;
+ OSType previewType;
+ short resID;
+ FSSpec sourceFile;
+#ifndef PreviewMakePreviewReference
+ PyMac_PRECHECK(PreviewMakePreviewReference);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &p,
+ PyMac_GetFSSpec, &sourceFile))
+ return NULL;
+ _rv = PreviewMakePreviewReference(p,
+ &previewType,
+ &resID,
+ &sourceFile);
+ _res = Py_BuildValue("lO&h",
+ _rv,
+ PyMac_BuildOSType, previewType,
+ resID);
+ return _res;
+}
+
+static PyObject *Qt_PreviewEvent(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ pnotComponent p;
+ EventRecord e;
+ Boolean handledEvent;
+#ifndef PreviewEvent
+ PyMac_PRECHECK(PreviewEvent);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &p))
+ return NULL;
+ _rv = PreviewEvent(p,
+ &e,
+ &handledEvent);
+ _res = Py_BuildValue("lO&b",
+ _rv,
+ PyMac_BuildEventRecord, &e,
+ handledEvent);
+ return _res;
+}
+
+static PyObject *Qt_DataCodecDecompress(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataCodecComponent dc;
+ void * srcData;
+ UInt32 srcSize;
+ void * dstData;
+ UInt32 dstBufferSize;
+#ifndef DataCodecDecompress
+ PyMac_PRECHECK(DataCodecDecompress);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&slsl",
+ CmpInstObj_Convert, &dc,
+ &srcData,
+ &srcSize,
+ &dstData,
+ &dstBufferSize))
+ return NULL;
+ _rv = DataCodecDecompress(dc,
+ srcData,
+ srcSize,
+ dstData,
+ dstBufferSize);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_DataCodecGetCompressBufferSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataCodecComponent dc;
+ UInt32 srcSize;
+ UInt32 dstSize;
+#ifndef DataCodecGetCompressBufferSize
+ PyMac_PRECHECK(DataCodecGetCompressBufferSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &dc,
+ &srcSize))
+ return NULL;
+ _rv = DataCodecGetCompressBufferSize(dc,
+ srcSize,
+ &dstSize);
+ _res = Py_BuildValue("ll",
+ _rv,
+ dstSize);
+ return _res;
+}
+
+static PyObject *Qt_DataCodecCompress(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataCodecComponent dc;
+ void * srcData;
+ UInt32 srcSize;
+ void * dstData;
+ UInt32 dstBufferSize;
+ UInt32 actualDstSize;
+ UInt32 decompressSlop;
+#ifndef DataCodecCompress
+ PyMac_PRECHECK(DataCodecCompress);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&slsl",
+ CmpInstObj_Convert, &dc,
+ &srcData,
+ &srcSize,
+ &dstData,
+ &dstBufferSize))
+ return NULL;
+ _rv = DataCodecCompress(dc,
+ srcData,
+ srcSize,
+ dstData,
+ dstBufferSize,
+ &actualDstSize,
+ &decompressSlop);
+ _res = Py_BuildValue("lll",
+ _rv,
+ actualDstSize,
+ decompressSlop);
+ return _res;
+}
+
+static PyObject *Qt_DataCodecBeginInterruptSafe(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataCodecComponent dc;
+ unsigned long maxSrcSize;
+#ifndef DataCodecBeginInterruptSafe
+ PyMac_PRECHECK(DataCodecBeginInterruptSafe);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &dc,
+ &maxSrcSize))
+ return NULL;
+ _rv = DataCodecBeginInterruptSafe(dc,
+ maxSrcSize);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_DataCodecEndInterruptSafe(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataCodecComponent dc;
+#ifndef DataCodecEndInterruptSafe
+ PyMac_PRECHECK(DataCodecEndInterruptSafe);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &dc))
+ return NULL;
+ _rv = DataCodecEndInterruptSafe(dc);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_DataHGetData(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ Handle h;
+ long hOffset;
+ long offset;
+ long size;
+#ifndef DataHGetData
+ PyMac_PRECHECK(DataHGetData);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&lll",
+ CmpInstObj_Convert, &dh,
+ ResObj_Convert, &h,
+ &hOffset,
+ &offset,
+ &size))
+ return NULL;
+ _rv = DataHGetData(dh,
+ h,
+ hOffset,
+ offset,
+ size);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_DataHPutData(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ Handle h;
+ long hOffset;
+ long offset;
+ long size;
+#ifndef DataHPutData
+ PyMac_PRECHECK(DataHPutData);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&ll",
+ CmpInstObj_Convert, &dh,
+ ResObj_Convert, &h,
+ &hOffset,
+ &size))
+ return NULL;
+ _rv = DataHPutData(dh,
+ h,
+ hOffset,
+ &offset,
+ size);
+ _res = Py_BuildValue("ll",
+ _rv,
+ offset);
+ return _res;
+}
+
+static PyObject *Qt_DataHFlushData(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+#ifndef DataHFlushData
+ PyMac_PRECHECK(DataHFlushData);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &dh))
+ return NULL;
+ _rv = DataHFlushData(dh);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_DataHOpenForWrite(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+#ifndef DataHOpenForWrite
+ PyMac_PRECHECK(DataHOpenForWrite);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &dh))
+ return NULL;
+ _rv = DataHOpenForWrite(dh);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_DataHCloseForWrite(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+#ifndef DataHCloseForWrite
+ PyMac_PRECHECK(DataHCloseForWrite);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &dh))
+ return NULL;
+ _rv = DataHCloseForWrite(dh);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_DataHOpenForRead(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+#ifndef DataHOpenForRead
+ PyMac_PRECHECK(DataHOpenForRead);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &dh))
+ return NULL;
+ _rv = DataHOpenForRead(dh);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_DataHCloseForRead(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+#ifndef DataHCloseForRead
+ PyMac_PRECHECK(DataHCloseForRead);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &dh))
+ return NULL;
+ _rv = DataHCloseForRead(dh);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_DataHSetDataRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ Handle dataRef;
+#ifndef DataHSetDataRef
+ PyMac_PRECHECK(DataHSetDataRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &dh,
+ ResObj_Convert, &dataRef))
+ return NULL;
+ _rv = DataHSetDataRef(dh,
+ dataRef);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_DataHGetDataRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ Handle dataRef;
+#ifndef DataHGetDataRef
+ PyMac_PRECHECK(DataHGetDataRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &dh))
+ return NULL;
+ _rv = DataHGetDataRef(dh,
+ &dataRef);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, dataRef);
+ return _res;
+}
+
+static PyObject *Qt_DataHCompareDataRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ Handle dataRef;
+ Boolean equal;
+#ifndef DataHCompareDataRef
+ PyMac_PRECHECK(DataHCompareDataRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &dh,
+ ResObj_Convert, &dataRef))
+ return NULL;
+ _rv = DataHCompareDataRef(dh,
+ dataRef,
+ &equal);
+ _res = Py_BuildValue("lb",
+ _rv,
+ equal);
+ return _res;
+}
+
+static PyObject *Qt_DataHTask(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+#ifndef DataHTask
+ PyMac_PRECHECK(DataHTask);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &dh))
+ return NULL;
+ _rv = DataHTask(dh);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_DataHFinishData(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ Ptr PlaceToPutDataPtr;
+ Boolean Cancel;
+#ifndef DataHFinishData
+ PyMac_PRECHECK(DataHFinishData);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&sb",
+ CmpInstObj_Convert, &dh,
+ &PlaceToPutDataPtr,
+ &Cancel))
+ return NULL;
+ _rv = DataHFinishData(dh,
+ PlaceToPutDataPtr,
+ Cancel);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_DataHFlushCache(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+#ifndef DataHFlushCache
+ PyMac_PRECHECK(DataHFlushCache);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &dh))
+ return NULL;
+ _rv = DataHFlushCache(dh);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_DataHResolveDataRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ Handle theDataRef;
+ Boolean wasChanged;
+ Boolean userInterfaceAllowed;
+#ifndef DataHResolveDataRef
+ PyMac_PRECHECK(DataHResolveDataRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&b",
+ CmpInstObj_Convert, &dh,
+ ResObj_Convert, &theDataRef,
+ &userInterfaceAllowed))
+ return NULL;
+ _rv = DataHResolveDataRef(dh,
+ theDataRef,
+ &wasChanged,
+ userInterfaceAllowed);
+ _res = Py_BuildValue("lb",
+ _rv,
+ wasChanged);
+ return _res;
+}
+
+static PyObject *Qt_DataHGetFileSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ long fileSize;
+#ifndef DataHGetFileSize
+ PyMac_PRECHECK(DataHGetFileSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &dh))
+ return NULL;
+ _rv = DataHGetFileSize(dh,
+ &fileSize);
+ _res = Py_BuildValue("ll",
+ _rv,
+ fileSize);
+ return _res;
+}
+
+static PyObject *Qt_DataHCanUseDataRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ Handle dataRef;
+ long useFlags;
+#ifndef DataHCanUseDataRef
+ PyMac_PRECHECK(DataHCanUseDataRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &dh,
+ ResObj_Convert, &dataRef))
+ return NULL;
+ _rv = DataHCanUseDataRef(dh,
+ dataRef,
+ &useFlags);
+ _res = Py_BuildValue("ll",
+ _rv,
+ useFlags);
+ return _res;
+}
+
+static PyObject *Qt_DataHPreextend(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ unsigned long maxToAdd;
+ unsigned long spaceAdded;
+#ifndef DataHPreextend
+ PyMac_PRECHECK(DataHPreextend);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &dh,
+ &maxToAdd))
+ return NULL;
+ _rv = DataHPreextend(dh,
+ maxToAdd,
+ &spaceAdded);
+ _res = Py_BuildValue("ll",
+ _rv,
+ spaceAdded);
+ return _res;
+}
+
+static PyObject *Qt_DataHSetFileSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ long fileSize;
+#ifndef DataHSetFileSize
+ PyMac_PRECHECK(DataHSetFileSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &dh,
+ &fileSize))
+ return NULL;
+ _rv = DataHSetFileSize(dh,
+ fileSize);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_DataHGetFreeSpace(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ unsigned long freeSize;
+#ifndef DataHGetFreeSpace
+ PyMac_PRECHECK(DataHGetFreeSpace);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &dh))
+ return NULL;
+ _rv = DataHGetFreeSpace(dh,
+ &freeSize);
+ _res = Py_BuildValue("ll",
+ _rv,
+ freeSize);
+ return _res;
+}
+
+static PyObject *Qt_DataHCreateFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ OSType creator;
+ Boolean deleteExisting;
+#ifndef DataHCreateFile
+ PyMac_PRECHECK(DataHCreateFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&b",
+ CmpInstObj_Convert, &dh,
+ PyMac_GetOSType, &creator,
+ &deleteExisting))
+ return NULL;
+ _rv = DataHCreateFile(dh,
+ creator,
+ deleteExisting);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_DataHGetPreferredBlockSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ long blockSize;
+#ifndef DataHGetPreferredBlockSize
+ PyMac_PRECHECK(DataHGetPreferredBlockSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &dh))
+ return NULL;
+ _rv = DataHGetPreferredBlockSize(dh,
+ &blockSize);
+ _res = Py_BuildValue("ll",
+ _rv,
+ blockSize);
+ return _res;
+}
+
+static PyObject *Qt_DataHGetDeviceIndex(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ long deviceIndex;
+#ifndef DataHGetDeviceIndex
+ PyMac_PRECHECK(DataHGetDeviceIndex);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &dh))
+ return NULL;
+ _rv = DataHGetDeviceIndex(dh,
+ &deviceIndex);
+ _res = Py_BuildValue("ll",
+ _rv,
+ deviceIndex);
+ return _res;
+}
+
+static PyObject *Qt_DataHIsStreamingDataHandler(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ Boolean yes;
+#ifndef DataHIsStreamingDataHandler
+ PyMac_PRECHECK(DataHIsStreamingDataHandler);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &dh))
+ return NULL;
+ _rv = DataHIsStreamingDataHandler(dh,
+ &yes);
+ _res = Py_BuildValue("lb",
+ _rv,
+ yes);
+ return _res;
+}
+
+static PyObject *Qt_DataHGetDataInBuffer(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ long startOffset;
+ long size;
+#ifndef DataHGetDataInBuffer
+ PyMac_PRECHECK(DataHGetDataInBuffer);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &dh,
+ &startOffset))
+ return NULL;
+ _rv = DataHGetDataInBuffer(dh,
+ startOffset,
+ &size);
+ _res = Py_BuildValue("ll",
+ _rv,
+ size);
+ return _res;
+}
+
+static PyObject *Qt_DataHGetScheduleAheadTime(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ long millisecs;
+#ifndef DataHGetScheduleAheadTime
+ PyMac_PRECHECK(DataHGetScheduleAheadTime);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &dh))
+ return NULL;
+ _rv = DataHGetScheduleAheadTime(dh,
+ &millisecs);
+ _res = Py_BuildValue("ll",
+ _rv,
+ millisecs);
+ return _res;
+}
+
+static PyObject *Qt_DataHSetCacheSizeLimit(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ Size cacheSizeLimit;
+#ifndef DataHSetCacheSizeLimit
+ PyMac_PRECHECK(DataHSetCacheSizeLimit);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &dh,
+ &cacheSizeLimit))
+ return NULL;
+ _rv = DataHSetCacheSizeLimit(dh,
+ cacheSizeLimit);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_DataHGetCacheSizeLimit(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ Size cacheSizeLimit;
+#ifndef DataHGetCacheSizeLimit
+ PyMac_PRECHECK(DataHGetCacheSizeLimit);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &dh))
+ return NULL;
+ _rv = DataHGetCacheSizeLimit(dh,
+ &cacheSizeLimit);
+ _res = Py_BuildValue("ll",
+ _rv,
+ cacheSizeLimit);
+ return _res;
+}
+
+static PyObject *Qt_DataHGetMovie(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ Movie theMovie;
+ short id;
+#ifndef DataHGetMovie
+ PyMac_PRECHECK(DataHGetMovie);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &dh))
+ return NULL;
+ _rv = DataHGetMovie(dh,
+ &theMovie,
+ &id);
+ _res = Py_BuildValue("lO&h",
+ _rv,
+ MovieObj_New, theMovie,
+ id);
+ return _res;
+}
+
+static PyObject *Qt_DataHAddMovie(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ Movie theMovie;
+ short id;
+#ifndef DataHAddMovie
+ PyMac_PRECHECK(DataHAddMovie);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &dh,
+ MovieObj_Convert, &theMovie))
+ return NULL;
+ _rv = DataHAddMovie(dh,
+ theMovie,
+ &id);
+ _res = Py_BuildValue("lh",
+ _rv,
+ id);
+ return _res;
+}
+
+static PyObject *Qt_DataHUpdateMovie(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ Movie theMovie;
+ short id;
+#ifndef DataHUpdateMovie
+ PyMac_PRECHECK(DataHUpdateMovie);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&h",
+ CmpInstObj_Convert, &dh,
+ MovieObj_Convert, &theMovie,
+ &id))
+ return NULL;
+ _rv = DataHUpdateMovie(dh,
+ theMovie,
+ id);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_DataHDoesBuffer(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ Boolean buffersReads;
+ Boolean buffersWrites;
+#ifndef DataHDoesBuffer
+ PyMac_PRECHECK(DataHDoesBuffer);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &dh))
+ return NULL;
+ _rv = DataHDoesBuffer(dh,
+ &buffersReads,
+ &buffersWrites);
+ _res = Py_BuildValue("lbb",
+ _rv,
+ buffersReads,
+ buffersWrites);
+ return _res;
+}
+
+static PyObject *Qt_DataHGetFileName(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ Str255 str;
+#ifndef DataHGetFileName
+ PyMac_PRECHECK(DataHGetFileName);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &dh,
+ PyMac_GetStr255, str))
+ return NULL;
+ _rv = DataHGetFileName(dh,
+ str);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_DataHGetAvailableFileSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ long fileSize;
+#ifndef DataHGetAvailableFileSize
+ PyMac_PRECHECK(DataHGetAvailableFileSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &dh))
+ return NULL;
+ _rv = DataHGetAvailableFileSize(dh,
+ &fileSize);
+ _res = Py_BuildValue("ll",
+ _rv,
+ fileSize);
+ return _res;
+}
+
+static PyObject *Qt_DataHGetMacOSFileType(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ OSType fileType;
+#ifndef DataHGetMacOSFileType
+ PyMac_PRECHECK(DataHGetMacOSFileType);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &dh))
+ return NULL;
+ _rv = DataHGetMacOSFileType(dh,
+ &fileType);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildOSType, fileType);
+ return _res;
+}
+
+static PyObject *Qt_DataHGetMIMEType(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ Str255 mimeType;
+#ifndef DataHGetMIMEType
+ PyMac_PRECHECK(DataHGetMIMEType);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &dh,
+ PyMac_GetStr255, mimeType))
+ return NULL;
+ _rv = DataHGetMIMEType(dh,
+ mimeType);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_DataHSetDataRefWithAnchor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ Handle anchorDataRef;
+ OSType dataRefType;
+ Handle dataRef;
+#ifndef DataHSetDataRefWithAnchor
+ PyMac_PRECHECK(DataHSetDataRefWithAnchor);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&",
+ CmpInstObj_Convert, &dh,
+ ResObj_Convert, &anchorDataRef,
+ PyMac_GetOSType, &dataRefType,
+ ResObj_Convert, &dataRef))
+ return NULL;
+ _rv = DataHSetDataRefWithAnchor(dh,
+ anchorDataRef,
+ dataRefType,
+ dataRef);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_DataHGetDataRefWithAnchor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ Handle anchorDataRef;
+ OSType dataRefType;
+ Handle dataRef;
+#ifndef DataHGetDataRefWithAnchor
+ PyMac_PRECHECK(DataHGetDataRefWithAnchor);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CmpInstObj_Convert, &dh,
+ ResObj_Convert, &anchorDataRef,
+ PyMac_GetOSType, &dataRefType))
+ return NULL;
+ _rv = DataHGetDataRefWithAnchor(dh,
+ anchorDataRef,
+ dataRefType,
+ &dataRef);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, dataRef);
+ return _res;
+}
+
+static PyObject *Qt_DataHSetMacOSFileType(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ OSType fileType;
+#ifndef DataHSetMacOSFileType
+ PyMac_PRECHECK(DataHSetMacOSFileType);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &dh,
+ PyMac_GetOSType, &fileType))
+ return NULL;
+ _rv = DataHSetMacOSFileType(dh,
+ fileType);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_DataHSetTimeBase(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ TimeBase tb;
+#ifndef DataHSetTimeBase
+ PyMac_PRECHECK(DataHSetTimeBase);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &dh,
+ TimeBaseObj_Convert, &tb))
+ return NULL;
+ _rv = DataHSetTimeBase(dh,
+ tb);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_DataHGetInfoFlags(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ UInt32 flags;
+#ifndef DataHGetInfoFlags
+ PyMac_PRECHECK(DataHGetInfoFlags);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &dh))
+ return NULL;
+ _rv = DataHGetInfoFlags(dh,
+ &flags);
+ _res = Py_BuildValue("ll",
+ _rv,
+ flags);
+ return _res;
+}
+
+static PyObject *Qt_DataHGetFileSize64(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ wide fileSize;
+#ifndef DataHGetFileSize64
+ PyMac_PRECHECK(DataHGetFileSize64);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &dh))
+ return NULL;
+ _rv = DataHGetFileSize64(dh,
+ &fileSize);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_Buildwide, fileSize);
+ return _res;
+}
+
+static PyObject *Qt_DataHPreextend64(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ wide maxToAdd;
+ wide spaceAdded;
+#ifndef DataHPreextend64
+ PyMac_PRECHECK(DataHPreextend64);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &dh,
+ PyMac_Getwide, &maxToAdd))
+ return NULL;
+ _rv = DataHPreextend64(dh,
+ &maxToAdd,
+ &spaceAdded);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_Buildwide, spaceAdded);
+ return _res;
+}
+
+static PyObject *Qt_DataHSetFileSize64(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ wide fileSize;
+#ifndef DataHSetFileSize64
+ PyMac_PRECHECK(DataHSetFileSize64);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &dh,
+ PyMac_Getwide, &fileSize))
+ return NULL;
+ _rv = DataHSetFileSize64(dh,
+ &fileSize);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_DataHGetFreeSpace64(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ wide freeSize;
+#ifndef DataHGetFreeSpace64
+ PyMac_PRECHECK(DataHGetFreeSpace64);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &dh))
+ return NULL;
+ _rv = DataHGetFreeSpace64(dh,
+ &freeSize);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_Buildwide, freeSize);
+ return _res;
+}
+
+static PyObject *Qt_DataHAppend64(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ void * data;
+ wide fileOffset;
+ unsigned long size;
+#ifndef DataHAppend64
+ PyMac_PRECHECK(DataHAppend64);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&sl",
+ CmpInstObj_Convert, &dh,
+ &data,
+ &size))
+ return NULL;
+ _rv = DataHAppend64(dh,
+ data,
+ &fileOffset,
+ size);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_Buildwide, fileOffset);
+ return _res;
+}
+
+static PyObject *Qt_DataHPollRead(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ void * dataPtr;
+ UInt32 dataSizeSoFar;
+#ifndef DataHPollRead
+ PyMac_PRECHECK(DataHPollRead);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&s",
+ CmpInstObj_Convert, &dh,
+ &dataPtr))
+ return NULL;
+ _rv = DataHPollRead(dh,
+ dataPtr,
+ &dataSizeSoFar);
+ _res = Py_BuildValue("ll",
+ _rv,
+ dataSizeSoFar);
+ return _res;
+}
+
+static PyObject *Qt_DataHGetDataAvailability(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ long offset;
+ long len;
+ long missing_offset;
+ long missing_len;
+#ifndef DataHGetDataAvailability
+ PyMac_PRECHECK(DataHGetDataAvailability);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ CmpInstObj_Convert, &dh,
+ &offset,
+ &len))
+ return NULL;
+ _rv = DataHGetDataAvailability(dh,
+ offset,
+ len,
+ &missing_offset,
+ &missing_len);
+ _res = Py_BuildValue("lll",
+ _rv,
+ missing_offset,
+ missing_len);
+ return _res;
+}
+
+static PyObject *Qt_DataHGetDataRefAsType(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ OSType requestedType;
+ Handle dataRef;
+#ifndef DataHGetDataRefAsType
+ PyMac_PRECHECK(DataHGetDataRefAsType);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &dh,
+ PyMac_GetOSType, &requestedType))
+ return NULL;
+ _rv = DataHGetDataRefAsType(dh,
+ requestedType,
+ &dataRef);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, dataRef);
+ return _res;
+}
+
+static PyObject *Qt_DataHSetDataRefExtension(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ Handle extension;
+ OSType idType;
+#ifndef DataHSetDataRefExtension
+ PyMac_PRECHECK(DataHSetDataRefExtension);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CmpInstObj_Convert, &dh,
+ ResObj_Convert, &extension,
+ PyMac_GetOSType, &idType))
+ return NULL;
+ _rv = DataHSetDataRefExtension(dh,
+ extension,
+ idType);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_DataHGetDataRefExtension(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ Handle extension;
+ OSType idType;
+#ifndef DataHGetDataRefExtension
+ PyMac_PRECHECK(DataHGetDataRefExtension);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &dh,
+ PyMac_GetOSType, &idType))
+ return NULL;
+ _rv = DataHGetDataRefExtension(dh,
+ &extension,
+ idType);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, extension);
+ return _res;
+}
+
+static PyObject *Qt_DataHGetMovieWithFlags(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ Movie theMovie;
+ short id;
+ short flags;
+#ifndef DataHGetMovieWithFlags
+ PyMac_PRECHECK(DataHGetMovieWithFlags);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ CmpInstObj_Convert, &dh,
+ &flags))
+ return NULL;
+ _rv = DataHGetMovieWithFlags(dh,
+ &theMovie,
+ &id,
+ flags);
+ _res = Py_BuildValue("lO&h",
+ _rv,
+ MovieObj_New, theMovie,
+ id);
+ return _res;
+}
+
+static PyObject *Qt_DataHGetFileTypeOrdering(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ DataHFileTypeOrderingHandle orderingListHandle;
+#ifndef DataHGetFileTypeOrdering
+ PyMac_PRECHECK(DataHGetFileTypeOrdering);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &dh))
+ return NULL;
+ _rv = DataHGetFileTypeOrdering(dh,
+ &orderingListHandle);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, orderingListHandle);
+ return _res;
+}
+
+static PyObject *Qt_DataHCreateFileWithFlags(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ OSType creator;
+ Boolean deleteExisting;
+ UInt32 flags;
+#ifndef DataHCreateFileWithFlags
+ PyMac_PRECHECK(DataHCreateFileWithFlags);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&bl",
+ CmpInstObj_Convert, &dh,
+ PyMac_GetOSType, &creator,
+ &deleteExisting,
+ &flags))
+ return NULL;
+ _rv = DataHCreateFileWithFlags(dh,
+ creator,
+ deleteExisting,
+ flags);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_DataHGetInfo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ OSType what;
+ void * info;
+#ifndef DataHGetInfo
+ PyMac_PRECHECK(DataHGetInfo);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&s",
+ CmpInstObj_Convert, &dh,
+ PyMac_GetOSType, &what,
+ &info))
+ return NULL;
+ _rv = DataHGetInfo(dh,
+ what,
+ info);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_DataHSetIdleManager(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ IdleManager im;
+#ifndef DataHSetIdleManager
+ PyMac_PRECHECK(DataHSetIdleManager);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &dh,
+ IdleManagerObj_Convert, &im))
+ return NULL;
+ _rv = DataHSetIdleManager(dh,
+ im);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_DataHDeleteFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+#ifndef DataHDeleteFile
+ PyMac_PRECHECK(DataHDeleteFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &dh))
+ return NULL;
+ _rv = DataHDeleteFile(dh);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_DataHSetMovieUsageFlags(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ long flags;
+#ifndef DataHSetMovieUsageFlags
+ PyMac_PRECHECK(DataHSetMovieUsageFlags);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &dh,
+ &flags))
+ return NULL;
+ _rv = DataHSetMovieUsageFlags(dh,
+ flags);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_DataHUseTemporaryDataRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ long inFlags;
+#ifndef DataHUseTemporaryDataRef
+ PyMac_PRECHECK(DataHUseTemporaryDataRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &dh,
+ &inFlags))
+ return NULL;
+ _rv = DataHUseTemporaryDataRef(dh,
+ inFlags);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_DataHGetTemporaryDataRefCapabilities(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ long outUnderstoodFlags;
+#ifndef DataHGetTemporaryDataRefCapabilities
+ PyMac_PRECHECK(DataHGetTemporaryDataRefCapabilities);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &dh))
+ return NULL;
+ _rv = DataHGetTemporaryDataRefCapabilities(dh,
+ &outUnderstoodFlags);
+ _res = Py_BuildValue("ll",
+ _rv,
+ outUnderstoodFlags);
+ return _res;
+}
+
+static PyObject *Qt_DataHRenameFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ Handle newDataRef;
+#ifndef DataHRenameFile
+ PyMac_PRECHECK(DataHRenameFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &dh,
+ ResObj_Convert, &newDataRef))
+ return NULL;
+ _rv = DataHRenameFile(dh,
+ newDataRef);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_DataHPlaybackHints(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ long flags;
+ unsigned long minFileOffset;
+ unsigned long maxFileOffset;
+ long bytesPerSecond;
+#ifndef DataHPlaybackHints
+ PyMac_PRECHECK(DataHPlaybackHints);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&llll",
+ CmpInstObj_Convert, &dh,
+ &flags,
+ &minFileOffset,
+ &maxFileOffset,
+ &bytesPerSecond))
+ return NULL;
+ _rv = DataHPlaybackHints(dh,
+ flags,
+ minFileOffset,
+ maxFileOffset,
+ bytesPerSecond);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_DataHPlaybackHints64(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ long flags;
+ wide minFileOffset;
+ wide maxFileOffset;
+ long bytesPerSecond;
+#ifndef DataHPlaybackHints64
+ PyMac_PRECHECK(DataHPlaybackHints64);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lO&O&l",
+ CmpInstObj_Convert, &dh,
+ &flags,
+ PyMac_Getwide, &minFileOffset,
+ PyMac_Getwide, &maxFileOffset,
+ &bytesPerSecond))
+ return NULL;
+ _rv = DataHPlaybackHints64(dh,
+ flags,
+ &minFileOffset,
+ &maxFileOffset,
+ bytesPerSecond);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_DataHGetDataRate(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ long flags;
+ long bytesPerSecond;
+#ifndef DataHGetDataRate
+ PyMac_PRECHECK(DataHGetDataRate);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &dh,
+ &flags))
+ return NULL;
+ _rv = DataHGetDataRate(dh,
+ flags,
+ &bytesPerSecond);
+ _res = Py_BuildValue("ll",
+ _rv,
+ bytesPerSecond);
+ return _res;
+}
+
+static PyObject *Qt_DataHSetTimeHints(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ DataHandler dh;
+ long flags;
+ long bandwidthPriority;
+ TimeScale scale;
+ TimeValue minTime;
+ TimeValue maxTime;
+#ifndef DataHSetTimeHints
+ PyMac_PRECHECK(DataHSetTimeHints);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lllll",
+ CmpInstObj_Convert, &dh,
+ &flags,
+ &bandwidthPriority,
+ &scale,
+ &minTime,
+ &maxTime))
+ return NULL;
+ _rv = DataHSetTimeHints(dh,
+ flags,
+ bandwidthPriority,
+ scale,
+ minTime,
+ maxTime);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VDGetMaxSrcRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ short inputStd;
+ Rect maxSrcRect;
+#ifndef VDGetMaxSrcRect
+ PyMac_PRECHECK(VDGetMaxSrcRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ CmpInstObj_Convert, &ci,
+ &inputStd))
+ return NULL;
+ _rv = VDGetMaxSrcRect(ci,
+ inputStd,
+ &maxSrcRect);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildRect, &maxSrcRect);
+ return _res;
+}
+
+static PyObject *Qt_VDGetActiveSrcRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ short inputStd;
+ Rect activeSrcRect;
+#ifndef VDGetActiveSrcRect
+ PyMac_PRECHECK(VDGetActiveSrcRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ CmpInstObj_Convert, &ci,
+ &inputStd))
+ return NULL;
+ _rv = VDGetActiveSrcRect(ci,
+ inputStd,
+ &activeSrcRect);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildRect, &activeSrcRect);
+ return _res;
+}
+
+static PyObject *Qt_VDSetDigitizerRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ Rect digitizerRect;
+#ifndef VDSetDigitizerRect
+ PyMac_PRECHECK(VDSetDigitizerRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDSetDigitizerRect(ci,
+ &digitizerRect);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildRect, &digitizerRect);
+ return _res;
+}
+
+static PyObject *Qt_VDGetDigitizerRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ Rect digitizerRect;
+#ifndef VDGetDigitizerRect
+ PyMac_PRECHECK(VDGetDigitizerRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDGetDigitizerRect(ci,
+ &digitizerRect);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildRect, &digitizerRect);
+ return _res;
+}
+
+static PyObject *Qt_VDGetVBlankRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ short inputStd;
+ Rect vBlankRect;
+#ifndef VDGetVBlankRect
+ PyMac_PRECHECK(VDGetVBlankRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ CmpInstObj_Convert, &ci,
+ &inputStd))
+ return NULL;
+ _rv = VDGetVBlankRect(ci,
+ inputStd,
+ &vBlankRect);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildRect, &vBlankRect);
+ return _res;
+}
+
+static PyObject *Qt_VDGetMaskPixMap(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ PixMapHandle maskPixMap;
+#ifndef VDGetMaskPixMap
+ PyMac_PRECHECK(VDGetMaskPixMap);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &ci,
+ ResObj_Convert, &maskPixMap))
+ return NULL;
+ _rv = VDGetMaskPixMap(ci,
+ maskPixMap);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VDUseThisCLUT(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ CTabHandle colorTableHandle;
+#ifndef VDUseThisCLUT
+ PyMac_PRECHECK(VDUseThisCLUT);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &ci,
+ ResObj_Convert, &colorTableHandle))
+ return NULL;
+ _rv = VDUseThisCLUT(ci,
+ colorTableHandle);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VDSetInputGammaValue(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ Fixed channel1;
+ Fixed channel2;
+ Fixed channel3;
+#ifndef VDSetInputGammaValue
+ PyMac_PRECHECK(VDSetInputGammaValue);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&",
+ CmpInstObj_Convert, &ci,
+ PyMac_GetFixed, &channel1,
+ PyMac_GetFixed, &channel2,
+ PyMac_GetFixed, &channel3))
+ return NULL;
+ _rv = VDSetInputGammaValue(ci,
+ channel1,
+ channel2,
+ channel3);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VDGetInputGammaValue(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ Fixed channel1;
+ Fixed channel2;
+ Fixed channel3;
+#ifndef VDGetInputGammaValue
+ PyMac_PRECHECK(VDGetInputGammaValue);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDGetInputGammaValue(ci,
+ &channel1,
+ &channel2,
+ &channel3);
+ _res = Py_BuildValue("lO&O&O&",
+ _rv,
+ PyMac_BuildFixed, channel1,
+ PyMac_BuildFixed, channel2,
+ PyMac_BuildFixed, channel3);
+ return _res;
+}
+
+static PyObject *Qt_VDSetBrightness(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ unsigned short brightness;
+#ifndef VDSetBrightness
+ PyMac_PRECHECK(VDSetBrightness);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDSetBrightness(ci,
+ &brightness);
+ _res = Py_BuildValue("lH",
+ _rv,
+ brightness);
+ return _res;
+}
+
+static PyObject *Qt_VDGetBrightness(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ unsigned short brightness;
+#ifndef VDGetBrightness
+ PyMac_PRECHECK(VDGetBrightness);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDGetBrightness(ci,
+ &brightness);
+ _res = Py_BuildValue("lH",
+ _rv,
+ brightness);
+ return _res;
+}
+
+static PyObject *Qt_VDSetContrast(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ unsigned short contrast;
+#ifndef VDSetContrast
+ PyMac_PRECHECK(VDSetContrast);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDSetContrast(ci,
+ &contrast);
+ _res = Py_BuildValue("lH",
+ _rv,
+ contrast);
+ return _res;
+}
+
+static PyObject *Qt_VDSetHue(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ unsigned short hue;
+#ifndef VDSetHue
+ PyMac_PRECHECK(VDSetHue);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDSetHue(ci,
+ &hue);
+ _res = Py_BuildValue("lH",
+ _rv,
+ hue);
+ return _res;
+}
+
+static PyObject *Qt_VDSetSharpness(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ unsigned short sharpness;
+#ifndef VDSetSharpness
+ PyMac_PRECHECK(VDSetSharpness);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDSetSharpness(ci,
+ &sharpness);
+ _res = Py_BuildValue("lH",
+ _rv,
+ sharpness);
+ return _res;
+}
+
+static PyObject *Qt_VDSetSaturation(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ unsigned short saturation;
+#ifndef VDSetSaturation
+ PyMac_PRECHECK(VDSetSaturation);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDSetSaturation(ci,
+ &saturation);
+ _res = Py_BuildValue("lH",
+ _rv,
+ saturation);
+ return _res;
+}
+
+static PyObject *Qt_VDGetContrast(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ unsigned short contrast;
+#ifndef VDGetContrast
+ PyMac_PRECHECK(VDGetContrast);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDGetContrast(ci,
+ &contrast);
+ _res = Py_BuildValue("lH",
+ _rv,
+ contrast);
+ return _res;
+}
+
+static PyObject *Qt_VDGetHue(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ unsigned short hue;
+#ifndef VDGetHue
+ PyMac_PRECHECK(VDGetHue);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDGetHue(ci,
+ &hue);
+ _res = Py_BuildValue("lH",
+ _rv,
+ hue);
+ return _res;
+}
+
+static PyObject *Qt_VDGetSharpness(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ unsigned short sharpness;
+#ifndef VDGetSharpness
+ PyMac_PRECHECK(VDGetSharpness);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDGetSharpness(ci,
+ &sharpness);
+ _res = Py_BuildValue("lH",
+ _rv,
+ sharpness);
+ return _res;
+}
+
+static PyObject *Qt_VDGetSaturation(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ unsigned short saturation;
+#ifndef VDGetSaturation
+ PyMac_PRECHECK(VDGetSaturation);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDGetSaturation(ci,
+ &saturation);
+ _res = Py_BuildValue("lH",
+ _rv,
+ saturation);
+ return _res;
+}
+
+static PyObject *Qt_VDGrabOneFrame(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+#ifndef VDGrabOneFrame
+ PyMac_PRECHECK(VDGrabOneFrame);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDGrabOneFrame(ci);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VDGetMaxAuxBuffer(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ PixMapHandle pm;
+ Rect r;
+#ifndef VDGetMaxAuxBuffer
+ PyMac_PRECHECK(VDGetMaxAuxBuffer);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDGetMaxAuxBuffer(ci,
+ &pm,
+ &r);
+ _res = Py_BuildValue("lO&O&",
+ _rv,
+ ResObj_New, pm,
+ PyMac_BuildRect, &r);
+ return _res;
+}
+
+static PyObject *Qt_VDGetCurrentFlags(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ long inputCurrentFlag;
+ long outputCurrentFlag;
+#ifndef VDGetCurrentFlags
+ PyMac_PRECHECK(VDGetCurrentFlags);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDGetCurrentFlags(ci,
+ &inputCurrentFlag,
+ &outputCurrentFlag);
+ _res = Py_BuildValue("lll",
+ _rv,
+ inputCurrentFlag,
+ outputCurrentFlag);
+ return _res;
+}
+
+static PyObject *Qt_VDSetKeyColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ long index;
+#ifndef VDSetKeyColor
+ PyMac_PRECHECK(VDSetKeyColor);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &ci,
+ &index))
+ return NULL;
+ _rv = VDSetKeyColor(ci,
+ index);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VDGetKeyColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ long index;
+#ifndef VDGetKeyColor
+ PyMac_PRECHECK(VDGetKeyColor);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDGetKeyColor(ci,
+ &index);
+ _res = Py_BuildValue("ll",
+ _rv,
+ index);
+ return _res;
+}
+
+static PyObject *Qt_VDAddKeyColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ long index;
+#ifndef VDAddKeyColor
+ PyMac_PRECHECK(VDAddKeyColor);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDAddKeyColor(ci,
+ &index);
+ _res = Py_BuildValue("ll",
+ _rv,
+ index);
+ return _res;
+}
+
+static PyObject *Qt_VDGetNextKeyColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ long index;
+#ifndef VDGetNextKeyColor
+ PyMac_PRECHECK(VDGetNextKeyColor);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &ci,
+ &index))
+ return NULL;
+ _rv = VDGetNextKeyColor(ci,
+ index);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VDSetKeyColorRange(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ RGBColor minRGB;
+ RGBColor maxRGB;
+#ifndef VDSetKeyColorRange
+ PyMac_PRECHECK(VDSetKeyColorRange);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDSetKeyColorRange(ci,
+ &minRGB,
+ &maxRGB);
+ _res = Py_BuildValue("lO&O&",
+ _rv,
+ QdRGB_New, &minRGB,
+ QdRGB_New, &maxRGB);
+ return _res;
+}
+
+static PyObject *Qt_VDGetKeyColorRange(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ RGBColor minRGB;
+ RGBColor maxRGB;
+#ifndef VDGetKeyColorRange
+ PyMac_PRECHECK(VDGetKeyColorRange);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDGetKeyColorRange(ci,
+ &minRGB,
+ &maxRGB);
+ _res = Py_BuildValue("lO&O&",
+ _rv,
+ QdRGB_New, &minRGB,
+ QdRGB_New, &maxRGB);
+ return _res;
+}
+
+static PyObject *Qt_VDSetInputColorSpaceMode(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ short colorSpaceMode;
+#ifndef VDSetInputColorSpaceMode
+ PyMac_PRECHECK(VDSetInputColorSpaceMode);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ CmpInstObj_Convert, &ci,
+ &colorSpaceMode))
+ return NULL;
+ _rv = VDSetInputColorSpaceMode(ci,
+ colorSpaceMode);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VDGetInputColorSpaceMode(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ short colorSpaceMode;
+#ifndef VDGetInputColorSpaceMode
+ PyMac_PRECHECK(VDGetInputColorSpaceMode);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDGetInputColorSpaceMode(ci,
+ &colorSpaceMode);
+ _res = Py_BuildValue("lh",
+ _rv,
+ colorSpaceMode);
+ return _res;
+}
+
+static PyObject *Qt_VDSetClipState(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ short clipEnable;
+#ifndef VDSetClipState
+ PyMac_PRECHECK(VDSetClipState);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ CmpInstObj_Convert, &ci,
+ &clipEnable))
+ return NULL;
+ _rv = VDSetClipState(ci,
+ clipEnable);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VDGetClipState(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ short clipEnable;
+#ifndef VDGetClipState
+ PyMac_PRECHECK(VDGetClipState);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDGetClipState(ci,
+ &clipEnable);
+ _res = Py_BuildValue("lh",
+ _rv,
+ clipEnable);
+ return _res;
+}
+
+static PyObject *Qt_VDSetClipRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ RgnHandle clipRegion;
+#ifndef VDSetClipRgn
+ PyMac_PRECHECK(VDSetClipRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &ci,
+ ResObj_Convert, &clipRegion))
+ return NULL;
+ _rv = VDSetClipRgn(ci,
+ clipRegion);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VDClearClipRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ RgnHandle clipRegion;
+#ifndef VDClearClipRgn
+ PyMac_PRECHECK(VDClearClipRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &ci,
+ ResObj_Convert, &clipRegion))
+ return NULL;
+ _rv = VDClearClipRgn(ci,
+ clipRegion);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VDGetCLUTInUse(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ CTabHandle colorTableHandle;
+#ifndef VDGetCLUTInUse
+ PyMac_PRECHECK(VDGetCLUTInUse);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDGetCLUTInUse(ci,
+ &colorTableHandle);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, colorTableHandle);
+ return _res;
+}
+
+static PyObject *Qt_VDSetPLLFilterType(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ short pllType;
+#ifndef VDSetPLLFilterType
+ PyMac_PRECHECK(VDSetPLLFilterType);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ CmpInstObj_Convert, &ci,
+ &pllType))
+ return NULL;
+ _rv = VDSetPLLFilterType(ci,
+ pllType);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VDGetPLLFilterType(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ short pllType;
+#ifndef VDGetPLLFilterType
+ PyMac_PRECHECK(VDGetPLLFilterType);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDGetPLLFilterType(ci,
+ &pllType);
+ _res = Py_BuildValue("lh",
+ _rv,
+ pllType);
+ return _res;
+}
+
+static PyObject *Qt_VDGetMaskandValue(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ unsigned short blendLevel;
+ long mask;
+ long value;
+#ifndef VDGetMaskandValue
+ PyMac_PRECHECK(VDGetMaskandValue);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&H",
+ CmpInstObj_Convert, &ci,
+ &blendLevel))
+ return NULL;
+ _rv = VDGetMaskandValue(ci,
+ blendLevel,
+ &mask,
+ &value);
+ _res = Py_BuildValue("lll",
+ _rv,
+ mask,
+ value);
+ return _res;
+}
+
+static PyObject *Qt_VDSetMasterBlendLevel(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ unsigned short blendLevel;
+#ifndef VDSetMasterBlendLevel
+ PyMac_PRECHECK(VDSetMasterBlendLevel);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDSetMasterBlendLevel(ci,
+ &blendLevel);
+ _res = Py_BuildValue("lH",
+ _rv,
+ blendLevel);
+ return _res;
+}
+
+static PyObject *Qt_VDSetPlayThruOnOff(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ short state;
+#ifndef VDSetPlayThruOnOff
+ PyMac_PRECHECK(VDSetPlayThruOnOff);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ CmpInstObj_Convert, &ci,
+ &state))
+ return NULL;
+ _rv = VDSetPlayThruOnOff(ci,
+ state);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VDSetFieldPreference(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ short fieldFlag;
+#ifndef VDSetFieldPreference
+ PyMac_PRECHECK(VDSetFieldPreference);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ CmpInstObj_Convert, &ci,
+ &fieldFlag))
+ return NULL;
+ _rv = VDSetFieldPreference(ci,
+ fieldFlag);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VDGetFieldPreference(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ short fieldFlag;
+#ifndef VDGetFieldPreference
+ PyMac_PRECHECK(VDGetFieldPreference);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDGetFieldPreference(ci,
+ &fieldFlag);
+ _res = Py_BuildValue("lh",
+ _rv,
+ fieldFlag);
+ return _res;
+}
+
+static PyObject *Qt_VDPreflightGlobalRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ GrafPtr theWindow;
+ Rect globalRect;
+#ifndef VDPreflightGlobalRect
+ PyMac_PRECHECK(VDPreflightGlobalRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &ci,
+ GrafObj_Convert, &theWindow))
+ return NULL;
+ _rv = VDPreflightGlobalRect(ci,
+ theWindow,
+ &globalRect);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildRect, &globalRect);
+ return _res;
+}
+
+static PyObject *Qt_VDSetPlayThruGlobalRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ GrafPtr theWindow;
+ Rect globalRect;
+#ifndef VDSetPlayThruGlobalRect
+ PyMac_PRECHECK(VDSetPlayThruGlobalRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &ci,
+ GrafObj_Convert, &theWindow))
+ return NULL;
+ _rv = VDSetPlayThruGlobalRect(ci,
+ theWindow,
+ &globalRect);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildRect, &globalRect);
+ return _res;
+}
+
+static PyObject *Qt_VDSetBlackLevelValue(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ unsigned short blackLevel;
+#ifndef VDSetBlackLevelValue
+ PyMac_PRECHECK(VDSetBlackLevelValue);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDSetBlackLevelValue(ci,
+ &blackLevel);
+ _res = Py_BuildValue("lH",
+ _rv,
+ blackLevel);
+ return _res;
+}
+
+static PyObject *Qt_VDGetBlackLevelValue(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ unsigned short blackLevel;
+#ifndef VDGetBlackLevelValue
+ PyMac_PRECHECK(VDGetBlackLevelValue);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDGetBlackLevelValue(ci,
+ &blackLevel);
+ _res = Py_BuildValue("lH",
+ _rv,
+ blackLevel);
+ return _res;
+}
+
+static PyObject *Qt_VDSetWhiteLevelValue(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ unsigned short whiteLevel;
+#ifndef VDSetWhiteLevelValue
+ PyMac_PRECHECK(VDSetWhiteLevelValue);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDSetWhiteLevelValue(ci,
+ &whiteLevel);
+ _res = Py_BuildValue("lH",
+ _rv,
+ whiteLevel);
+ return _res;
+}
+
+static PyObject *Qt_VDGetWhiteLevelValue(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ unsigned short whiteLevel;
+#ifndef VDGetWhiteLevelValue
+ PyMac_PRECHECK(VDGetWhiteLevelValue);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDGetWhiteLevelValue(ci,
+ &whiteLevel);
+ _res = Py_BuildValue("lH",
+ _rv,
+ whiteLevel);
+ return _res;
+}
+
+static PyObject *Qt_VDGetVideoDefaults(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ unsigned short blackLevel;
+ unsigned short whiteLevel;
+ unsigned short brightness;
+ unsigned short hue;
+ unsigned short saturation;
+ unsigned short contrast;
+ unsigned short sharpness;
+#ifndef VDGetVideoDefaults
+ PyMac_PRECHECK(VDGetVideoDefaults);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDGetVideoDefaults(ci,
+ &blackLevel,
+ &whiteLevel,
+ &brightness,
+ &hue,
+ &saturation,
+ &contrast,
+ &sharpness);
+ _res = Py_BuildValue("lHHHHHHH",
+ _rv,
+ blackLevel,
+ whiteLevel,
+ brightness,
+ hue,
+ saturation,
+ contrast,
+ sharpness);
+ return _res;
+}
+
+static PyObject *Qt_VDGetNumberOfInputs(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ short inputs;
+#ifndef VDGetNumberOfInputs
+ PyMac_PRECHECK(VDGetNumberOfInputs);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDGetNumberOfInputs(ci,
+ &inputs);
+ _res = Py_BuildValue("lh",
+ _rv,
+ inputs);
+ return _res;
+}
+
+static PyObject *Qt_VDGetInputFormat(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ short input;
+ short format;
+#ifndef VDGetInputFormat
+ PyMac_PRECHECK(VDGetInputFormat);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ CmpInstObj_Convert, &ci,
+ &input))
+ return NULL;
+ _rv = VDGetInputFormat(ci,
+ input,
+ &format);
+ _res = Py_BuildValue("lh",
+ _rv,
+ format);
+ return _res;
+}
+
+static PyObject *Qt_VDSetInput(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ short input;
+#ifndef VDSetInput
+ PyMac_PRECHECK(VDSetInput);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ CmpInstObj_Convert, &ci,
+ &input))
+ return NULL;
+ _rv = VDSetInput(ci,
+ input);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VDGetInput(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ short input;
+#ifndef VDGetInput
+ PyMac_PRECHECK(VDGetInput);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDGetInput(ci,
+ &input);
+ _res = Py_BuildValue("lh",
+ _rv,
+ input);
+ return _res;
+}
+
+static PyObject *Qt_VDSetInputStandard(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ short inputStandard;
+#ifndef VDSetInputStandard
+ PyMac_PRECHECK(VDSetInputStandard);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ CmpInstObj_Convert, &ci,
+ &inputStandard))
+ return NULL;
+ _rv = VDSetInputStandard(ci,
+ inputStandard);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VDSetupBuffers(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ VdigBufferRecListHandle bufferList;
+#ifndef VDSetupBuffers
+ PyMac_PRECHECK(VDSetupBuffers);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &ci,
+ ResObj_Convert, &bufferList))
+ return NULL;
+ _rv = VDSetupBuffers(ci,
+ bufferList);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VDGrabOneFrameAsync(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ short buffer;
+#ifndef VDGrabOneFrameAsync
+ PyMac_PRECHECK(VDGrabOneFrameAsync);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ CmpInstObj_Convert, &ci,
+ &buffer))
+ return NULL;
+ _rv = VDGrabOneFrameAsync(ci,
+ buffer);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VDDone(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ short buffer;
+#ifndef VDDone
+ PyMac_PRECHECK(VDDone);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ CmpInstObj_Convert, &ci,
+ &buffer))
+ return NULL;
+ _rv = VDDone(ci,
+ buffer);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VDSetCompression(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ OSType compressType;
+ short depth;
+ Rect bounds;
+ CodecQ spatialQuality;
+ CodecQ temporalQuality;
+ long keyFrameRate;
+#ifndef VDSetCompression
+ PyMac_PRECHECK(VDSetCompression);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&hlll",
+ CmpInstObj_Convert, &ci,
+ PyMac_GetOSType, &compressType,
+ &depth,
+ &spatialQuality,
+ &temporalQuality,
+ &keyFrameRate))
+ return NULL;
+ _rv = VDSetCompression(ci,
+ compressType,
+ depth,
+ &bounds,
+ spatialQuality,
+ temporalQuality,
+ keyFrameRate);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildRect, &bounds);
+ return _res;
+}
+
+static PyObject *Qt_VDCompressOneFrameAsync(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+#ifndef VDCompressOneFrameAsync
+ PyMac_PRECHECK(VDCompressOneFrameAsync);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDCompressOneFrameAsync(ci);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VDGetImageDescription(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ ImageDescriptionHandle desc;
+#ifndef VDGetImageDescription
+ PyMac_PRECHECK(VDGetImageDescription);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &ci,
+ ResObj_Convert, &desc))
+ return NULL;
+ _rv = VDGetImageDescription(ci,
+ desc);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VDResetCompressSequence(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+#ifndef VDResetCompressSequence
+ PyMac_PRECHECK(VDResetCompressSequence);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDResetCompressSequence(ci);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VDSetCompressionOnOff(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ Boolean state;
+#ifndef VDSetCompressionOnOff
+ PyMac_PRECHECK(VDSetCompressionOnOff);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&b",
+ CmpInstObj_Convert, &ci,
+ &state))
+ return NULL;
+ _rv = VDSetCompressionOnOff(ci,
+ state);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VDGetCompressionTypes(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ VDCompressionListHandle h;
+#ifndef VDGetCompressionTypes
+ PyMac_PRECHECK(VDGetCompressionTypes);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &ci,
+ ResObj_Convert, &h))
+ return NULL;
+ _rv = VDGetCompressionTypes(ci,
+ h);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VDSetTimeBase(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ TimeBase t;
+#ifndef VDSetTimeBase
+ PyMac_PRECHECK(VDSetTimeBase);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &ci,
+ TimeBaseObj_Convert, &t))
+ return NULL;
+ _rv = VDSetTimeBase(ci,
+ t);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VDSetFrameRate(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ Fixed framesPerSecond;
+#ifndef VDSetFrameRate
+ PyMac_PRECHECK(VDSetFrameRate);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &ci,
+ PyMac_GetFixed, &framesPerSecond))
+ return NULL;
+ _rv = VDSetFrameRate(ci,
+ framesPerSecond);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VDGetDataRate(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ long milliSecPerFrame;
+ Fixed framesPerSecond;
+ long bytesPerSecond;
+#ifndef VDGetDataRate
+ PyMac_PRECHECK(VDGetDataRate);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDGetDataRate(ci,
+ &milliSecPerFrame,
+ &framesPerSecond,
+ &bytesPerSecond);
+ _res = Py_BuildValue("llO&l",
+ _rv,
+ milliSecPerFrame,
+ PyMac_BuildFixed, framesPerSecond,
+ bytesPerSecond);
+ return _res;
+}
+
+static PyObject *Qt_VDGetSoundInputDriver(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ Str255 soundDriverName;
+#ifndef VDGetSoundInputDriver
+ PyMac_PRECHECK(VDGetSoundInputDriver);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &ci,
+ PyMac_GetStr255, soundDriverName))
+ return NULL;
+ _rv = VDGetSoundInputDriver(ci,
+ soundDriverName);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VDGetDMADepths(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ long depthArray;
+ long preferredDepth;
+#ifndef VDGetDMADepths
+ PyMac_PRECHECK(VDGetDMADepths);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDGetDMADepths(ci,
+ &depthArray,
+ &preferredDepth);
+ _res = Py_BuildValue("lll",
+ _rv,
+ depthArray,
+ preferredDepth);
+ return _res;
+}
+
+static PyObject *Qt_VDGetPreferredTimeScale(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ TimeScale preferred;
+#ifndef VDGetPreferredTimeScale
+ PyMac_PRECHECK(VDGetPreferredTimeScale);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDGetPreferredTimeScale(ci,
+ &preferred);
+ _res = Py_BuildValue("ll",
+ _rv,
+ preferred);
+ return _res;
+}
+
+static PyObject *Qt_VDReleaseAsyncBuffers(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+#ifndef VDReleaseAsyncBuffers
+ PyMac_PRECHECK(VDReleaseAsyncBuffers);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDReleaseAsyncBuffers(ci);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VDSetDataRate(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ long bytesPerSecond;
+#ifndef VDSetDataRate
+ PyMac_PRECHECK(VDSetDataRate);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &ci,
+ &bytesPerSecond))
+ return NULL;
+ _rv = VDSetDataRate(ci,
+ bytesPerSecond);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VDGetTimeCode(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ TimeRecord atTime;
+ void * timeCodeFormat;
+ void * timeCodeTime;
+#ifndef VDGetTimeCode
+ PyMac_PRECHECK(VDGetTimeCode);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ss",
+ CmpInstObj_Convert, &ci,
+ &timeCodeFormat,
+ &timeCodeTime))
+ return NULL;
+ _rv = VDGetTimeCode(ci,
+ &atTime,
+ timeCodeFormat,
+ timeCodeTime);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ QtTimeRecord_New, &atTime);
+ return _res;
+}
+
+static PyObject *Qt_VDUseSafeBuffers(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ Boolean useSafeBuffers;
+#ifndef VDUseSafeBuffers
+ PyMac_PRECHECK(VDUseSafeBuffers);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&b",
+ CmpInstObj_Convert, &ci,
+ &useSafeBuffers))
+ return NULL;
+ _rv = VDUseSafeBuffers(ci,
+ useSafeBuffers);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VDGetSoundInputSource(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ long videoInput;
+ long soundInput;
+#ifndef VDGetSoundInputSource
+ PyMac_PRECHECK(VDGetSoundInputSource);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &ci,
+ &videoInput))
+ return NULL;
+ _rv = VDGetSoundInputSource(ci,
+ videoInput,
+ &soundInput);
+ _res = Py_BuildValue("ll",
+ _rv,
+ soundInput);
+ return _res;
+}
+
+static PyObject *Qt_VDGetCompressionTime(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ OSType compressionType;
+ short depth;
+ Rect srcRect;
+ CodecQ spatialQuality;
+ CodecQ temporalQuality;
+ unsigned long compressTime;
+#ifndef VDGetCompressionTime
+ PyMac_PRECHECK(VDGetCompressionTime);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&h",
+ CmpInstObj_Convert, &ci,
+ PyMac_GetOSType, &compressionType,
+ &depth))
+ return NULL;
+ _rv = VDGetCompressionTime(ci,
+ compressionType,
+ depth,
+ &srcRect,
+ &spatialQuality,
+ &temporalQuality,
+ &compressTime);
+ _res = Py_BuildValue("lO&lll",
+ _rv,
+ PyMac_BuildRect, &srcRect,
+ spatialQuality,
+ temporalQuality,
+ compressTime);
+ return _res;
+}
+
+static PyObject *Qt_VDSetPreferredPacketSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ long preferredPacketSizeInBytes;
+#ifndef VDSetPreferredPacketSize
+ PyMac_PRECHECK(VDSetPreferredPacketSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &ci,
+ &preferredPacketSizeInBytes))
+ return NULL;
+ _rv = VDSetPreferredPacketSize(ci,
+ preferredPacketSizeInBytes);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VDSetPreferredImageDimensions(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ long width;
+ long height;
+#ifndef VDSetPreferredImageDimensions
+ PyMac_PRECHECK(VDSetPreferredImageDimensions);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ CmpInstObj_Convert, &ci,
+ &width,
+ &height))
+ return NULL;
+ _rv = VDSetPreferredImageDimensions(ci,
+ width,
+ height);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VDGetPreferredImageDimensions(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ long width;
+ long height;
+#ifndef VDGetPreferredImageDimensions
+ PyMac_PRECHECK(VDGetPreferredImageDimensions);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = VDGetPreferredImageDimensions(ci,
+ &width,
+ &height);
+ _res = Py_BuildValue("lll",
+ _rv,
+ width,
+ height);
+ return _res;
+}
+
+static PyObject *Qt_VDGetInputName(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ long videoInput;
+ Str255 name;
+#ifndef VDGetInputName
+ PyMac_PRECHECK(VDGetInputName);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lO&",
+ CmpInstObj_Convert, &ci,
+ &videoInput,
+ PyMac_GetStr255, name))
+ return NULL;
+ _rv = VDGetInputName(ci,
+ videoInput,
+ name);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VDSetDestinationPort(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ CGrafPtr destPort;
+#ifndef VDSetDestinationPort
+ PyMac_PRECHECK(VDSetDestinationPort);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &ci,
+ GrafObj_Convert, &destPort))
+ return NULL;
+ _rv = VDSetDestinationPort(ci,
+ destPort);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VDGetDeviceNameAndFlags(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ Str255 outName;
+ UInt32 outNameFlags;
+#ifndef VDGetDeviceNameAndFlags
+ PyMac_PRECHECK(VDGetDeviceNameAndFlags);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &ci,
+ PyMac_GetStr255, outName))
+ return NULL;
+ _rv = VDGetDeviceNameAndFlags(ci,
+ outName,
+ &outNameFlags);
+ _res = Py_BuildValue("ll",
+ _rv,
+ outNameFlags);
+ return _res;
+}
+
+static PyObject *Qt_VDCaptureStateChanging(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ VideoDigitizerComponent ci;
+ UInt32 inStateFlags;
+#ifndef VDCaptureStateChanging
+ PyMac_PRECHECK(VDCaptureStateChanging);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &ci,
+ &inStateFlags))
+ return NULL;
+ _rv = VDCaptureStateChanging(ci,
+ inStateFlags);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_XMLParseGetDetailedParseError(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ComponentInstance aParser;
+ long errorLine;
+ StringPtr errDesc;
+#ifndef XMLParseGetDetailedParseError
+ PyMac_PRECHECK(XMLParseGetDetailedParseError);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&s",
+ CmpInstObj_Convert, &aParser,
+ &errDesc))
+ return NULL;
+ _rv = XMLParseGetDetailedParseError(aParser,
+ &errorLine,
+ errDesc);
+ _res = Py_BuildValue("ll",
+ _rv,
+ errorLine);
+ return _res;
+}
+
+static PyObject *Qt_XMLParseAddElement(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ComponentInstance aParser;
+ char elementName;
+ UInt32 nameSpaceID;
+ UInt32 elementID;
+ long elementFlags;
+#ifndef XMLParseAddElement
+ PyMac_PRECHECK(XMLParseAddElement);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ CmpInstObj_Convert, &aParser,
+ &nameSpaceID,
+ &elementFlags))
+ return NULL;
+ _rv = XMLParseAddElement(aParser,
+ &elementName,
+ nameSpaceID,
+ &elementID,
+ elementFlags);
+ _res = Py_BuildValue("lcl",
+ _rv,
+ elementName,
+ elementID);
+ return _res;
+}
+
+static PyObject *Qt_XMLParseAddAttribute(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ComponentInstance aParser;
+ UInt32 elementID;
+ UInt32 nameSpaceID;
+ char attributeName;
+ UInt32 attributeID;
+#ifndef XMLParseAddAttribute
+ PyMac_PRECHECK(XMLParseAddAttribute);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ CmpInstObj_Convert, &aParser,
+ &elementID,
+ &nameSpaceID))
+ return NULL;
+ _rv = XMLParseAddAttribute(aParser,
+ elementID,
+ nameSpaceID,
+ &attributeName,
+ &attributeID);
+ _res = Py_BuildValue("lcl",
+ _rv,
+ attributeName,
+ attributeID);
+ return _res;
+}
+
+static PyObject *Qt_XMLParseAddMultipleAttributes(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ComponentInstance aParser;
+ UInt32 elementID;
+ UInt32 nameSpaceIDs;
+ char attributeNames;
+ UInt32 attributeIDs;
+#ifndef XMLParseAddMultipleAttributes
+ PyMac_PRECHECK(XMLParseAddMultipleAttributes);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &aParser,
+ &elementID))
+ return NULL;
+ _rv = XMLParseAddMultipleAttributes(aParser,
+ elementID,
+ &nameSpaceIDs,
+ &attributeNames,
+ &attributeIDs);
+ _res = Py_BuildValue("llcl",
+ _rv,
+ nameSpaceIDs,
+ attributeNames,
+ attributeIDs);
+ return _res;
+}
+
+static PyObject *Qt_XMLParseAddAttributeAndValue(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ComponentInstance aParser;
+ UInt32 elementID;
+ UInt32 nameSpaceID;
+ char attributeName;
+ UInt32 attributeID;
+ UInt32 attributeValueKind;
+ void * attributeValueKindInfo;
+#ifndef XMLParseAddAttributeAndValue
+ PyMac_PRECHECK(XMLParseAddAttributeAndValue);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&llls",
+ CmpInstObj_Convert, &aParser,
+ &elementID,
+ &nameSpaceID,
+ &attributeValueKind,
+ &attributeValueKindInfo))
+ return NULL;
+ _rv = XMLParseAddAttributeAndValue(aParser,
+ elementID,
+ nameSpaceID,
+ &attributeName,
+ &attributeID,
+ attributeValueKind,
+ attributeValueKindInfo);
+ _res = Py_BuildValue("lcl",
+ _rv,
+ attributeName,
+ attributeID);
+ return _res;
+}
+
+static PyObject *Qt_XMLParseAddAttributeValueKind(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ComponentInstance aParser;
+ UInt32 elementID;
+ UInt32 attributeID;
+ UInt32 attributeValueKind;
+ void * attributeValueKindInfo;
+#ifndef XMLParseAddAttributeValueKind
+ PyMac_PRECHECK(XMLParseAddAttributeValueKind);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&llls",
+ CmpInstObj_Convert, &aParser,
+ &elementID,
+ &attributeID,
+ &attributeValueKind,
+ &attributeValueKindInfo))
+ return NULL;
+ _rv = XMLParseAddAttributeValueKind(aParser,
+ elementID,
+ attributeID,
+ attributeValueKind,
+ attributeValueKindInfo);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_XMLParseAddNameSpace(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ComponentInstance aParser;
+ char nameSpaceURL;
+ UInt32 nameSpaceID;
+#ifndef XMLParseAddNameSpace
+ PyMac_PRECHECK(XMLParseAddNameSpace);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &aParser))
+ return NULL;
+ _rv = XMLParseAddNameSpace(aParser,
+ &nameSpaceURL,
+ &nameSpaceID);
+ _res = Py_BuildValue("lcl",
+ _rv,
+ nameSpaceURL,
+ nameSpaceID);
+ return _res;
+}
+
+static PyObject *Qt_XMLParseSetOffsetAndLimit(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ComponentInstance aParser;
+ UInt32 offset;
+ UInt32 limit;
+#ifndef XMLParseSetOffsetAndLimit
+ PyMac_PRECHECK(XMLParseSetOffsetAndLimit);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ CmpInstObj_Convert, &aParser,
+ &offset,
+ &limit))
+ return NULL;
+ _rv = XMLParseSetOffsetAndLimit(aParser,
+ offset,
+ limit);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_XMLParseSetEventParseRefCon(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ComponentInstance aParser;
+ long refcon;
+#ifndef XMLParseSetEventParseRefCon
+ PyMac_PRECHECK(XMLParseSetEventParseRefCon);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &aParser,
+ &refcon))
+ return NULL;
+ _rv = XMLParseSetEventParseRefCon(aParser,
+ refcon);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGInitialize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+#ifndef SGInitialize
+ PyMac_PRECHECK(SGInitialize);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &s))
+ return NULL;
+ _rv = SGInitialize(s);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGSetDataOutput(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ FSSpec movieFile;
+ long whereFlags;
+#ifndef SGSetDataOutput
+ PyMac_PRECHECK(SGSetDataOutput);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&l",
+ CmpInstObj_Convert, &s,
+ PyMac_GetFSSpec, &movieFile,
+ &whereFlags))
+ return NULL;
+ _rv = SGSetDataOutput(s,
+ &movieFile,
+ whereFlags);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGGetDataOutput(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ FSSpec movieFile;
+ long whereFlags;
+#ifndef SGGetDataOutput
+ PyMac_PRECHECK(SGGetDataOutput);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &s,
+ PyMac_GetFSSpec, &movieFile))
+ return NULL;
+ _rv = SGGetDataOutput(s,
+ &movieFile,
+ &whereFlags);
+ _res = Py_BuildValue("ll",
+ _rv,
+ whereFlags);
+ return _res;
+}
+
+static PyObject *Qt_SGSetGWorld(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ CGrafPtr gp;
+ GDHandle gd;
+#ifndef SGSetGWorld
+ PyMac_PRECHECK(SGSetGWorld);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CmpInstObj_Convert, &s,
+ GrafObj_Convert, &gp,
+ OptResObj_Convert, &gd))
+ return NULL;
+ _rv = SGSetGWorld(s,
+ gp,
+ gd);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGGetGWorld(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ CGrafPtr gp;
+ GDHandle gd;
+#ifndef SGGetGWorld
+ PyMac_PRECHECK(SGGetGWorld);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &s))
+ return NULL;
+ _rv = SGGetGWorld(s,
+ &gp,
+ &gd);
+ _res = Py_BuildValue("lO&O&",
+ _rv,
+ GrafObj_New, gp,
+ OptResObj_New, gd);
+ return _res;
+}
+
+static PyObject *Qt_SGNewChannel(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ OSType channelType;
+ SGChannel ref;
+#ifndef SGNewChannel
+ PyMac_PRECHECK(SGNewChannel);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &s,
+ PyMac_GetOSType, &channelType))
+ return NULL;
+ _rv = SGNewChannel(s,
+ channelType,
+ &ref);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ CmpInstObj_New, ref);
+ return _res;
+}
+
+static PyObject *Qt_SGDisposeChannel(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ SGChannel c;
+#ifndef SGDisposeChannel
+ PyMac_PRECHECK(SGDisposeChannel);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &s,
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGDisposeChannel(s,
+ c);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGStartPreview(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+#ifndef SGStartPreview
+ PyMac_PRECHECK(SGStartPreview);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &s))
+ return NULL;
+ _rv = SGStartPreview(s);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGStartRecord(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+#ifndef SGStartRecord
+ PyMac_PRECHECK(SGStartRecord);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &s))
+ return NULL;
+ _rv = SGStartRecord(s);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGIdle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+#ifndef SGIdle
+ PyMac_PRECHECK(SGIdle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &s))
+ return NULL;
+ _rv = SGIdle(s);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGStop(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+#ifndef SGStop
+ PyMac_PRECHECK(SGStop);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &s))
+ return NULL;
+ _rv = SGStop(s);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGPause(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ Boolean pause;
+#ifndef SGPause
+ PyMac_PRECHECK(SGPause);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&b",
+ CmpInstObj_Convert, &s,
+ &pause))
+ return NULL;
+ _rv = SGPause(s,
+ pause);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGPrepare(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ Boolean prepareForPreview;
+ Boolean prepareForRecord;
+#ifndef SGPrepare
+ PyMac_PRECHECK(SGPrepare);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&bb",
+ CmpInstObj_Convert, &s,
+ &prepareForPreview,
+ &prepareForRecord))
+ return NULL;
+ _rv = SGPrepare(s,
+ prepareForPreview,
+ prepareForRecord);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGRelease(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+#ifndef SGRelease
+ PyMac_PRECHECK(SGRelease);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &s))
+ return NULL;
+ _rv = SGRelease(s);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGGetMovie(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Movie _rv;
+ SeqGrabComponent s;
+#ifndef SGGetMovie
+ PyMac_PRECHECK(SGGetMovie);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &s))
+ return NULL;
+ _rv = SGGetMovie(s);
+ _res = Py_BuildValue("O&",
+ MovieObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGSetMaximumRecordTime(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ unsigned long ticks;
+#ifndef SGSetMaximumRecordTime
+ PyMac_PRECHECK(SGSetMaximumRecordTime);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &s,
+ &ticks))
+ return NULL;
+ _rv = SGSetMaximumRecordTime(s,
+ ticks);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGGetMaximumRecordTime(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ unsigned long ticks;
+#ifndef SGGetMaximumRecordTime
+ PyMac_PRECHECK(SGGetMaximumRecordTime);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &s))
+ return NULL;
+ _rv = SGGetMaximumRecordTime(s,
+ &ticks);
+ _res = Py_BuildValue("ll",
+ _rv,
+ ticks);
+ return _res;
+}
+
+static PyObject *Qt_SGGetStorageSpaceRemaining(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ unsigned long bytes;
+#ifndef SGGetStorageSpaceRemaining
+ PyMac_PRECHECK(SGGetStorageSpaceRemaining);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &s))
+ return NULL;
+ _rv = SGGetStorageSpaceRemaining(s,
+ &bytes);
+ _res = Py_BuildValue("ll",
+ _rv,
+ bytes);
+ return _res;
+}
+
+static PyObject *Qt_SGGetTimeRemaining(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ long ticksLeft;
+#ifndef SGGetTimeRemaining
+ PyMac_PRECHECK(SGGetTimeRemaining);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &s))
+ return NULL;
+ _rv = SGGetTimeRemaining(s,
+ &ticksLeft);
+ _res = Py_BuildValue("ll",
+ _rv,
+ ticksLeft);
+ return _res;
+}
+
+static PyObject *Qt_SGGrabPict(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ PicHandle p;
+ Rect bounds;
+ short offscreenDepth;
+ long grabPictFlags;
+#ifndef SGGrabPict
+ PyMac_PRECHECK(SGGrabPict);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&hl",
+ CmpInstObj_Convert, &s,
+ PyMac_GetRect, &bounds,
+ &offscreenDepth,
+ &grabPictFlags))
+ return NULL;
+ _rv = SGGrabPict(s,
+ &p,
+ &bounds,
+ offscreenDepth,
+ grabPictFlags);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, p);
+ return _res;
+}
+
+static PyObject *Qt_SGGetLastMovieResID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ short resID;
+#ifndef SGGetLastMovieResID
+ PyMac_PRECHECK(SGGetLastMovieResID);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &s))
+ return NULL;
+ _rv = SGGetLastMovieResID(s,
+ &resID);
+ _res = Py_BuildValue("lh",
+ _rv,
+ resID);
+ return _res;
+}
+
+static PyObject *Qt_SGSetFlags(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ long sgFlags;
+#ifndef SGSetFlags
+ PyMac_PRECHECK(SGSetFlags);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &s,
+ &sgFlags))
+ return NULL;
+ _rv = SGSetFlags(s,
+ sgFlags);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGGetFlags(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ long sgFlags;
+#ifndef SGGetFlags
+ PyMac_PRECHECK(SGGetFlags);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &s))
+ return NULL;
+ _rv = SGGetFlags(s,
+ &sgFlags);
+ _res = Py_BuildValue("ll",
+ _rv,
+ sgFlags);
+ return _res;
+}
+
+static PyObject *Qt_SGNewChannelFromComponent(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ SGChannel newChannel;
+ Component sgChannelComponent;
+#ifndef SGNewChannelFromComponent
+ PyMac_PRECHECK(SGNewChannelFromComponent);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &s,
+ CmpObj_Convert, &sgChannelComponent))
+ return NULL;
+ _rv = SGNewChannelFromComponent(s,
+ &newChannel,
+ sgChannelComponent);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ CmpInstObj_New, newChannel);
+ return _res;
+}
+
+static PyObject *Qt_SGSetSettings(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ UserData ud;
+ long flags;
+#ifndef SGSetSettings
+ PyMac_PRECHECK(SGSetSettings);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&l",
+ CmpInstObj_Convert, &s,
+ UserDataObj_Convert, &ud,
+ &flags))
+ return NULL;
+ _rv = SGSetSettings(s,
+ ud,
+ flags);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGGetSettings(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ UserData ud;
+ long flags;
+#ifndef SGGetSettings
+ PyMac_PRECHECK(SGGetSettings);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &s,
+ &flags))
+ return NULL;
+ _rv = SGGetSettings(s,
+ &ud,
+ flags);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ UserDataObj_New, ud);
+ return _res;
+}
+
+static PyObject *Qt_SGGetIndChannel(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ short index;
+ SGChannel ref;
+ OSType chanType;
+#ifndef SGGetIndChannel
+ PyMac_PRECHECK(SGGetIndChannel);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ CmpInstObj_Convert, &s,
+ &index))
+ return NULL;
+ _rv = SGGetIndChannel(s,
+ index,
+ &ref,
+ &chanType);
+ _res = Py_BuildValue("lO&O&",
+ _rv,
+ CmpInstObj_New, ref,
+ PyMac_BuildOSType, chanType);
+ return _res;
+}
+
+static PyObject *Qt_SGUpdate(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ RgnHandle updateRgn;
+#ifndef SGUpdate
+ PyMac_PRECHECK(SGUpdate);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &s,
+ ResObj_Convert, &updateRgn))
+ return NULL;
+ _rv = SGUpdate(s,
+ updateRgn);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGGetPause(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ Boolean paused;
+#ifndef SGGetPause
+ PyMac_PRECHECK(SGGetPause);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &s))
+ return NULL;
+ _rv = SGGetPause(s,
+ &paused);
+ _res = Py_BuildValue("lb",
+ _rv,
+ paused);
+ return _res;
+}
+
+static PyObject *Qt_SGSetChannelSettings(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ SGChannel c;
+ UserData ud;
+ long flags;
+#ifndef SGSetChannelSettings
+ PyMac_PRECHECK(SGSetChannelSettings);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&l",
+ CmpInstObj_Convert, &s,
+ CmpInstObj_Convert, &c,
+ UserDataObj_Convert, &ud,
+ &flags))
+ return NULL;
+ _rv = SGSetChannelSettings(s,
+ c,
+ ud,
+ flags);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGGetChannelSettings(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ SGChannel c;
+ UserData ud;
+ long flags;
+#ifndef SGGetChannelSettings
+ PyMac_PRECHECK(SGGetChannelSettings);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&l",
+ CmpInstObj_Convert, &s,
+ CmpInstObj_Convert, &c,
+ &flags))
+ return NULL;
+ _rv = SGGetChannelSettings(s,
+ c,
+ &ud,
+ flags);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ UserDataObj_New, ud);
+ return _res;
+}
+
+static PyObject *Qt_SGGetMode(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ Boolean previewMode;
+ Boolean recordMode;
+#ifndef SGGetMode
+ PyMac_PRECHECK(SGGetMode);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &s))
+ return NULL;
+ _rv = SGGetMode(s,
+ &previewMode,
+ &recordMode);
+ _res = Py_BuildValue("lbb",
+ _rv,
+ previewMode,
+ recordMode);
+ return _res;
+}
+
+static PyObject *Qt_SGSetDataRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ Handle dataRef;
+ OSType dataRefType;
+ long whereFlags;
+#ifndef SGSetDataRef
+ PyMac_PRECHECK(SGSetDataRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&l",
+ CmpInstObj_Convert, &s,
+ ResObj_Convert, &dataRef,
+ PyMac_GetOSType, &dataRefType,
+ &whereFlags))
+ return NULL;
+ _rv = SGSetDataRef(s,
+ dataRef,
+ dataRefType,
+ whereFlags);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGGetDataRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ Handle dataRef;
+ OSType dataRefType;
+ long whereFlags;
+#ifndef SGGetDataRef
+ PyMac_PRECHECK(SGGetDataRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &s))
+ return NULL;
+ _rv = SGGetDataRef(s,
+ &dataRef,
+ &dataRefType,
+ &whereFlags);
+ _res = Py_BuildValue("lO&O&l",
+ _rv,
+ ResObj_New, dataRef,
+ PyMac_BuildOSType, dataRefType,
+ whereFlags);
+ return _res;
+}
+
+static PyObject *Qt_SGNewOutput(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ Handle dataRef;
+ OSType dataRefType;
+ long whereFlags;
+ SGOutput sgOut;
+#ifndef SGNewOutput
+ PyMac_PRECHECK(SGNewOutput);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&l",
+ CmpInstObj_Convert, &s,
+ ResObj_Convert, &dataRef,
+ PyMac_GetOSType, &dataRefType,
+ &whereFlags))
+ return NULL;
+ _rv = SGNewOutput(s,
+ dataRef,
+ dataRefType,
+ whereFlags,
+ &sgOut);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ SGOutputObj_New, sgOut);
+ return _res;
+}
+
+static PyObject *Qt_SGDisposeOutput(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ SGOutput sgOut;
+#ifndef SGDisposeOutput
+ PyMac_PRECHECK(SGDisposeOutput);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &s,
+ SGOutputObj_Convert, &sgOut))
+ return NULL;
+ _rv = SGDisposeOutput(s,
+ sgOut);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGSetOutputFlags(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ SGOutput sgOut;
+ long whereFlags;
+#ifndef SGSetOutputFlags
+ PyMac_PRECHECK(SGSetOutputFlags);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&l",
+ CmpInstObj_Convert, &s,
+ SGOutputObj_Convert, &sgOut,
+ &whereFlags))
+ return NULL;
+ _rv = SGSetOutputFlags(s,
+ sgOut,
+ whereFlags);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGSetChannelOutput(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ SGChannel c;
+ SGOutput sgOut;
+#ifndef SGSetChannelOutput
+ PyMac_PRECHECK(SGSetChannelOutput);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CmpInstObj_Convert, &s,
+ CmpInstObj_Convert, &c,
+ SGOutputObj_Convert, &sgOut))
+ return NULL;
+ _rv = SGSetChannelOutput(s,
+ c,
+ sgOut);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGGetDataOutputStorageSpaceRemaining(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ SGOutput sgOut;
+ unsigned long space;
+#ifndef SGGetDataOutputStorageSpaceRemaining
+ PyMac_PRECHECK(SGGetDataOutputStorageSpaceRemaining);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &s,
+ SGOutputObj_Convert, &sgOut))
+ return NULL;
+ _rv = SGGetDataOutputStorageSpaceRemaining(s,
+ sgOut,
+ &space);
+ _res = Py_BuildValue("ll",
+ _rv,
+ space);
+ return _res;
+}
+
+static PyObject *Qt_SGHandleUpdateEvent(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ EventRecord event;
+ Boolean handled;
+#ifndef SGHandleUpdateEvent
+ PyMac_PRECHECK(SGHandleUpdateEvent);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &s,
+ PyMac_GetEventRecord, &event))
+ return NULL;
+ _rv = SGHandleUpdateEvent(s,
+ &event,
+ &handled);
+ _res = Py_BuildValue("lb",
+ _rv,
+ handled);
+ return _res;
+}
+
+static PyObject *Qt_SGSetOutputNextOutput(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ SGOutput sgOut;
+ SGOutput nextOut;
+#ifndef SGSetOutputNextOutput
+ PyMac_PRECHECK(SGSetOutputNextOutput);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CmpInstObj_Convert, &s,
+ SGOutputObj_Convert, &sgOut,
+ SGOutputObj_Convert, &nextOut))
+ return NULL;
+ _rv = SGSetOutputNextOutput(s,
+ sgOut,
+ nextOut);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGGetOutputNextOutput(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ SGOutput sgOut;
+ SGOutput nextOut;
+#ifndef SGGetOutputNextOutput
+ PyMac_PRECHECK(SGGetOutputNextOutput);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &s,
+ SGOutputObj_Convert, &sgOut))
+ return NULL;
+ _rv = SGGetOutputNextOutput(s,
+ sgOut,
+ &nextOut);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ SGOutputObj_New, nextOut);
+ return _res;
+}
+
+static PyObject *Qt_SGSetOutputMaximumOffset(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ SGOutput sgOut;
+ wide maxOffset;
+#ifndef SGSetOutputMaximumOffset
+ PyMac_PRECHECK(SGSetOutputMaximumOffset);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CmpInstObj_Convert, &s,
+ SGOutputObj_Convert, &sgOut,
+ PyMac_Getwide, &maxOffset))
+ return NULL;
+ _rv = SGSetOutputMaximumOffset(s,
+ sgOut,
+ &maxOffset);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGGetOutputMaximumOffset(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ SGOutput sgOut;
+ wide maxOffset;
+#ifndef SGGetOutputMaximumOffset
+ PyMac_PRECHECK(SGGetOutputMaximumOffset);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &s,
+ SGOutputObj_Convert, &sgOut))
+ return NULL;
+ _rv = SGGetOutputMaximumOffset(s,
+ sgOut,
+ &maxOffset);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_Buildwide, maxOffset);
+ return _res;
+}
+
+static PyObject *Qt_SGGetOutputDataReference(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ SGOutput sgOut;
+ Handle dataRef;
+ OSType dataRefType;
+#ifndef SGGetOutputDataReference
+ PyMac_PRECHECK(SGGetOutputDataReference);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &s,
+ SGOutputObj_Convert, &sgOut))
+ return NULL;
+ _rv = SGGetOutputDataReference(s,
+ sgOut,
+ &dataRef,
+ &dataRefType);
+ _res = Py_BuildValue("lO&O&",
+ _rv,
+ ResObj_New, dataRef,
+ PyMac_BuildOSType, dataRefType);
+ return _res;
+}
+
+static PyObject *Qt_SGWriteExtendedMovieData(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ SGChannel c;
+ Ptr p;
+ long len;
+ wide offset;
+ SGOutput sgOut;
+#ifndef SGWriteExtendedMovieData
+ PyMac_PRECHECK(SGWriteExtendedMovieData);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&sl",
+ CmpInstObj_Convert, &s,
+ CmpInstObj_Convert, &c,
+ &p,
+ &len))
+ return NULL;
+ _rv = SGWriteExtendedMovieData(s,
+ c,
+ p,
+ len,
+ &offset,
+ &sgOut);
+ _res = Py_BuildValue("lO&O&",
+ _rv,
+ PyMac_Buildwide, offset,
+ SGOutputObj_New, sgOut);
+ return _res;
+}
+
+static PyObject *Qt_SGGetStorageSpaceRemaining64(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ wide bytes;
+#ifndef SGGetStorageSpaceRemaining64
+ PyMac_PRECHECK(SGGetStorageSpaceRemaining64);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &s))
+ return NULL;
+ _rv = SGGetStorageSpaceRemaining64(s,
+ &bytes);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_Buildwide, bytes);
+ return _res;
+}
+
+static PyObject *Qt_SGGetDataOutputStorageSpaceRemaining64(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ SGOutput sgOut;
+ wide space;
+#ifndef SGGetDataOutputStorageSpaceRemaining64
+ PyMac_PRECHECK(SGGetDataOutputStorageSpaceRemaining64);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &s,
+ SGOutputObj_Convert, &sgOut))
+ return NULL;
+ _rv = SGGetDataOutputStorageSpaceRemaining64(s,
+ sgOut,
+ &space);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_Buildwide, space);
+ return _res;
+}
+
+static PyObject *Qt_SGWriteMovieData(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ SGChannel c;
+ Ptr p;
+ long len;
+ long offset;
+#ifndef SGWriteMovieData
+ PyMac_PRECHECK(SGWriteMovieData);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&sl",
+ CmpInstObj_Convert, &s,
+ CmpInstObj_Convert, &c,
+ &p,
+ &len))
+ return NULL;
+ _rv = SGWriteMovieData(s,
+ c,
+ p,
+ len,
+ &offset);
+ _res = Py_BuildValue("ll",
+ _rv,
+ offset);
+ return _res;
+}
+
+static PyObject *Qt_SGGetTimeBase(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ TimeBase tb;
+#ifndef SGGetTimeBase
+ PyMac_PRECHECK(SGGetTimeBase);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &s))
+ return NULL;
+ _rv = SGGetTimeBase(s,
+ &tb);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ TimeBaseObj_New, tb);
+ return _res;
+}
+
+static PyObject *Qt_SGAddMovieData(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ SGChannel c;
+ Ptr p;
+ long len;
+ long offset;
+ long chRefCon;
+ TimeValue time;
+ short writeType;
+#ifndef SGAddMovieData
+ PyMac_PRECHECK(SGAddMovieData);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&slllh",
+ CmpInstObj_Convert, &s,
+ CmpInstObj_Convert, &c,
+ &p,
+ &len,
+ &chRefCon,
+ &time,
+ &writeType))
+ return NULL;
+ _rv = SGAddMovieData(s,
+ c,
+ p,
+ len,
+ &offset,
+ chRefCon,
+ time,
+ writeType);
+ _res = Py_BuildValue("ll",
+ _rv,
+ offset);
+ return _res;
+}
+
+static PyObject *Qt_SGChangedSource(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ SGChannel c;
+#ifndef SGChangedSource
+ PyMac_PRECHECK(SGChangedSource);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &s,
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGChangedSource(s,
+ c);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGAddExtendedMovieData(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ SGChannel c;
+ Ptr p;
+ long len;
+ wide offset;
+ long chRefCon;
+ TimeValue time;
+ short writeType;
+ SGOutput whichOutput;
+#ifndef SGAddExtendedMovieData
+ PyMac_PRECHECK(SGAddExtendedMovieData);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&slllh",
+ CmpInstObj_Convert, &s,
+ CmpInstObj_Convert, &c,
+ &p,
+ &len,
+ &chRefCon,
+ &time,
+ &writeType))
+ return NULL;
+ _rv = SGAddExtendedMovieData(s,
+ c,
+ p,
+ len,
+ &offset,
+ chRefCon,
+ time,
+ writeType,
+ &whichOutput);
+ _res = Py_BuildValue("lO&O&",
+ _rv,
+ PyMac_Buildwide, offset,
+ SGOutputObj_New, whichOutput);
+ return _res;
+}
+
+static PyObject *Qt_SGAddOutputDataRefToMedia(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ SGOutput sgOut;
+ Media theMedia;
+ SampleDescriptionHandle desc;
+#ifndef SGAddOutputDataRefToMedia
+ PyMac_PRECHECK(SGAddOutputDataRefToMedia);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&",
+ CmpInstObj_Convert, &s,
+ SGOutputObj_Convert, &sgOut,
+ MediaObj_Convert, &theMedia,
+ ResObj_Convert, &desc))
+ return NULL;
+ _rv = SGAddOutputDataRefToMedia(s,
+ sgOut,
+ theMedia,
+ desc);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGSetSettingsSummary(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ Handle summaryText;
+#ifndef SGSetSettingsSummary
+ PyMac_PRECHECK(SGSetSettingsSummary);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &s,
+ ResObj_Convert, &summaryText))
+ return NULL;
+ _rv = SGSetSettingsSummary(s,
+ summaryText);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGSetChannelUsage(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ long usage;
+#ifndef SGSetChannelUsage
+ PyMac_PRECHECK(SGSetChannelUsage);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &c,
+ &usage))
+ return NULL;
+ _rv = SGSetChannelUsage(c,
+ usage);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGGetChannelUsage(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ long usage;
+#ifndef SGGetChannelUsage
+ PyMac_PRECHECK(SGGetChannelUsage);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGGetChannelUsage(c,
+ &usage);
+ _res = Py_BuildValue("ll",
+ _rv,
+ usage);
+ return _res;
+}
+
+static PyObject *Qt_SGSetChannelBounds(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ Rect bounds;
+#ifndef SGSetChannelBounds
+ PyMac_PRECHECK(SGSetChannelBounds);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &c,
+ PyMac_GetRect, &bounds))
+ return NULL;
+ _rv = SGSetChannelBounds(c,
+ &bounds);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGGetChannelBounds(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ Rect bounds;
+#ifndef SGGetChannelBounds
+ PyMac_PRECHECK(SGGetChannelBounds);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGGetChannelBounds(c,
+ &bounds);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildRect, &bounds);
+ return _res;
+}
+
+static PyObject *Qt_SGSetChannelVolume(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ short volume;
+#ifndef SGSetChannelVolume
+ PyMac_PRECHECK(SGSetChannelVolume);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ CmpInstObj_Convert, &c,
+ &volume))
+ return NULL;
+ _rv = SGSetChannelVolume(c,
+ volume);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGGetChannelVolume(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ short volume;
+#ifndef SGGetChannelVolume
+ PyMac_PRECHECK(SGGetChannelVolume);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGGetChannelVolume(c,
+ &volume);
+ _res = Py_BuildValue("lh",
+ _rv,
+ volume);
+ return _res;
+}
+
+static PyObject *Qt_SGGetChannelInfo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ long channelInfo;
+#ifndef SGGetChannelInfo
+ PyMac_PRECHECK(SGGetChannelInfo);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGGetChannelInfo(c,
+ &channelInfo);
+ _res = Py_BuildValue("ll",
+ _rv,
+ channelInfo);
+ return _res;
+}
+
+static PyObject *Qt_SGSetChannelPlayFlags(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ long playFlags;
+#ifndef SGSetChannelPlayFlags
+ PyMac_PRECHECK(SGSetChannelPlayFlags);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &c,
+ &playFlags))
+ return NULL;
+ _rv = SGSetChannelPlayFlags(c,
+ playFlags);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGGetChannelPlayFlags(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ long playFlags;
+#ifndef SGGetChannelPlayFlags
+ PyMac_PRECHECK(SGGetChannelPlayFlags);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGGetChannelPlayFlags(c,
+ &playFlags);
+ _res = Py_BuildValue("ll",
+ _rv,
+ playFlags);
+ return _res;
+}
+
+static PyObject *Qt_SGSetChannelMaxFrames(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ long frameCount;
+#ifndef SGSetChannelMaxFrames
+ PyMac_PRECHECK(SGSetChannelMaxFrames);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &c,
+ &frameCount))
+ return NULL;
+ _rv = SGSetChannelMaxFrames(c,
+ frameCount);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGGetChannelMaxFrames(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ long frameCount;
+#ifndef SGGetChannelMaxFrames
+ PyMac_PRECHECK(SGGetChannelMaxFrames);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGGetChannelMaxFrames(c,
+ &frameCount);
+ _res = Py_BuildValue("ll",
+ _rv,
+ frameCount);
+ return _res;
+}
+
+static PyObject *Qt_SGSetChannelRefCon(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ long refCon;
+#ifndef SGSetChannelRefCon
+ PyMac_PRECHECK(SGSetChannelRefCon);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &c,
+ &refCon))
+ return NULL;
+ _rv = SGSetChannelRefCon(c,
+ refCon);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGSetChannelClip(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ RgnHandle theClip;
+#ifndef SGSetChannelClip
+ PyMac_PRECHECK(SGSetChannelClip);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &c,
+ ResObj_Convert, &theClip))
+ return NULL;
+ _rv = SGSetChannelClip(c,
+ theClip);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGGetChannelClip(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ RgnHandle theClip;
+#ifndef SGGetChannelClip
+ PyMac_PRECHECK(SGGetChannelClip);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGGetChannelClip(c,
+ &theClip);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, theClip);
+ return _res;
+}
+
+static PyObject *Qt_SGGetChannelSampleDescription(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ Handle sampleDesc;
+#ifndef SGGetChannelSampleDescription
+ PyMac_PRECHECK(SGGetChannelSampleDescription);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &c,
+ ResObj_Convert, &sampleDesc))
+ return NULL;
+ _rv = SGGetChannelSampleDescription(c,
+ sampleDesc);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGSetChannelDevice(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ StringPtr name;
+#ifndef SGSetChannelDevice
+ PyMac_PRECHECK(SGSetChannelDevice);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&s",
+ CmpInstObj_Convert, &c,
+ &name))
+ return NULL;
+ _rv = SGSetChannelDevice(c,
+ name);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGGetChannelTimeScale(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ TimeScale scale;
+#ifndef SGGetChannelTimeScale
+ PyMac_PRECHECK(SGGetChannelTimeScale);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGGetChannelTimeScale(c,
+ &scale);
+ _res = Py_BuildValue("ll",
+ _rv,
+ scale);
+ return _res;
+}
+
+static PyObject *Qt_SGChannelPutPicture(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+#ifndef SGChannelPutPicture
+ PyMac_PRECHECK(SGChannelPutPicture);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGChannelPutPicture(c);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGChannelSetRequestedDataRate(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ long bytesPerSecond;
+#ifndef SGChannelSetRequestedDataRate
+ PyMac_PRECHECK(SGChannelSetRequestedDataRate);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &c,
+ &bytesPerSecond))
+ return NULL;
+ _rv = SGChannelSetRequestedDataRate(c,
+ bytesPerSecond);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGChannelGetRequestedDataRate(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ long bytesPerSecond;
+#ifndef SGChannelGetRequestedDataRate
+ PyMac_PRECHECK(SGChannelGetRequestedDataRate);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGChannelGetRequestedDataRate(c,
+ &bytesPerSecond);
+ _res = Py_BuildValue("ll",
+ _rv,
+ bytesPerSecond);
+ return _res;
+}
+
+static PyObject *Qt_SGChannelSetDataSourceName(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ Str255 name;
+ ScriptCode scriptTag;
+#ifndef SGChannelSetDataSourceName
+ PyMac_PRECHECK(SGChannelSetDataSourceName);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&h",
+ CmpInstObj_Convert, &c,
+ PyMac_GetStr255, name,
+ &scriptTag))
+ return NULL;
+ _rv = SGChannelSetDataSourceName(c,
+ name,
+ scriptTag);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGChannelGetDataSourceName(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ Str255 name;
+ ScriptCode scriptTag;
+#ifndef SGChannelGetDataSourceName
+ PyMac_PRECHECK(SGChannelGetDataSourceName);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &c,
+ PyMac_GetStr255, name))
+ return NULL;
+ _rv = SGChannelGetDataSourceName(c,
+ name,
+ &scriptTag);
+ _res = Py_BuildValue("lh",
+ _rv,
+ scriptTag);
+ return _res;
+}
+
+static PyObject *Qt_SGChannelSetCodecSettings(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ Handle settings;
+#ifndef SGChannelSetCodecSettings
+ PyMac_PRECHECK(SGChannelSetCodecSettings);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &c,
+ ResObj_Convert, &settings))
+ return NULL;
+ _rv = SGChannelSetCodecSettings(c,
+ settings);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGChannelGetCodecSettings(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ Handle settings;
+#ifndef SGChannelGetCodecSettings
+ PyMac_PRECHECK(SGChannelGetCodecSettings);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGChannelGetCodecSettings(c,
+ &settings);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, settings);
+ return _res;
+}
+
+static PyObject *Qt_SGGetChannelTimeBase(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ TimeBase tb;
+#ifndef SGGetChannelTimeBase
+ PyMac_PRECHECK(SGGetChannelTimeBase);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGGetChannelTimeBase(c,
+ &tb);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ TimeBaseObj_New, tb);
+ return _res;
+}
+
+static PyObject *Qt_SGGetChannelRefCon(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ long refCon;
+#ifndef SGGetChannelRefCon
+ PyMac_PRECHECK(SGGetChannelRefCon);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGGetChannelRefCon(c,
+ &refCon);
+ _res = Py_BuildValue("ll",
+ _rv,
+ refCon);
+ return _res;
+}
+
+static PyObject *Qt_SGGetChannelDeviceAndInputNames(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ Str255 outDeviceName;
+ Str255 outInputName;
+ short outInputNumber;
+#ifndef SGGetChannelDeviceAndInputNames
+ PyMac_PRECHECK(SGGetChannelDeviceAndInputNames);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CmpInstObj_Convert, &c,
+ PyMac_GetStr255, outDeviceName,
+ PyMac_GetStr255, outInputName))
+ return NULL;
+ _rv = SGGetChannelDeviceAndInputNames(c,
+ outDeviceName,
+ outInputName,
+ &outInputNumber);
+ _res = Py_BuildValue("lh",
+ _rv,
+ outInputNumber);
+ return _res;
+}
+
+static PyObject *Qt_SGSetChannelDeviceInput(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ short inInputNumber;
+#ifndef SGSetChannelDeviceInput
+ PyMac_PRECHECK(SGSetChannelDeviceInput);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ CmpInstObj_Convert, &c,
+ &inInputNumber))
+ return NULL;
+ _rv = SGSetChannelDeviceInput(c,
+ inInputNumber);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGSetChannelSettingsStateChanging(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ UInt32 inFlags;
+#ifndef SGSetChannelSettingsStateChanging
+ PyMac_PRECHECK(SGSetChannelSettingsStateChanging);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &c,
+ &inFlags))
+ return NULL;
+ _rv = SGSetChannelSettingsStateChanging(c,
+ inFlags);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGInitChannel(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ SeqGrabComponent owner;
+#ifndef SGInitChannel
+ PyMac_PRECHECK(SGInitChannel);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &c,
+ CmpInstObj_Convert, &owner))
+ return NULL;
+ _rv = SGInitChannel(c,
+ owner);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGWriteSamples(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ Movie m;
+ AliasHandle theFile;
+#ifndef SGWriteSamples
+ PyMac_PRECHECK(SGWriteSamples);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CmpInstObj_Convert, &c,
+ MovieObj_Convert, &m,
+ ResObj_Convert, &theFile))
+ return NULL;
+ _rv = SGWriteSamples(c,
+ m,
+ theFile);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGGetDataRate(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ long bytesPerSecond;
+#ifndef SGGetDataRate
+ PyMac_PRECHECK(SGGetDataRate);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGGetDataRate(c,
+ &bytesPerSecond);
+ _res = Py_BuildValue("ll",
+ _rv,
+ bytesPerSecond);
+ return _res;
+}
+
+static PyObject *Qt_SGAlignChannelRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ Rect r;
+#ifndef SGAlignChannelRect
+ PyMac_PRECHECK(SGAlignChannelRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGAlignChannelRect(c,
+ &r);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildRect, &r);
+ return _res;
+}
+
+static PyObject *Qt_SGPanelGetDitl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ Handle ditl;
+#ifndef SGPanelGetDitl
+ PyMac_PRECHECK(SGPanelGetDitl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &s))
+ return NULL;
+ _rv = SGPanelGetDitl(s,
+ &ditl);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, ditl);
+ return _res;
+}
+
+static PyObject *Qt_SGPanelGetTitle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ Str255 title;
+#ifndef SGPanelGetTitle
+ PyMac_PRECHECK(SGPanelGetTitle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &s,
+ PyMac_GetStr255, title))
+ return NULL;
+ _rv = SGPanelGetTitle(s,
+ title);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGPanelCanRun(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ SGChannel c;
+#ifndef SGPanelCanRun
+ PyMac_PRECHECK(SGPanelCanRun);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &s,
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGPanelCanRun(s,
+ c);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGPanelInstall(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ SGChannel c;
+ DialogPtr d;
+ short itemOffset;
+#ifndef SGPanelInstall
+ PyMac_PRECHECK(SGPanelInstall);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&h",
+ CmpInstObj_Convert, &s,
+ CmpInstObj_Convert, &c,
+ DlgObj_Convert, &d,
+ &itemOffset))
+ return NULL;
+ _rv = SGPanelInstall(s,
+ c,
+ d,
+ itemOffset);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGPanelEvent(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ SGChannel c;
+ DialogPtr d;
+ short itemOffset;
+ EventRecord theEvent;
+ short itemHit;
+ Boolean handled;
+#ifndef SGPanelEvent
+ PyMac_PRECHECK(SGPanelEvent);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&hO&",
+ CmpInstObj_Convert, &s,
+ CmpInstObj_Convert, &c,
+ DlgObj_Convert, &d,
+ &itemOffset,
+ PyMac_GetEventRecord, &theEvent))
+ return NULL;
+ _rv = SGPanelEvent(s,
+ c,
+ d,
+ itemOffset,
+ &theEvent,
+ &itemHit,
+ &handled);
+ _res = Py_BuildValue("lhb",
+ _rv,
+ itemHit,
+ handled);
+ return _res;
+}
+
+static PyObject *Qt_SGPanelItem(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ SGChannel c;
+ DialogPtr d;
+ short itemOffset;
+ short itemNum;
+#ifndef SGPanelItem
+ PyMac_PRECHECK(SGPanelItem);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&hh",
+ CmpInstObj_Convert, &s,
+ CmpInstObj_Convert, &c,
+ DlgObj_Convert, &d,
+ &itemOffset,
+ &itemNum))
+ return NULL;
+ _rv = SGPanelItem(s,
+ c,
+ d,
+ itemOffset,
+ itemNum);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGPanelRemove(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ SGChannel c;
+ DialogPtr d;
+ short itemOffset;
+#ifndef SGPanelRemove
+ PyMac_PRECHECK(SGPanelRemove);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&h",
+ CmpInstObj_Convert, &s,
+ CmpInstObj_Convert, &c,
+ DlgObj_Convert, &d,
+ &itemOffset))
+ return NULL;
+ _rv = SGPanelRemove(s,
+ c,
+ d,
+ itemOffset);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGPanelSetGrabber(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ SeqGrabComponent sg;
+#ifndef SGPanelSetGrabber
+ PyMac_PRECHECK(SGPanelSetGrabber);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &s,
+ CmpInstObj_Convert, &sg))
+ return NULL;
+ _rv = SGPanelSetGrabber(s,
+ sg);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGPanelSetResFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ short resRef;
+#ifndef SGPanelSetResFile
+ PyMac_PRECHECK(SGPanelSetResFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ CmpInstObj_Convert, &s,
+ &resRef))
+ return NULL;
+ _rv = SGPanelSetResFile(s,
+ resRef);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGPanelGetSettings(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ SGChannel c;
+ UserData ud;
+ long flags;
+#ifndef SGPanelGetSettings
+ PyMac_PRECHECK(SGPanelGetSettings);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&l",
+ CmpInstObj_Convert, &s,
+ CmpInstObj_Convert, &c,
+ &flags))
+ return NULL;
+ _rv = SGPanelGetSettings(s,
+ c,
+ &ud,
+ flags);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ UserDataObj_New, ud);
+ return _res;
+}
+
+static PyObject *Qt_SGPanelSetSettings(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ SGChannel c;
+ UserData ud;
+ long flags;
+#ifndef SGPanelSetSettings
+ PyMac_PRECHECK(SGPanelSetSettings);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&l",
+ CmpInstObj_Convert, &s,
+ CmpInstObj_Convert, &c,
+ UserDataObj_Convert, &ud,
+ &flags))
+ return NULL;
+ _rv = SGPanelSetSettings(s,
+ c,
+ ud,
+ flags);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGPanelValidateInput(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ Boolean ok;
+#ifndef SGPanelValidateInput
+ PyMac_PRECHECK(SGPanelValidateInput);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &s))
+ return NULL;
+ _rv = SGPanelValidateInput(s,
+ &ok);
+ _res = Py_BuildValue("lb",
+ _rv,
+ ok);
+ return _res;
+}
+
+static PyObject *Qt_SGPanelGetDITLForSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SeqGrabComponent s;
+ Handle ditl;
+ Point requestedSize;
+#ifndef SGPanelGetDITLForSize
+ PyMac_PRECHECK(SGPanelGetDITLForSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &s))
+ return NULL;
+ _rv = SGPanelGetDITLForSize(s,
+ &ditl,
+ &requestedSize);
+ _res = Py_BuildValue("lO&O&",
+ _rv,
+ ResObj_New, ditl,
+ PyMac_BuildPoint, requestedSize);
+ return _res;
+}
+
+static PyObject *Qt_SGGetSrcVideoBounds(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ Rect r;
+#ifndef SGGetSrcVideoBounds
+ PyMac_PRECHECK(SGGetSrcVideoBounds);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGGetSrcVideoBounds(c,
+ &r);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildRect, &r);
+ return _res;
+}
+
+static PyObject *Qt_SGSetVideoRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ Rect r;
+#ifndef SGSetVideoRect
+ PyMac_PRECHECK(SGSetVideoRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &c,
+ PyMac_GetRect, &r))
+ return NULL;
+ _rv = SGSetVideoRect(c,
+ &r);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGGetVideoRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ Rect r;
+#ifndef SGGetVideoRect
+ PyMac_PRECHECK(SGGetVideoRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGGetVideoRect(c,
+ &r);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildRect, &r);
+ return _res;
+}
+
+static PyObject *Qt_SGGetVideoCompressorType(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ OSType compressorType;
+#ifndef SGGetVideoCompressorType
+ PyMac_PRECHECK(SGGetVideoCompressorType);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGGetVideoCompressorType(c,
+ &compressorType);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildOSType, compressorType);
+ return _res;
+}
+
+static PyObject *Qt_SGSetVideoCompressorType(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ OSType compressorType;
+#ifndef SGSetVideoCompressorType
+ PyMac_PRECHECK(SGSetVideoCompressorType);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &c,
+ PyMac_GetOSType, &compressorType))
+ return NULL;
+ _rv = SGSetVideoCompressorType(c,
+ compressorType);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGSetVideoCompressor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ short depth;
+ CompressorComponent compressor;
+ CodecQ spatialQuality;
+ CodecQ temporalQuality;
+ long keyFrameRate;
+#ifndef SGSetVideoCompressor
+ PyMac_PRECHECK(SGSetVideoCompressor);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hO&lll",
+ CmpInstObj_Convert, &c,
+ &depth,
+ CmpObj_Convert, &compressor,
+ &spatialQuality,
+ &temporalQuality,
+ &keyFrameRate))
+ return NULL;
+ _rv = SGSetVideoCompressor(c,
+ depth,
+ compressor,
+ spatialQuality,
+ temporalQuality,
+ keyFrameRate);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGGetVideoCompressor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ short depth;
+ CompressorComponent compressor;
+ CodecQ spatialQuality;
+ CodecQ temporalQuality;
+ long keyFrameRate;
+#ifndef SGGetVideoCompressor
+ PyMac_PRECHECK(SGGetVideoCompressor);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGGetVideoCompressor(c,
+ &depth,
+ &compressor,
+ &spatialQuality,
+ &temporalQuality,
+ &keyFrameRate);
+ _res = Py_BuildValue("lhO&lll",
+ _rv,
+ depth,
+ CmpObj_New, compressor,
+ spatialQuality,
+ temporalQuality,
+ keyFrameRate);
+ return _res;
+}
+
+static PyObject *Qt_SGGetVideoDigitizerComponent(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentInstance _rv;
+ SGChannel c;
+#ifndef SGGetVideoDigitizerComponent
+ PyMac_PRECHECK(SGGetVideoDigitizerComponent);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGGetVideoDigitizerComponent(c);
+ _res = Py_BuildValue("O&",
+ CmpInstObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGSetVideoDigitizerComponent(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ ComponentInstance vdig;
+#ifndef SGSetVideoDigitizerComponent
+ PyMac_PRECHECK(SGSetVideoDigitizerComponent);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &c,
+ CmpInstObj_Convert, &vdig))
+ return NULL;
+ _rv = SGSetVideoDigitizerComponent(c,
+ vdig);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGVideoDigitizerChanged(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+#ifndef SGVideoDigitizerChanged
+ PyMac_PRECHECK(SGVideoDigitizerChanged);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGVideoDigitizerChanged(c);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGGrabFrame(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ short bufferNum;
+#ifndef SGGrabFrame
+ PyMac_PRECHECK(SGGrabFrame);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ CmpInstObj_Convert, &c,
+ &bufferNum))
+ return NULL;
+ _rv = SGGrabFrame(c,
+ bufferNum);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGGrabFrameComplete(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ short bufferNum;
+ Boolean done;
+#ifndef SGGrabFrameComplete
+ PyMac_PRECHECK(SGGrabFrameComplete);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ CmpInstObj_Convert, &c,
+ &bufferNum))
+ return NULL;
+ _rv = SGGrabFrameComplete(c,
+ bufferNum,
+ &done);
+ _res = Py_BuildValue("lb",
+ _rv,
+ done);
+ return _res;
+}
+
+static PyObject *Qt_SGCompressFrame(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ short bufferNum;
+#ifndef SGCompressFrame
+ PyMac_PRECHECK(SGCompressFrame);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ CmpInstObj_Convert, &c,
+ &bufferNum))
+ return NULL;
+ _rv = SGCompressFrame(c,
+ bufferNum);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGSetCompressBuffer(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ short depth;
+ Rect compressSize;
+#ifndef SGSetCompressBuffer
+ PyMac_PRECHECK(SGSetCompressBuffer);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hO&",
+ CmpInstObj_Convert, &c,
+ &depth,
+ PyMac_GetRect, &compressSize))
+ return NULL;
+ _rv = SGSetCompressBuffer(c,
+ depth,
+ &compressSize);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGGetCompressBuffer(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ short depth;
+ Rect compressSize;
+#ifndef SGGetCompressBuffer
+ PyMac_PRECHECK(SGGetCompressBuffer);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGGetCompressBuffer(c,
+ &depth,
+ &compressSize);
+ _res = Py_BuildValue("lhO&",
+ _rv,
+ depth,
+ PyMac_BuildRect, &compressSize);
+ return _res;
+}
+
+static PyObject *Qt_SGGetBufferInfo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ short bufferNum;
+ PixMapHandle bufferPM;
+ Rect bufferRect;
+ GWorldPtr compressBuffer;
+ Rect compressBufferRect;
+#ifndef SGGetBufferInfo
+ PyMac_PRECHECK(SGGetBufferInfo);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ CmpInstObj_Convert, &c,
+ &bufferNum))
+ return NULL;
+ _rv = SGGetBufferInfo(c,
+ bufferNum,
+ &bufferPM,
+ &bufferRect,
+ &compressBuffer,
+ &compressBufferRect);
+ _res = Py_BuildValue("lO&O&O&O&",
+ _rv,
+ ResObj_New, bufferPM,
+ PyMac_BuildRect, &bufferRect,
+ GWorldObj_New, compressBuffer,
+ PyMac_BuildRect, &compressBufferRect);
+ return _res;
+}
+
+static PyObject *Qt_SGSetUseScreenBuffer(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ Boolean useScreenBuffer;
+#ifndef SGSetUseScreenBuffer
+ PyMac_PRECHECK(SGSetUseScreenBuffer);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&b",
+ CmpInstObj_Convert, &c,
+ &useScreenBuffer))
+ return NULL;
+ _rv = SGSetUseScreenBuffer(c,
+ useScreenBuffer);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGGetUseScreenBuffer(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ Boolean useScreenBuffer;
+#ifndef SGGetUseScreenBuffer
+ PyMac_PRECHECK(SGGetUseScreenBuffer);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGGetUseScreenBuffer(c,
+ &useScreenBuffer);
+ _res = Py_BuildValue("lb",
+ _rv,
+ useScreenBuffer);
+ return _res;
+}
+
+static PyObject *Qt_SGSetFrameRate(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ Fixed frameRate;
+#ifndef SGSetFrameRate
+ PyMac_PRECHECK(SGSetFrameRate);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &c,
+ PyMac_GetFixed, &frameRate))
+ return NULL;
+ _rv = SGSetFrameRate(c,
+ frameRate);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGGetFrameRate(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ Fixed frameRate;
+#ifndef SGGetFrameRate
+ PyMac_PRECHECK(SGGetFrameRate);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGGetFrameRate(c,
+ &frameRate);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildFixed, frameRate);
+ return _res;
+}
+
+static PyObject *Qt_SGSetPreferredPacketSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ long preferredPacketSizeInBytes;
+#ifndef SGSetPreferredPacketSize
+ PyMac_PRECHECK(SGSetPreferredPacketSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &c,
+ &preferredPacketSizeInBytes))
+ return NULL;
+ _rv = SGSetPreferredPacketSize(c,
+ preferredPacketSizeInBytes);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGGetPreferredPacketSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ long preferredPacketSizeInBytes;
+#ifndef SGGetPreferredPacketSize
+ PyMac_PRECHECK(SGGetPreferredPacketSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGGetPreferredPacketSize(c,
+ &preferredPacketSizeInBytes);
+ _res = Py_BuildValue("ll",
+ _rv,
+ preferredPacketSizeInBytes);
+ return _res;
+}
+
+static PyObject *Qt_SGSetUserVideoCompressorList(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ Handle compressorTypes;
+#ifndef SGSetUserVideoCompressorList
+ PyMac_PRECHECK(SGSetUserVideoCompressorList);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &c,
+ ResObj_Convert, &compressorTypes))
+ return NULL;
+ _rv = SGSetUserVideoCompressorList(c,
+ compressorTypes);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGGetUserVideoCompressorList(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ Handle compressorTypes;
+#ifndef SGGetUserVideoCompressorList
+ PyMac_PRECHECK(SGGetUserVideoCompressorList);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGGetUserVideoCompressorList(c,
+ &compressorTypes);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, compressorTypes);
+ return _res;
+}
+
+static PyObject *Qt_SGSetSoundInputDriver(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ Str255 driverName;
+#ifndef SGSetSoundInputDriver
+ PyMac_PRECHECK(SGSetSoundInputDriver);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &c,
+ PyMac_GetStr255, driverName))
+ return NULL;
+ _rv = SGSetSoundInputDriver(c,
+ driverName);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGGetSoundInputDriver(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ SGChannel c;
+#ifndef SGGetSoundInputDriver
+ PyMac_PRECHECK(SGGetSoundInputDriver);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGGetSoundInputDriver(c);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGSoundInputDriverChanged(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+#ifndef SGSoundInputDriverChanged
+ PyMac_PRECHECK(SGSoundInputDriverChanged);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGSoundInputDriverChanged(c);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGSetSoundRecordChunkSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ long seconds;
+#ifndef SGSetSoundRecordChunkSize
+ PyMac_PRECHECK(SGSetSoundRecordChunkSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &c,
+ &seconds))
+ return NULL;
+ _rv = SGSetSoundRecordChunkSize(c,
+ seconds);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGGetSoundRecordChunkSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ SGChannel c;
+#ifndef SGGetSoundRecordChunkSize
+ PyMac_PRECHECK(SGGetSoundRecordChunkSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGGetSoundRecordChunkSize(c);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGSetSoundInputRate(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ Fixed rate;
+#ifndef SGSetSoundInputRate
+ PyMac_PRECHECK(SGSetSoundInputRate);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &c,
+ PyMac_GetFixed, &rate))
+ return NULL;
+ _rv = SGSetSoundInputRate(c,
+ rate);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGGetSoundInputRate(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Fixed _rv;
+ SGChannel c;
+#ifndef SGGetSoundInputRate
+ PyMac_PRECHECK(SGGetSoundInputRate);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGGetSoundInputRate(c);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildFixed, _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGSetSoundInputParameters(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ short sampleSize;
+ short numChannels;
+ OSType compressionType;
+#ifndef SGSetSoundInputParameters
+ PyMac_PRECHECK(SGSetSoundInputParameters);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hhO&",
+ CmpInstObj_Convert, &c,
+ &sampleSize,
+ &numChannels,
+ PyMac_GetOSType, &compressionType))
+ return NULL;
+ _rv = SGSetSoundInputParameters(c,
+ sampleSize,
+ numChannels,
+ compressionType);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGGetSoundInputParameters(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ short sampleSize;
+ short numChannels;
+ OSType compressionType;
+#ifndef SGGetSoundInputParameters
+ PyMac_PRECHECK(SGGetSoundInputParameters);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGGetSoundInputParameters(c,
+ &sampleSize,
+ &numChannels,
+ &compressionType);
+ _res = Py_BuildValue("lhhO&",
+ _rv,
+ sampleSize,
+ numChannels,
+ PyMac_BuildOSType, compressionType);
+ return _res;
+}
+
+static PyObject *Qt_SGSetAdditionalSoundRates(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ Handle rates;
+#ifndef SGSetAdditionalSoundRates
+ PyMac_PRECHECK(SGSetAdditionalSoundRates);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &c,
+ ResObj_Convert, &rates))
+ return NULL;
+ _rv = SGSetAdditionalSoundRates(c,
+ rates);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGGetAdditionalSoundRates(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ Handle rates;
+#ifndef SGGetAdditionalSoundRates
+ PyMac_PRECHECK(SGGetAdditionalSoundRates);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGGetAdditionalSoundRates(c,
+ &rates);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, rates);
+ return _res;
+}
+
+static PyObject *Qt_SGSetFontName(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ StringPtr pstr;
+#ifndef SGSetFontName
+ PyMac_PRECHECK(SGSetFontName);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&s",
+ CmpInstObj_Convert, &c,
+ &pstr))
+ return NULL;
+ _rv = SGSetFontName(c,
+ pstr);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGSetFontSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ short fontSize;
+#ifndef SGSetFontSize
+ PyMac_PRECHECK(SGSetFontSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ CmpInstObj_Convert, &c,
+ &fontSize))
+ return NULL;
+ _rv = SGSetFontSize(c,
+ fontSize);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGSetTextForeColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ RGBColor theColor;
+#ifndef SGSetTextForeColor
+ PyMac_PRECHECK(SGSetTextForeColor);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGSetTextForeColor(c,
+ &theColor);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ QdRGB_New, &theColor);
+ return _res;
+}
+
+static PyObject *Qt_SGSetTextBackColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ RGBColor theColor;
+#ifndef SGSetTextBackColor
+ PyMac_PRECHECK(SGSetTextBackColor);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGSetTextBackColor(c,
+ &theColor);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ QdRGB_New, &theColor);
+ return _res;
+}
+
+static PyObject *Qt_SGSetJustification(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ short just;
+#ifndef SGSetJustification
+ PyMac_PRECHECK(SGSetJustification);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ CmpInstObj_Convert, &c,
+ &just))
+ return NULL;
+ _rv = SGSetJustification(c,
+ just);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SGGetTextReturnToSpaceValue(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ short rettospace;
+#ifndef SGGetTextReturnToSpaceValue
+ PyMac_PRECHECK(SGGetTextReturnToSpaceValue);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &c))
+ return NULL;
+ _rv = SGGetTextReturnToSpaceValue(c,
+ &rettospace);
+ _res = Py_BuildValue("lh",
+ _rv,
+ rettospace);
+ return _res;
+}
+
+static PyObject *Qt_SGSetTextReturnToSpaceValue(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SGChannel c;
+ short rettospace;
+#ifndef SGSetTextReturnToSpaceValue
+ PyMac_PRECHECK(SGSetTextReturnToSpaceValue);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ CmpInstObj_Convert, &c,
+ &rettospace))
+ return NULL;
+ _rv = SGSetTextReturnToSpaceValue(c,
+ rettospace);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_QTVideoOutputGetCurrentClientName(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ QTVideoOutputComponent vo;
+ Str255 str;
+#ifndef QTVideoOutputGetCurrentClientName
+ PyMac_PRECHECK(QTVideoOutputGetCurrentClientName);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &vo,
+ PyMac_GetStr255, str))
+ return NULL;
+ _rv = QTVideoOutputGetCurrentClientName(vo,
+ str);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_QTVideoOutputSetClientName(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ QTVideoOutputComponent vo;
+ Str255 str;
+#ifndef QTVideoOutputSetClientName
+ PyMac_PRECHECK(QTVideoOutputSetClientName);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &vo,
+ PyMac_GetStr255, str))
+ return NULL;
+ _rv = QTVideoOutputSetClientName(vo,
+ str);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_QTVideoOutputGetClientName(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ QTVideoOutputComponent vo;
+ Str255 str;
+#ifndef QTVideoOutputGetClientName
+ PyMac_PRECHECK(QTVideoOutputGetClientName);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &vo,
+ PyMac_GetStr255, str))
+ return NULL;
+ _rv = QTVideoOutputGetClientName(vo,
+ str);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_QTVideoOutputBegin(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ QTVideoOutputComponent vo;
+#ifndef QTVideoOutputBegin
+ PyMac_PRECHECK(QTVideoOutputBegin);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &vo))
+ return NULL;
+ _rv = QTVideoOutputBegin(vo);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_QTVideoOutputEnd(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ QTVideoOutputComponent vo;
+#ifndef QTVideoOutputEnd
+ PyMac_PRECHECK(QTVideoOutputEnd);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &vo))
+ return NULL;
+ _rv = QTVideoOutputEnd(vo);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_QTVideoOutputSetDisplayMode(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ QTVideoOutputComponent vo;
+ long displayModeID;
+#ifndef QTVideoOutputSetDisplayMode
+ PyMac_PRECHECK(QTVideoOutputSetDisplayMode);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &vo,
+ &displayModeID))
+ return NULL;
+ _rv = QTVideoOutputSetDisplayMode(vo,
+ displayModeID);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_QTVideoOutputGetDisplayMode(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ QTVideoOutputComponent vo;
+ long displayModeID;
+#ifndef QTVideoOutputGetDisplayMode
+ PyMac_PRECHECK(QTVideoOutputGetDisplayMode);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &vo))
+ return NULL;
+ _rv = QTVideoOutputGetDisplayMode(vo,
+ &displayModeID);
+ _res = Py_BuildValue("ll",
+ _rv,
+ displayModeID);
+ return _res;
+}
+
+static PyObject *Qt_QTVideoOutputGetGWorld(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ QTVideoOutputComponent vo;
+ GWorldPtr gw;
+#ifndef QTVideoOutputGetGWorld
+ PyMac_PRECHECK(QTVideoOutputGetGWorld);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &vo))
+ return NULL;
+ _rv = QTVideoOutputGetGWorld(vo,
+ &gw);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ GWorldObj_New, gw);
+ return _res;
+}
+
+static PyObject *Qt_QTVideoOutputGetIndSoundOutput(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ QTVideoOutputComponent vo;
+ long index;
+ Component outputComponent;
+#ifndef QTVideoOutputGetIndSoundOutput
+ PyMac_PRECHECK(QTVideoOutputGetIndSoundOutput);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &vo,
+ &index))
+ return NULL;
+ _rv = QTVideoOutputGetIndSoundOutput(vo,
+ index,
+ &outputComponent);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ CmpObj_New, outputComponent);
+ return _res;
+}
+
+static PyObject *Qt_QTVideoOutputGetClock(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ QTVideoOutputComponent vo;
+ ComponentInstance clock;
+#ifndef QTVideoOutputGetClock
+ PyMac_PRECHECK(QTVideoOutputGetClock);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &vo))
+ return NULL;
+ _rv = QTVideoOutputGetClock(vo,
+ &clock);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ CmpInstObj_New, clock);
+ return _res;
+}
+
+static PyObject *Qt_QTVideoOutputSetEchoPort(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ QTVideoOutputComponent vo;
+ CGrafPtr echoPort;
+#ifndef QTVideoOutputSetEchoPort
+ PyMac_PRECHECK(QTVideoOutputSetEchoPort);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &vo,
+ GrafObj_Convert, &echoPort))
+ return NULL;
+ _rv = QTVideoOutputSetEchoPort(vo,
+ echoPort);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_QTVideoOutputGetIndImageDecompressor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ QTVideoOutputComponent vo;
+ long index;
+ Component codec;
+#ifndef QTVideoOutputGetIndImageDecompressor
+ PyMac_PRECHECK(QTVideoOutputGetIndImageDecompressor);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &vo,
+ &index))
+ return NULL;
+ _rv = QTVideoOutputGetIndImageDecompressor(vo,
+ index,
+ &codec);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ CmpObj_New, codec);
+ return _res;
+}
+
+static PyObject *Qt_QTVideoOutputBaseSetEchoPort(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ QTVideoOutputComponent vo;
+ CGrafPtr echoPort;
+#ifndef QTVideoOutputBaseSetEchoPort
+ PyMac_PRECHECK(QTVideoOutputBaseSetEchoPort);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &vo,
+ GrafObj_Convert, &echoPort))
+ return NULL;
+ _rv = QTVideoOutputBaseSetEchoPort(vo,
+ echoPort);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaSetChunkManagementFlags(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ UInt32 flags;
+ UInt32 flagsMask;
+#ifndef MediaSetChunkManagementFlags
+ PyMac_PRECHECK(MediaSetChunkManagementFlags);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ CmpInstObj_Convert, &mh,
+ &flags,
+ &flagsMask))
+ return NULL;
+ _rv = MediaSetChunkManagementFlags(mh,
+ flags,
+ flagsMask);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaGetChunkManagementFlags(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ UInt32 flags;
+#ifndef MediaGetChunkManagementFlags
+ PyMac_PRECHECK(MediaGetChunkManagementFlags);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = MediaGetChunkManagementFlags(mh,
+ &flags);
+ _res = Py_BuildValue("ll",
+ _rv,
+ flags);
+ return _res;
+}
+
+static PyObject *Qt_MediaSetPurgeableChunkMemoryAllowance(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ Size allowance;
+#ifndef MediaSetPurgeableChunkMemoryAllowance
+ PyMac_PRECHECK(MediaSetPurgeableChunkMemoryAllowance);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mh,
+ &allowance))
+ return NULL;
+ _rv = MediaSetPurgeableChunkMemoryAllowance(mh,
+ allowance);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaGetPurgeableChunkMemoryAllowance(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ Size allowance;
+#ifndef MediaGetPurgeableChunkMemoryAllowance
+ PyMac_PRECHECK(MediaGetPurgeableChunkMemoryAllowance);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = MediaGetPurgeableChunkMemoryAllowance(mh,
+ &allowance);
+ _res = Py_BuildValue("ll",
+ _rv,
+ allowance);
+ return _res;
+}
+
+static PyObject *Qt_MediaEmptyAllPurgeableChunks(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+#ifndef MediaEmptyAllPurgeableChunks
+ PyMac_PRECHECK(MediaEmptyAllPurgeableChunks);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = MediaEmptyAllPurgeableChunks(mh);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaSetHandlerCapabilities(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long flags;
+ long flagsMask;
+#ifndef MediaSetHandlerCapabilities
+ PyMac_PRECHECK(MediaSetHandlerCapabilities);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ CmpInstObj_Convert, &mh,
+ &flags,
+ &flagsMask))
+ return NULL;
+ _rv = MediaSetHandlerCapabilities(mh,
+ flags,
+ flagsMask);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaIdle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ TimeValue atMediaTime;
+ long flagsIn;
+ long flagsOut;
+ TimeRecord movieTime;
+#ifndef MediaIdle
+ PyMac_PRECHECK(MediaIdle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&llO&",
+ CmpInstObj_Convert, &mh,
+ &atMediaTime,
+ &flagsIn,
+ QtTimeRecord_Convert, &movieTime))
+ return NULL;
+ _rv = MediaIdle(mh,
+ atMediaTime,
+ flagsIn,
+ &flagsOut,
+ &movieTime);
+ _res = Py_BuildValue("ll",
+ _rv,
+ flagsOut);
+ return _res;
+}
+
+static PyObject *Qt_MediaGetMediaInfo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ Handle h;
+#ifndef MediaGetMediaInfo
+ PyMac_PRECHECK(MediaGetMediaInfo);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &mh,
+ ResObj_Convert, &h))
+ return NULL;
+ _rv = MediaGetMediaInfo(mh,
+ h);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaPutMediaInfo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ Handle h;
+#ifndef MediaPutMediaInfo
+ PyMac_PRECHECK(MediaPutMediaInfo);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &mh,
+ ResObj_Convert, &h))
+ return NULL;
+ _rv = MediaPutMediaInfo(mh,
+ h);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaSetActive(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ Boolean enableMedia;
+#ifndef MediaSetActive
+ PyMac_PRECHECK(MediaSetActive);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&b",
+ CmpInstObj_Convert, &mh,
+ &enableMedia))
+ return NULL;
+ _rv = MediaSetActive(mh,
+ enableMedia);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaSetRate(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ Fixed rate;
+#ifndef MediaSetRate
+ PyMac_PRECHECK(MediaSetRate);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &mh,
+ PyMac_GetFixed, &rate))
+ return NULL;
+ _rv = MediaSetRate(mh,
+ rate);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaGGetStatus(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ ComponentResult statusErr;
+#ifndef MediaGGetStatus
+ PyMac_PRECHECK(MediaGGetStatus);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = MediaGGetStatus(mh,
+ &statusErr);
+ _res = Py_BuildValue("ll",
+ _rv,
+ statusErr);
+ return _res;
+}
+
+static PyObject *Qt_MediaTrackEdited(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+#ifndef MediaTrackEdited
+ PyMac_PRECHECK(MediaTrackEdited);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = MediaTrackEdited(mh);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaSetMediaTimeScale(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ TimeScale newTimeScale;
+#ifndef MediaSetMediaTimeScale
+ PyMac_PRECHECK(MediaSetMediaTimeScale);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mh,
+ &newTimeScale))
+ return NULL;
+ _rv = MediaSetMediaTimeScale(mh,
+ newTimeScale);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaSetMovieTimeScale(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ TimeScale newTimeScale;
+#ifndef MediaSetMovieTimeScale
+ PyMac_PRECHECK(MediaSetMovieTimeScale);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mh,
+ &newTimeScale))
+ return NULL;
+ _rv = MediaSetMovieTimeScale(mh,
+ newTimeScale);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaSetGWorld(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ CGrafPtr aPort;
+ GDHandle aGD;
+#ifndef MediaSetGWorld
+ PyMac_PRECHECK(MediaSetGWorld);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CmpInstObj_Convert, &mh,
+ GrafObj_Convert, &aPort,
+ OptResObj_Convert, &aGD))
+ return NULL;
+ _rv = MediaSetGWorld(mh,
+ aPort,
+ aGD);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaSetDimensions(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ Fixed width;
+ Fixed height;
+#ifndef MediaSetDimensions
+ PyMac_PRECHECK(MediaSetDimensions);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CmpInstObj_Convert, &mh,
+ PyMac_GetFixed, &width,
+ PyMac_GetFixed, &height))
+ return NULL;
+ _rv = MediaSetDimensions(mh,
+ width,
+ height);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaSetClip(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ RgnHandle theClip;
+#ifndef MediaSetClip
+ PyMac_PRECHECK(MediaSetClip);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &mh,
+ ResObj_Convert, &theClip))
+ return NULL;
+ _rv = MediaSetClip(mh,
+ theClip);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaGetTrackOpaque(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ Boolean trackIsOpaque;
+#ifndef MediaGetTrackOpaque
+ PyMac_PRECHECK(MediaGetTrackOpaque);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = MediaGetTrackOpaque(mh,
+ &trackIsOpaque);
+ _res = Py_BuildValue("lb",
+ _rv,
+ trackIsOpaque);
+ return _res;
+}
+
+static PyObject *Qt_MediaSetGraphicsMode(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long mode;
+ RGBColor opColor;
+#ifndef MediaSetGraphicsMode
+ PyMac_PRECHECK(MediaSetGraphicsMode);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lO&",
+ CmpInstObj_Convert, &mh,
+ &mode,
+ QdRGB_Convert, &opColor))
+ return NULL;
+ _rv = MediaSetGraphicsMode(mh,
+ mode,
+ &opColor);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaGetGraphicsMode(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long mode;
+ RGBColor opColor;
+#ifndef MediaGetGraphicsMode
+ PyMac_PRECHECK(MediaGetGraphicsMode);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = MediaGetGraphicsMode(mh,
+ &mode,
+ &opColor);
+ _res = Py_BuildValue("llO&",
+ _rv,
+ mode,
+ QdRGB_New, &opColor);
+ return _res;
+}
+
+static PyObject *Qt_MediaGSetVolume(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ short volume;
+#ifndef MediaGSetVolume
+ PyMac_PRECHECK(MediaGSetVolume);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ CmpInstObj_Convert, &mh,
+ &volume))
+ return NULL;
+ _rv = MediaGSetVolume(mh,
+ volume);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaSetSoundBalance(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ short balance;
+#ifndef MediaSetSoundBalance
+ PyMac_PRECHECK(MediaSetSoundBalance);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ CmpInstObj_Convert, &mh,
+ &balance))
+ return NULL;
+ _rv = MediaSetSoundBalance(mh,
+ balance);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaGetSoundBalance(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ short balance;
+#ifndef MediaGetSoundBalance
+ PyMac_PRECHECK(MediaGetSoundBalance);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = MediaGetSoundBalance(mh,
+ &balance);
+ _res = Py_BuildValue("lh",
+ _rv,
+ balance);
+ return _res;
+}
+
+static PyObject *Qt_MediaGetNextBoundsChange(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ TimeValue when;
+#ifndef MediaGetNextBoundsChange
+ PyMac_PRECHECK(MediaGetNextBoundsChange);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = MediaGetNextBoundsChange(mh,
+ &when);
+ _res = Py_BuildValue("ll",
+ _rv,
+ when);
+ return _res;
+}
+
+static PyObject *Qt_MediaGetSrcRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ RgnHandle rgn;
+ TimeValue atMediaTime;
+#ifndef MediaGetSrcRgn
+ PyMac_PRECHECK(MediaGetSrcRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&l",
+ CmpInstObj_Convert, &mh,
+ ResObj_Convert, &rgn,
+ &atMediaTime))
+ return NULL;
+ _rv = MediaGetSrcRgn(mh,
+ rgn,
+ atMediaTime);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaPreroll(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ TimeValue time;
+ Fixed rate;
+#ifndef MediaPreroll
+ PyMac_PRECHECK(MediaPreroll);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lO&",
+ CmpInstObj_Convert, &mh,
+ &time,
+ PyMac_GetFixed, &rate))
+ return NULL;
+ _rv = MediaPreroll(mh,
+ time,
+ rate);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaSampleDescriptionChanged(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long index;
+#ifndef MediaSampleDescriptionChanged
+ PyMac_PRECHECK(MediaSampleDescriptionChanged);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mh,
+ &index))
+ return NULL;
+ _rv = MediaSampleDescriptionChanged(mh,
+ index);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaHasCharacteristic(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ OSType characteristic;
+ Boolean hasIt;
+#ifndef MediaHasCharacteristic
+ PyMac_PRECHECK(MediaHasCharacteristic);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &mh,
+ PyMac_GetOSType, &characteristic))
+ return NULL;
+ _rv = MediaHasCharacteristic(mh,
+ characteristic,
+ &hasIt);
+ _res = Py_BuildValue("lb",
+ _rv,
+ hasIt);
+ return _res;
+}
+
+static PyObject *Qt_MediaGetOffscreenBufferSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ Rect bounds;
+ short depth;
+ CTabHandle ctab;
+#ifndef MediaGetOffscreenBufferSize
+ PyMac_PRECHECK(MediaGetOffscreenBufferSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hO&",
+ CmpInstObj_Convert, &mh,
+ &depth,
+ ResObj_Convert, &ctab))
+ return NULL;
+ _rv = MediaGetOffscreenBufferSize(mh,
+ &bounds,
+ depth,
+ ctab);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildRect, &bounds);
+ return _res;
+}
+
+static PyObject *Qt_MediaSetHints(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long hints;
+#ifndef MediaSetHints
+ PyMac_PRECHECK(MediaSetHints);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mh,
+ &hints))
+ return NULL;
+ _rv = MediaSetHints(mh,
+ hints);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaGetName(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ Str255 name;
+ long requestedLanguage;
+ long actualLanguage;
+#ifndef MediaGetName
+ PyMac_PRECHECK(MediaGetName);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&l",
+ CmpInstObj_Convert, &mh,
+ PyMac_GetStr255, name,
+ &requestedLanguage))
+ return NULL;
+ _rv = MediaGetName(mh,
+ name,
+ requestedLanguage,
+ &actualLanguage);
+ _res = Py_BuildValue("ll",
+ _rv,
+ actualLanguage);
+ return _res;
+}
+
+static PyObject *Qt_MediaForceUpdate(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long forceUpdateFlags;
+#ifndef MediaForceUpdate
+ PyMac_PRECHECK(MediaForceUpdate);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mh,
+ &forceUpdateFlags))
+ return NULL;
+ _rv = MediaForceUpdate(mh,
+ forceUpdateFlags);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaGetDrawingRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ RgnHandle partialRgn;
+#ifndef MediaGetDrawingRgn
+ PyMac_PRECHECK(MediaGetDrawingRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = MediaGetDrawingRgn(mh,
+ &partialRgn);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, partialRgn);
+ return _res;
+}
+
+static PyObject *Qt_MediaGSetActiveSegment(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ TimeValue activeStart;
+ TimeValue activeDuration;
+#ifndef MediaGSetActiveSegment
+ PyMac_PRECHECK(MediaGSetActiveSegment);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ CmpInstObj_Convert, &mh,
+ &activeStart,
+ &activeDuration))
+ return NULL;
+ _rv = MediaGSetActiveSegment(mh,
+ activeStart,
+ activeDuration);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaInvalidateRegion(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ RgnHandle invalRgn;
+#ifndef MediaInvalidateRegion
+ PyMac_PRECHECK(MediaInvalidateRegion);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &mh,
+ ResObj_Convert, &invalRgn))
+ return NULL;
+ _rv = MediaInvalidateRegion(mh,
+ invalRgn);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaGetNextStepTime(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ short flags;
+ TimeValue mediaTimeIn;
+ TimeValue mediaTimeOut;
+ Fixed rate;
+#ifndef MediaGetNextStepTime
+ PyMac_PRECHECK(MediaGetNextStepTime);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hlO&",
+ CmpInstObj_Convert, &mh,
+ &flags,
+ &mediaTimeIn,
+ PyMac_GetFixed, &rate))
+ return NULL;
+ _rv = MediaGetNextStepTime(mh,
+ flags,
+ mediaTimeIn,
+ &mediaTimeOut,
+ rate);
+ _res = Py_BuildValue("ll",
+ _rv,
+ mediaTimeOut);
+ return _res;
+}
+
+static PyObject *Qt_MediaChangedNonPrimarySource(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long inputIndex;
+#ifndef MediaChangedNonPrimarySource
+ PyMac_PRECHECK(MediaChangedNonPrimarySource);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mh,
+ &inputIndex))
+ return NULL;
+ _rv = MediaChangedNonPrimarySource(mh,
+ inputIndex);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaTrackReferencesChanged(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+#ifndef MediaTrackReferencesChanged
+ PyMac_PRECHECK(MediaTrackReferencesChanged);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = MediaTrackReferencesChanged(mh);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaReleaseSampleDataPointer(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long sampleNum;
+#ifndef MediaReleaseSampleDataPointer
+ PyMac_PRECHECK(MediaReleaseSampleDataPointer);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mh,
+ &sampleNum))
+ return NULL;
+ _rv = MediaReleaseSampleDataPointer(mh,
+ sampleNum);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaTrackPropertyAtomChanged(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+#ifndef MediaTrackPropertyAtomChanged
+ PyMac_PRECHECK(MediaTrackPropertyAtomChanged);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = MediaTrackPropertyAtomChanged(mh);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaSetVideoParam(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long whichParam;
+ unsigned short value;
+#ifndef MediaSetVideoParam
+ PyMac_PRECHECK(MediaSetVideoParam);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mh,
+ &whichParam))
+ return NULL;
+ _rv = MediaSetVideoParam(mh,
+ whichParam,
+ &value);
+ _res = Py_BuildValue("lH",
+ _rv,
+ value);
+ return _res;
+}
+
+static PyObject *Qt_MediaGetVideoParam(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long whichParam;
+ unsigned short value;
+#ifndef MediaGetVideoParam
+ PyMac_PRECHECK(MediaGetVideoParam);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mh,
+ &whichParam))
+ return NULL;
+ _rv = MediaGetVideoParam(mh,
+ whichParam,
+ &value);
+ _res = Py_BuildValue("lH",
+ _rv,
+ value);
+ return _res;
+}
+
+static PyObject *Qt_MediaCompare(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ Boolean isOK;
+ Media srcMedia;
+ ComponentInstance srcMediaComponent;
+#ifndef MediaCompare
+ PyMac_PRECHECK(MediaCompare);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ CmpInstObj_Convert, &mh,
+ MediaObj_Convert, &srcMedia,
+ CmpInstObj_Convert, &srcMediaComponent))
+ return NULL;
+ _rv = MediaCompare(mh,
+ &isOK,
+ srcMedia,
+ srcMediaComponent);
+ _res = Py_BuildValue("lb",
+ _rv,
+ isOK);
+ return _res;
+}
+
+static PyObject *Qt_MediaGetClock(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ ComponentInstance clock;
+#ifndef MediaGetClock
+ PyMac_PRECHECK(MediaGetClock);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = MediaGetClock(mh,
+ &clock);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ CmpInstObj_New, clock);
+ return _res;
+}
+
+static PyObject *Qt_MediaSetSoundOutputComponent(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ Component outputComponent;
+#ifndef MediaSetSoundOutputComponent
+ PyMac_PRECHECK(MediaSetSoundOutputComponent);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &mh,
+ CmpObj_Convert, &outputComponent))
+ return NULL;
+ _rv = MediaSetSoundOutputComponent(mh,
+ outputComponent);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaGetSoundOutputComponent(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ Component outputComponent;
+#ifndef MediaGetSoundOutputComponent
+ PyMac_PRECHECK(MediaGetSoundOutputComponent);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = MediaGetSoundOutputComponent(mh,
+ &outputComponent);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ CmpObj_New, outputComponent);
+ return _res;
+}
+
+static PyObject *Qt_MediaSetSoundLocalizationData(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ Handle data;
+#ifndef MediaSetSoundLocalizationData
+ PyMac_PRECHECK(MediaSetSoundLocalizationData);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &mh,
+ ResObj_Convert, &data))
+ return NULL;
+ _rv = MediaSetSoundLocalizationData(mh,
+ data);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaGetInvalidRegion(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ RgnHandle rgn;
+#ifndef MediaGetInvalidRegion
+ PyMac_PRECHECK(MediaGetInvalidRegion);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &mh,
+ ResObj_Convert, &rgn))
+ return NULL;
+ _rv = MediaGetInvalidRegion(mh,
+ rgn);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaSampleDescriptionB2N(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ SampleDescriptionHandle sampleDescriptionH;
+#ifndef MediaSampleDescriptionB2N
+ PyMac_PRECHECK(MediaSampleDescriptionB2N);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &mh,
+ ResObj_Convert, &sampleDescriptionH))
+ return NULL;
+ _rv = MediaSampleDescriptionB2N(mh,
+ sampleDescriptionH);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaSampleDescriptionN2B(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ SampleDescriptionHandle sampleDescriptionH;
+#ifndef MediaSampleDescriptionN2B
+ PyMac_PRECHECK(MediaSampleDescriptionN2B);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &mh,
+ ResObj_Convert, &sampleDescriptionH))
+ return NULL;
+ _rv = MediaSampleDescriptionN2B(mh,
+ sampleDescriptionH);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaFlushNonPrimarySourceData(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long inputIndex;
+#ifndef MediaFlushNonPrimarySourceData
+ PyMac_PRECHECK(MediaFlushNonPrimarySourceData);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mh,
+ &inputIndex))
+ return NULL;
+ _rv = MediaFlushNonPrimarySourceData(mh,
+ inputIndex);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaGetURLLink(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ Point displayWhere;
+ Handle urlLink;
+#ifndef MediaGetURLLink
+ PyMac_PRECHECK(MediaGetURLLink);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &mh,
+ PyMac_GetPoint, &displayWhere))
+ return NULL;
+ _rv = MediaGetURLLink(mh,
+ displayWhere,
+ &urlLink);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, urlLink);
+ return _res;
+}
+
+static PyObject *Qt_MediaHitTestForTargetRefCon(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long flags;
+ Point loc;
+ long targetRefCon;
+#ifndef MediaHitTestForTargetRefCon
+ PyMac_PRECHECK(MediaHitTestForTargetRefCon);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lO&",
+ CmpInstObj_Convert, &mh,
+ &flags,
+ PyMac_GetPoint, &loc))
+ return NULL;
+ _rv = MediaHitTestForTargetRefCon(mh,
+ flags,
+ loc,
+ &targetRefCon);
+ _res = Py_BuildValue("ll",
+ _rv,
+ targetRefCon);
+ return _res;
+}
+
+static PyObject *Qt_MediaHitTestTargetRefCon(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long targetRefCon;
+ long flags;
+ Point loc;
+ Boolean wasHit;
+#ifndef MediaHitTestTargetRefCon
+ PyMac_PRECHECK(MediaHitTestTargetRefCon);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&llO&",
+ CmpInstObj_Convert, &mh,
+ &targetRefCon,
+ &flags,
+ PyMac_GetPoint, &loc))
+ return NULL;
+ _rv = MediaHitTestTargetRefCon(mh,
+ targetRefCon,
+ flags,
+ loc,
+ &wasHit);
+ _res = Py_BuildValue("lb",
+ _rv,
+ wasHit);
+ return _res;
+}
+
+static PyObject *Qt_MediaDisposeTargetRefCon(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long targetRefCon;
+#ifndef MediaDisposeTargetRefCon
+ PyMac_PRECHECK(MediaDisposeTargetRefCon);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mh,
+ &targetRefCon))
+ return NULL;
+ _rv = MediaDisposeTargetRefCon(mh,
+ targetRefCon);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaTargetRefConsEqual(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long firstRefCon;
+ long secondRefCon;
+ Boolean equal;
+#ifndef MediaTargetRefConsEqual
+ PyMac_PRECHECK(MediaTargetRefConsEqual);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ CmpInstObj_Convert, &mh,
+ &firstRefCon,
+ &secondRefCon))
+ return NULL;
+ _rv = MediaTargetRefConsEqual(mh,
+ firstRefCon,
+ secondRefCon,
+ &equal);
+ _res = Py_BuildValue("lb",
+ _rv,
+ equal);
+ return _res;
+}
+
+static PyObject *Qt_MediaPrePrerollCancel(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ void * refcon;
+#ifndef MediaPrePrerollCancel
+ PyMac_PRECHECK(MediaPrePrerollCancel);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&s",
+ CmpInstObj_Convert, &mh,
+ &refcon))
+ return NULL;
+ _rv = MediaPrePrerollCancel(mh,
+ refcon);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaEnterEmptyEdit(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+#ifndef MediaEnterEmptyEdit
+ PyMac_PRECHECK(MediaEnterEmptyEdit);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = MediaEnterEmptyEdit(mh);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaCurrentMediaQueuedData(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long milliSecs;
+#ifndef MediaCurrentMediaQueuedData
+ PyMac_PRECHECK(MediaCurrentMediaQueuedData);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = MediaCurrentMediaQueuedData(mh,
+ &milliSecs);
+ _res = Py_BuildValue("ll",
+ _rv,
+ milliSecs);
+ return _res;
+}
+
+static PyObject *Qt_MediaGetEffectiveVolume(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ short volume;
+#ifndef MediaGetEffectiveVolume
+ PyMac_PRECHECK(MediaGetEffectiveVolume);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = MediaGetEffectiveVolume(mh,
+ &volume);
+ _res = Py_BuildValue("lh",
+ _rv,
+ volume);
+ return _res;
+}
+
+static PyObject *Qt_MediaGetSoundLevelMeteringEnabled(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ Boolean enabled;
+#ifndef MediaGetSoundLevelMeteringEnabled
+ PyMac_PRECHECK(MediaGetSoundLevelMeteringEnabled);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = MediaGetSoundLevelMeteringEnabled(mh,
+ &enabled);
+ _res = Py_BuildValue("lb",
+ _rv,
+ enabled);
+ return _res;
+}
+
+static PyObject *Qt_MediaSetSoundLevelMeteringEnabled(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ Boolean enable;
+#ifndef MediaSetSoundLevelMeteringEnabled
+ PyMac_PRECHECK(MediaSetSoundLevelMeteringEnabled);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&b",
+ CmpInstObj_Convert, &mh,
+ &enable))
+ return NULL;
+ _rv = MediaSetSoundLevelMeteringEnabled(mh,
+ enable);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaGetEffectiveSoundBalance(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ short balance;
+#ifndef MediaGetEffectiveSoundBalance
+ PyMac_PRECHECK(MediaGetEffectiveSoundBalance);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = MediaGetEffectiveSoundBalance(mh,
+ &balance);
+ _res = Py_BuildValue("lh",
+ _rv,
+ balance);
+ return _res;
+}
+
+static PyObject *Qt_MediaSetScreenLock(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ Boolean lockIt;
+#ifndef MediaSetScreenLock
+ PyMac_PRECHECK(MediaSetScreenLock);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&b",
+ CmpInstObj_Convert, &mh,
+ &lockIt))
+ return NULL;
+ _rv = MediaSetScreenLock(mh,
+ lockIt);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaGetErrorString(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ ComponentResult theError;
+ Str255 errorString;
+#ifndef MediaGetErrorString
+ PyMac_PRECHECK(MediaGetErrorString);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lO&",
+ CmpInstObj_Convert, &mh,
+ &theError,
+ PyMac_GetStr255, errorString))
+ return NULL;
+ _rv = MediaGetErrorString(mh,
+ theError,
+ errorString);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaGetSoundEqualizerBandLevels(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ UInt8 bandLevels;
+#ifndef MediaGetSoundEqualizerBandLevels
+ PyMac_PRECHECK(MediaGetSoundEqualizerBandLevels);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = MediaGetSoundEqualizerBandLevels(mh,
+ &bandLevels);
+ _res = Py_BuildValue("lb",
+ _rv,
+ bandLevels);
+ return _res;
+}
+
+static PyObject *Qt_MediaDoIdleActions(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+#ifndef MediaDoIdleActions
+ PyMac_PRECHECK(MediaDoIdleActions);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = MediaDoIdleActions(mh);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaSetSoundBassAndTreble(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ short bass;
+ short treble;
+#ifndef MediaSetSoundBassAndTreble
+ PyMac_PRECHECK(MediaSetSoundBassAndTreble);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ CmpInstObj_Convert, &mh,
+ &bass,
+ &treble))
+ return NULL;
+ _rv = MediaSetSoundBassAndTreble(mh,
+ bass,
+ treble);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaGetSoundBassAndTreble(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ short bass;
+ short treble;
+#ifndef MediaGetSoundBassAndTreble
+ PyMac_PRECHECK(MediaGetSoundBassAndTreble);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = MediaGetSoundBassAndTreble(mh,
+ &bass,
+ &treble);
+ _res = Py_BuildValue("lhh",
+ _rv,
+ bass,
+ treble);
+ return _res;
+}
+
+static PyObject *Qt_MediaTimeBaseChanged(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+#ifndef MediaTimeBaseChanged
+ PyMac_PRECHECK(MediaTimeBaseChanged);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = MediaTimeBaseChanged(mh);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaMCIsPlayerEvent(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ EventRecord e;
+ Boolean handledIt;
+#ifndef MediaMCIsPlayerEvent
+ PyMac_PRECHECK(MediaMCIsPlayerEvent);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &mh,
+ PyMac_GetEventRecord, &e))
+ return NULL;
+ _rv = MediaMCIsPlayerEvent(mh,
+ &e,
+ &handledIt);
+ _res = Py_BuildValue("lb",
+ _rv,
+ handledIt);
+ return _res;
+}
+
+static PyObject *Qt_MediaGetMediaLoadState(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long mediaLoadState;
+#ifndef MediaGetMediaLoadState
+ PyMac_PRECHECK(MediaGetMediaLoadState);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = MediaGetMediaLoadState(mh,
+ &mediaLoadState);
+ _res = Py_BuildValue("ll",
+ _rv,
+ mediaLoadState);
+ return _res;
+}
+
+static PyObject *Qt_MediaVideoOutputChanged(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ ComponentInstance vout;
+#ifndef MediaVideoOutputChanged
+ PyMac_PRECHECK(MediaVideoOutputChanged);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &mh,
+ CmpInstObj_Convert, &vout))
+ return NULL;
+ _rv = MediaVideoOutputChanged(mh,
+ vout);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaEmptySampleCache(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long sampleNum;
+ long sampleCount;
+#ifndef MediaEmptySampleCache
+ PyMac_PRECHECK(MediaEmptySampleCache);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ CmpInstObj_Convert, &mh,
+ &sampleNum,
+ &sampleCount))
+ return NULL;
+ _rv = MediaEmptySampleCache(mh,
+ sampleNum,
+ sampleCount);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaGetPublicInfo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ OSType infoSelector;
+ void * infoDataPtr;
+ Size ioDataSize;
+#ifndef MediaGetPublicInfo
+ PyMac_PRECHECK(MediaGetPublicInfo);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&s",
+ CmpInstObj_Convert, &mh,
+ PyMac_GetOSType, &infoSelector,
+ &infoDataPtr))
+ return NULL;
+ _rv = MediaGetPublicInfo(mh,
+ infoSelector,
+ infoDataPtr,
+ &ioDataSize);
+ _res = Py_BuildValue("ll",
+ _rv,
+ ioDataSize);
+ return _res;
+}
+
+static PyObject *Qt_MediaSetPublicInfo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ OSType infoSelector;
+ void * infoDataPtr;
+ Size dataSize;
+#ifndef MediaSetPublicInfo
+ PyMac_PRECHECK(MediaSetPublicInfo);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&sl",
+ CmpInstObj_Convert, &mh,
+ PyMac_GetOSType, &infoSelector,
+ &infoDataPtr,
+ &dataSize))
+ return NULL;
+ _rv = MediaSetPublicInfo(mh,
+ infoSelector,
+ infoDataPtr,
+ dataSize);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaRefConSetProperty(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long refCon;
+ long propertyType;
+ void * propertyValue;
+#ifndef MediaRefConSetProperty
+ PyMac_PRECHECK(MediaRefConSetProperty);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lls",
+ CmpInstObj_Convert, &mh,
+ &refCon,
+ &propertyType,
+ &propertyValue))
+ return NULL;
+ _rv = MediaRefConSetProperty(mh,
+ refCon,
+ propertyType,
+ propertyValue);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaRefConGetProperty(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long refCon;
+ long propertyType;
+ void * propertyValue;
+#ifndef MediaRefConGetProperty
+ PyMac_PRECHECK(MediaRefConGetProperty);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lls",
+ CmpInstObj_Convert, &mh,
+ &refCon,
+ &propertyType,
+ &propertyValue))
+ return NULL;
+ _rv = MediaRefConGetProperty(mh,
+ refCon,
+ propertyType,
+ propertyValue);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MediaNavigateTargetRefCon(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long navigation;
+ long refCon;
+#ifndef MediaNavigateTargetRefCon
+ PyMac_PRECHECK(MediaNavigateTargetRefCon);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mh,
+ &navigation))
+ return NULL;
+ _rv = MediaNavigateTargetRefCon(mh,
+ navigation,
+ &refCon);
+ _res = Py_BuildValue("ll",
+ _rv,
+ refCon);
+ return _res;
+}
+
+static PyObject *Qt_MediaGGetIdleManager(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ IdleManager pim;
+#ifndef MediaGGetIdleManager
+ PyMac_PRECHECK(MediaGGetIdleManager);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = MediaGGetIdleManager(mh,
+ &pim);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ IdleManagerObj_New, pim);
+ return _res;
+}
+
+static PyObject *Qt_MediaGSetIdleManager(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ IdleManager im;
+#ifndef MediaGSetIdleManager
+ PyMac_PRECHECK(MediaGSetIdleManager);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &mh,
+ IdleManagerObj_Convert, &im))
+ return NULL;
+ _rv = MediaGSetIdleManager(mh,
+ im);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_QTMIDIGetMIDIPorts(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ QTMIDIComponent ci;
+ QTMIDIPortListHandle inputPorts;
+ QTMIDIPortListHandle outputPorts;
+#ifndef QTMIDIGetMIDIPorts
+ PyMac_PRECHECK(QTMIDIGetMIDIPorts);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &ci))
+ return NULL;
+ _rv = QTMIDIGetMIDIPorts(ci,
+ &inputPorts,
+ &outputPorts);
+ _res = Py_BuildValue("lO&O&",
+ _rv,
+ ResObj_New, inputPorts,
+ ResObj_New, outputPorts);
+ return _res;
+}
+
+static PyObject *Qt_QTMIDIUseSendPort(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ QTMIDIComponent ci;
+ long portIndex;
+ long inUse;
+#ifndef QTMIDIUseSendPort
+ PyMac_PRECHECK(QTMIDIUseSendPort);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ CmpInstObj_Convert, &ci,
+ &portIndex,
+ &inUse))
+ return NULL;
+ _rv = QTMIDIUseSendPort(ci,
+ portIndex,
+ inUse);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_QTMIDISendMIDI(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ QTMIDIComponent ci;
+ long portIndex;
+ MusicMIDIPacket mp;
+#ifndef QTMIDISendMIDI
+ PyMac_PRECHECK(QTMIDISendMIDI);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lO&",
+ CmpInstObj_Convert, &ci,
+ &portIndex,
+ QtMusicMIDIPacket_Convert, &mp))
+ return NULL;
+ _rv = QTMIDISendMIDI(ci,
+ portIndex,
+ &mp);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MusicGetPart(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+ long part;
+ long midiChannel;
+ long polyphony;
+#ifndef MusicGetPart
+ PyMac_PRECHECK(MusicGetPart);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mc,
+ &part))
+ return NULL;
+ _rv = MusicGetPart(mc,
+ part,
+ &midiChannel,
+ &polyphony);
+ _res = Py_BuildValue("lll",
+ _rv,
+ midiChannel,
+ polyphony);
+ return _res;
+}
+
+static PyObject *Qt_MusicSetPart(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+ long part;
+ long midiChannel;
+ long polyphony;
+#ifndef MusicSetPart
+ PyMac_PRECHECK(MusicSetPart);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lll",
+ CmpInstObj_Convert, &mc,
+ &part,
+ &midiChannel,
+ &polyphony))
+ return NULL;
+ _rv = MusicSetPart(mc,
+ part,
+ midiChannel,
+ polyphony);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MusicSetPartInstrumentNumber(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+ long part;
+ long instrumentNumber;
+#ifndef MusicSetPartInstrumentNumber
+ PyMac_PRECHECK(MusicSetPartInstrumentNumber);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ CmpInstObj_Convert, &mc,
+ &part,
+ &instrumentNumber))
+ return NULL;
+ _rv = MusicSetPartInstrumentNumber(mc,
+ part,
+ instrumentNumber);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MusicGetPartInstrumentNumber(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+ long part;
+#ifndef MusicGetPartInstrumentNumber
+ PyMac_PRECHECK(MusicGetPartInstrumentNumber);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mc,
+ &part))
+ return NULL;
+ _rv = MusicGetPartInstrumentNumber(mc,
+ part);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MusicStorePartInstrument(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+ long part;
+ long instrumentNumber;
+#ifndef MusicStorePartInstrument
+ PyMac_PRECHECK(MusicStorePartInstrument);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ CmpInstObj_Convert, &mc,
+ &part,
+ &instrumentNumber))
+ return NULL;
+ _rv = MusicStorePartInstrument(mc,
+ part,
+ instrumentNumber);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MusicGetPartAtomicInstrument(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+ long part;
+ AtomicInstrument ai;
+ long flags;
+#ifndef MusicGetPartAtomicInstrument
+ PyMac_PRECHECK(MusicGetPartAtomicInstrument);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ CmpInstObj_Convert, &mc,
+ &part,
+ &flags))
+ return NULL;
+ _rv = MusicGetPartAtomicInstrument(mc,
+ part,
+ &ai,
+ flags);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, ai);
+ return _res;
+}
+
+static PyObject *Qt_MusicSetPartAtomicInstrument(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+ long part;
+ AtomicInstrumentPtr aiP;
+ long flags;
+#ifndef MusicSetPartAtomicInstrument
+ PyMac_PRECHECK(MusicSetPartAtomicInstrument);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lsl",
+ CmpInstObj_Convert, &mc,
+ &part,
+ &aiP,
+ &flags))
+ return NULL;
+ _rv = MusicSetPartAtomicInstrument(mc,
+ part,
+ aiP,
+ flags);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MusicGetPartKnob(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+ long part;
+ long knobID;
+#ifndef MusicGetPartKnob
+ PyMac_PRECHECK(MusicGetPartKnob);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ CmpInstObj_Convert, &mc,
+ &part,
+ &knobID))
+ return NULL;
+ _rv = MusicGetPartKnob(mc,
+ part,
+ knobID);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MusicSetPartKnob(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+ long part;
+ long knobID;
+ long knobValue;
+#ifndef MusicSetPartKnob
+ PyMac_PRECHECK(MusicSetPartKnob);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lll",
+ CmpInstObj_Convert, &mc,
+ &part,
+ &knobID,
+ &knobValue))
+ return NULL;
+ _rv = MusicSetPartKnob(mc,
+ part,
+ knobID,
+ knobValue);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MusicGetKnob(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+ long knobID;
+#ifndef MusicGetKnob
+ PyMac_PRECHECK(MusicGetKnob);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mc,
+ &knobID))
+ return NULL;
+ _rv = MusicGetKnob(mc,
+ knobID);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MusicSetKnob(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+ long knobID;
+ long knobValue;
+#ifndef MusicSetKnob
+ PyMac_PRECHECK(MusicSetKnob);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ CmpInstObj_Convert, &mc,
+ &knobID,
+ &knobValue))
+ return NULL;
+ _rv = MusicSetKnob(mc,
+ knobID,
+ knobValue);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MusicGetPartName(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+ long part;
+ StringPtr name;
+#ifndef MusicGetPartName
+ PyMac_PRECHECK(MusicGetPartName);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ls",
+ CmpInstObj_Convert, &mc,
+ &part,
+ &name))
+ return NULL;
+ _rv = MusicGetPartName(mc,
+ part,
+ name);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MusicSetPartName(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+ long part;
+ StringPtr name;
+#ifndef MusicSetPartName
+ PyMac_PRECHECK(MusicSetPartName);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ls",
+ CmpInstObj_Convert, &mc,
+ &part,
+ &name))
+ return NULL;
+ _rv = MusicSetPartName(mc,
+ part,
+ name);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MusicPlayNote(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+ long part;
+ long pitch;
+ long velocity;
+#ifndef MusicPlayNote
+ PyMac_PRECHECK(MusicPlayNote);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lll",
+ CmpInstObj_Convert, &mc,
+ &part,
+ &pitch,
+ &velocity))
+ return NULL;
+ _rv = MusicPlayNote(mc,
+ part,
+ pitch,
+ velocity);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MusicResetPart(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+ long part;
+#ifndef MusicResetPart
+ PyMac_PRECHECK(MusicResetPart);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mc,
+ &part))
+ return NULL;
+ _rv = MusicResetPart(mc,
+ part);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MusicSetPartController(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+ long part;
+ MusicController controllerNumber;
+ long controllerValue;
+#ifndef MusicSetPartController
+ PyMac_PRECHECK(MusicSetPartController);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lll",
+ CmpInstObj_Convert, &mc,
+ &part,
+ &controllerNumber,
+ &controllerValue))
+ return NULL;
+ _rv = MusicSetPartController(mc,
+ part,
+ controllerNumber,
+ controllerValue);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MusicGetPartController(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+ long part;
+ MusicController controllerNumber;
+#ifndef MusicGetPartController
+ PyMac_PRECHECK(MusicGetPartController);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ CmpInstObj_Convert, &mc,
+ &part,
+ &controllerNumber))
+ return NULL;
+ _rv = MusicGetPartController(mc,
+ part,
+ controllerNumber);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MusicGetInstrumentNames(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+ long modifiableInstruments;
+ Handle instrumentNames;
+ Handle instrumentCategoryLasts;
+ Handle instrumentCategoryNames;
+#ifndef MusicGetInstrumentNames
+ PyMac_PRECHECK(MusicGetInstrumentNames);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mc,
+ &modifiableInstruments))
+ return NULL;
+ _rv = MusicGetInstrumentNames(mc,
+ modifiableInstruments,
+ &instrumentNames,
+ &instrumentCategoryLasts,
+ &instrumentCategoryNames);
+ _res = Py_BuildValue("lO&O&O&",
+ _rv,
+ ResObj_New, instrumentNames,
+ ResObj_New, instrumentCategoryLasts,
+ ResObj_New, instrumentCategoryNames);
+ return _res;
+}
+
+static PyObject *Qt_MusicGetDrumNames(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+ long modifiableInstruments;
+ Handle instrumentNumbers;
+ Handle instrumentNames;
+#ifndef MusicGetDrumNames
+ PyMac_PRECHECK(MusicGetDrumNames);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mc,
+ &modifiableInstruments))
+ return NULL;
+ _rv = MusicGetDrumNames(mc,
+ modifiableInstruments,
+ &instrumentNumbers,
+ &instrumentNames);
+ _res = Py_BuildValue("lO&O&",
+ _rv,
+ ResObj_New, instrumentNumbers,
+ ResObj_New, instrumentNames);
+ return _res;
+}
+
+static PyObject *Qt_MusicGetMasterTune(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+#ifndef MusicGetMasterTune
+ PyMac_PRECHECK(MusicGetMasterTune);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mc))
+ return NULL;
+ _rv = MusicGetMasterTune(mc);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MusicSetMasterTune(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+ long masterTune;
+#ifndef MusicSetMasterTune
+ PyMac_PRECHECK(MusicSetMasterTune);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mc,
+ &masterTune))
+ return NULL;
+ _rv = MusicSetMasterTune(mc,
+ masterTune);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MusicGetDeviceConnection(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+ long index;
+ long id1;
+ long id2;
+#ifndef MusicGetDeviceConnection
+ PyMac_PRECHECK(MusicGetDeviceConnection);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mc,
+ &index))
+ return NULL;
+ _rv = MusicGetDeviceConnection(mc,
+ index,
+ &id1,
+ &id2);
+ _res = Py_BuildValue("lll",
+ _rv,
+ id1,
+ id2);
+ return _res;
+}
+
+static PyObject *Qt_MusicUseDeviceConnection(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+ long id1;
+ long id2;
+#ifndef MusicUseDeviceConnection
+ PyMac_PRECHECK(MusicUseDeviceConnection);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ CmpInstObj_Convert, &mc,
+ &id1,
+ &id2))
+ return NULL;
+ _rv = MusicUseDeviceConnection(mc,
+ id1,
+ id2);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MusicGetKnobSettingStrings(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+ long knobIndex;
+ long isGlobal;
+ Handle settingsNames;
+ Handle settingsCategoryLasts;
+ Handle settingsCategoryNames;
+#ifndef MusicGetKnobSettingStrings
+ PyMac_PRECHECK(MusicGetKnobSettingStrings);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ CmpInstObj_Convert, &mc,
+ &knobIndex,
+ &isGlobal))
+ return NULL;
+ _rv = MusicGetKnobSettingStrings(mc,
+ knobIndex,
+ isGlobal,
+ &settingsNames,
+ &settingsCategoryLasts,
+ &settingsCategoryNames);
+ _res = Py_BuildValue("lO&O&O&",
+ _rv,
+ ResObj_New, settingsNames,
+ ResObj_New, settingsCategoryLasts,
+ ResObj_New, settingsCategoryNames);
+ return _res;
+}
+
+static PyObject *Qt_MusicGetMIDIPorts(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+ long inputPortCount;
+ long outputPortCount;
+#ifndef MusicGetMIDIPorts
+ PyMac_PRECHECK(MusicGetMIDIPorts);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mc))
+ return NULL;
+ _rv = MusicGetMIDIPorts(mc,
+ &inputPortCount,
+ &outputPortCount);
+ _res = Py_BuildValue("lll",
+ _rv,
+ inputPortCount,
+ outputPortCount);
+ return _res;
+}
+
+static PyObject *Qt_MusicSendMIDI(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+ long portIndex;
+ MusicMIDIPacket mp;
+#ifndef MusicSendMIDI
+ PyMac_PRECHECK(MusicSendMIDI);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lO&",
+ CmpInstObj_Convert, &mc,
+ &portIndex,
+ QtMusicMIDIPacket_Convert, &mp))
+ return NULL;
+ _rv = MusicSendMIDI(mc,
+ portIndex,
+ &mp);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MusicSetOfflineTimeTo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+ long newTimeStamp;
+#ifndef MusicSetOfflineTimeTo
+ PyMac_PRECHECK(MusicSetOfflineTimeTo);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mc,
+ &newTimeStamp))
+ return NULL;
+ _rv = MusicSetOfflineTimeTo(mc,
+ newTimeStamp);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MusicGetInfoText(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+ long selector;
+ Handle textH;
+ Handle styleH;
+#ifndef MusicGetInfoText
+ PyMac_PRECHECK(MusicGetInfoText);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mc,
+ &selector))
+ return NULL;
+ _rv = MusicGetInfoText(mc,
+ selector,
+ &textH,
+ &styleH);
+ _res = Py_BuildValue("lO&O&",
+ _rv,
+ ResObj_New, textH,
+ ResObj_New, styleH);
+ return _res;
+}
+
+static PyObject *Qt_MusicGetInstrumentInfo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+ long getInstrumentInfoFlags;
+ InstrumentInfoListHandle infoListH;
+#ifndef MusicGetInstrumentInfo
+ PyMac_PRECHECK(MusicGetInstrumentInfo);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mc,
+ &getInstrumentInfoFlags))
+ return NULL;
+ _rv = MusicGetInstrumentInfo(mc,
+ getInstrumentInfoFlags,
+ &infoListH);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, infoListH);
+ return _res;
+}
+
+static PyObject *Qt_MusicTask(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+#ifndef MusicTask
+ PyMac_PRECHECK(MusicTask);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mc))
+ return NULL;
+ _rv = MusicTask(mc);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MusicSetPartInstrumentNumberInterruptSafe(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+ long part;
+ long instrumentNumber;
+#ifndef MusicSetPartInstrumentNumberInterruptSafe
+ PyMac_PRECHECK(MusicSetPartInstrumentNumberInterruptSafe);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ CmpInstObj_Convert, &mc,
+ &part,
+ &instrumentNumber))
+ return NULL;
+ _rv = MusicSetPartInstrumentNumberInterruptSafe(mc,
+ part,
+ instrumentNumber);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MusicSetPartSoundLocalization(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+ long part;
+ Handle data;
+#ifndef MusicSetPartSoundLocalization
+ PyMac_PRECHECK(MusicSetPartSoundLocalization);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lO&",
+ CmpInstObj_Convert, &mc,
+ &part,
+ ResObj_Convert, &data))
+ return NULL;
+ _rv = MusicSetPartSoundLocalization(mc,
+ part,
+ data);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MusicGenericConfigure(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+ long mode;
+ long flags;
+ long baseResID;
+#ifndef MusicGenericConfigure
+ PyMac_PRECHECK(MusicGenericConfigure);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lll",
+ CmpInstObj_Convert, &mc,
+ &mode,
+ &flags,
+ &baseResID))
+ return NULL;
+ _rv = MusicGenericConfigure(mc,
+ mode,
+ flags,
+ baseResID);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MusicGenericGetKnobList(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+ long knobType;
+ GenericKnobDescriptionListHandle gkdlH;
+#ifndef MusicGenericGetKnobList
+ PyMac_PRECHECK(MusicGenericGetKnobList);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mc,
+ &knobType))
+ return NULL;
+ _rv = MusicGenericGetKnobList(mc,
+ knobType,
+ &gkdlH);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, gkdlH);
+ return _res;
+}
+
+static PyObject *Qt_MusicGenericSetResourceNumbers(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+ Handle resourceIDH;
+#ifndef MusicGenericSetResourceNumbers
+ PyMac_PRECHECK(MusicGenericSetResourceNumbers);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &mc,
+ ResObj_Convert, &resourceIDH))
+ return NULL;
+ _rv = MusicGenericSetResourceNumbers(mc,
+ resourceIDH);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MusicDerivedMIDISend(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+ MusicMIDIPacket packet;
+#ifndef MusicDerivedMIDISend
+ PyMac_PRECHECK(MusicDerivedMIDISend);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &mc,
+ QtMusicMIDIPacket_Convert, &packet))
+ return NULL;
+ _rv = MusicDerivedMIDISend(mc,
+ &packet);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MusicDerivedOpenResFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+#ifndef MusicDerivedOpenResFile
+ PyMac_PRECHECK(MusicDerivedOpenResFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mc))
+ return NULL;
+ _rv = MusicDerivedOpenResFile(mc);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_MusicDerivedCloseResFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MusicComponent mc;
+ short resRefNum;
+#ifndef MusicDerivedCloseResFile
+ PyMac_PRECHECK(MusicDerivedCloseResFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ CmpInstObj_Convert, &mc,
+ &resRefNum))
+ return NULL;
+ _rv = MusicDerivedCloseResFile(mc,
+ resRefNum);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_NAUnregisterMusicDevice(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ NoteAllocator na;
+ long index;
+#ifndef NAUnregisterMusicDevice
+ PyMac_PRECHECK(NAUnregisterMusicDevice);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &na,
+ &index))
+ return NULL;
+ _rv = NAUnregisterMusicDevice(na,
+ index);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_NASaveMusicConfiguration(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ NoteAllocator na;
+#ifndef NASaveMusicConfiguration
+ PyMac_PRECHECK(NASaveMusicConfiguration);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &na))
+ return NULL;
+ _rv = NASaveMusicConfiguration(na);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_NAGetMIDIPorts(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ NoteAllocator na;
+ QTMIDIPortListHandle inputPorts;
+ QTMIDIPortListHandle outputPorts;
+#ifndef NAGetMIDIPorts
+ PyMac_PRECHECK(NAGetMIDIPorts);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &na))
+ return NULL;
+ _rv = NAGetMIDIPorts(na,
+ &inputPorts,
+ &outputPorts);
+ _res = Py_BuildValue("lO&O&",
+ _rv,
+ ResObj_New, inputPorts,
+ ResObj_New, outputPorts);
+ return _res;
+}
+
+static PyObject *Qt_NATask(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ NoteAllocator na;
+#ifndef NATask
+ PyMac_PRECHECK(NATask);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &na))
+ return NULL;
+ _rv = NATask(na);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_TuneSetHeader(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ TunePlayer tp;
+ unsigned long * header;
+#ifndef TuneSetHeader
+ PyMac_PRECHECK(TuneSetHeader);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&s",
+ CmpInstObj_Convert, &tp,
+ &header))
+ return NULL;
+ _rv = TuneSetHeader(tp,
+ header);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_TuneGetTimeBase(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ TunePlayer tp;
+ TimeBase tb;
+#ifndef TuneGetTimeBase
+ PyMac_PRECHECK(TuneGetTimeBase);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &tp))
+ return NULL;
+ _rv = TuneGetTimeBase(tp,
+ &tb);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ TimeBaseObj_New, tb);
+ return _res;
+}
+
+static PyObject *Qt_TuneSetTimeScale(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ TunePlayer tp;
+ TimeScale scale;
+#ifndef TuneSetTimeScale
+ PyMac_PRECHECK(TuneSetTimeScale);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &tp,
+ &scale))
+ return NULL;
+ _rv = TuneSetTimeScale(tp,
+ scale);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_TuneGetTimeScale(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ TunePlayer tp;
+ TimeScale scale;
+#ifndef TuneGetTimeScale
+ PyMac_PRECHECK(TuneGetTimeScale);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &tp))
+ return NULL;
+ _rv = TuneGetTimeScale(tp,
+ &scale);
+ _res = Py_BuildValue("ll",
+ _rv,
+ scale);
+ return _res;
+}
+
+static PyObject *Qt_TuneInstant(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ TunePlayer tp;
+ unsigned long tune;
+ unsigned long tunePosition;
+#ifndef TuneInstant
+ PyMac_PRECHECK(TuneInstant);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &tp,
+ &tunePosition))
+ return NULL;
+ _rv = TuneInstant(tp,
+ &tune,
+ tunePosition);
+ _res = Py_BuildValue("ll",
+ _rv,
+ tune);
+ return _res;
+}
+
+static PyObject *Qt_TuneStop(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ TunePlayer tp;
+ long stopFlags;
+#ifndef TuneStop
+ PyMac_PRECHECK(TuneStop);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &tp,
+ &stopFlags))
+ return NULL;
+ _rv = TuneStop(tp,
+ stopFlags);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_TuneSetVolume(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ TunePlayer tp;
+ Fixed volume;
+#ifndef TuneSetVolume
+ PyMac_PRECHECK(TuneSetVolume);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &tp,
+ PyMac_GetFixed, &volume))
+ return NULL;
+ _rv = TuneSetVolume(tp,
+ volume);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_TuneGetVolume(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ TunePlayer tp;
+#ifndef TuneGetVolume
+ PyMac_PRECHECK(TuneGetVolume);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &tp))
+ return NULL;
+ _rv = TuneGetVolume(tp);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_TunePreroll(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ TunePlayer tp;
+#ifndef TunePreroll
+ PyMac_PRECHECK(TunePreroll);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &tp))
+ return NULL;
+ _rv = TunePreroll(tp);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_TuneUnroll(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ TunePlayer tp;
+#ifndef TuneUnroll
+ PyMac_PRECHECK(TuneUnroll);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &tp))
+ return NULL;
+ _rv = TuneUnroll(tp);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_TuneSetPartTranspose(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ TunePlayer tp;
+ unsigned long part;
+ long transpose;
+ long velocityShift;
+#ifndef TuneSetPartTranspose
+ PyMac_PRECHECK(TuneSetPartTranspose);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&lll",
+ CmpInstObj_Convert, &tp,
+ &part,
+ &transpose,
+ &velocityShift))
+ return NULL;
+ _rv = TuneSetPartTranspose(tp,
+ part,
+ transpose,
+ velocityShift);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_TuneGetNoteAllocator(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ NoteAllocator _rv;
+ TunePlayer tp;
+#ifndef TuneGetNoteAllocator
+ PyMac_PRECHECK(TuneGetNoteAllocator);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &tp))
+ return NULL;
+ _rv = TuneGetNoteAllocator(tp);
+ _res = Py_BuildValue("O&",
+ CmpInstObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qt_TuneSetSofter(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ TunePlayer tp;
+ long softer;
+#ifndef TuneSetSofter
+ PyMac_PRECHECK(TuneSetSofter);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &tp,
+ &softer))
+ return NULL;
+ _rv = TuneSetSofter(tp,
+ softer);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_TuneTask(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ TunePlayer tp;
+#ifndef TuneTask
+ PyMac_PRECHECK(TuneTask);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &tp))
+ return NULL;
+ _rv = TuneTask(tp);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_TuneSetBalance(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ TunePlayer tp;
+ long balance;
+#ifndef TuneSetBalance
+ PyMac_PRECHECK(TuneSetBalance);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &tp,
+ &balance))
+ return NULL;
+ _rv = TuneSetBalance(tp,
+ balance);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_TuneSetSoundLocalization(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ TunePlayer tp;
+ Handle data;
+#ifndef TuneSetSoundLocalization
+ PyMac_PRECHECK(TuneSetSoundLocalization);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpInstObj_Convert, &tp,
+ ResObj_Convert, &data))
+ return NULL;
+ _rv = TuneSetSoundLocalization(tp,
+ data);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_TuneSetHeaderWithSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ TunePlayer tp;
+ unsigned long * header;
+ unsigned long size;
+#ifndef TuneSetHeaderWithSize
+ PyMac_PRECHECK(TuneSetHeaderWithSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&sl",
+ CmpInstObj_Convert, &tp,
+ &header,
+ &size))
+ return NULL;
+ _rv = TuneSetHeaderWithSize(tp,
+ header,
+ size);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_TuneSetPartMix(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ TunePlayer tp;
+ unsigned long partNumber;
+ long volume;
+ long balance;
+ long mixFlags;
+#ifndef TuneSetPartMix
+ PyMac_PRECHECK(TuneSetPartMix);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&llll",
+ CmpInstObj_Convert, &tp,
+ &partNumber,
+ &volume,
+ &balance,
+ &mixFlags))
+ return NULL;
+ _rv = TuneSetPartMix(tp,
+ partNumber,
+ volume,
+ balance,
+ mixFlags);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_TuneGetPartMix(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ TunePlayer tp;
+ unsigned long partNumber;
+ long volumeOut;
+ long balanceOut;
+ long mixFlagsOut;
+#ifndef TuneGetPartMix
+ PyMac_PRECHECK(TuneGetPartMix);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &tp,
+ &partNumber))
+ return NULL;
+ _rv = TuneGetPartMix(tp,
+ partNumber,
+ &volumeOut,
+ &balanceOut,
+ &mixFlagsOut);
+ _res = Py_BuildValue("llll",
+ _rv,
+ volumeOut,
+ balanceOut,
+ mixFlagsOut);
+ return _res;
+}
+
+static PyObject *Qt_AlignWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr wp;
+ Boolean front;
+#ifndef AlignWindow
+ PyMac_PRECHECK(AlignWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&b",
+ WinObj_Convert, &wp,
+ &front))
+ return NULL;
+ AlignWindow(wp,
+ front,
+ (Rect *)0,
+ (ICMAlignmentProcRecordPtr)0);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_DragAlignedWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr wp;
+ Point startPt;
+ Rect boundsRect;
+#ifndef DragAlignedWindow
+ PyMac_PRECHECK(DragAlignedWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ WinObj_Convert, &wp,
+ PyMac_GetPoint, &startPt,
+ PyMac_GetRect, &boundsRect))
+ return NULL;
+ DragAlignedWindow(wp,
+ startPt,
+ &boundsRect,
+ (Rect *)0,
+ (ICMAlignmentProcRecordPtr)0);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_MoviesTask(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long maxMilliSecToUse;
+#ifndef MoviesTask
+ PyMac_PRECHECK(MoviesTask);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &maxMilliSecToUse))
+ return NULL;
+ MoviesTask((Movie)0,
+ maxMilliSecToUse);
+ Py_INCREF(Py_None);
+ _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,
+ PyDoc_STR("() -> None")},
+ {"GetMoviesError", (PyCFunction)Qt_GetMoviesError, 1,
+ PyDoc_STR("() -> None")},
+ {"ClearMoviesStickyError", (PyCFunction)Qt_ClearMoviesStickyError, 1,
+ PyDoc_STR("() -> None")},
+ {"GetMoviesStickyError", (PyCFunction)Qt_GetMoviesStickyError, 1,
+ PyDoc_STR("() -> None")},
+ {"QTGetWallClockTimeBase", (PyCFunction)Qt_QTGetWallClockTimeBase, 1,
+ PyDoc_STR("() -> (TimeBase wallClockTimeBase)")},
+ {"QTIdleManagerOpen", (PyCFunction)Qt_QTIdleManagerOpen, 1,
+ PyDoc_STR("() -> (IdleManager _rv)")},
+ {"CreateMovieControl", (PyCFunction)Qt_CreateMovieControl, 1,
+ PyDoc_STR("(WindowPtr theWindow, Movie theMovie, UInt32 options) -> (Rect localRect, ControlHandle returnedControl)")},
+ {"DisposeMatte", (PyCFunction)Qt_DisposeMatte, 1,
+ PyDoc_STR("(PixMapHandle theMatte) -> None")},
+ {"NewMovie", (PyCFunction)Qt_NewMovie, 1,
+ PyDoc_STR("(long flags) -> (Movie _rv)")},
+ {"QTGetTimeUntilNextTask", (PyCFunction)Qt_QTGetTimeUntilNextTask, 1,
+ PyDoc_STR("(long scale) -> (long duration)")},
+ {"GetDataHandler", (PyCFunction)Qt_GetDataHandler, 1,
+ PyDoc_STR("(Handle dataRef, OSType dataHandlerSubType, long flags) -> (Component _rv)")},
+ {"PasteHandleIntoMovie", (PyCFunction)Qt_PasteHandleIntoMovie, 1,
+ PyDoc_STR("(Handle h, OSType handleType, Movie theMovie, long flags, ComponentInstance userComp) -> None")},
+ {"GetMovieImporterForDataRef", (PyCFunction)Qt_GetMovieImporterForDataRef, 1,
+ PyDoc_STR("(OSType dataRefType, Handle dataRef, long flags) -> (Component importer)")},
+ {"QTGetMIMETypeInfo", (PyCFunction)Qt_QTGetMIMETypeInfo, 1,
+ PyDoc_STR("(char* mimeStringStart, short mimeStringLength, OSType infoSelector, void * infoDataPtr) -> (long infoDataSize)")},
+ {"TrackTimeToMediaTime", (PyCFunction)Qt_TrackTimeToMediaTime, 1,
+ PyDoc_STR("(TimeValue value, Track theTrack) -> (TimeValue _rv)")},
+ {"NewUserData", (PyCFunction)Qt_NewUserData, 1,
+ PyDoc_STR("() -> (UserData theUserData)")},
+ {"NewUserDataFromHandle", (PyCFunction)Qt_NewUserDataFromHandle, 1,
+ PyDoc_STR("(Handle h) -> (UserData theUserData)")},
+ {"CreateMovieFile", (PyCFunction)Qt_CreateMovieFile, 1,
+ PyDoc_STR("(FSSpec fileSpec, OSType creator, ScriptCode scriptTag, long createMovieFileFlags) -> (short resRefNum, Movie newmovie)")},
+ {"OpenMovieFile", (PyCFunction)Qt_OpenMovieFile, 1,
+ PyDoc_STR("(FSSpec fileSpec, SInt8 permission) -> (short resRefNum)")},
+ {"CloseMovieFile", (PyCFunction)Qt_CloseMovieFile, 1,
+ PyDoc_STR("(short resRefNum) -> None")},
+ {"DeleteMovieFile", (PyCFunction)Qt_DeleteMovieFile, 1,
+ PyDoc_STR("(FSSpec fileSpec) -> None")},
+ {"NewMovieFromFile", (PyCFunction)Qt_NewMovieFromFile, 1,
+ PyDoc_STR("(short resRefNum, short resId, short newMovieFlags) -> (Movie theMovie, short resId, Boolean dataRefWasChanged)")},
+ {"NewMovieFromHandle", (PyCFunction)Qt_NewMovieFromHandle, 1,
+ PyDoc_STR("(Handle h, short newMovieFlags) -> (Movie theMovie, Boolean dataRefWasChanged)")},
+ {"NewMovieFromDataFork", (PyCFunction)Qt_NewMovieFromDataFork, 1,
+ PyDoc_STR("(short fRefNum, long fileOffset, short newMovieFlags) -> (Movie theMovie, Boolean dataRefWasChanged)")},
+ {"NewMovieFromDataFork64", (PyCFunction)Qt_NewMovieFromDataFork64, 1,
+ PyDoc_STR("(long fRefNum, wide fileOffset, short newMovieFlags) -> (Movie theMovie, Boolean dataRefWasChanged)")},
+ {"NewMovieFromDataRef", (PyCFunction)Qt_NewMovieFromDataRef, 1,
+ PyDoc_STR("(short flags, Handle dataRef, OSType dtaRefType) -> (Movie m, short id)")},
+ {"NewMovieFromStorageOffset", (PyCFunction)Qt_NewMovieFromStorageOffset, 1,
+ PyDoc_STR("(DataHandler dh, wide fileOffset, short newMovieFlags) -> (Movie theMovie, Boolean dataRefWasCataRefType)")},
+ {"NewMovieForDataRefFromHandle", (PyCFunction)Qt_NewMovieForDataRefFromHandle, 1,
+ PyDoc_STR("(Handle h, short newMovieFlags, Handle dataRef, OSType dataRefType) -> (Movie theMovie, Boolean dataRefWasChanged)")},
+ {"RemoveMovieResource", (PyCFunction)Qt_RemoveMovieResource, 1,
+ PyDoc_STR("(short resRefNum, short resId) -> None")},
+ {"CreateMovieStorage", (PyCFunction)Qt_CreateMovieStorage, 1,
+ PyDoc_STR("(Handle dataRef, OSType dataRefType, OSType creator, ScriptCode scriptTag, long createMovieFileFlags) -> (DataHandler outDataHandler, Movie newmovie)")},
+ {"OpenMovieStorage", (PyCFunction)Qt_OpenMovieStorage, 1,
+ PyDoc_STR("(Handle dataRef, OSType dataRefType, long flags) -> (DataHandler outDataHandler)")},
+ {"CloseMovieStorage", (PyCFunction)Qt_CloseMovieStorage, 1,
+ PyDoc_STR("(DataHandler dh) -> None")},
+ {"DeleteMovieStorage", (PyCFunction)Qt_DeleteMovieStorage, 1,
+ PyDoc_STR("(Handle dataRef, OSType dataRefType) -> None")},
+ {"CreateShortcutMovieFile", (PyCFunction)Qt_CreateShortcutMovieFile, 1,
+ PyDoc_STR("(FSSpec fileSpec, OSType creator, ScriptCode scriptTag, long createMovieFileFlags, Handle targetDataRef, OSType targetDataRefType) -> None")},
+ {"CanQuickTimeOpenFile", (PyCFunction)Qt_CanQuickTimeOpenFile, 1,
+ PyDoc_STR("(FSSpec fileSpec, OSType fileType, OSType fileNameExtension, UInt32 inFlags) -> (Boolean outCanOpenWithGraphicsImporter, Boolean outCanOpenAsMovie, Boolean outPreferGraphicsImporter)")},
+ {"CanQuickTimeOpenDataRef", (PyCFunction)Qt_CanQuickTimeOpenDataRef, 1,
+ PyDoc_STR("(Handle dataRef, OSType dataRefType, UInt32 inFlags) -> (Boolean outCanOpenWithGraphicsImporter, Boolean outCanOpenAsMovie, Boolean outPreferGraphicsImporter)")},
+ {"NewMovieFromScrap", (PyCFunction)Qt_NewMovieFromScrap, 1,
+ PyDoc_STR("(long newMovieFlags) -> (Movie _rv)")},
+ {"QTNewAlias", (PyCFunction)Qt_QTNewAlias, 1,
+ PyDoc_STR("(FSSpec fss, Boolean minimal) -> (AliasHandle alias)")},
+ {"EndFullScreen", (PyCFunction)Qt_EndFullScreen, 1,
+ PyDoc_STR("(Ptr fullState, long flags) -> None")},
+ {"AddSoundDescriptionExtension", (PyCFunction)Qt_AddSoundDescriptionExtension, 1,
+ PyDoc_STR("(SoundDescriptionHandle desc, Handle extension, OSType idType) -> None")},
+ {"GetSoundDescriptionExtension", (PyCFunction)Qt_GetSoundDescriptionExtension, 1,
+ PyDoc_STR("(SoundDescriptionHandle desc, OSType idType) -> (Handle extension)")},
+ {"RemoveSoundDescriptionExtension", (PyCFunction)Qt_RemoveSoundDescriptionExtension, 1,
+ PyDoc_STR("(SoundDescriptionHandle desc, OSType idType) -> None")},
+ {"QTIsStandardParameterDialogEvent", (PyCFunction)Qt_QTIsStandardParameterDialogEvent, 1,
+ PyDoc_STR("(QTParameterDialog createdDialog) -> (EventRecord pEvent)")},
+ {"QTDismissStandardParameterDialog", (PyCFunction)Qt_QTDismissStandardParameterDialog, 1,
+ PyDoc_STR("(QTParameterDialog createdDialog) -> None")},
+ {"QTStandardParameterDialogDoAction", (PyCFunction)Qt_QTStandardParameterDialogDoAction, 1,
+ PyDoc_STR("(QTParameterDialog createdDialog, long action, void * params) -> None")},
+ {"QTRegisterAccessKey", (PyCFunction)Qt_QTRegisterAccessKey, 1,
+ PyDoc_STR("(Str255 accessKeyType, long flags, Handle accessKey) -> None")},
+ {"QTUnregisterAccessKey", (PyCFunction)Qt_QTUnregisterAccessKey, 1,
+ PyDoc_STR("(Str255 accessKeyType, long flags, Handle accessKey) -> None")},
+ {"QTGetSupportedRestrictions", (PyCFunction)Qt_QTGetSupportedRestrictions, 1,
+ PyDoc_STR("(OSType inRestrictionClass) -> (UInt32 outRestrictionIDs)")},
+ {"QTTextToNativeText", (PyCFunction)Qt_QTTextToNativeText, 1,
+ PyDoc_STR("(Handle theText, long encoding, long flags) -> None")},
+ {"VideoMediaResetStatistics", (PyCFunction)Qt_VideoMediaResetStatistics, 1,
+ PyDoc_STR("(MediaHandler mh) -> (ComponentResult _rv)")},
+ {"VideoMediaGetStatistics", (PyCFunction)Qt_VideoMediaGetStatistics, 1,
+ PyDoc_STR("(MediaHandler mh) -> (ComponentResult _rv)")},
+ {"VideoMediaGetStallCount", (PyCFunction)Qt_VideoMediaGetStallCount, 1,
+ PyDoc_STR("(MediaHandler mh) -> (ComponentResult _rv, unsigned long stalls)")},
+ {"VideoMediaSetCodecParameter", (PyCFunction)Qt_VideoMediaSetCodecParameter, 1,
+ PyDoc_STR("(MediaHandler mh, CodecType cType, OSType parameterID, long parameterChangeSeed, void * dataPtr, long dataSize) -> (ComponentResult _rv)")},
+ {"VideoMediaGetCodecParameter", (PyCFunction)Qt_VideoMediaGetCodecParameter, 1,
+ PyDoc_STR("(MediaHandler mh, CodecType cType, OSType parameterID, Handle outParameterData) -> (ComponentResult _rv)")},
+ {"TextMediaAddTextSample", (PyCFunction)Qt_TextMediaAddTextSample, 1,
+ PyDoc_STR("(MediaHandler mh, Ptr text, unsigned long size, short fontNumber, short fontSize, Style textFace, short textJustification, long displayFlags, TimeValue scrollDelay, short hiliteStart, short hiliteEnd, TimeValue duration) -> (ComponentResult _rv, RGBColor textColor, RGBColor backColor, Rect textBox, RGBColor rgbHiliteColor, TimeValue sampleTime)")},
+ {"TextMediaAddTESample", (PyCFunction)Qt_TextMediaAddTESample, 1,
+ PyDoc_STR("(MediaHandler mh, TEHandle hTE, short textJustification, long displayFlags, TimeValue scrollDelay, short hiliteStart, short hiliteEnd, TimeValue duration) -> (ComponentResult _rv, RGBColor backColor, Rect textBox, RGBColor rgbHiliteColor, TimeValue sampleTime)")},
+ {"TextMediaAddHiliteSample", (PyCFunction)Qt_TextMediaAddHiliteSample, 1,
+ PyDoc_STR("(MediaHandler mh, short hiliteStart, short hiliteEnd, TimeValue duration) -> (ComponentResult _rv, RGBColor rgbHiliteColor, TimeValue sampleTime)")},
+ {"TextMediaDrawRaw", (PyCFunction)Qt_TextMediaDrawRaw, 1,
+ PyDoc_STR("(MediaHandler mh, GWorldPtr gw, GDHandle gd, void * data, long dataSize, TextDescriptionHandle tdh) -> (ComponentResult _rv)")},
+ {"TextMediaSetTextProperty", (PyCFunction)Qt_TextMediaSetTextProperty, 1,
+ PyDoc_STR("(MediaHandler mh, TimeValue atMediaTime, long propertyType, void * data, long dataSize) -> (ComponentResult _rv)")},
+ {"TextMediaRawSetup", (PyCFunction)Qt_TextMediaRawSetup, 1,
+ PyDoc_STR("(MediaHandler mh, GWorldPtr gw, GDHandle gd, void * data, long dataSize, TextDescriptionHandle tdh, TimeValue sampleDuration) -> (ComponentResult _rv)")},
+ {"TextMediaRawIdle", (PyCFunction)Qt_TextMediaRawIdle, 1,
+ PyDoc_STR("(MediaHandler mh, GWorldPtr gw, GDHandle gd, TimeValue sampleTime, long flagsIn) -> (ComponentResult _rv, long flagsOut)")},
+ {"TextMediaGetTextProperty", (PyCFunction)Qt_TextMediaGetTextProperty, 1,
+ PyDoc_STR("(MediaHandler mh, TimeValue atMediaTime, long propertyType, void * data, long dataSize) -> (ComponentResult _rv)")},
+ {"TextMediaFindNextText", (PyCFunction)Qt_TextMediaFindNextText, 1,
+ PyDoc_STR("(MediaHandler mh, Ptr text, long size, short findFlags, TimeValue startTime) -> (ComponentResult _rv, TimeValue foundTime, TimeValue foundDuration, long offset)")},
+ {"TextMediaHiliteTextSample", (PyCFunction)Qt_TextMediaHiliteTextSample, 1,
+ PyDoc_STR("(MediaHandler mh, TimeValue sampleTime, short hiliteStart, short hiliteEnd) -> (ComponentResult _rv, RGBColor rgbHiliteColor)")},
+ {"TextMediaSetTextSampleData", (PyCFunction)Qt_TextMediaSetTextSampleData, 1,
+ PyDoc_STR("(MediaHandler mh, void * data, OSType dataType) -> (ComponentResult _rv)")},
+ {"SpriteMediaSetProperty", (PyCFunction)Qt_SpriteMediaSetProperty, 1,
+ PyDoc_STR("(MediaHandler mh, short spriteIndex, long propertyType, void * propertyValue) -> (ComponentResult _rv)")},
+ {"SpriteMediaGetProperty", (PyCFunction)Qt_SpriteMediaGetProperty, 1,
+ PyDoc_STR("(MediaHandler mh, short spriteIndex, long propertyType, void * propertyValue) -> (ComponentResult _rv)")},
+ {"SpriteMediaHitTestSprites", (PyCFunction)Qt_SpriteMediaHitTestSprites, 1,
+ PyDoc_STR("(MediaHandler mh, long flags, Point loc) -> (ComponentResult _rv, short spriteHitIndex)")},
+ {"SpriteMediaCountSprites", (PyCFunction)Qt_SpriteMediaCountSprites, 1,
+ PyDoc_STR("(MediaHandler mh) -> (ComponentResult _rv, short numSprites)")},
+ {"SpriteMediaCountImages", (PyCFunction)Qt_SpriteMediaCountImages, 1,
+ PyDoc_STR("(MediaHandler mh) -> (ComponentResult _rv, short numImages)")},
+ {"SpriteMediaGetIndImageDescription", (PyCFunction)Qt_SpriteMediaGetIndImageDescription, 1,
+ PyDoc_STR("(MediaHandler mh, short imageIndex, ImageDescriptionHandle imageDescription) -> (ComponentResult _rv)")},
+ {"SpriteMediaGetDisplayedSampleNumber", (PyCFunction)Qt_SpriteMediaGetDisplayedSampleNumber, 1,
+ PyDoc_STR("(MediaHandler mh) -> (ComponentResult _rv, long sampleNum)")},
+ {"SpriteMediaGetSpriteName", (PyCFunction)Qt_SpriteMediaGetSpriteName, 1,
+ PyDoc_STR("(MediaHandler mh, QTAtomID spriteID, Str255 spriteName) -> (ComponentResult _rv)")},
+ {"SpriteMediaGetImageName", (PyCFunction)Qt_SpriteMediaGetImageName, 1,
+ PyDoc_STR("(MediaHandler mh, short imageIndex, Str255 imageName) -> (ComponentResult _rv)")},
+ {"SpriteMediaSetSpriteProperty", (PyCFunction)Qt_SpriteMediaSetSpriteProperty, 1,
+ PyDoc_STR("(MediaHandler mh, QTAtomID spriteID, long propertyType, void * propertyValue) -> (ComponentResult _rv)")},
+ {"SpriteMediaGetSpriteProperty", (PyCFunction)Qt_SpriteMediaGetSpriteProperty, 1,
+ PyDoc_STR("(MediaHandler mh, QTAtomID spriteID, long propertyType, void * propertyValue) -> (ComponentResult _rv)")},
+ {"SpriteMediaHitTestAllSprites", (PyCFunction)Qt_SpriteMediaHitTestAllSprites, 1,
+ PyDoc_STR("(MediaHandler mh, long flags, Point loc) -> (ComponentResult _rv, QTAtomID spriteHitID)")},
+ {"SpriteMediaHitTestOneSprite", (PyCFunction)Qt_SpriteMediaHitTestOneSprite, 1,
+ PyDoc_STR("(MediaHandler mh, QTAtomID spriteID, long flags, Point loc) -> (ComponentResult _rv, Boolean wasHit)")},
+ {"SpriteMediaSpriteIndexToID", (PyCFunction)Qt_SpriteMediaSpriteIndexToID, 1,
+ PyDoc_STR("(MediaHandler mh, short spriteIndex) -> (ComponentResult _rv, QTAtomID spriteID)")},
+ {"SpriteMediaSpriteIDToIndex", (PyCFunction)Qt_SpriteMediaSpriteIDToIndex, 1,
+ PyDoc_STR("(MediaHandler mh, QTAtomID spriteID) -> (ComponentResult _rv, short spriteIndex)")},
+ {"SpriteMediaSetActionVariable", (PyCFunction)Qt_SpriteMediaSetActionVariable, 1,
+ PyDoc_STR("(MediaHandler mh, QTAtomID variableID, float value) -> (ComponentResult _rv)")},
+ {"SpriteMediaGetActionVariable", (PyCFunction)Qt_SpriteMediaGetActionVariable, 1,
+ PyDoc_STR("(MediaHandler mh, QTAtomID variableID) -> (ComponentResult _rv, float value)")},
+ {"SpriteMediaDisposeSprite", (PyCFunction)Qt_SpriteMediaDisposeSprite, 1,
+ PyDoc_STR("(MediaHandler mh, QTAtomID spriteID) -> (ComponentResult _rv)")},
+ {"SpriteMediaSetActionVariableToString", (PyCFunction)Qt_SpriteMediaSetActionVariableToString, 1,
+ PyDoc_STR("(MediaHandler mh, QTAtomID variableID, Ptr theCString) -> (ComponentResult _rv)")},
+ {"SpriteMediaGetActionVariableAsString", (PyCFunction)Qt_SpriteMediaGetActionVariableAsString, 1,
+ PyDoc_STR("(MediaHandler mh, QTAtomID variableID) -> (ComponentResult _rv, Handle theCString)")},
+ {"SpriteMediaNewImage", (PyCFunction)Qt_SpriteMediaNewImage, 1,
+ PyDoc_STR("(MediaHandler mh, Handle dataRef, OSType dataRefType, QTAtomID desiredID) -> (ComponentResult _rv)")},
+ {"SpriteMediaDisposeImage", (PyCFunction)Qt_SpriteMediaDisposeImage, 1,
+ PyDoc_STR("(MediaHandler mh, short imageIndex) -> (ComponentResult _rv)")},
+ {"SpriteMediaImageIndexToID", (PyCFunction)Qt_SpriteMediaImageIndexToID, 1,
+ PyDoc_STR("(MediaHandler mh, short imageIndex) -> (ComponentResult _rv, QTAtomID imageID)")},
+ {"SpriteMediaImageIDToIndex", (PyCFunction)Qt_SpriteMediaImageIDToIndex, 1,
+ PyDoc_STR("(MediaHandler mh, QTAtomID imageID) -> (ComponentResult _rv, short imageIndex)")},
+ {"FlashMediaSetPan", (PyCFunction)Qt_FlashMediaSetPan, 1,
+ PyDoc_STR("(MediaHandler mh, short xPercent, short yPercent) -> (ComponentResult _rv)")},
+ {"FlashMediaSetZoom", (PyCFunction)Qt_FlashMediaSetZoom, 1,
+ PyDoc_STR("(MediaHandler mh, short factor) -> (ComponentResult _rv)")},
+ {"FlashMediaSetZoomRect", (PyCFunction)Qt_FlashMediaSetZoomRect, 1,
+ PyDoc_STR("(MediaHandler mh, long left, long top, long right, long bottom) -> (ComponentResult _rv)")},
+ {"FlashMediaGetRefConBounds", (PyCFunction)Qt_FlashMediaGetRefConBounds, 1,
+ PyDoc_STR("(MediaHandler mh, long refCon) -> (ComponentResult _rv, long left, long top, long right, long bottom)")},
+ {"FlashMediaGetRefConID", (PyCFunction)Qt_FlashMediaGetRefConID, 1,
+ PyDoc_STR("(MediaHandler mh, long refCon) -> (ComponentResult _rv, long refConID)")},
+ {"FlashMediaIDToRefCon", (PyCFunction)Qt_FlashMediaIDToRefCon, 1,
+ PyDoc_STR("(MediaHandler mh, long refConID) -> (ComponentResult _rv, long refCon)")},
+ {"FlashMediaGetDisplayedFrameNumber", (PyCFunction)Qt_FlashMediaGetDisplayedFrameNumber, 1,
+ PyDoc_STR("(MediaHandler mh) -> (ComponentResult _rv, long flashFrameNumber)")},
+ {"FlashMediaFrameNumberToMovieTime", (PyCFunction)Qt_FlashMediaFrameNumberToMovieTime, 1,
+ PyDoc_STR("(MediaHandler mh, long flashFrameNumber) -> (ComponentResult _rv, TimeValue movieTime)")},
+ {"FlashMediaFrameLabelToMovieTime", (PyCFunction)Qt_FlashMediaFrameLabelToMovieTime, 1,
+ PyDoc_STR("(MediaHandler mh, Ptr theLabel) -> (ComponentResult _rv, TimeValue movieTime)")},
+ {"FlashMediaGetFlashVariable", (PyCFunction)Qt_FlashMediaGetFlashVariable, 1,
+ PyDoc_STR("(MediaHandler mh) -> (ComponentResult _rv, char path, char name, Handle theVariableCStringOut)")},
+ {"FlashMediaSetFlashVariable", (PyCFunction)Qt_FlashMediaSetFlashVariable, 1,
+ PyDoc_STR("(MediaHandler mh, Boolean updateFocus) -> (ComponentResult _rv, char path, char name, char value)")},
+ {"FlashMediaDoButtonActions", (PyCFunction)Qt_FlashMediaDoButtonActions, 1,
+ PyDoc_STR("(MediaHandler mh, long buttonID, long transition) -> (ComponentResult _rv, char path)")},
+ {"FlashMediaGetSupportedSwfVersion", (PyCFunction)Qt_FlashMediaGetSupportedSwfVersion, 1,
+ PyDoc_STR("(MediaHandler mh) -> (ComponentResult _rv, UInt8 swfVersion)")},
+ {"Media3DGetCurrentGroup", (PyCFunction)Qt_Media3DGetCurrentGroup, 1,
+ PyDoc_STR("(MediaHandler mh, void * group) -> (ComponentResult _rv)")},
+ {"Media3DTranslateNamedObjectTo", (PyCFunction)Qt_Media3DTranslateNamedObjectTo, 1,
+ PyDoc_STR("(MediaHandler mh, Fixed x, Fixed y, Fixed z) -> (ComponentResult _rv, char objectName)")},
+ {"Media3DScaleNamedObjectTo", (PyCFunction)Qt_Media3DScaleNamedObjectTo, 1,
+ PyDoc_STR("(MediaHandler mh, Fixed xScale, Fixed yScale, Fixed zScale) -> (ComponentResult _rv, char objectName)")},
+ {"Media3DRotateNamedObjectTo", (PyCFunction)Qt_Media3DRotateNamedObjectTo, 1,
+ PyDoc_STR("(MediaHandler mh, Fixed xDegrees, Fixed yDegrees, Fixed zDegrees) -> (ComponentResult _rv, char objectName)")},
+ {"Media3DSetCameraData", (PyCFunction)Qt_Media3DSetCameraData, 1,
+ PyDoc_STR("(MediaHandler mh, void * cameraData) -> (ComponentResult _rv)")},
+ {"Media3DGetCameraData", (PyCFunction)Qt_Media3DGetCameraData, 1,
+ PyDoc_STR("(MediaHandler mh, void * cameraData) -> (ComponentResult _rv)")},
+ {"Media3DSetCameraAngleAspect", (PyCFunction)Qt_Media3DSetCameraAngleAspect, 1,
+ PyDoc_STR("(MediaHandler mh, QTFloatSingle fov, QTFloatSingle aspectRatioXToY) -> (ComponentResult _rv)")},
+ {"Media3DGetCameraAngleAspect", (PyCFunction)Qt_Media3DGetCameraAngleAspect, 1,
+ PyDoc_STR("(MediaHandler mh) -> (ComponentResult _rv, QTFloatSingle fov, QTFloatSingle aspectRatioXToY)")},
+ {"Media3DSetCameraRange", (PyCFunction)Qt_Media3DSetCameraRange, 1,
+ PyDoc_STR("(MediaHandler mh, void * tQ3CameraRange) -> (ComponentResult _rv)")},
+ {"Media3DGetCameraRange", (PyCFunction)Qt_Media3DGetCameraRange, 1,
+ PyDoc_STR("(MediaHandler mh, void * tQ3CameraRange) -> (ComponentResult _rv)")},
+ {"NewTimeBase", (PyCFunction)Qt_NewTimeBase, 1,
+ PyDoc_STR("() -> (TimeBase _rv)")},
+ {"ConvertTime", (PyCFunction)Qt_ConvertTime, 1,
+ PyDoc_STR("(TimeRecord theTime, TimeBase newBase) -> (TimeRecord theTime)")},
+ {"ConvertTimeScale", (PyCFunction)Qt_ConvertTimeScale, 1,
+ PyDoc_STR("(TimeRecord theTime, TimeScale newScale) -> (TimeRecord theTime)")},
+ {"AddTime", (PyCFunction)Qt_AddTime, 1,
+ PyDoc_STR("(TimeRecord dst, TimeRecord src) -> (TimeRecord dst)")},
+ {"SubtractTime", (PyCFunction)Qt_SubtractTime, 1,
+ PyDoc_STR("(TimeRecord dst, TimeRecord src) -> (TimeRecord dst)")},
+ {"MusicMediaGetIndexedTunePlayer", (PyCFunction)Qt_MusicMediaGetIndexedTunePlayer, 1,
+ PyDoc_STR("(ComponentInstance ti, long sampleDescIndex) -> (ComponentResult _rv, ComponentInstance tp)")},
+ {"CodecManagerVersion", (PyCFunction)Qt_CodecManagerVersion, 1,
+ PyDoc_STR("() -> (long version)")},
+ {"GetMaxCompressionSize", (PyCFunction)Qt_GetMaxCompressionSize, 1,
+ PyDoc_STR("(PixMapHandle src, Rect srcRect, short colorDepth, CodecQ quality, CodecType cType, CompressorComponent codec) -> (long size)")},
+ {"GetCompressionTime", (PyCFunction)Qt_GetCompressionTime, 1,
+ PyDoc_STR("(PixMapHandle src, Rect srcRect, short colorDepth, CodecType cType, CompressorComponent codec) -> (CodecQ spatialQuality, CodecQ temporalQuality, unsigned long compressTime)")},
+ {"CompressImage", (PyCFunction)Qt_CompressImage, 1,
+ PyDoc_STR("(PixMapHandle src, Rect srcRect, CodecQ quality, CodecType cType, ImageDescriptionHandle desc, Ptr data) -> None")},
+ {"DecompressImage", (PyCFunction)Qt_DecompressImage, 1,
+ PyDoc_STR("(Ptr data, ImageDescriptionHandle desc, PixMapHandle dst, Rect srcRect, Rect dstRect, short mode, RgnHandle mask) -> None")},
+ {"GetSimilarity", (PyCFunction)Qt_GetSimilarity, 1,
+ PyDoc_STR("(PixMapHandle src, Rect srcRect, ImageDescriptionHandle desc, Ptr data) -> (Fixed similarity)")},
+ {"GetImageDescriptionCTable", (PyCFunction)Qt_GetImageDescriptionCTable, 1,
+ PyDoc_STR("(ImageDescriptionHandle desc) -> (CTabHandle ctable)")},
+ {"SetImageDescriptionCTable", (PyCFunction)Qt_SetImageDescriptionCTable, 1,
+ PyDoc_STR("(ImageDescriptionHandle desc, CTabHandle ctable) -> None")},
+ {"GetImageDescriptionExtension", (PyCFunction)Qt_GetImageDescriptionExtension, 1,
+ PyDoc_STR("(ImageDescriptionHandle desc, long idType, long index) -> (Handle extension)")},
+ {"AddImageDescriptionExtension", (PyCFunction)Qt_AddImageDescriptionExtension, 1,
+ PyDoc_STR("(ImageDescriptionHandle desc, Handle extension, long idType) -> None")},
+ {"RemoveImageDescriptionExtension", (PyCFunction)Qt_RemoveImageDescriptionExtension, 1,
+ PyDoc_STR("(ImageDescriptionHandle desc, long idType, long index) -> None")},
+ {"CountImageDescriptionExtensionType", (PyCFunction)Qt_CountImageDescriptionExtensionType, 1,
+ PyDoc_STR("(ImageDescriptionHandle desc, long idType) -> (long count)")},
+ {"GetNextImageDescriptionExtensionType", (PyCFunction)Qt_GetNextImageDescriptionExtensionType, 1,
+ PyDoc_STR("(ImageDescriptionHandle desc) -> (long idType)")},
+ {"FindCodec", (PyCFunction)Qt_FindCodec, 1,
+ PyDoc_STR("(CodecType cType, CodecComponent specCodec) -> (CompressorComponent compressor, DecompressorComponent decompressor)")},
+ {"CompressPicture", (PyCFunction)Qt_CompressPicture, 1,
+ PyDoc_STR("(PicHandle srcPicture, PicHandle dstPicture, CodecQ quality, CodecType cType) -> None")},
+ {"CompressPictureFile", (PyCFunction)Qt_CompressPictureFile, 1,
+ PyDoc_STR("(short srcRefNum, short dstRefNum, CodecQ quality, CodecType cType) -> None")},
+ {"ConvertImage", (PyCFunction)Qt_ConvertImage, 1,
+ PyDoc_STR("(ImageDescriptionHandle srcDD, Ptr srcData, short colorDepth, CTabHandle ctable, CodecQ accuracy, CodecQ quality, CodecType cType, CodecComponent codec, ImageDescriptionHandle dstDD, Ptr dstData) -> None")},
+ {"AddFilePreview", (PyCFunction)Qt_AddFilePreview, 1,
+ PyDoc_STR("(short resRefNum, OSType previewType, Handle previewData) -> None")},
+ {"GetBestDeviceRect", (PyCFunction)Qt_GetBestDeviceRect, 1,
+ PyDoc_STR("() -> (GDHandle gdh, Rect rp)")},
+ {"GDHasScale", (PyCFunction)Qt_GDHasScale, 1,
+ PyDoc_STR("(GDHandle gdh, short depth) -> (Fixed scale)")},
+ {"GDGetScale", (PyCFunction)Qt_GDGetScale, 1,
+ PyDoc_STR("(GDHandle gdh) -> (Fixed scale, short flags)")},
+ {"GDSetScale", (PyCFunction)Qt_GDSetScale, 1,
+ PyDoc_STR("(GDHandle gdh, Fixed scale, short flags) -> None")},
+ {"GetGraphicsImporterForFile", (PyCFunction)Qt_GetGraphicsImporterForFile, 1,
+ PyDoc_STR("(FSSpec theFile) -> (ComponentInstance gi)")},
+ {"GetGraphicsImporterForDataRef", (PyCFunction)Qt_GetGraphicsImporterForDataRef, 1,
+ PyDoc_STR("(Handle dataRef, OSType dataRefType) -> (ComponentInstance gi)")},
+ {"GetGraphicsImporterForFileWithFlags", (PyCFunction)Qt_GetGraphicsImporterForFileWithFlags, 1,
+ PyDoc_STR("(FSSpec theFile, long flags) -> (ComponentInstance gi)")},
+ {"GetGraphicsImporterForDataRefWithFlags", (PyCFunction)Qt_GetGraphicsImporterForDataRefWithFlags, 1,
+ PyDoc_STR("(Handle dataRef, OSType dataRefType, long flags) -> (ComponentInstance gi)")},
+ {"MakeImageDescriptionForPixMap", (PyCFunction)Qt_MakeImageDescriptionForPixMap, 1,
+ PyDoc_STR("(PixMapHandle pixmap) -> (ImageDescriptionHandle idh)")},
+ {"MakeImageDescriptionForEffect", (PyCFunction)Qt_MakeImageDescriptionForEffect, 1,
+ PyDoc_STR("(OSType effectType) -> (ImageDescriptionHandle idh)")},
+ {"QTGetPixelSize", (PyCFunction)Qt_QTGetPixelSize, 1,
+ PyDoc_STR("(OSType PixelFormat) -> (short _rv)")},
+ {"QTGetPixelFormatDepthForImageDescription", (PyCFunction)Qt_QTGetPixelFormatDepthForImageDescription, 1,
+ PyDoc_STR("(OSType PixelFormat) -> (short _rv)")},
+ {"QTGetPixMapHandleRowBytes", (PyCFunction)Qt_QTGetPixMapHandleRowBytes, 1,
+ PyDoc_STR("(PixMapHandle pm) -> (long _rv)")},
+ {"QTSetPixMapHandleRowBytes", (PyCFunction)Qt_QTSetPixMapHandleRowBytes, 1,
+ PyDoc_STR("(PixMapHandle pm, long rowBytes) -> None")},
+ {"QTGetPixMapHandleGammaLevel", (PyCFunction)Qt_QTGetPixMapHandleGammaLevel, 1,
+ PyDoc_STR("(PixMapHandle pm) -> (Fixed _rv)")},
+ {"QTSetPixMapHandleGammaLevel", (PyCFunction)Qt_QTSetPixMapHandleGammaLevel, 1,
+ PyDoc_STR("(PixMapHandle pm, Fixed gammaLevel) -> None")},
+ {"QTGetPixMapHandleRequestedGammaLevel", (PyCFunction)Qt_QTGetPixMapHandleRequestedGammaLevel, 1,
+ PyDoc_STR("(PixMapHandle pm) -> (Fixed _rv)")},
+ {"QTSetPixMapHandleRequestedGammaLevel", (PyCFunction)Qt_QTSetPixMapHandleRequestedGammaLevel, 1,
+ PyDoc_STR("(PixMapHandle pm, Fixed requestedGammaLevel) -> None")},
+ {"CompAdd", (PyCFunction)Qt_CompAdd, 1,
+ PyDoc_STR("() -> (wide src, wide dst)")},
+ {"CompSub", (PyCFunction)Qt_CompSub, 1,
+ PyDoc_STR("() -> (wide src, wide dst)")},
+ {"CompNeg", (PyCFunction)Qt_CompNeg, 1,
+ PyDoc_STR("() -> (wide dst)")},
+ {"CompShift", (PyCFunction)Qt_CompShift, 1,
+ PyDoc_STR("(short shift) -> (wide src)")},
+ {"CompMul", (PyCFunction)Qt_CompMul, 1,
+ PyDoc_STR("(long src1, long src2) -> (wide dst)")},
+ {"CompDiv", (PyCFunction)Qt_CompDiv, 1,
+ PyDoc_STR("(long denominator) -> (long _rv, wide numerator, long remainder)")},
+ {"CompFixMul", (PyCFunction)Qt_CompFixMul, 1,
+ PyDoc_STR("(Fixed fixSrc) -> (wide compSrc, wide compDst)")},
+ {"CompMulDiv", (PyCFunction)Qt_CompMulDiv, 1,
+ PyDoc_STR("(long mul, long divisor) -> (wide co)")},
+ {"CompMulDivTrunc", (PyCFunction)Qt_CompMulDivTrunc, 1,
+ PyDoc_STR("(long mul, long divisor) -> (wide co, long remainder)")},
+ {"CompCompare", (PyCFunction)Qt_CompCompare, 1,
+ PyDoc_STR("(wide a, wide minusb) -> (long _rv)")},
+ {"CompSquareRoot", (PyCFunction)Qt_CompSquareRoot, 1,
+ PyDoc_STR("(wide src) -> (unsigned long _rv)")},
+ {"FixMulDiv", (PyCFunction)Qt_FixMulDiv, 1,
+ PyDoc_STR("(Fixed src, Fixed mul, Fixed divisor) -> (Fixed _rv)")},
+ {"UnsignedFixMulDiv", (PyCFunction)Qt_UnsignedFixMulDiv, 1,
+ PyDoc_STR("(Fixed src, Fixed mul, Fixed divisor) -> (Fixed _rv)")},
+ {"FixExp2", (PyCFunction)Qt_FixExp2, 1,
+ PyDoc_STR("(Fixed src) -> (Fixed _rv)")},
+ {"FixLog2", (PyCFunction)Qt_FixLog2, 1,
+ PyDoc_STR("(Fixed src) -> (Fixed _rv)")},
+ {"FixPow", (PyCFunction)Qt_FixPow, 1,
+ PyDoc_STR("(Fixed base, Fixed exp) -> (Fixed _rv)")},
+ {"GraphicsImportSetDataReference", (PyCFunction)Qt_GraphicsImportSetDataReference, 1,
+ PyDoc_STR("(GraphicsImportComponent ci, Handle dataRef, OSType dataReType) -> (ComponentResult _rv)")},
+ {"GraphicsImportGetDataReference", (PyCFunction)Qt_GraphicsImportGetDataReference, 1,
+ PyDoc_STR("(GraphicsImportComponent ci) -> (ComponentResult _rv, Handle dataRef, OSType dataReType)")},
+ {"GraphicsImportSetDataFile", (PyCFunction)Qt_GraphicsImportSetDataFile, 1,
+ PyDoc_STR("(GraphicsImportComponent ci, FSSpec theFile) -> (ComponentResult _rv)")},
+ {"GraphicsImportGetDataFile", (PyCFunction)Qt_GraphicsImportGetDataFile, 1,
+ PyDoc_STR("(GraphicsImportComponent ci, FSSpec theFile) -> (ComponentResult _rv)")},
+ {"GraphicsImportSetDataHandle", (PyCFunction)Qt_GraphicsImportSetDataHandle, 1,
+ PyDoc_STR("(GraphicsImportComponent ci, Handle h) -> (ComponentResult _rv)")},
+ {"GraphicsImportGetDataHandle", (PyCFunction)Qt_GraphicsImportGetDataHandle, 1,
+ PyDoc_STR("(GraphicsImportComponent ci) -> (ComponentResult _rv, Handle h)")},
+ {"GraphicsImportGetImageDescription", (PyCFunction)Qt_GraphicsImportGetImageDescription, 1,
+ PyDoc_STR("(GraphicsImportComponent ci) -> (ComponentResult _rv, ImageDescriptionHandle desc)")},
+ {"GraphicsImportGetDataOffsetAndSize", (PyCFunction)Qt_GraphicsImportGetDataOffsetAndSize, 1,
+ PyDoc_STR("(GraphicsImportComponent ci) -> (ComponentResult _rv, unsigned long offset, unsigned long size)")},
+ {"GraphicsImportReadData", (PyCFunction)Qt_GraphicsImportReadData, 1,
+ PyDoc_STR("(GraphicsImportComponent ci, void * dataPtr, unsigned long dataOffset, unsigned long dataSize) -> (ComponentResult _rv)")},
+ {"GraphicsImportSetClip", (PyCFunction)Qt_GraphicsImportSetClip, 1,
+ PyDoc_STR("(GraphicsImportComponent ci, RgnHandle clipRgn) -> (ComponentResult _rv)")},
+ {"GraphicsImportGetClip", (PyCFunction)Qt_GraphicsImportGetClip, 1,
+ PyDoc_STR("(GraphicsImportComponent ci) -> (ComponentResult _rv, RgnHandle clipRgn)")},
+ {"GraphicsImportSetSourceRect", (PyCFunction)Qt_GraphicsImportSetSourceRect, 1,
+ PyDoc_STR("(GraphicsImportComponent ci, Rect sourceRect) -> (ComponentResult _rv)")},
+ {"GraphicsImportGetSourceRect", (PyCFunction)Qt_GraphicsImportGetSourceRect, 1,
+ PyDoc_STR("(GraphicsImportComponent ci) -> (ComponentResult _rv, Rect sourceRect)")},
+ {"GraphicsImportGetNaturalBounds", (PyCFunction)Qt_GraphicsImportGetNaturalBounds, 1,
+ PyDoc_STR("(GraphicsImportComponent ci) -> (ComponentResult _rv, Rect naturalBounds)")},
+ {"GraphicsImportDraw", (PyCFunction)Qt_GraphicsImportDraw, 1,
+ PyDoc_STR("(GraphicsImportComponent ci) -> (ComponentResult _rv)")},
+ {"GraphicsImportSetGWorld", (PyCFunction)Qt_GraphicsImportSetGWorld, 1,
+ PyDoc_STR("(GraphicsImportComponent ci, CGrafPtr port, GDHandle gd) -> (ComponentResult _rv)")},
+ {"GraphicsImportGetGWorld", (PyCFunction)Qt_GraphicsImportGetGWorld, 1,
+ PyDoc_STR("(GraphicsImportComponent ci) -> (ComponentResult _rv, CGrafPtr port, GDHandle gd)")},
+ {"GraphicsImportSetBoundsRect", (PyCFunction)Qt_GraphicsImportSetBoundsRect, 1,
+ PyDoc_STR("(GraphicsImportComponent ci, Rect bounds) -> (ComponentResult _rv)")},
+ {"GraphicsImportGetBoundsRect", (PyCFunction)Qt_GraphicsImportGetBoundsRect, 1,
+ PyDoc_STR("(GraphicsImportComponent ci) -> (ComponentResult _rv, Rect bounds)")},
+ {"GraphicsImportSaveAsPicture", (PyCFunction)Qt_GraphicsImportSaveAsPicture, 1,
+ PyDoc_STR("(GraphicsImportComponent ci, FSSpec fss, ScriptCode scriptTag) -> (ComponentResult _rv)")},
+ {"GraphicsImportSetGraphicsMode", (PyCFunction)Qt_GraphicsImportSetGraphicsMode, 1,
+ PyDoc_STR("(GraphicsImportComponent ci, long graphicsMode, RGBColor opColor) -> (ComponentResult _rv)")},
+ {"GraphicsImportGetGraphicsMode", (PyCFunction)Qt_GraphicsImportGetGraphicsMode, 1,
+ PyDoc_STR("(GraphicsImportComponent ci) -> (ComponentResult _rv, long graphicsMode, RGBColor opColor)")},
+ {"GraphicsImportSetQuality", (PyCFunction)Qt_GraphicsImportSetQuality, 1,
+ PyDoc_STR("(GraphicsImportComponent ci, CodecQ quality) -> (ComponentResult _rv)")},
+ {"GraphicsImportGetQuality", (PyCFunction)Qt_GraphicsImportGetQuality, 1,
+ PyDoc_STR("(GraphicsImportComponent ci) -> (ComponentResult _rv, CodecQ quality)")},
+ {"GraphicsImportSaveAsQuickTimeImageFile", (PyCFunction)Qt_GraphicsImportSaveAsQuickTimeImageFile, 1,
+ PyDoc_STR("(GraphicsImportComponent ci, FSSpec fss, ScriptCode scriptTag) -> (ComponentResult _rv)")},
+ {"GraphicsImportSetDataReferenceOffsetAndLimit", (PyCFunction)Qt_GraphicsImportSetDataReferenceOffsetAndLimit, 1,
+ PyDoc_STR("(GraphicsImportComponent ci, unsigned long offset, unsigned long limit) -> (ComponentResult _rv)")},
+ {"GraphicsImportGetDataReferenceOffsetAndLimit", (PyCFunction)Qt_GraphicsImportGetDataReferenceOffsetAndLimit, 1,
+ PyDoc_STR("(GraphicsImportComponent ci) -> (ComponentResult _rv, unsigned long offset, unsigned long limit)")},
+ {"GraphicsImportGetAliasedDataReference", (PyCFunction)Qt_GraphicsImportGetAliasedDataReference, 1,
+ PyDoc_STR("(GraphicsImportComponent ci) -> (ComponentResult _rv, Handle dataRef, OSType dataRefType)")},
+ {"GraphicsImportValidate", (PyCFunction)Qt_GraphicsImportValidate, 1,
+ PyDoc_STR("(GraphicsImportComponent ci) -> (ComponentResult _rv, Boolean valid)")},
+ {"GraphicsImportGetMetaData", (PyCFunction)Qt_GraphicsImportGetMetaData, 1,
+ PyDoc_STR("(GraphicsImportComponent ci, void * userData) -> (ComponentResult _rv)")},
+ {"GraphicsImportGetMIMETypeList", (PyCFunction)Qt_GraphicsImportGetMIMETypeList, 1,
+ PyDoc_STR("(GraphicsImportComponent ci, void * qtAtomContainerPtr) -> (ComponentResult _rv)")},
+ {"GraphicsImportDoesDrawAllPixels", (PyCFunction)Qt_GraphicsImportDoesDrawAllPixels, 1,
+ PyDoc_STR("(GraphicsImportComponent ci) -> (ComponentResult _rv, short drawsAllPixels)")},
+ {"GraphicsImportGetAsPicture", (PyCFunction)Qt_GraphicsImportGetAsPicture, 1,
+ PyDoc_STR("(GraphicsImportComponent ci) -> (ComponentResult _rv, PicHandle picture)")},
+ {"GraphicsImportExportImageFile", (PyCFunction)Qt_GraphicsImportExportImageFile, 1,
+ PyDoc_STR("(GraphicsImportComponent ci, OSType fileType, OSType fileCreator, FSSpec fss, ScriptCode scriptTag) -> (ComponentResult _rv)")},
+ {"GraphicsImportGetExportImageTypeList", (PyCFunction)Qt_GraphicsImportGetExportImageTypeList, 1,
+ PyDoc_STR("(GraphicsImportComponent ci, void * qtAtomContainerPtr) -> (ComponentResult _rv)")},
+ {"GraphicsImportGetExportSettingsAsAtomContainer", (PyCFunction)Qt_GraphicsImportGetExportSettingsAsAtomContainer, 1,
+ PyDoc_STR("(GraphicsImportComponent ci, void * qtAtomContainerPtr) -> (ComponentResult _rv)")},
+ {"GraphicsImportSetExportSettingsFromAtomContainer", (PyCFunction)Qt_GraphicsImportSetExportSettingsFromAtomContainer, 1,
+ PyDoc_STR("(GraphicsImportComponent ci, void * qtAtomContainer) -> (ComponentResult _rv)")},
+ {"GraphicsImportGetImageCount", (PyCFunction)Qt_GraphicsImportGetImageCount, 1,
+ PyDoc_STR("(GraphicsImportComponent ci) -> (ComponentResult _rv, unsigned long imageCount)")},
+ {"GraphicsImportSetImageIndex", (PyCFunction)Qt_GraphicsImportSetImageIndex, 1,
+ PyDoc_STR("(GraphicsImportComponent ci, unsigned long imageIndex) -> (ComponentResult _rv)")},
+ {"GraphicsImportGetImageIndex", (PyCFunction)Qt_GraphicsImportGetImageIndex, 1,
+ PyDoc_STR("(GraphicsImportComponent ci) -> (ComponentResult _rv, unsigned long imageIndex)")},
+ {"GraphicsImportGetDataOffsetAndSize64", (PyCFunction)Qt_GraphicsImportGetDataOffsetAndSize64, 1,
+ PyDoc_STR("(GraphicsImportComponent ci) -> (ComponentResult _rv, wide offset, wide size)")},
+ {"GraphicsImportReadData64", (PyCFunction)Qt_GraphicsImportReadData64, 1,
+ PyDoc_STR("(GraphicsImportComponent ci, void * dataPtr, wide dataOffset, unsigned long dataSize) -> (ComponentResult _rv)")},
+ {"GraphicsImportSetDataReferenceOffsetAndLimit64", (PyCFunction)Qt_GraphicsImportSetDataReferenceOffsetAndLimit64, 1,
+ PyDoc_STR("(GraphicsImportComponent ci, wide offset, wide limit) -> (ComponentResult _rv)")},
+ {"GraphicsImportGetDataReferenceOffsetAndLimit64", (PyCFunction)Qt_GraphicsImportGetDataReferenceOffsetAndLimit64, 1,
+ PyDoc_STR("(GraphicsImportComponent ci) -> (ComponentResult _rv, wide offset, wide limit)")},
+ {"GraphicsImportGetDefaultClip", (PyCFunction)Qt_GraphicsImportGetDefaultClip, 1,
+ PyDoc_STR("(GraphicsImportComponent ci) -> (ComponentResult _rv, RgnHandle defaultRgn)")},
+ {"GraphicsImportGetDefaultGraphicsMode", (PyCFunction)Qt_GraphicsImportGetDefaultGraphicsMode, 1,
+ PyDoc_STR("(GraphicsImportComponent ci) -> (ComponentResult _rv, long defaultGraphicsMode, RGBColor defaultOpColor)")},
+ {"GraphicsImportGetDefaultSourceRect", (PyCFunction)Qt_GraphicsImportGetDefaultSourceRect, 1,
+ PyDoc_STR("(GraphicsImportComponent ci) -> (ComponentResult _rv, Rect defaultSourceRect)")},
+ {"GraphicsImportGetColorSyncProfile", (PyCFunction)Qt_GraphicsImportGetColorSyncProfile, 1,
+ PyDoc_STR("(GraphicsImportComponent ci) -> (ComponentResult _rv, Handle profile)")},
+ {"GraphicsImportSetDestRect", (PyCFunction)Qt_GraphicsImportSetDestRect, 1,
+ PyDoc_STR("(GraphicsImportComponent ci, Rect destRect) -> (ComponentResult _rv)")},
+ {"GraphicsImportGetDestRect", (PyCFunction)Qt_GraphicsImportGetDestRect, 1,
+ PyDoc_STR("(GraphicsImportComponent ci) -> (ComponentResult _rv, Rect destRect)")},
+ {"GraphicsImportSetFlags", (PyCFunction)Qt_GraphicsImportSetFlags, 1,
+ PyDoc_STR("(GraphicsImportComponent ci, long flags) -> (ComponentResult _rv)")},
+ {"GraphicsImportGetFlags", (PyCFunction)Qt_GraphicsImportGetFlags, 1,
+ PyDoc_STR("(GraphicsImportComponent ci) -> (ComponentResult _rv, long flags)")},
+ {"GraphicsImportGetBaseDataOffsetAndSize64", (PyCFunction)Qt_GraphicsImportGetBaseDataOffsetAndSize64, 1,
+ PyDoc_STR("(GraphicsImportComponent ci) -> (ComponentResult _rv, wide offset, wide size)")},
+ {"GraphicsImportSetImageIndexToThumbnail", (PyCFunction)Qt_GraphicsImportSetImageIndexToThumbnail, 1,
+ PyDoc_STR("(GraphicsImportComponent ci) -> (ComponentResult _rv)")},
+ {"GraphicsExportDoExport", (PyCFunction)Qt_GraphicsExportDoExport, 1,
+ PyDoc_STR("(GraphicsExportComponent ci) -> (ComponentResult _rv, unsigned long actualSizeWritten)")},
+ {"GraphicsExportCanTranscode", (PyCFunction)Qt_GraphicsExportCanTranscode, 1,
+ PyDoc_STR("(GraphicsExportComponent ci) -> (ComponentResult _rv, Boolean canTranscode)")},
+ {"GraphicsExportDoTranscode", (PyCFunction)Qt_GraphicsExportDoTranscode, 1,
+ PyDoc_STR("(GraphicsExportComponent ci) -> (ComponentResult _rv)")},
+ {"GraphicsExportCanUseCompressor", (PyCFunction)Qt_GraphicsExportCanUseCompressor, 1,
+ PyDoc_STR("(GraphicsExportComponent ci, void * codecSettingsAtomContainerPtr) -> (ComponentResult _rv, Boolean canUseCompressor)")},
+ {"GraphicsExportDoUseCompressor", (PyCFunction)Qt_GraphicsExportDoUseCompressor, 1,
+ PyDoc_STR("(GraphicsExportComponent ci, void * codecSettingsAtomContainer) -> (ComponentResult _rv, ImageDescriptionHandle outDesc)")},
+ {"GraphicsExportDoStandaloneExport", (PyCFunction)Qt_GraphicsExportDoStandaloneExport, 1,
+ PyDoc_STR("(GraphicsExportComponent ci) -> (ComponentResult _rv)")},
+ {"GraphicsExportGetDefaultFileTypeAndCreator", (PyCFunction)Qt_GraphicsExportGetDefaultFileTypeAndCreator, 1,
+ PyDoc_STR("(GraphicsExportComponent ci) -> (ComponentResult _rv, OSType fileType, OSType fileCreator)")},
+ {"GraphicsExportGetDefaultFileNameExtension", (PyCFunction)Qt_GraphicsExportGetDefaultFileNameExtension, 1,
+ PyDoc_STR("(GraphicsExportComponent ci) -> (ComponentResult _rv, OSType fileNameExtension)")},
+ {"GraphicsExportGetMIMETypeList", (PyCFunction)Qt_GraphicsExportGetMIMETypeList, 1,
+ PyDoc_STR("(GraphicsExportComponent ci, void * qtAtomContainerPtr) -> (ComponentResult _rv)")},
+ {"GraphicsExportSetSettingsFromAtomContainer", (PyCFunction)Qt_GraphicsExportSetSettingsFromAtomContainer, 1,
+ PyDoc_STR("(GraphicsExportComponent ci, void * qtAtomContainer) -> (ComponentResult _rv)")},
+ {"GraphicsExportGetSettingsAsAtomContainer", (PyCFunction)Qt_GraphicsExportGetSettingsAsAtomContainer, 1,
+ PyDoc_STR("(GraphicsExportComponent ci, void * qtAtomContainerPtr) -> (ComponentResult _rv)")},
+ {"GraphicsExportGetSettingsAsText", (PyCFunction)Qt_GraphicsExportGetSettingsAsText, 1,
+ PyDoc_STR("(GraphicsExportComponent ci) -> (ComponentResult _rv, Handle theText)")},
+ {"GraphicsExportSetDontRecompress", (PyCFunction)Qt_GraphicsExportSetDontRecompress, 1,
+ PyDoc_STR("(GraphicsExportComponent ci, Boolean dontRecompress) -> (ComponentResult _rv)")},
+ {"GraphicsExportGetDontRecompress", (PyCFunction)Qt_GraphicsExportGetDontRecompress, 1,
+ PyDoc_STR("(GraphicsExportComponent ci) -> (ComponentResult _rv, Boolean dontRecompress)")},
+ {"GraphicsExportSetInterlaceStyle", (PyCFunction)Qt_GraphicsExportSetInterlaceStyle, 1,
+ PyDoc_STR("(GraphicsExportComponent ci, unsigned long interlaceStyle) -> (ComponentResult _rv)")},
+ {"GraphicsExportGetInterlaceStyle", (PyCFunction)Qt_GraphicsExportGetInterlaceStyle, 1,
+ PyDoc_STR("(GraphicsExportComponent ci) -> (ComponentResult _rv, unsigned long interlaceStyle)")},
+ {"GraphicsExportSetMetaData", (PyCFunction)Qt_GraphicsExportSetMetaData, 1,
+ PyDoc_STR("(GraphicsExportComponent ci, void * userData) -> (ComponentResult _rv)")},
+ {"GraphicsExportGetMetaData", (PyCFunction)Qt_GraphicsExportGetMetaData, 1,
+ PyDoc_STR("(GraphicsExportComponent ci, void * userData) -> (ComponentResult _rv)")},
+ {"GraphicsExportSetTargetDataSize", (PyCFunction)Qt_GraphicsExportSetTargetDataSize, 1,
+ PyDoc_STR("(GraphicsExportComponent ci, unsigned long targetDataSize) -> (ComponentResult _rv)")},
+ {"GraphicsExportGetTargetDataSize", (PyCFunction)Qt_GraphicsExportGetTargetDataSize, 1,
+ PyDoc_STR("(GraphicsExportComponent ci) -> (ComponentResult _rv, unsigned long targetDataSize)")},
+ {"GraphicsExportSetCompressionMethod", (PyCFunction)Qt_GraphicsExportSetCompressionMethod, 1,
+ PyDoc_STR("(GraphicsExportComponent ci, long compressionMethod) -> (ComponentResult _rv)")},
+ {"GraphicsExportGetCompressionMethod", (PyCFunction)Qt_GraphicsExportGetCompressionMethod, 1,
+ PyDoc_STR("(GraphicsExportComponent ci) -> (ComponentResult _rv, long compressionMethod)")},
+ {"GraphicsExportSetCompressionQuality", (PyCFunction)Qt_GraphicsExportSetCompressionQuality, 1,
+ PyDoc_STR("(GraphicsExportComponent ci, CodecQ spatialQuality) -> (ComponentResult _rv)")},
+ {"GraphicsExportGetCompressionQuality", (PyCFunction)Qt_GraphicsExportGetCompressionQuality, 1,
+ PyDoc_STR("(GraphicsExportComponent ci) -> (ComponentResult _rv, CodecQ spatialQuality)")},
+ {"GraphicsExportSetResolution", (PyCFunction)Qt_GraphicsExportSetResolution, 1,
+ PyDoc_STR("(GraphicsExportComponent ci, Fixed horizontalResolution, Fixed verticalResolution) -> (ComponentResult _rv)")},
+ {"GraphicsExportGetResolution", (PyCFunction)Qt_GraphicsExportGetResolution, 1,
+ PyDoc_STR("(GraphicsExportComponent ci) -> (ComponentResult _rv, Fixed horizontalResolution, Fixed verticalResolution)")},
+ {"GraphicsExportSetDepth", (PyCFunction)Qt_GraphicsExportSetDepth, 1,
+ PyDoc_STR("(GraphicsExportComponent ci, long depth) -> (ComponentResult _rv)")},
+ {"GraphicsExportGetDepth", (PyCFunction)Qt_GraphicsExportGetDepth, 1,
+ PyDoc_STR("(GraphicsExportComponent ci) -> (ComponentResult _rv, long depth)")},
+ {"GraphicsExportSetColorSyncProfile", (PyCFunction)Qt_GraphicsExportSetColorSyncProfile, 1,
+ PyDoc_STR("(GraphicsExportComponent ci, Handle colorSyncProfile) -> (ComponentResult _rv)")},
+ {"GraphicsExportGetColorSyncProfile", (PyCFunction)Qt_GraphicsExportGetColorSyncProfile, 1,
+ PyDoc_STR("(GraphicsExportComponent ci) -> (ComponentResult _rv, Handle colorSyncProfile)")},
+ {"GraphicsExportSetInputDataReference", (PyCFunction)Qt_GraphicsExportSetInputDataReference, 1,
+ PyDoc_STR("(GraphicsExportComponent ci, Handle dataRef, OSType dataRefType, ImageDescriptionHandle desc) -> (ComponentResult _rv)")},
+ {"GraphicsExportGetInputDataReference", (PyCFunction)Qt_GraphicsExportGetInputDataReference, 1,
+ PyDoc_STR("(GraphicsExportComponent ci) -> (ComponentResult _rv, Handle dataRef, OSType dataRefType)")},
+ {"GraphicsExportSetInputFile", (PyCFunction)Qt_GraphicsExportSetInputFile, 1,
+ PyDoc_STR("(GraphicsExportComponent ci, FSSpec theFile, ImageDescriptionHandle desc) -> (ComponentResult _rv)")},
+ {"GraphicsExportGetInputFile", (PyCFunction)Qt_GraphicsExportGetInputFile, 1,
+ PyDoc_STR("(GraphicsExportComponent ci, FSSpec theFile) -> (ComponentResult _rv)")},
+ {"GraphicsExportSetInputHandle", (PyCFunction)Qt_GraphicsExportSetInputHandle, 1,
+ PyDoc_STR("(GraphicsExportComponent ci, Handle h, ImageDescriptionHandle desc) -> (ComponentResult _rv)")},
+ {"GraphicsExportGetInputHandle", (PyCFunction)Qt_GraphicsExportGetInputHandle, 1,
+ PyDoc_STR("(GraphicsExportComponent ci) -> (ComponentResult _rv, Handle h)")},
+ {"GraphicsExportSetInputPtr", (PyCFunction)Qt_GraphicsExportSetInputPtr, 1,
+ PyDoc_STR("(GraphicsExportComponent ci, Ptr p, unsigned long size, ImageDescriptionHandle desc) -> (ComponentResult _rv)")},
+ {"GraphicsExportSetInputGraphicsImporter", (PyCFunction)Qt_GraphicsExportSetInputGraphicsImporter, 1,
+ PyDoc_STR("(GraphicsExportComponent ci, GraphicsImportComponent grip) -> (ComponentResult _rv)")},
+ {"GraphicsExportGetInputGraphicsImporter", (PyCFunction)Qt_GraphicsExportGetInputGraphicsImporter, 1,
+ PyDoc_STR("(GraphicsExportComponent ci) -> (ComponentResult _rv, GraphicsImportComponent grip)")},
+ {"GraphicsExportSetInputPicture", (PyCFunction)Qt_GraphicsExportSetInputPicture, 1,
+ PyDoc_STR("(GraphicsExportComponent ci, PicHandle picture) -> (ComponentResult _rv)")},
+ {"GraphicsExportGetInputPicture", (PyCFunction)Qt_GraphicsExportGetInputPicture, 1,
+ PyDoc_STR("(GraphicsExportComponent ci) -> (ComponentResult _rv, PicHandle picture)")},
+ {"GraphicsExportSetInputGWorld", (PyCFunction)Qt_GraphicsExportSetInputGWorld, 1,
+ PyDoc_STR("(GraphicsExportComponent ci, GWorldPtr gworld) -> (ComponentResult _rv)")},
+ {"GraphicsExportGetInputGWorld", (PyCFunction)Qt_GraphicsExportGetInputGWorld, 1,
+ PyDoc_STR("(GraphicsExportComponent ci) -> (ComponentResult _rv, GWorldPtr gworld)")},
+ {"GraphicsExportSetInputPixmap", (PyCFunction)Qt_GraphicsExportSetInputPixmap, 1,
+ PyDoc_STR("(GraphicsExportComponent ci, PixMapHandle pixmap) -> (ComponentResult _rv)")},
+ {"GraphicsExportGetInputPixmap", (PyCFunction)Qt_GraphicsExportGetInputPixmap, 1,
+ PyDoc_STR("(GraphicsExportComponent ci) -> (ComponentResult _rv, PixMapHandle pixmap)")},
+ {"GraphicsExportSetInputOffsetAndLimit", (PyCFunction)Qt_GraphicsExportSetInputOffsetAndLimit, 1,
+ PyDoc_STR("(GraphicsExportComponent ci, unsigned long offset, unsigned long limit) -> (ComponentResult _rv)")},
+ {"GraphicsExportGetInputOffsetAndLimit", (PyCFunction)Qt_GraphicsExportGetInputOffsetAndLimit, 1,
+ PyDoc_STR("(GraphicsExportComponent ci) -> (ComponentResult _rv, unsigned long offset, unsigned long limit)")},
+ {"GraphicsExportMayExporterReadInputData", (PyCFunction)Qt_GraphicsExportMayExporterReadInputData, 1,
+ PyDoc_STR("(GraphicsExportComponent ci) -> (ComponentResult _rv, Boolean mayReadInputData)")},
+ {"GraphicsExportGetInputDataSize", (PyCFunction)Qt_GraphicsExportGetInputDataSize, 1,
+ PyDoc_STR("(GraphicsExportComponent ci) -> (ComponentResult _rv, unsigned long size)")},
+ {"GraphicsExportReadInputData", (PyCFunction)Qt_GraphicsExportReadInputData, 1,
+ PyDoc_STR("(GraphicsExportComponent ci, void * dataPtr, unsigned long dataOffset, unsigned long dataSize) -> (ComponentResult _rv)")},
+ {"GraphicsExportGetInputImageDescription", (PyCFunction)Qt_GraphicsExportGetInputImageDescription, 1,
+ PyDoc_STR("(GraphicsExportComponent ci) -> (ComponentResult _rv, ImageDescriptionHandle desc)")},
+ {"GraphicsExportGetInputImageDimensions", (PyCFunction)Qt_GraphicsExportGetInputImageDimensions, 1,
+ PyDoc_STR("(GraphicsExportComponent ci) -> (ComponentResult _rv, Rect dimensions)")},
+ {"GraphicsExportGetInputImageDepth", (PyCFunction)Qt_GraphicsExportGetInputImageDepth, 1,
+ PyDoc_STR("(GraphicsExportComponent ci) -> (ComponentResult _rv, long inputDepth)")},
+ {"GraphicsExportDrawInputImage", (PyCFunction)Qt_GraphicsExportDrawInputImage, 1,
+ PyDoc_STR("(GraphicsExportComponent ci, CGrafPtr gw, GDHandle gd, Rect srcRect, Rect dstRect) -> (ComponentResult _rv)")},
+ {"GraphicsExportSetOutputDataReference", (PyCFunction)Qt_GraphicsExportSetOutputDataReference, 1,
+ PyDoc_STR("(GraphicsExportComponent ci, Handle dataRef, OSType dataRefType) -> (ComponentResult _rv)")},
+ {"GraphicsExportGetOutputDataReference", (PyCFunction)Qt_GraphicsExportGetOutputDataReference, 1,
+ PyDoc_STR("(GraphicsExportComponent ci) -> (ComponentResult _rv, Handle dataRef, OSType dataRefType)")},
+ {"GraphicsExportSetOutputFile", (PyCFunction)Qt_GraphicsExportSetOutputFile, 1,
+ PyDoc_STR("(GraphicsExportComponent ci, FSSpec theFile) -> (ComponentResult _rv)")},
+ {"GraphicsExportGetOutputFile", (PyCFunction)Qt_GraphicsExportGetOutputFile, 1,
+ PyDoc_STR("(GraphicsExportComponent ci, FSSpec theFile) -> (ComponentResult _rv)")},
+ {"GraphicsExportSetOutputHandle", (PyCFunction)Qt_GraphicsExportSetOutputHandle, 1,
+ PyDoc_STR("(GraphicsExportComponent ci, Handle h) -> (ComponentResult _rv)")},
+ {"GraphicsExportGetOutputHandle", (PyCFunction)Qt_GraphicsExportGetOutputHandle, 1,
+ PyDoc_STR("(GraphicsExportComponent ci) -> (ComponentResult _rv, Handle h)")},
+ {"GraphicsExportSetOutputOffsetAndMaxSize", (PyCFunction)Qt_GraphicsExportSetOutputOffsetAndMaxSize, 1,
+ PyDoc_STR("(GraphicsExportComponent ci, unsigned long offset, unsigned long maxSize, Boolean truncateFile) -> (ComponentResult _rv)")},
+ {"GraphicsExportGetOutputOffsetAndMaxSize", (PyCFunction)Qt_GraphicsExportGetOutputOffsetAndMaxSize, 1,
+ PyDoc_STR("(GraphicsExportComponent ci) -> (ComponentResult _rv, unsigned long offset, unsigned long maxSize, Boolean truncateFile)")},
+ {"GraphicsExportSetOutputFileTypeAndCreator", (PyCFunction)Qt_GraphicsExportSetOutputFileTypeAndCreator, 1,
+ PyDoc_STR("(GraphicsExportComponent ci, OSType fileType, OSType fileCreator) -> (ComponentResult _rv)")},
+ {"GraphicsExportGetOutputFileTypeAndCreator", (PyCFunction)Qt_GraphicsExportGetOutputFileTypeAndCreator, 1,
+ PyDoc_STR("(GraphicsExportComponent ci) -> (ComponentResult _rv, OSType fileType, OSType fileCreator)")},
+ {"GraphicsExportSetOutputMark", (PyCFunction)Qt_GraphicsExportSetOutputMark, 1,
+ PyDoc_STR("(GraphicsExportComponent ci, unsigned long mark) -> (ComponentResult _rv)")},
+ {"GraphicsExportGetOutputMark", (PyCFunction)Qt_GraphicsExportGetOutputMark, 1,
+ PyDoc_STR("(GraphicsExportComponent ci) -> (ComponentResult _rv, unsigned long mark)")},
+ {"GraphicsExportReadOutputData", (PyCFunction)Qt_GraphicsExportReadOutputData, 1,
+ PyDoc_STR("(GraphicsExportComponent ci, void * dataPtr, unsigned long dataOffset, unsigned long dataSize) -> (ComponentResult _rv)")},
+ {"GraphicsExportSetThumbnailEnabled", (PyCFunction)Qt_GraphicsExportSetThumbnailEnabled, 1,
+ PyDoc_STR("(GraphicsExportComponent ci, Boolean enableThumbnail, long maxThumbnailWidth, long maxThumbnailHeight) -> (ComponentResult _rv)")},
+ {"GraphicsExportGetThumbnailEnabled", (PyCFunction)Qt_GraphicsExportGetThumbnailEnabled, 1,
+ PyDoc_STR("(GraphicsExportComponent ci) -> (ComponentResult _rv, Boolean thumbnailEnabled, long maxThumbnailWidth, long maxThumbnailHeight)")},
+ {"GraphicsExportSetExifEnabled", (PyCFunction)Qt_GraphicsExportSetExifEnabled, 1,
+ PyDoc_STR("(GraphicsExportComponent ci, Boolean enableExif) -> (ComponentResult _rv)")},
+ {"GraphicsExportGetExifEnabled", (PyCFunction)Qt_GraphicsExportGetExifEnabled, 1,
+ PyDoc_STR("(GraphicsExportComponent ci) -> (ComponentResult _rv, Boolean exifEnabled)")},
+ {"ImageTranscoderBeginSequence", (PyCFunction)Qt_ImageTranscoderBeginSequence, 1,
+ PyDoc_STR("(ImageTranscoderComponent itc, ImageDescriptionHandle srcDesc, void * data, long dataSize) -> (ComponentResult _rv, ImageDescriptionHandle dstDesc)")},
+ {"ImageTranscoderDisposeData", (PyCFunction)Qt_ImageTranscoderDisposeData, 1,
+ PyDoc_STR("(ImageTranscoderComponent itc, void * dstData) -> (ComponentResult _rv)")},
+ {"ImageTranscoderEndSequence", (PyCFunction)Qt_ImageTranscoderEndSequence, 1,
+ PyDoc_STR("(ImageTranscoderComponent itc) -> (ComponentResult _rv)")},
+ {"ClockGetTime", (PyCFunction)Qt_ClockGetTime, 1,
+ PyDoc_STR("(ComponentInstance aClock) -> (ComponentResult _rv, TimeRecord out)")},
+ {"ClockSetTimeBase", (PyCFunction)Qt_ClockSetTimeBase, 1,
+ PyDoc_STR("(ComponentInstance aClock, TimeBase tb) -> (ComponentResult _rv)")},
+ {"ClockGetRate", (PyCFunction)Qt_ClockGetRate, 1,
+ PyDoc_STR("(ComponentInstance aClock) -> (ComponentResult _rv, Fixed rate)")},
+ {"SCPositionRect", (PyCFunction)Qt_SCPositionRect, 1,
+ PyDoc_STR("(ComponentInstance ci) -> (ComponentResult _rv, Rect rp, Point where)")},
+ {"SCPositionDialog", (PyCFunction)Qt_SCPositionDialog, 1,
+ PyDoc_STR("(ComponentInstance ci, short id) -> (ComponentResult _rv, Point where)")},
+ {"SCSetTestImagePictHandle", (PyCFunction)Qt_SCSetTestImagePictHandle, 1,
+ PyDoc_STR("(ComponentInstance ci, PicHandle testPict, short testFlags) -> (ComponentResult _rv, Rect testRect)")},
+ {"SCSetTestImagePictFile", (PyCFunction)Qt_SCSetTestImagePictFile, 1,
+ PyDoc_STR("(ComponentInstance ci, short testFileRef, short testFlags) -> (ComponentResult _rv, Rect testRect)")},
+ {"SCSetTestImagePixMap", (PyCFunction)Qt_SCSetTestImagePixMap, 1,
+ PyDoc_STR("(ComponentInstance ci, PixMapHandle testPixMap, short testFlags) -> (ComponentResult _rv, Rect testRect)")},
+ {"SCGetBestDeviceRect", (PyCFunction)Qt_SCGetBestDeviceRect, 1,
+ PyDoc_STR("(ComponentInstance ci) -> (ComponentResult _rv, Rect r)")},
+ {"SCRequestImageSettings", (PyCFunction)Qt_SCRequestImageSettings, 1,
+ PyDoc_STR("(ComponentInstance ci) -> (ComponentResult _rv)")},
+ {"SCCompressImage", (PyCFunction)Qt_SCCompressImage, 1,
+ PyDoc_STR("(ComponentInstance ci, PixMapHandle src, Rect srcRect) -> (ComponentResult _rv, ImageDescriptionHandle desc, Handle data)")},
+ {"SCCompressPicture", (PyCFunction)Qt_SCCompressPicture, 1,
+ PyDoc_STR("(ComponentInstance ci, PicHandle srcPicture, PicHandle dstPicture) -> (ComponentResult _rv)")},
+ {"SCCompressPictureFile", (PyCFunction)Qt_SCCompressPictureFile, 1,
+ PyDoc_STR("(ComponentInstance ci, short srcRefNum, short dstRefNum) -> (ComponentResult _rv)")},
+ {"SCRequestSequenceSettings", (PyCFunction)Qt_SCRequestSequenceSettings, 1,
+ PyDoc_STR("(ComponentInstance ci) -> (ComponentResult _rv)")},
+ {"SCCompressSequenceBegin", (PyCFunction)Qt_SCCompressSequenceBegin, 1,
+ PyDoc_STR("(ComponentInstance ci, PixMapHandle src, Rect srcRect) -> (ComponentResult _rv, ImageDescriptionHandle desc)")},
+ {"SCCompressSequenceFrame", (PyCFunction)Qt_SCCompressSequenceFrame, 1,
+ PyDoc_STR("(ComponentInstance ci, PixMapHandle src, Rect srcRect) -> (ComponentResult _rv, Handle data, long dataSize, short notSyncFlag)")},
+ {"SCCompressSequenceEnd", (PyCFunction)Qt_SCCompressSequenceEnd, 1,
+ PyDoc_STR("(ComponentInstance ci) -> (ComponentResult _rv)")},
+ {"SCDefaultPictHandleSettings", (PyCFunction)Qt_SCDefaultPictHandleSettings, 1,
+ PyDoc_STR("(ComponentInstance ci, PicHandle srcPicture, short motion) -> (ComponentResult _rv)")},
+ {"SCDefaultPictFileSettings", (PyCFunction)Qt_SCDefaultPictFileSettings, 1,
+ PyDoc_STR("(ComponentInstance ci, short srcRef, short motion) -> (ComponentResult _rv)")},
+ {"SCDefaultPixMapSettings", (PyCFunction)Qt_SCDefaultPixMapSettings, 1,
+ PyDoc_STR("(ComponentInstance ci, PixMapHandle src, short motion) -> (ComponentResult _rv)")},
+ {"SCGetInfo", (PyCFunction)Qt_SCGetInfo, 1,
+ PyDoc_STR("(ComponentInstance ci, OSType infoType, void * info) -> (ComponentResult _rv)")},
+ {"SCSetInfo", (PyCFunction)Qt_SCSetInfo, 1,
+ PyDoc_STR("(ComponentInstance ci, OSType infoType, void * info) -> (ComponentResult _rv)")},
+ {"SCSetCompressFlags", (PyCFunction)Qt_SCSetCompressFlags, 1,
+ PyDoc_STR("(ComponentInstance ci, long flags) -> (ComponentResult _rv)")},
+ {"SCGetCompressFlags", (PyCFunction)Qt_SCGetCompressFlags, 1,
+ PyDoc_STR("(ComponentInstance ci) -> (ComponentResult _rv, long flags)")},
+ {"SCGetSettingsAsText", (PyCFunction)Qt_SCGetSettingsAsText, 1,
+ PyDoc_STR("(ComponentInstance ci) -> (ComponentResult _rv, Handle text)")},
+ {"SCAsyncIdle", (PyCFunction)Qt_SCAsyncIdle, 1,
+ PyDoc_STR("(ComponentInstance ci) -> (ComponentResult _rv)")},
+ {"TweenerReset", (PyCFunction)Qt_TweenerReset, 1,
+ PyDoc_STR("(TweenerComponent tc) -> (ComponentResult _rv)")},
+ {"TCGetSourceRef", (PyCFunction)Qt_TCGetSourceRef, 1,
+ PyDoc_STR("(MediaHandler mh, TimeCodeDescriptionHandle tcdH) -> (HandlerError _rv, UserData srefH)")},
+ {"TCSetSourceRef", (PyCFunction)Qt_TCSetSourceRef, 1,
+ PyDoc_STR("(MediaHandler mh, TimeCodeDescriptionHandle tcdH, UserData srefH) -> (HandlerError _rv)")},
+ {"TCSetTimeCodeFlags", (PyCFunction)Qt_TCSetTimeCodeFlags, 1,
+ PyDoc_STR("(MediaHandler mh, long flags, long flagsMask) -> (HandlerError _rv)")},
+ {"TCGetTimeCodeFlags", (PyCFunction)Qt_TCGetTimeCodeFlags, 1,
+ PyDoc_STR("(MediaHandler mh) -> (HandlerError _rv, long flags)")},
+ {"MovieImportHandle", (PyCFunction)Qt_MovieImportHandle, 1,
+ PyDoc_STR("(MovieImportComponent ci, Handle dataH, Movie theMovie, Track targetTrack, TimeValue atTime, long inFlags) -> (ComponentResult _rv, Track usedTrack, TimeValue addedDuration, long outFlags)")},
+ {"MovieImportFile", (PyCFunction)Qt_MovieImportFile, 1,
+ PyDoc_STR("(MovieImportComponent ci, FSSpec theFile, Movie theMovie, Track targetTrack, TimeValue atTime, long inFlags) -> (ComponentResult _rv, Track usedTrack, TimeValue addedDuration, long outFlags)")},
+ {"MovieImportSetSampleDuration", (PyCFunction)Qt_MovieImportSetSampleDuration, 1,
+ PyDoc_STR("(MovieImportComponent ci, TimeValue duration, TimeScale scale) -> (ComponentResult _rv)")},
+ {"MovieImportSetSampleDescription", (PyCFunction)Qt_MovieImportSetSampleDescription, 1,
+ PyDoc_STR("(MovieImportComponent ci, SampleDescriptionHandle desc, OSType mediaType) -> (ComponentResult _rv)")},
+ {"MovieImportSetMediaFile", (PyCFunction)Qt_MovieImportSetMediaFile, 1,
+ PyDoc_STR("(MovieImportComponent ci, AliasHandle alias) -> (ComponentResult _rv)")},
+ {"MovieImportSetDimensions", (PyCFunction)Qt_MovieImportSetDimensions, 1,
+ PyDoc_STR("(MovieImportComponent ci, Fixed width, Fixed height) -> (ComponentResult _rv)")},
+ {"MovieImportSetChunkSize", (PyCFunction)Qt_MovieImportSetChunkSize, 1,
+ PyDoc_STR("(MovieImportComponent ci, long chunkSize) -> (ComponentResult _rv)")},
+ {"MovieImportSetAuxiliaryData", (PyCFunction)Qt_MovieImportSetAuxiliaryData, 1,
+ PyDoc_STR("(MovieImportComponent ci, Handle data, OSType handleType) -> (ComponentResult _rv)")},
+ {"MovieImportSetFromScrap", (PyCFunction)Qt_MovieImportSetFromScrap, 1,
+ PyDoc_STR("(MovieImportComponent ci, Boolean fromScrap) -> (ComponentResult _rv)")},
+ {"MovieImportDoUserDialog", (PyCFunction)Qt_MovieImportDoUserDialog, 1,
+ PyDoc_STR("(MovieImportComponent ci, FSSpec theFile, Handle theData) -> (ComponentResult _rv, Boolean canceled)")},
+ {"MovieImportSetDuration", (PyCFunction)Qt_MovieImportSetDuration, 1,
+ PyDoc_STR("(MovieImportComponent ci, TimeValue duration) -> (ComponentResult _rv)")},
+ {"MovieImportGetAuxiliaryDataType", (PyCFunction)Qt_MovieImportGetAuxiliaryDataType, 1,
+ PyDoc_STR("(MovieImportComponent ci) -> (ComponentResult _rv, OSType auxType)")},
+ {"MovieImportValidate", (PyCFunction)Qt_MovieImportValidate, 1,
+ PyDoc_STR("(MovieImportComponent ci, FSSpec theFile, Handle theData) -> (ComponentResult _rv, Boolean valid)")},
+ {"MovieImportGetFileType", (PyCFunction)Qt_MovieImportGetFileType, 1,
+ PyDoc_STR("(MovieImportComponent ci) -> (ComponentResult _rv, OSType fileType)")},
+ {"MovieImportDataRef", (PyCFunction)Qt_MovieImportDataRef, 1,
+ PyDoc_STR("(MovieImportComponent ci, Handle dataRef, OSType dataRefType, Movie theMovie, Track targetTrack, TimeValue atTime, long inFlags) -> (ComponentResult _rv, Track usedTrack, TimeValue addedDuration, long outFlags)")},
+ {"MovieImportGetSampleDescription", (PyCFunction)Qt_MovieImportGetSampleDescription, 1,
+ PyDoc_STR("(MovieImportComponent ci) -> (ComponentResult _rv, SampleDescriptionHandle desc, OSType mediaType)")},
+ {"MovieImportSetOffsetAndLimit", (PyCFunction)Qt_MovieImportSetOffsetAndLimit, 1,
+ PyDoc_STR("(MovieImportComponent ci, unsigned long offset, unsigned long limit) -> (ComponentResult _rv)")},
+ {"MovieImportSetOffsetAndLimit64", (PyCFunction)Qt_MovieImportSetOffsetAndLimit64, 1,
+ PyDoc_STR("(MovieImportComponent ci, wide offset, wide limit) -> (ComponentResult _rv)")},
+ {"MovieImportIdle", (PyCFunction)Qt_MovieImportIdle, 1,
+ PyDoc_STR("(MovieImportComponent ci, long inFlags) -> (ComponentResult _rv, long outFlags)")},
+ {"MovieImportValidateDataRef", (PyCFunction)Qt_MovieImportValidateDataRef, 1,
+ PyDoc_STR("(MovieImportComponent ci, Handle dataRef, OSType dataRefType) -> (ComponentResult _rv, UInt8 valid)")},
+ {"MovieImportGetLoadState", (PyCFunction)Qt_MovieImportGetLoadState, 1,
+ PyDoc_STR("(MovieImportComponent ci) -> (ComponentResult _rv, long importerLoadState)")},
+ {"MovieImportGetMaxLoadedTime", (PyCFunction)Qt_MovieImportGetMaxLoadedTime, 1,
+ PyDoc_STR("(MovieImportComponent ci) -> (ComponentResult _rv, TimeValue time)")},
+ {"MovieImportEstimateCompletionTime", (PyCFunction)Qt_MovieImportEstimateCompletionTime, 1,
+ PyDoc_STR("(MovieImportComponent ci) -> (ComponentResult _rv, TimeRecord time)")},
+ {"MovieImportSetDontBlock", (PyCFunction)Qt_MovieImportSetDontBlock, 1,
+ PyDoc_STR("(MovieImportComponent ci, Boolean dontBlock) -> (ComponentResult _rv)")},
+ {"MovieImportGetDontBlock", (PyCFunction)Qt_MovieImportGetDontBlock, 1,
+ PyDoc_STR("(MovieImportComponent ci) -> (ComponentResult _rv, Boolean willBlock)")},
+ {"MovieImportSetIdleManager", (PyCFunction)Qt_MovieImportSetIdleManager, 1,
+ PyDoc_STR("(MovieImportComponent ci, IdleManager im) -> (ComponentResult _rv)")},
+ {"MovieImportSetNewMovieFlags", (PyCFunction)Qt_MovieImportSetNewMovieFlags, 1,
+ PyDoc_STR("(MovieImportComponent ci, long newMovieFlags) -> (ComponentResult _rv)")},
+ {"MovieImportGetDestinationMediaType", (PyCFunction)Qt_MovieImportGetDestinationMediaType, 1,
+ PyDoc_STR("(MovieImportComponent ci) -> (ComponentResult _rv, OSType mediaType)")},
+ {"MovieExportToHandle", (PyCFunction)Qt_MovieExportToHandle, 1,
+ PyDoc_STR("(MovieExportComponent ci, Handle dataH, Movie theMovie, Track onlyThisTrack, TimeValue startTime, TimeValue duration) -> (ComponentResult _rv)")},
+ {"MovieExportToFile", (PyCFunction)Qt_MovieExportToFile, 1,
+ PyDoc_STR("(MovieExportComponent ci, FSSpec theFile, Movie theMovie, Track onlyThisTrack, TimeValue startTime, TimeValue duration) -> (ComponentResult _rv)")},
+ {"MovieExportGetAuxiliaryData", (PyCFunction)Qt_MovieExportGetAuxiliaryData, 1,
+ PyDoc_STR("(MovieExportComponent ci, Handle dataH) -> (ComponentResult _rv, OSType handleType)")},
+ {"MovieExportSetSampleDescription", (PyCFunction)Qt_MovieExportSetSampleDescription, 1,
+ PyDoc_STR("(MovieExportComponent ci, SampleDescriptionHandle desc, OSType mediaType) -> (ComponentResult _rv)")},
+ {"MovieExportDoUserDialog", (PyCFunction)Qt_MovieExportDoUserDialog, 1,
+ PyDoc_STR("(MovieExportComponent ci, Movie theMovie, Track onlyThisTrack, TimeValue startTime, TimeValue duration) -> (ComponentResult _rv, Boolean canceled)")},
+ {"MovieExportGetCreatorType", (PyCFunction)Qt_MovieExportGetCreatorType, 1,
+ PyDoc_STR("(MovieExportComponent ci) -> (ComponentResult _rv, OSType creator)")},
+ {"MovieExportToDataRef", (PyCFunction)Qt_MovieExportToDataRef, 1,
+ PyDoc_STR("(MovieExportComponent ci, Handle dataRef, OSType dataRefType, Movie theMovie, Track onlyThisTrack, TimeValue startTime, TimeValue duration) -> (ComponentResult _rv)")},
+ {"MovieExportFromProceduresToDataRef", (PyCFunction)Qt_MovieExportFromProceduresToDataRef, 1,
+ PyDoc_STR("(MovieExportComponent ci, Handle dataRef, OSType dataRefType) -> (ComponentResult _rv)")},
+ {"MovieExportValidate", (PyCFunction)Qt_MovieExportValidate, 1,
+ PyDoc_STR("(MovieExportComponent ci, Movie theMovie, Track onlyThisTrack) -> (ComponentResult _rv, Boolean valid)")},
+ {"MovieExportGetFileNameExtension", (PyCFunction)Qt_MovieExportGetFileNameExtension, 1,
+ PyDoc_STR("(MovieExportComponent ci) -> (ComponentResult _rv, OSType extension)")},
+ {"MovieExportGetShortFileTypeString", (PyCFunction)Qt_MovieExportGetShortFileTypeString, 1,
+ PyDoc_STR("(MovieExportComponent ci, Str255 typeString) -> (ComponentResult _rv)")},
+ {"MovieExportGetSourceMediaType", (PyCFunction)Qt_MovieExportGetSourceMediaType, 1,
+ PyDoc_STR("(MovieExportComponent ci) -> (ComponentResult _rv, OSType mediaType)")},
+ {"TextExportGetTimeFraction", (PyCFunction)Qt_TextExportGetTimeFraction, 1,
+ PyDoc_STR("(TextExportComponent ci) -> (ComponentResult _rv, long movieTimeFraction)")},
+ {"TextExportSetTimeFraction", (PyCFunction)Qt_TextExportSetTimeFraction, 1,
+ PyDoc_STR("(TextExportComponent ci, long movieTimeFraction) -> (ComponentResult _rv)")},
+ {"TextExportGetSettings", (PyCFunction)Qt_TextExportGetSettings, 1,
+ PyDoc_STR("(TextExportComponent ci) -> (ComponentResult _rv, long setting)")},
+ {"TextExportSetSettings", (PyCFunction)Qt_TextExportSetSettings, 1,
+ PyDoc_STR("(TextExportComponent ci, long setting) -> (ComponentResult _rv)")},
+ {"MIDIImportGetSettings", (PyCFunction)Qt_MIDIImportGetSettings, 1,
+ PyDoc_STR("(TextExportComponent ci) -> (ComponentResult _rv, long setting)")},
+ {"MIDIImportSetSettings", (PyCFunction)Qt_MIDIImportSetSettings, 1,
+ PyDoc_STR("(TextExportComponent ci, long setting) -> (ComponentResult _rv)")},
+ {"GraphicsImageImportSetSequenceEnabled", (PyCFunction)Qt_GraphicsImageImportSetSequenceEnabled, 1,
+ PyDoc_STR("(GraphicImageMovieImportComponent ci, Boolean enable) -> (ComponentResult _rv)")},
+ {"GraphicsImageImportGetSequenceEnabled", (PyCFunction)Qt_GraphicsImageImportGetSequenceEnabled, 1,
+ PyDoc_STR("(GraphicImageMovieImportComponent ci) -> (ComponentResult _rv, Boolean enable)")},
+ {"PreviewShowData", (PyCFunction)Qt_PreviewShowData, 1,
+ PyDoc_STR("(pnotComponent p, OSType dataType, Handle data, Rect inHere) -> (ComponentResult _rv)")},
+ {"PreviewMakePreviewReference", (PyCFunction)Qt_PreviewMakePreviewReference, 1,
+ PyDoc_STR("(pnotComponent p, FSSpec sourceFile) -> (ComponentResult _rv, OSType previewType, short resID)")},
+ {"PreviewEvent", (PyCFunction)Qt_PreviewEvent, 1,
+ PyDoc_STR("(pnotComponent p) -> (ComponentResult _rv, EventRecord e, Boolean handledEvent)")},
+ {"DataCodecDecompress", (PyCFunction)Qt_DataCodecDecompress, 1,
+ PyDoc_STR("(DataCodecComponent dc, void * srcData, UInt32 srcSize, void * dstData, UInt32 dstBufferSize) -> (ComponentResult _rv)")},
+ {"DataCodecGetCompressBufferSize", (PyCFunction)Qt_DataCodecGetCompressBufferSize, 1,
+ PyDoc_STR("(DataCodecComponent dc, UInt32 srcSize) -> (ComponentResult _rv, UInt32 dstSize)")},
+ {"DataCodecCompress", (PyCFunction)Qt_DataCodecCompress, 1,
+ PyDoc_STR("(DataCodecComponent dc, void * srcData, UInt32 srcSize, void * dstData, UInt32 dstBufferSize) -> (ComponentResult _rv, UInt32 actualDstSize, UInt32 decompressSlop)")},
+ {"DataCodecBeginInterruptSafe", (PyCFunction)Qt_DataCodecBeginInterruptSafe, 1,
+ PyDoc_STR("(DataCodecComponent dc, unsigned long maxSrcSize) -> (ComponentResult _rv)")},
+ {"DataCodecEndInterruptSafe", (PyCFunction)Qt_DataCodecEndInterruptSafe, 1,
+ PyDoc_STR("(DataCodecComponent dc) -> (ComponentResult _rv)")},
+ {"DataHGetData", (PyCFunction)Qt_DataHGetData, 1,
+ PyDoc_STR("(DataHandler dh, Handle h, long hOffset, long offset, long size) -> (ComponentResult _rv)")},
+ {"DataHPutData", (PyCFunction)Qt_DataHPutData, 1,
+ PyDoc_STR("(DataHandler dh, Handle h, long hOffset, long size) -> (ComponentResult _rv, long offset)")},
+ {"DataHFlushData", (PyCFunction)Qt_DataHFlushData, 1,
+ PyDoc_STR("(DataHandler dh) -> (ComponentResult _rv)")},
+ {"DataHOpenForWrite", (PyCFunction)Qt_DataHOpenForWrite, 1,
+ PyDoc_STR("(DataHandler dh) -> (ComponentResult _rv)")},
+ {"DataHCloseForWrite", (PyCFunction)Qt_DataHCloseForWrite, 1,
+ PyDoc_STR("(DataHandler dh) -> (ComponentResult _rv)")},
+ {"DataHOpenForRead", (PyCFunction)Qt_DataHOpenForRead, 1,
+ PyDoc_STR("(DataHandler dh) -> (ComponentResult _rv)")},
+ {"DataHCloseForRead", (PyCFunction)Qt_DataHCloseForRead, 1,
+ PyDoc_STR("(DataHandler dh) -> (ComponentResult _rv)")},
+ {"DataHSetDataRef", (PyCFunction)Qt_DataHSetDataRef, 1,
+ PyDoc_STR("(DataHandler dh, Handle dataRef) -> (ComponentResult _rv)")},
+ {"DataHGetDataRef", (PyCFunction)Qt_DataHGetDataRef, 1,
+ PyDoc_STR("(DataHandler dh) -> (ComponentResult _rv, Handle dataRef)")},
+ {"DataHCompareDataRef", (PyCFunction)Qt_DataHCompareDataRef, 1,
+ PyDoc_STR("(DataHandler dh, Handle dataRef) -> (ComponentResult _rv, Boolean equal)")},
+ {"DataHTask", (PyCFunction)Qt_DataHTask, 1,
+ PyDoc_STR("(DataHandler dh) -> (ComponentResult _rv)")},
+ {"DataHFinishData", (PyCFunction)Qt_DataHFinishData, 1,
+ PyDoc_STR("(DataHandler dh, Ptr PlaceToPutDataPtr, Boolean Cancel) -> (ComponentResult _rv)")},
+ {"DataHFlushCache", (PyCFunction)Qt_DataHFlushCache, 1,
+ PyDoc_STR("(DataHandler dh) -> (ComponentResult _rv)")},
+ {"DataHResolveDataRef", (PyCFunction)Qt_DataHResolveDataRef, 1,
+ PyDoc_STR("(DataHandler dh, Handle theDataRef, Boolean userInterfaceAllowed) -> (ComponentResult _rv, Boolean wasChanged)")},
+ {"DataHGetFileSize", (PyCFunction)Qt_DataHGetFileSize, 1,
+ PyDoc_STR("(DataHandler dh) -> (ComponentResult _rv, long fileSize)")},
+ {"DataHCanUseDataRef", (PyCFunction)Qt_DataHCanUseDataRef, 1,
+ PyDoc_STR("(DataHandler dh, Handle dataRef) -> (ComponentResult _rv, long useFlags)")},
+ {"DataHPreextend", (PyCFunction)Qt_DataHPreextend, 1,
+ PyDoc_STR("(DataHandler dh, unsigned long maxToAdd) -> (ComponentResult _rv, unsigned long spaceAdded)")},
+ {"DataHSetFileSize", (PyCFunction)Qt_DataHSetFileSize, 1,
+ PyDoc_STR("(DataHandler dh, long fileSize) -> (ComponentResult _rv)")},
+ {"DataHGetFreeSpace", (PyCFunction)Qt_DataHGetFreeSpace, 1,
+ PyDoc_STR("(DataHandler dh) -> (ComponentResult _rv, unsigned long freeSize)")},
+ {"DataHCreateFile", (PyCFunction)Qt_DataHCreateFile, 1,
+ PyDoc_STR("(DataHandler dh, OSType creator, Boolean deleteExisting) -> (ComponentResult _rv)")},
+ {"DataHGetPreferredBlockSize", (PyCFunction)Qt_DataHGetPreferredBlockSize, 1,
+ PyDoc_STR("(DataHandler dh) -> (ComponentResult _rv, long blockSize)")},
+ {"DataHGetDeviceIndex", (PyCFunction)Qt_DataHGetDeviceIndex, 1,
+ PyDoc_STR("(DataHandler dh) -> (ComponentResult _rv, long deviceIndex)")},
+ {"DataHIsStreamingDataHandler", (PyCFunction)Qt_DataHIsStreamingDataHandler, 1,
+ PyDoc_STR("(DataHandler dh) -> (ComponentResult _rv, Boolean yes)")},
+ {"DataHGetDataInBuffer", (PyCFunction)Qt_DataHGetDataInBuffer, 1,
+ PyDoc_STR("(DataHandler dh, long startOffset) -> (ComponentResult _rv, long size)")},
+ {"DataHGetScheduleAheadTime", (PyCFunction)Qt_DataHGetScheduleAheadTime, 1,
+ PyDoc_STR("(DataHandler dh) -> (ComponentResult _rv, long millisecs)")},
+ {"DataHSetCacheSizeLimit", (PyCFunction)Qt_DataHSetCacheSizeLimit, 1,
+ PyDoc_STR("(DataHandler dh, Size cacheSizeLimit) -> (ComponentResult _rv)")},
+ {"DataHGetCacheSizeLimit", (PyCFunction)Qt_DataHGetCacheSizeLimit, 1,
+ PyDoc_STR("(DataHandler dh) -> (ComponentResult _rv, Size cacheSizeLimit)")},
+ {"DataHGetMovie", (PyCFunction)Qt_DataHGetMovie, 1,
+ PyDoc_STR("(DataHandler dh) -> (ComponentResult _rv, Movie theMovie, short id)")},
+ {"DataHAddMovie", (PyCFunction)Qt_DataHAddMovie, 1,
+ PyDoc_STR("(DataHandler dh, Movie theMovie) -> (ComponentResult _rv, short id)")},
+ {"DataHUpdateMovie", (PyCFunction)Qt_DataHUpdateMovie, 1,
+ PyDoc_STR("(DataHandler dh, Movie theMovie, short id) -> (ComponentResult _rv)")},
+ {"DataHDoesBuffer", (PyCFunction)Qt_DataHDoesBuffer, 1,
+ PyDoc_STR("(DataHandler dh) -> (ComponentResult _rv, Boolean buffersReads, Boolean buffersWrites)")},
+ {"DataHGetFileName", (PyCFunction)Qt_DataHGetFileName, 1,
+ PyDoc_STR("(DataHandler dh, Str255 str) -> (ComponentResult _rv)")},
+ {"DataHGetAvailableFileSize", (PyCFunction)Qt_DataHGetAvailableFileSize, 1,
+ PyDoc_STR("(DataHandler dh) -> (ComponentResult _rv, long fileSize)")},
+ {"DataHGetMacOSFileType", (PyCFunction)Qt_DataHGetMacOSFileType, 1,
+ PyDoc_STR("(DataHandler dh) -> (ComponentResult _rv, OSType fileType)")},
+ {"DataHGetMIMEType", (PyCFunction)Qt_DataHGetMIMEType, 1,
+ PyDoc_STR("(DataHandler dh, Str255 mimeType) -> (ComponentResult _rv)")},
+ {"DataHSetDataRefWithAnchor", (PyCFunction)Qt_DataHSetDataRefWithAnchor, 1,
+ PyDoc_STR("(DataHandler dh, Handle anchorDataRef, OSType dataRefType, Handle dataRef) -> (ComponentResult _rv)")},
+ {"DataHGetDataRefWithAnchor", (PyCFunction)Qt_DataHGetDataRefWithAnchor, 1,
+ PyDoc_STR("(DataHandler dh, Handle anchorDataRef, OSType dataRefType) -> (ComponentResult _rv, Handle dataRef)")},
+ {"DataHSetMacOSFileType", (PyCFunction)Qt_DataHSetMacOSFileType, 1,
+ PyDoc_STR("(DataHandler dh, OSType fileType) -> (ComponentResult _rv)")},
+ {"DataHSetTimeBase", (PyCFunction)Qt_DataHSetTimeBase, 1,
+ PyDoc_STR("(DataHandler dh, TimeBase tb) -> (ComponentResult _rv)")},
+ {"DataHGetInfoFlags", (PyCFunction)Qt_DataHGetInfoFlags, 1,
+ PyDoc_STR("(DataHandler dh) -> (ComponentResult _rv, UInt32 flags)")},
+ {"DataHGetFileSize64", (PyCFunction)Qt_DataHGetFileSize64, 1,
+ PyDoc_STR("(DataHandler dh) -> (ComponentResult _rv, wide fileSize)")},
+ {"DataHPreextend64", (PyCFunction)Qt_DataHPreextend64, 1,
+ PyDoc_STR("(DataHandler dh, wide maxToAdd) -> (ComponentResult _rv, wide spaceAdded)")},
+ {"DataHSetFileSize64", (PyCFunction)Qt_DataHSetFileSize64, 1,
+ PyDoc_STR("(DataHandler dh, wide fileSize) -> (ComponentResult _rv)")},
+ {"DataHGetFreeSpace64", (PyCFunction)Qt_DataHGetFreeSpace64, 1,
+ PyDoc_STR("(DataHandler dh) -> (ComponentResult _rv, wide freeSize)")},
+ {"DataHAppend64", (PyCFunction)Qt_DataHAppend64, 1,
+ PyDoc_STR("(DataHandler dh, void * data, unsigned long size) -> (ComponentResult _rv, wide fileOffset)")},
+ {"DataHPollRead", (PyCFunction)Qt_DataHPollRead, 1,
+ PyDoc_STR("(DataHandler dh, void * dataPtr) -> (ComponentResult _rv, UInt32 dataSizeSoFar)")},
+ {"DataHGetDataAvailability", (PyCFunction)Qt_DataHGetDataAvailability, 1,
+ PyDoc_STR("(DataHandler dh, long offset, long len) -> (ComponentResult _rv, long missing_offset, long missing_len)")},
+ {"DataHGetDataRefAsType", (PyCFunction)Qt_DataHGetDataRefAsType, 1,
+ PyDoc_STR("(DataHandler dh, OSType requestedType) -> (ComponentResult _rv, Handle dataRef)")},
+ {"DataHSetDataRefExtension", (PyCFunction)Qt_DataHSetDataRefExtension, 1,
+ PyDoc_STR("(DataHandler dh, Handle extension, OSType idType) -> (ComponentResult _rv)")},
+ {"DataHGetDataRefExtension", (PyCFunction)Qt_DataHGetDataRefExtension, 1,
+ PyDoc_STR("(DataHandler dh, OSType idType) -> (ComponentResult _rv, Handle extension)")},
+ {"DataHGetMovieWithFlags", (PyCFunction)Qt_DataHGetMovieWithFlags, 1,
+ PyDoc_STR("(DataHandler dh, short flags) -> (ComponentResult _rv, Movie theMovie, short id)")},
+ {"DataHGetFileTypeOrdering", (PyCFunction)Qt_DataHGetFileTypeOrdering, 1,
+ PyDoc_STR("(DataHandler dh) -> (ComponentResult _rv, DataHFileTypeOrderingHandle orderingListHandle)")},
+ {"DataHCreateFileWithFlags", (PyCFunction)Qt_DataHCreateFileWithFlags, 1,
+ PyDoc_STR("(DataHandler dh, OSType creator, Boolean deleteExisting, UInt32 flags) -> (ComponentResult _rv)")},
+ {"DataHGetInfo", (PyCFunction)Qt_DataHGetInfo, 1,
+ PyDoc_STR("(DataHandler dh, OSType what, void * info) -> (ComponentResult _rv)")},
+ {"DataHSetIdleManager", (PyCFunction)Qt_DataHSetIdleManager, 1,
+ PyDoc_STR("(DataHandler dh, IdleManager im) -> (ComponentResult _rv)")},
+ {"DataHDeleteFile", (PyCFunction)Qt_DataHDeleteFile, 1,
+ PyDoc_STR("(DataHandler dh) -> (ComponentResult _rv)")},
+ {"DataHSetMovieUsageFlags", (PyCFunction)Qt_DataHSetMovieUsageFlags, 1,
+ PyDoc_STR("(DataHandler dh, long flags) -> (ComponentResult _rv)")},
+ {"DataHUseTemporaryDataRef", (PyCFunction)Qt_DataHUseTemporaryDataRef, 1,
+ PyDoc_STR("(DataHandler dh, long inFlags) -> (ComponentResult _rv)")},
+ {"DataHGetTemporaryDataRefCapabilities", (PyCFunction)Qt_DataHGetTemporaryDataRefCapabilities, 1,
+ PyDoc_STR("(DataHandler dh) -> (ComponentResult _rv, long outUnderstoodFlags)")},
+ {"DataHRenameFile", (PyCFunction)Qt_DataHRenameFile, 1,
+ PyDoc_STR("(DataHandler dh, Handle newDataRef) -> (ComponentResult _rv)")},
+ {"DataHPlaybackHints", (PyCFunction)Qt_DataHPlaybackHints, 1,
+ PyDoc_STR("(DataHandler dh, long flags, unsigned long minFileOffset, unsigned long maxFileOffset, long bytesPerSecond) -> (ComponentResult _rv)")},
+ {"DataHPlaybackHints64", (PyCFunction)Qt_DataHPlaybackHints64, 1,
+ PyDoc_STR("(DataHandler dh, long flags, wide minFileOffset, wide maxFileOffset, long bytesPerSecond) -> (ComponentResult _rv)")},
+ {"DataHGetDataRate", (PyCFunction)Qt_DataHGetDataRate, 1,
+ PyDoc_STR("(DataHandler dh, long flags) -> (ComponentResult _rv, long bytesPerSecond)")},
+ {"DataHSetTimeHints", (PyCFunction)Qt_DataHSetTimeHints, 1,
+ PyDoc_STR("(DataHandler dh, long flags, long bandwidthPriority, TimeScale scale, TimeValue minTime, TimeValue maxTime) -> (ComponentResult _rv)")},
+ {"VDGetMaxSrcRect", (PyCFunction)Qt_VDGetMaxSrcRect, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, short inputStd) -> (ComponentResult _rv, Rect maxSrcRect)")},
+ {"VDGetActiveSrcRect", (PyCFunction)Qt_VDGetActiveSrcRect, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, short inputStd) -> (ComponentResult _rv, Rect activeSrcRect)")},
+ {"VDSetDigitizerRect", (PyCFunction)Qt_VDSetDigitizerRect, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv, Rect digitizerRect)")},
+ {"VDGetDigitizerRect", (PyCFunction)Qt_VDGetDigitizerRect, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv, Rect digitizerRect)")},
+ {"VDGetVBlankRect", (PyCFunction)Qt_VDGetVBlankRect, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, short inputStd) -> (ComponentResult _rv, Rect vBlankRect)")},
+ {"VDGetMaskPixMap", (PyCFunction)Qt_VDGetMaskPixMap, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, PixMapHandle maskPixMap) -> (ComponentResult _rv)")},
+ {"VDUseThisCLUT", (PyCFunction)Qt_VDUseThisCLUT, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, CTabHandle colorTableHandle) -> (ComponentResult _rv)")},
+ {"VDSetInputGammaValue", (PyCFunction)Qt_VDSetInputGammaValue, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, Fixed channel1, Fixed channel2, Fixed channel3) -> (ComponentResult _rv)")},
+ {"VDGetInputGammaValue", (PyCFunction)Qt_VDGetInputGammaValue, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv, Fixed channel1, Fixed channel2, Fixed channel3)")},
+ {"VDSetBrightness", (PyCFunction)Qt_VDSetBrightness, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv, unsigned short brightness)")},
+ {"VDGetBrightness", (PyCFunction)Qt_VDGetBrightness, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv, unsigned short brightness)")},
+ {"VDSetContrast", (PyCFunction)Qt_VDSetContrast, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv, unsigned short contrast)")},
+ {"VDSetHue", (PyCFunction)Qt_VDSetHue, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv, unsigned short hue)")},
+ {"VDSetSharpness", (PyCFunction)Qt_VDSetSharpness, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv, unsigned short sharpness)")},
+ {"VDSetSaturation", (PyCFunction)Qt_VDSetSaturation, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv, unsigned short saturation)")},
+ {"VDGetContrast", (PyCFunction)Qt_VDGetContrast, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv, unsigned short contrast)")},
+ {"VDGetHue", (PyCFunction)Qt_VDGetHue, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv, unsigned short hue)")},
+ {"VDGetSharpness", (PyCFunction)Qt_VDGetSharpness, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv, unsigned short sharpness)")},
+ {"VDGetSaturation", (PyCFunction)Qt_VDGetSaturation, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv, unsigned short saturation)")},
+ {"VDGrabOneFrame", (PyCFunction)Qt_VDGrabOneFrame, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv)")},
+ {"VDGetMaxAuxBuffer", (PyCFunction)Qt_VDGetMaxAuxBuffer, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv, PixMapHandle pm, Rect r)")},
+ {"VDGetCurrentFlags", (PyCFunction)Qt_VDGetCurrentFlags, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv, long inputCurrentFlag, long outputCurrentFlag)")},
+ {"VDSetKeyColor", (PyCFunction)Qt_VDSetKeyColor, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, long index) -> (ComponentResult _rv)")},
+ {"VDGetKeyColor", (PyCFunction)Qt_VDGetKeyColor, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv, long index)")},
+ {"VDAddKeyColor", (PyCFunction)Qt_VDAddKeyColor, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv, long index)")},
+ {"VDGetNextKeyColor", (PyCFunction)Qt_VDGetNextKeyColor, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, long index) -> (ComponentResult _rv)")},
+ {"VDSetKeyColorRange", (PyCFunction)Qt_VDSetKeyColorRange, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv, RGBColor minRGB, RGBColor maxRGB)")},
+ {"VDGetKeyColorRange", (PyCFunction)Qt_VDGetKeyColorRange, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv, RGBColor minRGB, RGBColor maxRGB)")},
+ {"VDSetInputColorSpaceMode", (PyCFunction)Qt_VDSetInputColorSpaceMode, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, short colorSpaceMode) -> (ComponentResult _rv)")},
+ {"VDGetInputColorSpaceMode", (PyCFunction)Qt_VDGetInputColorSpaceMode, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv, short colorSpaceMode)")},
+ {"VDSetClipState", (PyCFunction)Qt_VDSetClipState, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, short clipEnable) -> (ComponentResult _rv)")},
+ {"VDGetClipState", (PyCFunction)Qt_VDGetClipState, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv, short clipEnable)")},
+ {"VDSetClipRgn", (PyCFunction)Qt_VDSetClipRgn, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, RgnHandle clipRegion) -> (ComponentResult _rv)")},
+ {"VDClearClipRgn", (PyCFunction)Qt_VDClearClipRgn, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, RgnHandle clipRegion) -> (ComponentResult _rv)")},
+ {"VDGetCLUTInUse", (PyCFunction)Qt_VDGetCLUTInUse, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv, CTabHandle colorTableHandle)")},
+ {"VDSetPLLFilterType", (PyCFunction)Qt_VDSetPLLFilterType, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, short pllType) -> (ComponentResult _rv)")},
+ {"VDGetPLLFilterType", (PyCFunction)Qt_VDGetPLLFilterType, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv, short pllType)")},
+ {"VDGetMaskandValue", (PyCFunction)Qt_VDGetMaskandValue, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, unsigned short blendLevel) -> (ComponentResult _rv, long mask, long value)")},
+ {"VDSetMasterBlendLevel", (PyCFunction)Qt_VDSetMasterBlendLevel, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv, unsigned short blendLevel)")},
+ {"VDSetPlayThruOnOff", (PyCFunction)Qt_VDSetPlayThruOnOff, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, short state) -> (ComponentResult _rv)")},
+ {"VDSetFieldPreference", (PyCFunction)Qt_VDSetFieldPreference, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, short fieldFlag) -> (ComponentResult _rv)")},
+ {"VDGetFieldPreference", (PyCFunction)Qt_VDGetFieldPreference, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv, short fieldFlag)")},
+ {"VDPreflightGlobalRect", (PyCFunction)Qt_VDPreflightGlobalRect, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, GrafPtr theWindow) -> (ComponentResult _rv, Rect globalRect)")},
+ {"VDSetPlayThruGlobalRect", (PyCFunction)Qt_VDSetPlayThruGlobalRect, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, GrafPtr theWindow) -> (ComponentResult _rv, Rect globalRect)")},
+ {"VDSetBlackLevelValue", (PyCFunction)Qt_VDSetBlackLevelValue, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv, unsigned short blackLevel)")},
+ {"VDGetBlackLevelValue", (PyCFunction)Qt_VDGetBlackLevelValue, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv, unsigned short blackLevel)")},
+ {"VDSetWhiteLevelValue", (PyCFunction)Qt_VDSetWhiteLevelValue, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv, unsigned short whiteLevel)")},
+ {"VDGetWhiteLevelValue", (PyCFunction)Qt_VDGetWhiteLevelValue, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv, unsigned short whiteLevel)")},
+ {"VDGetVideoDefaults", (PyCFunction)Qt_VDGetVideoDefaults, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv, unsigned short blackLevel, unsigned short whiteLevel, unsigned short brightness, unsigned short hue, unsigned short saturation, unsigned short contrast, unsigned short sharpness)")},
+ {"VDGetNumberOfInputs", (PyCFunction)Qt_VDGetNumberOfInputs, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv, short inputs)")},
+ {"VDGetInputFormat", (PyCFunction)Qt_VDGetInputFormat, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, short input) -> (ComponentResult _rv, short format)")},
+ {"VDSetInput", (PyCFunction)Qt_VDSetInput, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, short input) -> (ComponentResult _rv)")},
+ {"VDGetInput", (PyCFunction)Qt_VDGetInput, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv, short input)")},
+ {"VDSetInputStandard", (PyCFunction)Qt_VDSetInputStandard, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, short inputStandard) -> (ComponentResult _rv)")},
+ {"VDSetupBuffers", (PyCFunction)Qt_VDSetupBuffers, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, VdigBufferRecListHandle bufferList) -> (ComponentResult _rv)")},
+ {"VDGrabOneFrameAsync", (PyCFunction)Qt_VDGrabOneFrameAsync, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, short buffer) -> (ComponentResult _rv)")},
+ {"VDDone", (PyCFunction)Qt_VDDone, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, short buffer) -> (ComponentResult _rv)")},
+ {"VDSetCompression", (PyCFunction)Qt_VDSetCompression, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, OSType compressType, short depth, CodecQ spatialQuality, CodecQ temporalQuality, long keyFrameRate) -> (ComponentResult _rv, Rect bounds)")},
+ {"VDCompressOneFrameAsync", (PyCFunction)Qt_VDCompressOneFrameAsync, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv)")},
+ {"VDGetImageDescription", (PyCFunction)Qt_VDGetImageDescription, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, ImageDescriptionHandle desc) -> (ComponentResult _rv)")},
+ {"VDResetCompressSequence", (PyCFunction)Qt_VDResetCompressSequence, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv)")},
+ {"VDSetCompressionOnOff", (PyCFunction)Qt_VDSetCompressionOnOff, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, Boolean state) -> (ComponentResult _rv)")},
+ {"VDGetCompressionTypes", (PyCFunction)Qt_VDGetCompressionTypes, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, VDCompressionListHandle h) -> (ComponentResult _rv)")},
+ {"VDSetTimeBase", (PyCFunction)Qt_VDSetTimeBase, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, TimeBase t) -> (ComponentResult _rv)")},
+ {"VDSetFrameRate", (PyCFunction)Qt_VDSetFrameRate, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, Fixed framesPerSecond) -> (ComponentResult _rv)")},
+ {"VDGetDataRate", (PyCFunction)Qt_VDGetDataRate, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv, long milliSecPerFrame, Fixed framesPerSecond, long bytesPerSecond)")},
+ {"VDGetSoundInputDriver", (PyCFunction)Qt_VDGetSoundInputDriver, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, Str255 soundDriverName) -> (ComponentResult _rv)")},
+ {"VDGetDMADepths", (PyCFunction)Qt_VDGetDMADepths, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv, long depthArray, long preferredDepth)")},
+ {"VDGetPreferredTimeScale", (PyCFunction)Qt_VDGetPreferredTimeScale, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv, TimeScale preferred)")},
+ {"VDReleaseAsyncBuffers", (PyCFunction)Qt_VDReleaseAsyncBuffers, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv)")},
+ {"VDSetDataRate", (PyCFunction)Qt_VDSetDataRate, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, long bytesPerSecond) -> (ComponentResult _rv)")},
+ {"VDGetTimeCode", (PyCFunction)Qt_VDGetTimeCode, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, void * timeCodeFormat, void * timeCodeTime) -> (ComponentResult _rv, TimeRecord atTime)")},
+ {"VDUseSafeBuffers", (PyCFunction)Qt_VDUseSafeBuffers, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, Boolean useSafeBuffers) -> (ComponentResult _rv)")},
+ {"VDGetSoundInputSource", (PyCFunction)Qt_VDGetSoundInputSource, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, long videoInput) -> (ComponentResult _rv, long soundInput)")},
+ {"VDGetCompressionTime", (PyCFunction)Qt_VDGetCompressionTime, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, OSType compressionType, short depth) -> (ComponentResult _rv, Rect srcRect, CodecQ spatialQuality, CodecQ temporalQuality, unsigned long compressTime)")},
+ {"VDSetPreferredPacketSize", (PyCFunction)Qt_VDSetPreferredPacketSize, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, long preferredPacketSizeInBytes) -> (ComponentResult _rv)")},
+ {"VDSetPreferredImageDimensions", (PyCFunction)Qt_VDSetPreferredImageDimensions, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, long width, long height) -> (ComponentResult _rv)")},
+ {"VDGetPreferredImageDimensions", (PyCFunction)Qt_VDGetPreferredImageDimensions, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci) -> (ComponentResult _rv, long width, long height)")},
+ {"VDGetInputName", (PyCFunction)Qt_VDGetInputName, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, long videoInput, Str255 name) -> (ComponentResult _rv)")},
+ {"VDSetDestinationPort", (PyCFunction)Qt_VDSetDestinationPort, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, CGrafPtr destPort) -> (ComponentResult _rv)")},
+ {"VDGetDeviceNameAndFlags", (PyCFunction)Qt_VDGetDeviceNameAndFlags, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, Str255 outName) -> (ComponentResult _rv, UInt32 outNameFlags)")},
+ {"VDCaptureStateChanging", (PyCFunction)Qt_VDCaptureStateChanging, 1,
+ PyDoc_STR("(VideoDigitizerComponent ci, UInt32 inStateFlags) -> (ComponentResult _rv)")},
+ {"XMLParseGetDetailedParseError", (PyCFunction)Qt_XMLParseGetDetailedParseError, 1,
+ PyDoc_STR("(ComponentInstance aParser, StringPtr errDesc) -> (ComponentResult _rv, long errorLine)")},
+ {"XMLParseAddElement", (PyCFunction)Qt_XMLParseAddElement, 1,
+ PyDoc_STR("(ComponentInstance aParser, UInt32 nameSpaceID, long elementFlags) -> (ComponentResult _rv, char elementName, UInt32 elementID)")},
+ {"XMLParseAddAttribute", (PyCFunction)Qt_XMLParseAddAttribute, 1,
+ PyDoc_STR("(ComponentInstance aParser, UInt32 elementID, UInt32 nameSpaceID) -> (ComponentResult _rv, char attributeName, UInt32 attributeID)")},
+ {"XMLParseAddMultipleAttributes", (PyCFunction)Qt_XMLParseAddMultipleAttributes, 1,
+ PyDoc_STR("(ComponentInstance aParser, UInt32 elementID) -> (ComponentResult _rv, UInt32 nameSpaceIDs, char attributeNames, UInt32 attributeIDs)")},
+ {"XMLParseAddAttributeAndValue", (PyCFunction)Qt_XMLParseAddAttributeAndValue, 1,
+ PyDoc_STR("(ComponentInstance aParser, UInt32 elementID, UInt32 nameSpaceID, UInt32 attributeValueKind, void * attributeValueKindInfo) -> (ComponentResult _rv, char attributeName, UInt32 attributeID)")},
+ {"XMLParseAddAttributeValueKind", (PyCFunction)Qt_XMLParseAddAttributeValueKind, 1,
+ PyDoc_STR("(ComponentInstance aParser, UInt32 elementID, UInt32 attributeID, UInt32 attributeValueKind, void * attributeValueKindInfo) -> (ComponentResult _rv)")},
+ {"XMLParseAddNameSpace", (PyCFunction)Qt_XMLParseAddNameSpace, 1,
+ PyDoc_STR("(ComponentInstance aParser) -> (ComponentResult _rv, char nameSpaceURL, UInt32 nameSpaceID)")},
+ {"XMLParseSetOffsetAndLimit", (PyCFunction)Qt_XMLParseSetOffsetAndLimit, 1,
+ PyDoc_STR("(ComponentInstance aParser, UInt32 offset, UInt32 limit) -> (ComponentResult _rv)")},
+ {"XMLParseSetEventParseRefCon", (PyCFunction)Qt_XMLParseSetEventParseRefCon, 1,
+ PyDoc_STR("(ComponentInstance aParser, long refcon) -> (ComponentResult _rv)")},
+ {"SGInitialize", (PyCFunction)Qt_SGInitialize, 1,
+ PyDoc_STR("(SeqGrabComponent s) -> (ComponentResult _rv)")},
+ {"SGSetDataOutput", (PyCFunction)Qt_SGSetDataOutput, 1,
+ PyDoc_STR("(SeqGrabComponent s, FSSpec movieFile, long whereFlags) -> (ComponentResult _rv)")},
+ {"SGGetDataOutput", (PyCFunction)Qt_SGGetDataOutput, 1,
+ PyDoc_STR("(SeqGrabComponent s, FSSpec movieFile) -> (ComponentResult _rv, long whereFlags)")},
+ {"SGSetGWorld", (PyCFunction)Qt_SGSetGWorld, 1,
+ PyDoc_STR("(SeqGrabComponent s, CGrafPtr gp, GDHandle gd) -> (ComponentResult _rv)")},
+ {"SGGetGWorld", (PyCFunction)Qt_SGGetGWorld, 1,
+ PyDoc_STR("(SeqGrabComponent s) -> (ComponentResult _rv, CGrafPtr gp, GDHandle gd)")},
+ {"SGNewChannel", (PyCFunction)Qt_SGNewChannel, 1,
+ PyDoc_STR("(SeqGrabComponent s, OSType channelType) -> (ComponentResult _rv, SGChannel ref)")},
+ {"SGDisposeChannel", (PyCFunction)Qt_SGDisposeChannel, 1,
+ PyDoc_STR("(SeqGrabComponent s, SGChannel c) -> (ComponentResult _rv)")},
+ {"SGStartPreview", (PyCFunction)Qt_SGStartPreview, 1,
+ PyDoc_STR("(SeqGrabComponent s) -> (ComponentResult _rv)")},
+ {"SGStartRecord", (PyCFunction)Qt_SGStartRecord, 1,
+ PyDoc_STR("(SeqGrabComponent s) -> (ComponentResult _rv)")},
+ {"SGIdle", (PyCFunction)Qt_SGIdle, 1,
+ PyDoc_STR("(SeqGrabComponent s) -> (ComponentResult _rv)")},
+ {"SGStop", (PyCFunction)Qt_SGStop, 1,
+ PyDoc_STR("(SeqGrabComponent s) -> (ComponentResult _rv)")},
+ {"SGPause", (PyCFunction)Qt_SGPause, 1,
+ PyDoc_STR("(SeqGrabComponent s, Boolean pause) -> (ComponentResult _rv)")},
+ {"SGPrepare", (PyCFunction)Qt_SGPrepare, 1,
+ PyDoc_STR("(SeqGrabComponent s, Boolean prepareForPreview, Boolean prepareForRecord) -> (ComponentResult _rv)")},
+ {"SGRelease", (PyCFunction)Qt_SGRelease, 1,
+ PyDoc_STR("(SeqGrabComponent s) -> (ComponentResult _rv)")},
+ {"SGGetMovie", (PyCFunction)Qt_SGGetMovie, 1,
+ PyDoc_STR("(SeqGrabComponent s) -> (Movie _rv)")},
+ {"SGSetMaximumRecordTime", (PyCFunction)Qt_SGSetMaximumRecordTime, 1,
+ PyDoc_STR("(SeqGrabComponent s, unsigned long ticks) -> (ComponentResult _rv)")},
+ {"SGGetMaximumRecordTime", (PyCFunction)Qt_SGGetMaximumRecordTime, 1,
+ PyDoc_STR("(SeqGrabComponent s) -> (ComponentResult _rv, unsigned long ticks)")},
+ {"SGGetStorageSpaceRemaining", (PyCFunction)Qt_SGGetStorageSpaceRemaining, 1,
+ PyDoc_STR("(SeqGrabComponent s) -> (ComponentResult _rv, unsigned long bytes)")},
+ {"SGGetTimeRemaining", (PyCFunction)Qt_SGGetTimeRemaining, 1,
+ PyDoc_STR("(SeqGrabComponent s) -> (ComponentResult _rv, long ticksLeft)")},
+ {"SGGrabPict", (PyCFunction)Qt_SGGrabPict, 1,
+ PyDoc_STR("(SeqGrabComponent s, Rect bounds, short offscreenDepth, long grabPictFlags) -> (ComponentResult _rv, PicHandle p)")},
+ {"SGGetLastMovieResID", (PyCFunction)Qt_SGGetLastMovieResID, 1,
+ PyDoc_STR("(SeqGrabComponent s) -> (ComponentResult _rv, short resID)")},
+ {"SGSetFlags", (PyCFunction)Qt_SGSetFlags, 1,
+ PyDoc_STR("(SeqGrabComponent s, long sgFlags) -> (ComponentResult _rv)")},
+ {"SGGetFlags", (PyCFunction)Qt_SGGetFlags, 1,
+ PyDoc_STR("(SeqGrabComponent s) -> (ComponentResult _rv, long sgFlags)")},
+ {"SGNewChannelFromComponent", (PyCFunction)Qt_SGNewChannelFromComponent, 1,
+ PyDoc_STR("(SeqGrabComponent s, Component sgChannelComponent) -> (ComponentResult _rv, SGChannel newChannel)")},
+ {"SGSetSettings", (PyCFunction)Qt_SGSetSettings, 1,
+ PyDoc_STR("(SeqGrabComponent s, UserData ud, long flags) -> (ComponentResult _rv)")},
+ {"SGGetSettings", (PyCFunction)Qt_SGGetSettings, 1,
+ PyDoc_STR("(SeqGrabComponent s, long flags) -> (ComponentResult _rv, UserData ud)")},
+ {"SGGetIndChannel", (PyCFunction)Qt_SGGetIndChannel, 1,
+ PyDoc_STR("(SeqGrabComponent s, short index) -> (ComponentResult _rv, SGChannel ref, OSType chanType)")},
+ {"SGUpdate", (PyCFunction)Qt_SGUpdate, 1,
+ PyDoc_STR("(SeqGrabComponent s, RgnHandle updateRgn) -> (ComponentResult _rv)")},
+ {"SGGetPause", (PyCFunction)Qt_SGGetPause, 1,
+ PyDoc_STR("(SeqGrabComponent s) -> (ComponentResult _rv, Boolean paused)")},
+ {"SGSetChannelSettings", (PyCFunction)Qt_SGSetChannelSettings, 1,
+ PyDoc_STR("(SeqGrabComponent s, SGChannel c, UserData ud, long flags) -> (ComponentResult _rv)")},
+ {"SGGetChannelSettings", (PyCFunction)Qt_SGGetChannelSettings, 1,
+ PyDoc_STR("(SeqGrabComponent s, SGChannel c, long flags) -> (ComponentResult _rv, UserData ud)")},
+ {"SGGetMode", (PyCFunction)Qt_SGGetMode, 1,
+ PyDoc_STR("(SeqGrabComponent s) -> (ComponentResult _rv, Boolean previewMode, Boolean recordMode)")},
+ {"SGSetDataRef", (PyCFunction)Qt_SGSetDataRef, 1,
+ PyDoc_STR("(SeqGrabComponent s, Handle dataRef, OSType dataRefType, long whereFlags) -> (ComponentResult _rv)")},
+ {"SGGetDataRef", (PyCFunction)Qt_SGGetDataRef, 1,
+ PyDoc_STR("(SeqGrabComponent s) -> (ComponentResult _rv, Handle dataRef, OSType dataRefType, long whereFlags)")},
+ {"SGNewOutput", (PyCFunction)Qt_SGNewOutput, 1,
+ PyDoc_STR("(SeqGrabComponent s, Handle dataRef, OSType dataRefType, long whereFlags) -> (ComponentResult _rv, SGOutput sgOut)")},
+ {"SGDisposeOutput", (PyCFunction)Qt_SGDisposeOutput, 1,
+ PyDoc_STR("(SeqGrabComponent s, SGOutput sgOut) -> (ComponentResult _rv)")},
+ {"SGSetOutputFlags", (PyCFunction)Qt_SGSetOutputFlags, 1,
+ PyDoc_STR("(SeqGrabComponent s, SGOutput sgOut, long whereFlags) -> (ComponentResult _rv)")},
+ {"SGSetChannelOutput", (PyCFunction)Qt_SGSetChannelOutput, 1,
+ PyDoc_STR("(SeqGrabComponent s, SGChannel c, SGOutput sgOut) -> (ComponentResult _rv)")},
+ {"SGGetDataOutputStorageSpaceRemaining", (PyCFunction)Qt_SGGetDataOutputStorageSpaceRemaining, 1,
+ PyDoc_STR("(SeqGrabComponent s, SGOutput sgOut) -> (ComponentResult _rv, unsigned long space)")},
+ {"SGHandleUpdateEvent", (PyCFunction)Qt_SGHandleUpdateEvent, 1,
+ PyDoc_STR("(SeqGrabComponent s, EventRecord event) -> (ComponentResult _rv, Boolean handled)")},
+ {"SGSetOutputNextOutput", (PyCFunction)Qt_SGSetOutputNextOutput, 1,
+ PyDoc_STR("(SeqGrabComponent s, SGOutput sgOut, SGOutput nextOut) -> (ComponentResult _rv)")},
+ {"SGGetOutputNextOutput", (PyCFunction)Qt_SGGetOutputNextOutput, 1,
+ PyDoc_STR("(SeqGrabComponent s, SGOutput sgOut) -> (ComponentResult _rv, SGOutput nextOut)")},
+ {"SGSetOutputMaximumOffset", (PyCFunction)Qt_SGSetOutputMaximumOffset, 1,
+ PyDoc_STR("(SeqGrabComponent s, SGOutput sgOut, wide maxOffset) -> (ComponentResult _rv)")},
+ {"SGGetOutputMaximumOffset", (PyCFunction)Qt_SGGetOutputMaximumOffset, 1,
+ PyDoc_STR("(SeqGrabComponent s, SGOutput sgOut) -> (ComponentResult _rv, wide maxOffset)")},
+ {"SGGetOutputDataReference", (PyCFunction)Qt_SGGetOutputDataReference, 1,
+ PyDoc_STR("(SeqGrabComponent s, SGOutput sgOut) -> (ComponentResult _rv, Handle dataRef, OSType dataRefType)")},
+ {"SGWriteExtendedMovieData", (PyCFunction)Qt_SGWriteExtendedMovieData, 1,
+ PyDoc_STR("(SeqGrabComponent s, SGChannel c, Ptr p, long len) -> (ComponentResult _rv, wide offset, SGOutput sgOut)")},
+ {"SGGetStorageSpaceRemaining64", (PyCFunction)Qt_SGGetStorageSpaceRemaining64, 1,
+ PyDoc_STR("(SeqGrabComponent s) -> (ComponentResult _rv, wide bytes)")},
+ {"SGGetDataOutputStorageSpaceRemaining64", (PyCFunction)Qt_SGGetDataOutputStorageSpaceRemaining64, 1,
+ PyDoc_STR("(SeqGrabComponent s, SGOutput sgOut) -> (ComponentResult _rv, wide space)")},
+ {"SGWriteMovieData", (PyCFunction)Qt_SGWriteMovieData, 1,
+ PyDoc_STR("(SeqGrabComponent s, SGChannel c, Ptr p, long len) -> (ComponentResult _rv, long offset)")},
+ {"SGGetTimeBase", (PyCFunction)Qt_SGGetTimeBase, 1,
+ PyDoc_STR("(SeqGrabComponent s) -> (ComponentResult _rv, TimeBase tb)")},
+ {"SGAddMovieData", (PyCFunction)Qt_SGAddMovieData, 1,
+ PyDoc_STR("(SeqGrabComponent s, SGChannel c, Ptr p, long len, long chRefCon, TimeValue time, short writeType) -> (ComponentResult _rv, long offset)")},
+ {"SGChangedSource", (PyCFunction)Qt_SGChangedSource, 1,
+ PyDoc_STR("(SeqGrabComponent s, SGChannel c) -> (ComponentResult _rv)")},
+ {"SGAddExtendedMovieData", (PyCFunction)Qt_SGAddExtendedMovieData, 1,
+ PyDoc_STR("(SeqGrabComponent s, SGChannel c, Ptr p, long len, long chRefCon, TimeValue time, short writeType) -> (ComponentResult _rv, wide offset, SGOutput whichOutput)")},
+ {"SGAddOutputDataRefToMedia", (PyCFunction)Qt_SGAddOutputDataRefToMedia, 1,
+ PyDoc_STR("(SeqGrabComponent s, SGOutput sgOut, Media theMedia, SampleDescriptionHandle desc) -> (ComponentResult _rv)")},
+ {"SGSetSettingsSummary", (PyCFunction)Qt_SGSetSettingsSummary, 1,
+ PyDoc_STR("(SeqGrabComponent s, Handle summaryText) -> (ComponentResult _rv)")},
+ {"SGSetChannelUsage", (PyCFunction)Qt_SGSetChannelUsage, 1,
+ PyDoc_STR("(SGChannel c, long usage) -> (ComponentResult _rv)")},
+ {"SGGetChannelUsage", (PyCFunction)Qt_SGGetChannelUsage, 1,
+ PyDoc_STR("(SGChannel c) -> (ComponentResult _rv, long usage)")},
+ {"SGSetChannelBounds", (PyCFunction)Qt_SGSetChannelBounds, 1,
+ PyDoc_STR("(SGChannel c, Rect bounds) -> (ComponentResult _rv)")},
+ {"SGGetChannelBounds", (PyCFunction)Qt_SGGetChannelBounds, 1,
+ PyDoc_STR("(SGChannel c) -> (ComponentResult _rv, Rect bounds)")},
+ {"SGSetChannelVolume", (PyCFunction)Qt_SGSetChannelVolume, 1,
+ PyDoc_STR("(SGChannel c, short volume) -> (ComponentResult _rv)")},
+ {"SGGetChannelVolume", (PyCFunction)Qt_SGGetChannelVolume, 1,
+ PyDoc_STR("(SGChannel c) -> (ComponentResult _rv, short volume)")},
+ {"SGGetChannelInfo", (PyCFunction)Qt_SGGetChannelInfo, 1,
+ PyDoc_STR("(SGChannel c) -> (ComponentResult _rv, long channelInfo)")},
+ {"SGSetChannelPlayFlags", (PyCFunction)Qt_SGSetChannelPlayFlags, 1,
+ PyDoc_STR("(SGChannel c, long playFlags) -> (ComponentResult _rv)")},
+ {"SGGetChannelPlayFlags", (PyCFunction)Qt_SGGetChannelPlayFlags, 1,
+ PyDoc_STR("(SGChannel c) -> (ComponentResult _rv, long playFlags)")},
+ {"SGSetChannelMaxFrames", (PyCFunction)Qt_SGSetChannelMaxFrames, 1,
+ PyDoc_STR("(SGChannel c, long frameCount) -> (ComponentResult _rv)")},
+ {"SGGetChannelMaxFrames", (PyCFunction)Qt_SGGetChannelMaxFrames, 1,
+ PyDoc_STR("(SGChannel c) -> (ComponentResult _rv, long frameCount)")},
+ {"SGSetChannelRefCon", (PyCFunction)Qt_SGSetChannelRefCon, 1,
+ PyDoc_STR("(SGChannel c, long refCon) -> (ComponentResult _rv)")},
+ {"SGSetChannelClip", (PyCFunction)Qt_SGSetChannelClip, 1,
+ PyDoc_STR("(SGChannel c, RgnHandle theClip) -> (ComponentResult _rv)")},
+ {"SGGetChannelClip", (PyCFunction)Qt_SGGetChannelClip, 1,
+ PyDoc_STR("(SGChannel c) -> (ComponentResult _rv, RgnHandle theClip)")},
+ {"SGGetChannelSampleDescription", (PyCFunction)Qt_SGGetChannelSampleDescription, 1,
+ PyDoc_STR("(SGChannel c, Handle sampleDesc) -> (ComponentResult _rv)")},
+ {"SGSetChannelDevice", (PyCFunction)Qt_SGSetChannelDevice, 1,
+ PyDoc_STR("(SGChannel c, StringPtr name) -> (ComponentResult _rv)")},
+ {"SGGetChannelTimeScale", (PyCFunction)Qt_SGGetChannelTimeScale, 1,
+ PyDoc_STR("(SGChannel c) -> (ComponentResult _rv, TimeScale scale)")},
+ {"SGChannelPutPicture", (PyCFunction)Qt_SGChannelPutPicture, 1,
+ PyDoc_STR("(SGChannel c) -> (ComponentResult _rv)")},
+ {"SGChannelSetRequestedDataRate", (PyCFunction)Qt_SGChannelSetRequestedDataRate, 1,
+ PyDoc_STR("(SGChannel c, long bytesPerSecond) -> (ComponentResult _rv)")},
+ {"SGChannelGetRequestedDataRate", (PyCFunction)Qt_SGChannelGetRequestedDataRate, 1,
+ PyDoc_STR("(SGChannel c) -> (ComponentResult _rv, long bytesPerSecond)")},
+ {"SGChannelSetDataSourceName", (PyCFunction)Qt_SGChannelSetDataSourceName, 1,
+ PyDoc_STR("(SGChannel c, Str255 name, ScriptCode scriptTag) -> (ComponentResult _rv)")},
+ {"SGChannelGetDataSourceName", (PyCFunction)Qt_SGChannelGetDataSourceName, 1,
+ PyDoc_STR("(SGChannel c, Str255 name) -> (ComponentResult _rv, ScriptCode scriptTag)")},
+ {"SGChannelSetCodecSettings", (PyCFunction)Qt_SGChannelSetCodecSettings, 1,
+ PyDoc_STR("(SGChannel c, Handle settings) -> (ComponentResult _rv)")},
+ {"SGChannelGetCodecSettings", (PyCFunction)Qt_SGChannelGetCodecSettings, 1,
+ PyDoc_STR("(SGChannel c) -> (ComponentResult _rv, Handle settings)")},
+ {"SGGetChannelTimeBase", (PyCFunction)Qt_SGGetChannelTimeBase, 1,
+ PyDoc_STR("(SGChannel c) -> (ComponentResult _rv, TimeBase tb)")},
+ {"SGGetChannelRefCon", (PyCFunction)Qt_SGGetChannelRefCon, 1,
+ PyDoc_STR("(SGChannel c) -> (ComponentResult _rv, long refCon)")},
+ {"SGGetChannelDeviceAndInputNames", (PyCFunction)Qt_SGGetChannelDeviceAndInputNames, 1,
+ PyDoc_STR("(SGChannel c, Str255 outDeviceName, Str255 outInputName) -> (ComponentResult _rv, short outInputNumber)")},
+ {"SGSetChannelDeviceInput", (PyCFunction)Qt_SGSetChannelDeviceInput, 1,
+ PyDoc_STR("(SGChannel c, short inInputNumber) -> (ComponentResult _rv)")},
+ {"SGSetChannelSettingsStateChanging", (PyCFunction)Qt_SGSetChannelSettingsStateChanging, 1,
+ PyDoc_STR("(SGChannel c, UInt32 inFlags) -> (ComponentResult _rv)")},
+ {"SGInitChannel", (PyCFunction)Qt_SGInitChannel, 1,
+ PyDoc_STR("(SGChannel c, SeqGrabComponent owner) -> (ComponentResult _rv)")},
+ {"SGWriteSamples", (PyCFunction)Qt_SGWriteSamples, 1,
+ PyDoc_STR("(SGChannel c, Movie m, AliasHandle theFile) -> (ComponentResult _rv)")},
+ {"SGGetDataRate", (PyCFunction)Qt_SGGetDataRate, 1,
+ PyDoc_STR("(SGChannel c) -> (ComponentResult _rv, long bytesPerSecond)")},
+ {"SGAlignChannelRect", (PyCFunction)Qt_SGAlignChannelRect, 1,
+ PyDoc_STR("(SGChannel c) -> (ComponentResult _rv, Rect r)")},
+ {"SGPanelGetDitl", (PyCFunction)Qt_SGPanelGetDitl, 1,
+ PyDoc_STR("(SeqGrabComponent s) -> (ComponentResult _rv, Handle ditl)")},
+ {"SGPanelGetTitle", (PyCFunction)Qt_SGPanelGetTitle, 1,
+ PyDoc_STR("(SeqGrabComponent s, Str255 title) -> (ComponentResult _rv)")},
+ {"SGPanelCanRun", (PyCFunction)Qt_SGPanelCanRun, 1,
+ PyDoc_STR("(SeqGrabComponent s, SGChannel c) -> (ComponentResult _rv)")},
+ {"SGPanelInstall", (PyCFunction)Qt_SGPanelInstall, 1,
+ PyDoc_STR("(SeqGrabComponent s, SGChannel c, DialogPtr d, short itemOffset) -> (ComponentResult _rv)")},
+ {"SGPanelEvent", (PyCFunction)Qt_SGPanelEvent, 1,
+ PyDoc_STR("(SeqGrabComponent s, SGChannel c, DialogPtr d, short itemOffset, EventRecord theEvent) -> (ComponentResult _rv, short itemHit, Boolean handled)")},
+ {"SGPanelItem", (PyCFunction)Qt_SGPanelItem, 1,
+ PyDoc_STR("(SeqGrabComponent s, SGChannel c, DialogPtr d, short itemOffset, short itemNum) -> (ComponentResult _rv)")},
+ {"SGPanelRemove", (PyCFunction)Qt_SGPanelRemove, 1,
+ PyDoc_STR("(SeqGrabComponent s, SGChannel c, DialogPtr d, short itemOffset) -> (ComponentResult _rv)")},
+ {"SGPanelSetGrabber", (PyCFunction)Qt_SGPanelSetGrabber, 1,
+ PyDoc_STR("(SeqGrabComponent s, SeqGrabComponent sg) -> (ComponentResult _rv)")},
+ {"SGPanelSetResFile", (PyCFunction)Qt_SGPanelSetResFile, 1,
+ PyDoc_STR("(SeqGrabComponent s, short resRef) -> (ComponentResult _rv)")},
+ {"SGPanelGetSettings", (PyCFunction)Qt_SGPanelGetSettings, 1,
+ PyDoc_STR("(SeqGrabComponent s, SGChannel c, long flags) -> (ComponentResult _rv, UserData ud)")},
+ {"SGPanelSetSettings", (PyCFunction)Qt_SGPanelSetSettings, 1,
+ PyDoc_STR("(SeqGrabComponent s, SGChannel c, UserData ud, long flags) -> (ComponentResult _rv)")},
+ {"SGPanelValidateInput", (PyCFunction)Qt_SGPanelValidateInput, 1,
+ PyDoc_STR("(SeqGrabComponent s) -> (ComponentResult _rv, Boolean ok)")},
+ {"SGPanelGetDITLForSize", (PyCFunction)Qt_SGPanelGetDITLForSize, 1,
+ PyDoc_STR("(SeqGrabComponent s) -> (ComponentResult _rv, Handle ditl, Point requestedSize)")},
+ {"SGGetSrcVideoBounds", (PyCFunction)Qt_SGGetSrcVideoBounds, 1,
+ PyDoc_STR("(SGChannel c) -> (ComponentResult _rv, Rect r)")},
+ {"SGSetVideoRect", (PyCFunction)Qt_SGSetVideoRect, 1,
+ PyDoc_STR("(SGChannel c, Rect r) -> (ComponentResult _rv)")},
+ {"SGGetVideoRect", (PyCFunction)Qt_SGGetVideoRect, 1,
+ PyDoc_STR("(SGChannel c) -> (ComponentResult _rv, Rect r)")},
+ {"SGGetVideoCompressorType", (PyCFunction)Qt_SGGetVideoCompressorType, 1,
+ PyDoc_STR("(SGChannel c) -> (ComponentResult _rv, OSType compressorType)")},
+ {"SGSetVideoCompressorType", (PyCFunction)Qt_SGSetVideoCompressorType, 1,
+ PyDoc_STR("(SGChannel c, OSType compressorType) -> (ComponentResult _rv)")},
+ {"SGSetVideoCompressor", (PyCFunction)Qt_SGSetVideoCompressor, 1,
+ PyDoc_STR("(SGChannel c, short depth, CompressorComponent compressor, CodecQ spatialQuality, CodecQ temporalQuality, long keyFrameRate) -> (ComponentResult _rv)")},
+ {"SGGetVideoCompressor", (PyCFunction)Qt_SGGetVideoCompressor, 1,
+ PyDoc_STR("(SGChannel c) -> (ComponentResult _rv, short depth, CompressorComponent compressor, CodecQ spatialQuality, CodecQ temporalQuality, long keyFrameRate)")},
+ {"SGGetVideoDigitizerComponent", (PyCFunction)Qt_SGGetVideoDigitizerComponent, 1,
+ PyDoc_STR("(SGChannel c) -> (ComponentInstance _rv)")},
+ {"SGSetVideoDigitizerComponent", (PyCFunction)Qt_SGSetVideoDigitizerComponent, 1,
+ PyDoc_STR("(SGChannel c, ComponentInstance vdig) -> (ComponentResult _rv)")},
+ {"SGVideoDigitizerChanged", (PyCFunction)Qt_SGVideoDigitizerChanged, 1,
+ PyDoc_STR("(SGChannel c) -> (ComponentResult _rv)")},
+ {"SGGrabFrame", (PyCFunction)Qt_SGGrabFrame, 1,
+ PyDoc_STR("(SGChannel c, short bufferNum) -> (ComponentResult _rv)")},
+ {"SGGrabFrameComplete", (PyCFunction)Qt_SGGrabFrameComplete, 1,
+ PyDoc_STR("(SGChannel c, short bufferNum) -> (ComponentResult _rv, Boolean done)")},
+ {"SGCompressFrame", (PyCFunction)Qt_SGCompressFrame, 1,
+ PyDoc_STR("(SGChannel c, short bufferNum) -> (ComponentResult _rv)")},
+ {"SGSetCompressBuffer", (PyCFunction)Qt_SGSetCompressBuffer, 1,
+ PyDoc_STR("(SGChannel c, short depth, Rect compressSize) -> (ComponentResult _rv)")},
+ {"SGGetCompressBuffer", (PyCFunction)Qt_SGGetCompressBuffer, 1,
+ PyDoc_STR("(SGChannel c) -> (ComponentResult _rv, short depth, Rect compressSize)")},
+ {"SGGetBufferInfo", (PyCFunction)Qt_SGGetBufferInfo, 1,
+ PyDoc_STR("(SGChannel c, short bufferNum) -> (ComponentResult _rv, PixMapHandle bufferPM, Rect bufferRect, GWorldPtr compressBuffer, Rect compressBufferRect)")},
+ {"SGSetUseScreenBuffer", (PyCFunction)Qt_SGSetUseScreenBuffer, 1,
+ PyDoc_STR("(SGChannel c, Boolean useScreenBuffer) -> (ComponentResult _rv)")},
+ {"SGGetUseScreenBuffer", (PyCFunction)Qt_SGGetUseScreenBuffer, 1,
+ PyDoc_STR("(SGChannel c) -> (ComponentResult _rv, Boolean useScreenBuffer)")},
+ {"SGSetFrameRate", (PyCFunction)Qt_SGSetFrameRate, 1,
+ PyDoc_STR("(SGChannel c, Fixed frameRate) -> (ComponentResult _rv)")},
+ {"SGGetFrameRate", (PyCFunction)Qt_SGGetFrameRate, 1,
+ PyDoc_STR("(SGChannel c) -> (ComponentResult _rv, Fixed frameRate)")},
+ {"SGSetPreferredPacketSize", (PyCFunction)Qt_SGSetPreferredPacketSize, 1,
+ PyDoc_STR("(SGChannel c, long preferredPacketSizeInBytes) -> (ComponentResult _rv)")},
+ {"SGGetPreferredPacketSize", (PyCFunction)Qt_SGGetPreferredPacketSize, 1,
+ PyDoc_STR("(SGChannel c) -> (ComponentResult _rv, long preferredPacketSizeInBytes)")},
+ {"SGSetUserVideoCompressorList", (PyCFunction)Qt_SGSetUserVideoCompressorList, 1,
+ PyDoc_STR("(SGChannel c, Handle compressorTypes) -> (ComponentResult _rv)")},
+ {"SGGetUserVideoCompressorList", (PyCFunction)Qt_SGGetUserVideoCompressorList, 1,
+ PyDoc_STR("(SGChannel c) -> (ComponentResult _rv, Handle compressorTypes)")},
+ {"SGSetSoundInputDriver", (PyCFunction)Qt_SGSetSoundInputDriver, 1,
+ PyDoc_STR("(SGChannel c, Str255 driverName) -> (ComponentResult _rv)")},
+ {"SGGetSoundInputDriver", (PyCFunction)Qt_SGGetSoundInputDriver, 1,
+ PyDoc_STR("(SGChannel c) -> (long _rv)")},
+ {"SGSoundInputDriverChanged", (PyCFunction)Qt_SGSoundInputDriverChanged, 1,
+ PyDoc_STR("(SGChannel c) -> (ComponentResult _rv)")},
+ {"SGSetSoundRecordChunkSize", (PyCFunction)Qt_SGSetSoundRecordChunkSize, 1,
+ PyDoc_STR("(SGChannel c, long seconds) -> (ComponentResult _rv)")},
+ {"SGGetSoundRecordChunkSize", (PyCFunction)Qt_SGGetSoundRecordChunkSize, 1,
+ PyDoc_STR("(SGChannel c) -> (long _rv)")},
+ {"SGSetSoundInputRate", (PyCFunction)Qt_SGSetSoundInputRate, 1,
+ PyDoc_STR("(SGChannel c, Fixed rate) -> (ComponentResult _rv)")},
+ {"SGGetSoundInputRate", (PyCFunction)Qt_SGGetSoundInputRate, 1,
+ PyDoc_STR("(SGChannel c) -> (Fixed _rv)")},
+ {"SGSetSoundInputParameters", (PyCFunction)Qt_SGSetSoundInputParameters, 1,
+ PyDoc_STR("(SGChannel c, short sampleSize, short numChannels, OSType compressionType) -> (ComponentResult _rv)")},
+ {"SGGetSoundInputParameters", (PyCFunction)Qt_SGGetSoundInputParameters, 1,
+ PyDoc_STR("(SGChannel c) -> (ComponentResult _rv, short sampleSize, short numChannels, OSType compressionType)")},
+ {"SGSetAdditionalSoundRates", (PyCFunction)Qt_SGSetAdditionalSoundRates, 1,
+ PyDoc_STR("(SGChannel c, Handle rates) -> (ComponentResult _rv)")},
+ {"SGGetAdditionalSoundRates", (PyCFunction)Qt_SGGetAdditionalSoundRates, 1,
+ PyDoc_STR("(SGChannel c) -> (ComponentResult _rv, Handle rates)")},
+ {"SGSetFontName", (PyCFunction)Qt_SGSetFontName, 1,
+ PyDoc_STR("(SGChannel c, StringPtr pstr) -> (ComponentResult _rv)")},
+ {"SGSetFontSize", (PyCFunction)Qt_SGSetFontSize, 1,
+ PyDoc_STR("(SGChannel c, short fontSize) -> (ComponentResult _rv)")},
+ {"SGSetTextForeColor", (PyCFunction)Qt_SGSetTextForeColor, 1,
+ PyDoc_STR("(SGChannel c) -> (ComponentResult _rv, RGBColor theColor)")},
+ {"SGSetTextBackColor", (PyCFunction)Qt_SGSetTextBackColor, 1,
+ PyDoc_STR("(SGChannel c) -> (ComponentResult _rv, RGBColor theColor)")},
+ {"SGSetJustification", (PyCFunction)Qt_SGSetJustification, 1,
+ PyDoc_STR("(SGChannel c, short just) -> (ComponentResult _rv)")},
+ {"SGGetTextReturnToSpaceValue", (PyCFunction)Qt_SGGetTextReturnToSpaceValue, 1,
+ PyDoc_STR("(SGChannel c) -> (ComponentResult _rv, short rettospace)")},
+ {"SGSetTextReturnToSpaceValue", (PyCFunction)Qt_SGSetTextReturnToSpaceValue, 1,
+ PyDoc_STR("(SGChannel c, short rettospace) -> (ComponentResult _rv)")},
+ {"QTVideoOutputGetCurrentClientName", (PyCFunction)Qt_QTVideoOutputGetCurrentClientName, 1,
+ PyDoc_STR("(QTVideoOutputComponent vo, Str255 str) -> (ComponentResult _rv)")},
+ {"QTVideoOutputSetClientName", (PyCFunction)Qt_QTVideoOutputSetClientName, 1,
+ PyDoc_STR("(QTVideoOutputComponent vo, Str255 str) -> (ComponentResult _rv)")},
+ {"QTVideoOutputGetClientName", (PyCFunction)Qt_QTVideoOutputGetClientName, 1,
+ PyDoc_STR("(QTVideoOutputComponent vo, Str255 str) -> (ComponentResult _rv)")},
+ {"QTVideoOutputBegin", (PyCFunction)Qt_QTVideoOutputBegin, 1,
+ PyDoc_STR("(QTVideoOutputComponent vo) -> (ComponentResult _rv)")},
+ {"QTVideoOutputEnd", (PyCFunction)Qt_QTVideoOutputEnd, 1,
+ PyDoc_STR("(QTVideoOutputComponent vo) -> (ComponentResult _rv)")},
+ {"QTVideoOutputSetDisplayMode", (PyCFunction)Qt_QTVideoOutputSetDisplayMode, 1,
+ PyDoc_STR("(QTVideoOutputComponent vo, long displayModeID) -> (ComponentResult _rv)")},
+ {"QTVideoOutputGetDisplayMode", (PyCFunction)Qt_QTVideoOutputGetDisplayMode, 1,
+ PyDoc_STR("(QTVideoOutputComponent vo) -> (ComponentResult _rv, long displayModeID)")},
+ {"QTVideoOutputGetGWorld", (PyCFunction)Qt_QTVideoOutputGetGWorld, 1,
+ PyDoc_STR("(QTVideoOutputComponent vo) -> (ComponentResult _rv, GWorldPtr gw)")},
+ {"QTVideoOutputGetIndSoundOutput", (PyCFunction)Qt_QTVideoOutputGetIndSoundOutput, 1,
+ PyDoc_STR("(QTVideoOutputComponent vo, long index) -> (ComponentResult _rv, Component outputComponent)")},
+ {"QTVideoOutputGetClock", (PyCFunction)Qt_QTVideoOutputGetClock, 1,
+ PyDoc_STR("(QTVideoOutputComponent vo) -> (ComponentResult _rv, ComponentInstance clock)")},
+ {"QTVideoOutputSetEchoPort", (PyCFunction)Qt_QTVideoOutputSetEchoPort, 1,
+ PyDoc_STR("(QTVideoOutputComponent vo, CGrafPtr echoPort) -> (ComponentResult _rv)")},
+ {"QTVideoOutputGetIndImageDecompressor", (PyCFunction)Qt_QTVideoOutputGetIndImageDecompressor, 1,
+ PyDoc_STR("(QTVideoOutputComponent vo, long index) -> (ComponentResult _rv, Component codec)")},
+ {"QTVideoOutputBaseSetEchoPort", (PyCFunction)Qt_QTVideoOutputBaseSetEchoPort, 1,
+ PyDoc_STR("(QTVideoOutputComponent vo, CGrafPtr echoPort) -> (ComponentResult _rv)")},
+ {"MediaSetChunkManagementFlags", (PyCFunction)Qt_MediaSetChunkManagementFlags, 1,
+ PyDoc_STR("(MediaHandler mh, UInt32 flags, UInt32 flagsMask) -> (ComponentResult _rv)")},
+ {"MediaGetChunkManagementFlags", (PyCFunction)Qt_MediaGetChunkManagementFlags, 1,
+ PyDoc_STR("(MediaHandler mh) -> (ComponentResult _rv, UInt32 flags)")},
+ {"MediaSetPurgeableChunkMemoryAllowance", (PyCFunction)Qt_MediaSetPurgeableChunkMemoryAllowance, 1,
+ PyDoc_STR("(MediaHandler mh, Size allowance) -> (ComponentResult _rv)")},
+ {"MediaGetPurgeableChunkMemoryAllowance", (PyCFunction)Qt_MediaGetPurgeableChunkMemoryAllowance, 1,
+ PyDoc_STR("(MediaHandler mh) -> (ComponentResult _rv, Size allowance)")},
+ {"MediaEmptyAllPurgeableChunks", (PyCFunction)Qt_MediaEmptyAllPurgeableChunks, 1,
+ PyDoc_STR("(MediaHandler mh) -> (ComponentResult _rv)")},
+ {"MediaSetHandlerCapabilities", (PyCFunction)Qt_MediaSetHandlerCapabilities, 1,
+ PyDoc_STR("(MediaHandler mh, long flags, long flagsMask) -> (ComponentResult _rv)")},
+ {"MediaIdle", (PyCFunction)Qt_MediaIdle, 1,
+ PyDoc_STR("(MediaHandler mh, TimeValue atMediaTime, long flagsIn, TimeRecord movieTime) -> (ComponentResult _rv, long flagsOut)")},
+ {"MediaGetMediaInfo", (PyCFunction)Qt_MediaGetMediaInfo, 1,
+ PyDoc_STR("(MediaHandler mh, Handle h) -> (ComponentResult _rv)")},
+ {"MediaPutMediaInfo", (PyCFunction)Qt_MediaPutMediaInfo, 1,
+ PyDoc_STR("(MediaHandler mh, Handle h) -> (ComponentResult _rv)")},
+ {"MediaSetActive", (PyCFunction)Qt_MediaSetActive, 1,
+ PyDoc_STR("(MediaHandler mh, Boolean enableMedia) -> (ComponentResult _rv)")},
+ {"MediaSetRate", (PyCFunction)Qt_MediaSetRate, 1,
+ PyDoc_STR("(MediaHandler mh, Fixed rate) -> (ComponentResult _rv)")},
+ {"MediaGGetStatus", (PyCFunction)Qt_MediaGGetStatus, 1,
+ PyDoc_STR("(MediaHandler mh) -> (ComponentResult _rv, ComponentResult statusErr)")},
+ {"MediaTrackEdited", (PyCFunction)Qt_MediaTrackEdited, 1,
+ PyDoc_STR("(MediaHandler mh) -> (ComponentResult _rv)")},
+ {"MediaSetMediaTimeScale", (PyCFunction)Qt_MediaSetMediaTimeScale, 1,
+ PyDoc_STR("(MediaHandler mh, TimeScale newTimeScale) -> (ComponentResult _rv)")},
+ {"MediaSetMovieTimeScale", (PyCFunction)Qt_MediaSetMovieTimeScale, 1,
+ PyDoc_STR("(MediaHandler mh, TimeScale newTimeScale) -> (ComponentResult _rv)")},
+ {"MediaSetGWorld", (PyCFunction)Qt_MediaSetGWorld, 1,
+ PyDoc_STR("(MediaHandler mh, CGrafPtr aPort, GDHandle aGD) -> (ComponentResult _rv)")},
+ {"MediaSetDimensions", (PyCFunction)Qt_MediaSetDimensions, 1,
+ PyDoc_STR("(MediaHandler mh, Fixed width, Fixed height) -> (ComponentResult _rv)")},
+ {"MediaSetClip", (PyCFunction)Qt_MediaSetClip, 1,
+ PyDoc_STR("(MediaHandler mh, RgnHandle theClip) -> (ComponentResult _rv)")},
+ {"MediaGetTrackOpaque", (PyCFunction)Qt_MediaGetTrackOpaque, 1,
+ PyDoc_STR("(MediaHandler mh) -> (ComponentResult _rv, Boolean trackIsOpaque)")},
+ {"MediaSetGraphicsMode", (PyCFunction)Qt_MediaSetGraphicsMode, 1,
+ PyDoc_STR("(MediaHandler mh, long mode, RGBColor opColor) -> (ComponentResult _rv)")},
+ {"MediaGetGraphicsMode", (PyCFunction)Qt_MediaGetGraphicsMode, 1,
+ PyDoc_STR("(MediaHandler mh) -> (ComponentResult _rv, long mode, RGBColor opColor)")},
+ {"MediaGSetVolume", (PyCFunction)Qt_MediaGSetVolume, 1,
+ PyDoc_STR("(MediaHandler mh, short volume) -> (ComponentResult _rv)")},
+ {"MediaSetSoundBalance", (PyCFunction)Qt_MediaSetSoundBalance, 1,
+ PyDoc_STR("(MediaHandler mh, short balance) -> (ComponentResult _rv)")},
+ {"MediaGetSoundBalance", (PyCFunction)Qt_MediaGetSoundBalance, 1,
+ PyDoc_STR("(MediaHandler mh) -> (ComponentResult _rv, short balance)")},
+ {"MediaGetNextBoundsChange", (PyCFunction)Qt_MediaGetNextBoundsChange, 1,
+ PyDoc_STR("(MediaHandler mh) -> (ComponentResult _rv, TimeValue when)")},
+ {"MediaGetSrcRgn", (PyCFunction)Qt_MediaGetSrcRgn, 1,
+ PyDoc_STR("(MediaHandler mh, RgnHandle rgn, TimeValue atMediaTime) -> (ComponentResult _rv)")},
+ {"MediaPreroll", (PyCFunction)Qt_MediaPreroll, 1,
+ PyDoc_STR("(MediaHandler mh, TimeValue time, Fixed rate) -> (ComponentResult _rv)")},
+ {"MediaSampleDescriptionChanged", (PyCFunction)Qt_MediaSampleDescriptionChanged, 1,
+ PyDoc_STR("(MediaHandler mh, long index) -> (ComponentResult _rv)")},
+ {"MediaHasCharacteristic", (PyCFunction)Qt_MediaHasCharacteristic, 1,
+ PyDoc_STR("(MediaHandler mh, OSType characteristic) -> (ComponentResult _rv, Boolean hasIt)")},
+ {"MediaGetOffscreenBufferSize", (PyCFunction)Qt_MediaGetOffscreenBufferSize, 1,
+ PyDoc_STR("(MediaHandler mh, short depth, CTabHandle ctab) -> (ComponentResult _rv, Rect bounds)")},
+ {"MediaSetHints", (PyCFunction)Qt_MediaSetHints, 1,
+ PyDoc_STR("(MediaHandler mh, long hints) -> (ComponentResult _rv)")},
+ {"MediaGetName", (PyCFunction)Qt_MediaGetName, 1,
+ PyDoc_STR("(MediaHandler mh, Str255 name, long requestedLanguage) -> (ComponentResult _rv, long actualLanguage)")},
+ {"MediaForceUpdate", (PyCFunction)Qt_MediaForceUpdate, 1,
+ PyDoc_STR("(MediaHandler mh, long forceUpdateFlags) -> (ComponentResult _rv)")},
+ {"MediaGetDrawingRgn", (PyCFunction)Qt_MediaGetDrawingRgn, 1,
+ PyDoc_STR("(MediaHandler mh) -> (ComponentResult _rv, RgnHandle partialRgn)")},
+ {"MediaGSetActiveSegment", (PyCFunction)Qt_MediaGSetActiveSegment, 1,
+ PyDoc_STR("(MediaHandler mh, TimeValue activeStart, TimeValue activeDuration) -> (ComponentResult _rv)")},
+ {"MediaInvalidateRegion", (PyCFunction)Qt_MediaInvalidateRegion, 1,
+ PyDoc_STR("(MediaHandler mh, RgnHandle invalRgn) -> (ComponentResult _rv)")},
+ {"MediaGetNextStepTime", (PyCFunction)Qt_MediaGetNextStepTime, 1,
+ PyDoc_STR("(MediaHandler mh, short flags, TimeValue mediaTimeIn, Fixed rate) -> (ComponentResult _rv, TimeValue mediaTimeOut)")},
+ {"MediaChangedNonPrimarySource", (PyCFunction)Qt_MediaChangedNonPrimarySource, 1,
+ PyDoc_STR("(MediaHandler mh, long inputIndex) -> (ComponentResult _rv)")},
+ {"MediaTrackReferencesChanged", (PyCFunction)Qt_MediaTrackReferencesChanged, 1,
+ PyDoc_STR("(MediaHandler mh) -> (ComponentResult _rv)")},
+ {"MediaReleaseSampleDataPointer", (PyCFunction)Qt_MediaReleaseSampleDataPointer, 1,
+ PyDoc_STR("(MediaHandler mh, long sampleNum) -> (ComponentResult _rv)")},
+ {"MediaTrackPropertyAtomChanged", (PyCFunction)Qt_MediaTrackPropertyAtomChanged, 1,
+ PyDoc_STR("(MediaHandler mh) -> (ComponentResult _rv)")},
+ {"MediaSetVideoParam", (PyCFunction)Qt_MediaSetVideoParam, 1,
+ PyDoc_STR("(MediaHandler mh, long whichParam) -> (ComponentResult _rv, unsigned short value)")},
+ {"MediaGetVideoParam", (PyCFunction)Qt_MediaGetVideoParam, 1,
+ PyDoc_STR("(MediaHandler mh, long whichParam) -> (ComponentResult _rv, unsigned short value)")},
+ {"MediaCompare", (PyCFunction)Qt_MediaCompare, 1,
+ PyDoc_STR("(MediaHandler mh, Media srcMedia, ComponentInstance srcMediaComponent) -> (ComponentResult _rv, Boolean isOK)")},
+ {"MediaGetClock", (PyCFunction)Qt_MediaGetClock, 1,
+ PyDoc_STR("(MediaHandler mh) -> (ComponentResult _rv, ComponentInstance clock)")},
+ {"MediaSetSoundOutputComponent", (PyCFunction)Qt_MediaSetSoundOutputComponent, 1,
+ PyDoc_STR("(MediaHandler mh, Component outputComponent) -> (ComponentResult _rv)")},
+ {"MediaGetSoundOutputComponent", (PyCFunction)Qt_MediaGetSoundOutputComponent, 1,
+ PyDoc_STR("(MediaHandler mh) -> (ComponentResult _rv, Component outputComponent)")},
+ {"MediaSetSoundLocalizationData", (PyCFunction)Qt_MediaSetSoundLocalizationData, 1,
+ PyDoc_STR("(MediaHandler mh, Handle data) -> (ComponentResult _rv)")},
+ {"MediaGetInvalidRegion", (PyCFunction)Qt_MediaGetInvalidRegion, 1,
+ PyDoc_STR("(MediaHandler mh, RgnHandle rgn) -> (ComponentResult _rv)")},
+ {"MediaSampleDescriptionB2N", (PyCFunction)Qt_MediaSampleDescriptionB2N, 1,
+ PyDoc_STR("(MediaHandler mh, SampleDescriptionHandle sampleDescriptionH) -> (ComponentResult _rv)")},
+ {"MediaSampleDescriptionN2B", (PyCFunction)Qt_MediaSampleDescriptionN2B, 1,
+ PyDoc_STR("(MediaHandler mh, SampleDescriptionHandle sampleDescriptionH) -> (ComponentResult _rv)")},
+ {"MediaFlushNonPrimarySourceData", (PyCFunction)Qt_MediaFlushNonPrimarySourceData, 1,
+ PyDoc_STR("(MediaHandler mh, long inputIndex) -> (ComponentResult _rv)")},
+ {"MediaGetURLLink", (PyCFunction)Qt_MediaGetURLLink, 1,
+ PyDoc_STR("(MediaHandler mh, Point displayWhere) -> (ComponentResult _rv, Handle urlLink)")},
+ {"MediaHitTestForTargetRefCon", (PyCFunction)Qt_MediaHitTestForTargetRefCon, 1,
+ PyDoc_STR("(MediaHandler mh, long flags, Point loc) -> (ComponentResult _rv, long targetRefCon)")},
+ {"MediaHitTestTargetRefCon", (PyCFunction)Qt_MediaHitTestTargetRefCon, 1,
+ PyDoc_STR("(MediaHandler mh, long targetRefCon, long flags, Point loc) -> (ComponentResult _rv, Boolean wasHit)")},
+ {"MediaDisposeTargetRefCon", (PyCFunction)Qt_MediaDisposeTargetRefCon, 1,
+ PyDoc_STR("(MediaHandler mh, long targetRefCon) -> (ComponentResult _rv)")},
+ {"MediaTargetRefConsEqual", (PyCFunction)Qt_MediaTargetRefConsEqual, 1,
+ PyDoc_STR("(MediaHandler mh, long firstRefCon, long secondRefCon) -> (ComponentResult _rv, Boolean equal)")},
+ {"MediaPrePrerollCancel", (PyCFunction)Qt_MediaPrePrerollCancel, 1,
+ PyDoc_STR("(MediaHandler mh, void * refcon) -> (ComponentResult _rv)")},
+ {"MediaEnterEmptyEdit", (PyCFunction)Qt_MediaEnterEmptyEdit, 1,
+ PyDoc_STR("(MediaHandler mh) -> (ComponentResult _rv)")},
+ {"MediaCurrentMediaQueuedData", (PyCFunction)Qt_MediaCurrentMediaQueuedData, 1,
+ PyDoc_STR("(MediaHandler mh) -> (ComponentResult _rv, long milliSecs)")},
+ {"MediaGetEffectiveVolume", (PyCFunction)Qt_MediaGetEffectiveVolume, 1,
+ PyDoc_STR("(MediaHandler mh) -> (ComponentResult _rv, short volume)")},
+ {"MediaGetSoundLevelMeteringEnabled", (PyCFunction)Qt_MediaGetSoundLevelMeteringEnabled, 1,
+ PyDoc_STR("(MediaHandler mh) -> (ComponentResult _rv, Boolean enabled)")},
+ {"MediaSetSoundLevelMeteringEnabled", (PyCFunction)Qt_MediaSetSoundLevelMeteringEnabled, 1,
+ PyDoc_STR("(MediaHandler mh, Boolean enable) -> (ComponentResult _rv)")},
+ {"MediaGetEffectiveSoundBalance", (PyCFunction)Qt_MediaGetEffectiveSoundBalance, 1,
+ PyDoc_STR("(MediaHandler mh) -> (ComponentResult _rv, short balance)")},
+ {"MediaSetScreenLock", (PyCFunction)Qt_MediaSetScreenLock, 1,
+ PyDoc_STR("(MediaHandler mh, Boolean lockIt) -> (ComponentResult _rv)")},
+ {"MediaGetErrorString", (PyCFunction)Qt_MediaGetErrorString, 1,
+ PyDoc_STR("(MediaHandler mh, ComponentResult theError, Str255 errorString) -> (ComponentResult _rv)")},
+ {"MediaGetSoundEqualizerBandLevels", (PyCFunction)Qt_MediaGetSoundEqualizerBandLevels, 1,
+ PyDoc_STR("(MediaHandler mh) -> (ComponentResult _rv, UInt8 bandLevels)")},
+ {"MediaDoIdleActions", (PyCFunction)Qt_MediaDoIdleActions, 1,
+ PyDoc_STR("(MediaHandler mh) -> (ComponentResult _rv)")},
+ {"MediaSetSoundBassAndTreble", (PyCFunction)Qt_MediaSetSoundBassAndTreble, 1,
+ PyDoc_STR("(MediaHandler mh, short bass, short treble) -> (ComponentResult _rv)")},
+ {"MediaGetSoundBassAndTreble", (PyCFunction)Qt_MediaGetSoundBassAndTreble, 1,
+ PyDoc_STR("(MediaHandler mh) -> (ComponentResult _rv, short bass, short treble)")},
+ {"MediaTimeBaseChanged", (PyCFunction)Qt_MediaTimeBaseChanged, 1,
+ PyDoc_STR("(MediaHandler mh) -> (ComponentResult _rv)")},
+ {"MediaMCIsPlayerEvent", (PyCFunction)Qt_MediaMCIsPlayerEvent, 1,
+ PyDoc_STR("(MediaHandler mh, EventRecord e) -> (ComponentResult _rv, Boolean handledIt)")},
+ {"MediaGetMediaLoadState", (PyCFunction)Qt_MediaGetMediaLoadState, 1,
+ PyDoc_STR("(MediaHandler mh) -> (ComponentResult _rv, long mediaLoadState)")},
+ {"MediaVideoOutputChanged", (PyCFunction)Qt_MediaVideoOutputChanged, 1,
+ PyDoc_STR("(MediaHandler mh, ComponentInstance vout) -> (ComponentResult _rv)")},
+ {"MediaEmptySampleCache", (PyCFunction)Qt_MediaEmptySampleCache, 1,
+ PyDoc_STR("(MediaHandler mh, long sampleNum, long sampleCount) -> (ComponentResult _rv)")},
+ {"MediaGetPublicInfo", (PyCFunction)Qt_MediaGetPublicInfo, 1,
+ PyDoc_STR("(MediaHandler mh, OSType infoSelector, void * infoDataPtr) -> (ComponentResult _rv, Size ioDataSize)")},
+ {"MediaSetPublicInfo", (PyCFunction)Qt_MediaSetPublicInfo, 1,
+ PyDoc_STR("(MediaHandler mh, OSType infoSelector, void * infoDataPtr, Size dataSize) -> (ComponentResult _rv)")},
+ {"MediaRefConSetProperty", (PyCFunction)Qt_MediaRefConSetProperty, 1,
+ PyDoc_STR("(MediaHandler mh, long refCon, long propertyType, void * propertyValue) -> (ComponentResult _rv)")},
+ {"MediaRefConGetProperty", (PyCFunction)Qt_MediaRefConGetProperty, 1,
+ PyDoc_STR("(MediaHandler mh, long refCon, long propertyType, void * propertyValue) -> (ComponentResult _rv)")},
+ {"MediaNavigateTargetRefCon", (PyCFunction)Qt_MediaNavigateTargetRefCon, 1,
+ PyDoc_STR("(MediaHandler mh, long navigation) -> (ComponentResult _rv, long refCon)")},
+ {"MediaGGetIdleManager", (PyCFunction)Qt_MediaGGetIdleManager, 1,
+ PyDoc_STR("(MediaHandler mh) -> (ComponentResult _rv, IdleManager pim)")},
+ {"MediaGSetIdleManager", (PyCFunction)Qt_MediaGSetIdleManager, 1,
+ PyDoc_STR("(MediaHandler mh, IdleManager im) -> (ComponentResult _rv)")},
+ {"QTMIDIGetMIDIPorts", (PyCFunction)Qt_QTMIDIGetMIDIPorts, 1,
+ PyDoc_STR("(QTMIDIComponent ci) -> (ComponentResult _rv, QTMIDIPortListHandle inputPorts, QTMIDIPortListHandle outputPorts)")},
+ {"QTMIDIUseSendPort", (PyCFunction)Qt_QTMIDIUseSendPort, 1,
+ PyDoc_STR("(QTMIDIComponent ci, long portIndex, long inUse) -> (ComponentResult _rv)")},
+ {"QTMIDISendMIDI", (PyCFunction)Qt_QTMIDISendMIDI, 1,
+ PyDoc_STR("(QTMIDIComponent ci, long portIndex, MusicMIDIPacket mp) -> (ComponentResult _rv)")},
+ {"MusicGetPart", (PyCFunction)Qt_MusicGetPart, 1,
+ PyDoc_STR("(MusicComponent mc, long part) -> (ComponentResult _rv, long midiChannel, long polyphony)")},
+ {"MusicSetPart", (PyCFunction)Qt_MusicSetPart, 1,
+ PyDoc_STR("(MusicComponent mc, long part, long midiChannel, long polyphony) -> (ComponentResult _rv)")},
+ {"MusicSetPartInstrumentNumber", (PyCFunction)Qt_MusicSetPartInstrumentNumber, 1,
+ PyDoc_STR("(MusicComponent mc, long part, long instrumentNumber) -> (ComponentResult _rv)")},
+ {"MusicGetPartInstrumentNumber", (PyCFunction)Qt_MusicGetPartInstrumentNumber, 1,
+ PyDoc_STR("(MusicComponent mc, long part) -> (ComponentResult _rv)")},
+ {"MusicStorePartInstrument", (PyCFunction)Qt_MusicStorePartInstrument, 1,
+ PyDoc_STR("(MusicComponent mc, long part, long instrumentNumber) -> (ComponentResult _rv)")},
+ {"MusicGetPartAtomicInstrument", (PyCFunction)Qt_MusicGetPartAtomicInstrument, 1,
+ PyDoc_STR("(MusicComponent mc, long part, long flags) -> (ComponentResult _rv, AtomicInstrument ai)")},
+ {"MusicSetPartAtomicInstrument", (PyCFunction)Qt_MusicSetPartAtomicInstrument, 1,
+ PyDoc_STR("(MusicComponent mc, long part, AtomicInstrumentPtr aiP, long flags) -> (ComponentResult _rv)")},
+ {"MusicGetPartKnob", (PyCFunction)Qt_MusicGetPartKnob, 1,
+ PyDoc_STR("(MusicComponent mc, long part, long knobID) -> (ComponentResult _rv)")},
+ {"MusicSetPartKnob", (PyCFunction)Qt_MusicSetPartKnob, 1,
+ PyDoc_STR("(MusicComponent mc, long part, long knobID, long knobValue) -> (ComponentResult _rv)")},
+ {"MusicGetKnob", (PyCFunction)Qt_MusicGetKnob, 1,
+ PyDoc_STR("(MusicComponent mc, long knobID) -> (ComponentResult _rv)")},
+ {"MusicSetKnob", (PyCFunction)Qt_MusicSetKnob, 1,
+ PyDoc_STR("(MusicComponent mc, long knobID, long knobValue) -> (ComponentResult _rv)")},
+ {"MusicGetPartName", (PyCFunction)Qt_MusicGetPartName, 1,
+ PyDoc_STR("(MusicComponent mc, long part, StringPtr name) -> (ComponentResult _rv)")},
+ {"MusicSetPartName", (PyCFunction)Qt_MusicSetPartName, 1,
+ PyDoc_STR("(MusicComponent mc, long part, StringPtr name) -> (ComponentResult _rv)")},
+ {"MusicPlayNote", (PyCFunction)Qt_MusicPlayNote, 1,
+ PyDoc_STR("(MusicComponent mc, long part, long pitch, long velocity) -> (ComponentResult _rv)")},
+ {"MusicResetPart", (PyCFunction)Qt_MusicResetPart, 1,
+ PyDoc_STR("(MusicComponent mc, long part) -> (ComponentResult _rv)")},
+ {"MusicSetPartController", (PyCFunction)Qt_MusicSetPartController, 1,
+ PyDoc_STR("(MusicComponent mc, long part, MusicController controllerNumber, long controllerValue) -> (ComponentResult _rv)")},
+ {"MusicGetPartController", (PyCFunction)Qt_MusicGetPartController, 1,
+ PyDoc_STR("(MusicComponent mc, long part, MusicController controllerNumber) -> (ComponentResult _rv)")},
+ {"MusicGetInstrumentNames", (PyCFunction)Qt_MusicGetInstrumentNames, 1,
+ PyDoc_STR("(MusicComponent mc, long modifiableInstruments) -> (ComponentResult _rv, Handle instrumentNames, Handle instrumentCategoryLasts, Handle instrumentCategoryNames)")},
+ {"MusicGetDrumNames", (PyCFunction)Qt_MusicGetDrumNames, 1,
+ PyDoc_STR("(MusicComponent mc, long modifiableInstruments) -> (ComponentResult _rv, Handle instrumentNumbers, Handle instrumentNames)")},
+ {"MusicGetMasterTune", (PyCFunction)Qt_MusicGetMasterTune, 1,
+ PyDoc_STR("(MusicComponent mc) -> (ComponentResult _rv)")},
+ {"MusicSetMasterTune", (PyCFunction)Qt_MusicSetMasterTune, 1,
+ PyDoc_STR("(MusicComponent mc, long masterTune) -> (ComponentResult _rv)")},
+ {"MusicGetDeviceConnection", (PyCFunction)Qt_MusicGetDeviceConnection, 1,
+ PyDoc_STR("(MusicComponent mc, long index) -> (ComponentResult _rv, long id1, long id2)")},
+ {"MusicUseDeviceConnection", (PyCFunction)Qt_MusicUseDeviceConnection, 1,
+ PyDoc_STR("(MusicComponent mc, long id1, long id2) -> (ComponentResult _rv)")},
+ {"MusicGetKnobSettingStrings", (PyCFunction)Qt_MusicGetKnobSettingStrings, 1,
+ PyDoc_STR("(MusicComponent mc, long knobIndex, long isGlobal) -> (ComponentResult _rv, Handle settingsNames, Handle settingsCategoryLasts, Handle settingsCategoryNames)")},
+ {"MusicGetMIDIPorts", (PyCFunction)Qt_MusicGetMIDIPorts, 1,
+ PyDoc_STR("(MusicComponent mc) -> (ComponentResult _rv, long inputPortCount, long outputPortCount)")},
+ {"MusicSendMIDI", (PyCFunction)Qt_MusicSendMIDI, 1,
+ PyDoc_STR("(MusicComponent mc, long portIndex, MusicMIDIPacket mp) -> (ComponentResult _rv)")},
+ {"MusicSetOfflineTimeTo", (PyCFunction)Qt_MusicSetOfflineTimeTo, 1,
+ PyDoc_STR("(MusicComponent mc, long newTimeStamp) -> (ComponentResult _rv)")},
+ {"MusicGetInfoText", (PyCFunction)Qt_MusicGetInfoText, 1,
+ PyDoc_STR("(MusicComponent mc, long selector) -> (ComponentResult _rv, Handle textH, Handle styleH)")},
+ {"MusicGetInstrumentInfo", (PyCFunction)Qt_MusicGetInstrumentInfo, 1,
+ PyDoc_STR("(MusicComponent mc, long getInstrumentInfoFlags) -> (ComponentResult _rv, InstrumentInfoListHandle infoListH)")},
+ {"MusicTask", (PyCFunction)Qt_MusicTask, 1,
+ PyDoc_STR("(MusicComponent mc) -> (ComponentResult _rv)")},
+ {"MusicSetPartInstrumentNumberInterruptSafe", (PyCFunction)Qt_MusicSetPartInstrumentNumberInterruptSafe, 1,
+ PyDoc_STR("(MusicComponent mc, long part, long instrumentNumber) -> (ComponentResult _rv)")},
+ {"MusicSetPartSoundLocalization", (PyCFunction)Qt_MusicSetPartSoundLocalization, 1,
+ PyDoc_STR("(MusicComponent mc, long part, Handle data) -> (ComponentResult _rv)")},
+ {"MusicGenericConfigure", (PyCFunction)Qt_MusicGenericConfigure, 1,
+ PyDoc_STR("(MusicComponent mc, long mode, long flags, long baseResID) -> (ComponentResult _rv)")},
+ {"MusicGenericGetKnobList", (PyCFunction)Qt_MusicGenericGetKnobList, 1,
+ PyDoc_STR("(MusicComponent mc, long knobType) -> (ComponentResult _rv, GenericKnobDescriptionListHandle gkdlH)")},
+ {"MusicGenericSetResourceNumbers", (PyCFunction)Qt_MusicGenericSetResourceNumbers, 1,
+ PyDoc_STR("(MusicComponent mc, Handle resourceIDH) -> (ComponentResult _rv)")},
+ {"MusicDerivedMIDISend", (PyCFunction)Qt_MusicDerivedMIDISend, 1,
+ PyDoc_STR("(MusicComponent mc, MusicMIDIPacket packet) -> (ComponentResult _rv)")},
+ {"MusicDerivedOpenResFile", (PyCFunction)Qt_MusicDerivedOpenResFile, 1,
+ PyDoc_STR("(MusicComponent mc) -> (ComponentResult _rv)")},
+ {"MusicDerivedCloseResFile", (PyCFunction)Qt_MusicDerivedCloseResFile, 1,
+ PyDoc_STR("(MusicComponent mc, short resRefNum) -> (ComponentResult _rv)")},
+ {"NAUnregisterMusicDevice", (PyCFunction)Qt_NAUnregisterMusicDevice, 1,
+ PyDoc_STR("(NoteAllocator na, long index) -> (ComponentResult _rv)")},
+ {"NASaveMusicConfiguration", (PyCFunction)Qt_NASaveMusicConfiguration, 1,
+ PyDoc_STR("(NoteAllocator na) -> (ComponentResult _rv)")},
+ {"NAGetMIDIPorts", (PyCFunction)Qt_NAGetMIDIPorts, 1,
+ PyDoc_STR("(NoteAllocator na) -> (ComponentResult _rv, QTMIDIPortListHandle inputPorts, QTMIDIPortListHandle outputPorts)")},
+ {"NATask", (PyCFunction)Qt_NATask, 1,
+ PyDoc_STR("(NoteAllocator na) -> (ComponentResult _rv)")},
+ {"TuneSetHeader", (PyCFunction)Qt_TuneSetHeader, 1,
+ PyDoc_STR("(TunePlayer tp, unsigned long * header) -> (ComponentResult _rv)")},
+ {"TuneGetTimeBase", (PyCFunction)Qt_TuneGetTimeBase, 1,
+ PyDoc_STR("(TunePlayer tp) -> (ComponentResult _rv, TimeBase tb)")},
+ {"TuneSetTimeScale", (PyCFunction)Qt_TuneSetTimeScale, 1,
+ PyDoc_STR("(TunePlayer tp, TimeScale scale) -> (ComponentResult _rv)")},
+ {"TuneGetTimeScale", (PyCFunction)Qt_TuneGetTimeScale, 1,
+ PyDoc_STR("(TunePlayer tp) -> (ComponentResult _rv, TimeScale scale)")},
+ {"TuneInstant", (PyCFunction)Qt_TuneInstant, 1,
+ PyDoc_STR("(TunePlayer tp, unsigned long tunePosition) -> (ComponentResult _rv, unsigned long tune)")},
+ {"TuneStop", (PyCFunction)Qt_TuneStop, 1,
+ PyDoc_STR("(TunePlayer tp, long stopFlags) -> (ComponentResult _rv)")},
+ {"TuneSetVolume", (PyCFunction)Qt_TuneSetVolume, 1,
+ PyDoc_STR("(TunePlayer tp, Fixed volume) -> (ComponentResult _rv)")},
+ {"TuneGetVolume", (PyCFunction)Qt_TuneGetVolume, 1,
+ PyDoc_STR("(TunePlayer tp) -> (ComponentResult _rv)")},
+ {"TunePreroll", (PyCFunction)Qt_TunePreroll, 1,
+ PyDoc_STR("(TunePlayer tp) -> (ComponentResult _rv)")},
+ {"TuneUnroll", (PyCFunction)Qt_TuneUnroll, 1,
+ PyDoc_STR("(TunePlayer tp) -> (ComponentResult _rv)")},
+ {"TuneSetPartTranspose", (PyCFunction)Qt_TuneSetPartTranspose, 1,
+ PyDoc_STR("(TunePlayer tp, unsigned long part, long transpose, long velocityShift) -> (ComponentResult _rv)")},
+ {"TuneGetNoteAllocator", (PyCFunction)Qt_TuneGetNoteAllocator, 1,
+ PyDoc_STR("(TunePlayer tp) -> (NoteAllocator _rv)")},
+ {"TuneSetSofter", (PyCFunction)Qt_TuneSetSofter, 1,
+ PyDoc_STR("(TunePlayer tp, long softer) -> (ComponentResult _rv)")},
+ {"TuneTask", (PyCFunction)Qt_TuneTask, 1,
+ PyDoc_STR("(TunePlayer tp) -> (ComponentResult _rv)")},
+ {"TuneSetBalance", (PyCFunction)Qt_TuneSetBalance, 1,
+ PyDoc_STR("(TunePlayer tp, long balance) -> (ComponentResult _rv)")},
+ {"TuneSetSoundLocalization", (PyCFunction)Qt_TuneSetSoundLocalization, 1,
+ PyDoc_STR("(TunePlayer tp, Handle data) -> (ComponentResult _rv)")},
+ {"TuneSetHeaderWithSize", (PyCFunction)Qt_TuneSetHeaderWithSize, 1,
+ PyDoc_STR("(TunePlayer tp, unsigned long * header, unsigned long size) -> (ComponentResult _rv)")},
+ {"TuneSetPartMix", (PyCFunction)Qt_TuneSetPartMix, 1,
+ PyDoc_STR("(TunePlayer tp, unsigned long partNumber, long volume, long balance, long mixFlags) -> (ComponentResult _rv)")},
+ {"TuneGetPartMix", (PyCFunction)Qt_TuneGetPartMix, 1,
+ PyDoc_STR("(TunePlayer tp, unsigned long partNumber) -> (ComponentResult _rv, long volumeOut, long balanceOut, long mixFlagsOut)")},
+ {"AlignWindow", (PyCFunction)Qt_AlignWindow, 1,
+ PyDoc_STR("(WindowPtr wp, Boolean front) -> None")},
+ {"DragAlignedWindow", (PyCFunction)Qt_DragAlignedWindow, 1,
+ PyDoc_STR("(WindowPtr wp, Point startPt, Rect boundsRect) -> None")},
+ {"MoviesTask", (PyCFunction)Qt_MoviesTask, 1,
+ PyDoc_STR("(long maxMilliSecToUse) -> None")},
+#endif /* __LP64__ */
+ {NULL, NULL, 0}
+};
+
+
+
+
+void init_Qt(void)
+{
+ PyObject *m;
+#ifndef __LP64__
+ PyObject *d;
+
+
+
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(Track, TrackObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Track, TrackObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(Movie, MovieObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Movie, MovieObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(MovieController, MovieCtlObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MovieController, MovieCtlObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(TimeBase, TimeBaseObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TimeBase, TimeBaseObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(UserData, UserDataObj_New);
+ 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 ||
+ PyDict_SetItemString(d, "Error", Qt_Error) != 0)
+ return;
+ IdleManager_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&IdleManager_Type) < 0) return;
+ Py_INCREF(&IdleManager_Type);
+ PyModule_AddObject(m, "IdleManager", (PyObject *)&IdleManager_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&IdleManager_Type);
+ PyModule_AddObject(m, "IdleManagerType", (PyObject *)&IdleManager_Type);
+ MovieController_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&MovieController_Type) < 0) return;
+ Py_INCREF(&MovieController_Type);
+ PyModule_AddObject(m, "MovieController", (PyObject *)&MovieController_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&MovieController_Type);
+ PyModule_AddObject(m, "MovieControllerType", (PyObject *)&MovieController_Type);
+ TimeBase_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&TimeBase_Type) < 0) return;
+ Py_INCREF(&TimeBase_Type);
+ PyModule_AddObject(m, "TimeBase", (PyObject *)&TimeBase_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&TimeBase_Type);
+ PyModule_AddObject(m, "TimeBaseType", (PyObject *)&TimeBase_Type);
+ UserData_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&UserData_Type) < 0) return;
+ Py_INCREF(&UserData_Type);
+ PyModule_AddObject(m, "UserData", (PyObject *)&UserData_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&UserData_Type);
+ PyModule_AddObject(m, "UserDataType", (PyObject *)&UserData_Type);
+ Media_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&Media_Type) < 0) return;
+ Py_INCREF(&Media_Type);
+ PyModule_AddObject(m, "Media", (PyObject *)&Media_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&Media_Type);
+ PyModule_AddObject(m, "MediaType", (PyObject *)&Media_Type);
+ Track_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&Track_Type) < 0) return;
+ Py_INCREF(&Track_Type);
+ PyModule_AddObject(m, "Track", (PyObject *)&Track_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&Track_Type);
+ PyModule_AddObject(m, "TrackType", (PyObject *)&Track_Type);
+ Movie_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&Movie_Type) < 0) return;
+ Py_INCREF(&Movie_Type);
+ PyModule_AddObject(m, "Movie", (PyObject *)&Movie_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&Movie_Type);
+ PyModule_AddObject(m, "MovieType", (PyObject *)&Movie_Type);
+ SGOutput_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&SGOutput_Type) < 0) return;
+ Py_INCREF(&SGOutput_Type);
+ PyModule_AddObject(m, "SGOutput", (PyObject *)&SGOutput_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&SGOutput_Type);
+ PyModule_AddObject(m, "SGOutputType", (PyObject *)&SGOutput_Type);
+#endif /* __LP64__ */
+}
+
+/* ========================= End module _Qt ========================= */
+
diff --git a/Mac/Modules/qt/qtscan.py b/Mac/Modules/qt/qtscan.py
new file mode 100644
index 0000000000..cd001244f6
--- /dev/null
+++ b/Mac/Modules/qt/qtscan.py
@@ -0,0 +1,318 @@
+# Scan an Apple header file, generating a Python file of generator calls.
+
+import sys
+from bgenlocations import TOOLBOXDIR, BGENDIR
+sys.path.append(BGENDIR)
+from scantools import Scanner
+
+LONG = "QuickTime"
+SHORT = "qt"
+HEADERFILES= (
+# "Components.h" -- In Carbon.Cm
+ "Movies.h",
+ "ImageCompression.h",
+ "QuickTimeComponents.h",
+# "ImageCodec.h" -- seems not too useful, and difficult.
+# "IsochronousDataHandlers.h" -- Is this useful?
+ "MediaHandlers.h",
+# "QTML.h", -- Windows only, needs separate module
+# "QuickTimeStreaming.h", -- Difficult
+# "QTStreamingComponents.h", -- Needs QTStreaming
+ "QuickTimeMusic.h",
+# "QuickTimeVR.h", -- Not done yet
+# "Sound.h", -- In Carbon.Snd
+ )
+OBJECTS = ("Movie", "Track", "Media", "UserData", "TimeBase", "MovieController",
+ "IdleManager", "SGOutput")
+
+def main():
+ input = HEADERFILES
+ output = SHORT + "gen.py"
+ defsoutput = TOOLBOXDIR + LONG + ".py"
+ scanner = MyScanner(input, output, defsoutput)
+ scanner.scan()
+ scanner.close()
+ scanner.gentypetest(SHORT+"typetest.py")
+ print "=== Testing definitions output code ==="
+ execfile(defsoutput, {}, {})
+ print "=== Done scanning and generating, now importing the generated code... ==="
+ exec "import " + SHORT + "support"
+ print "=== Done. It's up to you to compile it now! ==="
+
+class MyScanner(Scanner):
+
+ def destination(self, type, name, arglist):
+ classname = "Function"
+ listname = "functions"
+ if arglist:
+ t, n, m = arglist[0]
+ if t in OBJECTS and m == "InMode":
+ classname = "Method"
+ listname = t + "_methods"
+ return classname, listname
+
+ def writeinitialdefs(self):
+ self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
+ self.defsfile.write("xmlIdentifierUnrecognized = -1\n")
+ self.defsfile.write("kControllerMinimum = -0xf777\n")
+ self.defsfile.write("notImplementedMusicOSErr = -2071\n")
+ self.defsfile.write("cantSendToSynthesizerOSErr = -2072\n")
+ self.defsfile.write("cantReceiveFromSynthesizerOSErr = -2073\n")
+ self.defsfile.write("illegalVoiceAllocationOSErr = -2074\n")
+ self.defsfile.write("illegalPartOSErr = -2075\n")
+ self.defsfile.write("illegalChannelOSErr = -2076\n")
+ self.defsfile.write("illegalKnobOSErr = -2077\n")
+ self.defsfile.write("illegalKnobValueOSErr = -2078\n")
+ self.defsfile.write("illegalInstrumentOSErr = -2079\n")
+ self.defsfile.write("illegalControllerOSErr = -2080\n")
+ self.defsfile.write("midiManagerAbsentOSErr = -2081\n")
+ self.defsfile.write("synthesizerNotRespondingOSErr = -2082\n")
+ self.defsfile.write("synthesizerOSErr = -2083\n")
+ self.defsfile.write("illegalNoteChannelOSErr = -2084\n")
+ self.defsfile.write("noteChannelNotAllocatedOSErr = -2085\n")
+ self.defsfile.write("tunePlayerFullOSErr = -2086\n")
+ self.defsfile.write("tuneParseOSErr = -2087\n")
+
+ def makeblacklistnames(self):
+ return [
+ "xmlIdentifierUnrecognized", # const with incompatible definition
+ "DisposeMovie", # Done on python-object disposal
+ "DisposeMovieTrack", # ditto
+ "DisposeTrackMedia", # ditto
+ "DisposeUserData", # ditto
+# "DisposeTimeBase", # ditto
+ "DisposeMovieController", # ditto
+
+ # The following 4 use 'void *' in an uncontrolled way
+ # TBD when I've read the manual...
+ "GetUserDataItem",
+ "SetUserDataItem",
+ "SetTextSampleData",
+ "BeginFullScreen",
+ # bgen gets the argument in/out wrong..
+ "AddTextSample",
+ "AddTESample",
+ "AddHiliteSample",
+ "HiliteTextSample",
+
+ "MakeTrackTimeTable", # Uses long * return?
+ "MakeMediaTimeTable", # ditto
+## "VideoMediaGetStallCount", # Undefined in CW Pro 3 library
+ # OS8 only:
+ 'SpriteMediaGetIndImageProperty', # XXXX Why isn't this in carbon?
+ 'CheckQuickTimeRegistration',
+ 'SetMovieAnchorDataRef',
+ 'GetMovieAnchorDataRef',
+ 'GetMovieLoadState',
+ 'OpenADataHandler',
+ 'MovieMediaGetCurrentMovieProperty',
+ 'MovieMediaGetCurrentTrackProperty',
+ 'MovieMediaGetChildMovieDataReference',
+ 'MovieMediaSetChildMovieDataReference',
+ 'MovieMediaLoadChildMovieFromDataReference',
+ 'Media3DGetViewObject',
+
+ # these are ImageCompression blacklists
+ "GraphicsExportGetInputPtr",
+
+ # QuickTimeComponents
+ # These two need some help: the first returns a point to a databuffer that
+ # the second disposes. Generate manually?
+ "VDCompressDone",
+ "VDReleaseCompressBuffer",
+ "QTVideoOutputGetGWorldParameters", # How useful is this?
+
+ # MediaHandlers
+ "MediaMakeMediaTimeTable", # just lazy
+ "MediaGetSampleDataPointer", # funny output pointer
+
+ # QuickTimeMusic
+ "kControllerMinimum",
+ # These are artefacts of a macro definition
+ "ulen",
+ "_ext",
+ "x",
+ "w1",
+ "w2",
+ ]
+
+ def makeblacklisttypes(self):
+ return [
+ # I don't think we want to do these
+ "QTSyncTaskPtr",
+ # We dont do callbacks yet, so no need for these
+ "QTCallBack",
+ # Skipped for now, due to laziness
+ "TrackEditState",
+ "MovieEditState",
+ "MatrixRecord",
+ "MatrixRecord_ptr",
+ "SampleReferencePtr",
+ "QTTweener",
+ "QTErrorReplacementPtr",
+ "QTRestrictionSet",
+ "QTUUID",
+ "QTUUID_ptr",
+
+ # Routine pointers, not yet.
+ "MoviesErrorUPP",
+ "MoviePreviewCallOutUPP",
+ "MovieDrawingCompleteUPP",
+ "QTCallBackUPP",
+ "TextMediaUPP",
+ "MovieProgressUPP",
+ "MovieRgnCoverUPP",
+ "MCActionFilterUPP",
+ "MCActionFilterWithRefConUPP",
+ "GetMovieUPP",
+ "ModalFilterUPP",
+ "TrackTransferUPP",
+ "MoviePrePrerollCompleteUPP",
+ "MovieExecuteWiredActionsUPP",
+ "QTBandwidthNotificationUPP",
+ "DoMCActionUPP",
+ "QTNextTaskNeededSoonerCallbackUPP",
+
+ "SampleReference64Ptr", # Don't know what this does, yet
+ "QTRuntimeSpriteDescPtr",
+ "QTBandwidthReference",
+ "QTScheduledBandwidthReference",
+ "QTAtomContainer",
+ "SpriteWorld",
+ "Sprite",
+
+ # these are ImageCompression blacklists
+ "ICMDataUPP",
+ "ICMFlushUPP",
+ "ICMCompletionUPP",
+ "ICMProgressUPP",
+ "StdPixUPP",
+ "QDPixUPP",
+ "ICMAlignmentUPP",
+ "ICMCursorShieldedUPP",
+ "ICMMemoryDisposedUPP",
+ "ICMConvertDataFormatUPP",
+ "ModalFilterYDUPP",
+ "FileFilterUPP",
+
+ "CodecNameSpecListPtr",
+ "CodecInfo",
+ "ImageSequence",
+ "MatrixRecordPtr",
+ "ICMDataProcRecordPtr",
+ "OpenCPicParams",
+ "ICMProgressProcRecordPtr",
+ "ICMAlignmentProcRecordPtr",
+ "ICMPixelFormatInfoPtr",
+ "ImageSequenceDataSource",
+ "ConstStrFileNameParam",
+ "ImageTranscodeSequence",
+ "ImageFieldSequence",
+ "Fract",
+ "PixMapPtr",
+ "GWorldFlags",
+ "void_ptr", # XXX Being lazy, this one is doable.
+
+ # These are from QuickTimeComponents
+ "CDataHandlerUPP",
+ "CharDataHandlerUPP",
+ "CommentHandlerUPP",
+ "DataHCompletionUPP",
+ "'MovieExportGetDataUPP",
+ "MovieExportGetPropertyUPP",
+ "PreprocessInstructionHandlerUPP",
+ "SGModalFilterUPP",
+ "StartDocumentHandlerUPP",
+ "StartElementHandlerUPP",
+ "VdigIntUPP",
+ "SGDataUPP",
+ "EndDocumentHandlerUPP",
+ "EndElementHandlerUPP",
+ "VideoBottles", # Record full of UPPs
+
+ "SCParams",
+ "ICMCompletionProcRecordPtr",
+ "DataHVolumeList",
+ "DigitizerInfo",
+ "SGCompressInfo",
+ "SeqGrabExtendedFrameInfoPtr",
+ "SeqGrabFrameInfoPtr",
+ "TCTextOptionsPtr",
+ "SGCompressInfo_ptr",
+ "SGDeviceList",
+ "TextDisplayData",
+ "TimeCodeDef",
+ "TimeCodeRecord",
+ "TweenRecord",
+ "VDGamRecPtr",
+ "ToneDescription", # XXXX Just lazy: this one is easy.
+ "XMLDoc",
+ "UInt64", # XXXX lazy
+ "UInt64_ptr", # XXXX lazy
+
+ # From MediaHandlers
+ "ActionsUPP",
+ "PrePrerollCompleteUPP",
+ "CodecComponentHandle", # Difficult: handle containing list of components.
+ "GetMovieCompleteParams", # Immense struct
+ "LevelMeterInfoPtr", # Lazy. Also: can be an output parameter!!
+ "MediaEQSpectrumBandsRecordPtr", # ditto
+
+ # From QuickTimeMusic
+ "MusicMIDISendUPP",
+ "MusicOfflineDataUPP",
+ "TuneCallBackUPP",
+ "TunePlayCallBackUPP",
+ "GCPart", # Struct with lots of fields
+ "GCPart_ptr",
+ "GenericKnobDescription", # Struct with lots of fields
+ "KnobDescription", # Struct with lots of fields
+ "InstrumentAboutInfo", # Struct, not too difficult
+ "NoteChannel", # XXXX Lazy. Could be opaque, I think
+ "NoteRequest", # XXXX Lazy. Not-too-difficult struct
+ "SynthesizerConnections", # Struct with lots of fields
+ "SynthesizerDescription", # Struct with lots of fields
+ "TuneStatus", # Struct with lots of fields
+
+ ]
+
+ def makerepairinstructions(self):
+ return [
+ ([('FSSpec', '*', 'OutMode')], [('FSSpec_ptr', '*', 'InMode')]),
+
+ # Movie controller creation
+ ([('ComponentInstance', 'NewMovieController', 'ReturnMode')],
+ [('MovieController', '*', 'ReturnMode')]),
+
+ # NewMovieFromFile
+ ([('short', 'resId', 'OutMode'), ('StringPtr', 'resName', 'InMode')],
+ [('short', 'resId', 'InOutMode'), ('dummyStringPtr', 'resName', 'InMode')]),
+
+ # MCDoAction and more
+ ([('void', '*', 'OutMode')], [('mcactionparams', '*', 'InMode')]),
+
+ # SetTimeBaseZero. Does not handle NULLs, unfortunately
+ ([('TimeRecord', 'zero', 'OutMode')], [('TimeRecord', 'zero', 'InMode')]),
+
+ # ConvertTime and ConvertTimeScale
+ ([('TimeRecord', 'inout', 'OutMode')], [('TimeRecord', 'inout', 'InOutMode')]),
+ ([('TimeRecord', 'theTime', 'OutMode')], [('TimeRecord', 'theTime', 'InOutMode')]),
+
+ # AddTime and SubtractTime
+ ([('TimeRecord', 'dst', 'OutMode')], [('TimeRecord', 'dst', 'InOutMode')]),
+
+ # Funny definitions
+ ([('char_ptr', '*', 'InMode')], [('stringptr', '*', 'InMode')]),
+ ([('FSSpecPtr', '*', 'InMode')], [('FSSpec_ptr', '*', 'InMode')]),
+ ([('unsigned_char', 'swfVersion', 'OutMode')], [('UInt8', 'swfVersion', 'OutMode')]),
+
+ # It seems MusicMIDIPacket if never flagged with const but always used
+ # for sending only. If that ever changes this needs to be fixed.
+ ([('MusicMIDIPacket', '*', 'OutMode')], [('MusicMIDIPacket_ptr', '*', 'InMode')]),
+
+ # QTMusic const-less input parameters
+ ([('unsigned_long', 'header', 'OutMode')], [('UnsignedLongPtr', 'header', 'InMode')]),
+ ]
+
+if __name__ == "__main__":
+ main()
diff --git a/Mac/Modules/qt/qtsupport.py b/Mac/Modules/qt/qtsupport.py
new file mode 100644
index 0000000000..14e6d1660d
--- /dev/null
+++ b/Mac/Modules/qt/qtsupport.py
@@ -0,0 +1,382 @@
+# This script generates a Python interface for an Apple Macintosh Manager.
+# It uses the "bgen" package to generate C code.
+# The function specifications are generated by scanning the mamager's header file,
+# using the "scantools" package (customized for this particular manager).
+
+#error missing SetActionFilter
+
+import string
+
+# Declarations that change for each manager
+MACHEADERFILE = 'Movies.h' # The Apple header file
+MODNAME = '_Qt' # The name of the module
+OBJECTNAME = 'Movie' # The basic name of the objects used here
+
+# The following is *usually* unchanged but may still require tuning
+MODPREFIX = 'Qt' # The prefix for module-wide routines
+OBJECTTYPE = "Movie" # The C type used to represent them
+OBJECTPREFIX = MODPREFIX + 'Obj' # The prefix for object methods
+INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner
+OUTPUTFILE = MODNAME + "module.c" # The file generated by this program
+
+from macsupport import *
+
+# Create the type objects
+
+includestuff = includestuff + """
+#include <QuickTime/QuickTime.h>
+
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_TrackObj_New(Track);
+extern int _TrackObj_Convert(PyObject *, Track *);
+extern PyObject *_MovieObj_New(Movie);
+extern int _MovieObj_Convert(PyObject *, Movie *);
+extern PyObject *_MovieCtlObj_New(MovieController);
+extern int _MovieCtlObj_Convert(PyObject *, MovieController *);
+extern PyObject *_TimeBaseObj_New(TimeBase);
+extern int _TimeBaseObj_Convert(PyObject *, TimeBase *);
+extern PyObject *_UserDataObj_New(UserData);
+extern int _UserDataObj_Convert(PyObject *, UserData *);
+extern PyObject *_MediaObj_New(Media);
+extern int _MediaObj_Convert(PyObject *, Media *);
+
+#define TrackObj_New _TrackObj_New
+#define TrackObj_Convert _TrackObj_Convert
+#define MovieObj_New _MovieObj_New
+#define MovieObj_Convert _MovieObj_Convert
+#define MovieCtlObj_New _MovieCtlObj_New
+#define MovieCtlObj_Convert _MovieCtlObj_Convert
+#define TimeBaseObj_New _TimeBaseObj_New
+#define TimeBaseObj_Convert _TimeBaseObj_Convert
+#define UserDataObj_New _UserDataObj_New
+#define UserDataObj_Convert _UserDataObj_Convert
+#define MediaObj_New _MediaObj_New
+#define MediaObj_Convert _MediaObj_Convert
+#endif
+
+/* Macro to allow us to GetNextInterestingTime without duration */
+#define GetMediaNextInterestingTimeOnly(media, flags, time, rate, rv) \
+ GetMediaNextInterestingTime(media, flags, time, rate, rv, NULL)
+
+/*
+** Parse/generate time records
+*/
+static PyObject *
+QtTimeRecord_New(TimeRecord *itself)
+{
+ if (itself->base)
+ return Py_BuildValue("O&lO&", PyMac_Buildwide, &itself->value, itself->scale,
+ TimeBaseObj_New, itself->base);
+ else
+ return Py_BuildValue("O&lO", PyMac_Buildwide, &itself->value, itself->scale,
+ Py_None);
+}
+
+static int
+QtTimeRecord_Convert(PyObject *v, TimeRecord *p_itself)
+{
+ PyObject *base = NULL;
+ if( !PyArg_ParseTuple(v, "O&l|O", PyMac_Getwide, &p_itself->value, &p_itself->scale,
+ &base) )
+ return 0;
+ if ( base == NULL || base == Py_None )
+ p_itself->base = NULL;
+ else
+ if ( !TimeBaseObj_Convert(base, &p_itself->base) )
+ return 0;
+ return 1;
+}
+
+static int
+QtMusicMIDIPacket_Convert(PyObject *v, MusicMIDIPacket *p_itself)
+{
+ int dummy;
+
+ if( !PyArg_ParseTuple(v, "hls#", &p_itself->length, &p_itself->reserved, p_itself->data, dummy) )
+ return 0;
+ return 1;
+}
+
+
+
+"""
+
+initstuff = initstuff + """
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(Track, TrackObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Track, TrackObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(Movie, MovieObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Movie, MovieObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(MovieController, MovieCtlObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MovieController, MovieCtlObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(TimeBase, TimeBaseObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TimeBase, TimeBaseObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(UserData, UserDataObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(UserData, UserDataObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(Media, MediaObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Media, MediaObj_Convert);
+"""
+
+# Our (opaque) objects
+Movie = OpaqueByValueType('Movie', 'MovieObj')
+NullMovie = FakeType("(Movie)0")
+Track = OpaqueByValueType('Track', 'TrackObj')
+Media = OpaqueByValueType('Media', 'MediaObj')
+UserData = OpaqueByValueType('UserData', 'UserDataObj')
+TimeBase = OpaqueByValueType('TimeBase', 'TimeBaseObj')
+MovieController = OpaqueByValueType('MovieController', 'MovieCtlObj')
+IdleManager = OpaqueByValueType('IdleManager', 'IdleManagerObj')
+SGOutput = OpaqueByValueType('SGOutput', 'SGOutputObj')
+
+# Other opaque objects
+Component = OpaqueByValueType('Component', 'CmpObj')
+MediaHandlerComponent = OpaqueByValueType('MediaHandlerComponent', 'CmpObj')
+DataHandlerComponent = OpaqueByValueType('DataHandlerComponent', 'CmpObj')
+CompressorComponent = OpaqueByValueType('CompressorComponent', 'CmpObj')
+DecompressorComponent = OpaqueByValueType('DecompressorComponent', 'CmpObj')
+CodecComponent = OpaqueByValueType('CodecComponent', 'CmpObj')
+
+# Despite their names, these are all ComponentInstance types
+GraphicsImportComponent = OpaqueByValueType('GraphicsImportComponent', 'CmpInstObj')
+GraphicsExportComponent = OpaqueByValueType('GraphicsExportComponent', 'CmpInstObj')
+ImageTranscoderComponent = OpaqueByValueType('ImageTranscoderComponent', 'CmpInstObj')
+MovieImportComponent = OpaqueByValueType('MovieImportComponent', 'CmpInstObj')
+MovieExportComponent = OpaqueByValueType('MovieExportComponent', 'CmpInstObj')
+TextExportComponent = OpaqueByValueType('TextExportComponent', 'CmpInstObj')
+GraphicImageMovieImportComponent = OpaqueByValueType('GraphicImageMovieImportComponent', 'CmpInstObj')
+pnotComponent = OpaqueByValueType('pnotComponent', 'CmpInstObj')
+# DataCompressorComponent, DataDecompressorComponent would go here
+DataCodecComponent = OpaqueByValueType('DataCodecComponent', 'CmpInstObj')
+TweenerComponent = OpaqueByValueType('TweenerComponent', 'CmpInstObj')
+QTVideoOutputComponent = OpaqueByValueType('QTVideoOutputComponent', 'CmpInstObj')
+SeqGrabComponent = OpaqueByValueType('SeqGrabComponent', 'CmpInstObj')
+VideoDigitizerComponent = OpaqueByValueType('VideoDigitizerComponent', 'CmpInstObj')
+
+ComponentInstance = OpaqueByValueType('ComponentInstance', 'CmpInstObj')
+MediaHandler = OpaqueByValueType('MediaHandler', 'CmpInstObj')
+DataHandler = OpaqueByValueType('DataHandler', 'CmpInstObj')
+SGChannel = OpaqueByValueType('SGChannel', 'CmpInstObj')
+TunePlayer = OpaqueByValueType('TunePlayer', 'CmpInstObj')
+MusicComponent = OpaqueByValueType('MusicComponent', 'CmpInstObj')
+NoteAllocator = OpaqueByValueType('NoteAllocator', 'CmpInstObj')
+QTMIDIComponent = OpaqueByValueType('QTMIDIComponent', 'CmpInstObj')
+
+ConstFSSpecPtr = FSSpec_ptr
+GrafPtr = OpaqueByValueType("GrafPtr", "GrafObj")
+Byte = Boolean # XXXX For GetPaused and SetPaused
+
+RgnHandle = OpaqueByValueType("RgnHandle", "ResObj")
+PicHandle = OpaqueByValueType("PicHandle", "ResObj")
+CTabHandle = OpaqueByValueType("CTabHandle", "ResObj")
+PixMapHandle = OpaqueByValueType("PixMapHandle", "ResObj")
+SampleDescriptionHandle = OpaqueByValueType("SampleDescriptionHandle", "ResObj")
+ImageDescriptionHandle = OpaqueByValueType("ImageDescriptionHandle", "ResObj")
+TextDescriptionHandle = OpaqueByValueType("TextDescriptionHandle", "ResObj")
+TEHandle = OpaqueByValueType("TEHandle", "ResObj")
+CGrafPtr = OpaqueByValueType("CGrafPtr", "GrafObj")
+GDHandle = OpaqueByValueType("GDHandle", "OptResObj")
+AliasHandle = OpaqueByValueType("AliasHandle", "ResObj")
+SoundDescriptionHandle = OpaqueByValueType("SoundDescriptionHandle", "ResObj")
+VdigBufferRecListHandle = OpaqueByValueType("VdigBufferRecListHandle", "ResObj")
+VDCompressionListHandle = OpaqueByValueType("VDCompressionListHandle", "ResObj")
+TimeCodeDescriptionHandle = OpaqueByValueType("TimeCodeDescriptionHandle", "ResObj")
+DataHFileTypeOrderingHandle = OpaqueByValueType("DataHFileTypeOrderingHandle", "ResObj")
+QTMIDIPortListHandle = OpaqueByValueType("QTMIDIPortListHandle", "ResObj")
+GenericKnobDescriptionListHandle = OpaqueByValueType("GenericKnobDescriptionListHandle", "ResObj")
+InstrumentInfoListHandle = OpaqueByValueType("InstrumentInfoListHandle", "ResObj")
+# Silly Apple, passing an OStype by reference...
+OSType_ptr = OpaqueType("OSType", "PyMac_BuildOSType", "PyMac_GetOSType")
+# And even sillier: passing floats by address
+float_ptr = ByAddressType("float", "f")
+
+RGBColor = OpaqueType("RGBColor", "QdRGB")
+RGBColor_ptr = RGBColor
+TimeRecord = OpaqueType("TimeRecord", "QtTimeRecord")
+TimeRecord_ptr = TimeRecord
+MusicMIDIPacket = OpaqueType("MusicMIDIPacket", "QtMusicMIDIPacket")
+MusicMIDIPacket_ptr = MusicMIDIPacket
+
+# Non-opaque types, mostly integer-ish
+TimeValue = Type("TimeValue", "l")
+TimeScale = Type("TimeScale", "l")
+TimeBaseFlags = Type("TimeBaseFlags", "l")
+QTCallBackFlags = Type("QTCallBackFlags", "H")
+TimeBaseStatus = Type("TimeBaseStatus", "l")
+QTCallBackType = Type("QTCallBackType", "H")
+nextTimeFlagsEnum = Type("nextTimeFlagsEnum", "H")
+createMovieFileFlagsEnum = Type("createMovieFileFlagsEnum", "l")
+movieFlattenFlagsEnum = Type("movieFlattenFlagsEnum", "l")
+dataRefAttributesFlags = Type("dataRefAttributesFlags", "l")
+playHintsEnum = Type("playHintsEnum", "l")
+mediaHandlerFlagsEnum = Type("mediaHandlerFlagsEnum", "l")
+ComponentResult = Type("ComponentResult", "l")
+VideoDigitizerError = Type("ComponentResult", "l")
+HandlerError = Type("HandlerError", "l")
+Ptr = InputOnlyType("Ptr", "s")
+StringPtr = Type("StringPtr", "s")
+UnsignedLongPtr = Type("unsigned long *", "s")
+mcactionparams = InputOnlyType("void *", "s")
+QTParameterDialog = Type("QTParameterDialog", "l")
+QTAtomID = Type("QTAtomID", "l")
+MCInterfaceElement = Type("MCInterfaceElement", "l")
+CodecType = OSTypeType("CodecType")
+GWorldPtr = OpaqueByValueType("GWorldPtr", "GWorldObj")
+QTFloatSingle = Type("QTFloatSingle", "f")
+CodecQ = Type("CodecQ", "l")
+MusicController = Type("MusicController", "l")
+
+# Could-not-be-bothered-types (NewMovieFromFile)
+dummyshortptr = FakeType('(short *)0')
+dummyStringPtr = FakeType('(StringPtr)0')
+
+# Not-quite-sure-this-is-okay types
+AtomicInstrument = OpaqueByValueType("AtomicInstrument", "ResObj")
+AtomicInstrumentPtr = InputOnlyType("AtomicInstrumentPtr", "s")
+
+# XXXX Need to override output_tp_newBody() to allow for None initializer.
+class QtGlobalObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
+ def outputCheckNewArg(self):
+ # We don't allow NULL pointers to be returned by QuickTime API calls,
+ # in stead we raise an exception
+ Output("""if (itself == NULL) {
+ PyErr_SetString(Qt_Error,"Cannot create %s from NULL pointer");
+ return NULL;
+ }""", self.name)
+
+ def outputCheckConvertArg(self):
+ # But what we do allow is passing None whereever a quicktime object is
+ # expected, and pass this as NULL to the API routines. Note you can
+ # call methods too by creating an object with None as the initializer.
+ Output("if (v == Py_None)")
+ OutLbrace()
+ Output("*p_itself = NULL;")
+ Output("return 1;")
+ OutRbrace()
+
+class MovieObjectDefinition(QtGlobalObjectDefinition):
+ def outputFreeIt(self, itselfname):
+ Output("if (%s) DisposeMovie(%s);", itselfname, itselfname)
+
+class TrackObjectDefinition(QtGlobalObjectDefinition):
+ def outputFreeIt(self, itselfname):
+ Output("if (%s) DisposeMovieTrack(%s);", itselfname, itselfname)
+
+class MediaObjectDefinition(QtGlobalObjectDefinition):
+ def outputFreeIt(self, itselfname):
+ Output("if (%s) DisposeTrackMedia(%s);", itselfname, itselfname)
+
+class UserDataObjectDefinition(QtGlobalObjectDefinition):
+ def outputFreeIt(self, itselfname):
+ Output("if (%s) DisposeUserData(%s);", itselfname, itselfname)
+
+class TimeBaseObjectDefinition(QtGlobalObjectDefinition):
+ pass
+
+class MovieCtlObjectDefinition(QtGlobalObjectDefinition):
+ def outputFreeIt(self, itselfname):
+ Output("if (%s) DisposeMovieController(%s);", itselfname, itselfname)
+
+class IdleManagerObjectDefinition(QtGlobalObjectDefinition):
+ pass
+
+class SGOutputObjectDefinition(QtGlobalObjectDefinition):
+ # XXXX I'm not sure I fully understand how SGOutput works. It seems it's always tied
+ # to a specific SeqGrabComponent, but I'm not 100% sure. Also, I'm not sure all the
+ # routines that return an SGOutput actually return a *new* SGOutput. Need to read up on
+ # this.
+ pass
+
+
+# From here on it's basically all boiler plate...
+
+# Create the generator groups and link them
+module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff)
+Movie_object = MovieObjectDefinition('Movie', 'MovieObj', 'Movie')
+Track_object = TrackObjectDefinition('Track', 'TrackObj', 'Track')
+Media_object = MediaObjectDefinition('Media', 'MediaObj', 'Media')
+UserData_object = UserDataObjectDefinition('UserData', 'UserDataObj', 'UserData')
+TimeBase_object = TimeBaseObjectDefinition('TimeBase', 'TimeBaseObj', 'TimeBase')
+MovieController_object = MovieCtlObjectDefinition('MovieController', 'MovieCtlObj', 'MovieController')
+IdleManager_object = IdleManagerObjectDefinition('IdleManager', 'IdleManagerObj', 'IdleManager')
+SGOutput_object = SGOutputObjectDefinition('SGOutput', 'SGOutputObj', 'SGOutput')
+
+module.addobject(IdleManager_object)
+module.addobject(MovieController_object)
+module.addobject(TimeBase_object)
+module.addobject(UserData_object)
+module.addobject(Media_object)
+module.addobject(Track_object)
+module.addobject(Movie_object)
+module.addobject(SGOutput_object)
+
+# Test which types we are still missing.
+execfile(string.lower(MODPREFIX) + 'typetest.py')
+
+# Create the generator classes used to populate the lists
+Function = OSErrWeakLinkFunctionGenerator
+Method = OSErrWeakLinkMethodGenerator
+
+# Create and populate the lists
+functions = []
+IdleManager_methods = []
+MovieController_methods = []
+TimeBase_methods = []
+UserData_methods = []
+Media_methods = []
+Track_methods = []
+Movie_methods = []
+SGOutput_methods = []
+execfile(INPUTFILE)
+
+#
+# Some functions from ImageCompression.h that we need:
+ICMAlignmentProcRecordPtr = FakeType('(ICMAlignmentProcRecordPtr)0')
+dummyRect = FakeType('(Rect *)0')
+
+f = Function(void, 'AlignWindow',
+ (WindowPtr, 'wp', InMode),
+ (Boolean, 'front', InMode),
+ (dummyRect, 'alignmentRect', InMode),
+ (ICMAlignmentProcRecordPtr, 'alignmentProc', InMode),
+)
+functions.append(f)
+
+f = Function(void, 'DragAlignedWindow',
+ (WindowPtr, 'wp', InMode),
+ (Point, 'startPt', InMode),
+ (Rect_ptr, 'boundsRect', InMode),
+ (dummyRect, 'alignmentRect', InMode),
+ (ICMAlignmentProcRecordPtr, 'alignmentProc', InMode),
+)
+functions.append(f)
+
+# And we want the version of MoviesTask without a movie argument
+f = Function(void, 'MoviesTask',
+ (NullMovie, 'theMovie', InMode),
+ (long, 'maxMilliSecToUse', InMode),
+)
+functions.append(f)
+
+# And we want a GetMediaNextInterestingTime without duration
+f = Method(void, 'GetMediaNextInterestingTimeOnly',
+ (Media, 'theMedia', InMode),
+ (short, 'interestingTimeFlags', InMode),
+ (TimeValue, 'time', InMode),
+ (Fixed, 'rate', InMode),
+ (TimeValue, 'interestingTime', OutMode),
+)
+Media_methods.append(f)
+
+# add the populated lists to the generator groups
+# (in a different wordl the scan program would generate this)
+for f in functions: module.add(f)
+for f in MovieController_methods: MovieController_object.add(f)
+for f in TimeBase_methods: TimeBase_object.add(f)
+for f in UserData_methods: UserData_object.add(f)
+for f in Media_methods: Media_object.add(f)
+for f in Track_methods: Track_object.add(f)
+for f in Movie_methods: Movie_object.add(f)
+
+# generate output (open the output file as late as possible)
+SetOutputFileName(OUTPUTFILE)
+module.generate()
diff --git a/Mac/Modules/qt/setup.py b/Mac/Modules/qt/setup.py
new file mode 100644
index 0000000000..8442011ab9
--- /dev/null
+++ b/Mac/Modules/qt/setup.py
@@ -0,0 +1,13 @@
+# This is a temporary setup script to allow distribution of
+# MacPython 2.4 modules for MacPython 2.3.
+
+from distutils.core import Extension, setup
+
+setup(name="QuickTime", version="0.2",
+ ext_modules=[
+ Extension('QuickTime._Qt', ['_Qtmodule.c'],
+ extra_link_args=['-framework', 'Carbon', '-framework', 'QuickTime'])
+ ],
+ py_modules=['QuickTime.Qt', 'QuickTime.QuickTime'],
+ package_dir={'QuickTime':'../../../Lib/plat-mac/Carbon'}
+ )
diff --git a/Mac/Modules/res/_Resmodule.c b/Mac/Modules/res/_Resmodule.c
new file mode 100644
index 0000000000..f5824b1f7c
--- /dev/null
+++ b/Mac/Modules/res/_Resmodule.c
@@ -0,0 +1,1760 @@
+
+/* ========================== Module _Res =========================== */
+
+#include "Python.h"
+
+
+#include "pymactoolbox.h"
+
+/* Macro to test whether a weak-loaded CFM function exists */
+#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
+ PyErr_SetString(PyExc_NotImplementedError, \
+ "Not available in this shared library/OS version"); \
+ return NULL; \
+ }} while(0)
+
+
+#include <Carbon/Carbon.h>
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_ResObj_New(Handle);
+extern int _ResObj_Convert(PyObject *, Handle *);
+extern PyObject *_OptResObj_New(Handle);
+extern int _OptResObj_Convert(PyObject *, Handle *);
+#define ResObj_New _ResObj_New
+#define ResObj_Convert _ResObj_Convert
+#define OptResObj_New _OptResObj_New
+#define OptResObj_Convert _OptResObj_Convert
+#endif
+
+/* Function to dispose a resource, with a "normal" calling sequence */
+static void
+PyMac_AutoDisposeHandle(Handle h)
+{
+ DisposeHandle(h);
+}
+
+static PyObject *Res_Error;
+
+/* ---------------------- Object type Resource ---------------------- */
+
+PyTypeObject Resource_Type;
+
+#define ResObj_Check(x) ((x)->ob_type == &Resource_Type || PyObject_TypeCheck((x), &Resource_Type))
+
+typedef struct ResourceObject {
+ PyObject_HEAD
+ Handle ob_itself;
+ void (*ob_freeit)(Handle ptr);
+} ResourceObject;
+
+PyObject *ResObj_New(Handle itself)
+{
+ ResourceObject *it;
+ if (itself == NULL) return PyMac_Error(resNotFound);
+ it = PyObject_NEW(ResourceObject, &Resource_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ it->ob_freeit = NULL;
+ return (PyObject *)it;
+}
+
+int ResObj_Convert(PyObject *v, Handle *p_itself)
+{
+ if (!ResObj_Check(v))
+ {
+ PyObject *tmp;
+ if ( (tmp=PyObject_CallMethod(v, "as_Resource", "")) )
+ {
+ *p_itself = ((ResourceObject *)tmp)->ob_itself;
+ Py_DECREF(tmp);
+ return 1;
+ }
+ PyErr_Clear();
+ }
+ if (!ResObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "Resource required");
+ return 0;
+ }
+ *p_itself = ((ResourceObject *)v)->ob_itself;
+ return 1;
+}
+
+static void ResObj_dealloc(ResourceObject *self)
+{
+ if (self->ob_freeit && self->ob_itself)
+ {
+ self->ob_freeit(self->ob_itself);
+ }
+ self->ob_itself = NULL;
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *ResObj_HomeResFile(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+#ifndef HomeResFile
+ PyMac_PRECHECK(HomeResFile);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = HomeResFile(_self->ob_itself);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *ResObj_MacLoadResource(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef MacLoadResource
+ PyMac_PRECHECK(MacLoadResource);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ MacLoadResource(_self->ob_itself);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ResObj_ReleaseResource(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef ReleaseResource
+ PyMac_PRECHECK(ReleaseResource);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ReleaseResource(_self->ob_itself);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ResObj_DetachResource(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef DetachResource
+ PyMac_PRECHECK(DetachResource);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ DetachResource(_self->ob_itself);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ResObj_GetResAttrs(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+#ifndef GetResAttrs
+ PyMac_PRECHECK(GetResAttrs);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetResAttrs(_self->ob_itself);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *ResObj_GetResInfo(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short theID;
+ ResType theType;
+ Str255 name;
+#ifndef GetResInfo
+ PyMac_PRECHECK(GetResInfo);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetResInfo(_self->ob_itself,
+ &theID,
+ &theType,
+ name);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("hO&O&",
+ theID,
+ PyMac_BuildOSType, theType,
+ PyMac_BuildStr255, name);
+ return _res;
+}
+
+static PyObject *ResObj_SetResInfo(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short theID;
+ Str255 name;
+#ifndef SetResInfo
+ PyMac_PRECHECK(SetResInfo);
+#endif
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &theID,
+ PyMac_GetStr255, name))
+ return NULL;
+ SetResInfo(_self->ob_itself,
+ theID,
+ name);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ResObj_AddResource(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ResType theType;
+ short theID;
+ Str255 name;
+#ifndef AddResource
+ PyMac_PRECHECK(AddResource);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hO&",
+ PyMac_GetOSType, &theType,
+ &theID,
+ PyMac_GetStr255, name))
+ return NULL;
+ AddResource(_self->ob_itself,
+ theType,
+ theID,
+ name);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ResObj_GetResourceSizeOnDisk(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+#ifndef GetResourceSizeOnDisk
+ PyMac_PRECHECK(GetResourceSizeOnDisk);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetResourceSizeOnDisk(_self->ob_itself);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *ResObj_GetMaxResourceSize(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+#ifndef GetMaxResourceSize
+ PyMac_PRECHECK(GetMaxResourceSize);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMaxResourceSize(_self->ob_itself);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *ResObj_SetResAttrs(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short attrs;
+#ifndef SetResAttrs
+ PyMac_PRECHECK(SetResAttrs);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &attrs))
+ return NULL;
+ SetResAttrs(_self->ob_itself,
+ attrs);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ResObj_ChangedResource(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef ChangedResource
+ PyMac_PRECHECK(ChangedResource);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ChangedResource(_self->ob_itself);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ResObj_RemoveResource(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef RemoveResource
+ PyMac_PRECHECK(RemoveResource);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ RemoveResource(_self->ob_itself);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ResObj_WriteResource(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef WriteResource
+ PyMac_PRECHECK(WriteResource);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ WriteResource(_self->ob_itself);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ResObj_SetResourceSize(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long newSize;
+#ifndef SetResourceSize
+ PyMac_PRECHECK(SetResourceSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &newSize))
+ return NULL;
+ SetResourceSize(_self->ob_itself,
+ newSize);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ResObj_GetNextFOND(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+#ifndef GetNextFOND
+ PyMac_PRECHECK(GetNextFOND);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetNextFOND(_self->ob_itself);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+#ifndef __LP64__
+static PyObject *ResObj_as_Control(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ _res = CtlObj_New((ControlHandle)_self->ob_itself);
+ return _res;
+
+}
+
+static PyObject *ResObj_as_Menu(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ _res = MenuObj_New((MenuHandle)_self->ob_itself);
+ return _res;
+
+}
+#endif /* !__LP64__ */
+
+static PyObject *ResObj_LoadResource(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef LoadResource
+ PyMac_PRECHECK(LoadResource);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ LoadResource(_self->ob_itself);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ResObj_AutoDispose(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ int onoff, old = 0;
+ if (!PyArg_ParseTuple(_args, "i", &onoff))
+ return NULL;
+ if ( _self->ob_freeit )
+ old = 1;
+ if ( onoff )
+ _self->ob_freeit = PyMac_AutoDisposeHandle;
+ else
+ _self->ob_freeit = NULL;
+ _res = Py_BuildValue("i", old);
+ return _res;
+
+}
+
+static PyMethodDef ResObj_methods[] = {
+ {"HomeResFile", (PyCFunction)ResObj_HomeResFile, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"MacLoadResource", (PyCFunction)ResObj_MacLoadResource, 1,
+ PyDoc_STR("() -> None")},
+ {"ReleaseResource", (PyCFunction)ResObj_ReleaseResource, 1,
+ PyDoc_STR("() -> None")},
+ {"DetachResource", (PyCFunction)ResObj_DetachResource, 1,
+ PyDoc_STR("() -> None")},
+ {"GetResAttrs", (PyCFunction)ResObj_GetResAttrs, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"GetResInfo", (PyCFunction)ResObj_GetResInfo, 1,
+ PyDoc_STR("() -> (short theID, ResType theType, Str255 name)")},
+ {"SetResInfo", (PyCFunction)ResObj_SetResInfo, 1,
+ PyDoc_STR("(short theID, Str255 name) -> None")},
+ {"AddResource", (PyCFunction)ResObj_AddResource, 1,
+ PyDoc_STR("(ResType theType, short theID, Str255 name) -> None")},
+ {"GetResourceSizeOnDisk", (PyCFunction)ResObj_GetResourceSizeOnDisk, 1,
+ PyDoc_STR("() -> (long _rv)")},
+ {"GetMaxResourceSize", (PyCFunction)ResObj_GetMaxResourceSize, 1,
+ PyDoc_STR("() -> (long _rv)")},
+ {"SetResAttrs", (PyCFunction)ResObj_SetResAttrs, 1,
+ PyDoc_STR("(short attrs) -> None")},
+ {"ChangedResource", (PyCFunction)ResObj_ChangedResource, 1,
+ PyDoc_STR("() -> None")},
+ {"RemoveResource", (PyCFunction)ResObj_RemoveResource, 1,
+ PyDoc_STR("() -> None")},
+ {"WriteResource", (PyCFunction)ResObj_WriteResource, 1,
+ PyDoc_STR("() -> None")},
+ {"SetResourceSize", (PyCFunction)ResObj_SetResourceSize, 1,
+ 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,
+ PyDoc_STR("(int)->int. Automatically DisposeHandle the object on Python object cleanup")},
+ {NULL, NULL, 0}
+};
+
+static PyObject *ResObj_get_data(ResourceObject *self, void *closure)
+{
+
+ PyObject *res;
+ char state;
+
+ state = HGetState(self->ob_itself);
+ HLock(self->ob_itself);
+ res = PyString_FromStringAndSize(
+ *self->ob_itself,
+ GetHandleSize(self->ob_itself));
+ HUnlock(self->ob_itself);
+ HSetState(self->ob_itself, state);
+ return res;
+
+}
+
+static int ResObj_set_data(ResourceObject *self, PyObject *v, void *closure)
+{
+
+ char *data;
+ long size;
+
+ if ( v == NULL )
+ return -1;
+ if ( !PyString_Check(v) )
+ return -1;
+ size = PyString_Size(v);
+ data = PyString_AsString(v);
+ /* XXXX Do I need the GetState/SetState calls? */
+ SetHandleSize(self->ob_itself, size);
+ if ( MemError())
+ return -1;
+ HLock(self->ob_itself);
+ memcpy((char *)*self->ob_itself, data, size);
+ HUnlock(self->ob_itself);
+ /* XXXX Should I do the Changed call immedeately? */
+ return 0;
+
+ return 0;
+}
+
+static PyObject *ResObj_get_size(ResourceObject *self, void *closure)
+{
+ return PyInt_FromLong(GetHandleSize(self->ob_itself));
+}
+
+#define ResObj_set_size NULL
+
+static PyGetSetDef ResObj_getsetlist[] = {
+ {"data", (getter)ResObj_get_data, (setter)ResObj_set_data, "The resource data"},
+ {"size", (getter)ResObj_get_size, (setter)ResObj_set_size, "The length of the resource data"},
+ {NULL, NULL, NULL, NULL},
+};
+
+
+#define ResObj_compare NULL
+
+#define ResObj_repr NULL
+
+#define ResObj_hash NULL
+static int ResObj_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds)
+{
+ char *srcdata = NULL;
+ int srclen = 0;
+ Handle itself;
+ char *kw[] = {"itself", 0};
+
+ if (PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, ResObj_Convert, &itself))
+ {
+ ((ResourceObject *)_self)->ob_itself = itself;
+ return 0;
+ }
+ PyErr_Clear();
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "|s#", kw, &srcdata, &srclen)) return -1;
+ if ((itself = NewHandle(srclen)) == NULL)
+ {
+ PyErr_NoMemory();
+ return 0;
+ }
+ ((ResourceObject *)_self)->ob_itself = itself;
+ if (srclen && srcdata)
+ {
+ HLock(itself);
+ memcpy(*itself, srcdata, srclen);
+ HUnlock(itself);
+ }
+ return 0;
+}
+
+#define ResObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *ResObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *self;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((ResourceObject *)self)->ob_itself = NULL;
+ ((ResourceObject *)self)->ob_freeit = NULL;
+ return self;
+}
+
+#define ResObj_tp_free PyObject_Del
+
+
+PyTypeObject Resource_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_Res.Resource", /*tp_name*/
+ sizeof(ResourceObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) ResObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) ResObj_compare, /*tp_compare*/
+ (reprfunc) ResObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) ResObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ ResObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ ResObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ ResObj_tp_init, /* tp_init */
+ ResObj_tp_alloc, /* tp_alloc */
+ ResObj_tp_new, /* tp_new */
+ ResObj_tp_free, /* tp_free */
+};
+
+/* -------------------- End object type Resource -------------------- */
+
+
+static PyObject *Res_CloseResFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short refNum;
+#ifndef CloseResFile
+ PyMac_PRECHECK(CloseResFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &refNum))
+ return NULL;
+ CloseResFile(refNum);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Res_ResError(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+#ifndef ResError
+ PyMac_PRECHECK(ResError);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Res_CurResFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+#ifndef CurResFile
+ PyMac_PRECHECK(CurResFile);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CurResFile();
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Res_UseResFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short refNum;
+#ifndef UseResFile
+ PyMac_PRECHECK(UseResFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &refNum))
+ return NULL;
+ UseResFile(refNum);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Res_CountTypes(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+#ifndef CountTypes
+ PyMac_PRECHECK(CountTypes);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CountTypes();
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Res_Count1Types(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+#ifndef Count1Types
+ PyMac_PRECHECK(Count1Types);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = Count1Types();
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Res_GetIndType(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ResType theType;
+ short index;
+#ifndef GetIndType
+ PyMac_PRECHECK(GetIndType);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &index))
+ return NULL;
+ GetIndType(&theType,
+ index);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("O&",
+ PyMac_BuildOSType, theType);
+ return _res;
+}
+
+static PyObject *Res_Get1IndType(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ResType theType;
+ short index;
+#ifndef Get1IndType
+ PyMac_PRECHECK(Get1IndType);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &index))
+ return NULL;
+ Get1IndType(&theType,
+ index);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("O&",
+ PyMac_BuildOSType, theType);
+ return _res;
+}
+
+static PyObject *Res_SetResLoad(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean load;
+#ifndef SetResLoad
+ PyMac_PRECHECK(SetResLoad);
+#endif
+ if (!PyArg_ParseTuple(_args, "b",
+ &load))
+ return NULL;
+ SetResLoad(load);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Res_CountResources(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ ResType theType;
+#ifndef CountResources
+ PyMac_PRECHECK(CountResources);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &theType))
+ return NULL;
+ _rv = CountResources(theType);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Res_Count1Resources(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ ResType theType;
+#ifndef Count1Resources
+ PyMac_PRECHECK(Count1Resources);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &theType))
+ return NULL;
+ _rv = Count1Resources(theType);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Res_GetIndResource(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+ ResType theType;
+ short index;
+#ifndef GetIndResource
+ PyMac_PRECHECK(GetIndResource);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ PyMac_GetOSType, &theType,
+ &index))
+ return NULL;
+ _rv = GetIndResource(theType,
+ index);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Res_Get1IndResource(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+ ResType theType;
+ short index;
+#ifndef Get1IndResource
+ PyMac_PRECHECK(Get1IndResource);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ PyMac_GetOSType, &theType,
+ &index))
+ return NULL;
+ _rv = Get1IndResource(theType,
+ index);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Res_GetResource(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+ ResType theType;
+ short theID;
+#ifndef GetResource
+ PyMac_PRECHECK(GetResource);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ PyMac_GetOSType, &theType,
+ &theID))
+ return NULL;
+ _rv = GetResource(theType,
+ theID);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Res_Get1Resource(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+ ResType theType;
+ short theID;
+#ifndef Get1Resource
+ PyMac_PRECHECK(Get1Resource);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ PyMac_GetOSType, &theType,
+ &theID))
+ return NULL;
+ _rv = Get1Resource(theType,
+ theID);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Res_GetNamedResource(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+ ResType theType;
+ Str255 name;
+#ifndef GetNamedResource
+ PyMac_PRECHECK(GetNamedResource);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &theType,
+ PyMac_GetStr255, name))
+ return NULL;
+ _rv = GetNamedResource(theType,
+ name);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Res_Get1NamedResource(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+ ResType theType;
+ Str255 name;
+#ifndef Get1NamedResource
+ PyMac_PRECHECK(Get1NamedResource);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &theType,
+ PyMac_GetStr255, name))
+ return NULL;
+ _rv = Get1NamedResource(theType,
+ name);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Res_UniqueID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ ResType theType;
+#ifndef UniqueID
+ PyMac_PRECHECK(UniqueID);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &theType))
+ return NULL;
+ _rv = UniqueID(theType);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Res_Unique1ID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ ResType theType;
+#ifndef Unique1ID
+ PyMac_PRECHECK(Unique1ID);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &theType))
+ return NULL;
+ _rv = Unique1ID(theType);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Res_UpdateResFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short refNum;
+#ifndef UpdateResFile
+ PyMac_PRECHECK(UpdateResFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &refNum))
+ return NULL;
+ UpdateResFile(refNum);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Res_SetResPurge(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean install;
+#ifndef SetResPurge
+ PyMac_PRECHECK(SetResPurge);
+#endif
+ if (!PyArg_ParseTuple(_args, "b",
+ &install))
+ return NULL;
+ SetResPurge(install);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Res_GetResFileAttrs(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ short refNum;
+#ifndef GetResFileAttrs
+ PyMac_PRECHECK(GetResFileAttrs);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &refNum))
+ return NULL;
+ _rv = GetResFileAttrs(refNum);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Res_SetResFileAttrs(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short refNum;
+ short attrs;
+#ifndef SetResFileAttrs
+ PyMac_PRECHECK(SetResFileAttrs);
+#endif
+ if (!PyArg_ParseTuple(_args, "hh",
+ &refNum,
+ &attrs))
+ return NULL;
+ SetResFileAttrs(refNum,
+ attrs);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+#ifndef __LP64__
+static PyObject *Res_OpenRFPerm(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ Str255 fileName;
+ short vRefNum;
+ SignedByte permission;
+#ifndef OpenRFPerm
+ PyMac_PRECHECK(OpenRFPerm);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hb",
+ PyMac_GetStr255, fileName,
+ &vRefNum,
+ &permission))
+ return NULL;
+ _rv = OpenRFPerm(fileName,
+ vRefNum,
+ permission);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Res_HOpenResFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ short vRefNum;
+ long dirID;
+ Str255 fileName;
+ SignedByte permission;
+#ifndef HOpenResFile
+ PyMac_PRECHECK(HOpenResFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "hlO&b",
+ &vRefNum,
+ &dirID,
+ PyMac_GetStr255, fileName,
+ &permission))
+ return NULL;
+ _rv = HOpenResFile(vRefNum,
+ dirID,
+ fileName,
+ permission);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Res_HCreateResFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short vRefNum;
+ long dirID;
+ Str255 fileName;
+#ifndef HCreateResFile
+ PyMac_PRECHECK(HCreateResFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "hlO&",
+ &vRefNum,
+ &dirID,
+ PyMac_GetStr255, fileName))
+ return NULL;
+ HCreateResFile(vRefNum,
+ dirID,
+ fileName);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Res_FSpOpenResFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ FSSpec spec;
+ SignedByte permission;
+#ifndef FSpOpenResFile
+ PyMac_PRECHECK(FSpOpenResFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&b",
+ PyMac_GetFSSpec, &spec,
+ &permission))
+ return NULL;
+ _rv = FSpOpenResFile(&spec,
+ permission);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Res_FSpCreateResFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ FSSpec spec;
+ OSType creator;
+ OSType fileType;
+ ScriptCode scriptTag;
+#ifndef FSpCreateResFile
+ PyMac_PRECHECK(FSpCreateResFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&h",
+ PyMac_GetFSSpec, &spec,
+ PyMac_GetOSType, &creator,
+ PyMac_GetOSType, &fileType,
+ &scriptTag))
+ return NULL;
+ FSpCreateResFile(&spec,
+ creator,
+ fileType,
+ scriptTag);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif /* !__LP64__ */
+
+static PyObject *Res_InsertResourceFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 refNum;
+ RsrcChainLocation where;
+#ifndef InsertResourceFile
+ PyMac_PRECHECK(InsertResourceFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "hh",
+ &refNum,
+ &where))
+ return NULL;
+ _err = InsertResourceFile(refNum,
+ where);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Res_DetachResourceFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 refNum;
+#ifndef DetachResourceFile
+ PyMac_PRECHECK(DetachResourceFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &refNum))
+ return NULL;
+ _err = DetachResourceFile(refNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+#ifndef __LP64__
+static PyObject *Res_FSpResourceFileAlreadyOpen(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ FSSpec resourceFile;
+ Boolean inChain;
+ SInt16 refNum;
+#ifndef FSpResourceFileAlreadyOpen
+ PyMac_PRECHECK(FSpResourceFileAlreadyOpen);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetFSSpec, &resourceFile))
+ return NULL;
+ _rv = FSpResourceFileAlreadyOpen(&resourceFile,
+ &inChain,
+ &refNum);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("bbh",
+ _rv,
+ inChain,
+ refNum);
+ return _res;
+}
+
+static PyObject *Res_FSpOpenOrphanResFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSSpec spec;
+ SignedByte permission;
+ SInt16 refNum;
+#ifndef FSpOpenOrphanResFile
+ PyMac_PRECHECK(FSpOpenOrphanResFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&b",
+ PyMac_GetFSSpec, &spec,
+ &permission))
+ return NULL;
+ _err = FSpOpenOrphanResFile(&spec,
+ permission,
+ &refNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ refNum);
+ return _res;
+}
+
+static PyObject *Res_GetTopResourceFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 refNum;
+#ifndef GetTopResourceFile
+ PyMac_PRECHECK(GetTopResourceFile);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetTopResourceFile(&refNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ refNum);
+ return _res;
+}
+
+
+static PyObject *Res_GetNextResourceFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 curRefNum;
+ SInt16 nextRefNum;
+#ifndef GetNextResourceFile
+ PyMac_PRECHECK(GetNextResourceFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &curRefNum))
+ return NULL;
+ _err = GetNextResourceFile(curRefNum,
+ &nextRefNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ nextRefNum);
+ return _res;
+}
+#endif /* !__LP64__ */
+
+static PyObject *Res_FSOpenResFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ FSRef ref;
+ SignedByte permission;
+#ifndef FSOpenResFile
+ PyMac_PRECHECK(FSOpenResFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&b",
+ PyMac_GetFSRef, &ref,
+ &permission))
+ return NULL;
+ _rv = FSOpenResFile(&ref,
+ permission);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+
+#ifndef __LP64__
+static PyObject *Res_FSCreateResFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ FSRef parentRef;
+ UniChar *nameLength__in__;
+ UniCharCount nameLength__len__;
+ int nameLength__in_len__;
+ FSRef newRef;
+ FSSpec newSpec;
+#ifndef FSCreateResFile
+ PyMac_PRECHECK(FSCreateResFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&u#",
+ PyMac_GetFSRef, &parentRef,
+ &nameLength__in__, &nameLength__in_len__))
+ return NULL;
+ nameLength__len__ = nameLength__in_len__;
+ FSCreateResFile(&parentRef,
+ nameLength__len__, nameLength__in__,
+ 0,
+ (FSCatalogInfo *)0,
+ &newRef,
+ &newSpec);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("O&O&",
+ PyMac_BuildFSRef, &newRef,
+ PyMac_BuildFSSpec, &newSpec);
+ return _res;
+}
+
+static PyObject *Res_FSResourceFileAlreadyOpen(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ FSRef resourceFileRef;
+ Boolean inChain;
+ SInt16 refNum;
+#ifndef FSResourceFileAlreadyOpen
+ PyMac_PRECHECK(FSResourceFileAlreadyOpen);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetFSRef, &resourceFileRef))
+ return NULL;
+ _rv = FSResourceFileAlreadyOpen(&resourceFileRef,
+ &inChain,
+ &refNum);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("bbh",
+ _rv,
+ inChain,
+ refNum);
+ return _res;
+}
+
+static PyObject *Res_FSCreateResourceFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSRef parentRef;
+ UniChar *nameLength__in__;
+ UniCharCount nameLength__len__;
+ int nameLength__in_len__;
+ UniChar *forkNameLength__in__;
+ UniCharCount forkNameLength__len__;
+ int forkNameLength__in_len__;
+ FSRef newRef;
+ FSSpec newSpec;
+#ifndef FSCreateResourceFile
+ PyMac_PRECHECK(FSCreateResourceFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&u#u#",
+ PyMac_GetFSRef, &parentRef,
+ &nameLength__in__, &nameLength__in_len__,
+ &forkNameLength__in__, &forkNameLength__in_len__))
+ return NULL;
+ nameLength__len__ = nameLength__in_len__;
+ forkNameLength__len__ = forkNameLength__in_len__;
+ _err = FSCreateResourceFile(&parentRef,
+ nameLength__len__, nameLength__in__,
+ 0,
+ (FSCatalogInfo *)0,
+ forkNameLength__len__, forkNameLength__in__,
+ &newRef,
+ &newSpec);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&O&",
+ PyMac_BuildFSRef, &newRef,
+ PyMac_BuildFSSpec, &newSpec);
+ return _res;
+}
+#endif /* __LP64__ */
+
+static PyObject *Res_FSOpenResourceFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSRef ref;
+ UniChar *forkNameLength__in__;
+ UniCharCount forkNameLength__len__;
+ int forkNameLength__in_len__;
+ SignedByte permissions;
+ ResFileRefNum refNum;
+#ifndef FSOpenResourceFile
+ PyMac_PRECHECK(FSOpenResourceFile);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&u#b",
+ PyMac_GetFSRef, &ref,
+ &forkNameLength__in__, &forkNameLength__in_len__,
+ &permissions))
+ return NULL;
+ forkNameLength__len__ = forkNameLength__in_len__;
+ _err = FSOpenResourceFile(&ref,
+ forkNameLength__len__, forkNameLength__in__,
+ permissions,
+ &refNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ refNum);
+ return _res;
+}
+
+static PyObject *Res_Handle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ char *buf;
+ int len;
+ Handle h;
+ ResourceObject *rv;
+
+ if (!PyArg_ParseTuple(_args, "s#", &buf, &len))
+ return NULL;
+ h = NewHandle(len);
+ if ( h == NULL ) {
+ PyErr_NoMemory();
+ return NULL;
+ }
+ HLock(h);
+ memcpy(*h, buf, len);
+ HUnlock(h);
+ rv = (ResourceObject *)ResObj_New(h);
+ rv->ob_freeit = PyMac_AutoDisposeHandle;
+ _res = (PyObject *)rv;
+ return _res;
+
+}
+
+static PyMethodDef Res_methods[] = {
+ {"CloseResFile", (PyCFunction)Res_CloseResFile, 1,
+ PyDoc_STR("(short refNum) -> None")},
+ {"ResError", (PyCFunction)Res_ResError, 1,
+ PyDoc_STR("() -> None")},
+ {"CurResFile", (PyCFunction)Res_CurResFile, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"UseResFile", (PyCFunction)Res_UseResFile, 1,
+ PyDoc_STR("(short refNum) -> None")},
+ {"CountTypes", (PyCFunction)Res_CountTypes, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"Count1Types", (PyCFunction)Res_Count1Types, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"GetIndType", (PyCFunction)Res_GetIndType, 1,
+ PyDoc_STR("(short index) -> (ResType theType)")},
+ {"Get1IndType", (PyCFunction)Res_Get1IndType, 1,
+ PyDoc_STR("(short index) -> (ResType theType)")},
+ {"SetResLoad", (PyCFunction)Res_SetResLoad, 1,
+ PyDoc_STR("(Boolean load) -> None")},
+ {"CountResources", (PyCFunction)Res_CountResources, 1,
+ PyDoc_STR("(ResType theType) -> (short _rv)")},
+ {"Count1Resources", (PyCFunction)Res_Count1Resources, 1,
+ PyDoc_STR("(ResType theType) -> (short _rv)")},
+ {"GetIndResource", (PyCFunction)Res_GetIndResource, 1,
+ PyDoc_STR("(ResType theType, short index) -> (Handle _rv)")},
+ {"Get1IndResource", (PyCFunction)Res_Get1IndResource, 1,
+ PyDoc_STR("(ResType theType, short index) -> (Handle _rv)")},
+ {"GetResource", (PyCFunction)Res_GetResource, 1,
+ PyDoc_STR("(ResType theType, short theID) -> (Handle _rv)")},
+ {"Get1Resource", (PyCFunction)Res_Get1Resource, 1,
+ PyDoc_STR("(ResType theType, short theID) -> (Handle _rv)")},
+ {"GetNamedResource", (PyCFunction)Res_GetNamedResource, 1,
+ PyDoc_STR("(ResType theType, Str255 name) -> (Handle _rv)")},
+ {"Get1NamedResource", (PyCFunction)Res_Get1NamedResource, 1,
+ PyDoc_STR("(ResType theType, Str255 name) -> (Handle _rv)")},
+ {"UniqueID", (PyCFunction)Res_UniqueID, 1,
+ PyDoc_STR("(ResType theType) -> (short _rv)")},
+ {"Unique1ID", (PyCFunction)Res_Unique1ID, 1,
+ PyDoc_STR("(ResType theType) -> (short _rv)")},
+ {"UpdateResFile", (PyCFunction)Res_UpdateResFile, 1,
+ PyDoc_STR("(short refNum) -> None")},
+ {"SetResPurge", (PyCFunction)Res_SetResPurge, 1,
+ PyDoc_STR("(Boolean install) -> None")},
+ {"GetResFileAttrs", (PyCFunction)Res_GetResFileAttrs, 1,
+ 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,
+ PyDoc_STR("(short vRefNum, long dirID, Str255 fileName, SignedByte permission) -> (short _rv)")},
+ {"HCreateResFile", (PyCFunction)Res_HCreateResFile, 1,
+ PyDoc_STR("(short vRefNum, long dirID, Str255 fileName) -> None")},
+ {"FSpOpenResFile", (PyCFunction)Res_FSpOpenResFile, 1,
+ 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,
+ PyDoc_STR("(FSSpec spec, SignedByte permission) -> (SInt16 refNum)")},
+ {"GetTopResourceFile", (PyCFunction)Res_GetTopResourceFile, 1,
+ 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,
+ PyDoc_STR("Convert a string to a Handle object.\n\nResource() and Handle() are very similar, but objects created with Handle() are\nby default automatically DisposeHandle()d upon object cleanup. Use AutoDispose()\nto change this.\n")},
+ {NULL, NULL, 0}
+};
+
+
+
+/* Alternative version of ResObj_New, which returns None for null argument */
+PyObject *OptResObj_New(Handle itself)
+{
+ if (itself == NULL) {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+ return ResObj_New(itself);
+}
+
+int OptResObj_Convert(PyObject *v, Handle *p_itself)
+{
+ PyObject *tmp;
+
+ if ( v == Py_None ) {
+ *p_itself = NULL;
+ return 1;
+ }
+ if (ResObj_Check(v))
+ {
+ *p_itself = ((ResourceObject *)v)->ob_itself;
+ return 1;
+ }
+ /* If it isn't a resource yet see whether it is convertible */
+ if ( (tmp=PyObject_CallMethod(v, "as_Resource", "")) ) {
+ *p_itself = ((ResourceObject *)tmp)->ob_itself;
+ Py_DECREF(tmp);
+ return 1;
+ }
+ PyErr_Clear();
+ PyErr_SetString(PyExc_TypeError, "Resource required");
+ return 0;
+}
+
+
+void init_Res(void)
+{
+ PyObject *m;
+ PyObject *d;
+
+
+
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(Handle, ResObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Handle, ResObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(Handle, OptResObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Handle, OptResObj_Convert);
+
+
+ m = Py_InitModule("_Res", Res_methods);
+ d = PyModule_GetDict(m);
+ Res_Error = PyMac_GetOSErrException();
+ if (Res_Error == NULL ||
+ PyDict_SetItemString(d, "Error", Res_Error) != 0)
+ return;
+ Resource_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&Resource_Type) < 0) return;
+ Py_INCREF(&Resource_Type);
+ PyModule_AddObject(m, "Resource", (PyObject *)&Resource_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&Resource_Type);
+ PyModule_AddObject(m, "ResourceType", (PyObject *)&Resource_Type);
+}
+
+/* ======================== End module _Res ========================= */
+
diff --git a/Mac/Modules/res/resedit.py b/Mac/Modules/res/resedit.py
new file mode 100644
index 0000000000..b3ef790385
--- /dev/null
+++ b/Mac/Modules/res/resedit.py
@@ -0,0 +1,102 @@
+##resource_body = """
+##char *buf;
+##int len;
+##Handle h;
+##
+##if (!PyArg_ParseTuple(_args, "s#", &buf, &len))
+## return NULL;
+##h = NewHandle(len);
+##if ( h == NULL ) {
+## PyErr_NoMemory();
+## return NULL;
+##}
+##HLock(h);
+##memcpy(*h, buf, len);
+##HUnlock(h);
+##_res = ResObj_New(h);
+##return _res;
+##"""
+##
+##f = ManualGenerator("Resource", resource_body)
+##f.docstring = lambda: """Convert a string to a resource object.
+##
+##The created resource object is actually just a handle,
+##apply AddResource() to write it to a resource file.
+##See also the Handle() docstring.
+##"""
+##functions.append(f)
+
+handle_body = """
+char *buf;
+int len;
+Handle h;
+ResourceObject *rv;
+
+if (!PyArg_ParseTuple(_args, "s#", &buf, &len))
+ return NULL;
+h = NewHandle(len);
+if ( h == NULL ) {
+ PyErr_NoMemory();
+ return NULL;
+}
+HLock(h);
+memcpy(*h, buf, len);
+HUnlock(h);
+rv = (ResourceObject *)ResObj_New(h);
+rv->ob_freeit = PyMac_AutoDisposeHandle;
+_res = (PyObject *)rv;
+return _res;
+"""
+
+f = ManualGenerator("Handle", handle_body)
+f.docstring = lambda: """Convert a string to a Handle object.
+
+Resource() and Handle() are very similar, but objects created with Handle() are
+by default automatically DisposeHandle()d upon object cleanup. Use AutoDispose()
+to change this.
+"""
+functions.append(f)
+
+# Convert resources to other things.
+
+as_xxx_body = """
+_res = %sObj_New((%sHandle)_self->ob_itself);
+return _res;
+"""
+
+def genresconverter(longname, shortname):
+
+ f = ManualGenerator("as_%s"%longname, as_xxx_body%(shortname, longname))
+ docstring = "Return this resource/handle as a %s"%longname
+ f.docstring = lambda docstring=docstring: docstring
+ return f
+
+resmethods.append(genresconverter("Control", "Ctl"))
+resmethods.append(genresconverter("Menu", "Menu"))
+
+# The definition of this one is MacLoadResource, so we do it by hand...
+
+f = ResMethod(void, 'LoadResource',
+ (Handle, 'theResource', InMode),
+)
+resmethods.append(f)
+
+#
+# A method to set the auto-dispose flag
+#
+AutoDispose_body = """
+int onoff, old = 0;
+if (!PyArg_ParseTuple(_args, "i", &onoff))
+ return NULL;
+if ( _self->ob_freeit )
+ old = 1;
+if ( onoff )
+ _self->ob_freeit = PyMac_AutoDisposeHandle;
+else
+ _self->ob_freeit = NULL;
+_res = Py_BuildValue("i", old);
+return _res;
+"""
+f = ManualGenerator("AutoDispose", AutoDispose_body)
+f.docstring = lambda: "(int)->int. Automatically DisposeHandle the object on Python object cleanup"
+resmethods.append(f)
diff --git a/Mac/Modules/res/resscan.py b/Mac/Modules/res/resscan.py
new file mode 100644
index 0000000000..6966e85819
--- /dev/null
+++ b/Mac/Modules/res/resscan.py
@@ -0,0 +1,83 @@
+# Scan Resources.h header file, generate resgen.py and Resources.py files.
+# Then run ressupport to generate Resmodule.c.
+# (Should learn how to tell the compiler to compile it as well.)
+
+import sys
+import MacOS
+
+from bgenlocations import TOOLBOXDIR, BGENDIR
+sys.path.append(BGENDIR)
+
+from scantools import Scanner
+
+def main():
+ input = "Resources.h"
+ output = "resgen.py"
+ defsoutput = TOOLBOXDIR + "Resources.py"
+ scanner = ResourcesScanner(input, output, defsoutput)
+ scanner.scan()
+ scanner.close()
+ print "=== Testing definitions output code ==="
+ execfile(defsoutput, {}, {})
+ print "=== Done scanning and generating, now doing 'import ressupport' ==="
+ import ressupport
+ print "=== Done 'import ressupport'. It's up to you to compile Resmodule.c ==="
+
+class ResourcesScanner(Scanner):
+
+ def destination(self, type, name, arglist):
+ classname = "ResFunction"
+ listname = "functions"
+ if arglist:
+ t, n, m = arglist[0]
+ if t == "Handle" and m == "InMode":
+ classname = "ResMethod"
+ listname = "resmethods"
+ return classname, listname
+
+ def makeblacklistnames(self):
+ return [
+ "ReadPartialResource",
+ "WritePartialResource",
+ "TempInsertROMMap",
+## "RmveResource", # RemoveResource
+## "SizeResource", # GetResourceSizeOnDisk
+## "MaxSizeRsrc", # GetMaxResourceSize
+ # OS8 only
+ 'RGetResource',
+ 'OpenResFile',
+ 'CreateResFile',
+ 'RsrcZoneInit',
+ 'InitResources',
+ 'RsrcMapEntry',
+ ]
+
+ def makeblacklisttypes(self):
+ return [
+ ]
+
+ def makerepairinstructions(self):
+ return [
+ ([("Str255", "*", "InMode")],
+ [("*", "*", "OutMode")]),
+
+ ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
+ [("InBuffer", "*", "*")]),
+
+ ([("void", "*", "OutMode"), ("long", "*", "InMode")],
+ [("InOutBuffer", "*", "*")]),
+
+ ([("void", "*", "OutMode"), ("long", "*", "InMode"),
+ ("long", "*", "OutMode")],
+ [("OutBuffer", "*", "InOutMode")]),
+
+ ([("SInt8", "*", "*")],
+ [("SignedByte", "*", "*")]),
+
+
+ ([("UniCharCount", "*", "InMode"), ("UniChar_ptr", "*", "InMode")],
+ [("UnicodeReverseInBuffer", "*", "*")]),
+ ]
+
+if __name__ == "__main__":
+ main()
diff --git a/Mac/Modules/res/ressupport.py b/Mac/Modules/res/ressupport.py
new file mode 100644
index 0000000000..9e42a45423
--- /dev/null
+++ b/Mac/Modules/res/ressupport.py
@@ -0,0 +1,221 @@
+# This script will generate the Resources interface for Python.
+# It uses the "bgen" package to generate C code.
+# It execs the file resgen.py which contain the function definitions
+# (resgen.py was generated by resscan.py, scanning the <Resources.h> header file).
+
+from macsupport import *
+
+class ResMixIn:
+
+ def checkit(self):
+ if self.returntype.__class__ != OSErrType:
+ OutLbrace()
+ Output("OSErr _err = ResError();")
+ Output("if (_err != noErr) return PyMac_Error(_err);")
+ OutRbrace()
+ FunctionGenerator.checkit(self) # XXX
+
+class ResFunction(ResMixIn, OSErrWeakLinkFunctionGenerator): pass
+class ResMethod(ResMixIn, OSErrWeakLinkMethodGenerator): pass
+
+RsrcChainLocation = Type("RsrcChainLocation", "h")
+FSCatalogInfoBitmap = FakeType("0") # Type("FSCatalogInfoBitmap", "l")
+FSCatalogInfo_ptr = FakeType("(FSCatalogInfo *)0")
+
+# includestuff etc. are imported from macsupport
+
+includestuff = includestuff + """
+#include <Carbon/Carbon.h>
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_ResObj_New(Handle);
+extern int _ResObj_Convert(PyObject *, Handle *);
+extern PyObject *_OptResObj_New(Handle);
+extern int _OptResObj_Convert(PyObject *, Handle *);
+#define ResObj_New _ResObj_New
+#define ResObj_Convert _ResObj_Convert
+#define OptResObj_New _OptResObj_New
+#define OptResObj_Convert _OptResObj_Convert
+#endif
+
+/* Function to dispose a resource, with a "normal" calling sequence */
+static void
+PyMac_AutoDisposeHandle(Handle h)
+{
+ DisposeHandle(h);
+}
+"""
+
+finalstuff = finalstuff + """
+
+/* Alternative version of ResObj_New, which returns None for null argument */
+PyObject *OptResObj_New(Handle itself)
+{
+ if (itself == NULL) {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+ return ResObj_New(itself);
+}
+
+int OptResObj_Convert(PyObject *v, Handle *p_itself)
+{
+ PyObject *tmp;
+
+ if ( v == Py_None ) {
+ *p_itself = NULL;
+ return 1;
+ }
+ if (ResObj_Check(v))
+ {
+ *p_itself = ((ResourceObject *)v)->ob_itself;
+ return 1;
+ }
+ /* If it isn't a resource yet see whether it is convertible */
+ if ( (tmp=PyObject_CallMethod(v, "as_Resource", "")) ) {
+ *p_itself = ((ResourceObject *)tmp)->ob_itself;
+ Py_DECREF(tmp);
+ return 1;
+ }
+ PyErr_Clear();
+ PyErr_SetString(PyExc_TypeError, "Resource required");
+ return 0;
+}
+"""
+
+initstuff = initstuff + """
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(Handle, ResObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Handle, ResObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(Handle, OptResObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Handle, OptResObj_Convert);
+"""
+
+module = MacModule('_Res', 'Res', includestuff, finalstuff, initstuff)
+
+class ResDefinition(PEP253Mixin, GlobalObjectDefinition):
+ getsetlist = [
+ ('data',
+ """
+ PyObject *res;
+ char state;
+
+ state = HGetState(self->ob_itself);
+ HLock(self->ob_itself);
+ res = PyString_FromStringAndSize(
+ *self->ob_itself,
+ GetHandleSize(self->ob_itself));
+ HUnlock(self->ob_itself);
+ HSetState(self->ob_itself, state);
+ return res;
+ """,
+ """
+ char *data;
+ long size;
+
+ if ( v == NULL )
+ return -1;
+ if ( !PyString_Check(v) )
+ return -1;
+ size = PyString_Size(v);
+ data = PyString_AsString(v);
+ /* XXXX Do I need the GetState/SetState calls? */
+ SetHandleSize(self->ob_itself, size);
+ if ( MemError())
+ return -1;
+ HLock(self->ob_itself);
+ memcpy((char *)*self->ob_itself, data, size);
+ HUnlock(self->ob_itself);
+ /* XXXX Should I do the Changed call immedeately? */
+ return 0;
+ """,
+ 'The resource data'
+ ), (
+ 'size',
+ 'return PyInt_FromLong(GetHandleSize(self->ob_itself));',
+ None,
+ 'The length of the resource data'
+ )]
+
+ def outputCheckNewArg(self):
+ Output("if (itself == NULL) return PyMac_Error(resNotFound);")
+
+ def outputCheckConvertArg(self):
+ # if it isn't a resource we may be able to coerce it
+ Output("if (!%s_Check(v))", self.prefix)
+ OutLbrace()
+ Output("PyObject *tmp;")
+ Output('if ( (tmp=PyObject_CallMethod(v, "as_Resource", "")) )')
+ OutLbrace()
+ Output("*p_itself = ((ResourceObject *)tmp)->ob_itself;")
+ Output("Py_DECREF(tmp);")
+ Output("return 1;")
+ OutRbrace()
+ Output("PyErr_Clear();")
+ OutRbrace()
+
+ def outputStructMembers(self):
+ GlobalObjectDefinition.outputStructMembers(self)
+ Output("void (*ob_freeit)(%s ptr);", self.itselftype)
+
+ def outputInitStructMembers(self):
+ GlobalObjectDefinition.outputInitStructMembers(self)
+ Output("it->ob_freeit = NULL;")
+
+ def outputCleanupStructMembers(self):
+ Output("if (self->ob_freeit && self->ob_itself)")
+ OutLbrace()
+ Output("self->ob_freeit(self->ob_itself);")
+ OutRbrace()
+ Output("self->ob_itself = NULL;")
+
+ def output_tp_newBody(self):
+ Output("PyObject *self;")
+ Output
+ Output("if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;")
+ Output("((%s *)self)->ob_itself = NULL;", self.objecttype)
+ Output("((%s *)self)->ob_freeit = NULL;", self.objecttype)
+ Output("return self;")
+
+ def output_tp_initBody(self):
+ Output("char *srcdata = NULL;")
+ Output("int srclen = 0;")
+ Output("%s itself;", self.itselftype);
+ Output("char *kw[] = {\"itself\", 0};")
+ Output()
+ Output("if (PyArg_ParseTupleAndKeywords(_args, _kwds, \"O&\", kw, %s_Convert, &itself))",
+ self.prefix);
+ OutLbrace()
+ Output("((%s *)_self)->ob_itself = itself;", self.objecttype)
+ Output("return 0;")
+ OutRbrace()
+ Output("PyErr_Clear();")
+ Output("if (!PyArg_ParseTupleAndKeywords(_args, _kwds, \"|s#\", kw, &srcdata, &srclen)) return -1;")
+ Output("if ((itself = NewHandle(srclen)) == NULL)")
+ OutLbrace()
+ Output("PyErr_NoMemory();")
+ Output("return 0;")
+ OutRbrace()
+ Output("((%s *)_self)->ob_itself = itself;", self.objecttype)
+# XXXX Output("((%s *)self)->ob_freeit = PyMac_AutoDisposeHandle;")
+ Output("if (srclen && srcdata)")
+ OutLbrace()
+ Output("HLock(itself);")
+ Output("memcpy(*itself, srcdata, srclen);")
+ Output("HUnlock(itself);")
+ OutRbrace()
+ Output("return 0;")
+
+resobject = ResDefinition('Resource', 'ResObj', 'Handle')
+module.addobject(resobject)
+
+functions = []
+resmethods = []
+
+execfile('resgen.py')
+execfile('resedit.py')
+
+for f in functions: module.add(f)
+for f in resmethods: resobject.add(f)
+
+SetOutputFileName('_Resmodule.c')
+module.generate()
diff --git a/Mac/Modules/scrap/_Scrapmodule.c b/Mac/Modules/scrap/_Scrapmodule.c
new file mode 100644
index 0000000000..f24ed8bb08
--- /dev/null
+++ b/Mac/Modules/scrap/_Scrapmodule.c
@@ -0,0 +1,365 @@
+
+/* ========================= Module _Scrap ========================== */
+
+#include "Python.h"
+
+
+#ifndef __LP64__
+
+#include "pymactoolbox.h"
+
+/* Macro to test whether a weak-loaded CFM function exists */
+#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
+ PyErr_SetString(PyExc_NotImplementedError, \
+ "Not available in this shared library/OS version"); \
+ return NULL; \
+ }} while(0)
+
+
+#include <Carbon/Carbon.h>
+
+static PyObject *Scrap_Error;
+
+/* ----------------------- Object type Scrap ------------------------ */
+
+PyTypeObject Scrap_Type;
+
+#define ScrapObj_Check(x) ((x)->ob_type == &Scrap_Type || PyObject_TypeCheck((x), &Scrap_Type))
+
+typedef struct ScrapObject {
+ PyObject_HEAD
+ ScrapRef ob_itself;
+} ScrapObject;
+
+PyObject *ScrapObj_New(ScrapRef itself)
+{
+ ScrapObject *it;
+ it = PyObject_NEW(ScrapObject, &Scrap_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+int ScrapObj_Convert(PyObject *v, ScrapRef *p_itself)
+{
+ if (!ScrapObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "Scrap required");
+ return 0;
+ }
+ *p_itself = ((ScrapObject *)v)->ob_itself;
+ return 1;
+}
+
+static void ScrapObj_dealloc(ScrapObject *self)
+{
+ /* Cleanup of self->ob_itself goes here */
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *ScrapObj_GetScrapFlavorFlags(ScrapObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ScrapFlavorType flavorType;
+ ScrapFlavorFlags flavorFlags;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &flavorType))
+ return NULL;
+ _err = GetScrapFlavorFlags(_self->ob_itself,
+ flavorType,
+ &flavorFlags);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ flavorFlags);
+ return _res;
+}
+
+static PyObject *ScrapObj_GetScrapFlavorSize(ScrapObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ScrapFlavorType flavorType;
+ Size byteCount;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &flavorType))
+ return NULL;
+ _err = GetScrapFlavorSize(_self->ob_itself,
+ flavorType,
+ &byteCount);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ byteCount);
+ return _res;
+}
+
+static PyObject *ScrapObj_GetScrapFlavorData(ScrapObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ScrapFlavorType flavorType;
+ Size byteCount;
+
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &flavorType))
+ return NULL;
+ _err = GetScrapFlavorSize(_self->ob_itself,
+ flavorType,
+ &byteCount);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = PyString_FromStringAndSize(NULL, (int)byteCount);
+ if ( _res == NULL ) return NULL;
+ _err = GetScrapFlavorData(_self->ob_itself,
+ flavorType,
+ &byteCount,
+ PyString_AS_STRING(_res));
+ if (_err != noErr) {
+ Py_XDECREF(_res);
+ return PyMac_Error(_err);
+ }
+ return _res;
+}
+
+static PyObject *ScrapObj_PutScrapFlavor(ScrapObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ScrapFlavorType flavorType;
+ ScrapFlavorFlags flavorFlags;
+ char *flavorData__in__;
+ int flavorData__in_len__;
+ if (!PyArg_ParseTuple(_args, "O&Ks#",
+ PyMac_GetOSType, &flavorType,
+ &flavorFlags,
+ &flavorData__in__, &flavorData__in_len__))
+ return NULL;
+ _err = PutScrapFlavor(_self->ob_itself,
+ flavorType,
+ flavorFlags,
+ (Size)flavorData__in_len__,
+ flavorData__in__);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ScrapObj_GetScrapFlavorCount(ScrapObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 infoCount;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetScrapFlavorCount(_self->ob_itself,
+ &infoCount);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ infoCount);
+ return _res;
+}
+
+static PyObject *ScrapObj_GetScrapFlavorInfoList(ScrapObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PyObject *item;
+ OSStatus _err;
+ UInt32 infoCount;
+ ScrapFlavorInfo *infolist = NULL;
+ int i;
+
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetScrapFlavorCount(_self->ob_itself,
+ &infoCount);
+ if (_err != noErr) return PyMac_Error(_err);
+ if (infoCount == 0) return Py_BuildValue("[]");
+
+ if ((infolist = (ScrapFlavorInfo *)malloc(infoCount*sizeof(ScrapFlavorInfo))) == NULL )
+ return PyErr_NoMemory();
+
+ _err = GetScrapFlavorInfoList(_self->ob_itself, &infoCount, infolist);
+ if (_err != noErr) {
+ free(infolist);
+ return NULL;
+ }
+ if ((_res = PyList_New(infoCount)) == NULL ) {
+ free(infolist);
+ return NULL;
+ }
+ for(i=0; i<infoCount; i++) {
+ item = Py_BuildValue("O&l", PyMac_BuildOSType, infolist[i].flavorType,
+ infolist[i].flavorFlags);
+ if ( !item || PyList_SetItem(_res, i, item) < 0 ) {
+ Py_DECREF(_res);
+ free(infolist);
+ return NULL;
+ }
+ }
+ free(infolist);
+ return _res;
+}
+
+static PyMethodDef ScrapObj_methods[] = {
+ {"GetScrapFlavorFlags", (PyCFunction)ScrapObj_GetScrapFlavorFlags, 1,
+ PyDoc_STR("(ScrapFlavorType flavorType) -> (ScrapFlavorFlags flavorFlags)")},
+ {"GetScrapFlavorSize", (PyCFunction)ScrapObj_GetScrapFlavorSize, 1,
+ PyDoc_STR("(ScrapFlavorType flavorType) -> (Size byteCount)")},
+ {"GetScrapFlavorData", (PyCFunction)ScrapObj_GetScrapFlavorData, 1,
+ PyDoc_STR("(ScrapFlavorType flavorType, Buffer destination) -> (Size byteCount)")},
+ {"PutScrapFlavor", (PyCFunction)ScrapObj_PutScrapFlavor, 1,
+ PyDoc_STR("(ScrapFlavorType flavorType, ScrapFlavorFlags flavorFlags, Size flavorSize, Buffer flavorData) -> None")},
+ {"GetScrapFlavorCount", (PyCFunction)ScrapObj_GetScrapFlavorCount, 1,
+ PyDoc_STR("() -> (UInt32 infoCount)")},
+ {"GetScrapFlavorInfoList", (PyCFunction)ScrapObj_GetScrapFlavorInfoList, 1,
+ PyDoc_STR("() -> ([(ScrapFlavorType, ScrapFlavorInfo), ...])")},
+ {NULL, NULL, 0}
+};
+
+PyMethodChain ScrapObj_chain = { ScrapObj_methods, NULL };
+
+static PyObject *ScrapObj_getattr(ScrapObject *self, char *name)
+{
+ return Py_FindMethodInChain(&ScrapObj_chain, (PyObject *)self, name);
+}
+
+#define ScrapObj_setattr NULL
+
+#define ScrapObj_compare NULL
+
+#define ScrapObj_repr NULL
+
+#define ScrapObj_hash NULL
+
+PyTypeObject Scrap_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_Scrap.Scrap", /*tp_name*/
+ sizeof(ScrapObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) ScrapObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc) ScrapObj_getattr, /*tp_getattr*/
+ (setattrfunc) ScrapObj_setattr, /*tp_setattr*/
+ (cmpfunc) ScrapObj_compare, /*tp_compare*/
+ (reprfunc) ScrapObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) ScrapObj_hash, /*tp_hash*/
+};
+
+/* --------------------- End object type Scrap ---------------------- */
+
+static PyObject *Scrap_LoadScrap(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = LoadScrap();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Scrap_UnloadScrap(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = UnloadScrap();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Scrap_GetCurrentScrap(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ScrapRef scrap;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetCurrentScrap(&scrap);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ScrapObj_New, scrap);
+ return _res;
+}
+
+static PyObject *Scrap_ClearCurrentScrap(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = ClearCurrentScrap();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Scrap_CallInScrapPromises(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = CallInScrapPromises();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _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,
+ PyDoc_STR("() -> None")},
+ {"GetCurrentScrap", (PyCFunction)Scrap_GetCurrentScrap, 1,
+ PyDoc_STR("() -> (ScrapRef scrap)")},
+ {"ClearCurrentScrap", (PyCFunction)Scrap_ClearCurrentScrap, 1,
+ PyDoc_STR("() -> None")},
+ {"CallInScrapPromises", (PyCFunction)Scrap_CallInScrapPromises, 1,
+ PyDoc_STR("() -> None")},
+#endif /* __LP64__ */
+ {NULL, NULL, 0}
+};
+
+
+
+
+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 ||
+ PyDict_SetItemString(d, "Error", Scrap_Error) != 0)
+ return;
+ Scrap_Type.ob_type = &PyType_Type;
+ Py_INCREF(&Scrap_Type);
+ if (PyDict_SetItemString(d, "ScrapType", (PyObject *)&Scrap_Type) != 0)
+ Py_FatalError("can't initialize ScrapType");
+#endif /* __LP64__ */
+}
+
+/* ======================= End module _Scrap ======================== */
+
diff --git a/Mac/Modules/scrap/scrapscan.py b/Mac/Modules/scrap/scrapscan.py
new file mode 100644
index 0000000000..25a683ca96
--- /dev/null
+++ b/Mac/Modules/scrap/scrapscan.py
@@ -0,0 +1,60 @@
+# Scan an Apple header file, generating a Python file of generator calls.
+#
+# Note that the scrap-manager include file is so weird that this
+# generates a boilerplate to be edited by hand.
+
+import sys
+from bgenlocations import TOOLBOXDIR, BGENDIR
+sys.path.append(BGENDIR)
+from scantools import Scanner
+
+LONG = "Scrap"
+SHORT = "scrap"
+
+def main():
+ input = "Scrap.h"
+ output = SHORT + "gen.py"
+ defsoutput = "@Scrap.py"
+ scanner = MyScanner(input, output, defsoutput)
+ scanner.scan()
+ scanner.close()
+## print "=== Testing definitions output code ==="
+## execfile(defsoutput, {}, {})
+ print "=== Done scanning and generating, now importing the generated code... ==="
+ exec "import " + SHORT + "support"
+ print "=== Done. It's up to you to compile it now! ==="
+
+class MyScanner(Scanner):
+
+ def destination(self, type, name, arglist):
+ classname = "Function"
+ listname = "functions"
+ if arglist:
+ t, n, m = arglist[0]
+ if t == 'ScrapRef' and m == "InMode":
+ classname = "Method"
+ listname = "methods"
+ return classname, listname
+
+ def makeblacklistnames(self):
+ return [
+ "GetScrapFlavorInfoList",
+ 'InfoScrap',
+ 'GetScrap',
+ 'ZeroScrap',
+ 'PutScrap',
+ ]
+
+ def makeblacklisttypes(self):
+ return [
+ 'ScrapPromiseKeeperUPP',
+ ]
+
+ def makerepairinstructions(self):
+ return [
+ ([('void', '*', 'OutMode')], [('putscrapbuffer', '*', 'InMode')]),
+ ([('void_ptr', '*', 'InMode')], [('putscrapbuffer', '*', 'InMode')]),
+ ]
+
+if __name__ == "__main__":
+ main()
diff --git a/Mac/Modules/scrap/scrapsupport.py b/Mac/Modules/scrap/scrapsupport.py
new file mode 100644
index 0000000000..84a75d22a7
--- /dev/null
+++ b/Mac/Modules/scrap/scrapsupport.py
@@ -0,0 +1,75 @@
+# This script generates a Python interface for an Apple Macintosh Manager.
+# It uses the "bgen" package to generate C code.
+# The function specifications are generated by scanning the mamager's header file,
+# using the "scantools" package (customized for this particular manager).
+
+# NOTE: the scrap include file is so bad that the bgen output has to be
+# massaged by hand.
+
+import string
+
+# Declarations that change for each manager
+MACHEADERFILE = 'Scrap.h' # The Apple header file
+MODNAME = '_Scrap' # The name of the module
+OBJECTNAME = 'Scrap' # The basic name of the objects used here
+
+# The following is *usually* unchanged but may still require tuning
+MODPREFIX = 'Scrap' # The prefix for module-wide routines
+OBJECTTYPE = OBJECTNAME + 'Ref' # The C type used to represent them
+OBJECTPREFIX = MODPREFIX + 'Obj' # The prefix for object methods
+INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner
+OUTPUTFILE = '@' + MODNAME + "module.c" # The file generated by this program
+
+from macsupport import *
+
+# Create the type objects
+ScrapRef = OpaqueByValueType(OBJECTTYPE, OBJECTPREFIX)
+
+includestuff = includestuff + """
+#include <Carbon/Carbon.h>
+
+/*
+** Generate ScrapInfo records
+*/
+static PyObject *
+SCRRec_New(itself)
+ ScrapStuff *itself;
+{
+
+ return Py_BuildValue("lO&hhO&", itself->scrapSize,
+ ResObj_New, itself->scrapHandle, itself->scrapCount, itself->scrapState,
+ PyMac_BuildStr255, itself->scrapName);
+}
+"""
+
+ScrapStuffPtr = OpaqueByValueType('ScrapStuffPtr', 'SCRRec')
+ScrapFlavorType = OSTypeType('ScrapFlavorType')
+ScrapFlavorFlags = Type('ScrapFlavorFlags', 'l')
+#ScrapFlavorInfo = OpaqueType('ScrapFlavorInfo', 'ScrapFlavorInfo')
+putscrapbuffer = FixedInputBufferType('void *')
+
+class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
+ pass
+
+# Create the generator groups and link them
+module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff)
+object = MyObjectDefinition(OBJECTNAME, OBJECTPREFIX, OBJECTTYPE)
+module.addobject(object)
+
+# Create the generator classes used to populate the lists
+Function = OSErrFunctionGenerator
+Method = OSErrMethodGenerator
+
+# Create and populate the lists
+functions = []
+methods = []
+execfile(INPUTFILE)
+
+# add the populated lists to the generator groups
+# (in a different wordl the scan program would generate this)
+for f in functions: module.add(f)
+for f in methods: object.add(f)
+
+# generate output (open the output file as late as possible)
+SetOutputFileName(OUTPUTFILE)
+module.generate()
diff --git a/Mac/Modules/snd/_Sndihooks.c b/Mac/Modules/snd/_Sndihooks.c
new file mode 100644
index 0000000000..254fc0c40b
--- /dev/null
+++ b/Mac/Modules/snd/_Sndihooks.c
@@ -0,0 +1,512 @@
+/***********************************************************
+Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
+The Netherlands.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of Stichting Mathematisch
+Centrum or CWI or Corporation for National Research Initiatives or
+CNRI not be used in advertising or publicity pertaining to
+distribution of the software without specific, written prior
+permission.
+
+While CWI is the initial source for this software, a modified version
+is made available by the Corporation for National Research Initiatives
+(CNRI) at the Internet address ftp://ftp.python.org.
+
+STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
+REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
+CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+
+******************************************************************/
+
+#include "Python.h"
+#include "pymactoolbox.h"
+#include <Sound.h>
+
+#pragma options align=mac68k
+struct SampleRateAvailable_arg {
+ short numrates;
+ Handle rates;
+};
+
+struct SampleSizeAvailable_arg {
+ short numsizes;
+ Handle sizes;
+};
+
+#pragma options align=reset
+
+static PyObject *ErrorObject;
+
+
+/* Convert Python object to unsigned Fixed */
+static int
+PyMac_GetUFixed(PyObject *v, Fixed *f)
+{
+ double d;
+ unsigned long uns;
+
+ if( !PyArg_Parse(v, "d", &d))
+ return 0;
+ uns = (unsigned long)(d * 0x10000);
+ *f = (Fixed)uns;
+ return 1;
+}
+
+/* Convert a Point to a Python object */
+static PyObject *
+PyMac_BuildUFixed(Fixed f)
+{
+ double d;
+ unsigned long funs;
+
+ funs = (unsigned long)f;
+
+ d = funs;
+ d = d / 0x10000;
+ return Py_BuildValue("d", d);
+}
+
+
+/* ----------------------------------------------------- */
+
+static char sndih_getChannelAvailable__doc__[] =
+""
+;
+
+static PyObject *
+sndih_getChannelAvailable(self, args)
+ PyObject *self; /* Not used */
+ PyObject *args;
+{
+ long inRefNum;
+ short nchannel;
+ OSErr err;
+
+ if (!PyArg_ParseTuple(args, "l", &inRefNum))
+ return NULL;
+
+ if( (err=SPBGetDeviceInfo(inRefNum, siChannelAvailable, (Ptr)&nchannel)) != noErr )
+ return PyMac_Error(err);
+ return Py_BuildValue("h", nchannel);
+}
+
+static char sndih_getNumberChannels__doc__[] =
+""
+;
+
+static PyObject *
+sndih_getNumberChannels(self, args)
+ PyObject *self; /* Not used */
+ PyObject *args;
+{
+ long inRefNum;
+ short nchannel;
+ OSErr err;
+
+ if (!PyArg_ParseTuple(args, "l", &inRefNum))
+ return NULL;
+
+ if( (err=SPBGetDeviceInfo(inRefNum, siNumberChannels, (Ptr)&nchannel)) != noErr )
+ return PyMac_Error(err);
+ return Py_BuildValue("h", nchannel);
+}
+
+static char sndih_setNumberChannels__doc__[] =
+""
+;
+
+static PyObject *
+sndih_setNumberChannels(self, args)
+ PyObject *self; /* Not used */
+ PyObject *args;
+{
+ long inRefNum;
+ short nchannel;
+ OSErr err;
+
+ if (!PyArg_ParseTuple(args, "lh", &inRefNum, &nchannel))
+ return NULL;
+
+ if( (err=SPBSetDeviceInfo(inRefNum, siNumberChannels, (Ptr)&nchannel)) != noErr )
+ return PyMac_Error(err);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static char sndih_getContinuous__doc__[] =
+""
+;
+
+static PyObject *
+sndih_getContinuous(self, args)
+ PyObject *self; /* Not used */
+ PyObject *args;
+{
+ long inRefNum;
+ short onoff;
+ OSErr err;
+
+ if (!PyArg_ParseTuple(args, "l", &inRefNum))
+ return NULL;
+
+ if( (err=SPBGetDeviceInfo(inRefNum, siContinuous, (Ptr)&onoff)) != noErr )
+ return PyMac_Error(err);
+ return Py_BuildValue("h", onoff);
+}
+
+static char sndih_setContinuous__doc__[] =
+""
+;
+
+static PyObject *
+sndih_setContinuous(self, args)
+ PyObject *self; /* Not used */
+ PyObject *args;
+{
+ long inRefNum;
+ short onoff;
+ OSErr err;
+
+ if (!PyArg_ParseTuple(args, "lh", &inRefNum, &onoff))
+ return NULL;
+
+ if( (err=SPBSetDeviceInfo(inRefNum, siContinuous, (Ptr)&onoff)) != noErr )
+ return PyMac_Error(err);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static char sndih_getInputSourceNames__doc__[] =
+""
+;
+
+static PyObject *
+sndih_getInputSourceNames(self, args)
+ PyObject *self; /* Not used */
+ PyObject *args;
+{
+ long inRefNum;
+ Handle names;
+ OSErr err;
+
+ if (!PyArg_ParseTuple(args, "l", &inRefNum))
+ return NULL;
+
+ if( (err=SPBGetDeviceInfo(inRefNum, siInputSourceNames, (Ptr)&names)) != noErr )
+ return PyMac_Error(err);
+ return Py_BuildValue("O&", ResObj_New, names);
+}
+
+static char sndih_getInputSource__doc__[] =
+""
+;
+
+static PyObject *
+sndih_getInputSource(self, args)
+ PyObject *self; /* Not used */
+ PyObject *args;
+{
+ long inRefNum;
+ short source;
+ OSErr err;
+
+ if (!PyArg_ParseTuple(args, "l", &inRefNum))
+ return NULL;
+
+ if( (err=SPBGetDeviceInfo(inRefNum, siInputSource, (Ptr)&source)) != noErr )
+ return PyMac_Error(err);
+ return Py_BuildValue("h", source);
+}
+
+static char sndih_setInputSource__doc__[] =
+""
+;
+
+static PyObject *
+sndih_setInputSource(self, args)
+ PyObject *self; /* Not used */
+ PyObject *args;
+{
+ long inRefNum;
+ short source;
+ OSErr err;
+
+ if (!PyArg_ParseTuple(args, "lh", &inRefNum, &source))
+ return NULL;
+
+ if( (err=SPBSetDeviceInfo(inRefNum, siInputSource, (Ptr)&source)) != noErr )
+ return PyMac_Error(err);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static char sndih_getPlayThruOnOff__doc__[] =
+""
+;
+
+static PyObject *
+sndih_getPlayThruOnOff(self, args)
+ PyObject *self; /* Not used */
+ PyObject *args;
+{
+ long inRefNum;
+ short onoff;
+ OSErr err;
+
+ if (!PyArg_ParseTuple(args, "l", &inRefNum))
+ return NULL;
+
+ if( (err=SPBGetDeviceInfo(inRefNum, siPlayThruOnOff, (Ptr)&onoff)) != noErr )
+ return PyMac_Error(err);
+ return Py_BuildValue("h", onoff);
+}
+
+static char sndih_setPlayThruOnOff__doc__[] =
+""
+;
+
+static PyObject *
+sndih_setPlayThruOnOff(self, args)
+ PyObject *self; /* Not used */
+ PyObject *args;
+{
+ long inRefNum;
+ short onoff;
+ OSErr err;
+
+ if (!PyArg_ParseTuple(args, "lh", &inRefNum, &onoff))
+ return NULL;
+
+ if( (err=SPBSetDeviceInfo(inRefNum, siPlayThruOnOff, (Ptr)&onoff)) != noErr )
+ return PyMac_Error(err);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static char sndih_getSampleRate__doc__[] =
+""
+;
+
+static PyObject *
+sndih_getSampleRate(self, args)
+ PyObject *self; /* Not used */
+ PyObject *args;
+{
+ long inRefNum;
+ Fixed sample_rate;
+ OSErr err;
+
+ if (!PyArg_ParseTuple(args, "l", &inRefNum))
+ return NULL;
+
+ if( (err=SPBGetDeviceInfo(inRefNum, siSampleRate, (Ptr)&sample_rate)) != noErr )
+ return PyMac_Error(err);
+ return Py_BuildValue("O&", PyMac_BuildUFixed, sample_rate);
+}
+
+static char sndih_setSampleRate__doc__[] =
+""
+;
+
+static PyObject *
+sndih_setSampleRate(self, args)
+ PyObject *self; /* Not used */
+ PyObject *args;
+{
+ long inRefNum;
+ Fixed sample_rate;
+ OSErr err;
+
+ if (!PyArg_ParseTuple(args, "lO&", &inRefNum, PyMac_GetUFixed, &sample_rate))
+ return NULL;
+
+ if( (err=SPBSetDeviceInfo(inRefNum, siSampleRate, (Ptr)&sample_rate)) != noErr )
+ return PyMac_Error(err);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static char sndih_getSampleSize__doc__[] =
+""
+;
+
+static PyObject *
+sndih_getSampleSize(self, args)
+ PyObject *self; /* Not used */
+ PyObject *args;
+{
+ long inRefNum;
+ short bits;
+ OSErr err;
+
+ if (!PyArg_ParseTuple(args, "l", &inRefNum))
+ return NULL;
+
+ if( (err=SPBGetDeviceInfo(inRefNum, siSampleSize, (Ptr)&bits)) != noErr )
+ return PyMac_Error(err);
+ return Py_BuildValue("h", bits);
+}
+
+static char sndih_setSampleSize__doc__[] =
+""
+;
+
+static PyObject *
+sndih_setSampleSize(self, args)
+ PyObject *self; /* Not used */
+ PyObject *args;
+{
+ long inRefNum;
+ short size;
+ OSErr err;
+
+ if (!PyArg_ParseTuple(args, "lh", &inRefNum, &size))
+ return NULL;
+
+ if( (err=SPBSetDeviceInfo(inRefNum, siSampleSize, (Ptr)&size)) != noErr )
+ return PyMac_Error(err);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static char sndih_getSampleSizeAvailable__doc__[] =
+""
+;
+
+static PyObject *
+sndih_getSampleSizeAvailable(self, args)
+ PyObject *self; /* Not used */
+ PyObject *args;
+{
+ long inRefNum;
+ struct SampleSizeAvailable_arg arg;
+ OSErr err;
+ PyObject *rsizes;
+ short *fsizes;
+ int i;
+
+ arg.sizes = NULL;
+ rsizes = NULL;
+ if (!PyArg_ParseTuple(args, "l", &inRefNum))
+ return NULL;
+
+ if( (err=SPBGetDeviceInfo(inRefNum, siSampleSizeAvailable, (Ptr)&arg)) != noErr ) {
+ return PyMac_Error(err);
+ }
+ fsizes = (short *)*(arg.sizes);
+ /* Handle contains a list of rates */
+ if( (rsizes = PyTuple_New(arg.numsizes)) == NULL)
+ return NULL;
+ for( i=0; i<arg.numsizes; i++ )
+ PyTuple_SetItem(rsizes, i, PyInt_FromLong((long)fsizes[i]));
+ return rsizes;
+}
+
+static char sndih_getSampleRateAvailable__doc__[] =
+""
+;
+
+static PyObject *
+sndih_getSampleRateAvailable(self, args)
+ PyObject *self; /* Not used */
+ PyObject *args;
+{
+ long inRefNum;
+ struct SampleRateAvailable_arg arg;
+ OSErr err;
+ PyObject *rrates, *obj;
+ Fixed *frates;
+ int i;
+
+ arg.rates = NULL;
+ rrates = NULL;
+ if (!PyArg_ParseTuple(args, "l", &inRefNum))
+ return NULL;
+
+ if( (err=SPBGetDeviceInfo(inRefNum, siSampleRateAvailable, (Ptr)&arg)) != noErr ) {
+ return PyMac_Error(err);
+ }
+ frates = (Fixed *)*(arg.rates);
+ if( arg.numrates == 0 ) {
+ /* The handle contains upper and lowerbound */
+ rrates = Py_BuildValue("O&O&", frates[0], frates[1]);
+ if (rrates == NULL) return NULL;
+ } else {
+ /* Handle contains a list of rates */
+ if( (rrates = PyTuple_New(arg.numrates)) == NULL)
+ return NULL;
+ for( i=0; i<arg.numrates; i++ ) {
+ if( (obj = Py_BuildValue("O&", PyMac_BuildUFixed, frates[i]))==NULL)
+ goto out;
+ PyTuple_SetItem(rrates, i, obj);
+ }
+ }
+ return Py_BuildValue("hO", arg.numrates, rrates);
+out:
+ Py_XDECREF(rrates);
+ return NULL;
+}
+
+/* List of methods defined in the module */
+
+static struct PyMethodDef sndih_methods[] = {
+ {"getChannelAvailable", (PyCFunction)sndih_getChannelAvailable, METH_VARARGS, sndih_getChannelAvailable__doc__},
+ {"getNumberChannels", (PyCFunction)sndih_getNumberChannels, METH_VARARGS, sndih_getNumberChannels__doc__},
+ {"setNumberChannels", (PyCFunction)sndih_setNumberChannels, METH_VARARGS, sndih_setNumberChannels__doc__},
+ {"getContinuous", (PyCFunction)sndih_getContinuous, METH_VARARGS, sndih_getContinuous__doc__},
+ {"setContinuous", (PyCFunction)sndih_setContinuous, METH_VARARGS, sndih_setContinuous__doc__},
+ {"getInputSourceNames", (PyCFunction)sndih_getInputSourceNames, METH_VARARGS, sndih_getInputSourceNames__doc__},
+ {"getInputSource", (PyCFunction)sndih_getInputSource, METH_VARARGS, sndih_getInputSource__doc__},
+ {"setInputSource", (PyCFunction)sndih_setInputSource, METH_VARARGS, sndih_setInputSource__doc__},
+ {"getPlayThruOnOff", (PyCFunction)sndih_getPlayThruOnOff, METH_VARARGS, sndih_getPlayThruOnOff__doc__},
+ {"setPlayThruOnOff", (PyCFunction)sndih_setPlayThruOnOff, METH_VARARGS, sndih_setPlayThruOnOff__doc__},
+ {"getSampleRate", (PyCFunction)sndih_getSampleRate, METH_VARARGS, sndih_getSampleRate__doc__},
+ {"setSampleRate", (PyCFunction)sndih_setSampleRate, METH_VARARGS, sndih_setSampleRate__doc__},
+ {"getSampleSize", (PyCFunction)sndih_getSampleSize, METH_VARARGS, sndih_getSampleSize__doc__},
+ {"setSampleSize", (PyCFunction)sndih_setSampleSize, METH_VARARGS, sndih_setSampleSize__doc__},
+ {"getSampleSizeAvailable", (PyCFunction)sndih_getSampleSizeAvailable, METH_VARARGS, sndih_getSampleSizeAvailable__doc__},
+ {"getSampleRateAvailable", (PyCFunction)sndih_getSampleRateAvailable, METH_VARARGS, sndih_getSampleRateAvailable__doc__},
+
+ {NULL, (PyCFunction)NULL, 0, NULL} /* sentinel */
+};
+
+
+/* Initialization function for the module (*must* be called initSndihooks) */
+
+static char Sndihooks_module_documentation[] =
+""
+;
+
+void
+init_Sndihooks()
+{
+ PyObject *m, *d;
+
+ /* Create the module and add the functions */
+ m = Py_InitModule4("_Sndihooks", sndih_methods,
+ Sndihooks_module_documentation,
+ (PyObject*)NULL,PYTHON_API_VERSION);
+
+ /* Add some symbolic constants to the module */
+ d = PyModule_GetDict(m);
+ ErrorObject = PyString_FromString("Sndihooks.error");
+ PyDict_SetItemString(d, "error", ErrorObject);
+
+ /* XXXX Add constants here */
+
+ /* Check for errors */
+ if (PyErr_Occurred())
+ Py_FatalError("can't initialize module Sndihooks");
+}
+
diff --git a/Mac/Modules/snd/_Sndmodule.c b/Mac/Modules/snd/_Sndmodule.c
new file mode 100644
index 0000000000..d713efe13c
--- /dev/null
+++ b/Mac/Modules/snd/_Sndmodule.c
@@ -0,0 +1,1163 @@
+
+/* ========================== Module _Snd =========================== */
+
+#include "Python.h"
+
+#ifndef __LP64__
+
+
+#include "pymactoolbox.h"
+
+/* Macro to test whether a weak-loaded CFM function exists */
+#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
+ PyErr_SetString(PyExc_NotImplementedError, \
+ "Not available in this shared library/OS version"); \
+ return NULL; \
+ }} while(0)
+
+
+#include <Carbon/Carbon.h>
+
+/* Convert a SndCommand argument */
+static int
+SndCmd_Convert(PyObject *v, SndCommand *pc)
+{
+ int len;
+ pc->param1 = 0;
+ pc->param2 = 0;
+ if (PyTuple_Check(v)) {
+ if (PyArg_ParseTuple(v, "h|hl", &pc->cmd, &pc->param1, &pc->param2))
+ return 1;
+ PyErr_Clear();
+ return PyArg_ParseTuple(v, "Hhs#", &pc->cmd, &pc->param1, &pc->param2, &len);
+ }
+ return PyArg_Parse(v, "H", &pc->cmd);
+}
+
+static pascal void SndCh_UserRoutine(SndChannelPtr chan, SndCommand *cmd); /* Forward */
+static pascal void SPB_completion(SPBPtr my_spb); /* Forward */
+
+static PyObject *Snd_Error;
+
+/* --------------------- Object type SndChannel --------------------- */
+
+static PyTypeObject SndChannel_Type;
+
+#define SndCh_Check(x) ((x)->ob_type == &SndChannel_Type || PyObject_TypeCheck((x), &SndChannel_Type))
+
+typedef struct SndChannelObject {
+ PyObject_HEAD
+ SndChannelPtr ob_itself;
+ /* Members used to implement callbacks: */
+ PyObject *ob_callback;
+ long ob_A5;
+ SndCommand ob_cmd;
+} SndChannelObject;
+
+static PyObject *SndCh_New(SndChannelPtr itself)
+{
+ SndChannelObject *it;
+ it = PyObject_NEW(SndChannelObject, &SndChannel_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ it->ob_callback = NULL;
+ it->ob_A5 = SetCurrentA5();
+ return (PyObject *)it;
+}
+
+static void SndCh_dealloc(SndChannelObject *self)
+{
+ SndDisposeChannel(self->ob_itself, 1);
+ Py_XDECREF(self->ob_callback);
+ PyObject_Free((PyObject *)self);
+}
+
+static PyObject *SndCh_SndDoCommand(SndChannelObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SndCommand cmd;
+ Boolean noWait;
+ if (!PyArg_ParseTuple(_args, "O&b",
+ SndCmd_Convert, &cmd,
+ &noWait))
+ return NULL;
+ _err = SndDoCommand(_self->ob_itself,
+ &cmd,
+ noWait);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *SndCh_SndDoImmediate(SndChannelObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SndCommand cmd;
+ if (!PyArg_ParseTuple(_args, "O&",
+ SndCmd_Convert, &cmd))
+ return NULL;
+ _err = SndDoImmediate(_self->ob_itself,
+ &cmd);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *SndCh_SndPlay(SndChannelObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SndListHandle sndHandle;
+ Boolean async;
+ if (!PyArg_ParseTuple(_args, "O&b",
+ ResObj_Convert, &sndHandle,
+ &async))
+ return NULL;
+ _err = SndPlay(_self->ob_itself,
+ sndHandle,
+ async);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *SndCh_SndChannelStatus(SndChannelObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short theLength;
+ SCStatus theStatus__out__;
+ if (!PyArg_ParseTuple(_args, "h",
+ &theLength))
+ return NULL;
+ _err = SndChannelStatus(_self->ob_itself,
+ theLength,
+ &theStatus__out__);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("s#",
+ (char *)&theStatus__out__, (int)sizeof(SCStatus));
+ return _res;
+}
+
+static PyObject *SndCh_SndGetInfo(SndChannelObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType selector;
+ void * infoPtr;
+ if (!PyArg_ParseTuple(_args, "O&w",
+ PyMac_GetOSType, &selector,
+ &infoPtr))
+ return NULL;
+ _err = SndGetInfo(_self->ob_itself,
+ selector,
+ infoPtr);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *SndCh_SndSetInfo(SndChannelObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType selector;
+ void * infoPtr;
+ if (!PyArg_ParseTuple(_args, "O&w",
+ PyMac_GetOSType, &selector,
+ &infoPtr))
+ return NULL;
+ _err = SndSetInfo(_self->ob_itself,
+ selector,
+ infoPtr);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyMethodDef SndCh_methods[] = {
+ {"SndDoCommand", (PyCFunction)SndCh_SndDoCommand, 1,
+ PyDoc_STR("(SndCommand cmd, Boolean noWait) -> None")},
+ {"SndDoImmediate", (PyCFunction)SndCh_SndDoImmediate, 1,
+ PyDoc_STR("(SndCommand cmd) -> None")},
+ {"SndPlay", (PyCFunction)SndCh_SndPlay, 1,
+ PyDoc_STR("(SndListHandle sndHandle, Boolean async) -> None")},
+ {"SndChannelStatus", (PyCFunction)SndCh_SndChannelStatus, 1,
+ PyDoc_STR("(short theLength) -> (SCStatus theStatus)")},
+ {"SndGetInfo", (PyCFunction)SndCh_SndGetInfo, 1,
+ PyDoc_STR("(OSType selector, void * infoPtr) -> None")},
+ {"SndSetInfo", (PyCFunction)SndCh_SndSetInfo, 1,
+ PyDoc_STR("(OSType selector, void * infoPtr) -> None")},
+ {NULL, NULL, 0}
+};
+
+#define SndCh_getsetlist NULL
+
+
+#define SndCh_compare NULL
+
+#define SndCh_repr NULL
+
+#define SndCh_hash NULL
+
+static PyTypeObject SndChannel_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_Snd.SndChannel", /*tp_name*/
+ sizeof(SndChannelObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) SndCh_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) SndCh_compare, /*tp_compare*/
+ (reprfunc) SndCh_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) SndCh_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ SndCh_methods, /* tp_methods */
+ 0, /*tp_members*/
+ SndCh_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ 0, /*tp_init*/
+ 0, /*tp_alloc*/
+ 0, /*tp_new*/
+ 0, /*tp_free*/
+};
+
+/* ------------------- End object type SndChannel ------------------- */
+
+
+/* ------------------------ Object type SPB ------------------------- */
+
+static PyTypeObject SPB_Type;
+
+#define SPBObj_Check(x) ((x)->ob_type == &SPB_Type || PyObject_TypeCheck((x), &SPB_Type))
+
+typedef struct SPBObject {
+ PyObject_HEAD
+ /* Members used to implement callbacks: */
+ PyObject *ob_completion;
+ PyObject *ob_interrupt;
+ PyObject *ob_thiscallback;
+ long ob_A5;
+ SPB ob_spb;
+} SPBObject;
+
+static PyObject *SPBObj_New(void)
+{
+ SPBObject *it;
+ it = PyObject_NEW(SPBObject, &SPB_Type);
+ if (it == NULL) return NULL;
+ it->ob_completion = NULL;
+ it->ob_interrupt = NULL;
+ it->ob_thiscallback = NULL;
+ it->ob_A5 = SetCurrentA5();
+ memset((char *)&it->ob_spb, 0, sizeof(it->ob_spb));
+ it->ob_spb.userLong = (long)it;
+ return (PyObject *)it;
+}
+static int SPBObj_Convert(PyObject *v, SPBPtr *p_itself)
+{
+ if (!SPBObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "SPB required");
+ return 0;
+ }
+ *p_itself = &((SPBObject *)v)->ob_spb;
+ return 1;
+}
+
+static void SPBObj_dealloc(SPBObject *self)
+{
+ /* Cleanup of self->ob_itself goes here */
+ self->ob_spb.userLong = 0;
+ self->ob_thiscallback = 0;
+ Py_XDECREF(self->ob_completion);
+ Py_XDECREF(self->ob_interrupt);
+ PyObject_Free((PyObject *)self);
+}
+
+static PyMethodDef SPBObj_methods[] = {
+ {NULL, NULL, 0}
+};
+
+static PyObject *SPBObj_get_inRefNum(SPBObject *self, void *closure)
+{
+ return Py_BuildValue("l", self->ob_spb.inRefNum);
+}
+
+static int SPBObj_set_inRefNum(SPBObject *self, PyObject *v, void *closure)
+{
+ return -1 + PyArg_Parse(v, "l", &self->ob_spb.inRefNum);
+ return 0;
+}
+
+static PyObject *SPBObj_get_count(SPBObject *self, void *closure)
+{
+ return Py_BuildValue("l", self->ob_spb.count);
+}
+
+static int SPBObj_set_count(SPBObject *self, PyObject *v, void *closure)
+{
+ return -1 + PyArg_Parse(v, "l", &self->ob_spb.count);
+ return 0;
+}
+
+static PyObject *SPBObj_get_milliseconds(SPBObject *self, void *closure)
+{
+ return Py_BuildValue("l", self->ob_spb.milliseconds);
+}
+
+static int SPBObj_set_milliseconds(SPBObject *self, PyObject *v, void *closure)
+{
+ return -1 + PyArg_Parse(v, "l", &self->ob_spb.milliseconds);
+ return 0;
+}
+
+static PyObject *SPBObj_get_error(SPBObject *self, void *closure)
+{
+ return Py_BuildValue("h", self->ob_spb.error);
+}
+
+#define SPBObj_set_error NULL
+
+#define SPBObj_get_completionRoutine NULL
+
+static int SPBObj_set_completionRoutine(SPBObject *self, PyObject *v, void *closure)
+{
+ self->ob_spb.completionRoutine = NewSICompletionUPP(SPB_completion);
+ self->ob_completion = v;
+ Py_INCREF(v);
+ return 0;
+ return 0;
+}
+
+static PyGetSetDef SPBObj_getsetlist[] = {
+ {"inRefNum", (getter)SPBObj_get_inRefNum, (setter)SPBObj_set_inRefNum, NULL},
+ {"count", (getter)SPBObj_get_count, (setter)SPBObj_set_count, NULL},
+ {"milliseconds", (getter)SPBObj_get_milliseconds, (setter)SPBObj_set_milliseconds, NULL},
+ {"error", (getter)SPBObj_get_error, (setter)SPBObj_set_error, NULL},
+ {"completionRoutine", (getter)SPBObj_get_completionRoutine, (setter)SPBObj_set_completionRoutine, NULL},
+ {NULL, NULL, NULL, NULL},
+};
+
+
+#define SPBObj_compare NULL
+
+#define SPBObj_repr NULL
+
+#define SPBObj_hash NULL
+
+static PyTypeObject SPB_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_Snd.SPB", /*tp_name*/
+ sizeof(SPBObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) SPBObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) SPBObj_compare, /*tp_compare*/
+ (reprfunc) SPBObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) SPBObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ SPBObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ SPBObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ 0, /*tp_init*/
+ 0, /*tp_alloc*/
+ 0, /*tp_new*/
+ 0, /*tp_free*/
+};
+
+/* ---------------------- End object type SPB ----------------------- */
+
+
+static PyObject *Snd_SPB(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ _res = SPBObj_New(); return _res;
+}
+
+static PyObject *Snd_SysBeep(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short duration;
+ if (!PyArg_ParseTuple(_args, "h",
+ &duration))
+ return NULL;
+ SysBeep(duration);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Snd_SndNewChannel(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SndChannelPtr chan = 0;
+ short synth;
+ long init;
+ PyObject* userRoutine;
+ if (!PyArg_ParseTuple(_args, "hlO",
+ &synth,
+ &init,
+ &userRoutine))
+ return NULL;
+ if (userRoutine != Py_None && !PyCallable_Check(userRoutine))
+ {
+ PyErr_SetString(PyExc_TypeError, "callback must be callable");
+ goto userRoutine__error__;
+ }
+ _err = SndNewChannel(&chan,
+ synth,
+ init,
+ NewSndCallBackUPP(SndCh_UserRoutine));
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ SndCh_New, chan);
+ if (_res != NULL && userRoutine != Py_None)
+ {
+ SndChannelObject *p = (SndChannelObject *)_res;
+ p->ob_itself->userInfo = (long)p;
+ Py_INCREF(userRoutine);
+ p->ob_callback = userRoutine;
+ }
+ userRoutine__error__: ;
+ return _res;
+}
+
+static PyObject *Snd_SndSoundManagerVersion(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ NumVersion _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = SndSoundManagerVersion();
+ _res = Py_BuildValue("O&",
+ PyMac_BuildNumVersion, _rv);
+ return _res;
+}
+
+static PyObject *Snd_SndManagerStatus(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short theLength;
+ SMStatus theStatus__out__;
+ if (!PyArg_ParseTuple(_args, "h",
+ &theLength))
+ return NULL;
+ _err = SndManagerStatus(theLength,
+ &theStatus__out__);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("s#",
+ (char *)&theStatus__out__, (int)sizeof(SMStatus));
+ return _res;
+}
+
+static PyObject *Snd_SndGetSysBeepState(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short sysBeepState;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ SndGetSysBeepState(&sysBeepState);
+ _res = Py_BuildValue("h",
+ sysBeepState);
+ return _res;
+}
+
+static PyObject *Snd_SndSetSysBeepState(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short sysBeepState;
+ if (!PyArg_ParseTuple(_args, "h",
+ &sysBeepState))
+ return NULL;
+ _err = SndSetSysBeepState(sysBeepState);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Snd_GetSysBeepVolume(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long level;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetSysBeepVolume(&level);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ level);
+ return _res;
+}
+
+static PyObject *Snd_SetSysBeepVolume(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long level;
+ if (!PyArg_ParseTuple(_args, "l",
+ &level))
+ return NULL;
+ _err = SetSysBeepVolume(level);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Snd_GetDefaultOutputVolume(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long level;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetDefaultOutputVolume(&level);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ level);
+ return _res;
+}
+
+static PyObject *Snd_SetDefaultOutputVolume(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long level;
+ if (!PyArg_ParseTuple(_args, "l",
+ &level))
+ return NULL;
+ _err = SetDefaultOutputVolume(level);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Snd_GetSoundHeaderOffset(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SndListHandle sndHandle;
+ long offset;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &sndHandle))
+ return NULL;
+ _err = GetSoundHeaderOffset(sndHandle,
+ &offset);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ offset);
+ return _res;
+}
+
+static PyObject *Snd_GetCompressionInfo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short compressionID;
+ OSType format;
+ short numChannels;
+ short sampleSize;
+ CompressionInfo cp__out__;
+ if (!PyArg_ParseTuple(_args, "hO&hh",
+ &compressionID,
+ PyMac_GetOSType, &format,
+ &numChannels,
+ &sampleSize))
+ return NULL;
+ _err = GetCompressionInfo(compressionID,
+ format,
+ numChannels,
+ sampleSize,
+ &cp__out__);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("s#",
+ (char *)&cp__out__, (int)sizeof(CompressionInfo));
+ return _res;
+}
+
+static PyObject *Snd_SetSoundPreference(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType theType;
+ Str255 name;
+ Handle settings;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &theType,
+ ResObj_Convert, &settings))
+ return NULL;
+ _err = SetSoundPreference(theType,
+ name,
+ settings);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildStr255, name);
+ return _res;
+}
+
+static PyObject *Snd_GetSoundPreference(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType theType;
+ Str255 name;
+ Handle settings;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &theType,
+ ResObj_Convert, &settings))
+ return NULL;
+ _err = GetSoundPreference(theType,
+ name,
+ settings);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildStr255, name);
+ return _res;
+}
+
+static PyObject *Snd_GetCompressionName(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType compressionType;
+ Str255 compressionName;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &compressionType))
+ return NULL;
+ _err = GetCompressionName(compressionType,
+ compressionName);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildStr255, compressionName);
+ return _res;
+}
+
+static PyObject *Snd_SPBVersion(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ NumVersion _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = SPBVersion();
+ _res = Py_BuildValue("O&",
+ PyMac_BuildNumVersion, _rv);
+ return _res;
+}
+
+static PyObject *Snd_SndRecord(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Point corner;
+ OSType quality;
+ SndListHandle sndHandle;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetPoint, &corner,
+ PyMac_GetOSType, &quality))
+ return NULL;
+ _err = SndRecord((ModalFilterUPP)0,
+ corner,
+ quality,
+ &sndHandle);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, sndHandle);
+ return _res;
+}
+
+static PyObject *Snd_SPBSignInDevice(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short deviceRefNum;
+ Str255 deviceName;
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &deviceRefNum,
+ PyMac_GetStr255, deviceName))
+ return NULL;
+ _err = SPBSignInDevice(deviceRefNum,
+ deviceName);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Snd_SPBSignOutDevice(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short deviceRefNum;
+ if (!PyArg_ParseTuple(_args, "h",
+ &deviceRefNum))
+ return NULL;
+ _err = SPBSignOutDevice(deviceRefNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Snd_SPBGetIndexedDevice(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short count;
+ Str255 deviceName;
+ Handle deviceIconHandle;
+ if (!PyArg_ParseTuple(_args, "h",
+ &count))
+ return NULL;
+ _err = SPBGetIndexedDevice(count,
+ deviceName,
+ &deviceIconHandle);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&O&",
+ PyMac_BuildStr255, deviceName,
+ ResObj_New, deviceIconHandle);
+ return _res;
+}
+
+static PyObject *Snd_SPBOpenDevice(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Str255 deviceName;
+ short permission;
+ long inRefNum;
+ if (!PyArg_ParseTuple(_args, "O&h",
+ PyMac_GetStr255, deviceName,
+ &permission))
+ return NULL;
+ _err = SPBOpenDevice(deviceName,
+ permission,
+ &inRefNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ inRefNum);
+ return _res;
+}
+
+static PyObject *Snd_SPBCloseDevice(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long inRefNum;
+ if (!PyArg_ParseTuple(_args, "l",
+ &inRefNum))
+ return NULL;
+ _err = SPBCloseDevice(inRefNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Snd_SPBRecord(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SPBPtr inParamPtr;
+ Boolean asynchFlag;
+ if (!PyArg_ParseTuple(_args, "O&b",
+ SPBObj_Convert, &inParamPtr,
+ &asynchFlag))
+ return NULL;
+ _err = SPBRecord(inParamPtr,
+ asynchFlag);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Snd_SPBPauseRecording(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long inRefNum;
+ if (!PyArg_ParseTuple(_args, "l",
+ &inRefNum))
+ return NULL;
+ _err = SPBPauseRecording(inRefNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Snd_SPBResumeRecording(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long inRefNum;
+ if (!PyArg_ParseTuple(_args, "l",
+ &inRefNum))
+ return NULL;
+ _err = SPBResumeRecording(inRefNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Snd_SPBStopRecording(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long inRefNum;
+ if (!PyArg_ParseTuple(_args, "l",
+ &inRefNum))
+ return NULL;
+ _err = SPBStopRecording(inRefNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Snd_SPBGetRecordingStatus(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long inRefNum;
+ short recordingStatus;
+ short meterLevel;
+ unsigned long totalSamplesToRecord;
+ unsigned long numberOfSamplesRecorded;
+ unsigned long totalMsecsToRecord;
+ unsigned long numberOfMsecsRecorded;
+ if (!PyArg_ParseTuple(_args, "l",
+ &inRefNum))
+ return NULL;
+ _err = SPBGetRecordingStatus(inRefNum,
+ &recordingStatus,
+ &meterLevel,
+ &totalSamplesToRecord,
+ &numberOfSamplesRecorded,
+ &totalMsecsToRecord,
+ &numberOfMsecsRecorded);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("hhllll",
+ recordingStatus,
+ meterLevel,
+ totalSamplesToRecord,
+ numberOfSamplesRecorded,
+ totalMsecsToRecord,
+ numberOfMsecsRecorded);
+ return _res;
+}
+
+static PyObject *Snd_SPBGetDeviceInfo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long inRefNum;
+ OSType infoType;
+ void * infoData;
+ if (!PyArg_ParseTuple(_args, "lO&w",
+ &inRefNum,
+ PyMac_GetOSType, &infoType,
+ &infoData))
+ return NULL;
+ _err = SPBGetDeviceInfo(inRefNum,
+ infoType,
+ infoData);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Snd_SPBSetDeviceInfo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long inRefNum;
+ OSType infoType;
+ void * infoData;
+ if (!PyArg_ParseTuple(_args, "lO&w",
+ &inRefNum,
+ PyMac_GetOSType, &infoType,
+ &infoData))
+ return NULL;
+ _err = SPBSetDeviceInfo(inRefNum,
+ infoType,
+ infoData);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Snd_SPBMillisecondsToBytes(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long inRefNum;
+ long milliseconds;
+ if (!PyArg_ParseTuple(_args, "l",
+ &inRefNum))
+ return NULL;
+ _err = SPBMillisecondsToBytes(inRefNum,
+ &milliseconds);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ milliseconds);
+ return _res;
+}
+
+static PyObject *Snd_SPBBytesToMilliseconds(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long inRefNum;
+ long byteCount;
+ if (!PyArg_ParseTuple(_args, "l",
+ &inRefNum))
+ return NULL;
+ _err = SPBBytesToMilliseconds(inRefNum,
+ &byteCount);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ byteCount);
+ return _res;
+}
+#endif /* __LP64__ */
+
+static PyMethodDef Snd_methods[] = {
+#ifndef __LP64__
+ {"SPB", (PyCFunction)Snd_SPB, 1,
+ PyDoc_STR(NULL)},
+ {"SysBeep", (PyCFunction)Snd_SysBeep, 1,
+ PyDoc_STR("(short duration) -> None")},
+ {"SndNewChannel", (PyCFunction)Snd_SndNewChannel, 1,
+ PyDoc_STR("(short synth, long init, PyObject* userRoutine) -> (SndChannelPtr chan)")},
+ {"SndSoundManagerVersion", (PyCFunction)Snd_SndSoundManagerVersion, 1,
+ PyDoc_STR("() -> (NumVersion _rv)")},
+ {"SndManagerStatus", (PyCFunction)Snd_SndManagerStatus, 1,
+ PyDoc_STR("(short theLength) -> (SMStatus theStatus)")},
+ {"SndGetSysBeepState", (PyCFunction)Snd_SndGetSysBeepState, 1,
+ PyDoc_STR("() -> (short sysBeepState)")},
+ {"SndSetSysBeepState", (PyCFunction)Snd_SndSetSysBeepState, 1,
+ PyDoc_STR("(short sysBeepState) -> None")},
+ {"GetSysBeepVolume", (PyCFunction)Snd_GetSysBeepVolume, 1,
+ PyDoc_STR("() -> (long level)")},
+ {"SetSysBeepVolume", (PyCFunction)Snd_SetSysBeepVolume, 1,
+ PyDoc_STR("(long level) -> None")},
+ {"GetDefaultOutputVolume", (PyCFunction)Snd_GetDefaultOutputVolume, 1,
+ PyDoc_STR("() -> (long level)")},
+ {"SetDefaultOutputVolume", (PyCFunction)Snd_SetDefaultOutputVolume, 1,
+ PyDoc_STR("(long level) -> None")},
+ {"GetSoundHeaderOffset", (PyCFunction)Snd_GetSoundHeaderOffset, 1,
+ PyDoc_STR("(SndListHandle sndHandle) -> (long offset)")},
+ {"GetCompressionInfo", (PyCFunction)Snd_GetCompressionInfo, 1,
+ PyDoc_STR("(short compressionID, OSType format, short numChannels, short sampleSize) -> (CompressionInfo cp)")},
+ {"SetSoundPreference", (PyCFunction)Snd_SetSoundPreference, 1,
+ PyDoc_STR("(OSType theType, Handle settings) -> (Str255 name)")},
+ {"GetSoundPreference", (PyCFunction)Snd_GetSoundPreference, 1,
+ PyDoc_STR("(OSType theType, Handle settings) -> (Str255 name)")},
+ {"GetCompressionName", (PyCFunction)Snd_GetCompressionName, 1,
+ PyDoc_STR("(OSType compressionType) -> (Str255 compressionName)")},
+ {"SPBVersion", (PyCFunction)Snd_SPBVersion, 1,
+ PyDoc_STR("() -> (NumVersion _rv)")},
+ {"SndRecord", (PyCFunction)Snd_SndRecord, 1,
+ PyDoc_STR("(Point corner, OSType quality) -> (SndListHandle sndHandle)")},
+ {"SPBSignInDevice", (PyCFunction)Snd_SPBSignInDevice, 1,
+ PyDoc_STR("(short deviceRefNum, Str255 deviceName) -> None")},
+ {"SPBSignOutDevice", (PyCFunction)Snd_SPBSignOutDevice, 1,
+ PyDoc_STR("(short deviceRefNum) -> None")},
+ {"SPBGetIndexedDevice", (PyCFunction)Snd_SPBGetIndexedDevice, 1,
+ PyDoc_STR("(short count) -> (Str255 deviceName, Handle deviceIconHandle)")},
+ {"SPBOpenDevice", (PyCFunction)Snd_SPBOpenDevice, 1,
+ PyDoc_STR("(Str255 deviceName, short permission) -> (long inRefNum)")},
+ {"SPBCloseDevice", (PyCFunction)Snd_SPBCloseDevice, 1,
+ PyDoc_STR("(long inRefNum) -> None")},
+ {"SPBRecord", (PyCFunction)Snd_SPBRecord, 1,
+ PyDoc_STR("(SPBPtr inParamPtr, Boolean asynchFlag) -> None")},
+ {"SPBPauseRecording", (PyCFunction)Snd_SPBPauseRecording, 1,
+ PyDoc_STR("(long inRefNum) -> None")},
+ {"SPBResumeRecording", (PyCFunction)Snd_SPBResumeRecording, 1,
+ PyDoc_STR("(long inRefNum) -> None")},
+ {"SPBStopRecording", (PyCFunction)Snd_SPBStopRecording, 1,
+ PyDoc_STR("(long inRefNum) -> None")},
+ {"SPBGetRecordingStatus", (PyCFunction)Snd_SPBGetRecordingStatus, 1,
+ PyDoc_STR("(long inRefNum) -> (short recordingStatus, short meterLevel, unsigned long totalSamplesToRecord, unsigned long numberOfSamplesRecorded, unsigned long totalMsecsToRecord, unsigned long numberOfMsecsRecorded)")},
+ {"SPBGetDeviceInfo", (PyCFunction)Snd_SPBGetDeviceInfo, 1,
+ PyDoc_STR("(long inRefNum, OSType infoType, void * infoData) -> None")},
+ {"SPBSetDeviceInfo", (PyCFunction)Snd_SPBSetDeviceInfo, 1,
+ PyDoc_STR("(long inRefNum, OSType infoType, void * infoData) -> None")},
+ {"SPBMillisecondsToBytes", (PyCFunction)Snd_SPBMillisecondsToBytes, 1,
+ 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
+SndCh_CallCallBack(void *arg)
+{
+ SndChannelObject *p = (SndChannelObject *)arg;
+ PyObject *args;
+ PyObject *res;
+ args = Py_BuildValue("(O(hhl))",
+ p, p->ob_cmd.cmd, p->ob_cmd.param1, p->ob_cmd.param2);
+ res = PyEval_CallObject(p->ob_callback, args);
+ Py_DECREF(args);
+ if (res == NULL)
+ return -1;
+ Py_DECREF(res);
+ return 0;
+}
+
+/* Routine passed to NewSndChannel -- schedule a call to SndCh_CallCallBack */
+static pascal void
+SndCh_UserRoutine(SndChannelPtr chan, SndCommand *cmd)
+{
+ SndChannelObject *p = (SndChannelObject *)(chan->userInfo);
+ if (p->ob_callback != NULL) {
+ long A5 = SetA5(p->ob_A5);
+ p->ob_cmd = *cmd;
+ Py_AddPendingCall(SndCh_CallCallBack, (void *)p);
+ SetA5(A5);
+ }
+}
+
+/* SPB callbacks - Schedule callbacks to Python */
+static int
+SPB_CallCallBack(void *arg)
+{
+ SPBObject *p = (SPBObject *)arg;
+ PyObject *args;
+ PyObject *res;
+
+ if ( p->ob_thiscallback == 0 ) return 0;
+ args = Py_BuildValue("(O)", p);
+ res = PyEval_CallObject(p->ob_thiscallback, args);
+ p->ob_thiscallback = 0;
+ Py_DECREF(args);
+ if (res == NULL)
+ return -1;
+ Py_DECREF(res);
+ return 0;
+}
+
+static pascal void
+SPB_completion(SPBPtr my_spb)
+{
+ SPBObject *p = (SPBObject *)(my_spb->userLong);
+
+ if (p && p->ob_completion) {
+ long A5 = SetA5(p->ob_A5);
+ p->ob_thiscallback = p->ob_completion; /* Hope we cannot get two at the same time */
+ Py_AddPendingCall(SPB_CallCallBack, (void *)p);
+ 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 ||
+ PyDict_SetItemString(d, "Error", Snd_Error) != 0)
+ return;
+ SndChannel_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&SndChannel_Type) < 0) return;
+ Py_INCREF(&SndChannel_Type);
+ PyModule_AddObject(m, "SndChannel", (PyObject *)&SndChannel_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&SndChannel_Type);
+ PyModule_AddObject(m, "SndChannelType", (PyObject *)&SndChannel_Type);
+ SPB_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&SPB_Type) < 0) return;
+ Py_INCREF(&SPB_Type);
+#if 0
+ PyModule_AddObject(m, "SPB", (PyObject *)&SPB_Type);
+#endif
+ /* Backward-compatible name */
+ Py_INCREF(&SPB_Type);
+ PyModule_AddObject(m, "SPBType", (PyObject *)&SPB_Type);
+#endif /* __LP64__ */
+}
+
+/* ======================== End module _Snd ========================= */
+
diff --git a/Mac/Modules/snd/sndscan.py b/Mac/Modules/snd/sndscan.py
new file mode 100644
index 0000000000..7504aefd93
--- /dev/null
+++ b/Mac/Modules/snd/sndscan.py
@@ -0,0 +1,127 @@
+# Scan Sound.h header file, generate sndgen.py and Sound.py files.
+# Then import sndsupport (which execs sndgen.py) to generate Sndmodule.c.
+# (Should learn how to tell the compiler to compile it as well.)
+
+import sys
+from bgenlocations import TOOLBOXDIR, BGENDIR
+sys.path.append(BGENDIR)
+
+from scantools import Scanner
+
+def main():
+ input = "Sound.h"
+ output = "sndgen.py"
+ defsoutput = TOOLBOXDIR + "Sound.py"
+ scanner = SoundScanner(input, output, defsoutput)
+ scanner.scan()
+ scanner.close()
+ print "=== Testing definitions output code ==="
+ execfile(defsoutput, {}, {})
+ print "=== Done scanning and generating, now doing 'import sndsupport' ==="
+ import sndsupport
+ print "=== Done. It's up to you to compile Sndmodule.c ==="
+
+class SoundScanner(Scanner):
+
+ def destination(self, type, name, arglist):
+ classname = "SndFunction"
+ listname = "functions"
+ if arglist:
+ t, n, m = arglist[0]
+ if t == "SndChannelPtr" and m == "InMode":
+ classname = "SndMethod"
+ listname = "sndmethods"
+ return classname, listname
+
+ def writeinitialdefs(self):
+ self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
+
+ def makeblacklistnames(self):
+ return [
+ 'SndDisposeChannel', # automatic on deallocation
+ 'SndAddModifier', # for internal use only
+ 'SndPlayDoubleBuffer', # very low level routine
+ # Missing from libraries (UH332)
+ 'SoundManagerSetInfo',
+ 'SoundManagerGetInfo',
+ # Constants with funny definitions
+ 'rate48khz',
+ 'rate44khz',
+ 'kInvalidSource',
+ # OS8 only:
+ 'MACEVersion',
+ 'SPBRecordToFile',
+ 'Exp1to6',
+ 'Comp6to1',
+ 'Exp1to3',
+ 'Comp3to1',
+ 'SndControl',
+ 'SndStopFilePlay',
+ 'SndStartFilePlay',
+ 'SndPauseFilePlay',
+ 'SndRecordToFile',
+
+ ]
+
+ def makeblacklisttypes(self):
+ return [
+ "GetSoundVol",
+ "SetSoundVol",
+ "UnsignedFixed",
+ # Don't have the time to dig into this...
+ "Component",
+ "ComponentInstance",
+ "SoundComponentDataPtr",
+ "SoundComponentData",
+ "SoundComponentData_ptr",
+ "SoundConverter",
+ ]
+
+ def makerepairinstructions(self):
+ return [
+ ([("Str255", "*", "InMode")],
+ [("*", "*", "OutMode")]),
+
+ ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
+ [("InBuffer", "*", "*")]),
+
+ ([("void", "*", "OutMode"), ("long", "*", "InMode"),
+ ("long", "*", "OutMode")],
+ [("VarVarOutBuffer", "*", "InOutMode")]),
+
+ ([("SCStatusPtr", "*", "InMode")],
+ [("SCStatus", "*", "OutMode")]),
+
+ ([("SMStatusPtr", "*", "InMode")],
+ [("SMStatus", "*", "OutMode")]),
+
+ ([("CompressionInfoPtr", "*", "InMode")],
+ [("CompressionInfo", "*", "OutMode")]),
+
+ # For SndPlay's SndListHandle argument
+ ([("Handle", "sndHdl", "InMode")],
+ [("SndListHandle", "*", "*")]),
+
+ # For SndStartFilePlay
+ ([("long", "bufferSize", "InMode"), ("void", "theBuffer", "OutMode")],
+ [("*", "*", "*"), ("FakeType('0')", "*", "InMode")]),
+
+ # For Comp3to1 etc.
+ ([("void_ptr", "inBuffer", "InMode"),
+ ("void", "outBuffer", "OutMode"),
+ ("unsigned_long", "cnt", "InMode")],
+ [("InOutBuffer", "buffer", "InOutMode")]),
+
+ # Ditto
+## ([("void_ptr", "inState", "InMode"), ("void", "outState", "OutMode")],
+## [("InOutBuf128", "state", "InOutMode")]),
+ ([("StateBlockPtr", "inState", "InMode"), ("StateBlockPtr", "outState", "InMode")],
+ [("StateBlock", "state", "InOutMode")]),
+
+ # Catch-all for the last couple of void pointers
+ ([("void", "*", "OutMode")],
+ [("void_ptr", "*", "InMode")]),
+ ]
+
+if __name__ == "__main__":
+ main()
diff --git a/Mac/Modules/snd/sndsupport.py b/Mac/Modules/snd/sndsupport.py
new file mode 100644
index 0000000000..cf0fa6ca5d
--- /dev/null
+++ b/Mac/Modules/snd/sndsupport.py
@@ -0,0 +1,319 @@
+# This script generates the Sound interface for Python.
+# It uses the "bgen" package to generate C code.
+# It execs the file sndgen.py which contain the function definitions
+# (sndgen.py was generated by sndscan.py, scanning the <Sound.h> header file).
+
+from macsupport import *
+
+
+# define our own function and module generators
+
+class SndMixIn: pass
+
+class SndFunction(SndMixIn, OSErrFunctionGenerator): pass
+class SndMethod(SndMixIn, OSErrMethodGenerator): pass
+
+
+# includestuff etc. are imported from macsupport
+
+includestuff = includestuff + """
+#include <Carbon/Carbon.h>
+"""
+
+initstuff = initstuff + """
+"""
+
+
+# define types used for arguments (in addition to standard and macsupport types)
+
+class SndChannelPtrType(OpaqueByValueType):
+ def declare(self, name):
+ # Initializing all SndChannelPtr objects to 0 saves
+ # special-casing NewSndChannel(), where it is formally an
+ # input-output parameter but we treat it as output-only
+ # (since Python users are not supposed to allocate memory)
+ Output("SndChannelPtr %s = 0;", name)
+
+SndChannelPtr = SndChannelPtrType('SndChannelPtr', 'SndCh')
+
+SndCommand = OpaqueType('SndCommand', 'SndCmd')
+SndCommand_ptr = OpaqueType('SndCommand', 'SndCmd')
+SndListHandle = OpaqueByValueType("SndListHandle", "ResObj")
+SPBPtr = OpaqueByValueType("SPBPtr", "SPBObj")
+ModalFilterUPP = FakeType("(ModalFilterUPP)0")
+
+#
+# NOTE: the following is pretty dangerous. For void pointers we pass buffer addresses
+# but we have no way to check that the buffer is big enough. This is the same problem
+# as in C, though (but Pythoneers may not be suspecting this...)
+void_ptr = Type("void *", "w")
+
+class SndCallBackType(InputOnlyType):
+ def __init__(self):
+ Type.__init__(self, 'PyObject*', 'O')
+ def getargsCheck(self, name):
+ Output("if (%s != Py_None && !PyCallable_Check(%s))", name, name)
+ OutLbrace()
+ Output('PyErr_SetString(PyExc_TypeError, "callback must be callable");')
+ Output("goto %s__error__;", name)
+ OutRbrace()
+ def passInput(self, name):
+ return "NewSndCallBackUPP(SndCh_UserRoutine)"
+ def cleanup(self, name):
+ # XXX This knows it is executing inside the SndNewChannel wrapper
+ Output("if (_res != NULL && %s != Py_None)", name)
+ OutLbrace()
+ Output("SndChannelObject *p = (SndChannelObject *)_res;")
+ Output("p->ob_itself->userInfo = (long)p;")
+ Output("Py_INCREF(%s);", name)
+ Output("p->ob_callback = %s;", name)
+ OutRbrace()
+ DedentLevel()
+ Output(" %s__error__: ;", name)
+ IndentLevel()
+
+SndCallBackProcPtr = SndCallBackType()
+SndCallBackUPP = SndCallBackProcPtr
+
+SndCompletionProcPtr = FakeType('(SndCompletionProcPtr)0') # XXX
+SndCompletionUPP = SndCompletionProcPtr
+
+##InOutBuf128 = FixedInputOutputBufferType(128)
+StateBlock = StructInputOutputBufferType('StateBlock')
+
+AudioSelectionPtr = FakeType('0') # XXX
+
+ProcPtr = FakeType('0') # XXX
+FilePlayCompletionUPP = FakeType('0') # XXX
+
+SCStatus = StructOutputBufferType('SCStatus')
+SMStatus = StructOutputBufferType('SMStatus')
+CompressionInfo = StructOutputBufferType('CompressionInfo')
+
+includestuff = includestuff + """
+/* Convert a SndCommand argument */
+static int
+SndCmd_Convert(PyObject *v, SndCommand *pc)
+{
+ int len;
+ pc->param1 = 0;
+ pc->param2 = 0;
+ if (PyTuple_Check(v)) {
+ if (PyArg_ParseTuple(v, "h|hl", &pc->cmd, &pc->param1, &pc->param2))
+ return 1;
+ PyErr_Clear();
+ return PyArg_ParseTuple(v, "Hhs#", &pc->cmd, &pc->param1, &pc->param2, &len);
+ }
+ return PyArg_Parse(v, "H", &pc->cmd);
+}
+
+static pascal void SndCh_UserRoutine(SndChannelPtr chan, SndCommand *cmd); /* Forward */
+static pascal void SPB_completion(SPBPtr my_spb); /* Forward */
+"""
+
+
+finalstuff = finalstuff + """
+/* Routine passed to Py_AddPendingCall -- call the Python callback */
+static int
+SndCh_CallCallBack(void *arg)
+{
+ SndChannelObject *p = (SndChannelObject *)arg;
+ PyObject *args;
+ PyObject *res;
+ args = Py_BuildValue("(O(hhl))",
+ p, p->ob_cmd.cmd, p->ob_cmd.param1, p->ob_cmd.param2);
+ res = PyEval_CallObject(p->ob_callback, args);
+ Py_DECREF(args);
+ if (res == NULL)
+ return -1;
+ Py_DECREF(res);
+ return 0;
+}
+
+/* Routine passed to NewSndChannel -- schedule a call to SndCh_CallCallBack */
+static pascal void
+SndCh_UserRoutine(SndChannelPtr chan, SndCommand *cmd)
+{
+ SndChannelObject *p = (SndChannelObject *)(chan->userInfo);
+ if (p->ob_callback != NULL) {
+ long A5 = SetA5(p->ob_A5);
+ p->ob_cmd = *cmd;
+ Py_AddPendingCall(SndCh_CallCallBack, (void *)p);
+ SetA5(A5);
+ }
+}
+
+/* SPB callbacks - Schedule callbacks to Python */
+static int
+SPB_CallCallBack(void *arg)
+{
+ SPBObject *p = (SPBObject *)arg;
+ PyObject *args;
+ PyObject *res;
+
+ if ( p->ob_thiscallback == 0 ) return 0;
+ args = Py_BuildValue("(O)", p);
+ res = PyEval_CallObject(p->ob_thiscallback, args);
+ p->ob_thiscallback = 0;
+ Py_DECREF(args);
+ if (res == NULL)
+ return -1;
+ Py_DECREF(res);
+ return 0;
+}
+
+static pascal void
+SPB_completion(SPBPtr my_spb)
+{
+ SPBObject *p = (SPBObject *)(my_spb->userLong);
+
+ if (p && p->ob_completion) {
+ long A5 = SetA5(p->ob_A5);
+ p->ob_thiscallback = p->ob_completion; /* Hope we cannot get two at the same time */
+ Py_AddPendingCall(SPB_CallCallBack, (void *)p);
+ SetA5(A5);
+ }
+}
+
+"""
+
+
+# create the module and object definition and link them
+
+class SndObjectDefinition(PEP252Mixin, ObjectDefinition):
+
+ def outputStructMembers(self):
+ ObjectDefinition.outputStructMembers(self)
+ Output("/* Members used to implement callbacks: */")
+ Output("PyObject *ob_callback;")
+ Output("long ob_A5;");
+ Output("SndCommand ob_cmd;")
+
+ def outputInitStructMembers(self):
+ ObjectDefinition.outputInitStructMembers(self)
+ Output("it->ob_callback = NULL;")
+ Output("it->ob_A5 = SetCurrentA5();");
+
+ def outputCleanupStructMembers(self):
+ ObjectDefinition.outputCleanupStructMembers(self)
+ Output("Py_XDECREF(self->ob_callback);")
+
+ def outputFreeIt(self, itselfname):
+ Output("SndDisposeChannel(%s, 1);", itselfname)
+
+ def outputConvert(self):
+ pass # Not needed
+
+#
+
+class SpbObjectDefinition(PEP252Mixin, ObjectDefinition):
+ getsetlist = [
+ (
+ 'inRefNum',
+ 'return Py_BuildValue("l", self->ob_spb.inRefNum);',
+ 'return -1 + PyArg_Parse(v, "l", &self->ob_spb.inRefNum);',
+ None,
+ ), (
+ 'count',
+ 'return Py_BuildValue("l", self->ob_spb.count);',
+ 'return -1 + PyArg_Parse(v, "l", &self->ob_spb.count);',
+ None
+ ), (
+ 'milliseconds',
+ 'return Py_BuildValue("l", self->ob_spb.milliseconds);',
+ 'return -1 + PyArg_Parse(v, "l", &self->ob_spb.milliseconds);',
+ None,
+ ), (
+ 'error',
+ 'return Py_BuildValue("h", self->ob_spb.error);',
+ None,
+ None
+ ), (
+ 'completionRoutine',
+ None,
+ """self->ob_spb.completionRoutine = NewSICompletionUPP(SPB_completion);
+ self->ob_completion = v;
+ Py_INCREF(v);
+ return 0;""",
+ None,
+ )]
+
+ def outputStructMembers(self):
+ Output("/* Members used to implement callbacks: */")
+ Output("PyObject *ob_completion;")
+ Output("PyObject *ob_interrupt;")
+ Output("PyObject *ob_thiscallback;");
+ Output("long ob_A5;")
+ Output("SPB ob_spb;")
+
+ def outputNew(self):
+ Output()
+ Output("%sPyObject *%s_New(void)", self.static, self.prefix)
+ OutLbrace()
+ Output("%s *it;", self.objecttype)
+ self.outputCheckNewArg()
+ Output("it = PyObject_NEW(%s, &%s);", self.objecttype, self.typename)
+ Output("if (it == NULL) return NULL;")
+ self.outputInitStructMembers()
+ Output("return (PyObject *)it;")
+ OutRbrace()
+
+ def outputInitStructMembers(self):
+ Output("it->ob_completion = NULL;")
+ Output("it->ob_interrupt = NULL;")
+ Output("it->ob_thiscallback = NULL;")
+ Output("it->ob_A5 = SetCurrentA5();")
+ Output("memset((char *)&it->ob_spb, 0, sizeof(it->ob_spb));")
+ Output("it->ob_spb.userLong = (long)it;")
+
+ def outputCleanupStructMembers(self):
+ ObjectDefinition.outputCleanupStructMembers(self)
+ Output("self->ob_spb.userLong = 0;")
+ Output("self->ob_thiscallback = 0;")
+ Output("Py_XDECREF(self->ob_completion);")
+ Output("Py_XDECREF(self->ob_interrupt);")
+
+ def outputConvert(self):
+ Output("%sint %s_Convert(PyObject *v, %s *p_itself)", self.static, self.prefix, self.itselftype)
+ OutLbrace()
+ self.outputCheckConvertArg()
+ Output("if (!%s_Check(v))", self.prefix)
+ OutLbrace()
+ Output('PyErr_SetString(PyExc_TypeError, "%s required");', self.name)
+ Output("return 0;")
+ OutRbrace()
+ Output("*p_itself = &((%s *)v)->ob_spb;", self.objecttype)
+ Output("return 1;")
+ OutRbrace()
+
+
+sndobject = SndObjectDefinition('SndChannel', 'SndCh', 'SndChannelPtr')
+spbobject = SpbObjectDefinition('SPB', 'SPBObj', 'SPBPtr')
+spbgenerator = ManualGenerator("SPB", "_res = SPBObj_New(); return _res;")
+module = MacModule('_Snd', 'Snd', includestuff, finalstuff, initstuff)
+module.addobject(sndobject)
+module.addobject(spbobject)
+module.add(spbgenerator)
+
+
+# create lists of functions and object methods
+
+functions = []
+sndmethods = []
+
+
+# populate the lists
+
+execfile('sndgen.py')
+
+
+# add the functions and methods to the module and object, respectively
+
+for f in functions: module.add(f)
+for f in sndmethods: sndobject.add(f)
+
+
+# generate output
+
+SetOutputFileName('_Sndmodule.c')
+module.generate()
diff --git a/Mac/Modules/te/_TEmodule.c b/Mac/Modules/te/_TEmodule.c
new file mode 100644
index 0000000000..a998fc8fcc
--- /dev/null
+++ b/Mac/Modules/te/_TEmodule.c
@@ -0,0 +1,1339 @@
+
+/* =========================== Module _TE =========================== */
+
+#include "Python.h"
+
+#ifndef __LP64__
+
+
+#include "pymactoolbox.h"
+
+/* Macro to test whether a weak-loaded CFM function exists */
+#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
+ PyErr_SetString(PyExc_NotImplementedError, \
+ "Not available in this shared library/OS version"); \
+ return NULL; \
+ }} while(0)
+
+
+#include <Carbon/Carbon.h>
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_TEObj_New(TEHandle);
+extern int _TEObj_Convert(PyObject *, TEHandle *);
+
+#define TEObj_New _TEObj_New
+#define TEObj_Convert _TEObj_Convert
+#endif
+
+#define as_TE(h) ((TEHandle)h)
+#define as_Resource(teh) ((Handle)teh)
+
+/*
+** Parse/generate TextStyle records
+*/
+static PyObject *
+TextStyle_New(TextStylePtr itself)
+{
+
+ return Py_BuildValue("lllO&", (long)itself->tsFont, (long)itself->tsFace, (long)itself->tsSize, QdRGB_New,
+ &itself->tsColor);
+}
+
+static int
+TextStyle_Convert(PyObject *v, TextStylePtr p_itself)
+{
+ long font, face, size;
+
+ if( !PyArg_ParseTuple(v, "lllO&", &font, &face, &size, QdRGB_Convert, &p_itself->tsColor) )
+ return 0;
+ p_itself->tsFont = (short)font;
+ p_itself->tsFace = (Style)face;
+ p_itself->tsSize = (short)size;
+ return 1;
+}
+
+static PyObject *TE_Error;
+
+/* ------------------------- Object type TE ------------------------- */
+
+PyTypeObject TE_Type;
+
+#define TEObj_Check(x) ((x)->ob_type == &TE_Type || PyObject_TypeCheck((x), &TE_Type))
+
+typedef struct TEObject {
+ PyObject_HEAD
+ TEHandle ob_itself;
+} TEObject;
+
+PyObject *TEObj_New(TEHandle itself)
+{
+ TEObject *it;
+ if (itself == NULL) {
+ PyErr_SetString(TE_Error,"Cannot create null TE");
+ return NULL;
+ }
+ it = PyObject_NEW(TEObject, &TE_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+
+int TEObj_Convert(PyObject *v, TEHandle *p_itself)
+{
+ if (!TEObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "TE required");
+ return 0;
+ }
+ *p_itself = ((TEObject *)v)->ob_itself;
+ return 1;
+}
+
+static void TEObj_dealloc(TEObject *self)
+{
+ TEDispose(self->ob_itself);
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *TEObj_TESetText(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ char *text__in__;
+ long text__len__;
+ int text__in_len__;
+#ifndef TESetText
+ PyMac_PRECHECK(TESetText);
+#endif
+ if (!PyArg_ParseTuple(_args, "s#",
+ &text__in__, &text__in_len__))
+ return NULL;
+ text__len__ = text__in_len__;
+ TESetText(text__in__, text__len__,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TEGetText(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CharsHandle _rv;
+#ifndef TEGetText
+ PyMac_PRECHECK(TEGetText);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = TEGetText(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TEObj_TEIdle(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef TEIdle
+ PyMac_PRECHECK(TEIdle);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TEIdle(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TESetSelect(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long selStart;
+ long selEnd;
+#ifndef TESetSelect
+ PyMac_PRECHECK(TESetSelect);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &selStart,
+ &selEnd))
+ return NULL;
+ TESetSelect(selStart,
+ selEnd,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TEActivate(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef TEActivate
+ PyMac_PRECHECK(TEActivate);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TEActivate(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TEDeactivate(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef TEDeactivate
+ PyMac_PRECHECK(TEDeactivate);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TEDeactivate(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TEKey(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CharParameter key;
+#ifndef TEKey
+ PyMac_PRECHECK(TEKey);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &key))
+ return NULL;
+ TEKey(key,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TECut(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef TECut
+ PyMac_PRECHECK(TECut);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TECut(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TECopy(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef TECopy
+ PyMac_PRECHECK(TECopy);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TECopy(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TEPaste(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef TEPaste
+ PyMac_PRECHECK(TEPaste);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TEPaste(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TEDelete(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef TEDelete
+ PyMac_PRECHECK(TEDelete);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TEDelete(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TEInsert(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ char *text__in__;
+ long text__len__;
+ int text__in_len__;
+#ifndef TEInsert
+ PyMac_PRECHECK(TEInsert);
+#endif
+ if (!PyArg_ParseTuple(_args, "s#",
+ &text__in__, &text__in_len__))
+ return NULL;
+ text__len__ = text__in_len__;
+ TEInsert(text__in__, text__len__,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TESetAlignment(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short just;
+#ifndef TESetAlignment
+ PyMac_PRECHECK(TESetAlignment);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &just))
+ return NULL;
+ TESetAlignment(just,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TEUpdate(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect rUpdate;
+#ifndef TEUpdate
+ PyMac_PRECHECK(TEUpdate);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &rUpdate))
+ return NULL;
+ TEUpdate(&rUpdate,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TEScroll(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short dh;
+ short dv;
+#ifndef TEScroll
+ PyMac_PRECHECK(TEScroll);
+#endif
+ if (!PyArg_ParseTuple(_args, "hh",
+ &dh,
+ &dv))
+ return NULL;
+ TEScroll(dh,
+ dv,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TESelView(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef TESelView
+ PyMac_PRECHECK(TESelView);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TESelView(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TEPinScroll(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short dh;
+ short dv;
+#ifndef TEPinScroll
+ PyMac_PRECHECK(TEPinScroll);
+#endif
+ if (!PyArg_ParseTuple(_args, "hh",
+ &dh,
+ &dv))
+ return NULL;
+ TEPinScroll(dh,
+ dv,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TEAutoView(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean fAuto;
+#ifndef TEAutoView
+ PyMac_PRECHECK(TEAutoView);
+#endif
+ if (!PyArg_ParseTuple(_args, "b",
+ &fAuto))
+ return NULL;
+ TEAutoView(fAuto,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TECalText(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef TECalText
+ PyMac_PRECHECK(TECalText);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TECalText(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TEGetOffset(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ Point pt;
+#ifndef TEGetOffset
+ PyMac_PRECHECK(TEGetOffset);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &pt))
+ return NULL;
+ _rv = TEGetOffset(pt,
+ _self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *TEObj_TEGetPoint(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point _rv;
+ short offset;
+#ifndef TEGetPoint
+ PyMac_PRECHECK(TEGetPoint);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &offset))
+ return NULL;
+ _rv = TEGetPoint(offset,
+ _self->ob_itself);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, _rv);
+ return _res;
+}
+
+static PyObject *TEObj_TEClick(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point pt;
+ Boolean fExtend;
+#ifndef TEClick
+ PyMac_PRECHECK(TEClick);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&b",
+ PyMac_GetPoint, &pt,
+ &fExtend))
+ return NULL;
+ TEClick(pt,
+ fExtend,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TESetStyleHandle(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TEStyleHandle theHandle;
+#ifndef TESetStyleHandle
+ PyMac_PRECHECK(TESetStyleHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &theHandle))
+ return NULL;
+ TESetStyleHandle(theHandle,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TEGetStyleHandle(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TEStyleHandle _rv;
+#ifndef TEGetStyleHandle
+ PyMac_PRECHECK(TEGetStyleHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = TEGetStyleHandle(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TEObj_TEGetStyle(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short offset;
+ TextStyle theStyle;
+ short lineHeight;
+ short fontAscent;
+#ifndef TEGetStyle
+ PyMac_PRECHECK(TEGetStyle);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &offset))
+ return NULL;
+ TEGetStyle(offset,
+ &theStyle,
+ &lineHeight,
+ &fontAscent,
+ _self->ob_itself);
+ _res = Py_BuildValue("O&hh",
+ TextStyle_New, &theStyle,
+ lineHeight,
+ fontAscent);
+ return _res;
+}
+
+static PyObject *TEObj_TEStylePaste(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef TEStylePaste
+ PyMac_PRECHECK(TEStylePaste);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TEStylePaste(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TESetStyle(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short mode;
+ TextStyle newStyle;
+ Boolean fRedraw;
+#ifndef TESetStyle
+ PyMac_PRECHECK(TESetStyle);
+#endif
+ if (!PyArg_ParseTuple(_args, "hO&b",
+ &mode,
+ TextStyle_Convert, &newStyle,
+ &fRedraw))
+ return NULL;
+ TESetStyle(mode,
+ &newStyle,
+ fRedraw,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TEReplaceStyle(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short mode;
+ TextStyle oldStyle;
+ TextStyle newStyle;
+ Boolean fRedraw;
+#ifndef TEReplaceStyle
+ PyMac_PRECHECK(TEReplaceStyle);
+#endif
+ if (!PyArg_ParseTuple(_args, "hO&O&b",
+ &mode,
+ TextStyle_Convert, &oldStyle,
+ TextStyle_Convert, &newStyle,
+ &fRedraw))
+ return NULL;
+ TEReplaceStyle(mode,
+ &oldStyle,
+ &newStyle,
+ fRedraw,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TEGetStyleScrapHandle(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ StScrpHandle _rv;
+#ifndef TEGetStyleScrapHandle
+ PyMac_PRECHECK(TEGetStyleScrapHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = TEGetStyleScrapHandle(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TEObj_TEStyleInsert(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ char *text__in__;
+ long text__len__;
+ int text__in_len__;
+ StScrpHandle hST;
+#ifndef TEStyleInsert
+ PyMac_PRECHECK(TEStyleInsert);
+#endif
+ if (!PyArg_ParseTuple(_args, "s#O&",
+ &text__in__, &text__in_len__,
+ ResObj_Convert, &hST))
+ return NULL;
+ text__len__ = text__in_len__;
+ TEStyleInsert(text__in__, text__len__,
+ hST,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TEGetHeight(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ long endLine;
+ long startLine;
+#ifndef TEGetHeight
+ PyMac_PRECHECK(TEGetHeight);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &endLine,
+ &startLine))
+ return NULL;
+ _rv = TEGetHeight(endLine,
+ startLine,
+ _self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *TEObj_TEContinuousStyle(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ short mode;
+ TextStyle aStyle;
+#ifndef TEContinuousStyle
+ PyMac_PRECHECK(TEContinuousStyle);
+#endif
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &mode,
+ TextStyle_Convert, &aStyle))
+ return NULL;
+ _rv = TEContinuousStyle(&mode,
+ &aStyle,
+ _self->ob_itself);
+ _res = Py_BuildValue("bhO&",
+ _rv,
+ mode,
+ TextStyle_New, &aStyle);
+ return _res;
+}
+
+static PyObject *TEObj_TEUseStyleScrap(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long rangeStart;
+ long rangeEnd;
+ StScrpHandle newStyles;
+ Boolean fRedraw;
+#ifndef TEUseStyleScrap
+ PyMac_PRECHECK(TEUseStyleScrap);
+#endif
+ if (!PyArg_ParseTuple(_args, "llO&b",
+ &rangeStart,
+ &rangeEnd,
+ ResObj_Convert, &newStyles,
+ &fRedraw))
+ return NULL;
+ TEUseStyleScrap(rangeStart,
+ rangeEnd,
+ newStyles,
+ fRedraw,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TENumStyles(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ long rangeStart;
+ long rangeEnd;
+#ifndef TENumStyles
+ PyMac_PRECHECK(TENumStyles);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &rangeStart,
+ &rangeEnd))
+ return NULL;
+ _rv = TENumStyles(rangeStart,
+ rangeEnd,
+ _self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *TEObj_TEFeatureFlag(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ short feature;
+ short action;
+#ifndef TEFeatureFlag
+ PyMac_PRECHECK(TEFeatureFlag);
+#endif
+ if (!PyArg_ParseTuple(_args, "hh",
+ &feature,
+ &action))
+ return NULL;
+ _rv = TEFeatureFlag(feature,
+ action,
+ _self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *TEObj_TEGetHiliteRgn(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ RgnHandle region;
+#ifndef TEGetHiliteRgn
+ PyMac_PRECHECK(TEGetHiliteRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &region))
+ return NULL;
+ _err = TEGetHiliteRgn(region,
+ _self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_as_Resource(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+#ifndef as_Resource
+ PyMac_PRECHECK(as_Resource);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = as_Resource(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyMethodDef TEObj_methods[] = {
+ {"TESetText", (PyCFunction)TEObj_TESetText, 1,
+ PyDoc_STR("(Buffer text) -> None")},
+ {"TEGetText", (PyCFunction)TEObj_TEGetText, 1,
+ PyDoc_STR("() -> (CharsHandle _rv)")},
+ {"TEIdle", (PyCFunction)TEObj_TEIdle, 1,
+ PyDoc_STR("() -> None")},
+ {"TESetSelect", (PyCFunction)TEObj_TESetSelect, 1,
+ PyDoc_STR("(long selStart, long selEnd) -> None")},
+ {"TEActivate", (PyCFunction)TEObj_TEActivate, 1,
+ PyDoc_STR("() -> None")},
+ {"TEDeactivate", (PyCFunction)TEObj_TEDeactivate, 1,
+ PyDoc_STR("() -> None")},
+ {"TEKey", (PyCFunction)TEObj_TEKey, 1,
+ PyDoc_STR("(CharParameter key) -> None")},
+ {"TECut", (PyCFunction)TEObj_TECut, 1,
+ PyDoc_STR("() -> None")},
+ {"TECopy", (PyCFunction)TEObj_TECopy, 1,
+ PyDoc_STR("() -> None")},
+ {"TEPaste", (PyCFunction)TEObj_TEPaste, 1,
+ PyDoc_STR("() -> None")},
+ {"TEDelete", (PyCFunction)TEObj_TEDelete, 1,
+ PyDoc_STR("() -> None")},
+ {"TEInsert", (PyCFunction)TEObj_TEInsert, 1,
+ PyDoc_STR("(Buffer text) -> None")},
+ {"TESetAlignment", (PyCFunction)TEObj_TESetAlignment, 1,
+ PyDoc_STR("(short just) -> None")},
+ {"TEUpdate", (PyCFunction)TEObj_TEUpdate, 1,
+ PyDoc_STR("(Rect rUpdate) -> None")},
+ {"TEScroll", (PyCFunction)TEObj_TEScroll, 1,
+ PyDoc_STR("(short dh, short dv) -> None")},
+ {"TESelView", (PyCFunction)TEObj_TESelView, 1,
+ PyDoc_STR("() -> None")},
+ {"TEPinScroll", (PyCFunction)TEObj_TEPinScroll, 1,
+ PyDoc_STR("(short dh, short dv) -> None")},
+ {"TEAutoView", (PyCFunction)TEObj_TEAutoView, 1,
+ PyDoc_STR("(Boolean fAuto) -> None")},
+ {"TECalText", (PyCFunction)TEObj_TECalText, 1,
+ PyDoc_STR("() -> None")},
+ {"TEGetOffset", (PyCFunction)TEObj_TEGetOffset, 1,
+ PyDoc_STR("(Point pt) -> (short _rv)")},
+ {"TEGetPoint", (PyCFunction)TEObj_TEGetPoint, 1,
+ PyDoc_STR("(short offset) -> (Point _rv)")},
+ {"TEClick", (PyCFunction)TEObj_TEClick, 1,
+ PyDoc_STR("(Point pt, Boolean fExtend) -> None")},
+ {"TESetStyleHandle", (PyCFunction)TEObj_TESetStyleHandle, 1,
+ PyDoc_STR("(TEStyleHandle theHandle) -> None")},
+ {"TEGetStyleHandle", (PyCFunction)TEObj_TEGetStyleHandle, 1,
+ PyDoc_STR("() -> (TEStyleHandle _rv)")},
+ {"TEGetStyle", (PyCFunction)TEObj_TEGetStyle, 1,
+ PyDoc_STR("(short offset) -> (TextStyle theStyle, short lineHeight, short fontAscent)")},
+ {"TEStylePaste", (PyCFunction)TEObj_TEStylePaste, 1,
+ PyDoc_STR("() -> None")},
+ {"TESetStyle", (PyCFunction)TEObj_TESetStyle, 1,
+ PyDoc_STR("(short mode, TextStyle newStyle, Boolean fRedraw) -> None")},
+ {"TEReplaceStyle", (PyCFunction)TEObj_TEReplaceStyle, 1,
+ PyDoc_STR("(short mode, TextStyle oldStyle, TextStyle newStyle, Boolean fRedraw) -> None")},
+ {"TEGetStyleScrapHandle", (PyCFunction)TEObj_TEGetStyleScrapHandle, 1,
+ PyDoc_STR("() -> (StScrpHandle _rv)")},
+ {"TEStyleInsert", (PyCFunction)TEObj_TEStyleInsert, 1,
+ PyDoc_STR("(Buffer text, StScrpHandle hST) -> None")},
+ {"TEGetHeight", (PyCFunction)TEObj_TEGetHeight, 1,
+ PyDoc_STR("(long endLine, long startLine) -> (long _rv)")},
+ {"TEContinuousStyle", (PyCFunction)TEObj_TEContinuousStyle, 1,
+ PyDoc_STR("(short mode, TextStyle aStyle) -> (Boolean _rv, short mode, TextStyle aStyle)")},
+ {"TEUseStyleScrap", (PyCFunction)TEObj_TEUseStyleScrap, 1,
+ PyDoc_STR("(long rangeStart, long rangeEnd, StScrpHandle newStyles, Boolean fRedraw) -> None")},
+ {"TENumStyles", (PyCFunction)TEObj_TENumStyles, 1,
+ PyDoc_STR("(long rangeStart, long rangeEnd) -> (long _rv)")},
+ {"TEFeatureFlag", (PyCFunction)TEObj_TEFeatureFlag, 1,
+ PyDoc_STR("(short feature, short action) -> (short _rv)")},
+ {"TEGetHiliteRgn", (PyCFunction)TEObj_TEGetHiliteRgn, 1,
+ PyDoc_STR("(RgnHandle region) -> None")},
+ {"as_Resource", (PyCFunction)TEObj_as_Resource, 1,
+ PyDoc_STR("() -> (Handle _rv)")},
+ {NULL, NULL, 0}
+};
+
+static PyObject *TEObj_get_destRect(TEObject *self, void *closure)
+{
+ return Py_BuildValue("O&", PyMac_BuildRect, &(*self->ob_itself)->destRect);
+}
+
+#define TEObj_set_destRect NULL
+
+static PyObject *TEObj_get_viewRect(TEObject *self, void *closure)
+{
+ return Py_BuildValue("O&", PyMac_BuildRect, &(*self->ob_itself)->viewRect);
+}
+
+#define TEObj_set_viewRect NULL
+
+static PyObject *TEObj_get_selRect(TEObject *self, void *closure)
+{
+ return Py_BuildValue("O&", PyMac_BuildRect, &(*self->ob_itself)->selRect);
+}
+
+#define TEObj_set_selRect NULL
+
+static PyObject *TEObj_get_lineHeight(TEObject *self, void *closure)
+{
+ return Py_BuildValue("h", (*self->ob_itself)->lineHeight);
+}
+
+#define TEObj_set_lineHeight NULL
+
+static PyObject *TEObj_get_fontAscent(TEObject *self, void *closure)
+{
+ return Py_BuildValue("h", (*self->ob_itself)->fontAscent);
+}
+
+#define TEObj_set_fontAscent NULL
+
+static PyObject *TEObj_get_selPoint(TEObject *self, void *closure)
+{
+ return Py_BuildValue("O&", PyMac_BuildPoint, (*self->ob_itself)->selPoint);
+}
+
+#define TEObj_set_selPoint NULL
+
+static PyObject *TEObj_get_selStart(TEObject *self, void *closure)
+{
+ return Py_BuildValue("h", (*self->ob_itself)->selStart);
+}
+
+#define TEObj_set_selStart NULL
+
+static PyObject *TEObj_get_selEnd(TEObject *self, void *closure)
+{
+ return Py_BuildValue("h", (*self->ob_itself)->selEnd);
+}
+
+#define TEObj_set_selEnd NULL
+
+static PyObject *TEObj_get_active(TEObject *self, void *closure)
+{
+ return Py_BuildValue("h", (*self->ob_itself)->active);
+}
+
+#define TEObj_set_active NULL
+
+static PyObject *TEObj_get_just(TEObject *self, void *closure)
+{
+ return Py_BuildValue("h", (*self->ob_itself)->just);
+}
+
+#define TEObj_set_just NULL
+
+static PyObject *TEObj_get_teLength(TEObject *self, void *closure)
+{
+ return Py_BuildValue("h", (*self->ob_itself)->teLength);
+}
+
+#define TEObj_set_teLength NULL
+
+static PyObject *TEObj_get_txFont(TEObject *self, void *closure)
+{
+ return Py_BuildValue("h", (*self->ob_itself)->txFont);
+}
+
+#define TEObj_set_txFont NULL
+
+static PyObject *TEObj_get_txFace(TEObject *self, void *closure)
+{
+ return Py_BuildValue("h", (*self->ob_itself)->txFace);
+}
+
+#define TEObj_set_txFace NULL
+
+static PyObject *TEObj_get_txMode(TEObject *self, void *closure)
+{
+ return Py_BuildValue("h", (*self->ob_itself)->txMode);
+}
+
+#define TEObj_set_txMode NULL
+
+static PyObject *TEObj_get_txSize(TEObject *self, void *closure)
+{
+ return Py_BuildValue("h", (*self->ob_itself)->txSize);
+}
+
+#define TEObj_set_txSize NULL
+
+static PyObject *TEObj_get_nLines(TEObject *self, void *closure)
+{
+ return Py_BuildValue("h", (*self->ob_itself)->nLines);
+}
+
+#define TEObj_set_nLines NULL
+
+static PyGetSetDef TEObj_getsetlist[] = {
+ {"destRect", (getter)TEObj_get_destRect, (setter)TEObj_set_destRect, "Destination rectangle"},
+ {"viewRect", (getter)TEObj_get_viewRect, (setter)TEObj_set_viewRect, "Viewing rectangle"},
+ {"selRect", (getter)TEObj_get_selRect, (setter)TEObj_set_selRect, "Selection rectangle"},
+ {"lineHeight", (getter)TEObj_get_lineHeight, (setter)TEObj_set_lineHeight, "Height of a line"},
+ {"fontAscent", (getter)TEObj_get_fontAscent, (setter)TEObj_set_fontAscent, "Ascent of a line"},
+ {"selPoint", (getter)TEObj_get_selPoint, (setter)TEObj_set_selPoint, "Selection Point"},
+ {"selStart", (getter)TEObj_get_selStart, (setter)TEObj_set_selStart, "Start of selection"},
+ {"selEnd", (getter)TEObj_get_selEnd, (setter)TEObj_set_selEnd, "End of selection"},
+ {"active", (getter)TEObj_get_active, (setter)TEObj_set_active, "TBD"},
+ {"just", (getter)TEObj_get_just, (setter)TEObj_set_just, "Justification"},
+ {"teLength", (getter)TEObj_get_teLength, (setter)TEObj_set_teLength, "TBD"},
+ {"txFont", (getter)TEObj_get_txFont, (setter)TEObj_set_txFont, "Current font"},
+ {"txFace", (getter)TEObj_get_txFace, (setter)TEObj_set_txFace, "Current font variant"},
+ {"txMode", (getter)TEObj_get_txMode, (setter)TEObj_set_txMode, "Current text-drawing mode"},
+ {"txSize", (getter)TEObj_get_txSize, (setter)TEObj_set_txSize, "Current font size"},
+ {"nLines", (getter)TEObj_get_nLines, (setter)TEObj_set_nLines, "TBD"},
+ {NULL, NULL, NULL, NULL},
+};
+
+
+#define TEObj_compare NULL
+
+#define TEObj_repr NULL
+
+#define TEObj_hash NULL
+#define TEObj_tp_init 0
+
+#define TEObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *TEObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *_self;
+ TEHandle itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, TEObj_Convert, &itself)) return NULL;
+ if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((TEObject *)_self)->ob_itself = itself;
+ return _self;
+}
+
+#define TEObj_tp_free PyObject_Del
+
+
+PyTypeObject TE_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_TE.TE", /*tp_name*/
+ sizeof(TEObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) TEObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) TEObj_compare, /*tp_compare*/
+ (reprfunc) TEObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) TEObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ TEObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ TEObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ TEObj_tp_init, /* tp_init */
+ TEObj_tp_alloc, /* tp_alloc */
+ TEObj_tp_new, /* tp_new */
+ TEObj_tp_free, /* tp_free */
+};
+
+/* ----------------------- End object type TE ----------------------- */
+
+
+static PyObject *TE_TEScrapHandle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+#ifndef TEScrapHandle
+ PyMac_PRECHECK(TEScrapHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = TEScrapHandle();
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TE_TEGetScrapLength(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+#ifndef TEGetScrapLength
+ PyMac_PRECHECK(TEGetScrapLength);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = TEGetScrapLength();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *TE_TENew(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TEHandle _rv;
+ Rect destRect;
+ Rect viewRect;
+#ifndef TENew
+ PyMac_PRECHECK(TENew);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetRect, &destRect,
+ PyMac_GetRect, &viewRect))
+ return NULL;
+ _rv = TENew(&destRect,
+ &viewRect);
+ _res = Py_BuildValue("O&",
+ TEObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TE_TETextBox(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ char *text__in__;
+ long text__len__;
+ int text__in_len__;
+ Rect box;
+ short just;
+#ifndef TETextBox
+ PyMac_PRECHECK(TETextBox);
+#endif
+ if (!PyArg_ParseTuple(_args, "s#O&h",
+ &text__in__, &text__in_len__,
+ PyMac_GetRect, &box,
+ &just))
+ return NULL;
+ text__len__ = text__in_len__;
+ TETextBox(text__in__, text__len__,
+ &box,
+ just);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TE_TEStyleNew(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TEHandle _rv;
+ Rect destRect;
+ Rect viewRect;
+#ifndef TEStyleNew
+ PyMac_PRECHECK(TEStyleNew);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetRect, &destRect,
+ PyMac_GetRect, &viewRect))
+ return NULL;
+ _rv = TEStyleNew(&destRect,
+ &viewRect);
+ _res = Py_BuildValue("O&",
+ TEObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TE_TESetScrapLength(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long length;
+#ifndef TESetScrapLength
+ PyMac_PRECHECK(TESetScrapLength);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &length))
+ return NULL;
+ TESetScrapLength(length);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TE_TEFromScrap(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+#ifndef TEFromScrap
+ PyMac_PRECHECK(TEFromScrap);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = TEFromScrap();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TE_TEToScrap(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+#ifndef TEToScrap
+ PyMac_PRECHECK(TEToScrap);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = TEToScrap();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TE_TEGetScrapHandle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+#ifndef TEGetScrapHandle
+ PyMac_PRECHECK(TEGetScrapHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = TEGetScrapHandle();
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TE_TESetScrapHandle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle value;
+#ifndef TESetScrapHandle
+ PyMac_PRECHECK(TESetScrapHandle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &value))
+ return NULL;
+ TESetScrapHandle(value);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TE_LMGetWordRedraw(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UInt8 _rv;
+#ifndef LMGetWordRedraw
+ PyMac_PRECHECK(LMGetWordRedraw);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = LMGetWordRedraw();
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *TE_LMSetWordRedraw(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UInt8 value;
+#ifndef LMSetWordRedraw
+ PyMac_PRECHECK(LMSetWordRedraw);
+#endif
+ if (!PyArg_ParseTuple(_args, "b",
+ &value))
+ return NULL;
+ LMSetWordRedraw(value);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TE_as_TE(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TEHandle _rv;
+ Handle h;
+#ifndef as_TE
+ PyMac_PRECHECK(as_TE);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &h))
+ return NULL;
+ _rv = as_TE(h);
+ _res = Py_BuildValue("O&",
+ 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,
+ PyDoc_STR("() -> (long _rv)")},
+ {"TENew", (PyCFunction)TE_TENew, 1,
+ PyDoc_STR("(Rect destRect, Rect viewRect) -> (TEHandle _rv)")},
+ {"TETextBox", (PyCFunction)TE_TETextBox, 1,
+ PyDoc_STR("(Buffer text, Rect box, short just) -> None")},
+ {"TEStyleNew", (PyCFunction)TE_TEStyleNew, 1,
+ PyDoc_STR("(Rect destRect, Rect viewRect) -> (TEHandle _rv)")},
+ {"TESetScrapLength", (PyCFunction)TE_TESetScrapLength, 1,
+ PyDoc_STR("(long length) -> None")},
+ {"TEFromScrap", (PyCFunction)TE_TEFromScrap, 1,
+ PyDoc_STR("() -> None")},
+ {"TEToScrap", (PyCFunction)TE_TEToScrap, 1,
+ PyDoc_STR("() -> None")},
+ {"TEGetScrapHandle", (PyCFunction)TE_TEGetScrapHandle, 1,
+ PyDoc_STR("() -> (Handle _rv)")},
+ {"TESetScrapHandle", (PyCFunction)TE_TESetScrapHandle, 1,
+ PyDoc_STR("(Handle value) -> None")},
+ {"LMGetWordRedraw", (PyCFunction)TE_LMGetWordRedraw, 1,
+ PyDoc_STR("() -> (UInt8 _rv)")},
+ {"LMSetWordRedraw", (PyCFunction)TE_LMSetWordRedraw, 1,
+ PyDoc_STR("(UInt8 value) -> None")},
+ {"as_TE", (PyCFunction)TE_as_TE, 1,
+ PyDoc_STR("(Handle h) -> (TEHandle _rv)")},
+#endif /* __LP64__ */
+ {NULL, NULL, 0}
+};
+
+
+
+
+void init_TE(void)
+{
+ PyObject *m;
+#ifndef __LP64__
+ PyObject *d;
+
+
+
+ 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 ||
+ PyDict_SetItemString(d, "Error", TE_Error) != 0)
+ return;
+ TE_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&TE_Type) < 0) return;
+ Py_INCREF(&TE_Type);
+ PyModule_AddObject(m, "TE", (PyObject *)&TE_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&TE_Type);
+ PyModule_AddObject(m, "TEType", (PyObject *)&TE_Type);
+#endif /* __LP64__ */
+}
+
+/* ========================= End module _TE ========================= */
+
diff --git a/Mac/Modules/te/tescan.py b/Mac/Modules/te/tescan.py
new file mode 100644
index 0000000000..6cd25f4661
--- /dev/null
+++ b/Mac/Modules/te/tescan.py
@@ -0,0 +1,66 @@
+# Scan an Apple header file, generating a Python file of generator calls.
+
+import sys
+from bgenlocations import TOOLBOXDIR, BGENDIR
+sys.path.append(BGENDIR)
+from scantools import Scanner
+
+LONG = "TextEdit"
+SHORT = "te"
+OBJECT = "TEHandle"
+
+def main():
+ input = LONG + ".h"
+ output = SHORT + "gen.py"
+ defsoutput = TOOLBOXDIR + LONG + ".py"
+ scanner = MyScanner(input, output, defsoutput)
+ scanner.scan()
+ scanner.close()
+ print "=== Testing definitions output code ==="
+ execfile(defsoutput, {}, {})
+ print "=== Done scanning and generating, now importing the generated code... ==="
+ exec "import " + SHORT + "support"
+ print "=== Done. It's up to you to compile it now! ==="
+
+class MyScanner(Scanner):
+
+ def destination(self, type, name, arglist):
+ classname = "Function"
+ listname = "functions"
+ if arglist:
+ t, n, m = arglist[-1]
+ # This is non-functional today
+ if t == OBJECT and m == "InMode":
+ classname = "Method"
+ listname = "methods"
+ return classname, listname
+
+ def makeblacklistnames(self):
+ return [
+ "TEDispose",
+ "TEInit",
+## "TEGetHiliteRgn",
+ ]
+
+ def makeblacklisttypes(self):
+ return [
+ "TEClickLoopUPP",
+ "UniversalProcPtr",
+ "WordBreakUPP",
+ "TEDoTextUPP",
+ "TERecalcUPP",
+ "TEFindWordUPP",
+ ]
+
+ def makerepairinstructions(self):
+ return [
+ ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
+ [("InBuffer", "*", "*")]),
+
+ # TEContinuousStyle
+ ([("short", "mode", "OutMode"), ("TextStyle", "aStyle", "OutMode")],
+ [("short", "mode", "InOutMode"), ("TextStyle", "aStyle", "InOutMode")])
+ ]
+
+if __name__ == "__main__":
+ main()
diff --git a/Mac/Modules/te/tesupport.py b/Mac/Modules/te/tesupport.py
new file mode 100644
index 0000000000..ad6c053a46
--- /dev/null
+++ b/Mac/Modules/te/tesupport.py
@@ -0,0 +1,216 @@
+# This script generates a Python interface for an Apple Macintosh Manager.
+# It uses the "bgen" package to generate C code.
+# The function specifications are generated by scanning the mamager's header file,
+# using the "scantools" package (customized for this particular manager).
+
+import string
+
+# Declarations that change for each manager
+MACHEADERFILE = 'TextEdit.h' # The Apple header file
+MODNAME = '_TE' # The name of the module
+OBJECTNAME = 'TE' # The basic name of the objects used here
+KIND = 'Handle' # Usually 'Ptr' or 'Handle'
+
+# The following is *usually* unchanged but may still require tuning
+MODPREFIX = 'TE' # The prefix for module-wide routines
+OBJECTTYPE = "TEHandle" # The C type used to represent them
+OBJECTPREFIX = MODPREFIX + 'Obj' # The prefix for object methods
+INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner
+OUTPUTFILE = MODNAME + "module.c" # The file generated by this program
+
+from macsupport import *
+
+# Create the type objects
+TEHandle = OpaqueByValueType("TEHandle", "TEObj")
+CharsHandle = OpaqueByValueType("CharsHandle", "ResObj")
+Handle = OpaqueByValueType("Handle", "ResObj")
+StScrpHandle = OpaqueByValueType("StScrpHandle", "ResObj")
+TEStyleHandle = OpaqueByValueType("TEStyleHandle", "ResObj")
+RgnHandle = OpaqueByValueType("RgnHandle", "ResObj")
+
+TextStyle = OpaqueType("TextStyle", "TextStyle")
+TextStyle_ptr = TextStyle
+
+includestuff = includestuff + """
+#include <Carbon/Carbon.h>
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_TEObj_New(TEHandle);
+extern int _TEObj_Convert(PyObject *, TEHandle *);
+
+#define TEObj_New _TEObj_New
+#define TEObj_Convert _TEObj_Convert
+#endif
+
+#define as_TE(h) ((TEHandle)h)
+#define as_Resource(teh) ((Handle)teh)
+
+/*
+** Parse/generate TextStyle records
+*/
+static PyObject *
+TextStyle_New(TextStylePtr itself)
+{
+
+ return Py_BuildValue("lllO&", (long)itself->tsFont, (long)itself->tsFace, (long)itself->tsSize, QdRGB_New,
+ &itself->tsColor);
+}
+
+static int
+TextStyle_Convert(PyObject *v, TextStylePtr p_itself)
+{
+ long font, face, size;
+
+ if( !PyArg_ParseTuple(v, "lllO&", &font, &face, &size, QdRGB_Convert, &p_itself->tsColor) )
+ return 0;
+ p_itself->tsFont = (short)font;
+ p_itself->tsFace = (Style)face;
+ p_itself->tsSize = (short)size;
+ return 1;
+}
+"""
+
+initstuff = initstuff + """
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(TEHandle, TEObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TEHandle, TEObj_Convert);
+"""
+
+class TEMethodGenerator(OSErrWeakLinkMethodGenerator):
+ """Similar to MethodGenerator, but has self as last argument"""
+
+ def parseArgumentList(self, args):
+ args, a0 = args[:-1], args[-1]
+ t0, n0, m0 = a0
+ if m0 != InMode:
+ raise ValueError, "method's 'self' must be 'InMode'"
+ self.itself = Variable(t0, "_self->ob_itself", SelfMode)
+ FunctionGenerator.parseArgumentList(self, args)
+ self.argumentList.append(self.itself)
+
+
+
+class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
+ # XXXX Could be subtype of Resource
+ # Attributes that can be set.
+ getsetlist = [
+ (
+ 'destRect',
+ 'return Py_BuildValue("O&", PyMac_BuildRect, &(*self->ob_itself)->destRect);',
+ None,
+ 'Destination rectangle'
+ ), (
+ 'viewRect',
+ 'return Py_BuildValue("O&", PyMac_BuildRect, &(*self->ob_itself)->viewRect);',
+ None,
+ 'Viewing rectangle'
+ ), (
+ 'selRect',
+ 'return Py_BuildValue("O&", PyMac_BuildRect, &(*self->ob_itself)->selRect);',
+ None,
+ 'Selection rectangle'
+ ), (
+ 'lineHeight',
+ 'return Py_BuildValue("h", (*self->ob_itself)->lineHeight);',
+ None,
+ 'Height of a line'
+ ), (
+ 'fontAscent',
+ 'return Py_BuildValue("h", (*self->ob_itself)->fontAscent);',
+ None,
+ 'Ascent of a line'
+ ), (
+ "selPoint",
+ 'return Py_BuildValue("O&", PyMac_BuildPoint, (*self->ob_itself)->selPoint);',
+ None,
+ 'Selection Point'
+ ), (
+ 'selStart',
+ 'return Py_BuildValue("h", (*self->ob_itself)->selStart);',
+ None,
+ 'Start of selection'
+ ), (
+ 'selEnd',
+ 'return Py_BuildValue("h", (*self->ob_itself)->selEnd);',
+ None,
+ 'End of selection'
+ ), (
+ 'active',
+ 'return Py_BuildValue("h", (*self->ob_itself)->active);',
+ None,
+ 'TBD'
+ ), (
+ 'just',
+ 'return Py_BuildValue("h", (*self->ob_itself)->just);',
+ None,
+ 'Justification'
+ ), (
+ 'teLength',
+ 'return Py_BuildValue("h", (*self->ob_itself)->teLength);',
+ None,
+ 'TBD'
+ ), (
+ 'txFont',
+ 'return Py_BuildValue("h", (*self->ob_itself)->txFont);',
+ None,
+ 'Current font'
+ ), (
+ 'txFace',
+ 'return Py_BuildValue("h", (*self->ob_itself)->txFace);',
+ None,
+ 'Current font variant'
+ ), (
+ 'txMode',
+ 'return Py_BuildValue("h", (*self->ob_itself)->txMode);',
+ None,
+ 'Current text-drawing mode'
+ ), (
+ 'txSize',
+ 'return Py_BuildValue("h", (*self->ob_itself)->txSize);',
+ None,
+ 'Current font size'
+ ), (
+ 'nLines',
+ 'return Py_BuildValue("h", (*self->ob_itself)->nLines);',
+ None,
+ 'TBD'
+ )]
+
+ def outputCheckNewArg(self):
+ Output("""if (itself == NULL) {
+ PyErr_SetString(TE_Error,"Cannot create null TE");
+ return NULL;
+ }""")
+ def outputFreeIt(self, itselfname):
+ Output("TEDispose(%s);", itselfname)
+
+
+# From here on it's basically all boiler plate...
+
+# Create the generator groups and link them
+module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff)
+object = MyObjectDefinition(OBJECTNAME, OBJECTPREFIX, OBJECTTYPE)
+module.addobject(object)
+
+# Create the generator classes used to populate the lists
+Function = OSErrWeakLinkFunctionGenerator
+Method = TEMethodGenerator
+
+# Create and populate the lists
+functions = []
+methods = []
+execfile(INPUTFILE)
+
+# Converter from/to handle
+f = Function(TEHandle, 'as_TE', (Handle, 'h', InMode))
+functions.append(f)
+f = Method(Handle, 'as_Resource', (TEHandle, 'teh', InMode))
+methods.append(f)
+
+# add the populated lists to the generator groups
+# (in a different wordl the scan program would generate this)
+for f in functions: module.add(f)
+for f in methods: object.add(f)
+
+# generate output (open the output file as late as possible)
+SetOutputFileName(OUTPUTFILE)
+module.generate()
diff --git a/Mac/Modules/win/_Winmodule.c b/Mac/Modules/win/_Winmodule.c
new file mode 100644
index 0000000000..89233ed553
--- /dev/null
+++ b/Mac/Modules/win/_Winmodule.c
@@ -0,0 +1,3265 @@
+
+/* ========================== Module _Win =========================== */
+
+#include "Python.h"
+
+#ifndef __LP64__
+
+#include "pymactoolbox.h"
+
+/* Macro to test whether a weak-loaded CFM function exists */
+#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
+ PyErr_SetString(PyExc_NotImplementedError, \
+ "Not available in this shared library/OS version"); \
+ return NULL; \
+ }} while(0)
+
+
+#include <Carbon/Carbon.h>
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_WinObj_New(WindowRef);
+extern PyObject *_WinObj_WhichWindow(WindowRef);
+extern int _WinObj_Convert(PyObject *, WindowRef *);
+
+#define WinObj_New _WinObj_New
+#define WinObj_WhichWindow _WinObj_WhichWindow
+#define WinObj_Convert _WinObj_Convert
+#endif
+
+/* Classic calls that we emulate in carbon mode */
+#define GetWindowUpdateRgn(win, rgn) GetWindowRegion((win), kWindowUpdateRgn, (rgn))
+#define GetWindowStructureRgn(win, rgn) GetWindowRegion((win), kWindowStructureRgn, (rgn))
+#define GetWindowContentRgn(win, rgn) GetWindowRegion((win), kWindowContentRgn, (rgn))
+
+/* Function to dispose a window, with a "normal" calling sequence */
+static void
+PyMac_AutoDisposeWindow(WindowPtr w)
+{
+ DisposeWindow(w);
+}
+
+static PyObject *Win_Error;
+
+/* ----------------------- Object type Window ----------------------- */
+
+PyTypeObject Window_Type;
+
+#define WinObj_Check(x) ((x)->ob_type == &Window_Type || PyObject_TypeCheck((x), &Window_Type))
+
+typedef struct WindowObject {
+ PyObject_HEAD
+ WindowPtr ob_itself;
+ void (*ob_freeit)(WindowPtr ptr);
+} WindowObject;
+
+PyObject *WinObj_New(WindowPtr itself)
+{
+ WindowObject *it;
+ if (itself == NULL) return PyMac_Error(resNotFound);
+ /* XXXX Or should we use WhichWindow code here? */
+ it = PyObject_NEW(WindowObject, &Window_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ it->ob_freeit = NULL;
+ if (GetWRefCon(itself) == 0)
+ {
+ SetWRefCon(itself, (long)it);
+ it->ob_freeit = PyMac_AutoDisposeWindow;
+ }
+ return (PyObject *)it;
+}
+
+int WinObj_Convert(PyObject *v, WindowPtr *p_itself)
+{
+
+ if (v == Py_None) { *p_itself = NULL; return 1; }
+ if (PyInt_Check(v)) { *p_itself = (WindowPtr)PyInt_AsLong(v); return 1; }
+
+ {
+ DialogRef dlg;
+ if (DlgObj_Convert(v, &dlg) && dlg) {
+ *p_itself = GetDialogWindow(dlg);
+ return 1;
+ }
+ PyErr_Clear();
+ }
+ if (!WinObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "Window required");
+ return 0;
+ }
+ *p_itself = ((WindowObject *)v)->ob_itself;
+ return 1;
+}
+
+static void WinObj_dealloc(WindowObject *self)
+{
+ if (self->ob_freeit && self->ob_itself)
+ {
+ SetWRefCon(self->ob_itself, 0);
+ self->ob_freeit(self->ob_itself);
+ }
+ self->ob_itself = NULL;
+ self->ob_freeit = NULL;
+ self->ob_type->tp_free((PyObject *)self);
+}
+
+static PyObject *WinObj_GetWindowOwnerCount(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 outCount;
+#ifndef GetWindowOwnerCount
+ PyMac_PRECHECK(GetWindowOwnerCount);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetWindowOwnerCount(_self->ob_itself,
+ &outCount);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outCount);
+ return _res;
+}
+
+static PyObject *WinObj_CloneWindow(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+#ifndef CloneWindow
+ PyMac_PRECHECK(CloneWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = CloneWindow(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowRetainCount(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ItemCount _rv;
+#ifndef GetWindowRetainCount
+ PyMac_PRECHECK(GetWindowRetainCount);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetWindowRetainCount(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *WinObj_RetainWindow(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+#ifndef RetainWindow
+ PyMac_PRECHECK(RetainWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = RetainWindow(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_ReleaseWindow(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+#ifndef ReleaseWindow
+ PyMac_PRECHECK(ReleaseWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = ReleaseWindow(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_ReshapeCustomWindow(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+#ifndef ReshapeCustomWindow
+ PyMac_PRECHECK(ReshapeCustomWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = ReshapeCustomWindow(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowWidgetHilite(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowDefPartCode outHilite;
+#ifndef GetWindowWidgetHilite
+ PyMac_PRECHECK(GetWindowWidgetHilite);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetWindowWidgetHilite(_self->ob_itself,
+ &outHilite);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ outHilite);
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowClass(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowClass outClass;
+#ifndef GetWindowClass
+ PyMac_PRECHECK(GetWindowClass);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetWindowClass(_self->ob_itself,
+ &outClass);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outClass);
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowAttributes(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowAttributes outAttributes;
+#ifndef GetWindowAttributes
+ PyMac_PRECHECK(GetWindowAttributes);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetWindowAttributes(_self->ob_itself,
+ &outAttributes);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outAttributes);
+ return _res;
+}
+
+static PyObject *WinObj_ChangeWindowAttributes(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowAttributes setTheseAttributes;
+ WindowAttributes clearTheseAttributes;
+#ifndef ChangeWindowAttributes
+ PyMac_PRECHECK(ChangeWindowAttributes);
+#endif
+ if (!PyArg_ParseTuple(_args, "ll",
+ &setTheseAttributes,
+ &clearTheseAttributes))
+ return NULL;
+ _err = ChangeWindowAttributes(_self->ob_itself,
+ setTheseAttributes,
+ clearTheseAttributes);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_SetWindowClass(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowClass inWindowClass;
+#ifndef SetWindowClass
+ PyMac_PRECHECK(SetWindowClass);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &inWindowClass))
+ return NULL;
+ _err = SetWindowClass(_self->ob_itself,
+ inWindowClass);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_SetWindowModality(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowModality inModalKind;
+ WindowPtr inUnavailableWindow;
+#ifndef SetWindowModality
+ PyMac_PRECHECK(SetWindowModality);
+#endif
+ if (!PyArg_ParseTuple(_args, "lO&",
+ &inModalKind,
+ WinObj_Convert, &inUnavailableWindow))
+ return NULL;
+ _err = SetWindowModality(_self->ob_itself,
+ inModalKind,
+ inUnavailableWindow);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowModality(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowModality outModalKind;
+ WindowPtr outUnavailableWindow;
+#ifndef GetWindowModality
+ PyMac_PRECHECK(GetWindowModality);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetWindowModality(_self->ob_itself,
+ &outModalKind,
+ &outUnavailableWindow);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("lO&",
+ outModalKind,
+ WinObj_WhichWindow, outUnavailableWindow);
+ return _res;
+}
+
+static PyObject *WinObj_SetWindowContentColor(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ RGBColor color;
+#ifndef SetWindowContentColor
+ PyMac_PRECHECK(SetWindowContentColor);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ QdRGB_Convert, &color))
+ return NULL;
+ _err = SetWindowContentColor(_self->ob_itself,
+ &color);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowContentColor(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ RGBColor color;
+#ifndef GetWindowContentColor
+ PyMac_PRECHECK(GetWindowContentColor);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetWindowContentColor(_self->ob_itself,
+ &color);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ QdRGB_New, &color);
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowContentPattern(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ PixPatHandle outPixPat;
+#ifndef GetWindowContentPattern
+ PyMac_PRECHECK(GetWindowContentPattern);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &outPixPat))
+ return NULL;
+ _err = GetWindowContentPattern(_self->ob_itself,
+ outPixPat);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_SetWindowContentPattern(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ PixPatHandle pixPat;
+#ifndef SetWindowContentPattern
+ PyMac_PRECHECK(SetWindowContentPattern);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &pixPat))
+ return NULL;
+ _err = SetWindowContentPattern(_self->ob_itself,
+ pixPat);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_ScrollWindowRect(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inScrollRect;
+ SInt16 inHPixels;
+ SInt16 inVPixels;
+ ScrollWindowOptions inOptions;
+ RgnHandle outExposedRgn;
+#ifndef ScrollWindowRect
+ PyMac_PRECHECK(ScrollWindowRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hhlO&",
+ PyMac_GetRect, &inScrollRect,
+ &inHPixels,
+ &inVPixels,
+ &inOptions,
+ ResObj_Convert, &outExposedRgn))
+ return NULL;
+ _err = ScrollWindowRect(_self->ob_itself,
+ &inScrollRect,
+ inHPixels,
+ inVPixels,
+ inOptions,
+ outExposedRgn);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_ScrollWindowRegion(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ RgnHandle inScrollRgn;
+ SInt16 inHPixels;
+ SInt16 inVPixels;
+ ScrollWindowOptions inOptions;
+ RgnHandle outExposedRgn;
+#ifndef ScrollWindowRegion
+ PyMac_PRECHECK(ScrollWindowRegion);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hhlO&",
+ ResObj_Convert, &inScrollRgn,
+ &inHPixels,
+ &inVPixels,
+ &inOptions,
+ ResObj_Convert, &outExposedRgn))
+ return NULL;
+ _err = ScrollWindowRegion(_self->ob_itself,
+ inScrollRgn,
+ inHPixels,
+ inVPixels,
+ inOptions,
+ outExposedRgn);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_ClipAbove(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef ClipAbove
+ PyMac_PRECHECK(ClipAbove);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ClipAbove(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_PaintOne(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle clobberedRgn;
+#ifndef PaintOne
+ PyMac_PRECHECK(PaintOne);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &clobberedRgn))
+ return NULL;
+ PaintOne(_self->ob_itself,
+ clobberedRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_PaintBehind(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle clobberedRgn;
+#ifndef PaintBehind
+ PyMac_PRECHECK(PaintBehind);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &clobberedRgn))
+ return NULL;
+ PaintBehind(_self->ob_itself,
+ clobberedRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_CalcVis(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef CalcVis
+ PyMac_PRECHECK(CalcVis);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ CalcVis(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_CalcVisBehind(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle clobberedRgn;
+#ifndef CalcVisBehind
+ PyMac_PRECHECK(CalcVisBehind);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &clobberedRgn))
+ return NULL;
+ CalcVisBehind(_self->ob_itself,
+ clobberedRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_BringToFront(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef BringToFront
+ PyMac_PRECHECK(BringToFront);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ BringToFront(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_SendBehind(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr behindWindow;
+#ifndef SendBehind
+ PyMac_PRECHECK(SendBehind);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &behindWindow))
+ return NULL;
+ SendBehind(_self->ob_itself,
+ behindWindow);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_SelectWindow(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef SelectWindow
+ PyMac_PRECHECK(SelectWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ SelectWindow(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_GetNextWindowOfClass(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr _rv;
+ WindowClass inWindowClass;
+ Boolean mustBeVisible;
+#ifndef GetNextWindowOfClass
+ PyMac_PRECHECK(GetNextWindowOfClass);
+#endif
+ if (!PyArg_ParseTuple(_args, "lb",
+ &inWindowClass,
+ &mustBeVisible))
+ return NULL;
+ _rv = GetNextWindowOfClass(_self->ob_itself,
+ inWindowClass,
+ mustBeVisible);
+ _res = Py_BuildValue("O&",
+ WinObj_New, _rv);
+ return _res;
+}
+
+static PyObject *WinObj_SetWindowAlternateTitle(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ CFStringRef inTitle;
+#ifndef SetWindowAlternateTitle
+ PyMac_PRECHECK(SetWindowAlternateTitle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFStringRefObj_Convert, &inTitle))
+ return NULL;
+ _err = SetWindowAlternateTitle(_self->ob_itself,
+ inTitle);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_CopyWindowAlternateTitle(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ CFStringRef outTitle;
+#ifndef CopyWindowAlternateTitle
+ PyMac_PRECHECK(CopyWindowAlternateTitle);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = CopyWindowAlternateTitle(_self->ob_itself,
+ &outTitle);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, outTitle);
+ return _res;
+}
+
+static PyObject *WinObj_HiliteWindow(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean fHilite;
+#ifndef HiliteWindow
+ PyMac_PRECHECK(HiliteWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, "b",
+ &fHilite))
+ return NULL;
+ HiliteWindow(_self->ob_itself,
+ fHilite);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_SetWRefCon(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long data;
+#ifndef SetWRefCon
+ PyMac_PRECHECK(SetWRefCon);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &data))
+ return NULL;
+ SetWRefCon(_self->ob_itself,
+ data);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_GetWRefCon(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+#ifndef GetWRefCon
+ PyMac_PRECHECK(GetWRefCon);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetWRefCon(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *WinObj_SetWindowPic(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PicHandle pic;
+#ifndef SetWindowPic
+ PyMac_PRECHECK(SetWindowPic);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &pic))
+ return NULL;
+ SetWindowPic(_self->ob_itself,
+ pic);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowPic(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PicHandle _rv;
+#ifndef GetWindowPic
+ PyMac_PRECHECK(GetWindowPic);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetWindowPic(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *WinObj_GetWVariant(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+#ifndef GetWVariant
+ PyMac_PRECHECK(GetWVariant);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetWVariant(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowFeatures(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 outFeatures;
+#ifndef GetWindowFeatures
+ PyMac_PRECHECK(GetWindowFeatures);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetWindowFeatures(_self->ob_itself,
+ &outFeatures);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outFeatures);
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowRegion(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowRegionCode inRegionCode;
+ RgnHandle ioWinRgn;
+#ifndef GetWindowRegion
+ PyMac_PRECHECK(GetWindowRegion);
+#endif
+ if (!PyArg_ParseTuple(_args, "HO&",
+ &inRegionCode,
+ ResObj_Convert, &ioWinRgn))
+ return NULL;
+ _err = GetWindowRegion(_self->ob_itself,
+ inRegionCode,
+ ioWinRgn);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowStructureWidths(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect outRect;
+#ifndef GetWindowStructureWidths
+ PyMac_PRECHECK(GetWindowStructureWidths);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetWindowStructureWidths(_self->ob_itself,
+ &outRect);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &outRect);
+ return _res;
+}
+
+static PyObject *WinObj_BeginUpdate(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef BeginUpdate
+ PyMac_PRECHECK(BeginUpdate);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ BeginUpdate(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_EndUpdate(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef EndUpdate
+ PyMac_PRECHECK(EndUpdate);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ EndUpdate(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_InvalWindowRgn(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ RgnHandle region;
+#ifndef InvalWindowRgn
+ PyMac_PRECHECK(InvalWindowRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &region))
+ return NULL;
+ _err = InvalWindowRgn(_self->ob_itself,
+ region);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_InvalWindowRect(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect bounds;
+#ifndef InvalWindowRect
+ PyMac_PRECHECK(InvalWindowRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &bounds))
+ return NULL;
+ _err = InvalWindowRect(_self->ob_itself,
+ &bounds);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_ValidWindowRgn(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ RgnHandle region;
+#ifndef ValidWindowRgn
+ PyMac_PRECHECK(ValidWindowRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &region))
+ return NULL;
+ _err = ValidWindowRgn(_self->ob_itself,
+ region);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_ValidWindowRect(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect bounds;
+#ifndef ValidWindowRect
+ PyMac_PRECHECK(ValidWindowRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &bounds))
+ return NULL;
+ _err = ValidWindowRect(_self->ob_itself,
+ &bounds);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_DrawGrowIcon(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef DrawGrowIcon
+ PyMac_PRECHECK(DrawGrowIcon);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ DrawGrowIcon(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_SetWTitle(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Str255 title;
+#ifndef SetWTitle
+ PyMac_PRECHECK(SetWTitle);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetStr255, title))
+ return NULL;
+ SetWTitle(_self->ob_itself,
+ title);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_GetWTitle(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Str255 title;
+#ifndef GetWTitle
+ PyMac_PRECHECK(GetWTitle);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetWTitle(_self->ob_itself,
+ title);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildStr255, title);
+ return _res;
+}
+
+static PyObject *WinObj_SetWindowTitleWithCFString(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ CFStringRef inString;
+#ifndef SetWindowTitleWithCFString
+ PyMac_PRECHECK(SetWindowTitleWithCFString);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFStringRefObj_Convert, &inString))
+ return NULL;
+ _err = SetWindowTitleWithCFString(_self->ob_itself,
+ inString);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_CopyWindowTitleAsCFString(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ CFStringRef outString;
+#ifndef CopyWindowTitleAsCFString
+ PyMac_PRECHECK(CopyWindowTitleAsCFString);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = CopyWindowTitleAsCFString(_self->ob_itself,
+ &outString);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, outString);
+ return _res;
+}
+
+static PyObject *WinObj_SetWindowProxyFSSpec(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ FSSpec inFile;
+#ifndef SetWindowProxyFSSpec
+ PyMac_PRECHECK(SetWindowProxyFSSpec);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetFSSpec, &inFile))
+ return NULL;
+ _err = SetWindowProxyFSSpec(_self->ob_itself,
+ &inFile);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowProxyFSSpec(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ FSSpec outFile;
+#ifndef GetWindowProxyFSSpec
+ PyMac_PRECHECK(GetWindowProxyFSSpec);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetWindowProxyFSSpec(_self->ob_itself,
+ &outFile);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildFSSpec, &outFile);
+ return _res;
+}
+
+static PyObject *WinObj_SetWindowProxyAlias(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ AliasHandle inAlias;
+#ifndef SetWindowProxyAlias
+ PyMac_PRECHECK(SetWindowProxyAlias);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &inAlias))
+ return NULL;
+ _err = SetWindowProxyAlias(_self->ob_itself,
+ inAlias);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowProxyAlias(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ AliasHandle alias;
+#ifndef GetWindowProxyAlias
+ PyMac_PRECHECK(GetWindowProxyAlias);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetWindowProxyAlias(_self->ob_itself,
+ &alias);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, alias);
+ return _res;
+}
+
+static PyObject *WinObj_SetWindowProxyCreatorAndType(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ OSType fileCreator;
+ OSType fileType;
+ SInt16 vRefNum;
+#ifndef SetWindowProxyCreatorAndType
+ PyMac_PRECHECK(SetWindowProxyCreatorAndType);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&h",
+ PyMac_GetOSType, &fileCreator,
+ PyMac_GetOSType, &fileType,
+ &vRefNum))
+ return NULL;
+ _err = SetWindowProxyCreatorAndType(_self->ob_itself,
+ fileCreator,
+ fileType,
+ vRefNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowProxyIcon(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ IconRef outIcon;
+#ifndef GetWindowProxyIcon
+ PyMac_PRECHECK(GetWindowProxyIcon);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetWindowProxyIcon(_self->ob_itself,
+ &outIcon);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, outIcon);
+ return _res;
+}
+
+static PyObject *WinObj_SetWindowProxyIcon(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ IconRef icon;
+#ifndef SetWindowProxyIcon
+ PyMac_PRECHECK(SetWindowProxyIcon);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &icon))
+ return NULL;
+ _err = SetWindowProxyIcon(_self->ob_itself,
+ icon);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_RemoveWindowProxy(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+#ifndef RemoveWindowProxy
+ PyMac_PRECHECK(RemoveWindowProxy);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = RemoveWindowProxy(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_BeginWindowProxyDrag(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ DragReference outNewDrag;
+ RgnHandle outDragOutlineRgn;
+#ifndef BeginWindowProxyDrag
+ PyMac_PRECHECK(BeginWindowProxyDrag);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &outDragOutlineRgn))
+ return NULL;
+ _err = BeginWindowProxyDrag(_self->ob_itself,
+ &outNewDrag,
+ outDragOutlineRgn);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ DragObj_New, outNewDrag);
+ return _res;
+}
+
+static PyObject *WinObj_EndWindowProxyDrag(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ DragReference theDrag;
+#ifndef EndWindowProxyDrag
+ PyMac_PRECHECK(EndWindowProxyDrag);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ DragObj_Convert, &theDrag))
+ return NULL;
+ _err = EndWindowProxyDrag(_self->ob_itself,
+ theDrag);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_TrackWindowProxyFromExistingDrag(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Point startPt;
+ DragReference drag;
+ RgnHandle inDragOutlineRgn;
+#ifndef TrackWindowProxyFromExistingDrag
+ PyMac_PRECHECK(TrackWindowProxyFromExistingDrag);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ PyMac_GetPoint, &startPt,
+ DragObj_Convert, &drag,
+ ResObj_Convert, &inDragOutlineRgn))
+ return NULL;
+ _err = TrackWindowProxyFromExistingDrag(_self->ob_itself,
+ startPt,
+ drag,
+ inDragOutlineRgn);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_TrackWindowProxyDrag(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Point startPt;
+#ifndef TrackWindowProxyDrag
+ PyMac_PRECHECK(TrackWindowProxyDrag);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &startPt))
+ return NULL;
+ _err = TrackWindowProxyDrag(_self->ob_itself,
+ startPt);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_IsWindowModified(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef IsWindowModified
+ PyMac_PRECHECK(IsWindowModified);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsWindowModified(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *WinObj_SetWindowModified(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Boolean modified;
+#ifndef SetWindowModified
+ PyMac_PRECHECK(SetWindowModified);
+#endif
+ if (!PyArg_ParseTuple(_args, "b",
+ &modified))
+ return NULL;
+ _err = SetWindowModified(_self->ob_itself,
+ modified);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_IsWindowPathSelectClick(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ EventRecord event;
+#ifndef IsWindowPathSelectClick
+ PyMac_PRECHECK(IsWindowPathSelectClick);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetEventRecord, &event))
+ return NULL;
+ _rv = IsWindowPathSelectClick(_self->ob_itself,
+ &event);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *WinObj_WindowPathSelect(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuHandle menu;
+ SInt32 outMenuResult;
+#ifndef WindowPathSelect
+ PyMac_PRECHECK(WindowPathSelect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ MenuObj_Convert, &menu))
+ return NULL;
+ _err = WindowPathSelect(_self->ob_itself,
+ menu,
+ &outMenuResult);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outMenuResult);
+ return _res;
+}
+
+static PyObject *WinObj_HiliteWindowFrameForDrag(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Boolean hilited;
+#ifndef HiliteWindowFrameForDrag
+ PyMac_PRECHECK(HiliteWindowFrameForDrag);
+#endif
+ if (!PyArg_ParseTuple(_args, "b",
+ &hilited))
+ return NULL;
+ _err = HiliteWindowFrameForDrag(_self->ob_itself,
+ hilited);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_TransitionWindow(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowTransitionEffect inEffect;
+ WindowTransitionAction inAction;
+ Rect inRect;
+#ifndef TransitionWindow
+ PyMac_PRECHECK(TransitionWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, "llO&",
+ &inEffect,
+ &inAction,
+ PyMac_GetRect, &inRect))
+ return NULL;
+ _err = TransitionWindow(_self->ob_itself,
+ inEffect,
+ inAction,
+ &inRect);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_TransitionWindowAndParent(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr inParentWindow;
+ WindowTransitionEffect inEffect;
+ WindowTransitionAction inAction;
+ Rect inRect;
+#ifndef TransitionWindowAndParent
+ PyMac_PRECHECK(TransitionWindowAndParent);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&llO&",
+ WinObj_Convert, &inParentWindow,
+ &inEffect,
+ &inAction,
+ PyMac_GetRect, &inRect))
+ return NULL;
+ _err = TransitionWindowAndParent(_self->ob_itself,
+ inParentWindow,
+ inEffect,
+ inAction,
+ &inRect);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_MacMoveWindow(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short hGlobal;
+ short vGlobal;
+ Boolean front;
+#ifndef MacMoveWindow
+ PyMac_PRECHECK(MacMoveWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, "hhb",
+ &hGlobal,
+ &vGlobal,
+ &front))
+ return NULL;
+ MacMoveWindow(_self->ob_itself,
+ hGlobal,
+ vGlobal,
+ front);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_SizeWindow(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short w;
+ short h;
+ Boolean fUpdate;
+#ifndef SizeWindow
+ PyMac_PRECHECK(SizeWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, "hhb",
+ &w,
+ &h,
+ &fUpdate))
+ return NULL;
+ SizeWindow(_self->ob_itself,
+ w,
+ h,
+ fUpdate);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_GrowWindow(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ Point startPt;
+ Rect bBox;
+#ifndef GrowWindow
+ PyMac_PRECHECK(GrowWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetPoint, &startPt,
+ PyMac_GetRect, &bBox))
+ return NULL;
+ _rv = GrowWindow(_self->ob_itself,
+ startPt,
+ &bBox);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *WinObj_DragWindow(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point startPt;
+ Rect boundsRect;
+#ifndef DragWindow
+ PyMac_PRECHECK(DragWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetPoint, &startPt,
+ PyMac_GetRect, &boundsRect))
+ return NULL;
+ DragWindow(_self->ob_itself,
+ startPt,
+ &boundsRect);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_ZoomWindow(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPartCode partCode;
+ Boolean front;
+#ifndef ZoomWindow
+ PyMac_PRECHECK(ZoomWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, "hb",
+ &partCode,
+ &front))
+ return NULL;
+ ZoomWindow(_self->ob_itself,
+ partCode,
+ front);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_IsWindowCollapsable(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef IsWindowCollapsable
+ PyMac_PRECHECK(IsWindowCollapsable);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsWindowCollapsable(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *WinObj_IsWindowCollapsed(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef IsWindowCollapsed
+ PyMac_PRECHECK(IsWindowCollapsed);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsWindowCollapsed(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *WinObj_CollapseWindow(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Boolean collapse;
+#ifndef CollapseWindow
+ PyMac_PRECHECK(CollapseWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, "b",
+ &collapse))
+ return NULL;
+ _err = CollapseWindow(_self->ob_itself,
+ collapse);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowBounds(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowRegionCode regionCode;
+ Rect globalBounds;
+#ifndef GetWindowBounds
+ PyMac_PRECHECK(GetWindowBounds);
+#endif
+ if (!PyArg_ParseTuple(_args, "H",
+ &regionCode))
+ return NULL;
+ _err = GetWindowBounds(_self->ob_itself,
+ regionCode,
+ &globalBounds);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &globalBounds);
+ return _res;
+}
+
+static PyObject *WinObj_ResizeWindow(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Point inStartPoint;
+ Rect inSizeConstraints;
+ Rect outNewContentRect;
+#ifndef ResizeWindow
+ PyMac_PRECHECK(ResizeWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetPoint, &inStartPoint,
+ PyMac_GetRect, &inSizeConstraints))
+ return NULL;
+ _rv = ResizeWindow(_self->ob_itself,
+ inStartPoint,
+ &inSizeConstraints,
+ &outNewContentRect);
+ _res = Py_BuildValue("bO&",
+ _rv,
+ PyMac_BuildRect, &outNewContentRect);
+ return _res;
+}
+
+static PyObject *WinObj_SetWindowBounds(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowRegionCode regionCode;
+ Rect globalBounds;
+#ifndef SetWindowBounds
+ PyMac_PRECHECK(SetWindowBounds);
+#endif
+ if (!PyArg_ParseTuple(_args, "HO&",
+ &regionCode,
+ PyMac_GetRect, &globalBounds))
+ return NULL;
+ _err = SetWindowBounds(_self->ob_itself,
+ regionCode,
+ &globalBounds);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_RepositionWindow(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr parentWindow;
+ WindowPositionMethod method;
+#ifndef RepositionWindow
+ PyMac_PRECHECK(RepositionWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ WinObj_Convert, &parentWindow,
+ &method))
+ return NULL;
+ _err = RepositionWindow(_self->ob_itself,
+ parentWindow,
+ method);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_MoveWindowStructure(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ short hGlobal;
+ short vGlobal;
+#ifndef MoveWindowStructure
+ PyMac_PRECHECK(MoveWindowStructure);
+#endif
+ if (!PyArg_ParseTuple(_args, "hh",
+ &hGlobal,
+ &vGlobal))
+ return NULL;
+ _err = MoveWindowStructure(_self->ob_itself,
+ hGlobal,
+ vGlobal);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_IsWindowInStandardState(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Point inIdealSize;
+ Rect outIdealStandardState;
+#ifndef IsWindowInStandardState
+ PyMac_PRECHECK(IsWindowInStandardState);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &inIdealSize))
+ return NULL;
+ _rv = IsWindowInStandardState(_self->ob_itself,
+ &inIdealSize,
+ &outIdealStandardState);
+ _res = Py_BuildValue("bO&",
+ _rv,
+ PyMac_BuildRect, &outIdealStandardState);
+ return _res;
+}
+
+static PyObject *WinObj_ZoomWindowIdeal(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPartCode inPartCode;
+ Point ioIdealSize;
+#ifndef ZoomWindowIdeal
+ PyMac_PRECHECK(ZoomWindowIdeal);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &inPartCode))
+ return NULL;
+ _err = ZoomWindowIdeal(_self->ob_itself,
+ inPartCode,
+ &ioIdealSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, ioIdealSize);
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowIdealUserState(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect outUserState;
+#ifndef GetWindowIdealUserState
+ PyMac_PRECHECK(GetWindowIdealUserState);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetWindowIdealUserState(_self->ob_itself,
+ &outUserState);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &outUserState);
+ return _res;
+}
+
+static PyObject *WinObj_SetWindowIdealUserState(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inUserState;
+#ifndef SetWindowIdealUserState
+ PyMac_PRECHECK(SetWindowIdealUserState);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &inUserState))
+ return NULL;
+ _err = SetWindowIdealUserState(_self->ob_itself,
+ &inUserState);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowGreatestAreaDevice(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowRegionCode inRegion;
+ GDHandle outGreatestDevice;
+ Rect outGreatestDeviceRect;
+#ifndef GetWindowGreatestAreaDevice
+ PyMac_PRECHECK(GetWindowGreatestAreaDevice);
+#endif
+ if (!PyArg_ParseTuple(_args, "H",
+ &inRegion))
+ return NULL;
+ _err = GetWindowGreatestAreaDevice(_self->ob_itself,
+ inRegion,
+ &outGreatestDevice,
+ &outGreatestDeviceRect);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&O&",
+ ResObj_New, outGreatestDevice,
+ PyMac_BuildRect, &outGreatestDeviceRect);
+ return _res;
+}
+
+static PyObject *WinObj_ConstrainWindowToScreen(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowRegionCode inRegionCode;
+ WindowConstrainOptions inOptions;
+ Rect inScreenRect;
+ Rect outStructure;
+#ifndef ConstrainWindowToScreen
+ PyMac_PRECHECK(ConstrainWindowToScreen);
+#endif
+ if (!PyArg_ParseTuple(_args, "HlO&",
+ &inRegionCode,
+ &inOptions,
+ PyMac_GetRect, &inScreenRect))
+ return NULL;
+ _err = ConstrainWindowToScreen(_self->ob_itself,
+ inRegionCode,
+ inOptions,
+ &inScreenRect,
+ &outStructure);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &outStructure);
+ return _res;
+}
+
+static PyObject *WinObj_HideWindow(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef HideWindow
+ PyMac_PRECHECK(HideWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ HideWindow(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_MacShowWindow(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef MacShowWindow
+ PyMac_PRECHECK(MacShowWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ MacShowWindow(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_ShowHide(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean showFlag;
+#ifndef ShowHide
+ PyMac_PRECHECK(ShowHide);
+#endif
+ if (!PyArg_ParseTuple(_args, "b",
+ &showFlag))
+ return NULL;
+ ShowHide(_self->ob_itself,
+ showFlag);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_MacIsWindowVisible(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef MacIsWindowVisible
+ PyMac_PRECHECK(MacIsWindowVisible);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MacIsWindowVisible(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *WinObj_ShowSheetWindow(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr inParentWindow;
+#ifndef ShowSheetWindow
+ PyMac_PRECHECK(ShowSheetWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &inParentWindow))
+ return NULL;
+ _err = ShowSheetWindow(_self->ob_itself,
+ inParentWindow);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_HideSheetWindow(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+#ifndef HideSheetWindow
+ PyMac_PRECHECK(HideSheetWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = HideSheetWindow(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_GetSheetWindowParent(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr outParentWindow;
+#ifndef GetSheetWindowParent
+ PyMac_PRECHECK(GetSheetWindowParent);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetSheetWindowParent(_self->ob_itself,
+ &outParentWindow);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ WinObj_WhichWindow, outParentWindow);
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowPropertyAttributes(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ OSType propertyCreator;
+ OSType propertyTag;
+ UInt32 attributes;
+#ifndef GetWindowPropertyAttributes
+ PyMac_PRECHECK(GetWindowPropertyAttributes);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &propertyCreator,
+ PyMac_GetOSType, &propertyTag))
+ return NULL;
+ _err = GetWindowPropertyAttributes(_self->ob_itself,
+ propertyCreator,
+ propertyTag,
+ &attributes);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ attributes);
+ return _res;
+}
+
+static PyObject *WinObj_ChangeWindowPropertyAttributes(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ OSType propertyCreator;
+ OSType propertyTag;
+ UInt32 attributesToSet;
+ UInt32 attributesToClear;
+#ifndef ChangeWindowPropertyAttributes
+ PyMac_PRECHECK(ChangeWindowPropertyAttributes);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&ll",
+ PyMac_GetOSType, &propertyCreator,
+ PyMac_GetOSType, &propertyTag,
+ &attributesToSet,
+ &attributesToClear))
+ return NULL;
+ _err = ChangeWindowPropertyAttributes(_self->ob_itself,
+ propertyCreator,
+ propertyTag,
+ attributesToSet,
+ attributesToClear);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_TrackBox(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Point thePt;
+ WindowPartCode partCode;
+#ifndef TrackBox
+ PyMac_PRECHECK(TrackBox);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&h",
+ PyMac_GetPoint, &thePt,
+ &partCode))
+ return NULL;
+ _rv = TrackBox(_self->ob_itself,
+ thePt,
+ partCode);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *WinObj_TrackGoAway(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Point thePt;
+#ifndef TrackGoAway
+ PyMac_PRECHECK(TrackGoAway);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &thePt))
+ return NULL;
+ _rv = TrackGoAway(_self->ob_itself,
+ thePt);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowPort(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr _rv;
+#ifndef GetWindowPort
+ PyMac_PRECHECK(GetWindowPort);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetWindowPort(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ GrafObj_New, _rv);
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowStructurePort(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr _rv;
+#ifndef GetWindowStructurePort
+ PyMac_PRECHECK(GetWindowStructurePort);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetWindowStructurePort(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ GrafObj_New, _rv);
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowKind(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+#ifndef GetWindowKind
+ PyMac_PRECHECK(GetWindowKind);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetWindowKind(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *WinObj_IsWindowHilited(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef IsWindowHilited
+ PyMac_PRECHECK(IsWindowHilited);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsWindowHilited(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *WinObj_IsWindowUpdatePending(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef IsWindowUpdatePending
+ PyMac_PRECHECK(IsWindowUpdatePending);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsWindowUpdatePending(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *WinObj_MacGetNextWindow(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr _rv;
+#ifndef MacGetNextWindow
+ PyMac_PRECHECK(MacGetNextWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MacGetNextWindow(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ WinObj_New, _rv);
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowStandardState(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect rect;
+#ifndef GetWindowStandardState
+ PyMac_PRECHECK(GetWindowStandardState);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetWindowStandardState(_self->ob_itself,
+ &rect);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &rect);
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowUserState(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect rect;
+#ifndef GetWindowUserState
+ PyMac_PRECHECK(GetWindowUserState);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetWindowUserState(_self->ob_itself,
+ &rect);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &rect);
+ return _res;
+}
+
+static PyObject *WinObj_SetWindowKind(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short kind;
+#ifndef SetWindowKind
+ PyMac_PRECHECK(SetWindowKind);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &kind))
+ return NULL;
+ SetWindowKind(_self->ob_itself,
+ kind);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_SetWindowStandardState(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect rect;
+#ifndef SetWindowStandardState
+ PyMac_PRECHECK(SetWindowStandardState);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &rect))
+ return NULL;
+ SetWindowStandardState(_self->ob_itself,
+ &rect);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_SetWindowUserState(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect rect;
+#ifndef SetWindowUserState
+ PyMac_PRECHECK(SetWindowUserState);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &rect))
+ return NULL;
+ SetWindowUserState(_self->ob_itself,
+ &rect);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_SetPortWindowPort(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef SetPortWindowPort
+ PyMac_PRECHECK(SetPortWindowPort);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ SetPortWindowPort(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowPortBounds(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect bounds;
+#ifndef GetWindowPortBounds
+ PyMac_PRECHECK(GetWindowPortBounds);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetWindowPortBounds(_self->ob_itself,
+ &bounds);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &bounds);
+ return _res;
+}
+
+static PyObject *WinObj_IsWindowVisible(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef IsWindowVisible
+ PyMac_PRECHECK(IsWindowVisible);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsWindowVisible(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowStructureRgn(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle r;
+#ifndef GetWindowStructureRgn
+ PyMac_PRECHECK(GetWindowStructureRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &r))
+ return NULL;
+ GetWindowStructureRgn(_self->ob_itself,
+ r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowContentRgn(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle r;
+#ifndef GetWindowContentRgn
+ PyMac_PRECHECK(GetWindowContentRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &r))
+ return NULL;
+ GetWindowContentRgn(_self->ob_itself,
+ r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowUpdateRgn(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle r;
+#ifndef GetWindowUpdateRgn
+ PyMac_PRECHECK(GetWindowUpdateRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &r))
+ return NULL;
+ GetWindowUpdateRgn(_self->ob_itself,
+ r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_GetNextWindow(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr _rv;
+#ifndef GetNextWindow
+ PyMac_PRECHECK(GetNextWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetNextWindow(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ WinObj_WhichWindow, _rv);
+ return _res;
+}
+
+static PyObject *WinObj_MoveWindow(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short hGlobal;
+ short vGlobal;
+ Boolean front;
+#ifndef MoveWindow
+ PyMac_PRECHECK(MoveWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, "hhb",
+ &hGlobal,
+ &vGlobal,
+ &front))
+ return NULL;
+ MoveWindow(_self->ob_itself,
+ hGlobal,
+ vGlobal,
+ front);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_ShowWindow(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef ShowWindow
+ PyMac_PRECHECK(ShowWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ShowWindow(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_AutoDispose(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ int onoff, old = 0;
+ if (!PyArg_ParseTuple(_args, "i", &onoff))
+ return NULL;
+ if ( _self->ob_freeit )
+ old = 1;
+ if ( onoff )
+ _self->ob_freeit = PyMac_AutoDisposeWindow;
+ else
+ _self->ob_freeit = NULL;
+ _res = Py_BuildValue("i", old);
+ return _res;
+
+}
+
+static PyMethodDef WinObj_methods[] = {
+ {"GetWindowOwnerCount", (PyCFunction)WinObj_GetWindowOwnerCount, 1,
+ PyDoc_STR("() -> (UInt32 outCount)")},
+ {"CloneWindow", (PyCFunction)WinObj_CloneWindow, 1,
+ PyDoc_STR("() -> None")},
+ {"GetWindowRetainCount", (PyCFunction)WinObj_GetWindowRetainCount, 1,
+ PyDoc_STR("() -> (ItemCount _rv)")},
+ {"RetainWindow", (PyCFunction)WinObj_RetainWindow, 1,
+ PyDoc_STR("() -> None")},
+ {"ReleaseWindow", (PyCFunction)WinObj_ReleaseWindow, 1,
+ PyDoc_STR("() -> None")},
+ {"ReshapeCustomWindow", (PyCFunction)WinObj_ReshapeCustomWindow, 1,
+ PyDoc_STR("() -> None")},
+ {"GetWindowWidgetHilite", (PyCFunction)WinObj_GetWindowWidgetHilite, 1,
+ PyDoc_STR("() -> (WindowDefPartCode outHilite)")},
+ {"GetWindowClass", (PyCFunction)WinObj_GetWindowClass, 1,
+ PyDoc_STR("() -> (WindowClass outClass)")},
+ {"GetWindowAttributes", (PyCFunction)WinObj_GetWindowAttributes, 1,
+ PyDoc_STR("() -> (WindowAttributes outAttributes)")},
+ {"ChangeWindowAttributes", (PyCFunction)WinObj_ChangeWindowAttributes, 1,
+ PyDoc_STR("(WindowAttributes setTheseAttributes, WindowAttributes clearTheseAttributes) -> None")},
+ {"SetWindowClass", (PyCFunction)WinObj_SetWindowClass, 1,
+ PyDoc_STR("(WindowClass inWindowClass) -> None")},
+ {"SetWindowModality", (PyCFunction)WinObj_SetWindowModality, 1,
+ PyDoc_STR("(WindowModality inModalKind, WindowPtr inUnavailableWindow) -> None")},
+ {"GetWindowModality", (PyCFunction)WinObj_GetWindowModality, 1,
+ PyDoc_STR("() -> (WindowModality outModalKind, WindowPtr outUnavailableWindow)")},
+ {"SetWindowContentColor", (PyCFunction)WinObj_SetWindowContentColor, 1,
+ PyDoc_STR("(RGBColor color) -> None")},
+ {"GetWindowContentColor", (PyCFunction)WinObj_GetWindowContentColor, 1,
+ PyDoc_STR("() -> (RGBColor color)")},
+ {"GetWindowContentPattern", (PyCFunction)WinObj_GetWindowContentPattern, 1,
+ PyDoc_STR("(PixPatHandle outPixPat) -> None")},
+ {"SetWindowContentPattern", (PyCFunction)WinObj_SetWindowContentPattern, 1,
+ PyDoc_STR("(PixPatHandle pixPat) -> None")},
+ {"ScrollWindowRect", (PyCFunction)WinObj_ScrollWindowRect, 1,
+ PyDoc_STR("(Rect inScrollRect, SInt16 inHPixels, SInt16 inVPixels, ScrollWindowOptions inOptions, RgnHandle outExposedRgn) -> None")},
+ {"ScrollWindowRegion", (PyCFunction)WinObj_ScrollWindowRegion, 1,
+ PyDoc_STR("(RgnHandle inScrollRgn, SInt16 inHPixels, SInt16 inVPixels, ScrollWindowOptions inOptions, RgnHandle outExposedRgn) -> None")},
+ {"ClipAbove", (PyCFunction)WinObj_ClipAbove, 1,
+ PyDoc_STR("() -> None")},
+ {"PaintOne", (PyCFunction)WinObj_PaintOne, 1,
+ PyDoc_STR("(RgnHandle clobberedRgn) -> None")},
+ {"PaintBehind", (PyCFunction)WinObj_PaintBehind, 1,
+ PyDoc_STR("(RgnHandle clobberedRgn) -> None")},
+ {"CalcVis", (PyCFunction)WinObj_CalcVis, 1,
+ PyDoc_STR("() -> None")},
+ {"CalcVisBehind", (PyCFunction)WinObj_CalcVisBehind, 1,
+ PyDoc_STR("(RgnHandle clobberedRgn) -> None")},
+ {"BringToFront", (PyCFunction)WinObj_BringToFront, 1,
+ PyDoc_STR("() -> None")},
+ {"SendBehind", (PyCFunction)WinObj_SendBehind, 1,
+ PyDoc_STR("(WindowPtr behindWindow) -> None")},
+ {"SelectWindow", (PyCFunction)WinObj_SelectWindow, 1,
+ PyDoc_STR("() -> None")},
+ {"GetNextWindowOfClass", (PyCFunction)WinObj_GetNextWindowOfClass, 1,
+ PyDoc_STR("(WindowClass inWindowClass, Boolean mustBeVisible) -> (WindowPtr _rv)")},
+ {"SetWindowAlternateTitle", (PyCFunction)WinObj_SetWindowAlternateTitle, 1,
+ PyDoc_STR("(CFStringRef inTitle) -> None")},
+ {"CopyWindowAlternateTitle", (PyCFunction)WinObj_CopyWindowAlternateTitle, 1,
+ PyDoc_STR("() -> (CFStringRef outTitle)")},
+ {"HiliteWindow", (PyCFunction)WinObj_HiliteWindow, 1,
+ PyDoc_STR("(Boolean fHilite) -> None")},
+ {"SetWRefCon", (PyCFunction)WinObj_SetWRefCon, 1,
+ PyDoc_STR("(long data) -> None")},
+ {"GetWRefCon", (PyCFunction)WinObj_GetWRefCon, 1,
+ PyDoc_STR("() -> (long _rv)")},
+ {"SetWindowPic", (PyCFunction)WinObj_SetWindowPic, 1,
+ PyDoc_STR("(PicHandle pic) -> None")},
+ {"GetWindowPic", (PyCFunction)WinObj_GetWindowPic, 1,
+ PyDoc_STR("() -> (PicHandle _rv)")},
+ {"GetWVariant", (PyCFunction)WinObj_GetWVariant, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"GetWindowFeatures", (PyCFunction)WinObj_GetWindowFeatures, 1,
+ PyDoc_STR("() -> (UInt32 outFeatures)")},
+ {"GetWindowRegion", (PyCFunction)WinObj_GetWindowRegion, 1,
+ PyDoc_STR("(WindowRegionCode inRegionCode, RgnHandle ioWinRgn) -> None")},
+ {"GetWindowStructureWidths", (PyCFunction)WinObj_GetWindowStructureWidths, 1,
+ PyDoc_STR("() -> (Rect outRect)")},
+ {"BeginUpdate", (PyCFunction)WinObj_BeginUpdate, 1,
+ PyDoc_STR("() -> None")},
+ {"EndUpdate", (PyCFunction)WinObj_EndUpdate, 1,
+ PyDoc_STR("() -> None")},
+ {"InvalWindowRgn", (PyCFunction)WinObj_InvalWindowRgn, 1,
+ PyDoc_STR("(RgnHandle region) -> None")},
+ {"InvalWindowRect", (PyCFunction)WinObj_InvalWindowRect, 1,
+ PyDoc_STR("(Rect bounds) -> None")},
+ {"ValidWindowRgn", (PyCFunction)WinObj_ValidWindowRgn, 1,
+ PyDoc_STR("(RgnHandle region) -> None")},
+ {"ValidWindowRect", (PyCFunction)WinObj_ValidWindowRect, 1,
+ PyDoc_STR("(Rect bounds) -> None")},
+ {"DrawGrowIcon", (PyCFunction)WinObj_DrawGrowIcon, 1,
+ PyDoc_STR("() -> None")},
+ {"SetWTitle", (PyCFunction)WinObj_SetWTitle, 1,
+ PyDoc_STR("(Str255 title) -> None")},
+ {"GetWTitle", (PyCFunction)WinObj_GetWTitle, 1,
+ PyDoc_STR("() -> (Str255 title)")},
+ {"SetWindowTitleWithCFString", (PyCFunction)WinObj_SetWindowTitleWithCFString, 1,
+ PyDoc_STR("(CFStringRef inString) -> None")},
+ {"CopyWindowTitleAsCFString", (PyCFunction)WinObj_CopyWindowTitleAsCFString, 1,
+ PyDoc_STR("() -> (CFStringRef outString)")},
+ {"SetWindowProxyFSSpec", (PyCFunction)WinObj_SetWindowProxyFSSpec, 1,
+ PyDoc_STR("(FSSpec inFile) -> None")},
+ {"GetWindowProxyFSSpec", (PyCFunction)WinObj_GetWindowProxyFSSpec, 1,
+ PyDoc_STR("() -> (FSSpec outFile)")},
+ {"SetWindowProxyAlias", (PyCFunction)WinObj_SetWindowProxyAlias, 1,
+ PyDoc_STR("(AliasHandle inAlias) -> None")},
+ {"GetWindowProxyAlias", (PyCFunction)WinObj_GetWindowProxyAlias, 1,
+ PyDoc_STR("() -> (AliasHandle alias)")},
+ {"SetWindowProxyCreatorAndType", (PyCFunction)WinObj_SetWindowProxyCreatorAndType, 1,
+ PyDoc_STR("(OSType fileCreator, OSType fileType, SInt16 vRefNum) -> None")},
+ {"GetWindowProxyIcon", (PyCFunction)WinObj_GetWindowProxyIcon, 1,
+ PyDoc_STR("() -> (IconRef outIcon)")},
+ {"SetWindowProxyIcon", (PyCFunction)WinObj_SetWindowProxyIcon, 1,
+ PyDoc_STR("(IconRef icon) -> None")},
+ {"RemoveWindowProxy", (PyCFunction)WinObj_RemoveWindowProxy, 1,
+ PyDoc_STR("() -> None")},
+ {"BeginWindowProxyDrag", (PyCFunction)WinObj_BeginWindowProxyDrag, 1,
+ PyDoc_STR("(RgnHandle outDragOutlineRgn) -> (DragReference outNewDrag)")},
+ {"EndWindowProxyDrag", (PyCFunction)WinObj_EndWindowProxyDrag, 1,
+ PyDoc_STR("(DragReference theDrag) -> None")},
+ {"TrackWindowProxyFromExistingDrag", (PyCFunction)WinObj_TrackWindowProxyFromExistingDrag, 1,
+ PyDoc_STR("(Point startPt, DragReference drag, RgnHandle inDragOutlineRgn) -> None")},
+ {"TrackWindowProxyDrag", (PyCFunction)WinObj_TrackWindowProxyDrag, 1,
+ PyDoc_STR("(Point startPt) -> None")},
+ {"IsWindowModified", (PyCFunction)WinObj_IsWindowModified, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"SetWindowModified", (PyCFunction)WinObj_SetWindowModified, 1,
+ PyDoc_STR("(Boolean modified) -> None")},
+ {"IsWindowPathSelectClick", (PyCFunction)WinObj_IsWindowPathSelectClick, 1,
+ PyDoc_STR("(EventRecord event) -> (Boolean _rv)")},
+ {"WindowPathSelect", (PyCFunction)WinObj_WindowPathSelect, 1,
+ PyDoc_STR("(MenuHandle menu) -> (SInt32 outMenuResult)")},
+ {"HiliteWindowFrameForDrag", (PyCFunction)WinObj_HiliteWindowFrameForDrag, 1,
+ PyDoc_STR("(Boolean hilited) -> None")},
+ {"TransitionWindow", (PyCFunction)WinObj_TransitionWindow, 1,
+ PyDoc_STR("(WindowTransitionEffect inEffect, WindowTransitionAction inAction, Rect inRect) -> None")},
+ {"TransitionWindowAndParent", (PyCFunction)WinObj_TransitionWindowAndParent, 1,
+ PyDoc_STR("(WindowPtr inParentWindow, WindowTransitionEffect inEffect, WindowTransitionAction inAction, Rect inRect) -> None")},
+ {"MacMoveWindow", (PyCFunction)WinObj_MacMoveWindow, 1,
+ PyDoc_STR("(short hGlobal, short vGlobal, Boolean front) -> None")},
+ {"SizeWindow", (PyCFunction)WinObj_SizeWindow, 1,
+ PyDoc_STR("(short w, short h, Boolean fUpdate) -> None")},
+ {"GrowWindow", (PyCFunction)WinObj_GrowWindow, 1,
+ PyDoc_STR("(Point startPt, Rect bBox) -> (long _rv)")},
+ {"DragWindow", (PyCFunction)WinObj_DragWindow, 1,
+ PyDoc_STR("(Point startPt, Rect boundsRect) -> None")},
+ {"ZoomWindow", (PyCFunction)WinObj_ZoomWindow, 1,
+ PyDoc_STR("(WindowPartCode partCode, Boolean front) -> None")},
+ {"IsWindowCollapsable", (PyCFunction)WinObj_IsWindowCollapsable, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"IsWindowCollapsed", (PyCFunction)WinObj_IsWindowCollapsed, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"CollapseWindow", (PyCFunction)WinObj_CollapseWindow, 1,
+ PyDoc_STR("(Boolean collapse) -> None")},
+ {"GetWindowBounds", (PyCFunction)WinObj_GetWindowBounds, 1,
+ PyDoc_STR("(WindowRegionCode regionCode) -> (Rect globalBounds)")},
+ {"ResizeWindow", (PyCFunction)WinObj_ResizeWindow, 1,
+ PyDoc_STR("(Point inStartPoint, Rect inSizeConstraints) -> (Boolean _rv, Rect outNewContentRect)")},
+ {"SetWindowBounds", (PyCFunction)WinObj_SetWindowBounds, 1,
+ PyDoc_STR("(WindowRegionCode regionCode, Rect globalBounds) -> None")},
+ {"RepositionWindow", (PyCFunction)WinObj_RepositionWindow, 1,
+ PyDoc_STR("(WindowPtr parentWindow, WindowPositionMethod method) -> None")},
+ {"MoveWindowStructure", (PyCFunction)WinObj_MoveWindowStructure, 1,
+ PyDoc_STR("(short hGlobal, short vGlobal) -> None")},
+ {"IsWindowInStandardState", (PyCFunction)WinObj_IsWindowInStandardState, 1,
+ PyDoc_STR("(Point inIdealSize) -> (Boolean _rv, Rect outIdealStandardState)")},
+ {"ZoomWindowIdeal", (PyCFunction)WinObj_ZoomWindowIdeal, 1,
+ PyDoc_STR("(WindowPartCode inPartCode) -> (Point ioIdealSize)")},
+ {"GetWindowIdealUserState", (PyCFunction)WinObj_GetWindowIdealUserState, 1,
+ PyDoc_STR("() -> (Rect outUserState)")},
+ {"SetWindowIdealUserState", (PyCFunction)WinObj_SetWindowIdealUserState, 1,
+ PyDoc_STR("(Rect inUserState) -> None")},
+ {"GetWindowGreatestAreaDevice", (PyCFunction)WinObj_GetWindowGreatestAreaDevice, 1,
+ PyDoc_STR("(WindowRegionCode inRegion) -> (GDHandle outGreatestDevice, Rect outGreatestDeviceRect)")},
+ {"ConstrainWindowToScreen", (PyCFunction)WinObj_ConstrainWindowToScreen, 1,
+ PyDoc_STR("(WindowRegionCode inRegionCode, WindowConstrainOptions inOptions, Rect inScreenRect) -> (Rect outStructure)")},
+ {"HideWindow", (PyCFunction)WinObj_HideWindow, 1,
+ PyDoc_STR("() -> None")},
+ {"MacShowWindow", (PyCFunction)WinObj_MacShowWindow, 1,
+ PyDoc_STR("() -> None")},
+ {"ShowHide", (PyCFunction)WinObj_ShowHide, 1,
+ PyDoc_STR("(Boolean showFlag) -> None")},
+ {"MacIsWindowVisible", (PyCFunction)WinObj_MacIsWindowVisible, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"ShowSheetWindow", (PyCFunction)WinObj_ShowSheetWindow, 1,
+ PyDoc_STR("(WindowPtr inParentWindow) -> None")},
+ {"HideSheetWindow", (PyCFunction)WinObj_HideSheetWindow, 1,
+ PyDoc_STR("() -> None")},
+ {"GetSheetWindowParent", (PyCFunction)WinObj_GetSheetWindowParent, 1,
+ PyDoc_STR("() -> (WindowPtr outParentWindow)")},
+ {"GetWindowPropertyAttributes", (PyCFunction)WinObj_GetWindowPropertyAttributes, 1,
+ PyDoc_STR("(OSType propertyCreator, OSType propertyTag) -> (UInt32 attributes)")},
+ {"ChangeWindowPropertyAttributes", (PyCFunction)WinObj_ChangeWindowPropertyAttributes, 1,
+ PyDoc_STR("(OSType propertyCreator, OSType propertyTag, UInt32 attributesToSet, UInt32 attributesToClear) -> None")},
+ {"TrackBox", (PyCFunction)WinObj_TrackBox, 1,
+ PyDoc_STR("(Point thePt, WindowPartCode partCode) -> (Boolean _rv)")},
+ {"TrackGoAway", (PyCFunction)WinObj_TrackGoAway, 1,
+ PyDoc_STR("(Point thePt) -> (Boolean _rv)")},
+ {"GetWindowPort", (PyCFunction)WinObj_GetWindowPort, 1,
+ PyDoc_STR("() -> (CGrafPtr _rv)")},
+ {"GetWindowStructurePort", (PyCFunction)WinObj_GetWindowStructurePort, 1,
+ PyDoc_STR("() -> (CGrafPtr _rv)")},
+ {"GetWindowKind", (PyCFunction)WinObj_GetWindowKind, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"IsWindowHilited", (PyCFunction)WinObj_IsWindowHilited, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"IsWindowUpdatePending", (PyCFunction)WinObj_IsWindowUpdatePending, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"MacGetNextWindow", (PyCFunction)WinObj_MacGetNextWindow, 1,
+ PyDoc_STR("() -> (WindowPtr _rv)")},
+ {"GetWindowStandardState", (PyCFunction)WinObj_GetWindowStandardState, 1,
+ PyDoc_STR("() -> (Rect rect)")},
+ {"GetWindowUserState", (PyCFunction)WinObj_GetWindowUserState, 1,
+ PyDoc_STR("() -> (Rect rect)")},
+ {"SetWindowKind", (PyCFunction)WinObj_SetWindowKind, 1,
+ PyDoc_STR("(short kind) -> None")},
+ {"SetWindowStandardState", (PyCFunction)WinObj_SetWindowStandardState, 1,
+ PyDoc_STR("(Rect rect) -> None")},
+ {"SetWindowUserState", (PyCFunction)WinObj_SetWindowUserState, 1,
+ PyDoc_STR("(Rect rect) -> None")},
+ {"SetPortWindowPort", (PyCFunction)WinObj_SetPortWindowPort, 1,
+ PyDoc_STR("() -> None")},
+ {"GetWindowPortBounds", (PyCFunction)WinObj_GetWindowPortBounds, 1,
+ PyDoc_STR("() -> (Rect bounds)")},
+ {"IsWindowVisible", (PyCFunction)WinObj_IsWindowVisible, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"GetWindowStructureRgn", (PyCFunction)WinObj_GetWindowStructureRgn, 1,
+ PyDoc_STR("(RgnHandle r) -> None")},
+ {"GetWindowContentRgn", (PyCFunction)WinObj_GetWindowContentRgn, 1,
+ PyDoc_STR("(RgnHandle r) -> None")},
+ {"GetWindowUpdateRgn", (PyCFunction)WinObj_GetWindowUpdateRgn, 1,
+ PyDoc_STR("(RgnHandle r) -> None")},
+ {"GetNextWindow", (PyCFunction)WinObj_GetNextWindow, 1,
+ PyDoc_STR("() -> (WindowPtr _rv)")},
+ {"MoveWindow", (PyCFunction)WinObj_MoveWindow, 1,
+ PyDoc_STR("(short hGlobal, short vGlobal, Boolean front) -> None")},
+ {"ShowWindow", (PyCFunction)WinObj_ShowWindow, 1,
+ PyDoc_STR("() -> None")},
+ {"AutoDispose", (PyCFunction)WinObj_AutoDispose, 1,
+ PyDoc_STR("(int)->int. Automatically DisposeHandle the object on Python object cleanup")},
+ {NULL, NULL, 0}
+};
+
+#define WinObj_getsetlist NULL
+
+
+static int WinObj_compare(WindowObject *self, WindowObject *other)
+{
+ if ( self->ob_itself > other->ob_itself ) return 1;
+ if ( self->ob_itself < other->ob_itself ) return -1;
+ return 0;
+}
+
+static PyObject * WinObj_repr(WindowObject *self)
+{
+ char buf[100];
+ sprintf(buf, "<Window object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
+ return PyString_FromString(buf);
+}
+
+static int WinObj_hash(WindowObject *self)
+{
+ return (int)self->ob_itself;
+}
+#define WinObj_tp_init 0
+
+#define WinObj_tp_alloc PyType_GenericAlloc
+
+static PyObject *WinObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
+{
+ PyObject *_self;
+ WindowPtr itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, WinObj_Convert, &itself)) return NULL;
+ if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((WindowObject *)_self)->ob_itself = itself;
+ return _self;
+}
+
+#define WinObj_tp_free PyObject_Del
+
+
+PyTypeObject Window_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_Win.Window", /*tp_name*/
+ sizeof(WindowObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) WinObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) WinObj_compare, /*tp_compare*/
+ (reprfunc) WinObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) WinObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ WinObj_methods, /* tp_methods */
+ 0, /*tp_members*/
+ WinObj_getsetlist, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ WinObj_tp_init, /* tp_init */
+ WinObj_tp_alloc, /* tp_alloc */
+ WinObj_tp_new, /* tp_new */
+ WinObj_tp_free, /* tp_free */
+};
+
+/* --------------------- End object type Window --------------------- */
+
+
+static PyObject *Win_GetNewCWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr _rv;
+ short windowID;
+ WindowPtr behind;
+#ifndef GetNewCWindow
+ PyMac_PRECHECK(GetNewCWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &windowID,
+ WinObj_Convert, &behind))
+ return NULL;
+ _rv = GetNewCWindow(windowID,
+ (void *)0,
+ behind);
+ _res = Py_BuildValue("O&",
+ WinObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Win_NewWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr _rv;
+ Rect boundsRect;
+ Str255 title;
+ Boolean visible;
+ short theProc;
+ WindowPtr behind;
+ Boolean goAwayFlag;
+ long refCon;
+#ifndef NewWindow
+ PyMac_PRECHECK(NewWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&bhO&bl",
+ PyMac_GetRect, &boundsRect,
+ PyMac_GetStr255, title,
+ &visible,
+ &theProc,
+ WinObj_Convert, &behind,
+ &goAwayFlag,
+ &refCon))
+ return NULL;
+ _rv = NewWindow((void *)0,
+ &boundsRect,
+ title,
+ visible,
+ theProc,
+ behind,
+ goAwayFlag,
+ refCon);
+ _res = Py_BuildValue("O&",
+ WinObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Win_GetNewWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr _rv;
+ short windowID;
+ WindowPtr behind;
+#ifndef GetNewWindow
+ PyMac_PRECHECK(GetNewWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &windowID,
+ WinObj_Convert, &behind))
+ return NULL;
+ _rv = GetNewWindow(windowID,
+ (void *)0,
+ behind);
+ _res = Py_BuildValue("O&",
+ WinObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Win_NewCWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr _rv;
+ Rect boundsRect;
+ Str255 title;
+ Boolean visible;
+ short procID;
+ WindowPtr behind;
+ Boolean goAwayFlag;
+ long refCon;
+#ifndef NewCWindow
+ PyMac_PRECHECK(NewCWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&bhO&bl",
+ PyMac_GetRect, &boundsRect,
+ PyMac_GetStr255, title,
+ &visible,
+ &procID,
+ WinObj_Convert, &behind,
+ &goAwayFlag,
+ &refCon))
+ return NULL;
+ _rv = NewCWindow((void *)0,
+ &boundsRect,
+ title,
+ visible,
+ procID,
+ behind,
+ goAwayFlag,
+ refCon);
+ _res = Py_BuildValue("O&",
+ WinObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Win_CreateNewWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowClass windowClass;
+ WindowAttributes attributes;
+ Rect contentBounds;
+ WindowPtr outWindow;
+#ifndef CreateNewWindow
+ PyMac_PRECHECK(CreateNewWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, "llO&",
+ &windowClass,
+ &attributes,
+ PyMac_GetRect, &contentBounds))
+ return NULL;
+ _err = CreateNewWindow(windowClass,
+ attributes,
+ &contentBounds,
+ &outWindow);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ WinObj_New, outWindow);
+ return _res;
+}
+
+static PyObject *Win_CreateWindowFromResource(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ SInt16 resID;
+ WindowPtr outWindow;
+#ifndef CreateWindowFromResource
+ PyMac_PRECHECK(CreateWindowFromResource);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &resID))
+ return NULL;
+ _err = CreateWindowFromResource(resID,
+ &outWindow);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ WinObj_New, outWindow);
+ return _res;
+}
+
+static PyObject *Win_ShowFloatingWindows(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+#ifndef ShowFloatingWindows
+ PyMac_PRECHECK(ShowFloatingWindows);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = ShowFloatingWindows();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Win_HideFloatingWindows(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+#ifndef HideFloatingWindows
+ PyMac_PRECHECK(HideFloatingWindows);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = HideFloatingWindows();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Win_AreFloatingWindowsVisible(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef AreFloatingWindowsVisible
+ PyMac_PRECHECK(AreFloatingWindowsVisible);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = AreFloatingWindowsVisible();
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Win_CheckUpdate(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ EventRecord theEvent;
+#ifndef CheckUpdate
+ PyMac_PRECHECK(CheckUpdate);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CheckUpdate(&theEvent);
+ _res = Py_BuildValue("bO&",
+ _rv,
+ PyMac_BuildEventRecord, &theEvent);
+ return _res;
+}
+
+static PyObject *Win_MacFindWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPartCode _rv;
+ Point thePoint;
+ WindowPtr window;
+#ifndef MacFindWindow
+ PyMac_PRECHECK(MacFindWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &thePoint))
+ return NULL;
+ _rv = MacFindWindow(thePoint,
+ &window);
+ _res = Py_BuildValue("hO&",
+ _rv,
+ WinObj_WhichWindow, window);
+ return _res;
+}
+
+static PyObject *Win_FrontWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr _rv;
+#ifndef FrontWindow
+ PyMac_PRECHECK(FrontWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = FrontWindow();
+ _res = Py_BuildValue("O&",
+ WinObj_WhichWindow, _rv);
+ return _res;
+}
+
+static PyObject *Win_FrontNonFloatingWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr _rv;
+#ifndef FrontNonFloatingWindow
+ PyMac_PRECHECK(FrontNonFloatingWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = FrontNonFloatingWindow();
+ _res = Py_BuildValue("O&",
+ WinObj_WhichWindow, _rv);
+ return _res;
+}
+
+static PyObject *Win_GetFrontWindowOfClass(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr _rv;
+ WindowClass inWindowClass;
+ Boolean mustBeVisible;
+#ifndef GetFrontWindowOfClass
+ PyMac_PRECHECK(GetFrontWindowOfClass);
+#endif
+ if (!PyArg_ParseTuple(_args, "lb",
+ &inWindowClass,
+ &mustBeVisible))
+ return NULL;
+ _rv = GetFrontWindowOfClass(inWindowClass,
+ mustBeVisible);
+ _res = Py_BuildValue("O&",
+ WinObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Win_FindWindowOfClass(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Point where;
+ WindowClass inWindowClass;
+ WindowPtr outWindow;
+ WindowPartCode outWindowPart;
+#ifndef FindWindowOfClass
+ PyMac_PRECHECK(FindWindowOfClass);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetPoint, &where,
+ &inWindowClass))
+ return NULL;
+ _err = FindWindowOfClass(&where,
+ inWindowClass,
+ &outWindow,
+ &outWindowPart);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&h",
+ WinObj_WhichWindow, outWindow,
+ outWindowPart);
+ return _res;
+}
+
+static PyObject *Win_CreateStandardWindowMenu(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ OptionBits inOptions;
+ MenuHandle outMenu;
+#ifndef CreateStandardWindowMenu
+ PyMac_PRECHECK(CreateStandardWindowMenu);
+#endif
+ if (!PyArg_ParseTuple(_args, "l",
+ &inOptions))
+ return NULL;
+ _err = CreateStandardWindowMenu(inOptions,
+ &outMenu);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ MenuObj_New, outMenu);
+ return _res;
+}
+
+static PyObject *Win_CollapseAllWindows(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Boolean collapse;
+#ifndef CollapseAllWindows
+ PyMac_PRECHECK(CollapseAllWindows);
+#endif
+ if (!PyArg_ParseTuple(_args, "b",
+ &collapse))
+ return NULL;
+ _err = CollapseAllWindows(collapse);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Win_GetAvailableWindowPositioningBounds(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ GDHandle inDevice;
+ Rect outAvailableRect;
+#ifndef GetAvailableWindowPositioningBounds
+ PyMac_PRECHECK(GetAvailableWindowPositioningBounds);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &inDevice))
+ return NULL;
+ _err = GetAvailableWindowPositioningBounds(inDevice,
+ &outAvailableRect);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &outAvailableRect);
+ return _res;
+}
+
+static PyObject *Win_DisableScreenUpdates(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+#ifndef DisableScreenUpdates
+ PyMac_PRECHECK(DisableScreenUpdates);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = DisableScreenUpdates();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Win_EnableScreenUpdates(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+#ifndef EnableScreenUpdates
+ PyMac_PRECHECK(EnableScreenUpdates);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = EnableScreenUpdates();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Win_PinRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ Rect theRect;
+ Point thePt;
+#ifndef PinRect
+ PyMac_PRECHECK(PinRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetRect, &theRect,
+ PyMac_GetPoint, &thePt))
+ return NULL;
+ _rv = PinRect(&theRect,
+ thePt);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Win_GetGrayRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle _rv;
+#ifndef GetGrayRgn
+ PyMac_PRECHECK(GetGrayRgn);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetGrayRgn();
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Win_GetWindowFromPort(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr _rv;
+ CGrafPtr port;
+#ifndef GetWindowFromPort
+ PyMac_PRECHECK(GetWindowFromPort);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ GrafObj_Convert, &port))
+ return NULL;
+ _rv = GetWindowFromPort(port);
+ _res = Py_BuildValue("O&",
+ WinObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Win_WhichWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ long ptr;
+
+ if ( !PyArg_ParseTuple(_args, "i", &ptr) )
+ return NULL;
+ _res = WinObj_WhichWindow((WindowPtr)ptr);
+ return _res;
+
+}
+
+static PyObject *Win_FindWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ Point thePoint;
+ WindowPtr theWindow;
+#ifndef FindWindow
+ PyMac_PRECHECK(FindWindow);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &thePoint))
+ return NULL;
+ _rv = FindWindow(thePoint,
+ &theWindow);
+ _res = Py_BuildValue("hO&",
+ _rv,
+ 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,
+ PyDoc_STR("(Rect boundsRect, Str255 title, Boolean visible, short theProc, WindowPtr behind, Boolean goAwayFlag, long refCon) -> (WindowPtr _rv)")},
+ {"GetNewWindow", (PyCFunction)Win_GetNewWindow, 1,
+ PyDoc_STR("(short windowID, WindowPtr behind) -> (WindowPtr _rv)")},
+ {"NewCWindow", (PyCFunction)Win_NewCWindow, 1,
+ PyDoc_STR("(Rect boundsRect, Str255 title, Boolean visible, short procID, WindowPtr behind, Boolean goAwayFlag, long refCon) -> (WindowPtr _rv)")},
+ {"CreateNewWindow", (PyCFunction)Win_CreateNewWindow, 1,
+ PyDoc_STR("(WindowClass windowClass, WindowAttributes attributes, Rect contentBounds) -> (WindowPtr outWindow)")},
+ {"CreateWindowFromResource", (PyCFunction)Win_CreateWindowFromResource, 1,
+ PyDoc_STR("(SInt16 resID) -> (WindowPtr outWindow)")},
+ {"ShowFloatingWindows", (PyCFunction)Win_ShowFloatingWindows, 1,
+ PyDoc_STR("() -> None")},
+ {"HideFloatingWindows", (PyCFunction)Win_HideFloatingWindows, 1,
+ PyDoc_STR("() -> None")},
+ {"AreFloatingWindowsVisible", (PyCFunction)Win_AreFloatingWindowsVisible, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"CheckUpdate", (PyCFunction)Win_CheckUpdate, 1,
+ PyDoc_STR("() -> (Boolean _rv, EventRecord theEvent)")},
+ {"MacFindWindow", (PyCFunction)Win_MacFindWindow, 1,
+ PyDoc_STR("(Point thePoint) -> (WindowPartCode _rv, WindowPtr window)")},
+ {"FrontWindow", (PyCFunction)Win_FrontWindow, 1,
+ PyDoc_STR("() -> (WindowPtr _rv)")},
+ {"FrontNonFloatingWindow", (PyCFunction)Win_FrontNonFloatingWindow, 1,
+ PyDoc_STR("() -> (WindowPtr _rv)")},
+ {"GetFrontWindowOfClass", (PyCFunction)Win_GetFrontWindowOfClass, 1,
+ PyDoc_STR("(WindowClass inWindowClass, Boolean mustBeVisible) -> (WindowPtr _rv)")},
+ {"FindWindowOfClass", (PyCFunction)Win_FindWindowOfClass, 1,
+ PyDoc_STR("(Point where, WindowClass inWindowClass) -> (WindowPtr outWindow, WindowPartCode outWindowPart)")},
+ {"CreateStandardWindowMenu", (PyCFunction)Win_CreateStandardWindowMenu, 1,
+ PyDoc_STR("(OptionBits inOptions) -> (MenuHandle outMenu)")},
+ {"CollapseAllWindows", (PyCFunction)Win_CollapseAllWindows, 1,
+ PyDoc_STR("(Boolean collapse) -> None")},
+ {"GetAvailableWindowPositioningBounds", (PyCFunction)Win_GetAvailableWindowPositioningBounds, 1,
+ PyDoc_STR("(GDHandle inDevice) -> (Rect outAvailableRect)")},
+ {"DisableScreenUpdates", (PyCFunction)Win_DisableScreenUpdates, 1,
+ PyDoc_STR("() -> None")},
+ {"EnableScreenUpdates", (PyCFunction)Win_EnableScreenUpdates, 1,
+ PyDoc_STR("() -> None")},
+ {"PinRect", (PyCFunction)Win_PinRect, 1,
+ PyDoc_STR("(Rect theRect, Point thePt) -> (long _rv)")},
+ {"GetGrayRgn", (PyCFunction)Win_GetGrayRgn, 1,
+ PyDoc_STR("() -> (RgnHandle _rv)")},
+ {"GetWindowFromPort", (PyCFunction)Win_GetWindowFromPort, 1,
+ PyDoc_STR("(CGrafPtr port) -> (WindowPtr _rv)")},
+ {"WhichWindow", (PyCFunction)Win_WhichWindow, 1,
+ PyDoc_STR("Resolve an integer WindowPtr address to a Window object")},
+ {"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 *
+WinObj_WhichWindow(WindowPtr w)
+{
+ PyObject *it;
+
+ if (w == NULL) {
+ it = Py_None;
+ Py_INCREF(it);
+ } else {
+ it = (PyObject *) GetWRefCon(w);
+ if (it == NULL || !IsPointerValid((Ptr)it) || ((WindowObject *)it)->ob_itself != w || !WinObj_Check(it)) {
+ it = WinObj_New(w);
+ ((WindowObject *)it)->ob_freeit = NULL;
+ } else {
+ Py_INCREF(it);
+ }
+ }
+ 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);
+
+#endif /* __LP64__ */
+
+ m = Py_InitModule("_Win", Win_methods);
+#ifndef __LP64__
+ d = PyModule_GetDict(m);
+ Win_Error = PyMac_GetOSErrException();
+ if (Win_Error == NULL ||
+ PyDict_SetItemString(d, "Error", Win_Error) != 0)
+ return;
+ Window_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&Window_Type) < 0) return;
+ Py_INCREF(&Window_Type);
+ PyModule_AddObject(m, "Window", (PyObject *)&Window_Type);
+ /* Backward-compatible name */
+ Py_INCREF(&Window_Type);
+ PyModule_AddObject(m, "WindowType", (PyObject *)&Window_Type);
+#endif /* __LP64__ */
+}
+
+/* ======================== End module _Win ========================= */
+
diff --git a/Mac/Modules/win/winedit.py b/Mac/Modules/win/winedit.py
new file mode 100644
index 0000000000..01cfe86f38
--- /dev/null
+++ b/Mac/Modules/win/winedit.py
@@ -0,0 +1,69 @@
+# These are inline-routines/defines, so we do them "by hand"
+#
+
+f = Method(Boolean, 'IsWindowVisible',
+ (WindowRef, 'theWindow', InMode),
+)
+methods.append(f)
+
+f = Method(void, 'GetWindowStructureRgn',
+ (WindowRef, 'theWindow', InMode),
+ (RgnHandle, 'r', InMode),
+)
+methods.append(f)
+
+f = Method(void, 'GetWindowContentRgn',
+ (WindowRef, 'theWindow', InMode),
+ (RgnHandle, 'r', InMode),
+)
+methods.append(f)
+
+f = Method(void, 'GetWindowUpdateRgn',
+ (WindowRef, 'theWindow', InMode),
+ (RgnHandle, 'r', InMode),
+)
+methods.append(f)
+
+f = Method(ExistingWindowPtr, 'GetNextWindow',
+ (WindowRef, 'theWindow', InMode),
+)
+methods.append(f)
+
+f = Function(short, 'FindWindow',
+ (Point, 'thePoint', InMode),
+ (ExistingWindowPtr, 'theWindow', OutMode),
+)
+functions.append(f)
+
+f = Method(void, 'MoveWindow',
+ (WindowPtr, 'theWindow', InMode),
+ (short, 'hGlobal', InMode),
+ (short, 'vGlobal', InMode),
+ (Boolean, 'front', InMode),
+)
+methods.append(f)
+
+f = Method(void, 'ShowWindow',
+ (WindowPtr, 'theWindow', InMode),
+)
+methods.append(f)
+
+#
+# A method to set the auto-dispose flag
+#
+AutoDispose_body = """
+int onoff, old = 0;
+if (!PyArg_ParseTuple(_args, "i", &onoff))
+ return NULL;
+if ( _self->ob_freeit )
+ old = 1;
+if ( onoff )
+ _self->ob_freeit = PyMac_AutoDisposeWindow;
+else
+ _self->ob_freeit = NULL;
+_res = Py_BuildValue("i", old);
+return _res;
+"""
+f = ManualGenerator("AutoDispose", AutoDispose_body)
+f.docstring = lambda: "(int)->int. Automatically DisposeHandle the object on Python object cleanup"
+methods.append(f)
diff --git a/Mac/Modules/win/winscan.py b/Mac/Modules/win/winscan.py
new file mode 100644
index 0000000000..8a2f726da1
--- /dev/null
+++ b/Mac/Modules/win/winscan.py
@@ -0,0 +1,129 @@
+# Scan an Apple header file, generating a Python file of generator calls.
+import sys
+from bgenlocations import TOOLBOXDIR, BGENDIR
+sys.path.append(BGENDIR)
+
+from scantools import Scanner
+
+def main():
+ input = "MacWindows.h"
+ output = "wingen.py"
+ defsoutput = TOOLBOXDIR + "Windows.py"
+ scanner = MyScanner(input, output, defsoutput)
+ scanner.scan()
+ scanner.close()
+ print "=== Testing definitions output code ==="
+ execfile(defsoutput, {}, {})
+ print "=== Done scanning and generating, now importing the generated code... ==="
+ import winsupport
+ print "=== Done. It's up to you to compile it now! ==="
+
+class MyScanner(Scanner):
+
+ def destination(self, type, name, arglist):
+ classname = "Function"
+ listname = "functions"
+ if arglist:
+ t, n, m = arglist[0]
+ if t in ("WindowPtr", "WindowPeek", "WindowRef") and m == "InMode":
+ classname = "Method"
+ listname = "methods"
+ return classname, listname
+
+ def writeinitialdefs(self):
+ self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
+ self.defsfile.write("false = 0\n")
+ self.defsfile.write("true = 1\n")
+ self.defsfile.write("kWindowNoConstrainAttribute = 0x80000000\n")
+
+ def makeblacklistnames(self):
+ return [
+ 'DisposeWindow', # Implied when the object is deleted
+ 'CloseWindow',
+ 'SetWindowProperty', # For the moment
+ 'GetWindowProperty',
+ 'GetWindowPropertySize',
+ 'RemoveWindowProperty',
+ 'MacCloseWindow',
+ 'GetWindowList', # Don't know whether this is safe...
+ # Constants with funny definitions
+ 'kMouseUpOutOfSlop',
+ 'kAllWindowClasses',
+ 'kWindowNoConstrainAttribute',
+ # OS8 only:
+ 'GetAuxWin',
+ 'GetWindowDataHandle',
+ 'SaveOld',
+ 'DrawNew',
+ 'SetWinColor',
+ 'SetDeskCPat',
+ 'InitWindows',
+ 'InitFloatingWindows',
+ 'GetWMgrPort',
+ 'GetCWMgrPort',
+ 'ValidRgn', # Use versions with Window in their name
+ 'ValidRect',
+ 'InvalRgn',
+ 'InvalRect',
+ 'IsValidWindowPtr', # I think this is useless for Python, but not sure...
+ 'GetWindowZoomFlag', # Not available in Carbon
+ 'GetWindowTitleWidth', # Ditto
+ 'GetWindowGoAwayFlag',
+ 'GetWindowSpareFlag',
+ ]
+
+ def makeblacklisttypes(self):
+ return [
+ 'ProcPtr',
+ 'DragGrayRgnUPP',
+ 'WindowPaintUPP',
+ 'Collection', # For now, to be done later
+ 'WindowDefSpec', # Too difficult for now
+ 'WindowDefSpec_ptr',
+ 'EventRef', #TBD
+ ]
+
+ def makerepairinstructions(self):
+ return [
+
+ # GetWTitle
+ ([("Str255", "*", "InMode")],
+ [("*", "*", "OutMode")]),
+
+ ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
+ [("InBuffer", "*", "*")]),
+
+ ([("void", "*", "OutMode"), ("long", "*", "InMode"),
+ ("long", "*", "OutMode")],
+ [("VarVarOutBuffer", "*", "InOutMode")]),
+
+ ([("void", "wStorage", "OutMode")],
+ [("NullStorage", "*", "InMode")]),
+
+ # match FindWindowOfClass
+ ([("WindowRef", "outWindow", "OutMode"), ("WindowPartCode", "outWindowPart", "OutMode")],
+ [("ExistingWindowPtr", "*", "OutMode"), ("WindowPartCode", "outWindowPart", "OutMode")]),
+ # then match CreateNewWindow and CreateWindowFromResource
+ ([("WindowRef", "outWindow", "OutMode")],
+ [("WindowRef", "*", "*")]),
+
+ ([("WindowPtr", "*", "OutMode")],
+ [("ExistingWindowPtr", "*", "*")]),
+ ([("WindowRef", "*", "OutMode")], # Same, but other style headerfiles
+ [("ExistingWindowPtr", "*", "*")]),
+
+ ([("WindowPtr", "FrontWindow", "ReturnMode")],
+ [("ExistingWindowPtr", "*", "*")]),
+ ([("WindowRef", "FrontWindow", "ReturnMode")], # Ditto
+ [("ExistingWindowPtr", "*", "*")]),
+ ([("WindowPtr", "FrontNonFloatingWindow", "ReturnMode")],
+ [("ExistingWindowPtr", "*", "*")]),
+ ([("WindowRef", "FrontNonFloatingWindow", "ReturnMode")], # Ditto
+ [("ExistingWindowPtr", "*", "*")]),
+
+ ([("Rect_ptr", "*", "ReturnMode")], # GetWindowXXXState accessors
+ [("void", "*", "ReturnMode")]),
+ ]
+
+if __name__ == "__main__":
+ main()
diff --git a/Mac/Modules/win/winsupport.py b/Mac/Modules/win/winsupport.py
new file mode 100644
index 0000000000..08a0379c53
--- /dev/null
+++ b/Mac/Modules/win/winsupport.py
@@ -0,0 +1,226 @@
+# This script generates a Python interface for an Apple Macintosh Manager.
+# It uses the "bgen" package to generate C code.
+# The function specifications are generated by scanning the mamager's header file,
+# using the "scantools" package (customized for this particular manager).
+
+import string
+
+# Declarations that change for each manager
+MACHEADERFILE = 'Windows.h' # The Apple header file
+MODNAME = '_Win' # The name of the module
+OBJECTNAME = 'Window' # The basic name of the objects used here
+
+# The following is *usually* unchanged but may still require tuning
+MODPREFIX = 'Win' # The prefix for module-wide routines
+OBJECTTYPE = OBJECTNAME + 'Ptr' # The C type used to represent them
+OBJECTPREFIX = MODPREFIX + 'Obj' # The prefix for object methods
+INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner
+EDITFILE = string.lower(MODPREFIX) + 'edit.py' # The manual definitions
+OUTPUTFILE = MODNAME + "module.c" # The file generated by this program
+
+from macsupport import *
+
+# Create the type objects
+
+WindowPtr = OpaqueByValueType(OBJECTTYPE, OBJECTPREFIX)
+WindowRef = WindowPtr
+WindowPeek = OpaqueByValueType("WindowPeek", OBJECTPREFIX)
+WindowPeek.passInput = lambda name: "(WindowPeek)(%s)" % name
+CGrafPtr = OpaqueByValueType("CGrafPtr", "GrafObj")
+GrafPtr = OpaqueByValueType("GrafPtr", "GrafObj")
+
+DragReference = OpaqueByValueType("DragReference", "DragObj")
+
+RgnHandle = OpaqueByValueType("RgnHandle", "ResObj")
+PicHandle = OpaqueByValueType("PicHandle", "ResObj")
+WCTabHandle = OpaqueByValueType("WCTabHandle", "ResObj")
+AuxWinHandle = OpaqueByValueType("AuxWinHandle", "ResObj")
+PixPatHandle = OpaqueByValueType("PixPatHandle", "ResObj")
+AliasHandle = OpaqueByValueType("AliasHandle", "ResObj")
+IconRef = OpaqueByValueType("IconRef", "ResObj")
+
+WindowRegionCode = Type("WindowRegionCode", "H")
+WindowClass = Type("WindowClass", "l")
+WindowAttributes = Type("WindowAttributes", "l")
+WindowPositionMethod = Type("WindowPositionMethod", "l")
+WindowTransitionEffect = Type("WindowTransitionEffect", "l")
+WindowTransitionAction = Type("WindowTransitionAction", "l")
+RGBColor = OpaqueType("RGBColor", "QdRGB")
+RGBColor_ptr = RGBColor
+ScrollWindowOptions = Type("ScrollWindowOptions", "l")
+WindowPartCode = Type("WindowPartCode", "h")
+WindowDefPartCode = Type("WindowDefPartCode", "h")
+WindowModality = Type("WindowModality", "l")
+GDHandle = OpaqueByValueType("GDHandle", "ResObj")
+WindowConstrainOptions = Type("WindowConstrainOptions", "l")
+
+PropertyCreator = OSTypeType("PropertyCreator")
+PropertyTag = OSTypeType("PropertyTag")
+
+includestuff = includestuff + """
+#include <Carbon/Carbon.h>
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_WinObj_New(WindowRef);
+extern PyObject *_WinObj_WhichWindow(WindowRef);
+extern int _WinObj_Convert(PyObject *, WindowRef *);
+
+#define WinObj_New _WinObj_New
+#define WinObj_WhichWindow _WinObj_WhichWindow
+#define WinObj_Convert _WinObj_Convert
+#endif
+
+/* Classic calls that we emulate in carbon mode */
+#define GetWindowUpdateRgn(win, rgn) GetWindowRegion((win), kWindowUpdateRgn, (rgn))
+#define GetWindowStructureRgn(win, rgn) GetWindowRegion((win), kWindowStructureRgn, (rgn))
+#define GetWindowContentRgn(win, rgn) GetWindowRegion((win), kWindowContentRgn, (rgn))
+
+/* Function to dispose a window, with a "normal" calling sequence */
+static void
+PyMac_AutoDisposeWindow(WindowPtr w)
+{
+ DisposeWindow(w);
+}
+"""
+
+finalstuff = finalstuff + """
+/* Return the object corresponding to the window, or NULL */
+
+PyObject *
+WinObj_WhichWindow(WindowPtr w)
+{
+ PyObject *it;
+
+ if (w == NULL) {
+ it = Py_None;
+ Py_INCREF(it);
+ } else {
+ it = (PyObject *) GetWRefCon(w);
+ if (it == NULL || !IsPointerValid((Ptr)it) || ((WindowObject *)it)->ob_itself != w || !WinObj_Check(it)) {
+ it = WinObj_New(w);
+ ((WindowObject *)it)->ob_freeit = NULL;
+ } else {
+ Py_INCREF(it);
+ }
+ }
+ return it;
+}
+"""
+
+initstuff = initstuff + """
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(WindowPtr, WinObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(WindowPtr, WinObj_WhichWindow);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(WindowPtr, WinObj_Convert);
+"""
+
+class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
+ def outputCheckNewArg(self):
+ Output("if (itself == NULL) return PyMac_Error(resNotFound);")
+ Output("/* XXXX Or should we use WhichWindow code here? */")
+ def outputStructMembers(self):
+ GlobalObjectDefinition.outputStructMembers(self)
+ Output("void (*ob_freeit)(%s ptr);", self.itselftype)
+ def outputInitStructMembers(self):
+ GlobalObjectDefinition.outputInitStructMembers(self)
+ Output("it->ob_freeit = NULL;")
+ Output("if (GetWRefCon(itself) == 0)")
+ OutLbrace()
+ Output("SetWRefCon(itself, (long)it);")
+ Output("it->ob_freeit = PyMac_AutoDisposeWindow;")
+ OutRbrace()
+ def outputCheckConvertArg(self):
+ Out("""
+ if (v == Py_None) { *p_itself = NULL; return 1; }
+ if (PyInt_Check(v)) { *p_itself = (WindowPtr)PyInt_AsLong(v); return 1; }
+ """)
+ OutLbrace()
+ Output("DialogRef dlg;")
+ OutLbrace("if (DlgObj_Convert(v, &dlg) && dlg)")
+ Output("*p_itself = GetDialogWindow(dlg);")
+ Output("return 1;")
+ OutRbrace()
+ Output("PyErr_Clear();")
+ OutRbrace()
+ def outputCleanupStructMembers(self):
+ Output("if (self->ob_freeit && self->ob_itself)")
+ OutLbrace()
+ Output("SetWRefCon(self->ob_itself, 0);")
+ Output("self->ob_freeit(self->ob_itself);")
+ OutRbrace()
+ Output("self->ob_itself = NULL;")
+ Output("self->ob_freeit = NULL;")
+
+ def outputCompare(self):
+ Output()
+ Output("static int %s_compare(%s *self, %s *other)", self.prefix, self.objecttype, self.objecttype)
+ OutLbrace()
+ Output("if ( self->ob_itself > other->ob_itself ) return 1;")
+ Output("if ( self->ob_itself < other->ob_itself ) return -1;")
+ Output("return 0;")
+ OutRbrace()
+
+ def outputHash(self):
+ Output()
+ Output("static int %s_hash(%s *self)", self.prefix, self.objecttype)
+ OutLbrace()
+ Output("return (int)self->ob_itself;")
+ OutRbrace()
+
+ def outputRepr(self):
+ Output()
+ Output("static PyObject * %s_repr(%s *self)", self.prefix, self.objecttype)
+ OutLbrace()
+ Output("char buf[100];")
+ Output("""sprintf(buf, "<Window object at 0x%%8.8x for 0x%%8.8x>", (unsigned)self, (unsigned)self->ob_itself);""")
+ Output("return PyString_FromString(buf);")
+ OutRbrace()
+
+## def outputFreeIt(self, itselfname):
+## Output("DisposeWindow(%s);", itselfname)
+# From here on it's basically all boiler plate...
+
+# Create the generator groups and link them
+module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff)
+object = MyObjectDefinition(OBJECTNAME, OBJECTPREFIX, OBJECTTYPE)
+module.addobject(object)
+
+# Create the generator classes used to populate the lists
+Function = OSErrWeakLinkFunctionGenerator
+Method = OSErrWeakLinkMethodGenerator
+
+# Create and populate the lists
+functions = []
+methods = []
+execfile(INPUTFILE)
+
+# Add manual routines for converting integer WindowPtr's (as returned by
+# various event routines) and Dialog objects to a WindowObject.
+whichwin_body = """
+long ptr;
+
+if ( !PyArg_ParseTuple(_args, "i", &ptr) )
+ return NULL;
+_res = WinObj_WhichWindow((WindowPtr)ptr);
+return _res;
+"""
+
+f = ManualGenerator("WhichWindow", whichwin_body)
+f.docstring = lambda : "Resolve an integer WindowPtr address to a Window object"
+
+functions.append(f)
+
+# And add the routines that access the internal bits of a window struct. They
+# are currently #defined in Windows.h, they will be real routines in Copland
+# (at which time this execfile can go)
+execfile(EDITFILE)
+
+# add the populated lists to the generator groups
+# (in a different wordl the scan program would generate this)
+for f in functions: module.add(f)
+for f in methods: object.add(f)
+
+
+
+# generate output (open the output file as late as possible)
+SetOutputFileName(OUTPUTFILE)
+module.generate()
diff --git a/Mac/PythonLauncher/Info.plist.in b/Mac/PythonLauncher/Info.plist.in
index 439f8b8c2b..913a2e0c7b 100644
--- a/Mac/PythonLauncher/Info.plist.in
+++ b/Mac/PythonLauncher/Info.plist.in
@@ -40,7 +40,7 @@
<key>CFBundleExecutable</key>
<string>PythonLauncher</string>
<key>CFBundleGetInfoString</key>
- <string>%VERSION%, © 2001-2011 Python Software Foundation</string>
+ <string>%VERSION%, © 2001-2012 Python Software Foundation</string>
<key>CFBundleIconFile</key>
<string>PythonLauncher.icns</string>
<key>CFBundleIdentifier</key>
diff --git a/Mac/PythonLauncher/Makefile.in b/Mac/PythonLauncher/Makefile.in
index 970b83f314..a6962f6eee 100644
--- a/Mac/PythonLauncher/Makefile.in
+++ b/Mac/PythonLauncher/Makefile.in
@@ -19,18 +19,19 @@ PYTHONFRAMEWORK=@PYTHONFRAMEWORK@
MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
@EXPORT_MACOSX_DEPLOYMENT_TARGET@export MACOSX_DEPLOYMENT_TARGET
-BUNDLEBULDER=$(srcdir)/../Tools/bundlebuilder.py
+BUNDLEBULDER=$(srcdir)/../../Lib/plat-mac/bundlebuilder.py
PYTHONAPPSDIR=@FRAMEWORKINSTALLAPPSPREFIX@/$(PYTHONFRAMEWORK) $(VERSION)
OBJECTS=FileSettings.o MyAppDelegate.o MyDocument.o PreferencesWindowController.o doscript.o main.o
+all: Python\ Launcher.app
+
install: Python\ Launcher.app
test -d "$(DESTDIR)$(PYTHONAPPSDIR)" || mkdir -p "$(DESTDIR)$(PYTHONAPPSDIR)"
-test -d "$(DESTDIR)$(PYTHONAPPSDIR)/Python Launcher.app" && rm -r "$(DESTDIR)$(PYTHONAPPSDIR)/Python Launcher.app"
/bin/cp -r "Python Launcher.app" "$(DESTDIR)$(PYTHONAPPSDIR)"
touch "$(DESTDIR)$(PYTHONAPPSDIR)/Python Launcher.app"
-
clean:
rm -f *.o "Python Launcher"
rm -rf "Python Launcher.app"
@@ -78,4 +79,4 @@ Python\ Launcher: $(OBJECTS)
$(CC) $(LDFLAGS) -o "Python Launcher" $(OBJECTS) -framework AppKit -framework Carbon
Info.plist: $(srcdir)/Info.plist.in
- sed 's/%VERSION%/'"`$(RUNSHARED) $(BUILDPYTHON) -c 'import platform; print(platform.python_version())'`"'/g' < $(srcdir)/Info.plist.in > Info.plist
+ sed 's/%VERSION%/'"`$(RUNSHARED) $(BUILDPYTHON) -c 'import platform; print platform.python_version()'`"'/g' < $(srcdir)/Info.plist.in > Info.plist
diff --git a/Mac/README b/Mac/README
index 0261127076..6c0eb6f310 100644
--- a/Mac/README
+++ b/Mac/README
@@ -5,6 +5,9 @@ MacOSX Notes
This document provides a quick overview of some Mac OS X specific features in
the Python distribution.
+Mac-specific arguments to configure
+===================================
+
* ``--enable-framework[=DIR]``
If this argument is specified the build will create a Python.framework rather
@@ -45,6 +48,7 @@ the Python distribution.
Specify the kind of universal binary that should be created. This option is
only valid when ``--enable-universalsdk`` is specified.
+
Building and using a universal binary of Python on Mac OS X
===========================================================
@@ -66,11 +70,17 @@ flag to configure::
$ make
$ make install
-This flag can be used a framework build of python, but also with a classic
+This flag can be used with a framework build of python, but also with a classic
unix build. Either way you will have to build python on Mac OS X 10.4 (or later)
with Xcode 2.1 (or later). You also have to install the 10.4u SDK when
installing Xcode.
+The option ``--enable-universalsdk`` has an optional argument to specify an
+SDK, which defaults to the 10.4u SDK. When you build on OSX 10.5 or later
+you can use the system headers instead of an SDK::
+
+ $ ./configure --enable-universalsdk=/
+
2.1 Flavours of universal binaries
..................................
@@ -129,8 +139,7 @@ will have to do the work yourself if you really want this.
A second reason for using frameworks is that they put Python-related items in
only two places: "/Library/Framework/Python.framework" and
-"/Applications/MacPython <VERSION>" where ``<VERSION>`` can be e.g. "2.6",
-"3.1", etc.. This simplifies matters for users installing
+"/Applications/MacPython 2.6". This simplifies matters for users installing
Python from a binary distribution if they want to get rid of it again. Moreover,
due to the way frameworks work a user without admin privileges can install a
binary distribution in his or her home directory without recompilation.
@@ -157,40 +166,33 @@ PyObjC.
This directory contains a Makefile that will create a couple of python-related
applications (fullblown OSX .app applications, that is) in
-"/Applications/MacPython <VERSION>", and a hidden helper application Python.app
+"/Applications/MacPython 2.6", and a hidden helper application Python.app
inside the Python.framework, and unix tools "python" and "pythonw" into
/usr/local/bin. In addition it has a target "installmacsubtree" that installs
the relevant portions of the Mac subtree into the Python.framework.
It is normally invoked indirectly through the main Makefile, as the last step
-in the sequence
-
- 1. ./configure --enable-framework
+in the sequence::
- 2. make
-
- 3. make install
+ $ ./configure --enable-framework
+ $ make
+ $ make install
This sequence will put the framework in /Library/Framework/Python.framework,
-the applications in "/Applications/MacPython <VERSION>" and the unix tools in
+the applications in "/Applications/MacPython 2.6" and the unix tools in
/usr/local/bin.
+It is possible to select a different name for the framework using the configure
+option ``--with-framework-name=NAME``. This makes it possible to have several
+parallel installs of a Python framework.
+
Installing in another place, for instance $HOME/Library/Frameworks if you have
no admin privileges on your machine, has only been tested very lightly. This
can be done by configuring with --enable-framework=$HOME/Library/Frameworks.
-The other two directories, "/Applications/MacPython-<VERSION>" and
-/usr/local/bin, will then also be deposited in $HOME. This is sub-optimal for
-the unix tools, which you would want in $HOME/bin, but there is no easy way to
-fix this right now.
-
-If you want to install some part, but not all, read the main Makefile. The
-frameworkinstall is composed of a couple of sub-targets that install the
-framework itself, the Mac subtree, the applications and the unix tools.
-
-There is an extra target frameworkinstallextras that is not part of the
-normal frameworkinstall which installs the Tools directory into
-"/Applications/MacPython <VERSION>", this is useful for binary
-distributions.
+The other two directories, "/Applications/MacPython-2.6" and /usr/local/bin,
+will then also be deposited in $HOME. This is sub-optimal for the unix tools,
+which you would want in $HOME/bin, but there is no easy way to fix this right
+now.
What do all these programs do?
===============================
@@ -206,6 +208,11 @@ GUI-things. Keep the "alt" key depressed while dragging or double-clicking a
script to set runtime options. These options can be set once and for all
through PythonLauncher's preferences dialog.
+"BuildApplet.app" creates an applet from a Python script. Drop the script on it
+and out comes a full-featured MacOS application. There is much more to this,
+to be supplied later. Some useful (but outdated) info can be found in
+Mac/Demo.
+
The commandline scripts /usr/local/bin/python and pythonw can be used to run
non-GUI and GUI python scripts from the command line, respectively.
@@ -214,8 +221,8 @@ How do I create a binary distribution?
Go to the directory "Mac/OSX/BuildScript". There you'll find a script
"build-installer.py" that does all the work. This will download and build
-a number of 3th-party libaries, configures and builds a framework Python,
-installs it, creates the installer pacakge files and then packs this in a
+a number of 3rd-party libaries, configures and builds a framework Python,
+installs it, creates the installer package files and then packs this in a
DMG image.
The script will build a universal binary, you'll therefore have to run this
@@ -237,7 +244,7 @@ The configure script sometimes emits warnings like the one below::
configure: WARNING: libintl.h: check for missing prerequisite headers?
configure: WARNING: libintl.h: see the Autoconf documentation
configure: WARNING: libintl.h: section "Present But Cannot Be Compiled"
- configure: WARNING: libintl.h: proceeding with the preprocessor's result
+ configure: WARNING: libintl.h: proceeding with the preprocessor's result
configure: WARNING: libintl.h: in the future, the compiler will take precedence
configure: WARNING: ## -------------------------------------- ##
configure: WARNING: ## Report this to http://bugs.python.org/ ##
@@ -251,8 +258,8 @@ architectures. Temporarily move ``/usr/local`` aside to finish the build.
Uninstalling a framework install, including the binary installer
================================================================
-Uninstalling a framework can be done by manually removing all bits that got installed,
-that's true for both installations from source and installations using the binary installer.
+Uninstalling a framework can be done by manually removing all bits that got installed.
+That's true for both installations from source and installations using the binary installer.
Sadly enough OSX does not have a central uninstaller.
The main bit of a framework install is the framework itself, installed in
diff --git a/Mac/Resources/app/Info.plist.in b/Mac/Resources/app/Info.plist.in
index b586ba026c..1bbca4f4a4 100644
--- a/Mac/Resources/app/Info.plist.in
+++ b/Mac/Resources/app/Info.plist.in
@@ -20,7 +20,7 @@
<key>CFBundleExecutable</key>
<string>Python</string>
<key>CFBundleGetInfoString</key>
- <string>%version%, (c) 2004-2011 Python Software Foundation.</string>
+ <string>%version%, (c) 2004-2012 Python Software Foundation.</string>
<key>CFBundleHelpBookFolder</key>
<array>
<string>Documentation</string>
@@ -37,7 +37,7 @@
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLongVersionString</key>
- <string>%version%, (c) 2004-2011 Python Software Foundation.</string>
+ <string>%version%, (c) 2004-2012 Python Software Foundation.</string>
<key>CFBundleName</key>
<string>Python</string>
<key>CFBundlePackageType</key>
@@ -55,6 +55,6 @@
<key>NSAppleScriptEnabled</key>
<true/>
<key>NSHumanReadableCopyright</key>
- <string>(c) 2011 Python Software Foundation.</string>
+ <string>(c) 2012 Python Software Foundation.</string>
</dict>
</plist>
diff --git a/Mac/Resources/framework/Info.plist.in b/Mac/Resources/framework/Info.plist.in
index b5b19d4ce5..bab46fa7c0 100644
--- a/Mac/Resources/framework/Info.plist.in
+++ b/Mac/Resources/framework/Info.plist.in
@@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
- <string>%VERSION%, (c) 2004-2011 Python Software Foundation.</string>
+ <string>%VERSION%, (c) 2004-2012 Python Software Foundation.</string>
<key>CFBundleLongVersionString</key>
- <string>%VERSION%, (c) 2004-2011 Python Software Foundation.</string>
+ <string>%VERSION%, (c) 2004-2012 Python Software Foundation.</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
diff --git a/Mac/Resources/iconsrc/IDE.psd b/Mac/Resources/iconsrc/IDE.psd
deleted file mode 100644
index b9637b993f..0000000000
--- a/Mac/Resources/iconsrc/IDE.psd
+++ /dev/null
Binary files differ
diff --git a/Mac/Resources/iconsrc/PackageManager.psd b/Mac/Resources/iconsrc/PackageManager.psd
deleted file mode 100644
index 42f41b125f..0000000000
--- a/Mac/Resources/iconsrc/PackageManager.psd
+++ /dev/null
Binary files differ
diff --git a/Mac/Resources/iconsrc/PythonApplet.psd b/Mac/Resources/iconsrc/PythonApplet.psd
deleted file mode 100644
index 7458b52c57..0000000000
--- a/Mac/Resources/iconsrc/PythonApplet.psd
+++ /dev/null
Binary files differ
diff --git a/Mac/Resources/iconsrc/PythonCompiled.psd b/Mac/Resources/iconsrc/PythonCompiled.psd
deleted file mode 100755
index 61fc4d18ae..0000000000
--- a/Mac/Resources/iconsrc/PythonCompiled.psd
+++ /dev/null
Binary files differ
diff --git a/Mac/Resources/iconsrc/PythonIcon.psd b/Mac/Resources/iconsrc/PythonIcon.psd
deleted file mode 100755
index d818dc6a14..0000000000
--- a/Mac/Resources/iconsrc/PythonIcon.psd
+++ /dev/null
Binary files differ
diff --git a/Mac/Resources/iconsrc/PythonSource.psd b/Mac/Resources/iconsrc/PythonSource.psd
deleted file mode 100755
index eba8f28d37..0000000000
--- a/Mac/Resources/iconsrc/PythonSource.psd
+++ /dev/null
Binary files differ
diff --git a/Mac/Resources/iconsrc/PythonWSource.psd b/Mac/Resources/iconsrc/PythonWSource.psd
deleted file mode 100644
index 2b84d94851..0000000000
--- a/Mac/Resources/iconsrc/PythonWSource.psd
+++ /dev/null
Binary files differ
diff --git a/Mac/Tools/Doc/HelpIndexingTool/Help_Indexing_Tool_Suite.py b/Mac/Tools/Doc/HelpIndexingTool/Help_Indexing_Tool_Suite.py
deleted file mode 100644
index 9b3ace4631..0000000000
--- a/Mac/Tools/Doc/HelpIndexingTool/Help_Indexing_Tool_Suite.py
+++ /dev/null
@@ -1,110 +0,0 @@
-"""Suite Help Indexing Tool Suite: Special events that just the Help Indexing Tool supports.
-Level 0, version 0
-
-Generated from /Developer/Applications/Apple Help Indexing Tool.app
-AETE/AEUT resource version 1/1, language 0, script 0
-"""
-
-import aetools
-import MacOS
-
-_code = 'HIT '
-
-class Help_Indexing_Tool_Suite_Events:
-
- def turn_anchor_indexing(self, _object, _attributes={}, **_arguments):
- """turn anchor indexing: Turns anchor indexing on or off.
- Required argument: \xd2on\xd3 or \xd2off\xd3, to turn anchor indexing on or off
- Keyword argument _attributes: AppleEvent attribute dictionary
- """
- _code = 'HIT '
- _subcode = 'tAnc'
-
- if _arguments: raise TypeError('No optional args expected')
- _arguments['----'] = _object
-
-
- _reply, _arguments, _attributes = self.send(_code, _subcode,
- _arguments, _attributes)
- if _arguments.get('errn', 0):
- raise aetools.Error(aetools.decodeerror(_arguments))
- # XXXX Optionally decode result
- if _arguments.has_key('----'):
- return _arguments['----']
-
- _argmap_turn_remote_root = {
- 'with_root_url' : 'rURL',
- }
-
- def turn_remote_root(self, _object, _attributes={}, **_arguments):
- """turn remote root: Turn usage of remote root for content on the web on or off. If turning \xd2on\xd3, supply a string as second parameter.
- Required argument: \xd2on\xd3 or \xd2off\xd3, to turn remote root on or off
- Keyword argument with_root_url: The remote root to use, in the form of \xd2http://www.apple.com/help/\xd3.
- Keyword argument _attributes: AppleEvent attribute dictionary
- """
- _code = 'HIT '
- _subcode = 'tRem'
-
- aetools.keysubst(_arguments, self._argmap_turn_remote_root)
- _arguments['----'] = _object
-
-
- _reply, _arguments, _attributes = self.send(_code, _subcode,
- _arguments, _attributes)
- if _arguments.get('errn', 0):
- raise aetools.Error(aetools.decodeerror(_arguments))
- # XXXX Optionally decode result
- if _arguments.has_key('----'):
- return _arguments['----']
-
- def use_tokenizer(self, _object, _attributes={}, **_arguments):
- """use tokenizer: Tells the indexing tool which tokenizer to use.
- Required argument: Specify \xd2English\xd3, \xd2European\xd3, \xd2Japanese\xd3, \xd2Korean\xd3, or \xd2Simple\xd3.
- Keyword argument _attributes: AppleEvent attribute dictionary
- """
- _code = 'HIT '
- _subcode = 'uTok'
-
- if _arguments: raise TypeError('No optional args expected')
- _arguments['----'] = _object
-
-
- _reply, _arguments, _attributes = self.send(_code, _subcode,
- _arguments, _attributes)
- if _arguments.get('errn', 0):
- raise aetools.Error(aetools.decodeerror(_arguments))
- # XXXX Optionally decode result
- if _arguments.has_key('----'):
- return _arguments['----']
-
-
-class application(aetools.ComponentItem):
- """application - Application class """
- want = 'capp'
-class _Prop_idleStatus(aetools.NProperty):
- """idleStatus - """
- which = 'sIdl'
- want = 'bool'
-application._superclassnames = []
-application._privpropdict = {
- 'idleStatus' : _Prop_idleStatus,
-}
-application._privelemdict = {
-}
-
-#
-# Indices of types declared in this module
-#
-_classdeclarations = {
- 'capp' : application,
-}
-
-_propdeclarations = {
- 'sIdl' : _Prop_idleStatus,
-}
-
-_compdeclarations = {
-}
-
-_enumdeclarations = {
-}
diff --git a/Mac/Tools/Doc/HelpIndexingTool/Miscellaneous_Standards.py b/Mac/Tools/Doc/HelpIndexingTool/Miscellaneous_Standards.py
deleted file mode 100644
index 616ae70b4a..0000000000
--- a/Mac/Tools/Doc/HelpIndexingTool/Miscellaneous_Standards.py
+++ /dev/null
@@ -1,49 +0,0 @@
-"""Suite Miscellaneous Standards: Useful events that aren\xd5t in any other suite
-Level 0, version 0
-
-Generated from /Developer/Applications/Apple Help Indexing Tool.app
-AETE/AEUT resource version 1/1, language 0, script 0
-"""
-
-import aetools
-import MacOS
-
-_code = 'misc'
-
-class Miscellaneous_Standards_Events:
-
- def revert(self, _object, _attributes={}, **_arguments):
- """revert: Revert an object to the most recently saved version
- Required argument: object to revert
- Keyword argument _attributes: AppleEvent attribute dictionary
- """
- _code = 'misc'
- _subcode = 'rvrt'
-
- if _arguments: raise TypeError('No optional args expected')
- _arguments['----'] = _object
-
-
- _reply, _arguments, _attributes = self.send(_code, _subcode,
- _arguments, _attributes)
- if _arguments.get('errn', 0):
- raise aetools.Error(aetools.decodeerror(_arguments))
- # XXXX Optionally decode result
- if _arguments.has_key('----'):
- return _arguments['----']
-
-
-#
-# Indices of types declared in this module
-#
-_classdeclarations = {
-}
-
-_propdeclarations = {
-}
-
-_compdeclarations = {
-}
-
-_enumdeclarations = {
-}
diff --git a/Mac/Tools/Doc/HelpIndexingTool/Required_Suite.py b/Mac/Tools/Doc/HelpIndexingTool/Required_Suite.py
deleted file mode 100644
index eb9fee0017..0000000000
--- a/Mac/Tools/Doc/HelpIndexingTool/Required_Suite.py
+++ /dev/null
@@ -1,32 +0,0 @@
-"""Suite Required Suite: Terms that every application should support
-Level 1, version 1
-
-Generated from /Developer/Applications/Apple Help Indexing Tool.app
-AETE/AEUT resource version 1/1, language 0, script 0
-"""
-
-import aetools
-import MacOS
-
-_code = 'reqd'
-
-from StdSuites.Required_Suite import *
-class Required_Suite_Events(Required_Suite_Events):
-
- pass
-
-
-#
-# Indices of types declared in this module
-#
-_classdeclarations = {
-}
-
-_propdeclarations = {
-}
-
-_compdeclarations = {
-}
-
-_enumdeclarations = {
-}
diff --git a/Mac/Tools/Doc/HelpIndexingTool/Standard_Suite.py b/Mac/Tools/Doc/HelpIndexingTool/Standard_Suite.py
deleted file mode 100644
index 7f0b63a3bb..0000000000
--- a/Mac/Tools/Doc/HelpIndexingTool/Standard_Suite.py
+++ /dev/null
@@ -1,343 +0,0 @@
-"""Suite Standard Suite: Common terms for most applications
-Level 1, version 1
-
-Generated from /Developer/Applications/Apple Help Indexing Tool.app
-AETE/AEUT resource version 1/1, language 0, script 0
-"""
-
-import aetools
-import MacOS
-
-_code = 'CoRe'
-
-from StdSuites.Standard_Suite import *
-class Standard_Suite_Events(Standard_Suite_Events):
-
- _argmap_close = {
- 'saving' : 'savo',
- 'in_' : 'kfil',
- }
-
- def close(self, _object, _attributes={}, **_arguments):
- """close: Close an object
- Required argument: the objects to close
- Keyword argument saving: specifies whether or not changes should be saved before closing
- Keyword argument in_: the file in which to save the object
- Keyword argument _attributes: AppleEvent attribute dictionary
- """
- _code = 'core'
- _subcode = 'clos'
-
- aetools.keysubst(_arguments, self._argmap_close)
- _arguments['----'] = _object
-
- aetools.enumsubst(_arguments, 'savo', _Enum_savo)
-
- _reply, _arguments, _attributes = self.send(_code, _subcode,
- _arguments, _attributes)
- if _arguments.get('errn', 0):
- raise aetools.Error(aetools.decodeerror(_arguments))
- # XXXX Optionally decode result
- if _arguments.has_key('----'):
- return _arguments['----']
-
- def data_size(self, _object, _attributes={}, **_arguments):
- """data size: Return the size in bytes of an object
- Required argument: the object whose data size is to be returned
- Keyword argument _attributes: AppleEvent attribute dictionary
- Returns: the size of the object in bytes
- """
- _code = 'core'
- _subcode = 'dsiz'
-
- if _arguments: raise TypeError('No optional args expected')
- _arguments['----'] = _object
-
-
- _reply, _arguments, _attributes = self.send(_code, _subcode,
- _arguments, _attributes)
- if _arguments.get('errn', 0):
- raise aetools.Error(aetools.decodeerror(_arguments))
- # XXXX Optionally decode result
- if _arguments.has_key('----'):
- return _arguments['----']
-
- def get(self, _object, _attributes={}, **_arguments):
- """get: Get the data for an object
- Required argument: the object whose data is to be returned
- Keyword argument _attributes: AppleEvent attribute dictionary
- Returns: The data from the object
- """
- _code = 'core'
- _subcode = 'getd'
-
- if _arguments: raise TypeError('No optional args expected')
- _arguments['----'] = _object
-
-
- _reply, _arguments, _attributes = self.send(_code, _subcode,
- _arguments, _attributes)
- if _arguments.get('errn', 0):
- raise aetools.Error(aetools.decodeerror(_arguments))
- # XXXX Optionally decode result
- if _arguments.has_key('----'):
- return _arguments['----']
-
- _argmap_make = {
- 'new' : 'kocl',
- 'at' : 'insh',
- 'with_data' : 'data',
- 'with_properties' : 'prdt',
- }
-
- def make(self, _no_object=None, _attributes={}, **_arguments):
- """make: Make a new element
- Keyword argument new: the class of the new element
- Keyword argument at: the location at which to insert the element
- Keyword argument with_data: the initial data for the element
- Keyword argument with_properties: the initial values for the properties of the element
- Keyword argument _attributes: AppleEvent attribute dictionary
- Returns: Object specifier for the new element
- """
- _code = 'core'
- _subcode = 'crel'
-
- aetools.keysubst(_arguments, self._argmap_make)
- if _no_object is not None: raise TypeError('No direct arg expected')
-
-
- _reply, _arguments, _attributes = self.send(_code, _subcode,
- _arguments, _attributes)
- if _arguments.get('errn', 0):
- raise aetools.Error(aetools.decodeerror(_arguments))
- # XXXX Optionally decode result
- if _arguments.has_key('----'):
- return _arguments['----']
-
- def open(self, _object, _attributes={}, **_arguments):
- """open: Open the specified object(s)
- Required argument: Objects to open. Can be a list of files or an object specifier.
- Keyword argument _attributes: AppleEvent attribute dictionary
- """
- _code = 'aevt'
- _subcode = 'odoc'
-
- if _arguments: raise TypeError('No optional args expected')
- _arguments['----'] = _object
-
-
- _reply, _arguments, _attributes = self.send(_code, _subcode,
- _arguments, _attributes)
- if _arguments.get('errn', 0):
- raise aetools.Error(aetools.decodeerror(_arguments))
- # XXXX Optionally decode result
- if _arguments.has_key('----'):
- return _arguments['----']
-
- def print_(self, _object, _attributes={}, **_arguments):
- """print: Print the specified object(s)
- Required argument: Objects to print. Can be a list of files or an object specifier.
- Keyword argument _attributes: AppleEvent attribute dictionary
- """
- _code = 'aevt'
- _subcode = 'pdoc'
-
- if _arguments: raise TypeError('No optional args expected')
- _arguments['----'] = _object
-
-
- _reply, _arguments, _attributes = self.send(_code, _subcode,
- _arguments, _attributes)
- if _arguments.get('errn', 0):
- raise aetools.Error(aetools.decodeerror(_arguments))
- # XXXX Optionally decode result
- if _arguments.has_key('----'):
- return _arguments['----']
-
- _argmap_save = {
- 'in_' : 'kfil',
- 'as' : 'fltp',
- }
-
- def save(self, _object, _attributes={}, **_arguments):
- """save: save a set of objects
- Required argument: Objects to save.
- Keyword argument in_: the file in which to save the object(s)
- Keyword argument as: the file type of the document in which to save the data
- Keyword argument _attributes: AppleEvent attribute dictionary
- """
- _code = 'core'
- _subcode = 'save'
-
- aetools.keysubst(_arguments, self._argmap_save)
- _arguments['----'] = _object
-
-
- _reply, _arguments, _attributes = self.send(_code, _subcode,
- _arguments, _attributes)
- if _arguments.get('errn', 0):
- raise aetools.Error(aetools.decodeerror(_arguments))
- # XXXX Optionally decode result
- if _arguments.has_key('----'):
- return _arguments['----']
-
- _argmap_set = {
- 'to' : 'data',
- }
-
- def set(self, _object, _attributes={}, **_arguments):
- """set: Set an object\xd5s data
- Required argument: the object to change
- Keyword argument to: the new value
- Keyword argument _attributes: AppleEvent attribute dictionary
- """
- _code = 'core'
- _subcode = 'setd'
-
- aetools.keysubst(_arguments, self._argmap_set)
- _arguments['----'] = _object
-
-
- _reply, _arguments, _attributes = self.send(_code, _subcode,
- _arguments, _attributes)
- if _arguments.get('errn', 0):
- raise aetools.Error(aetools.decodeerror(_arguments))
- # XXXX Optionally decode result
- if _arguments.has_key('----'):
- return _arguments['----']
-
-
-class application(aetools.ComponentItem):
- """application - An application program """
- want = 'capp'
-# element 'cwin' as ['indx', 'name', 'rele']
-# element 'docu' as ['name']
-
-class window(aetools.ComponentItem):
- """window - A Window """
- want = 'cwin'
-class _Prop_bounds(aetools.NProperty):
- """bounds - the boundary rectangle for the window """
- which = 'pbnd'
- want = 'qdrt'
-class _Prop_closeable(aetools.NProperty):
- """closeable - Does the window have a close box? """
- which = 'hclb'
- want = 'bool'
-class _Prop_floating(aetools.NProperty):
- """floating - Does the window float? """
- which = 'isfl'
- want = 'bool'
-class _Prop_index(aetools.NProperty):
- """index - the number of the window """
- which = 'pidx'
- want = 'long'
-class _Prop_modal(aetools.NProperty):
- """modal - Is the window modal? """
- which = 'pmod'
- want = 'bool'
-class _Prop_name(aetools.NProperty):
- """name - the title of the window """
- which = 'pnam'
- want = 'itxt'
-class _Prop_position(aetools.NProperty):
- """position - upper left coordinates of window """
- which = 'ppos'
- want = 'QDpt'
-class _Prop_resizable(aetools.NProperty):
- """resizable - Is the window resizable? """
- which = 'prsz'
- want = 'bool'
-class _Prop_titled(aetools.NProperty):
- """titled - Does the window have a title bar? """
- which = 'ptit'
- want = 'bool'
-class _Prop_visible(aetools.NProperty):
- """visible - is the window visible? """
- which = 'pvis'
- want = 'bool'
-class _Prop_zoomable(aetools.NProperty):
- """zoomable - Is the window zoomable? """
- which = 'iszm'
- want = 'bool'
-class _Prop_zoomed(aetools.NProperty):
- """zoomed - Is the window zoomed? """
- which = 'pzum'
- want = 'bool'
-
-class document(aetools.ComponentItem):
- """document - A Document """
- want = 'docu'
-class _Prop_modified(aetools.NProperty):
- """modified - Has the document been modified since the last save? """
- which = 'imod'
- want = 'bool'
-application._superclassnames = []
-application._privpropdict = {
-}
-application._privelemdict = {
- 'document' : document,
- 'window' : window,
-}
-window._superclassnames = []
-window._privpropdict = {
- 'bounds' : _Prop_bounds,
- 'closeable' : _Prop_closeable,
- 'floating' : _Prop_floating,
- 'index' : _Prop_index,
- 'modal' : _Prop_modal,
- 'name' : _Prop_name,
- 'position' : _Prop_position,
- 'resizable' : _Prop_resizable,
- 'titled' : _Prop_titled,
- 'visible' : _Prop_visible,
- 'zoomable' : _Prop_zoomable,
- 'zoomed' : _Prop_zoomed,
-}
-window._privelemdict = {
-}
-document._superclassnames = []
-document._privpropdict = {
- 'modified' : _Prop_modified,
- 'name' : _Prop_name,
-}
-document._privelemdict = {
-}
-_Enum_savo = {
- 'yes' : 'yes ', # Save objects now
- 'no' : 'no ', # Do not save objects
- 'ask' : 'ask ', # Ask the user whether to save
-}
-
-
-#
-# Indices of types declared in this module
-#
-_classdeclarations = {
- 'capp' : application,
- 'cwin' : window,
- 'docu' : document,
-}
-
-_propdeclarations = {
- 'hclb' : _Prop_closeable,
- 'imod' : _Prop_modified,
- 'isfl' : _Prop_floating,
- 'iszm' : _Prop_zoomable,
- 'pbnd' : _Prop_bounds,
- 'pidx' : _Prop_index,
- 'pmod' : _Prop_modal,
- 'pnam' : _Prop_name,
- 'ppos' : _Prop_position,
- 'prsz' : _Prop_resizable,
- 'ptit' : _Prop_titled,
- 'pvis' : _Prop_visible,
- 'pzum' : _Prop_zoomed,
-}
-
-_compdeclarations = {
-}
-
-_enumdeclarations = {
- 'savo' : _Enum_savo,
-}
diff --git a/Mac/Tools/Doc/HelpIndexingTool/__init__.py b/Mac/Tools/Doc/HelpIndexingTool/__init__.py
deleted file mode 100644
index 5359df53c4..0000000000
--- a/Mac/Tools/Doc/HelpIndexingTool/__init__.py
+++ /dev/null
@@ -1,78 +0,0 @@
-"""
-Package generated from /Developer/Applications/Apple Help Indexing Tool.app
-"""
-import aetools
-Error = aetools.Error
-import Standard_Suite
-import Help_Indexing_Tool_Suite
-import odds_and_ends
-import Miscellaneous_Standards
-import Required_Suite
-
-
-_code_to_module = {
- 'CoRe' : Standard_Suite,
- 'HIT ' : Help_Indexing_Tool_Suite,
- 'Odds' : odds_and_ends,
- 'misc' : Miscellaneous_Standards,
- 'reqd' : Required_Suite,
-}
-
-
-
-_code_to_fullname = {
- 'CoRe' : ('HelpIndexingTool.Standard_Suite', 'Standard_Suite'),
- 'HIT ' : ('HelpIndexingTool.Help_Indexing_Tool_Suite', 'Help_Indexing_Tool_Suite'),
- 'Odds' : ('HelpIndexingTool.odds_and_ends', 'odds_and_ends'),
- 'misc' : ('HelpIndexingTool.Miscellaneous_Standards', 'Miscellaneous_Standards'),
- 'reqd' : ('HelpIndexingTool.Required_Suite', 'Required_Suite'),
-}
-
-from Standard_Suite import *
-from Help_Indexing_Tool_Suite import *
-from odds_and_ends import *
-from Miscellaneous_Standards import *
-from Required_Suite import *
-
-def getbaseclasses(v):
- if not getattr(v, '_propdict', None):
- v._propdict = {}
- v._elemdict = {}
- for superclassname in getattr(v, '_superclassnames', []):
- superclass = eval(superclassname)
- getbaseclasses(superclass)
- v._propdict.update(getattr(superclass, '_propdict', {}))
- v._elemdict.update(getattr(superclass, '_elemdict', {}))
- v._propdict.update(getattr(v, '_privpropdict', {}))
- v._elemdict.update(getattr(v, '_privelemdict', {}))
-
-import StdSuites
-
-#
-# Set property and element dictionaries now that all classes have been defined
-#
-getbaseclasses(window)
-getbaseclasses(application)
-getbaseclasses(document)
-getbaseclasses(application)
-
-#
-# Indices of types declared in this module
-#
-_classdeclarations = {
- 'cwin' : window,
- 'capp' : application,
- 'docu' : document,
- 'capp' : application,
-}
-
-
-class HelpIndexingTool(Standard_Suite_Events,
- Help_Indexing_Tool_Suite_Events,
- odds_and_ends_Events,
- Miscellaneous_Standards_Events,
- Required_Suite_Events,
- aetools.TalkTo):
- _signature = 'hiti'
-
- _moduleName = 'HelpIndexingTool'
diff --git a/Mac/Tools/Doc/HelpIndexingTool/odds_and_ends.py b/Mac/Tools/Doc/HelpIndexingTool/odds_and_ends.py
deleted file mode 100644
index 86ecb95c96..0000000000
--- a/Mac/Tools/Doc/HelpIndexingTool/odds_and_ends.py
+++ /dev/null
@@ -1,49 +0,0 @@
-"""Suite odds and ends: Things that should be in some standard suite, but aren\xd5t
-Level 1, version 1
-
-Generated from /Developer/Applications/Apple Help Indexing Tool.app
-AETE/AEUT resource version 1/1, language 0, script 0
-"""
-
-import aetools
-import MacOS
-
-_code = 'Odds'
-
-class odds_and_ends_Events:
-
- def select(self, _object=None, _attributes={}, **_arguments):
- """select: Select the specified object
- Required argument: the object to select
- Keyword argument _attributes: AppleEvent attribute dictionary
- """
- _code = 'misc'
- _subcode = 'slct'
-
- if _arguments: raise TypeError('No optional args expected')
- _arguments['----'] = _object
-
-
- _reply, _arguments, _attributes = self.send(_code, _subcode,
- _arguments, _attributes)
- if _arguments.get('errn', 0):
- raise aetools.Error(aetools.decodeerror(_arguments))
- # XXXX Optionally decode result
- if _arguments.has_key('----'):
- return _arguments['----']
-
-
-#
-# Indices of types declared in this module
-#
-_classdeclarations = {
-}
-
-_propdeclarations = {
-}
-
-_compdeclarations = {
-}
-
-_enumdeclarations = {
-}
diff --git a/Mac/Tools/Doc/README b/Mac/Tools/Doc/README
deleted file mode 100644
index 4f4d53d01e..0000000000
--- a/Mac/Tools/Doc/README
+++ /dev/null
@@ -1,35 +0,0 @@
-In this directory you can build the Python documentation in a form that
-is suitable for access with Apple Help Viewer. This will enable the
-"Python Documentation" menu entries in the MacPython IDE Help menu.
-
-Unfortunately the procedure to build the docs is not very streamlined.
-
-First, edit setup.py. At the top, edit MAJOR_VERSION and MINOR_VERSION,
-and check that DESTDIR makes sense. The documentation will be installed
-inside PythonIDE.app.
-
-In DocBuild.initialize_options, set self.download to True if you want to
-download the docs. Set it to False if you want to build the docs from
-the source tree, but this requires LaTex and lots of other stuff.
-Doable, but not easy.
-
-Second, if you want to download the docs you may need to do a couple
-more edits. The way the docs are packaged will often change between
-major releases. Fiddle DocBuild.downloadDocs to make it do the right
-thing (download the docs from python.org, unpack them, rename the
-directory to "build/html").
-
-After these edits you should be ready to roll. "pythonw setup.py build"
-should download and unpack (or build) the docs. Next, it will do some
-magic to make the docs indexable. Finally, it will run the Apple Help
-Indexing Tool. (This last step is the reason you must use "pythonw" as
-opposed to "python"). Usually it will time out while waiting for AHIT to
-do its work. Wait until AHIT is done.
-
-Now you're ready to install with "python setup.py install".
-
-After this is done test your work. Fire up PythonIDE, and check that
-Help->Python Documentation brings up the documentation in the Help Viewer.
-Also open an IDE edit window, type something like "import sys", select
-"import", and use Help->Lookup in Python Documentation to check that the
-index has been generated correctly.
diff --git a/Mac/Tools/Doc/setup.py b/Mac/Tools/Doc/setup.py
deleted file mode 100644
index a35152cef1..0000000000
--- a/Mac/Tools/Doc/setup.py
+++ /dev/null
@@ -1,213 +0,0 @@
-# Build and install an Apple Help Viewer compatible version of the Python
-# documentation into the framework.
-# Code by Bill Fancher, with some modifications by Jack Jansen.
-#
-# You must run this as a two-step process
-# 1. python setupDocs.py build
-# 2. Wait for Apple Help Indexing Tool to finish
-# 3. python setupDocs.py install
-#
-# To do:
-# - test whether the docs are available locally before downloading
-# - fix buildDocsFromSource
-# - Get documentation version from sys.version, fallback to 2.2.1
-# - See if we can somehow detect that Apple Help Indexing Tool is finished
-# - data_files to setup() doesn't seem the right way to pass the arguments
-#
-import sys, os, re
-from distutils.cmd import Command
-from distutils.command.build import build
-from distutils.core import setup
-from distutils.file_util import copy_file
-from distutils.dir_util import copy_tree
-from distutils.log import log
-from distutils.spawn import spawn
-from distutils import sysconfig, dep_util
-from distutils.util import change_root
-import HelpIndexingTool
-import Carbon.File
-import time
-
-MAJOR_VERSION='2.4'
-MINOR_VERSION='2.4.1'
-DESTDIR='/Applications/MacPython-%s/PythonIDE.app/Contents/Resources/English.lproj/PythonDocumentation' % MAJOR_VERSION
-
-class DocBuild(build):
- def initialize_options(self):
- build.initialize_options(self)
- self.build_html = None
- self.build_dest = None
- self.download = 1
- self.doc_version = MINOR_VERSION # Only needed if download is true
-
- def finalize_options(self):
- build.finalize_options(self)
- if self.build_html is None:
- self.build_html = os.path.join(self.build_base, 'html')
- if self.build_dest is None:
- self.build_dest = os.path.join(self.build_base, 'PythonDocumentation')
-
- def spawn(self, *args):
- spawn(args, 1, self.verbose, self.dry_run)
-
- def downloadDocs(self):
- workdir = os.getcwd()
- # XXX Note: the next strings may change from version to version
- url = 'http://www.python.org/ftp/python/doc/%s/html-%s.tar.bz2' % \
- (self.doc_version,self.doc_version)
- tarfile = 'html-%s.tar.bz2' % self.doc_version
- dirname = 'Python-Docs-%s' % self.doc_version
-
- if os.path.exists(self.build_html):
- raise RuntimeError('%s: already exists, please remove and try again' % self.build_html)
- os.chdir(self.build_base)
- self.spawn('curl','-O', url)
- self.spawn('tar', '-xjf', tarfile)
- os.rename(dirname, 'html')
- os.chdir(workdir)
-## print "** Please unpack %s" % os.path.join(self.build_base, tarfile)
-## print "** Unpack the files into %s" % self.build_html
-## raise RuntimeError, "You need to unpack the docs manually"
-
- def buildDocsFromSource(self):
- srcdir = '../../..'
- docdir = os.path.join(srcdir, 'Doc')
- htmldir = os.path.join(docdir, 'html')
- spawn(('make','--directory', docdir, 'html'), 1, self.verbose, self.dry_run)
- self.mkpath(self.build_html)
- copy_tree(htmldir, self.build_html)
-
- def ensureHtml(self):
- if not os.path.exists(self.build_html):
- if self.download:
- self.downloadDocs()
- else:
- self.buildDocsFromSource()
-
- def hackIndex(self):
- ind_html = 'index.html'
- #print 'self.build_dest =', self.build_dest
- hackedIndex = file(os.path.join(self.build_dest, ind_html),'w')
- origIndex = file(os.path.join(self.build_html,ind_html))
- r = re.compile('<style type="text/css">.*</style>', re.DOTALL)
- hackedIndex.write(r.sub('<META NAME="AppleTitle" CONTENT="Python Documentation">',origIndex.read()))
-
- def hackFile(self,d,f):
- origPath = os.path.join(d,f)
- assert(origPath[:len(self.build_html)] == self.build_html)
- outPath = os.path.join(self.build_dest, d[len(self.build_html)+1:], f)
- (name, ext) = os.path.splitext(f)
- if os.path.isdir(origPath):
- self.mkpath(outPath)
- elif ext == '.html':
- if self.verbose: print('hacking %s to %s' % (origPath,outPath))
- hackedFile = file(outPath, 'w')
- origFile = file(origPath,'r')
- hackedFile.write(self.r.sub('<dl><dt><dd>', origFile.read()))
- else:
- copy_file(origPath, outPath)
-
- def hackHtml(self):
- self.r = re.compile('<dl><dd>')
- os.walk(self.build_html, self.visit, None)
-
- def visit(self, dummy, dirname, filenames):
- for f in filenames:
- self.hackFile(dirname, f)
-
- def makeHelpIndex(self):
- app = '/Developer/Applications/Apple Help Indexing Tool.app'
- self.spawn('open', '-a', app , self.build_dest)
- print("Please wait until Apple Help Indexing Tool finishes before installing")
-
- def makeHelpIndex(self):
- app = HelpIndexingTool.HelpIndexingTool(start=1)
- app.open(Carbon.File.FSSpec(self.build_dest))
- sys.stderr.write("Waiting for Help Indexing Tool to start...")
- while 1:
- # This is bad design in the suite generation code!
- idle = app._get(HelpIndexingTool.Help_Indexing_Tool_Suite._Prop_idleStatus())
- time.sleep(10)
- if not idle: break
- sys.stderr.write(".")
- sys.stderr.write("\n")
- sys.stderr.write("Waiting for Help Indexing Tool to finish...")
- while 1:
- # This is bad design in the suite generation code!
- idle = app._get(HelpIndexingTool.Help_Indexing_Tool_Suite._Prop_idleStatus())
- time.sleep(10)
- if idle: break
- sys.stderr.write(".")
- sys.stderr.write("\n")
-
-
- def run(self):
- self.ensure_finalized()
- self.mkpath(self.build_base)
- self.ensureHtml()
- if not os.path.isdir(self.build_html):
- raise RuntimeError("Can't find source folder for documentation.")
- self.mkpath(self.build_dest)
- if dep_util.newer(os.path.join(self.build_html,'index.html'), os.path.join(self.build_dest,'index.html')):
- self.mkpath(self.build_dest)
- self.hackHtml()
- self.hackIndex()
- self.makeHelpIndex()
-
-class AHVDocInstall(Command):
- description = "install Apple Help Viewer html files"
- user_options = [('install-doc=', 'd',
- 'directory to install HTML tree'),
- ('root=', None,
- "install everything relative to this alternate root directory"),
- ]
-
- def initialize_options(self):
- self.build_dest = None
- self.install_doc = None
- self.prefix = None
- self.root = None
-
- def finalize_options(self):
- self.set_undefined_options('install',
- ('prefix', 'prefix'),
- ('root', 'root'))
-# import pdb ; pdb.set_trace()
- build_cmd = self.get_finalized_command('build')
- if self.build_dest is None:
- build_cmd = self.get_finalized_command('build')
- self.build_dest = build_cmd.build_dest
- if self.install_doc is None:
- self.install_doc = os.path.join(self.prefix, DESTDIR)
- print('INSTALL', self.build_dest, '->', self.install_doc)
-
- def run(self):
- self.finalize_options()
- self.ensure_finalized()
- print("Running Installer")
- instloc = self.install_doc
- if self.root:
- instloc = change_root(self.root, instloc)
- self.mkpath(instloc)
- copy_tree(self.build_dest, instloc)
- print("Installation complete")
-
-def mungeVersion(infile, outfile):
- i = file(infile,'r')
- o = file(outfile,'w')
- o.write(re.sub('\$\(VERSION\)',sysconfig.get_config_var('VERSION'),i.read()))
- i.close()
- o.close()
-
-def main():
- # turn off warnings when deprecated modules are imported
-## import warnings
-## warnings.filterwarnings("ignore",category=DeprecationWarning)
- setup(name = 'Documentation',
- version = '%d.%d' % sys.version_info[:2],
- cmdclass = {'install_data':AHVDocInstall, 'build':DocBuild},
- data_files = ['dummy'],
- )
-
-if __name__ == '__main__':
- main()
diff --git a/Mac/Tools/bundlebuilder.py b/Mac/Tools/bundlebuilder.py
deleted file mode 100644
index 6cc130fa44..0000000000
--- a/Mac/Tools/bundlebuilder.py
+++ /dev/null
@@ -1,934 +0,0 @@
-#! /usr/bin/env python
-
-"""\
-bundlebuilder.py -- Tools to assemble MacOS X (application) bundles.
-
-This module contains two classes to build so called "bundles" for
-MacOS X. BundleBuilder is a general tool, AppBuilder is a subclass
-specialized in building application bundles.
-
-[Bundle|App]Builder objects are instantiated with a bunch of keyword
-arguments, and have a build() method that will do all the work. See
-the class doc strings for a description of the constructor arguments.
-
-The module contains a main program that can be used in two ways:
-
- % python bundlebuilder.py [options] build
- % python buildapp.py [options] build
-
-Where "buildapp.py" is a user-supplied setup.py-like script following
-this model:
-
- from bundlebuilder import buildapp
- buildapp(<lots-of-keyword-args>)
-
-"""
-
-
-__all__ = ["BundleBuilder", "BundleBuilderError", "AppBuilder", "buildapp"]
-
-
-import sys
-import os, errno, shutil
-import imp, marshal
-import re
-from copy import deepcopy
-import getopt
-from plistlib import Plist
-from types import FunctionType as function
-
-class BundleBuilderError(Exception): pass
-
-
-class Defaults:
-
- """Class attributes that don't start with an underscore and are
- not functions or classmethods are (deep)copied to self.__dict__.
- This allows for mutable default values.
- """
-
- def __init__(self, **kwargs):
- defaults = self._getDefaults()
- defaults.update(kwargs)
- self.__dict__.update(defaults)
-
- def _getDefaults(cls):
- defaults = {}
- for base in cls.__bases__:
- if hasattr(base, "_getDefaults"):
- defaults.update(base._getDefaults())
- for name, value in list(cls.__dict__.items()):
- if name[0] != "_" and not isinstance(value,
- (function, classmethod)):
- defaults[name] = deepcopy(value)
- return defaults
- _getDefaults = classmethod(_getDefaults)
-
-
-class BundleBuilder(Defaults):
-
- """BundleBuilder is a barebones class for assembling bundles. It
- knows nothing about executables or icons, it only copies files
- and creates the PkgInfo and Info.plist files.
- """
-
- # (Note that Defaults.__init__ (deep)copies these values to
- # instance variables. Mutable defaults are therefore safe.)
-
- # Name of the bundle, with or without extension.
- name = None
-
- # The property list ("plist")
- plist = Plist(CFBundleDevelopmentRegion = "English",
- CFBundleInfoDictionaryVersion = "6.0")
-
- # The type of the bundle.
- type = "BNDL"
- # The creator code of the bundle.
- creator = None
-
- # the CFBundleIdentifier (this is used for the preferences file name)
- bundle_id = None
-
- # List of files that have to be copied to <bundle>/Contents/Resources.
- resources = []
-
- # List of (src, dest) tuples; dest should be a path relative to the bundle
- # (eg. "Contents/Resources/MyStuff/SomeFile.ext).
- files = []
-
- # List of shared libraries (dylibs, Frameworks) to bundle with the app
- # will be placed in Contents/Frameworks
- libs = []
-
- # Directory where the bundle will be assembled.
- builddir = "build"
-
- # Make symlinks instead copying files. This is handy during debugging, but
- # makes the bundle non-distributable.
- symlink = 0
-
- # Verbosity level.
- verbosity = 1
-
- # Destination root directory
- destroot = ""
-
- def setup(self):
- # XXX rethink self.name munging, this is brittle.
- self.name, ext = os.path.splitext(self.name)
- if not ext:
- ext = ".bundle"
- bundleextension = ext
- # misc (derived) attributes
- self.bundlepath = pathjoin(self.builddir, self.name + bundleextension)
-
- plist = self.plist
- plist.CFBundleName = self.name
- plist.CFBundlePackageType = self.type
- if self.creator is None:
- if hasattr(plist, "CFBundleSignature"):
- self.creator = plist.CFBundleSignature
- else:
- self.creator = "????"
- plist.CFBundleSignature = self.creator
- if self.bundle_id:
- plist.CFBundleIdentifier = self.bundle_id
- elif not hasattr(plist, "CFBundleIdentifier"):
- plist.CFBundleIdentifier = self.name
-
- def build(self):
- """Build the bundle."""
- builddir = self.builddir
- if builddir and not os.path.exists(builddir):
- os.mkdir(builddir)
- self.message("Building %s" % repr(self.bundlepath), 1)
- if os.path.exists(self.bundlepath):
- shutil.rmtree(self.bundlepath)
- if os.path.exists(self.bundlepath + '~'):
- shutil.rmtree(self.bundlepath + '~')
- bp = self.bundlepath
-
- # Create the app bundle in a temporary location and then
- # rename the completed bundle. This way the Finder will
- # never see an incomplete bundle (where it might pick up
- # and cache the wrong meta data)
- self.bundlepath = bp + '~'
- try:
- os.mkdir(self.bundlepath)
- self.preProcess()
- self._copyFiles()
- self._addMetaFiles()
- self.postProcess()
- os.rename(self.bundlepath, bp)
- finally:
- self.bundlepath = bp
- self.message("Done.", 1)
-
- def preProcess(self):
- """Hook for subclasses."""
- pass
- def postProcess(self):
- """Hook for subclasses."""
- pass
-
- def _addMetaFiles(self):
- contents = pathjoin(self.bundlepath, "Contents")
- makedirs(contents)
- #
- # Write Contents/PkgInfo
- assert len(self.type) == len(self.creator) == 4, \
- "type and creator must be 4-byte strings."
- pkginfo = pathjoin(contents, "PkgInfo")
- f = open(pkginfo, "wb")
- f.write((self.type + self.creator).encode('latin1'))
- f.close()
- #
- # Write Contents/Info.plist
- infoplist = pathjoin(contents, "Info.plist")
- self.plist.write(infoplist)
-
- def _copyFiles(self):
- files = self.files[:]
- for path in self.resources:
- files.append((path, pathjoin("Contents", "Resources",
- os.path.basename(path))))
- for path in self.libs:
- files.append((path, pathjoin("Contents", "Frameworks",
- os.path.basename(path))))
- if self.symlink:
- self.message("Making symbolic links", 1)
- msg = "Making symlink from"
- else:
- self.message("Copying files", 1)
- msg = "Copying"
- files.sort()
- for src, dst in files:
- if os.path.isdir(src):
- self.message("%s %s/ to %s/" % (msg, src, dst), 2)
- else:
- self.message("%s %s to %s" % (msg, src, dst), 2)
- dst = pathjoin(self.bundlepath, dst)
- if self.symlink:
- symlink(src, dst, mkdirs=1)
- else:
- copy(src, dst, mkdirs=1)
-
- def message(self, msg, level=0):
- if level <= self.verbosity:
- indent = ""
- if level > 1:
- indent = (level - 1) * " "
- sys.stderr.write(indent + msg + "\n")
-
- def report(self):
- # XXX something decent
- pass
-
-
-if __debug__:
- PYC_EXT = ".pyc"
-else:
- PYC_EXT = ".pyo"
-
-MAGIC = imp.get_magic()
-USE_ZIPIMPORT = "zipimport" in sys.builtin_module_names
-
-# For standalone apps, we have our own minimal site.py. We don't need
-# all the cruft of the real site.py.
-SITE_PY = """\
-import sys
-if not %(semi_standalone)s:
- del sys.path[1:] # sys.path[0] is Contents/Resources/
-"""
-
-if USE_ZIPIMPORT:
- ZIP_ARCHIVE = "Modules.zip"
- SITE_PY += "sys.path.append(sys.path[0] + '/%s')\n" % ZIP_ARCHIVE
- def getPycData(fullname, code, ispkg):
- if ispkg:
- fullname += ".__init__"
- path = fullname.replace(".", os.sep) + PYC_EXT
- return path, MAGIC + '\0\0\0\0' + marshal.dumps(code)
-
-#
-# Extension modules can't be in the modules zip archive, so a placeholder
-# is added instead, that loads the extension from a specified location.
-#
-EXT_LOADER = """\
-def __load():
- import imp, sys, os
- for p in sys.path:
- path = os.path.join(p, "%(filename)s")
- if os.path.exists(path):
- break
- else:
- assert 0, "file not found: %(filename)s"
- mod = imp.load_dynamic("%(name)s", path)
-
-__load()
-del __load
-"""
-
-MAYMISS_MODULES = ['mac', 'os2', 'nt', 'ntpath', 'dos', 'dospath',
- 'win32api', 'ce', '_winreg', 'nturl2path', 'sitecustomize',
- 'org.python.core', 'riscos', 'riscosenviron', 'riscospath'
-]
-
-STRIP_EXEC = "/usr/bin/strip"
-
-#
-# We're using a stock interpreter to run the app, yet we need
-# a way to pass the Python main program to the interpreter. The
-# bootstrapping script fires up the interpreter with the right
-# arguments. os.execve() is used as OSX doesn't like us to
-# start a real new process. Also, the executable name must match
-# the CFBundleExecutable value in the Info.plist, so we lie
-# deliberately with argv[0]. The actual Python executable is
-# passed in an environment variable so we can "repair"
-# sys.executable later.
-#
-BOOTSTRAP_SCRIPT = """\
-#!%(hashbang)s
-
-import sys, os
-execdir = os.path.dirname(sys.argv[0])
-executable = os.path.join(execdir, "%(executable)s")
-resdir = os.path.join(os.path.dirname(execdir), "Resources")
-libdir = os.path.join(os.path.dirname(execdir), "Frameworks")
-mainprogram = os.path.join(resdir, "%(mainprogram)s")
-
-sys.argv.insert(1, mainprogram)
-if %(standalone)s or %(semi_standalone)s:
- os.environ["PYTHONPATH"] = resdir
- if %(standalone)s:
- os.environ["PYTHONHOME"] = resdir
-else:
- pypath = os.getenv("PYTHONPATH", "")
- if pypath:
- pypath = ":" + pypath
- os.environ["PYTHONPATH"] = resdir + pypath
-os.environ["PYTHONEXECUTABLE"] = executable
-os.environ["DYLD_LIBRARY_PATH"] = libdir
-os.environ["DYLD_FRAMEWORK_PATH"] = libdir
-os.execve(executable, sys.argv, os.environ)
-"""
-
-
-#
-# Optional wrapper that converts "dropped files" into sys.argv values.
-#
-ARGV_EMULATOR = """\
-import argvemulator, os
-
-argvemulator.ArgvCollector().mainloop()
-execfile(os.path.join(os.path.split(__file__)[0], "%(realmainprogram)s"))
-"""
-
-#
-# When building a standalone app with Python.framework, we need to copy
-# a subset from Python.framework to the bundle. The following list
-# specifies exactly what items we'll copy.
-#
-PYTHONFRAMEWORKGOODIES = [
- "Python", # the Python core library
- "Resources/English.lproj",
- "Resources/Info.plist",
- "Resources/version.plist",
-]
-
-def isFramework():
- return sys.exec_prefix.find("Python.framework") > 0
-
-
-LIB = os.path.join(sys.prefix, "lib", "python" + sys.version[:3])
-SITE_PACKAGES = os.path.join(LIB, "site-packages")
-
-
-class AppBuilder(BundleBuilder):
-
- # Override type of the bundle.
- type = "APPL"
-
- # platform, name of the subfolder of Contents that contains the executable.
- platform = "MacOS"
-
- # A Python main program. If this argument is given, the main
- # executable in the bundle will be a small wrapper that invokes
- # the main program. (XXX Discuss why.)
- mainprogram = None
-
- # The main executable. If a Python main program is specified
- # the executable will be copied to Resources and be invoked
- # by the wrapper program mentioned above. Otherwise it will
- # simply be used as the main executable.
- executable = None
-
- # The name of the main nib, for Cocoa apps. *Must* be specified
- # when building a Cocoa app.
- nibname = None
-
- # The name of the icon file to be copied to Resources and used for
- # the Finder icon.
- iconfile = None
-
- # Symlink the executable instead of copying it.
- symlink_exec = 0
-
- # If True, build standalone app.
- standalone = 0
-
- # If True, build semi-standalone app (only includes third-party modules).
- semi_standalone = 0
-
- # If set, use this for #! lines in stead of sys.executable
- python = None
-
- # If True, add a real main program that emulates sys.argv before calling
- # mainprogram
- argv_emulation = 0
-
- # The following attributes are only used when building a standalone app.
-
- # Exclude these modules.
- excludeModules = []
-
- # Include these modules.
- includeModules = []
-
- # Include these packages.
- includePackages = []
-
- # Strip binaries from debug info.
- strip = 0
-
- # Found Python modules: [(name, codeobject, ispkg), ...]
- pymodules = []
-
- # Modules that modulefinder couldn't find:
- missingModules = []
- maybeMissingModules = []
-
- def setup(self):
- if ((self.standalone or self.semi_standalone)
- and self.mainprogram is None):
- raise BundleBuilderError("must specify 'mainprogram' when "
- "building a standalone application.")
- if self.mainprogram is None and self.executable is None:
- raise BundleBuilderError("must specify either or both of "
- "'executable' and 'mainprogram'")
-
- self.execdir = pathjoin("Contents", self.platform)
-
- if self.name is not None:
- pass
- elif self.mainprogram is not None:
- self.name = os.path.splitext(os.path.basename(self.mainprogram))[0]
- elif executable is not None:
- self.name = os.path.splitext(os.path.basename(self.executable))[0]
- if self.name[-4:] != ".app":
- self.name += ".app"
-
- if self.executable is None:
- if not self.standalone and not isFramework():
- self.symlink_exec = 1
- if self.python:
- self.executable = self.python
- else:
- self.executable = sys.executable
-
- if self.nibname:
- self.plist.NSMainNibFile = self.nibname
- if not hasattr(self.plist, "NSPrincipalClass"):
- self.plist.NSPrincipalClass = "NSApplication"
-
- if self.standalone and isFramework():
- self.addPythonFramework()
-
- BundleBuilder.setup(self)
-
- self.plist.CFBundleExecutable = self.name
-
- if self.standalone or self.semi_standalone:
- self.findDependencies()
-
- def preProcess(self):
- resdir = "Contents/Resources"
- if self.executable is not None:
- if self.mainprogram is None:
- execname = self.name
- else:
- execname = os.path.basename(self.executable)
- execpath = pathjoin(self.execdir, execname)
- if not self.symlink_exec:
- self.files.append((self.destroot + self.executable, execpath))
- self.execpath = execpath
-
- if self.mainprogram is not None:
- mainprogram = os.path.basename(self.mainprogram)
- self.files.append((self.mainprogram, pathjoin(resdir, mainprogram)))
- if self.argv_emulation:
- # Change the main program, and create the helper main program (which
- # does argv collection and then calls the real main).
- # Also update the included modules (if we're creating a standalone
- # program) and the plist
- realmainprogram = mainprogram
- mainprogram = '__argvemulator_' + mainprogram
- resdirpath = pathjoin(self.bundlepath, resdir)
- mainprogrampath = pathjoin(resdirpath, mainprogram)
- makedirs(resdirpath)
- open(mainprogrampath, "w").write(ARGV_EMULATOR % locals())
- if self.standalone or self.semi_standalone:
- self.includeModules.append("argvemulator")
- self.includeModules.append("os")
- if "CFBundleDocumentTypes" not in self.plist:
- self.plist["CFBundleDocumentTypes"] = [
- { "CFBundleTypeOSTypes" : [
- "****",
- "fold",
- "disk"],
- "CFBundleTypeRole": "Viewer"}]
- # Write bootstrap script
- executable = os.path.basename(self.executable)
- execdir = pathjoin(self.bundlepath, self.execdir)
- bootstrappath = pathjoin(execdir, self.name)
- makedirs(execdir)
- if self.standalone or self.semi_standalone:
- # XXX we're screwed when the end user has deleted
- # /usr/bin/python
- hashbang = "/usr/bin/python"
- elif self.python:
- hashbang = self.python
- else:
- hashbang = os.path.realpath(sys.executable)
- standalone = self.standalone
- semi_standalone = self.semi_standalone
- open(bootstrappath, "w").write(BOOTSTRAP_SCRIPT % locals())
- os.chmod(bootstrappath, 0o775)
-
- if self.iconfile is not None:
- iconbase = os.path.basename(self.iconfile)
- self.plist.CFBundleIconFile = iconbase
- self.files.append((self.iconfile, pathjoin(resdir, iconbase)))
-
- def postProcess(self):
- if self.standalone or self.semi_standalone:
- self.addPythonModules()
- if self.strip and not self.symlink:
- self.stripBinaries()
-
- if self.symlink_exec and self.executable:
- self.message("Symlinking executable %s to %s" % (self.executable,
- self.execpath), 2)
- dst = pathjoin(self.bundlepath, self.execpath)
- makedirs(os.path.dirname(dst))
- os.symlink(os.path.abspath(self.executable), dst)
-
- if self.missingModules or self.maybeMissingModules:
- self.reportMissing()
-
- def addPythonFramework(self):
- # If we're building a standalone app with Python.framework,
- # include a minimal subset of Python.framework, *unless*
- # Python.framework was specified manually in self.libs.
- for lib in self.libs:
- if os.path.basename(lib) == "Python.framework":
- # a Python.framework was specified as a library
- return
-
- frameworkpath = sys.exec_prefix[:sys.exec_prefix.find(
- "Python.framework") + len("Python.framework")]
-
- version = sys.version[:3]
- frameworkpath = pathjoin(frameworkpath, "Versions", version)
- destbase = pathjoin("Contents", "Frameworks", "Python.framework",
- "Versions", version)
- for item in PYTHONFRAMEWORKGOODIES:
- src = pathjoin(frameworkpath, item)
- dst = pathjoin(destbase, item)
- self.files.append((src, dst))
-
- def _getSiteCode(self):
- return compile(SITE_PY % {"semi_standalone": self.semi_standalone},
- "<-bundlebuilder.py->", "exec")
-
- def addPythonModules(self):
- self.message("Adding Python modules", 1)
-
- if USE_ZIPIMPORT:
- # Create a zip file containing all modules as pyc.
- import zipfile
- relpath = pathjoin("Contents", "Resources", ZIP_ARCHIVE)
- abspath = pathjoin(self.bundlepath, relpath)
- zf = zipfile.ZipFile(abspath, "w", zipfile.ZIP_DEFLATED)
- for name, code, ispkg in self.pymodules:
- self.message("Adding Python module %s" % name, 2)
- path, pyc = getPycData(name, code, ispkg)
- zf.writestr(path, pyc)
- zf.close()
- # add site.pyc
- sitepath = pathjoin(self.bundlepath, "Contents", "Resources",
- "site" + PYC_EXT)
- writePyc(self._getSiteCode(), sitepath)
- else:
- # Create individual .pyc files.
- for name, code, ispkg in self.pymodules:
- if ispkg:
- name += ".__init__"
- path = name.split(".")
- path = pathjoin("Contents", "Resources", *path) + PYC_EXT
-
- if ispkg:
- self.message("Adding Python package %s" % path, 2)
- else:
- self.message("Adding Python module %s" % path, 2)
-
- abspath = pathjoin(self.bundlepath, path)
- makedirs(os.path.dirname(abspath))
- writePyc(code, abspath)
-
- def stripBinaries(self):
- if not os.path.exists(STRIP_EXEC):
- self.message("Error: can't strip binaries: no strip program at "
- "%s" % STRIP_EXEC, 0)
- else:
- import stat
- self.message("Stripping binaries", 1)
- def walk(top):
- for name in os.listdir(top):
- path = pathjoin(top, name)
- if os.path.islink(path):
- continue
- if os.path.isdir(path):
- walk(path)
- else:
- mod = os.stat(path)[stat.ST_MODE]
- if not (mod & 0o100):
- continue
- relpath = path[len(self.bundlepath):]
- self.message("Stripping %s" % relpath, 2)
- inf, outf = os.popen4("%s -S \"%s\"" %
- (STRIP_EXEC, path))
- output = outf.read().strip()
- if output:
- # usually not a real problem, like when we're
- # trying to strip a script
- self.message("Problem stripping %s:" % relpath, 3)
- self.message(output, 3)
- walk(self.bundlepath)
-
- def findDependencies(self):
- self.message("Finding module dependencies", 1)
- import modulefinder
- mf = modulefinder.ModuleFinder(excludes=self.excludeModules)
- if USE_ZIPIMPORT:
- # zipimport imports zlib, must add it manually
- mf.import_hook("zlib")
- # manually add our own site.py
- site = mf.add_module("site")
- site.__code__ = self._getSiteCode()
- mf.scan_code(site.__code__, site)
-
- # warnings.py gets imported implicitly from C
- mf.import_hook("warnings")
-
- includeModules = self.includeModules[:]
- for name in self.includePackages:
- includeModules.extend(list(findPackageContents(name).keys()))
- for name in includeModules:
- try:
- mf.import_hook(name)
- except ImportError:
- self.missingModules.append(name)
-
- mf.run_script(self.mainprogram)
- modules = list(mf.modules.items())
- modules.sort()
- for name, mod in modules:
- path = mod.__file__
- if path and self.semi_standalone:
- # skip the standard library
- if path.startswith(LIB) and not path.startswith(SITE_PACKAGES):
- continue
- if path and mod.__code__ is None:
- # C extension
- filename = os.path.basename(path)
- pathitems = name.split(".")[:-1] + [filename]
- dstpath = pathjoin(*pathitems)
- if USE_ZIPIMPORT:
- if name != "zlib":
- # neatly pack all extension modules in a subdirectory,
- # except zlib, since it's necessary for bootstrapping.
- dstpath = pathjoin("ExtensionModules", dstpath)
- # Python modules are stored in a Zip archive, but put
- # extensions in Contents/Resources/. Add a tiny "loader"
- # program in the Zip archive. Due to Thomas Heller.
- source = EXT_LOADER % {"name": name, "filename": dstpath}
- code = compile(source, "<dynloader for %s>" % name, "exec")
- mod.__code__ = code
- self.files.append((path, pathjoin("Contents", "Resources", dstpath)))
- if mod.__code__ is not None:
- ispkg = mod.__path__ is not None
- if not USE_ZIPIMPORT or name != "site":
- # Our site.py is doing the bootstrapping, so we must
- # include a real .pyc file if USE_ZIPIMPORT is True.
- self.pymodules.append((name, mod.__code__, ispkg))
-
- if hasattr(mf, "any_missing_maybe"):
- missing, maybe = mf.any_missing_maybe()
- else:
- missing = mf.any_missing()
- maybe = []
- self.missingModules.extend(missing)
- self.maybeMissingModules.extend(maybe)
-
- def reportMissing(self):
- missing = [name for name in self.missingModules
- if name not in MAYMISS_MODULES]
- if self.maybeMissingModules:
- maybe = self.maybeMissingModules
- else:
- maybe = [name for name in missing if "." in name]
- missing = [name for name in missing if "." not in name]
- missing.sort()
- maybe.sort()
- if maybe:
- self.message("Warning: couldn't find the following submodules:", 1)
- self.message(" (Note that these could be false alarms -- "
- "it's not always", 1)
- self.message(" possible to distinguish between \"from package "
- "import submodule\" ", 1)
- self.message(" and \"from package import name\")", 1)
- for name in maybe:
- self.message(" ? " + name, 1)
- if missing:
- self.message("Warning: couldn't find the following modules:", 1)
- for name in missing:
- self.message(" ? " + name, 1)
-
- def report(self):
- # XXX something decent
- import pprint
- pprint.pprint(self.__dict__)
- if self.standalone or self.semi_standalone:
- self.reportMissing()
-
-#
-# Utilities.
-#
-
-SUFFIXES = [_suf for _suf, _mode, _tp in imp.get_suffixes()]
-identifierRE = re.compile(r"[_a-zA-z][_a-zA-Z0-9]*$")
-
-def findPackageContents(name, searchpath=None):
- head = name.split(".")[-1]
- if identifierRE.match(head) is None:
- return {}
- try:
- fp, path, (ext, mode, tp) = imp.find_module(head, searchpath)
- except ImportError:
- return {}
- modules = {name: None}
- if tp == imp.PKG_DIRECTORY and path:
- files = os.listdir(path)
- for sub in files:
- sub, ext = os.path.splitext(sub)
- fullname = name + "." + sub
- if sub != "__init__" and fullname not in modules:
- modules.update(findPackageContents(fullname, [path]))
- return modules
-
-def writePyc(code, path):
- f = open(path, "wb")
- f.write(MAGIC)
- f.write("\0" * 4) # don't bother about a time stamp
- marshal.dump(code, f)
- f.close()
-
-def copy(src, dst, mkdirs=0):
- """Copy a file or a directory."""
- if mkdirs:
- makedirs(os.path.dirname(dst))
- if os.path.isdir(src):
- shutil.copytree(src, dst, symlinks=1)
- else:
- shutil.copy2(src, dst)
-
-def copytodir(src, dstdir):
- """Copy a file or a directory to an existing directory."""
- dst = pathjoin(dstdir, os.path.basename(src))
- copy(src, dst)
-
-def makedirs(dir):
- """Make all directories leading up to 'dir' including the leaf
- directory. Don't moan if any path element already exists."""
- try:
- os.makedirs(dir)
- except OSError as why:
- if why.errno != errno.EEXIST:
- raise
-
-def symlink(src, dst, mkdirs=0):
- """Copy a file or a directory."""
- if not os.path.exists(src):
- raise IOError("No such file or directory: '%s'" % src)
- if mkdirs:
- makedirs(os.path.dirname(dst))
- os.symlink(os.path.abspath(src), dst)
-
-def pathjoin(*args):
- """Safe wrapper for os.path.join: asserts that all but the first
- argument are relative paths."""
- for seg in args[1:]:
- assert seg[0] != "/"
- return os.path.join(*args)
-
-
-cmdline_doc = """\
-Usage:
- python bundlebuilder.py [options] command
- python mybuildscript.py [options] command
-
-Commands:
- build build the application
- report print a report
-
-Options:
- -b, --builddir=DIR the build directory; defaults to "build"
- -n, --name=NAME application name
- -r, --resource=FILE extra file or folder to be copied to Resources
- -f, --file=SRC:DST extra file or folder to be copied into the bundle;
- DST must be a path relative to the bundle root
- -e, --executable=FILE the executable to be used
- -m, --mainprogram=FILE the Python main program
- -a, --argv add a wrapper main program to create sys.argv
- -p, --plist=FILE .plist file (default: generate one)
- --nib=NAME main nib name
- -c, --creator=CCCC 4-char creator code (default: '????')
- --iconfile=FILE filename of the icon (an .icns file) to be used
- as the Finder icon
- --bundle-id=ID the CFBundleIdentifier, in reverse-dns format
- (eg. org.python.BuildApplet; this is used for
- the preferences file name)
- -l, --link symlink files/folder instead of copying them
- --link-exec symlink the executable instead of copying it
- --standalone build a standalone application, which is fully
- independent of a Python installation
- --semi-standalone build a standalone application, which depends on
- an installed Python, yet includes all third-party
- modules.
- --python=FILE Python to use in #! line in stead of current Python
- --lib=FILE shared library or framework to be copied into
- the bundle
- -x, --exclude=MODULE exclude module (with --(semi-)standalone)
- -i, --include=MODULE include module (with --(semi-)standalone)
- --package=PACKAGE include a whole package (with --(semi-)standalone)
- --strip strip binaries (remove debug info)
- -v, --verbose increase verbosity level
- -q, --quiet decrease verbosity level
- -h, --help print this message
-"""
-
-def usage(msg=None):
- if msg:
- print(msg)
- print(cmdline_doc)
- sys.exit(1)
-
-def main(builder=None):
- if builder is None:
- builder = AppBuilder(verbosity=1)
-
- shortopts = "b:n:r:f:e:m:c:p:lx:i:hvqa"
- longopts = ("builddir=", "name=", "resource=", "file=", "executable=",
- "mainprogram=", "creator=", "nib=", "plist=", "link",
- "link-exec", "help", "verbose", "quiet", "argv", "standalone",
- "exclude=", "include=", "package=", "strip", "iconfile=",
- "lib=", "python=", "semi-standalone", "bundle-id=", "destroot=")
-
- try:
- options, args = getopt.getopt(sys.argv[1:], shortopts, longopts)
- except getopt.error:
- usage()
-
- for opt, arg in options:
- if opt in ('-b', '--builddir'):
- builder.builddir = arg
- elif opt in ('-n', '--name'):
- builder.name = arg
- elif opt in ('-r', '--resource'):
- builder.resources.append(os.path.normpath(arg))
- elif opt in ('-f', '--file'):
- srcdst = arg.split(':')
- if len(srcdst) != 2:
- usage("-f or --file argument must be two paths, "
- "separated by a colon")
- builder.files.append(srcdst)
- elif opt in ('-e', '--executable'):
- builder.executable = arg
- elif opt in ('-m', '--mainprogram'):
- builder.mainprogram = arg
- elif opt in ('-a', '--argv'):
- builder.argv_emulation = 1
- elif opt in ('-c', '--creator'):
- builder.creator = arg
- elif opt == '--bundle-id':
- builder.bundle_id = arg
- elif opt == '--iconfile':
- builder.iconfile = arg
- elif opt == "--lib":
- builder.libs.append(os.path.normpath(arg))
- elif opt == "--nib":
- builder.nibname = arg
- elif opt in ('-p', '--plist'):
- builder.plist = Plist.fromFile(arg)
- elif opt in ('-l', '--link'):
- builder.symlink = 1
- elif opt == '--link-exec':
- builder.symlink_exec = 1
- elif opt in ('-h', '--help'):
- usage()
- elif opt in ('-v', '--verbose'):
- builder.verbosity += 1
- elif opt in ('-q', '--quiet'):
- builder.verbosity -= 1
- elif opt == '--standalone':
- builder.standalone = 1
- elif opt == '--semi-standalone':
- builder.semi_standalone = 1
- elif opt == '--python':
- builder.python = arg
- elif opt in ('-x', '--exclude'):
- builder.excludeModules.append(arg)
- elif opt in ('-i', '--include'):
- builder.includeModules.append(arg)
- elif opt == '--package':
- builder.includePackages.append(arg)
- elif opt == '--strip':
- builder.strip = 1
- elif opt == '--destroot':
- builder.destroot = arg
-
- if len(args) != 1:
- usage("Must specify one command ('build', 'report' or 'help')")
- command = args[0]
-
- if command == "build":
- builder.setup()
- builder.build()
- elif command == "report":
- builder.setup()
- builder.report()
- elif command == "help":
- usage()
- else:
- usage("Unknown command '%s'" % command)
-
-
-def buildapp(**kwargs):
- builder = AppBuilder(**kwargs)
- main(builder)
-
-
-if __name__ == "__main__":
- main()
diff --git a/Mac/Tools/fixapplepython23.py b/Mac/Tools/fixapplepython23.py
index 18b95b34f7..03c799b567 100644
--- a/Mac/Tools/fixapplepython23.py
+++ b/Mac/Tools/fixapplepython23.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
"""fixapplepython23 - Fix Apple-installed Python 2.3 (on Mac OS X 10.3)
Python 2.3 (and 2.3.X for X<5) have the problem that building an extension
@@ -14,7 +14,7 @@ status also when nothing needs to be fixed.
"""
import sys
import os
-import platform
+import gestalt
MAKEFILE='/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/config/Makefile'
CHANGES=((
@@ -57,35 +57,35 @@ def fix(makefile, do_apply):
continue
i = findline(lines, old)
if i < 0:
- print('fixapplepython23: Python installation not fixed (appears broken)')
- print('fixapplepython23: missing line:', old)
+ print 'fixapplepython23: Python installation not fixed (appears broken)'
+ print 'fixapplepython23: missing line:', old
return 2
lines[i] = new
fixed = True
if fixed:
if do_apply:
- print('fixapplepython23: Fix to Apple-installed Python 2.3 applied')
+ print 'fixapplepython23: Fix to Apple-installed Python 2.3 applied'
os.rename(makefile, makefile + '~')
open(makefile, 'w').writelines(lines)
return 0
else:
- print('fixapplepython23: Fix to Apple-installed Python 2.3 should be applied')
+ print 'fixapplepython23: Fix to Apple-installed Python 2.3 should be applied'
return 1
else:
- print('fixapplepython23: No fix needed, appears to have been applied before')
+ print 'fixapplepython23: No fix needed, appears to have been applied before'
return 0
def makescript(filename, compiler):
"""Create a wrapper script for a compiler"""
dirname = os.path.split(filename)[0]
if not os.access(dirname, os.X_OK):
- os.mkdir(dirname, 0o755)
+ os.mkdir(dirname, 0755)
fp = open(filename, 'w')
fp.write(SCRIPT % compiler)
fp.close()
- os.chmod(filename, 0o755)
- print('fixapplepython23: Created', filename)
+ os.chmod(filename, 0755)
+ print 'fixapplepython23: Created', filename
def main():
# Check for -n option
@@ -96,25 +96,24 @@ def main():
# First check OS version
if sys.byteorder == 'little':
# All intel macs are fine
- print("fixapplypython23: no fix is needed on MacOSX on Intel")
+ print "fixapplypython23: no fix is needed on MacOSX on Intel"
sys.exit(0)
- osver = platform.mac_ver()
- if osver != '10.3' and os.ver < '10.3.':
- print('fixapplepython23: no fix needed on MacOSX < 10.3')
+ if gestalt.gestalt('sysv') < 0x1030:
+ print 'fixapplepython23: no fix needed on MacOSX < 10.3'
sys.exit(0)
- if osver >= '10.4':
- print('fixapplepython23: no fix needed on MacOSX >= 10.4')
+ if gestalt.gestalt('sysv') >= 0x1040:
+ print 'fixapplepython23: no fix needed on MacOSX >= 10.4'
sys.exit(0)
# Test that a framework Python is indeed installed
if not os.path.exists(MAKEFILE):
- print('fixapplepython23: Python framework does not appear to be installed (?), nothing fixed')
+ print 'fixapplepython23: Python framework does not appear to be installed (?), nothing fixed'
sys.exit(0)
# Check that we can actually write the file
if do_apply and not os.access(MAKEFILE, os.W_OK):
- print('fixapplepython23: No write permission, please run with "sudo"')
+ print 'fixapplepython23: No write permission, please run with "sudo"'
sys.exit(2)
# Create the shell scripts
if do_apply:
diff --git a/Mac/Tools/pythonw.c b/Mac/Tools/pythonw.c
index 0b2fafc68a..76734c1063 100644
--- a/Mac/Tools/pythonw.c
+++ b/Mac/Tools/pythonw.c
@@ -10,7 +10,6 @@
* On OSX 10.4 (and earlier) this falls back to using exec because the
* posix_spawnv functions aren't available there.
*/
-
#pragma weak_import posix_spawnattr_init
#pragma weak_import posix_spawnattr_setbinpref_np
#pragma weak_import posix_spawnattr_setflags
@@ -27,7 +26,6 @@
#include <err.h>
#include <dlfcn.h>
#include <stdlib.h>
-#include <Python.h>
extern char** environ;
@@ -105,8 +103,8 @@ setup_spawnattr(posix_spawnattr_t* spawnattr)
count = 1;
- /* Run the real python executable using the same architure as this
- * executable, this allows users to controle the architecture using
+ /* Run the real python executable using the same architecture as this
+ * executable, this allows users to control the architecture using
* "arch -ppc python"
*/
@@ -160,12 +158,14 @@ main(int argc, char **argv) {
argv[0] = exec_path;
#ifdef HAVE_SPAWN_H
+
/* We're weak-linking to posix-spawnv to ensure that
* an executable build on 10.5 can work on 10.4.
*/
if (posix_spawn != NULL) {
posix_spawnattr_t spawnattr = NULL;
+
setup_spawnattr(&spawnattr);
posix_spawn(NULL, exec_path, NULL,
&spawnattr, argv, environ);
diff --git a/Mac/scripts/BuildApplet.icns b/Mac/scripts/BuildApplet.icns
new file mode 100644
index 0000000000..ea0214c674
--- /dev/null
+++ b/Mac/scripts/BuildApplet.icns
Binary files differ
diff --git a/Mac/scripts/BuildApplet.plist b/Mac/scripts/BuildApplet.plist
new file mode 100644
index 0000000000..0f142c9eb5
--- /dev/null
+++ b/Mac/scripts/BuildApplet.plist
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleDocumentTypes</key>
+ <array>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>py</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>PythonSource.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>Python Module</string>
+ <key>CFBundleTypeOSTypes</key>
+ <array>
+ <string>TEXT</string>
+ </array>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ </array>
+ <key>CFBundleExecutable</key>
+ <string>BuildApplet</string>
+ <key>CFBundleGetInfoString</key>
+ <string>2.5alpha0, (c) 2004 Python Software Foundation.</string>
+ <key>CFBundleIconFile</key>
+ <string>BuildApplet.icns</string>
+ <key>CFBundleIdentifier</key>
+ <string>org.python.buildapplet</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleLongVersionString</key>
+ <string>2.5alpha0, (c) 2004 Python Software Foundation.</string>
+ <key>CFBundleName</key>
+ <string>PythonIDE</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>2.5alpha0</string>
+ <key>CFBundleSignature</key>
+ <string>Pide</string>
+ <key>CFBundleVersion</key>
+ <string>2.5alpha0</string>
+ <key>CSResourcesFileMapped</key>
+ <true/>
+ <key>LSRequiresCarbon</key>
+ <true/>
+ <key>NSHumanReadableCopyright</key>
+ <string>(c) 2004 Python Software Foundation.</string>
+</dict>
+</plist>
diff --git a/Mac/scripts/BuildApplet.py b/Mac/scripts/BuildApplet.py
new file mode 100644
index 0000000000..a76ed90872
--- /dev/null
+++ b/Mac/scripts/BuildApplet.py
@@ -0,0 +1,156 @@
+"""Create an applet from a Python script.
+
+This puts up a dialog asking for a Python source file ('TEXT').
+The output is a file with the same name but its ".py" suffix dropped.
+It is created by copying an applet template and then adding a 'PYC '
+resource named __main__ containing the compiled, marshalled script.
+"""
+
+
+import sys
+sys.stdout = sys.stderr
+
+import os
+import MacOS
+try:
+ import EasyDialogs
+except ImportError:
+ EasyDialogs = None
+import buildtools
+import getopt
+
+if not sys.executable.startswith(sys.exec_prefix):
+ # Oh, the joys of using a python script to bootstrap applicatin bundles
+ # sys.executable points inside the current application bundle. Because this
+ # path contains blanks (two of them actually) this path isn't usable on
+ # #! lines. Reset sys.executable to point to the embedded python interpreter
+ sys.executable = os.path.join(sys.prefix,
+ 'Resources/Python.app/Contents/MacOS/Python')
+
+ # Just in case we're not in a framework:
+ if not os.path.exists(sys.executable):
+ sys.executable = os.path.join(sys.exec_prefix, 'bin/python')
+
+def main():
+ try:
+ buildapplet()
+ except buildtools.BuildError, detail:
+ if EasyDialogs is None:
+ print detail
+ else:
+ EasyDialogs.Message(detail)
+
+
+def buildapplet():
+ buildtools.DEBUG=1
+
+ # Find the template
+ # (there's no point in proceeding if we can't find it)
+
+ template = buildtools.findtemplate()
+
+ # Ask for source text if not specified in sys.argv[1:]
+
+ if not sys.argv[1:]:
+ if EasyDialogs is None:
+ usage()
+ sys.exit(1)
+
+ filename = EasyDialogs.AskFileForOpen(message='Select Python source or applet:',
+ typeList=('TEXT', 'APPL'))
+ if not filename:
+ return
+ tp, tf = os.path.split(filename)
+ if tf[-3:] == '.py':
+ tf = tf[:-3]
+ else:
+ tf = tf + '.applet'
+ dstfilename = EasyDialogs.AskFileForSave(message='Save application as:',
+ savedFileName=tf)
+ if not dstfilename: return
+ cr, tp = MacOS.GetCreatorAndType(filename)
+ if tp == 'APPL':
+ buildtools.update(template, filename, dstfilename)
+ else:
+ buildtools.process(template, filename, dstfilename, 1)
+ else:
+
+ SHORTOPTS = "o:r:ne:v?PR"
+ LONGOPTS=("output=", "resource=", "noargv", "extra=", "verbose", "help", "python=", "destroot=")
+ try:
+ options, args = getopt.getopt(sys.argv[1:], SHORTOPTS, LONGOPTS)
+ except getopt.error:
+ usage()
+ if options and len(args) > 1:
+ sys.stderr.write("Cannot use options when specifying multiple input files")
+ sys.exit(1)
+ dstfilename = None
+ rsrcfilename = None
+ raw = 0
+ extras = []
+ verbose = None
+ destroot = ''
+ for opt, arg in options:
+ if opt in ('-o', '--output'):
+ dstfilename = arg
+ elif opt in ('-r', '--resource'):
+ rsrcfilename = arg
+ elif opt in ('-n', '--noargv'):
+ raw = 1
+ elif opt in ('-e', '--extra'):
+ if ':' in arg:
+ arg = arg.split(':')
+ extras.append(arg)
+ elif opt in ('-P', '--python'):
+ # This is a very dirty trick. We set sys.executable
+ # so that bundlebuilder will use this in the #! line
+ # for the applet bootstrap.
+ sys.executable = arg
+ elif opt in ('-v', '--verbose'):
+ verbose = Verbose()
+ elif opt in ('-?', '--help'):
+ usage()
+ elif opt in ('-d', '--destroot'):
+ destroot = arg
+ # Loop over all files to be processed
+ for filename in args:
+ cr, tp = MacOS.GetCreatorAndType(filename)
+ if tp == 'APPL':
+ buildtools.update(template, filename, dstfilename)
+ else:
+ buildtools.process(template, filename, dstfilename, 1,
+ rsrcname=rsrcfilename, others=extras, raw=raw,
+ progress=verbose, destroot=destroot)
+
+def usage():
+ print "BuildApplet creates an application from a Python source file"
+ print "Usage:"
+ print " BuildApplet interactive, single file, no options"
+ print " BuildApplet src1.py src2.py ... non-interactive multiple file"
+ print " BuildApplet [options] src.py non-interactive single file"
+ print "Options:"
+ print " --output o Output file; default based on source filename, short -o"
+ print " --resource r Resource file; default based on source filename, short -r"
+ print " --noargv Build applet without drag-and-drop sys.argv emulation, short -n, OSX only"
+ print " --extra src[:dst] Extra file to put in .app bundle, short -e, OSX only"
+ print " --verbose Verbose, short -v"
+ print " --help This message, short -?"
+ sys.exit(1)
+
+class Verbose:
+ """This class mimics EasyDialogs.ProgressBar but prints to stderr"""
+ def __init__(self, *args):
+ if args and args[0]:
+ self.label(args[0])
+
+ def set(self, *args):
+ pass
+
+ def inc(self, *args):
+ pass
+
+ def label(self, str):
+ sys.stderr.write(str+'\n')
+
+if __name__ == '__main__':
+ main()
diff --git a/Mac/scripts/BuildApplet.rsrc b/Mac/scripts/BuildApplet.rsrc
new file mode 100644
index 0000000000..edabc61779
--- /dev/null
+++ b/Mac/scripts/BuildApplet.rsrc
Binary files differ
diff --git a/Mac/scripts/bgenall.py b/Mac/scripts/bgenall.py
new file mode 100644
index 0000000000..1fe5f34af0
--- /dev/null
+++ b/Mac/scripts/bgenall.py
@@ -0,0 +1,56 @@
+# bgenall - Generate all bgen-generated modules
+#
+import sys
+import os
+import string
+
+def bgenone(dirname, shortname):
+ os.chdir(dirname)
+ print '%s:'%shortname
+ # Sigh, we don't want to lose CVS history, so two
+ # modules have funny names:
+ if shortname == 'carbonevt':
+ modulename = 'CarbonEvtscan'
+ elif shortname == 'ibcarbon':
+ modulename = 'IBCarbonscan'
+ else:
+ modulename = shortname + 'scan'
+ try:
+ m = __import__(modulename)
+ except:
+ print "Error:", shortname, sys.exc_info()[1]
+ return 0
+ try:
+ m.main()
+ except:
+ print "Error:", shortname, sys.exc_info()[1]
+ return 0
+ return 1
+
+def main():
+ success = []
+ failure = []
+ sys.path.insert(0, os.curdir)
+ if len(sys.argv) > 1:
+ srcdir = sys.argv[1]
+ else:
+ srcdir = os.path.join(os.path.join(sys.prefix, 'Mac'), 'Modules')
+ srcdir = os.path.abspath(srcdir)
+ contents = os.listdir(srcdir)
+ for name in contents:
+ moduledir = os.path.join(srcdir, name)
+ scanmodule = os.path.join(moduledir, name +'scan.py')
+ if os.path.exists(scanmodule):
+ if bgenone(moduledir, name):
+ success.append(name)
+ else:
+ failure.append(name)
+ print 'Done:', string.join(success, ' ')
+ if failure:
+ print 'Failed:', string.join(failure, ' ')
+ return 0
+ return 1
+
+if __name__ == '__main__':
+ rv = main()
+ sys.exit(not rv)
diff --git a/Mac/scripts/buildpkg.py b/Mac/scripts/buildpkg.py
new file mode 100644
index 0000000000..ed5c88f6cb
--- /dev/null
+++ b/Mac/scripts/buildpkg.py
@@ -0,0 +1,484 @@
+#!/usr/bin/env python
+
+"""buildpkg.py -- Build OS X packages for Apple's Installer.app.
+
+This is an experimental command-line tool for building packages to be
+installed with the Mac OS X Installer.app application.
+
+It is much inspired by Apple's GUI tool called PackageMaker.app, that
+seems to be part of the OS X developer tools installed in the folder
+/Developer/Applications. But apparently there are other free tools to
+do the same thing which are also named PackageMaker like Brian Hill's
+one:
+
+ http://personalpages.tds.net/~brian_hill/packagemaker.html
+
+Beware of the multi-package features of Installer.app (which are not
+yet supported here) that can potentially screw-up your installation
+and are discussed in these articles on Stepwise:
+
+ http://www.stepwise.com/Articles/Technical/Packages/InstallerWoes.html
+ http://www.stepwise.com/Articles/Technical/Packages/InstallerOnX.html
+
+Beside using the PackageMaker class directly, by importing it inside
+another module, say, there are additional ways of using this module:
+the top-level buildPackage() function provides a shortcut to the same
+feature and is also called when using this module from the command-
+line.
+
+ ****************************************************************
+ NOTE: For now you should be able to run this even on a non-OS X
+ system and get something similar to a package, but without
+ the real archive (needs pax) and bom files (needs mkbom)
+ inside! This is only for providing a chance for testing to
+ folks without OS X.
+ ****************************************************************
+
+TODO:
+ - test pre-process and post-process scripts (Python ones?)
+ - handle multi-volume packages (?)
+ - integrate into distutils (?)
+
+Dinu C. Gherman,
+gherman@europemail.com
+November 2001
+
+!! USE AT YOUR OWN RISK !!
+"""
+
+__version__ = 0.2
+__license__ = "FreeBSD"
+
+
+import os, sys, glob, fnmatch, shutil, string, copy, getopt
+from os.path import basename, dirname, join, islink, isdir, isfile
+
+Error = "buildpkg.Error"
+
+PKG_INFO_FIELDS = """\
+Title
+Version
+Description
+DefaultLocation
+DeleteWarning
+NeedsAuthorization
+DisableStop
+UseUserMask
+Application
+Relocatable
+Required
+InstallOnly
+RequiresReboot
+RootVolumeOnly
+LongFilenames
+LibrarySubdirectory
+AllowBackRev
+OverwritePermissions
+InstallFat\
+"""
+
+######################################################################
+# Helpers
+######################################################################
+
+# Convenience class, as suggested by /F.
+
+class GlobDirectoryWalker:
+ "A forward iterator that traverses files in a directory tree."
+
+ def __init__(self, directory, pattern="*"):
+ self.stack = [directory]
+ self.pattern = pattern
+ self.files = []
+ self.index = 0
+
+
+ def __getitem__(self, index):
+ while 1:
+ try:
+ file = self.files[self.index]
+ self.index = self.index + 1
+ except IndexError:
+ # pop next directory from stack
+ self.directory = self.stack.pop()
+ self.files = os.listdir(self.directory)
+ self.index = 0
+ else:
+ # got a filename
+ fullname = join(self.directory, file)
+ if isdir(fullname) and not islink(fullname):
+ self.stack.append(fullname)
+ if fnmatch.fnmatch(file, self.pattern):
+ return fullname
+
+
+######################################################################
+# The real thing
+######################################################################
+
+class PackageMaker:
+ """A class to generate packages for Mac OS X.
+
+ This is intended to create OS X packages (with extension .pkg)
+ containing archives of arbitrary files that the Installer.app
+ will be able to handle.
+
+ As of now, PackageMaker instances need to be created with the
+ title, version and description of the package to be built.
+ The package is built after calling the instance method
+ build(root, **options). It has the same name as the constructor's
+ title argument plus a '.pkg' extension and is located in the same
+ parent folder that contains the root folder.
+
+ E.g. this will create a package folder /my/space/distutils.pkg/:
+
+ pm = PackageMaker("distutils", "1.0.2", "Python distutils.")
+ pm.build("/my/space/distutils")
+ """
+
+ packageInfoDefaults = {
+ 'Title': None,
+ 'Version': None,
+ 'Description': '',
+ 'DefaultLocation': '/',
+ 'DeleteWarning': '',
+ 'NeedsAuthorization': 'NO',
+ 'DisableStop': 'NO',
+ 'UseUserMask': 'YES',
+ 'Application': 'NO',
+ 'Relocatable': 'YES',
+ 'Required': 'NO',
+ 'InstallOnly': 'NO',
+ 'RequiresReboot': 'NO',
+ 'RootVolumeOnly' : 'NO',
+ 'InstallFat': 'NO',
+ 'LongFilenames': 'YES',
+ 'LibrarySubdirectory': 'Standard',
+ 'AllowBackRev': 'YES',
+ 'OverwritePermissions': 'NO',
+ }
+
+
+ def __init__(self, title, version, desc):
+ "Init. with mandatory title/version/description arguments."
+
+ info = {"Title": title, "Version": version, "Description": desc}
+ self.packageInfo = copy.deepcopy(self.packageInfoDefaults)
+ self.packageInfo.update(info)
+
+ # variables set later
+ self.packageRootFolder = None
+ self.packageResourceFolder = None
+ self.sourceFolder = None
+ self.resourceFolder = None
+
+
+ def build(self, root, resources=None, **options):
+ """Create a package for some given root folder.
+
+ With no 'resources' argument set it is assumed to be the same
+ as the root directory. Option items replace the default ones
+ in the package info.
+ """
+
+ # set folder attributes
+ self.sourceFolder = root
+ if resources is None:
+ self.resourceFolder = root
+ else:
+ self.resourceFolder = resources
+
+ # replace default option settings with user ones if provided
+ fields = self. packageInfoDefaults.keys()
+ for k, v in options.items():
+ if k in fields:
+ self.packageInfo[k] = v
+ elif not k in ["OutputDir"]:
+ raise Error, "Unknown package option: %s" % k
+
+ # Check where we should leave the output. Default is current directory
+ outputdir = options.get("OutputDir", os.getcwd())
+ packageName = self.packageInfo["Title"]
+ self.PackageRootFolder = os.path.join(outputdir, packageName + ".pkg")
+
+ # do what needs to be done
+ self._makeFolders()
+ self._addInfo()
+ self._addBom()
+ self._addArchive()
+ self._addResources()
+ self._addSizes()
+ self._addLoc()
+
+
+ def _makeFolders(self):
+ "Create package folder structure."
+
+ # Not sure if the package name should contain the version or not...
+ # packageName = "%s-%s" % (self.packageInfo["Title"],
+ # self.packageInfo["Version"]) # ??
+
+ contFolder = join(self.PackageRootFolder, "Contents")
+ self.packageResourceFolder = join(contFolder, "Resources")
+ os.mkdir(self.PackageRootFolder)
+ os.mkdir(contFolder)
+ os.mkdir(self.packageResourceFolder)
+
+ def _addInfo(self):
+ "Write .info file containing installing options."
+
+ # Not sure if options in PKG_INFO_FIELDS are complete...
+
+ info = ""
+ for f in string.split(PKG_INFO_FIELDS, "\n"):
+ if self.packageInfo.has_key(f):
+ info = info + "%s %%(%s)s\n" % (f, f)
+ info = info % self.packageInfo
+ base = self.packageInfo["Title"] + ".info"
+ path = join(self.packageResourceFolder, base)
+ f = open(path, "w")
+ f.write(info)
+
+
+ def _addBom(self):
+ "Write .bom file containing 'Bill of Materials'."
+
+ # Currently ignores if the 'mkbom' tool is not available.
+
+ try:
+ base = self.packageInfo["Title"] + ".bom"
+ bomPath = join(self.packageResourceFolder, base)
+ cmd = "mkbom %s %s" % (self.sourceFolder, bomPath)
+ res = os.system(cmd)
+ except:
+ pass
+
+
+ def _addArchive(self):
+ "Write .pax.gz file, a compressed archive using pax/gzip."
+
+ # Currently ignores if the 'pax' tool is not available.
+
+ cwd = os.getcwd()
+
+ # create archive
+ os.chdir(self.sourceFolder)
+ base = basename(self.packageInfo["Title"]) + ".pax"
+ self.archPath = join(self.packageResourceFolder, base)
+ cmd = "pax -w -f %s %s" % (self.archPath, ".")
+ res = os.system(cmd)
+
+ # compress archive
+ cmd = "gzip %s" % self.archPath
+ res = os.system(cmd)
+ os.chdir(cwd)
+
+
+ def _addResources(self):
+ "Add Welcome/ReadMe/License files, .lproj folders and scripts."
+
+ # Currently we just copy everything that matches the allowed
+ # filenames. So, it's left to Installer.app to deal with the
+ # same file available in multiple formats...
+
+ if not self.resourceFolder:
+ return
+
+ # find candidate resource files (txt html rtf rtfd/ or lproj/)
+ allFiles = []
+ for pat in string.split("*.txt *.html *.rtf *.rtfd *.lproj", " "):
+ pattern = join(self.resourceFolder, pat)
+ allFiles = allFiles + glob.glob(pattern)
+
+ # find pre-process and post-process scripts
+ # naming convention: packageName.{pre,post}_{upgrade,install}
+ # Alternatively the filenames can be {pre,post}_{upgrade,install}
+ # in which case we prepend the package name
+ packageName = self.packageInfo["Title"]
+ for pat in ("*upgrade", "*install", "*flight"):
+ pattern = join(self.resourceFolder, packageName + pat)
+ pattern2 = join(self.resourceFolder, pat)
+ allFiles = allFiles + glob.glob(pattern)
+ allFiles = allFiles + glob.glob(pattern2)
+
+ # check name patterns
+ files = []
+ for f in allFiles:
+ for s in ("Welcome", "License", "ReadMe"):
+ if string.find(basename(f), s) == 0:
+ files.append((f, f))
+ if f[-6:] == ".lproj":
+ files.append((f, f))
+ elif basename(f) in ["pre_upgrade", "pre_install", "post_upgrade", "post_install"]:
+ files.append((f, packageName+"."+basename(f)))
+ elif basename(f) in ["preflight", "postflight"]:
+ files.append((f, f))
+ elif f[-8:] == "_upgrade":
+ files.append((f,f))
+ elif f[-8:] == "_install":
+ files.append((f,f))
+
+ # copy files
+ for src, dst in files:
+ src = basename(src)
+ dst = basename(dst)
+ f = join(self.resourceFolder, src)
+ if isfile(f):
+ shutil.copy(f, os.path.join(self.packageResourceFolder, dst))
+ elif isdir(f):
+ # special case for .rtfd and .lproj folders...
+ d = join(self.packageResourceFolder, dst)
+ os.mkdir(d)
+ files = GlobDirectoryWalker(f)
+ for file in files:
+ shutil.copy(file, d)
+
+
+ def _addSizes(self):
+ "Write .sizes file with info about number and size of files."
+
+ # Not sure if this is correct, but 'installedSize' and
+ # 'zippedSize' are now in Bytes. Maybe blocks are needed?
+ # Well, Installer.app doesn't seem to care anyway, saying
+ # the installation needs 100+ MB...
+
+ numFiles = 0
+ installedSize = 0
+ zippedSize = 0
+
+ files = GlobDirectoryWalker(self.sourceFolder)
+ for f in files:
+ numFiles = numFiles + 1
+ installedSize = installedSize + os.lstat(f)[6]
+
+ try:
+ zippedSize = os.stat(self.archPath+ ".gz")[6]
+ except OSError: # ignore error
+ pass
+ base = self.packageInfo["Title"] + ".sizes"
+ f = open(join(self.packageResourceFolder, base), "w")
+ format = "NumFiles %d\nInstalledSize %d\nCompressedSize %d\n"
+ f.write(format % (numFiles, installedSize, zippedSize))
+
+ def _addLoc(self):
+ "Write .loc file."
+ base = self.packageInfo["Title"] + ".loc"
+ f = open(join(self.packageResourceFolder, base), "w")
+ f.write('/')
+
+# Shortcut function interface
+
+def buildPackage(*args, **options):
+ "A Shortcut function for building a package."
+
+ o = options
+ title, version, desc = o["Title"], o["Version"], o["Description"]
+ pm = PackageMaker(title, version, desc)
+ apply(pm.build, list(args), options)
+
+
+######################################################################
+# Tests
+######################################################################
+
+def test0():
+ "Vanilla test for the distutils distribution."
+
+ pm = PackageMaker("distutils2", "1.0.2", "Python distutils package.")
+ pm.build("/Users/dinu/Desktop/distutils2")
+
+
+def test1():
+ "Test for the reportlab distribution with modified options."
+
+ pm = PackageMaker("reportlab", "1.10",
+ "ReportLab's Open Source PDF toolkit.")
+ pm.build(root="/Users/dinu/Desktop/reportlab",
+ DefaultLocation="/Applications/ReportLab",
+ Relocatable="YES")
+
+def test2():
+ "Shortcut test for the reportlab distribution with modified options."
+
+ buildPackage(
+ "/Users/dinu/Desktop/reportlab",
+ Title="reportlab",
+ Version="1.10",
+ Description="ReportLab's Open Source PDF toolkit.",
+ DefaultLocation="/Applications/ReportLab",
+ Relocatable="YES")
+
+
+######################################################################
+# Command-line interface
+######################################################################
+
+def printUsage():
+ "Print usage message."
+
+ format = "Usage: %s <opts1> [<opts2>] <root> [<resources>]"
+ print format % basename(sys.argv[0])
+ print
+ print " with arguments:"
+ print " (mandatory) root: the package root folder"
+ print " (optional) resources: the package resources folder"
+ print
+ print " and options:"
+ print " (mandatory) opts1:"
+ mandatoryKeys = string.split("Title Version Description", " ")
+ for k in mandatoryKeys:
+ print " --%s" % k
+ print " (optional) opts2: (with default values)"
+
+ pmDefaults = PackageMaker.packageInfoDefaults
+ optionalKeys = pmDefaults.keys()
+ for k in mandatoryKeys:
+ optionalKeys.remove(k)
+ optionalKeys.sort()
+ maxKeyLen = max(map(len, optionalKeys))
+ for k in optionalKeys:
+ format = " --%%s:%s %%s"
+ format = format % (" " * (maxKeyLen-len(k)))
+ print format % (k, repr(pmDefaults[k]))
+
+
+def main():
+ "Command-line interface."
+
+ shortOpts = ""
+ keys = PackageMaker.packageInfoDefaults.keys()
+ longOpts = map(lambda k: k+"=", keys)
+
+ try:
+ opts, args = getopt.getopt(sys.argv[1:], shortOpts, longOpts)
+ except getopt.GetoptError, details:
+ print details
+ printUsage()
+ return
+
+ optsDict = {}
+ for k, v in opts:
+ optsDict[k[2:]] = v
+
+ ok = optsDict.keys()
+ if not (1 <= len(args) <= 2):
+ print "No argument given!"
+ elif not ("Title" in ok and \
+ "Version" in ok and \
+ "Description" in ok):
+ print "Missing mandatory option!"
+ else:
+ apply(buildPackage, args, optsDict)
+ return
+
+ printUsage()
+
+ # sample use:
+ # buildpkg.py --Title=distutils \
+ # --Version=1.0.2 \
+ # --Description="Python distutils package." \
+ # /Users/dinu/Desktop/distutils
+
+
+if __name__ == "__main__":
+ main()
diff --git a/Mac/scripts/cachersrc.py b/Mac/scripts/cachersrc.py
new file mode 100644
index 0000000000..e2eed8b270
--- /dev/null
+++ b/Mac/scripts/cachersrc.py
@@ -0,0 +1,44 @@
+# Scan the tree passed as argv[0] for .rsrc files, skipping .rsrc.df.rsrc
+# files, and open these. The effect of this is to create the .rsrc.df.rsrc
+# cache files if needed.
+# These are needed on OSX: the .rsrc files are in reality AppleSingle-encoded
+# files. We decode the resources into a datafork-based resource file.
+
+import macresource
+import os
+import sys
+import getopt
+
+class NoArgsError(Exception):
+ pass
+
+def handler((verbose, force), dirname, fnames):
+ for fn in fnames:
+ if fn[-5:] == '.rsrc' and fn[-13:] != '.rsrc.df.rsrc':
+ if force:
+ try:
+ os.unlink(os.path.join(dirname, fn + '.df.rsrc'))
+ except IOError:
+ pass
+ macresource.open_pathname(os.path.join(dirname, fn), verbose=verbose)
+
+def main():
+ try:
+ opts, args = getopt.getopt(sys.argv[1:], 'vf')
+ if not args:
+ raise NoArgsError
+ except (getopt.GetoptError, NoArgsError):
+ sys.stderr.write('Usage: cachersrc.py dirname ...\n')
+ sys.exit(1)
+ verbose = 0
+ force = 0
+ for o, v in opts:
+ if o == '-v':
+ verbose = 1
+ if o == '-f':
+ force = 1
+ for dir in sys.argv[1:]:
+ os.path.walk(dir, handler, (verbose, force))
+
+if __name__ == '__main__':
+ main()
diff --git a/Mac/scripts/errors.txt b/Mac/scripts/errors.txt
new file mode 100644
index 0000000000..0682e629f3
--- /dev/null
+++ b/Mac/scripts/errors.txt
@@ -0,0 +1,1852 @@
+-32768 svTempDisable svTempDisable
+-32640 svDisabled Reserve range -32640 to -32768 for Apple temp disables.
+-32615 fontNotOutlineErr bitmap font passed to routine that does outlines only
+-30788 kURL68kNotSupportedError kURL68kNotSupportedError
+-30787 kURLAccessNotAvailableError kURLAccessNotAvailableError
+-30786 kURLInvalidConfigurationError kURLInvalidConfigurationError
+-30785 kURLExtensionFailureError kURLExtensionFailureError
+-30783 kURLFileEmptyError kURLFileEmptyError
+-30781 kURLInvalidCallError kURLInvalidCallError
+-30780 kURLUnsettablePropertyError kURLUnsettablePropertyError
+-30779 kURLPropertyBufferTooSmallError kURLPropertyBufferTooSmallError
+-30778 kURLUnknownPropertyError kURLUnknownPropertyError
+-30777 kURLPropertyNotYetKnownError kURLPropertyNotYetKnownError
+-30776 kURLAuthenticationError kURLAuthenticationError
+-30775 kURLServerBusyError kURLServerBusyError
+-30774 kURLUnsupportedSchemeError kURLUnsupportedSchemeError
+-30773 kURLInvalidURLError kURLInvalidURLError
+-30772 kURLDestinationExistsError kURLDestinationExistsError
+-30771 kURLProgressAlreadyDisplayedError kURLProgressAlreadyDisplayedError
+-30770 kURLInvalidURLReferenceError kURLInvalidURLReferenceError
+-30599 controlHandleInvalidErr controlHandleInvalidErr
+-30597 controlInvalidDataVersionErr controlInvalidDataVersionErr
+-30596 errItemNotControl errItemNotControl
+-30595 errCantEmbedRoot errCantEmbedRoot
+-30594 errCantEmbedIntoSelf errCantEmbedIntoSelf
+-30593 errWindowRegionCodeInvalid errWindowRegionCodeInvalid
+-30592 errControlHiddenOrDisabled errControlHiddenOrDisabled
+-30591 errDataSizeMismatch errDataSizeMismatch
+-30590 errControlIsNotEmbedder errControlIsNotEmbedder
+-30589 errControlsAlreadyExist errControlsAlreadyExist
+-30588 errInvalidPartCode errInvalidPartCode
+-30587 errRootAlreadyExists errRootAlreadyExists
+-30586 errNoRootControl errNoRootControl
+-30585 errCouldntSetFocus errCouldntSetFocus
+-30584 errUnknownControl errUnknownControl
+-30583 errWindowDoesntSupportFocus errWindowDoesntSupportFocus
+-30582 errControlDoesntSupportFocus errControlDoesntSupportFocus
+-30581 errDataNotSupported errDataNotSupported
+-30580 errMessageNotSupported errMessageNotSupported
+-30567 themeMonitorDepthNotSupportedErr theme not supported at monitor depth
+-30566 themeScriptFontNotFoundErr theme font requested for uninstalled script system
+-30565 themeBadCursorIndexErr themeBadCursorIndexErr
+-30564 themeHasNoAccentsErr themeHasNoAccentsErr
+-30563 themeBadTextColorErr themeBadTextColorErr
+-30562 themeProcessNotRegisteredErr themeProcessNotRegisteredErr
+-30561 themeProcessRegisteredErr themeProcessRegisteredErr
+-30560 themeInvalidBrushErr pattern index invalid
+-30555 qtvrUninitialized qtvrUninitialized
+-30554 qtvrLibraryLoadErr qtvrLibraryLoadErr
+-30553 streamingNodeNotReadyErr streamingNodeNotReadyErr
+-30552 noMemoryNodeFailedInitialize noMemoryNodeFailedInitialize
+-30551 invalidHotSpotIDErr invalidHotSpotIDErr
+-30550 invalidNodeFormatErr invalidNodeFormatErr
+-30549 limitReachedErr limitReachedErr
+-30548 settingNotSupportedByNodeErr settingNotSupportedByNodeErr
+-30547 propertyNotSupportedByNodeErr propertyNotSupportedByNodeErr
+-30546 timeNotInViewErr timeNotInViewErr
+-30545 invalidViewStateErr invalidViewStateErr
+-30544 invalidNodeIDErr invalidNodeIDErr
+-30543 selectorNotSupportedByNodeErr selectorNotSupportedByNodeErr
+-30542 callNotSupportedByNodeErr callNotSupportedByNodeErr
+-30541 constraintReachedErr constraintReachedErr
+-30540 notAQTVRMovieErr notAQTVRMovieErr
+-30532 kFBCnoSuchHit kFBCnoSuchHit
+-30531 kFBCbadSearchSession kFBCbadSearchSession
+-30530 kFBCindexDiskIOFailed kFBCindexDiskIOFailed
+-30529 kFBCsummarizationCanceled kFBCsummarizationCanceled
+-30528 kFBCbadIndexFileVersion kFBCbadIndexFileVersion
+-30527 kFBCanalysisNotAvailable kFBCanalysisNotAvailable
+-30526 kFBCillegalSessionChange tried to add/remove vols to a session
+-30525 kFBCsomeFilesNotIndexed kFBCsomeFilesNotIndexed
+-30524 kFBCsearchFailed kFBCsearchFailed
+-30523 kFBCindexNotAvailable kFBCindexNotAvailable
+-30522 kFBCindexFileDestroyed kFBCindexFileDestroyed
+-30521 kFBCaccessCanceled kFBCaccessCanceled
+-30520 kFBCindexingCanceled kFBCindexingCanceled
+-30519 kFBCnoSearchSession kFBCnoSearchSession
+-30518 kFBCindexNotFound kFBCindexNotFound
+-30517 kFBCflushFailed kFBCflushFailed
+-30516 kFBCaddDocFailed kFBCaddDocFailed
+-30515 kFBCaccessorStoreFailed kFBCaccessorStoreFailed
+-30514 kFBCindexCreationFailed couldn't create index
+-30513 kFBCmergingFailed couldn't merge index files
+-30512 kFBCtokenizationFailed couldn't read from document or query
+-30511 kFBCmoveFailed V-Twin exception caught
+-30510 kFBCdeletionFailed V-Twin exception caught
+-30509 kFBCcommitFailed V-Twin exception caught
+-30508 kFBCindexingFailed V-Twin exception caught
+-30507 kFBCvalidationFailed V-Twin exception caught
+-30506 kFBCcompactionFailed V-Twin exception caught
+-30505 kFBCbadIndexFile bad FSSpec, or bad data in file
+-30504 kFBCfileNotIndexed kFBCfileNotIndexed
+-30503 kFBCbadParam kFBCbadParam
+-30502 kFBCallocFailed probably low memory
+-30501 kFBCnoIndexesFound kFBCnoIndexesFound
+-30500 kFBCvTwinExceptionErr no telling what it was
+-30450 kDSpStereoContextErr kDSpStereoContextErr
+-30449 kDSpInternalErr kDSpInternalErr
+-30448 kDSpConfirmSwitchWarning kDSpConfirmSwitchWarning
+-30447 kDSpFrameRateNotReadyErr kDSpFrameRateNotReadyErr
+-30446 kDSpContextNotFoundErr kDSpContextNotFoundErr
+-30445 kDSpContextNotReservedErr kDSpContextNotReservedErr
+-30444 kDSpContextAlreadyReservedErr kDSpContextAlreadyReservedErr
+-30443 kDSpInvalidAttributesErr kDSpInvalidAttributesErr
+-30442 kDSpInvalidContextErr kDSpInvalidContextErr
+-30441 kDSpSystemSWTooOldErr kDSpSystemSWTooOldErr
+-30440 kDSpNotInitializedErr kDSpNotInitializedErr
+-30429 kISpListBusyErr kISpListBusyErr
+-30428 kISpDeviceActiveErr kISpDeviceActiveErr
+-30427 kISpSystemActiveErr kISpSystemActiveErr
+-30426 kISpDeviceInactiveErr kISpDeviceInactiveErr
+-30425 kISpSystemInactiveErr kISpSystemInactiveErr
+-30424 kISpElementNotInListErr kISpElementNotInListErr
+-30423 kISpElementInListErr kISpElementInListErr
+-30422 kISpBufferToSmallErr kISpBufferToSmallErr
+-30421 kISpSystemListErr kISpSystemListErr
+-30420 kISpInternalErr kISpInternalErr
+-30399 kNSpJoinFailedErr kNSpJoinFailedErr
+-30398 kNSpCantBlockErr kNSpCantBlockErr
+-30397 kNSpMessageTooBigErr kNSpMessageTooBigErr
+-30396 kNSpSendFailedErr kNSpSendFailedErr
+-30395 kNSpConnectFailedErr kNSpConnectFailedErr
+-30394 kNSpGameTerminatedErr kNSpGameTerminatedErr
+-30393 kNSpTimeoutErr kNSpTimeoutErr
+-30392 kNSpInvalidProtocolListErr kNSpInvalidProtocolListErr
+-30391 kNSpInvalidProtocolRefErr kNSpInvalidProtocolRefErr
+-30390 kNSpInvalidDefinitionErr kNSpInvalidDefinitionErr
+-30389 kNSpAddPlayerFailedErr kNSpAddPlayerFailedErr
+-30388 kNSpCreateGroupFailedErr kNSpCreateGroupFailedErr
+-30387 kNSpNoHostVolunteersErr kNSpNoHostVolunteersErr
+-30386 kNSpNoGroupsErr kNSpNoGroupsErr
+-30385 kNSpNoPlayersErr kNSpNoPlayersErr
+-30384 kNSpInvalidGroupIDErr kNSpInvalidGroupIDErr
+-30383 kNSpInvalidPlayerIDErr kNSpInvalidPlayerIDErr
+-30382 kNSpNameRequiredErr kNSpNameRequiredErr
+-30381 kNSpFeatureNotImplementedErr kNSpFeatureNotImplementedErr
+-30380 kNSpAddressInUseErr kNSpAddressInUseErr
+-30379 kNSpRemovePlayerFailedErr kNSpRemovePlayerFailedErr
+-30378 kNSpFreeQExhaustedErr kNSpFreeQExhaustedErr
+-30377 kNSpInvalidAddressErr kNSpInvalidAddressErr
+-30376 kNSpNotAdvertisingErr kNSpNotAdvertisingErr
+-30374 kNSpAlreadyAdvertisingErr kNSpAlreadyAdvertisingErr
+-30373 kNSpMemAllocationErr kNSpMemAllocationErr
+-30371 kNSpOTVersionTooOldErr kNSpOTVersionTooOldErr
+-30370 kNSpOTNotPresentErr kNSpOTNotPresentErr
+-30369 kNSpInvalidParameterErr kNSpInvalidParameterErr
+-30367 kNSpInvalidGameRefErr kNSpInvalidGameRefErr
+-30366 kNSpProtocolNotAvailableErr kNSpProtocolNotAvailableErr
+-30365 kNSpHostFailedErr kNSpHostFailedErr
+-30364 kNSpPipeFullErr kNSpPipeFullErr
+-30362 kNSpTopologyNotSupportedErr kNSpTopologyNotSupportedErr
+-30361 kNSpAlreadyInitializedErr kNSpAlreadyInitializedErr
+-30360 kNSpInitializationFailedErr kNSpInitializationFailedErr
+-30344 kSSpScaleToZeroErr kSSpScaleToZeroErr
+-30343 kSSpParallelUpVectorErr kSSpParallelUpVectorErr
+-30342 kSSpCantInstallErr kSSpCantInstallErr
+-30341 kSSpVersionErr kSSpVersionErr
+-30340 kSSpInternalErr kSSpInternalErr
+-30049 kALMInternalErr kALMInternalErr
+-30048 kALMGroupNotFoundErr kALMGroupNotFoundErr
+-30047 kALMNoSuchModuleErr kALMNoSuchModuleErr
+-30046 kALMModuleCommunicationErr kALMModuleCommunicationErr
+-30045 kALMDuplicateModuleErr kALMDuplicateModuleErr
+-30044 kALMInstallationErr kALMInstallationErr
+-30043 kALMDeferSwitchErr kALMDeferSwitchErr
+-30042 kALMRebootFlagsLevelErr kALMRebootFlagsLevelErr
+-30029 kLocalesDefaultDisplayStatus Requested display locale unavailable, used default
+-30002 kLocalesTableFormatErr kLocalesTableFormatErr
+-30001 kLocalesBufferTooSmallErr kLocalesBufferTooSmallErr
+-29589 kFNSNameNotFoundErr The name with the requested paramters was not found
+-29587 kFNSBadFlattenedSizeErr flattened size didn't match input or was too small
+-29586 kFNSInsufficientDataErr insufficient data for the operation
+-29585 kFNSMismatchErr reference didn't match or wasn't found in profile
+-29584 kFNSDuplicateReferenceErr the ref. being added is already in the profile
+-29583 kFNSBadProfileVersionErr profile version is out of known range
+-29582 kFNSInvalidProfileErr profile is NULL or otherwise bad
+-29581 kFNSBadReferenceVersionErr ref. version is out of known range
+-29580 kFNSInvalidReferenceErr ref. was NULL or otherwise bad
+-29507 kCollateInvalidCollationRef kCollateInvalidCollationRef
+-29506 kCollateBufferTooSmall kCollateBufferTooSmall
+-29505 kCollateInvalidChar kCollateInvalidChar
+-29504 kCollatePatternNotFoundErr kCollatePatternNotFoundErr
+-29503 kCollateUnicodeConvertFailedErr kCollateUnicodeConvertFailedErr
+-29502 kCollateMissingUnicodeTableErr kCollateMissingUnicodeTableErr
+-29501 kCollateInvalidOptions kCollateInvalidOptions
+-29500 kCollateAttributesNotFoundErr kCollateAttributesNotFoundErr
+-29299 kMPInvalidIDErr kMPInvalidIDErr
+-29298 kMPInsufficientResourcesErr kMPInsufficientResourcesErr
+-29297 kMPTaskAbortedErr kMPTaskAbortedErr
+-29296 kMPTimeoutErr kMPTimeoutErr
+-29295 kMPDeletedErr kMPDeletedErr
+-29293 kMPBlueBlockingErr kMPBlueBlockingErr
+-29292 kMPTaskStoppedErr A convention used with MPThrowException.
+-29291 kMPTaskBlockedErr kMPTaskBlockedErr
+-29290 kMPTaskCreatedErr kMPTaskCreatedErr
+-29289 kMPProcessTerminatedErr kMPProcessTerminatedErr
+-29288 kMPProcessCreatedErr kMPProcessCreatedErr
+-29276 kMPPrivilegedErr kMPPrivilegedErr
+-29275 kMPIterationEndErr kMPIterationEndErr
+-25341 kUCTextBreakLocatorMissingType Unicode text break error
+-25340 kUCOutputBufferTooSmall Output buffer too small for Unicode string result
+-25318 errKCCreateChainFailed errKCCreateChainFailed
+-25317 errKCDataNotModifiable errKCDataNotModifiable
+-25316 errKCDataNotAvailable errKCDataNotAvailable
+-25315 errKCInteractionRequired errKCInteractionRequired
+-25314 errKCNoPolicyModule errKCNoPolicyModule
+-25313 errKCNoCertificateModule errKCNoCertificateModule
+-25312 errKCNoStorageModule errKCNoStorageModule
+-25311 errKCKeySizeNotAllowed errKCKeySizeNotAllowed
+-25310 errKCWrongKCVersion errKCWrongKCVersion
+-25309 errKCReadOnlyAttr errKCReadOnlyAttr
+-25308 errKCInteractionNotAllowed errKCInteractionNotAllowed
+-25307 errKCNoDefaultKeychain errKCNoDefaultKeychain
+-25306 errKCNoSuchClass errKCNoSuchClass
+-25305 errKCInvalidSearchRef errKCInvalidSearchRef
+-25304 errKCInvalidItemRef errKCInvalidItemRef
+-25303 errKCNoSuchAttr errKCNoSuchAttr
+-25302 errKCDataTooLarge errKCDataTooLarge
+-25301 errKCBufferTooSmall errKCBufferTooSmall
+-25300 errKCItemNotFound errKCItemNotFound
+-25299 errKCDuplicateItem errKCDuplicateItem
+-25298 errKCInvalidCallback errKCInvalidCallback
+-25297 errKCDuplicateCallback errKCDuplicateCallback
+-25296 errKCDuplicateKeychain errKCDuplicateKeychain
+-25295 errKCInvalidKeychain errKCInvalidKeychain
+-25294 errKCNoSuchKeychain errKCNoSuchKeychain
+-25293 errKCAuthFailed errKCAuthFailed
+-25292 errKCReadOnly errKCReadOnly
+-25291 errKCNotAvailable errKCNotAvailable
+-25280 printerStatusOpCodeNotSupportedErr printerStatusOpCodeNotSupportedErr
+-22018 kTXNOutsideOfFrameErr kTXNOutsideOfFrameErr
+-22017 kTXNOutsideOfLineErr kTXNOutsideOfLineErr
+-22016 kTXNATSUIIsNotInstalledErr kTXNATSUIIsNotInstalledErr
+-22015 kTXNDataTypeNotAllowedErr kTXNDataTypeNotAllowedErr
+-22014 kTXNCopyNotAllowedInEchoModeErr kTXNCopyNotAllowedInEchoModeErr
+-22013 kTXNCannotTurnTSMOffWhenUsingUnicodeErr kTXNCannotTurnTSMOffWhenUsingUnicodeErr
+-22012 kTXNAlreadyInitializedErr kTXNAlreadyInitializedErr
+-22011 kTXNInvalidRunIndex kTXNInvalidRunIndex
+-22010 kTXNSomeOrAllTagsInvalidForRunErr kTXNSomeOrAllTagsInvalidForRunErr
+-22009 kTXNAttributeTagInvalidForRunErr dataValue is set to this per invalid tag
+-22008 kTXNNoMatchErr kTXNNoMatchErr
+-22007 kTXNRunIndexOutofBoundsErr kTXNRunIndexOutofBoundsErr
+-22006 kTXNCannotSetAutoIndentErr kTXNCannotSetAutoIndentErr
+-22005 kTXNBadDefaultFileTypeWarning kTXNBadDefaultFileTypeWarning
+-22004 kTXNUserCanceledOperationErr kTXNUserCanceledOperationErr
+-22003 kTXNIllegalToCrossDataBoundariesErr kTXNIllegalToCrossDataBoundariesErr
+-22002 kTXNInvalidFrameIDErr kTXNInvalidFrameIDErr
+-22001 kTXNCannotAddFrameErr kTXNCannotAddFrameErr
+-22000 kTXNEndIterationErr kTXNEndIterationErr
+-20002 invalidIndexErr The recordIndex parameter is not valid.
+-20001 recordDataTooBigErr The record data is bigger than buffer size (1024 bytes).
+-20000 unknownInsertModeErr There is no such an insert mode.
+-14002 kModemScriptMissing kModemScriptMissing
+-14001 kModemPreferencesMissing kModemPreferencesMissing
+-14000 kModemOutOfMemory kModemOutOfMemory
+-13950 kHIDBaseError kHIDBaseError
+-13949 kHIDNullStateErr kHIDNullStateErr
+-13948 kHIDBufferTooSmallErr kHIDBufferTooSmallErr
+-13947 kHIDValueOutOfRangeErr kHIDValueOutOfRangeErr
+-13946 kHIDUsageNotFoundErr kHIDUsageNotFoundErr
+-13945 kHIDNotValueArrayErr kHIDNotValueArrayErr
+-13944 kHIDInvalidPreparsedDataErr kHIDInvalidPreparsedDataErr
+-13943 kHIDIncompatibleReportErr kHIDIncompatibleReportErr
+-13942 kHIDBadLogPhysValuesErr kHIDBadLogPhysValuesErr
+-13941 kHIDInvalidReportTypeErr kHIDInvalidReportTypeErr
+-13940 kHIDInvalidReportLengthErr kHIDInvalidReportLengthErr
+-13939 kHIDNullPointerErr kHIDNullPointerErr
+-13938 kHIDBadParameterErr kHIDBadParameterErr
+-13937 kHIDNotEnoughMemoryErr kHIDNotEnoughMemoryErr
+-13936 kHIDEndOfDescriptorErr kHIDEndOfDescriptorErr
+-13935 kHIDUsagePageZeroErr kHIDUsagePageZeroErr
+-13934 kHIDBadLogicalMinimumErr kHIDBadLogicalMinimumErr
+-13933 kHIDBadLogicalMaximumErr kHIDBadLogicalMaximumErr
+-13932 kHIDInvertedLogicalRangeErr kHIDInvertedLogicalRangeErr
+-13931 kHIDInvertedPhysicalRangeErr kHIDInvertedPhysicalRangeErr
+-13930 kHIDUnmatchedUsageRangeErr kHIDUnmatchedUsageRangeErr
+-13929 kHIDInvertedUsageRangeErr kHIDInvertedUsageRangeErr
+-13928 kHIDUnmatchedStringRangeErr kHIDUnmatchedStringRangeErr
+-13927 kHIDUnmatchedDesignatorRangeErr kHIDUnmatchedDesignatorRangeErr
+-13926 kHIDReportSizeZeroErr kHIDReportSizeZeroErr
+-13925 kHIDReportCountZeroErr kHIDReportCountZeroErr
+-13924 kHIDReportIDZeroErr kHIDReportIDZeroErr
+-13923 kHIDInvalidRangePageErr kHIDInvalidRangePageErr
+-13910 kHIDDeviceNotReady The device is still initializing, try again later
+-13909 kHIDVersionIncompatibleErr kHIDVersionIncompatibleErr
+-13887 debuggingNoMatchErr debugging component or option not found at this index
+-13886 debuggingNoCallbackErr debugging component has no callback
+-13885 debuggingInvalidNameErr componentName or optionName is invalid (NULL)
+-13884 debuggingInvalidOptionErr optionSelectorNum is not registered
+-13883 debuggingInvalidSignatureErr componentSignature not registered
+-13882 debuggingDuplicateOptionErr optionSelectorNum already registered
+-13881 debuggingDuplicateSignatureErr componentSignature already registered
+-13880 debuggingExecutionContextErr routine cannot be called at this time
+-13038 kBridgeSoftwareRunningCantSleep kBridgeSoftwareRunningCantSleep
+-13020 kNoSuchPowerSource kNoSuchPowerSource
+-13014 kProcessorTempRoutineRequiresMPLib2 kProcessorTempRoutineRequiresMPLib2
+-13013 kCantReportProcessorTemperatureErr kCantReportProcessorTemperatureErr
+-13010 kPowerMgtRequestDenied kPowerMgtRequestDenied
+-13009 kPowerMgtMessageNotHandled kPowerMgtMessageNotHandled
+-13008 kPowerHandlerNotFoundForProcErr kPowerHandlerNotFoundForProcErr
+-13007 kPowerHandlerNotFoundForDeviceErr kPowerHandlerNotFoundForDeviceErr
+-13006 kPowerHandlerExistsForDeviceErr kPowerHandlerExistsForDeviceErr
+-13005 pmRecvEndErr during receive, pmgr did not finish hs configured for this connection
+-13004 pmRecvStartErr during receive, pmgr did not start hs
+-13003 pmSendEndErr during send, pmgr did not finish hs
+-13002 pmSendStartErr during send, pmgr did not start hs
+-13001 pmReplyTOErr Timed out waiting for reply
+-13000 pmBusyErr Power Mgr never ready to start handshake
+-11005 pictureDataErr the picture data was invalid
+-11004 colorsRequestedErr the number of colors requested was illegal
+-11003 cantLoadPickMethodErr unable to load the custom pick proc
+-11002 pictInfoVerbErr the passed verb was invalid
+-11001 pictInfoIDErr the internal consistancy check for the PictInfoID is wrong
+-11000 pictInfoVersionErr wrong version of the PictInfo structure
+-10780 errTaskNotFound no task with that task id exists
+-10116 telNotEnoughdspBW not enough real-time for allocation
+-10115 telBadSampleRate incompatible sample rate
+-10114 telBadSWErr Software not installed properly
+-10113 telDetAlreadyOn detection is already turned on
+-10112 telAutoAnsNotOn autoAnswer in not turned on
+-10111 telValidateFailed telValidate failed
+-10110 telBadProcID invalid procID
+-10109 telDeviceNotFound device not found
+-10108 telBadCodeResource code resource not found
+-10107 telInitFailed initialization failed
+-10106 telNoCommFolder Communications/Extensions € not found
+-10103 telUnknownErr unable to set config
+-10102 telNoSuchTool unable to find tool with name specified
+-10091 telBadFunction bad msgCode specified
+-10090 telPBErr parameter block error, bad format
+-10082 telCANotDeflectable CA not "deflectable"
+-10081 telCANotRejectable CA not "rejectable"
+-10080 telCANotAcceptable CA not "acceptable"
+-10072 telTermNotOpen terminal not opened via TELOpenTerm
+-10071 telStillNeeded terminal driver still needed by someone else
+-10070 telAlreadyOpen terminal already open
+-10064 telNoCallbackRef no call back reference was specified, but is required
+-10063 telDisplayModeNotSupp display mode not supported by tool
+-10062 telBadDisplayMode bad display mode specified
+-10061 telFwdTypeNotSupp forward type not supported by tool
+-10060 telDNTypeNotSupp DN type not supported by tool
+-10059 telBadRate bad rate specified
+-10058 telBadBearerType bad bearerType specified
+-10057 telBadSelect unable to select or deselect DN
+-10056 telBadParkID bad park id specified
+-10055 telBadPickupGroupID bad pickup group ID specified
+-10054 telBadFwdType bad fwdType specified
+-10053 telBadFeatureID bad feature ID specified
+-10052 telBadIntercomID bad intercom ID specified
+-10051 telBadPageID bad page ID specified
+-10050 telBadDNType DN type invalid
+-10047 telConfLimitExceeded attempt to exceed switch conference limits
+-10046 telCBErr call back feature not set previously
+-10045 telTransferRej transfer request rejected
+-10044 telTransferErr transfer not prepared
+-10043 telConfRej conference request was rejected
+-10042 telConfErr conference was not prepared
+-10041 telConfNoLimit no limit was specified but required
+-10040 telConfLimitErr limit specified is too high for this configuration
+-10033 telFeatNotSupp feature program call not supported by this tool
+-10032 telFeatActive feature already active
+-10031 telFeatNotAvail feature subscribed but not available
+-10030 telFeatNotSub feature not subscribed
+-10025 errAEPropertiesClash illegal combination of properties settings for Set Data, make new, or duplicate
+-10024 errAECantPutThatThere in make new, duplicate, etc. class can't be an element of container
+-10023 errAENotAnEnumMember enumerated value in SetData is not allowed for this property
+-10022 telIntExtNotSupp internal external type not supported by this tool
+-10021 telBadIntExt bad internal external error
+-10020 telStateNotSupp device state not supported by tool
+-10019 telBadStateErr bad device state specified
+-10018 telIndexNotSupp index not supported by this tool
+-10017 telBadIndex bad index specified
+-10016 telAPattNotSupp alerting pattern not supported by tool
+-10015 telBadAPattErr bad alerting pattern specified
+-10014 telVTypeNotSupp volume type not supported by this tool
+-10013 telBadVTypeErr bad volume type error
+-10012 telBadLevelErr bad volume level setting
+-10011 telHTypeNotSupp hook type not supported by this tool
+-10010 telBadHTypeErr bad hook type specified
+-10009 errAECantSupplyType errAECantSupplyType
+-10008 telNoOpenErr unable to open terminal
+-10007 telNoMemErr no memory to allocate handle
+-10006 errOSACantAssign Signaled when an object cannot be set in a container.
+-10005 telBadProcErr bad msgProc specified
+-10004 telBadHandErr bad handle specified
+-10003 OSAIllegalAssign Signaled when an object can never be set in a container
+-10002 telBadDNErr TELDNHandle not found or invalid
+-10001 telBadTermErr invalid TELHandle or handle not found
+-10000 errAEEventFailed errAEEventFailed
+-9999 cannotMoveAttachedController cannotMoveAttachedController
+-9998 controllerHasFixedHeight controllerHasFixedHeight
+-9997 cannotSetWidthOfAttachedController cannotSetWidthOfAttachedController
+-9996 controllerBoundsNotExact controllerBoundsNotExact
+-9995 editingNotAllowed editingNotAllowed
+-9994 badControllerHeight badControllerHeight
+-9408 deviceCantMeetRequest deviceCantMeetRequest
+-9407 seqGrabInfoNotAvailable seqGrabInfoNotAvailable
+-9406 badSGChannel badSGChannel
+-9405 couldntGetRequiredComponent couldntGetRequiredComponent
+-9404 notEnoughDiskSpaceToGrab notEnoughDiskSpaceToGrab
+-9403 notEnoughMemoryToGrab notEnoughMemoryToGrab
+-9402 cantDoThatInCurrentMode cantDoThatInCurrentMode
+-9401 grabTimeComplete grabTimeComplete
+-9400 noDeviceForChannel noDeviceForChannel
+-9109 kNoCardBusCISErr No valid CIS exists for this CardBus card
+-9108 kNotZVCapableErr This socket does not support Zoomed Video
+-9107 kCardPowerOffErr Power to the card has been turned off
+-9106 kAttemptDupCardEntryErr The Enabler was asked to create a duplicate card entry
+-9105 kAlreadySavedStateErr The state has been saved on previous call
+-9104 kTooManyIOWindowsErr device requested more than one I/O window
+-9103 kNotReadyErr PC Card failed to go ready
+-9102 kClientRequestDenied CS Clients should return this code inorder to
+-9101 kNoCompatibleNameErr There is no compatible driver name for this device
+-9100 kNoEnablerForCardErr No Enablers were found that can support the card
+-9099 kNoCardEnablersFoundErr No Enablers were found
+-9098 kUnsupportedCardErr Card not supported by generic enabler
+-9097 kNoClientTableErr The client table has not be initialized yet
+-9096 kNoMoreInterruptSlotsErr All internal Interrupt slots are in use
+-9095 kNoMoreTimerClientsErr All timer callbacks are in use
+-9094 kNoIOWindowRequestedErr Request I/O window before calling configuration
+-9093 kBadCustomIFIDErr Custom interface ID is invalid
+-9092 kBadTupleDataErr Data in tuple is invalid
+-9091 kInvalidCSClientErr Card Services ClientID is not registered
+-9090 kUnsupportedVsErr Unsupported Voltage Sense
+-9089 kInvalidDeviceNumber kInvalidDeviceNumber
+-9088 kPostCardEventErr _PCCSLPostCardEvent failed and dropped an event
+-9087 kCantConfigureCardErr kCantConfigureCardErr
+-9086 kPassCallToChainErr kPassCallToChainErr
+-9085 kCardBusCardErr kCardBusCardErr
+-9084 k16BitCardErr k16BitCardErr
+-9083 kBadDeviceErr kBadDeviceErr
+-9082 kBadLinkErr kBadLinkErr
+-9081 kInvalidRegEntryErr kInvalidRegEntryErr
+-9080 kNoCardSevicesSocketsErr kNoCardSevicesSocketsErr
+-9079 kOutOfResourceErr Card Services has exhausted the resource
+-9078 kNoMoreItemsErr there are no more of the requested item
+-9077 kInUseErr requested resource is being used by a client
+-9076 kConfigurationLockedErr a configuration has already been locked
+-9075 kWriteProtectedErr media is write-protected
+-9074 kBusyErr unable to process request at this time - try later
+-9073 kUnsupportedModeErr mode is not supported
+-9072 kUnsupportedFunctionErr function is not supported by this implementation
+-9071 kNoCardErr no PC card in the socket
+-9070 kGeneralFailureErr an undefined error has occurred
+-9069 kWriteFailureErr unable to complete write request
+-9068 kReadFailureErr unable to complete read request
+-9067 kBadSpeedErr specified speed is unavailable
+-9066 kBadCISErr CIS on card is invalid
+-9065 kBadHandleErr clientHandle is invalid
+-9064 kBadArgsErr values in argument packet are invalid
+-9063 kBadArgLengthErr ArgLength argument is invalid
+-9062 kBadWindowErr specified window is invalid
+-9061 kBadVppErr specified Vpp1 or Vpp2 power level index is invalid
+-9060 kBadVccErr specified Vcc power level index is invalid
+-9059 kBadTypeErr specified window or interface type is invalid
+-9058 kBadSocketErr specified logical or physical socket number is invalid
+-9057 kBadSizeErr specified size is invalid
+-9056 kBadPageErr specified page is invalid
+-9055 kBadOffsetErr specified PC card memory array offset is invalid
+-9054 kBadIRQErr specified IRQ level is invalid
+-9053 kBadEDCErr specified EDC generator specified is invalid
+-9052 kBadBaseErr specified base system memory address is invalid
+-9051 kBadAttributeErr specified attributes field value is invalid
+-9050 kBadAdapterErr invalid adapter number
+-8992 codecOffscreenFailedPleaseRetryErr codecOffscreenFailedPleaseRetryErr
+-8991 lockPortBitsWrongGDeviceErr lockPortBitsWrongGDeviceErr
+-8990 directXObjectAlreadyExists directXObjectAlreadyExists
+-8989 codecDroppedFrameErr returned from ImageCodecDrawBand
+-8988 codecOffscreenFailedErr codecOffscreenFailedErr
+-8987 codecNeedAccessKeyErr codec needs password in order to decompress
+-8986 codecParameterDialogConfirm codecParameterDialogConfirm
+-8985 lockPortBitsSurfaceLostErr lockPortBitsSurfaceLostErr
+-8984 lockPortBitsBadPortErr lockPortBitsBadPortErr
+-8983 lockPortBitsWindowClippedErr lockPortBitsWindowClippedErr
+-8982 lockPortBitsWindowResizedErr lockPortBitsWindowResizedErr
+-8981 lockPortBitsWindowMovedErr lockPortBitsWindowMovedErr
+-8980 lockPortBitsBadSurfaceErr lockPortBitsBadSurfaceErr
+-8979 codecNeedToFlushChainErr codecNeedToFlushChainErr
+-8978 codecDisabledErr codec disabled itself -- pass codecFlagReenable to reset
+-8977 codecNoMemoryPleaseWaitErr codecNoMemoryPleaseWaitErr
+-8976 codecNothingToBlitErr codecNothingToBlitErr
+-8975 codecCantQueueErr codecCantQueueErr
+-8974 codecCantWhenErr codecCantWhenErr
+-8973 codecOpenErr codecOpenErr
+-8972 codecConditionErr codecConditionErr
+-8971 codecExtensionNotFoundErr codecExtensionNotFoundErr
+-8970 codecDataVersErr codecDataVersErr
+-8969 codecBadDataErr codecBadDataErr
+-8968 codecWouldOffscreenErr codecWouldOffscreenErr
+-8967 codecAbortErr codecAbortErr
+-8966 codecSpoolErr codecSpoolErr
+-8965 codecImageBufErr codecImageBufErr
+-8964 codecScreenBufErr codecScreenBufErr
+-8963 codecSizeErr codecSizeErr
+-8962 codecUnimpErr codecUnimpErr
+-8961 noCodecErr noCodecErr
+-8960 codecErr codecErr
+-8852 kIllegalClockValueErr kIllegalClockValueErr
+-8851 kUTCOverflowErr kUTCOverflowErr
+-8850 kUTCUnderflowErr kUTCUnderflowErr
+-8809 kATSULastErr The last ATSUI error code.
+-8808 kATSULineBreakInWord This is not an error code but is returned by ATSUBreakLine to
+-8807 kATSUCoordinateOverflowErr Used to indicate the coordinates provided to an ATSUI routine caused
+-8806 kATSUNoFontScalerAvailableErr Used when no font scaler is available for the font passed
+-8805 kATSUNoFontCmapAvailableErr Used when no CMAP table can be accessed or synthesized for the
+-8804 kATSULowLevelErr Used when an error was encountered within the low level ATS
+-8803 kATSUQuickDrawTextErr Used when QuickDraw Text encounters an error rendering or measuring
+-8802 kATSUNoStyleRunsAssignedErr Used when an attempt was made to measure, highlight or draw
+-8801 kATSUNotSetErr Used when the client attempts to retrieve an attribute,
+-8800 kATSUInvalidCacheErr Used when an attempt was made to read in style data
+-8799 kATSUInvalidAttributeTagErr Used when an attempt was made to use a tag value that
+-8798 kATSUInvalidAttributeSizeErr Used when an attempt was made to use an attribute with a
+-8797 kATSUInvalidAttributeValueErr Used when an attempt was made to use an attribute with
+-8796 kATSUInvalidFontErr Used when an attempt was made to use an invalid font ID.
+-8795 kATSUNoCorrespondingFontErr This value is retrned by font ID conversion
+-8794 kATSUFontsNotMatched This value is returned by ATSUMatchFontsToText()
+-8793 kATSUFontsMatched This is not an error code but is returned by
+-8792 kATSUInvalidTextRangeErr An attempt was made to extract information
+-8791 kATSUInvalidStyleErr An attempt was made to use a ATSUStyle which
+-8790 kATSUInvalidTextLayoutErr An attempt was made to use a ATSUTextLayout
+-8785 kTECOutputBufferFullStatus output buffer has no room for conversion of next input text element (partial conversion)
+-8784 kTECNeedFlushStatus kTECNeedFlushStatus
+-8783 kTECUsedFallbacksStatus kTECUsedFallbacksStatus
+-8771 kTECItemUnavailableErr item (e.g. name) not available for specified region (& encoding if relevant)
+-8770 kTECGlobalsUnavailableErr globals have already been deallocated (premature TERM)
+-8769 unicodeChecksumErr unicodeChecksumErr
+-8768 unicodeNoTableErr unicodeNoTableErr
+-8767 unicodeVariantErr unicodeVariantErr
+-8766 unicodeFallbacksErr unicodeFallbacksErr
+-8765 unicodePartConvertErr unicodePartConvertErr
+-8764 unicodeBufErr unicodeBufErr
+-8763 unicodeCharErr unicodeCharErr
+-8762 unicodeElementErr unicodeElementErr
+-8761 unicodeNotFoundErr unicodeNotFoundErr
+-8760 unicodeTableFormatErr unicodeTableFormatErr
+-8759 unicodeDirectionErr unicodeDirectionErr
+-8758 unicodeContextualErr unicodeContextualErr
+-8757 unicodeTextEncodingDataErr unicodeTextEncodingDataErr
+-8756 kTECDirectionErr direction stack overflow, etc.
+-8755 kTECIncompleteElementErr text element may be incomplete or is too long for internal buffers
+-8754 kTECUnmappableElementErr kTECUnmappableElementErr
+-8753 kTECPartialCharErr input buffer ends in the middle of a multibyte character, conversion stopped
+-8752 kTECBadTextRunErr kTECBadTextRunErr
+-8751 kTECArrayFullErr supplied name buffer or TextRun, TextEncoding, or UnicodeMapping array is too small
+-8750 kTECBufferBelowMinimumSizeErr output buffer too small to allow processing of first input text element
+-8749 kTECNoConversionPathErr kTECNoConversionPathErr
+-8748 kTECCorruptConverterErr invalid converter object reference
+-8747 kTECTableFormatErr kTECTableFormatErr
+-8746 kTECTableChecksumErr kTECTableChecksumErr
+-8745 kTECMissingTableErr kTECMissingTableErr
+-8740 kTextUndefinedElementErr text conversion errors
+-8739 kTextMalformedInputErr in DBCS, for example, high byte followed by invalid low byte
+-8738 kTextUnsupportedEncodingErr specified encoding not supported for this operation
+-7139 kRANotEnabled kRANotEnabled
+-7138 kRACallBackFailed kRACallBackFailed
+-7137 kRADuplicateIPAddr kRADuplicateIPAddr
+-7136 kRANCPRejectedbyPeer kRANCPRejectedbyPeer
+-7135 kRAExtAuthenticationFailed kRAExtAuthenticationFailed
+-7134 kRAATalkInactive kRAATalkInactive
+-7133 kRAPeerNotResponding kRAPeerNotResponding
+-7132 kRAPPPPeerDisconnected kRAPPPPeerDisconnected
+-7131 kRAPPPUserDisconnected kRAPPPUserDisconnected
+-7130 kRAPPPNegotiationFailed kRAPPPNegotiationFailed
+-7129 kRAPPPAuthenticationFailed kRAPPPAuthenticationFailed
+-7128 kRAPPPProtocolRejected kRAPPPProtocolRejected
+-7127 dcmBufferOverflowErr data is larger than buffer size
+-7126 kRANotPrimaryInterface when IPCP is not primary TCP/IP intf.
+-7125 kRATCPIPNotConfigured TCP/IP not configured, could be loaded
+-7124 kRATCPIPInactive TCP/IP inactive, cannot be loaded
+-7123 kRARemoteAccessNotReady kRARemoteAccessNotReady
+-7122 kRAInitOpenTransportFailed kRAInitOpenTransportFailed
+-7121 dcmProtectedErr need keyword to use dictionary
+-7120 kRAUserPwdEntryRequired kRAUserPwdEntryRequired
+-7119 kRAUserPwdChangeRequired kRAUserPwdChangeRequired
+-7118 dcmBadFindMethodErr no such find method supported
+-7117 kRAInvalidSerialProtocol kRAInvalidSerialProtocol
+-7116 kRAInvalidPortState kRAInvalidPortState
+-7115 dcmBadKeyErr bad key information
+-7114 kRAPortBusy kRAPortBusy
+-7113 kRAInstallationDamaged kRAInstallationDamaged
+-7112 dcmBadFieldTypeErr no such field type supported
+-7111 dcmBadFieldInfoErr incomplete information
+-7110 dcmNecessaryFieldErr lack required/identify field
+-7109 dcmDupRecordErr same record already exist
+-7108 kRANotConnected kRANotConnected
+-7107 dcmBlockFullErr dictionary block full
+-7106 kRAMissingResources kRAMissingResources
+-7105 dcmDictionaryBusyErr dictionary is busy
+-7104 dcmDictionaryNotOpenErr dictionary not opened
+-7103 dcmPermissionErr invalid permission
+-7102 dcmBadDictionaryErr invalid dictionary
+-7101 dcmNotDictionaryErr not dictionary
+-7100 kRAInvalidParameter kRAInvalidParameter
+-7000 laEngineNotFoundErr can't find the engine
+-6999 laPropertyErr Error in properties
+-6998 kUSBUnknownDeviceErr device ref not recognised
+-6997 laPropertyIsReadOnlyErr the property is read only
+-6996 laPropertyUnknownErr the property is unknown to this environment
+-6995 laPropertyValueErr Invalid property value
+-6994 laDictionaryTooManyErr too many dictionaries
+-6993 laDictionaryUnknownErr can't use this dictionary with this environment
+-6992 laDictionaryNotOpenedErr the dictionary is not opened
+-6991 laTextOverFlowErr text is too long
+-6990 laFailAnalysisErr analysis failed
+-6989 laNoMoreMorphemeErr nothing to read
+-6988 laInvalidPathErr path is not correct
+-6987 kUSBNotHandled Notification was not handled (same as NotFound)
+-6986 laEnvironmentNotFoundErr can't fint the specified environment
+-6985 laEnvironmentBusyErr specified environment is used
+-6984 laTooSmallBufferErr output buffer is too small to store any result
+-6983 kUSBFlagsError Unused flags not zeroed
+-6982 kUSBAbortedError Pipe aborted
+-6981 kUSBNoBandwidthError Not enough bandwidth available
+-6980 kUSBPipeIdleError Pipe is Idle, it will not accept transactions
+-6979 kUSBPipeStalledError Pipe has stalled, error needs to be cleared
+-6978 kUSBUnknownInterfaceErr Interface ref not recognised
+-6977 kUSBDeviceBusy Device is already being configured
+-6976 kUSBDevicePowerProblem Device has a power problem
+-6975 kUSBInvalidBuffer bad buffer, usually nil
+-6974 kUSBDeviceSuspended Device is suspended
+-6973 kUSBDeviceNotSuspended device is not suspended for resume
+-6972 kUSBDeviceDisconnected Disconnected during suspend or reset
+-6971 kUSBTimedOut Transaction timed out.
+-6970 kUSBQueueAborted Pipe zero stall cleared.
+-6969 kUSBPortDisabled The port you are attached to is disabled, use USBDeviceReset.
+-6950 kUSBBadDispatchTable Improper driver dispatch table
+-6949 kUSBUnknownNotification Notification type not defined
+-6948 kUSBQueueFull Internal queue maxxed
+-6916 kUSBLinkErr kUSBLinkErr
+-6915 kUSBCRCErr Pipe stall, bad CRC
+-6914 kUSBBitstufErr Pipe stall, bitstuffing
+-6913 kUSBDataToggleErr Pipe stall, Bad data toggle
+-6912 kUSBEndpointStallErr Device didn't understand
+-6911 kUSBNotRespondingErr Pipe stall, No device, device hung
+-6910 kUSBPIDCheckErr Pipe stall, PID CRC error
+-6909 kUSBWrongPIDErr Pipe stall, Bad or wrong PID
+-6908 kUSBOverRunErr Packet too large or more data than buffer
+-6907 kUSBUnderRunErr Less data than buffer
+-6906 kUSBRes1Err kUSBRes1Err
+-6905 kUSBRes2Err kUSBRes2Err
+-6904 kUSBBufOvrRunErr Host hardware failure on data in, PCI busy?
+-6903 kUSBBufUnderRunErr Host hardware failure on data out, PCI busy?
+-6902 kUSBNotSent1Err Transaction not sent
+-6901 kUSBNotSent2Err Transaction not sent
+-6232 kDMFoundErr Did not proceed because we found an item
+-6231 kDMMainDisplayCannotMoveErr Trying to move main display (or a display mirrored to it)
+-6230 kDMDisplayAlreadyInstalledErr Attempt to add an already installed display.
+-6229 kDMDisplayNotFoundErr Could not find item (will someday remove).
+-6228 kDMDriverNotDisplayMgrAwareErr Video Driver does not support display manager.
+-6227 kDMSWNotInitializedErr Required software not initialized (eg windowmanager or display mgr).
+-6226 kSysSWTooOld Missing critical pieces of System Software.
+-6225 kDMMirroringNotOn Returned by all calls that need mirroring to be on to do their thing.
+-6224 kDMCantBlock Mirroring is already on, canÕt Block now (call DMUnMirror() first).
+-6223 kDMMirroringBlocked DMBlockMirroring() has been called.
+-6222 kDMWrongNumberOfDisplays Can only handle 2 displays for now.
+-6221 kDMMirroringOnAlready Returned by all calls that need mirroring to be off to do their thing.
+-6220 kDMGenErr Unexpected Error
+-6150 kQTSSUnknownErr kQTSSUnknownErr
+-5753 collectionVersionErr collectionVersionErr
+-5752 collectionIndexRangeErr collectionIndexRangeErr
+-5751 collectionItemNotFoundErr collectionItemNotFoundErr
+-5750 collectionItemLockedErr collectionItemLockedErr
+-5699 kNavMissingKindStringErr kNavMissingKindStringErr
+-5698 kNavInvalidCustomControlMessageErr kNavInvalidCustomControlMessageErr
+-5697 kNavCustomControlMessageFailedErr kNavCustomControlMessageFailedErr
+-5696 kNavInvalidSystemConfigErr kNavInvalidSystemConfigErr
+-5695 kNavWrongDialogClassErr kNavWrongDialogClassErr
+-5694 kNavWrongDialogStateErr kNavWrongDialogStateErr
+-5640 dialogNoTimeoutErr dialogNoTimeoutErr
+-5623 menuInvalidErr menu is invalid
+-5622 menuItemNotFoundErr specified menu item wasn't found
+-5621 menuUsesSystemDefErr GetMenuDefinition failed because the menu uses the system MDEF
+-5620 menuNotFoundErr specified menu or menu ID wasn't found
+-5615 windowWrongStateErr window is not in a state that is valid for the current action
+-5614 windowManagerInternalErr something really weird happened inside the window manager
+-5613 windowAttributesConflictErr passed some attributes that are mutually exclusive
+-5612 windowAttributeImmutableErr tried to change attributes which can't be changed
+-5611 errWindowDoesNotFitOnscreen ConstrainWindowToScreen could not make the window fit onscreen
+-5610 errWindowNotFound returned from FindWindowOfClass
+-5609 errFloatingWindowsNotInitialized called HideFloatingWindows or ShowFloatingWindows without calling InitFloatingWindows
+-5608 errWindowsAlreadyInitialized tried to call InitFloatingWindows twice, or called InitWindows and then floating windows
+-5607 errUserWantsToDragWindow if returned from TrackWindowProxyDrag, you should call DragWindow on the window
+-5606 errCorruptWindowDescription tried to load a corrupt window description (size or version fields incorrect)
+-5605 errUnrecognizedWindowClass tried to create a window with a bad WindowClass
+-5604 errWindowPropertyNotFound tried to get a nonexistent property
+-5603 errInvalidWindowProperty tried to access a property tag with private creator
+-5602 errWindowDoesNotHaveProxy tried to do something requiring a proxy to a window which doesnÕt have a proxy
+-5601 errUnsupportedWindowAttributesForClass tried to create a window with WindowAttributes not supported by the WindowClass
+-5600 errInvalidWindowPtr tried to pass a bad WindowRef argument
+-5553 gestaltLocationErr gestalt function ptr wasn't in sysheap
+-5552 gestaltDupSelectorErr tried to add an entry that already existed
+-5551 gestaltUndefSelectorErr undefined selector was passed to Gestalt
+-5550 gestaltUnknownErr value returned if Gestalt doesn't know the answer
+-5502 envVersTooBig Version bigger than call can handle
+-5501 envBadVers Version non-positive
+-5500 envNotPresent returned by glue.
+-5421 qtsAddressBusyErr qtsAddressBusyErr
+-5420 qtsConnectionFailedErr qtsConnectionFailedErr
+-5408 qtsTimeoutErr qtsTimeoutErr
+-5407 qtsUnknownValueErr qtsUnknownValueErr
+-5406 qtsTooMuchDataErr qtsTooMuchDataErr
+-5405 qtsUnsupportedFeatureErr qtsUnsupportedFeatureErr
+-5404 qtsUnsupportedRateErr qtsUnsupportedRateErr
+-5403 qtsUnsupportedDataTypeErr qtsUnsupportedDataTypeErr
+-5402 qtsBadDataErr something is wrong with the data
+-5401 qtsBadStateErr qtsBadStateErr
+-5400 qtsBadSelectorErr qtsBadSelectorErr
+-5388 errIAEndOfTextRun errIAEndOfTextRun
+-5387 errIATextExtractionErr errIATextExtractionErr
+-5386 errIAInvalidDocument errIAInvalidDocument
+-5385 errIACanceled errIACanceled
+-5384 errIABufferTooSmall errIABufferTooSmall
+-5383 errIANoMoreItems errIANoMoreItems
+-5382 errIAParamErr errIAParamErr
+-5381 errIAAllocationErr errIAAllocationErr
+-5380 errIAUnknownErr errIAUnknownErr
+-5363 hrURLNotHandledErr hrURLNotHandledErr
+-5362 hrUnableToResizeHandleErr hrUnableToResizeHandleErr
+-5361 hrMiscellaneousExceptionErr hrMiscellaneousExceptionErr
+-5360 hrHTMLRenderingLibNotInstalledErr hrHTMLRenderingLibNotInstalledErr
+-5253 errCannotUndo errCannotUndo
+-5252 errNonContiuousAttribute errNonContiuousAttribute
+-5251 errUnknownElement errUnknownElement
+-5250 errReadOnlyText errReadOnlyText
+-5249 errEmptyScrap errEmptyScrap
+-5248 errNoHiliteText errNoHiliteText
+-5247 errOffsetNotOnElementBounday errOffsetNotOnElementBounday
+-5246 errInvalidRange errInvalidRange
+-5245 errIteratorReachedEnd errIteratorReachedEnd
+-5244 errEngineNotFound errEngineNotFound
+-5243 errAlreadyInImagingMode errAlreadyInImagingMode
+-5242 errNotInImagingMode errNotInImagingMode
+-5241 errMarginWilllNotFit errMarginWilllNotFit
+-5240 errUnknownAttributeTag errUnknownAttributeTag
+-5063 afpSameNodeErr An Attempt was made to connect to a file server running on the same machine
+-5062 afpAlreadyMounted The volume is already mounted
+-5061 afpCantMountMoreSrvre The Maximum number of server connections has been reached
+-5060 afpBadDirIDType afpBadDirIDType
+-5048 afpCallNotAllowed The server knows what you wanted to do, but won't let you do it just now
+-5047 afpAlreadyLoggedInErr User has been authenticated but is already logged in from another machine (and that's not allowed on this server)
+-5046 afpPwdPolicyErr Password does not conform to servers password policy
+-5045 afpPwdNeedsChangeErr The password needs to be changed
+-5044 afpInsideTrashErr The folder being shared is inside the trash folder OR the shared folder is being moved into the trash folder
+-5043 afpInsideSharedErr The folder being shared is inside a shared folder OR the folder contains a shared folder and is being moved into a shared folder
+-5042 afpPwdExpiredErr The password being used is too old: this requires the user to change the password before log-in can continue
+-5041 afpPwdTooShortErr The password being set is too short: there is a minimum length that must be met or exceeded
+-5040 afpPwdSameErr Someone tried to change their password to the same password on a mantadory password change
+-5039 afpBadIDErr afpBadIDErr
+-5038 afpSameObjectErr afpSameObjectErr
+-5037 afpCatalogChanged afpCatalogChanged
+-5036 afpDiffVolErr afpDiffVolErr
+-5035 afpIDExists afpIDExists
+-5034 afpIDNotFound afpIDNotFound
+-5033 afpContainsSharedErr the folder being shared contains a shared folder
+-5032 afpObjectLocked Object is M/R/D/W inhibited
+-5031 afpVolLocked Volume is Read-Only
+-5030 afpIconTypeError Icon size specified different from existing icon size
+-5029 afpDirNotFound Unknown directory specified
+-5028 afpCantRename AFPRename cannot rename volume
+-5027 afpServerGoingDown Server is shutting down
+-5026 afpTooManyFilesOpen Maximum open file count reached
+-5025 afpObjectTypeErr File/Directory specified where Directory/File expected
+-5024 afpCallNotSupported Unsupported AFP call was made
+-5023 afpUserNotAuth No AFPLogin call has successfully been made for this session
+-5022 afpSessClosed Session closed
+-5021 afpRangeOverlap Some or all of range already locked by same user
+-5020 afpRangeNotLocked Tried to unlock range that was not locked by user
+-5019 afpParmErr A specified parameter was out of allowable range
+-5018 afpObjectNotFound Specified file or directory does not exist
+-5017 afpObjectExists Specified destination file or directory already exists
+-5016 afpNoServer Server not responding
+-5015 afpNoMoreLocks Maximum lock limit reached
+-5014 afpMiscErr Unexpected error encountered during execution
+-5013 afpLockErr Some or all of requested range is locked by another user
+-5012 afpItemNotFound Unknown UserName/UserID or missing comment/APPL entry
+-5011 afpFlatVol Cannot create directory on specified volume
+-5010 afpFileBusy Cannot delete an open file
+-5009 afpEofError Read beyond logical end-of-file
+-5008 afpDiskFull Insufficient free space on volume for operation
+-5007 afpDirNotEmpty Cannot delete non-empty directory
+-5006 afpDenyConflict Specified open/deny modes conflict with current open modes
+-5005 afpCantMove Move destination is offspring of source, or root was specified
+-5004 afpBitmapErr Bitmap contained bits undefined for call
+-5003 afpBadVersNum Unknown AFP protocol version number specified
+-5002 afpBadUAM Unknown user authentication method specified
+-5001 afpAuthContinue Further information required to complete AFPLogin call
+-5000 afpAccessDenied Insufficient access privileges for operation
+-4999 illegalScrapFlavorSizeErr illegalScrapFlavorSizeErr
+-4998 illegalScrapFlavorTypeErr illegalScrapFlavorTypeErr
+-4997 illegalScrapFlavorFlagsErr illegalScrapFlavorFlagsErr
+-4996 scrapFlavorSizeMismatchErr scrapFlavorSizeMismatchErr
+-4995 scrapFlavorFlagsMismatchErr scrapFlavorFlagsMismatchErr
+-4994 nilScrapFlavorDataErr nilScrapFlavorDataErr
+-4993 noScrapPromiseKeeperErr noScrapPromiseKeeperErr
+-4992 scrapPromiseNotKeptErr scrapPromiseNotKeptErr
+-4991 processStateIncorrectErr processStateIncorrectErr
+-4990 badScrapRefErr badScrapRefErr
+-4989 duplicateScrapFlavorErr duplicateScrapFlavorErr
+-4988 internalScrapErr internalScrapErr
+-4960 coreFoundationUnknownErr coreFoundationUnknownErr
+-4276 badRoutingSizeErr badRoutingSizeErr
+-4275 routingNotFoundErr routingNotFoundErr
+-4274 duplicateRoutingErr duplicateRoutingErr
+-4273 invalidFolderTypeErr invalidFolderTypeErr
+-4272 noMoreFolderDescErr noMoreFolderDescErr
+-4271 duplicateFolderDescErr duplicateFolderDescErr
+-4270 badFolderDescErr badFolderDescErr
+-4217 cmCantGamutCheckError Gammut checking not supported by this ColorWorld
+-4216 cmNamedColorNotFound NamedColor not found
+-4215 cmCantCopyModifiedV1Profile Illegal to copy version 1 profiles that have been modified
+-4214 cmRangeOverFlow Color conversion warning that some output color values over/underflowed and were clipped
+-4213 cmInvalidProfileComment Bad Profile comment during drawpicture
+-4212 cmNoGDevicesError Begin/End Matching -- no gdevices available
+-4211 cmInvalidDstMap Destination pix/bit map was invalid
+-4210 cmInvalidSrcMap Source pix/bit map was invalid
+-4209 cmInvalidColorSpace Profile colorspace does not match bitmap type
+-4208 cmErrIncompatibleProfile Other ColorSync Errors
+-4207 cmSearchError cmSearchError
+-4206 cmInvalidSearch Bad Search Handle
+-4205 cmInvalidProfileLocation Operation not supported for this profile location
+-4204 cmInvalidProfile A Profile must contain a 'cs1 ' tag to be valid
+-4203 cmFatalProfileErr cmFatalProfileErr
+-4202 cmCantDeleteElement cmCantDeleteElement
+-4201 cmIndexRangeErr Tag index out of range
+-4200 kNSLInitializationFailed UNABLE TO INITIALIZE THE MANAGER!!!!! DO NOT CONTINUE!!!!
+-4199 kNSLNotInitialized kNSLNotInitialized
+-4198 kNSLInsufficientSysVer kNSLInsufficientSysVer
+-4197 kNSLInsufficientOTVer kNSLInsufficientOTVer
+-4196 kNSLNoElementsInList kNSLNoElementsInList
+-4195 kNSLBadReferenceErr kNSLBadReferenceErr
+-4194 kNSLBadServiceTypeErr kNSLBadServiceTypeErr
+-4193 kNSLBadDataTypeErr kNSLBadDataTypeErr
+-4192 kNSLBadNetConnection kNSLBadNetConnection
+-4191 kNSLNoSupportForService kNSLNoSupportForService
+-4190 kNSLInvalidPluginSpec kNSLInvalidPluginSpec
+-4189 kNSLRequestBufferAlreadyInList kNSLRequestBufferAlreadyInList
+-4188 kNSLNoContextAvailable (ContinueLookup function ptr invalid)
+-4187 kNSLBufferTooSmallForData (Client buffer too small for data from plugin)
+-4186 kNSLCannotContinueLookup (Can't continue lookup; error or bad state)
+-4185 kNSLBadClientInfoPtr (nil ClientAsyncInfoPtr; no reference available)
+-4184 kNSLNullListPtr (client is trying to add items to a nil list)
+-4183 kNSLBadProtocolTypeErr (client is trying to add a null protocol type)
+-4182 kNSLPluginLoadFailed (manager unable to load one of the plugins)
+-4181 kNSLNoPluginsFound (manager didn't find any valid plugins to load)
+-4180 kNSLSearchAlreadyInProgress (you can only have one ongoing search per clientRef)
+-4179 kNSLNoPluginsForSearch (no plugins will respond to search request; bad protocol(s)?)
+-4178 kNSLNullNeighborhoodPtr (client passed a null neighborhood ptr)
+-4177 kNSLSomePluginsFailedToLoad (one or more plugins failed to load, but at least one did load; this error isn't fatal)
+-4176 kNSLErrNullPtrError kNSLErrNullPtrError
+-4175 kNSLNotImplementedYet kNSLNotImplementedYet
+-4174 kNSLUILibraryNotAvailable The NSL UI Library needs to be in the Extensions Folder
+-4173 kNSLNoCarbonLib kNSLNoCarbonLib
+-4172 kNSLBadURLSyntax URL contains illegal characters
+-4171 kNSLSchedulerError A custom thread routine encountered an error
+-4170 kNSL68kContextNotSupported no 68k allowed
+-4009 noHelpForItem noHelpForItem
+-4008 badProfileError badProfileError
+-4007 colorSyncNotInstalled colorSyncNotInstalled
+-4006 pickerCantLive pickerCantLive
+-4005 cantLoadPackage cantLoadPackage
+-4004 cantCreatePickerWindow cantCreatePickerWindow
+-4003 cantLoadPicker cantLoadPicker
+-4002 pickerResourceError pickerResourceError
+-4001 requiredFlagsDontMatch requiredFlagsDontMatch
+-4000 firstPickerError firstPickerError
+-3285 kOTPortLostConnection
+-3284 kOTUserRequestedErr
+-3283 kOTConfigurationChangedErr
+-3282 kOTBadConfigurationErr
+-3281 kOTPortWasEjectedErr
+-3280 kOTPortHasDiedErr
+-3279 kOTClientNotInittedErr
+-3278 kENOMSGErr
+-3277 kESRCHErr
+-3276 kEINPROGRESSErr
+-3275 kENODATAErr
+-3274 kENOSTRErr
+-3273 kECANCELErr
+-3272 kEBADMSGErr
+-3271 kENOSRErr
+-3270 kETIMEErr
+-3269 kEPROTOErr ‚‚‚ fill out missing codes ‚‚‚
+-3264 kEHOSTUNREACHErr No route to host
+-3263 kEHOSTDOWNErr Host is down
+-3260 kECONNREFUSEDErr Connection refused
+-3259 kETIMEDOUTErr Connection timed out
+-3258 kETOOMANYREFSErr Too many references: can't splice
+-3257 kESHUTDOWNErr Can't send after socket shutdown
+-3256 kENOTCONNErr Socket is not connected
+-3255 kEISCONNErr Socket is already connected
+-3254 kENOBUFSErr No buffer space available
+-3253 kECONNRESETErr Connection reset by peer
+-3252 kECONNABORTEDErr Software caused connection abort
+-3251 kENETRESETErr Network dropped connection on reset
+-3250 kENETUNREACHErr Network is unreachable
+-3249 kENETDOWNErr Network is down
+-3248 kEADDRNOTAVAILErr Can't assign requested address
+-3247 kEADDRINUSEErr Address already in use
+-3244 kEOPNOTSUPPErr Operation not supported on socket
+-3243 kESOCKTNOSUPPORTErr Socket type not supported
+-3242 kEPROTONOSUPPORTErr Protocol not supported
+-3241 kENOPROTOOPTErr Protocol not available
+-3240 kEPROTOTYPEErr Protocol wrong type for socket
+-3239 kEMSGSIZEErr Message too long
+-3238 kEDESTADDRREQErr Destination address required
+-3237 kENOTSOCKErr Socket operation on non-socket
+-3236 kEALREADYErr
+-3234 kEWOULDBLOCKErr Call would block, so was aborted
+-3233 kERANGEErr Message size too large for STREAM
+-3231 kEPIPEErr Broken pipe
+-3224 kENOTTYErr Not a character device
+-3221 kEINVALErr Invalid argument
+-3218 kENODEVErr No such device
+-3216 kOTDuplicateFoundErr OT generic duplicate found error
+-3215 kEBUSYErr Device or resource busy
+-3213 kEFAULTErr Bad address
+-3212 kEACCESErr Permission denied
+-3211 kOTOutOfMemoryErr OT ran out of memory, may be a temporary
+-3210 kEAGAINErr Try operation again later
+-3208 kEBADFErr Bad file number
+-3205 kENXIOErr No such device or address
+-3204 kEIOErr I/O error
+-3203 kEINTRErr Interrupted system service
+-3202 kENORSRCErr No such resource
+-3201 kOTNotFoundErr OT generic not found error
+-3200 kEPERMErr Permission denied
+-3180 kOTCanceledErr XTI2OSStatus(TCANCELED) The command was cancelled
+-3179 kOTBadSyncErr XTI2OSStatus(TBADSYNC) A synchronous call at interrupt time
+-3178 kOTProtocolErr XTI2OSStatus(TPROTO) An unspecified provider error occurred
+-3177 kOTQFullErr XTI2OSStatus(TQFULL)
+-3176 kOTResAddressErr XTI2OSStatus(TRESADDR)
+-3175 kOTResQLenErr XTI2OSStatus(TRESQLEN)
+-3174 kOTProviderMismatchErr XTI2OSStatus(TPROVMISMATCH) Tried to accept on incompatible endpoint
+-3173 kOTIndOutErr XTI2OSStatus(TINDOUT) Accept failed because of pending listen
+-3172 kOTAddressBusyErr XTI2OSStatus(TADDRBUSY) Address requested is already in use
+-3171 kOTBadQLenErr XTI2OSStatus(TBADQLEN) A Bind to an in-use addr with qlen > 0
+-3170 kOTBadNameErr XTI2OSStatus(TBADNAME) A bad endpoint name was supplied
+-3169 kOTNoStructureTypeErr XTI2OSStatus(TNOSTRUCTYPE) Bad structure type requested for OTAlloc
+-3168 kOTStateChangeErr XTI2OSStatus(TSTATECHNG) State is changing - try again later
+-3167 kOTNotSupportedErr XTI2OSStatus(TNOTSUPPORT) Command is not supported
+-3166 kOTNoReleaseErr XTI2OSStatus(TNOREL) No orderly release indication available
+-3165 kOTBadFlagErr XTI2OSStatus(TBADFLAG) A Bad flag value was supplied
+-3164 kOTNoUDErrErr XTI2OSStatus(TNOUDERR) No Unit Data Error indication available
+-3163 kOTNoDisconnectErr XTI2OSStatus(TNODIS) No disconnect indication available
+-3162 kOTNoDataErr XTI2OSStatus(TNODATA) No data available for reading
+-3161 kOTFlowErr XTI2OSStatus(TFLOW) Provider is flow-controlled
+-3160 kOTBufferOverflowErr XTI2OSStatus(TBUFOVFLW) Passed buffer not big enough
+-3159 kOTBadDataErr XTI2OSStatus(TBADDATA) An illegal amount of data was specified
+-3158 kOTLookErr XTI2OSStatus(TLOOK) An event occurred - call Look()
+-3157 kOTSysErrorErr XTI2OSStatus(TSYSERR) A system error occurred
+-3156 kOTBadSequenceErr XTI2OSStatus(TBADSEQ) Sequence specified does not exist
+-3155 kOTOutStateErr XTI2OSStatus(TOUTSTATE) Call issued in wrong state
+-3154 kOTNoAddressErr XTI2OSStatus(TNOADDR) No address was specified
+-3153 kOTBadReferenceErr XTI2OSStatus(TBADF) Bad provider reference
+-3152 kOTAccessErr XTI2OSStatus(TACCES) Missing access permission
+-3151 kOTBadOptionErr XTI2OSStatus(TBADOPT) A Bad option was specified
+-3150 kOTBadAddressErr XTI2OSStatus(TBADADDR) A Bad address was specified
+-3109 sktClosedErr sktClosedErr
+-3108 recNotFnd recNotFnd
+-3107 atpBadRsp atpBadRsp
+-3106 atpLenErr atpLenErr
+-3105 readQErr readQErr
+-3104 extractErr extractErr
+-3103 ckSumErr ckSumErr
+-3102 noMPPErr noMPPErr
+-3101 buf2SmallErr buf2SmallErr
+-3032 noPrefAppErr noPrefAppErr
+-3031 badTranslationSpecErr badTranslationSpecErr
+-3030 noTranslationPathErr noTranslationPathErr
+-3026 couldNotParseSourceFileErr Source document does not contain source type
+-3025 invalidTranslationPathErr Source type to destination type not a valid path
+-3005 retryComponentRegistrationErr retryComponentRegistrationErr
+-3004 unresolvedComponentDLLErr unresolvedComponentDLLErr
+-3003 componentDontRegister componentDontRegister
+-3002 componentNotCaptured componentNotCaptured
+-3001 validInstancesExist validInstancesExist
+-3000 invalidComponentID invalidComponentID
+-2899 cfragLastErrCode The last value in the range of CFM errors.
+-2831 cfragOutputLengthErr An output parameter is too small to hold the value.
+-2830 cfragAbortClosureErr Used by notification handlers to abort a closure.
+-2829 cfragClosureIDErr The closure ID was not valid.
+-2828 cfragContainerIDErr The fragment container ID was not valid.
+-2827 cfragNoRegistrationErr The registration name was not found.
+-2826 cfragNotClosureErr The closure ID was actually a connection ID.
+-2825 cfragFileSizeErr A file was too large to be mapped.
+-2824 cfragFragmentUsageErr A semantic error in usage of the fragment.
+-2823 cfragArchitectureErr A fragment has an unacceptable architecture.
+-2822 cfragNoApplicationErr No application member found in the cfrg resource.
+-2821 cfragInitFunctionErr A fragment's initialization routine returned an error.
+-2820 cfragFragmentCorruptErr A fragment's container was corrupt (known format).
+-2819 cfragCFMInternalErr An internal inconstistancy has been detected.
+-2818 cfragCFMStartupErr Internal error during CFM initialization.
+-2817 cfragLibConnErr
+-2816 cfragInitAtBootErr A boot library has an initialization function. (System 7 only)
+-2815 cfragInitLoopErr Circularity in required initialization order.
+-2814 cfragImportTooNewErr An import library was too new for a client.
+-2813 cfragImportTooOldErr An import library was too old for a client.
+-2812 cfragInitOrderErr
+-2811 cfragNoIDsErr No more CFM IDs for contexts, connections, etc.
+-2810 cfragNoClientMemErr Out of memory for fragment mapping or section instances.
+-2809 cfragNoPrivateMemErr Out of memory for internal bookkeeping.
+-2808 cfragNoPositionErr The registration insertion point was not found.
+-2807 cfragUnresolvedErr A fragment had "hard" unresolved imports.
+-2806 cfragFragmentFormatErr A fragment's container format is unknown.
+-2805 cfragDupRegistrationErr The registration name was already in use.
+-2804 cfragNoLibraryErr The named library was not found.
+-2803 cfragNoSectionErr The specified section was not found.
+-2802 cfragNoSymbolErr The specified symbol was not found.
+-2801 cfragConnectionIDErr The connection ID was not valid.
+-2800 cfragFirstErrCode The first value in the range of CFM errors.
+-2780 errASInconsistentNames English errors:
+-2763 errASNoResultReturned The range -2780 thru -2799 is reserved for dialect specific error codes. (Error codes from different dialects may overlap.)
+-2762 errASParameterNotForEvent errASParameterNotForEvent
+-2761 errASIllegalFormalParameter errASIllegalFormalParameter
+-2760 errASTerminologyNestingTooDeep errASTerminologyNestingTooDeep
+-2755 OSAControlFlowError Signaled when illegal control flow occurs in an application (no catcher for throw, non-lexical loop exit, etc.)
+-2754 OSAInconsistentDeclarations Signaled when a variable is declared inconsistently in the same scope, such as both local and global
+-2753 OSAUndefinedVariable Signaled when a variable is accessed that has no value
+-2752 OSADuplicateHandler Signaled when more than one handler is defined with the same name in a scope where the language doesn't allow it
+-2751 OSADuplicateProperty Signaled when a formal parameter, local variable, or instance variable is specified more than once.
+-2750 OSADuplicateParameter Signaled when a formal parameter, local variable, or instance variable is specified more than once
+-2742 OSATokenTooLong Signaled when a name or number is too long to be parsed
+-2741 OSASyntaxTypeError Signaled when another form of syntax was expected. (e.g. "expected a <type> but found <this>")
+-2740 OSASyntaxError Signaled when a syntax error occurs. (e.g. "Syntax error" or "<this> can't go after <that>")
+-2721 errASCantCompareMoreThan32k Parser/Compiler errors:
+-2720 errASCantConsiderAndIgnore errASCantConsiderAndIgnore
+-2710 errOSACantCreate errOSACantCreate
+-2709 errOSACantGetTerminology errOSACantGetTerminology
+-2708 errOSADataBlockTooLarge Signaled when an intrinsic limitation is exceeded for the size of a value or data structure.
+-2707 errOSAInternalTableOverflow Signaled when a runtime internal data structure overflows
+-2706 errOSAStackOverflow Signaled when the runtime stack overflows
+-2705 errOSACorruptTerminology Signaled when an application's terminology resource is not readable
+-2704 errOSAAppNotHighLevelEventAware Signaled when an application can't respond to AppleEvents
+-2703 errOSACantLaunch Signaled when application can't be launched or when it is remote and program linking is not enabled
+-2702 errOSANumericOverflow Signaled when integer or real value is too large to be represented
+-2701 errOSADivideByZero Signaled when there is an attempt to divide by zero
+-2700 errOSAGeneralError Signaled by user scripts or applications when no actual error code is to be returned.
+-2582 noIconDataAvailableErr The necessary icon data is not available
+-2581 noSuchIconErr The requested icon could not be found
+-2580 invalidIconRefErr The icon ref is not valid
+-2557 nrCallNotSupported This call is not available or supported on this machine
+-2556 nrTransactionAborted transaction was aborted
+-2555 nrExitedIteratorScope outer scope of iterator was exited
+-2554 nrIterationDone iteration operation is done
+-2553 nrPropertyAlreadyExists property already exists
+-2552 nrInvalidEntryIterationOp invalid entry iteration operation
+-2551 nrPathBufferTooSmall buffer for path is too small
+-2550 nrPathNotFound a path component lookup failed
+-2549 nrResultCodeBase nrResultCodeBase
+-2548 nrOverrunErr nrOverrunErr
+-2547 nrNotModifiedErr nrNotModifiedErr
+-2546 nrTypeMismatchErr nrTypeMismatchErr
+-2545 nrPowerSwitchAbortErr nrPowerSwitchAbortErr
+-2544 nrPowerErr nrPowerErr
+-2543 nrDataTruncatedErr nrDataTruncatedErr
+-2542 nrNotSlotDeviceErr nrNotSlotDeviceErr
+-2541 nrNameErr nrNameErr
+-2540 nrNotCreatedErr nrNotCreatedErr
+-2539 nrNotFoundErr nrNotFoundErr
+-2538 nrInvalidNodeErr nrInvalidNodeErr
+-2537 nrNotEnoughMemoryErr nrNotEnoughMemoryErr
+-2536 nrLockedErr nrLockedErr
+-2526 mmInternalError mmInternalError
+-2524 tsmDefaultIsNotInputMethodErr Current Input source is KCHR or uchr, not Input Method (GetDefaultInputMethod)
+-2523 tsmNoStem No stem exists for the token
+-2522 tsmNoMoreTokens No more tokens are available for the source text
+-2521 tsmNoHandler No Callback Handler exists for callback
+-2520 tsmInvalidContext Invalid TSMContext specified in call
+-2519 tsmUnknownErr any other errors
+-2518 tsmUnsupportedTypeErr unSupported interface type error
+-2517 tsmScriptHasNoIMErr script has no imput method or is using old IM
+-2516 tsmInputMethodIsOldErr returned by GetDefaultInputMethod
+-2515 tsmComponentAlreadyOpenErr text service already opened for the document
+-2514 tsmTSNotOpenErr text service is not open
+-2513 tsmTSHasNoMenuErr the text service has no menu
+-2512 tsmUseInputWindowErr not TSM aware because we are using input window
+-2511 tsmDocumentOpenErr there are open documents
+-2510 tsmTextServiceNotFoundErr no text service found
+-2509 tsmCantOpenComponentErr canÕt open the component
+-2508 tsmNoOpenTSErr no open text service
+-2507 tsmDocNotActiveErr document is NOT active
+-2506 tsmTSMDocBusyErr document is still active
+-2505 tsmInvalidDocIDErr invalid TSM documentation id
+-2504 tsmNeverRegisteredErr app never registered error (not TSM aware)
+-2503 tsmAlreadyRegisteredErr want to register again error
+-2502 tsmNotAnAppErr not an application error
+-2501 tsmInputMethodNotFoundErr tsmInputMethodNotFoundErr
+-2500 tsmUnsupScriptLanguageErr tsmUnsupScriptLanguageErr
+-2499 kernelUnrecoverableErr kernelUnrecoverableErr
+-2422 kernelReturnValueErr kernelReturnValueErr
+-2421 kernelAlreadyFreeErr kernelAlreadyFreeErr
+-2419 kernelIDErr kernelIDErr
+-2418 kernelExceptionErr kernelExceptionErr
+-2417 kernelTerminatedErr kernelTerminatedErr
+-2416 kernelInUseErr kernelInUseErr
+-2415 kernelTimeoutErr kernelTimeoutErr
+-2414 kernelAsyncReceiveLimitErr kernelAsyncReceiveLimitErr
+-2413 kernelAsyncSendLimitErr kernelAsyncSendLimitErr
+-2412 kernelAttributeErr kernelAttributeErr
+-2411 kernelExecutionLevelErr kernelExecutionLevelErr
+-2410 kernelDeletePermissionErr kernelDeletePermissionErr
+-2409 kernelExecutePermissionErr kernelExecutePermissionErr
+-2408 kernelReadPermissionErr kernelReadPermissionErr
+-2407 kernelWritePermissionErr kernelWritePermissionErr
+-2406 kernelObjectExistsErr kernelObjectExistsErr
+-2405 kernelUnsupportedErr kernelUnsupportedErr
+-2404 kernelPrivilegeErr kernelPrivilegeErr
+-2403 kernelOptionsErr kernelOptionsErr
+-2402 kernelCanceledErr kernelCanceledErr
+-2401 kernelIncompleteErr kernelIncompleteErr
+-2209 badCallOrderErr Usually due to a status call being called prior to being setup first
+-2208 noDMAErr CanÕt do DMA digitizing (i.e. can't go to requested dest
+-2207 badDepthErr CanÕt digitize into this depth
+-2206 notExactSizeErr CanÕt do exact size requested
+-2205 noMoreKeyColorsErr all key indexes in use
+-2204 notExactMatrixErr warning of bad matrix, digitizer did its best
+-2203 matrixErr bad matrix, digitizer did nothing
+-2202 qtParamErr bad input parameter (out of range, etc)
+-2201 digiUnimpErr feature unimplemented
+-2159 qtXMLApplicationErr qtXMLApplicationErr
+-2158 qtXMLParseErr qtXMLParseErr
+-2157 qtActionNotHandledErr qtActionNotHandledErr
+-2149 notEnoughDataErr notEnoughDataErr
+-2148 urlDataHFTPURLErr urlDataHFTPURLErr
+-2147 urlDataHFTPServerDisconnectedErr urlDataHFTPServerDisconnectedErr
+-2146 urlDataHFTPNoPasswordErr urlDataHFTPNoPasswordErr
+-2145 urlDataHFTPNeedPasswordErr urlDataHFTPNeedPasswordErr
+-2144 urlDataHFTPBadNameListErr urlDataHFTPBadNameListErr
+-2143 urlDataHFTPNoNetDriverErr urlDataHFTPNoNetDriverErr
+-2142 urlDataHFTPFilenameErr urlDataHFTPFilenameErr
+-2141 urlDataHFTPPermissionsErr urlDataHFTPPermissionsErr
+-2140 urlDataHFTPQuotaErr urlDataHFTPQuotaErr
+-2139 urlDataHFTPNoDirectoryErr urlDataHFTPNoDirectoryErr
+-2138 urlDataHFTPDataConnectionErr urlDataHFTPDataConnectionErr
+-2137 urlDataHFTPServerErr urlDataHFTPServerErr
+-2136 urlDataHFTPBadPasswordErr urlDataHFTPBadPasswordErr
+-2135 urlDataHFTPBadUserErr urlDataHFTPBadUserErr
+-2134 urlDataHFTPShutdownErr urlDataHFTPShutdownErr
+-2133 urlDataHFTPProtocolErr urlDataHFTPProtocolErr
+-2132 urlDataHHTTPRedirectErr urlDataHHTTPRedirectErr
+-2131 urlDataHHTTPURLErr urlDataHHTTPURLErr
+-2130 urlDataHHTTPNoNetDriverErr urlDataHHTTPNoNetDriverErr
+-2129 urlDataHHTTPProtocolErr urlDataHHTTPProtocolErr
+-2127 qtNetworkAlreadyAllocatedErr qtNetworkAlreadyAllocatedErr
+-2126 notAllowedToSaveMovieErr notAllowedToSaveMovieErr
+-2125 fileOffsetTooBigErr fileOffsetTooBigErr
+-2124 ASDEntryNotFoundErr ASDEntryNotFoundErr
+-2123 ASDBadForkErr ASDBadForkErr
+-2122 ASDBadHeaderErr ASDBadHeaderErr
+-2121 AAPNotFoundErr AAPNotFoundErr
+-2120 AAPNotCreatedErr AAPNotCreatedErr
+-2119 qfcbNotCreatedErr qfcbNotCreatedErr
+-2118 qfcbNotFoundErr qfcbNotFoundErr
+-2117 wackBadMetaDataErr wackBadMetaDataErr
+-2116 wackForkNotFoundErr wackForkNotFoundErr
+-2115 wackBadFileErr wackBadFileErr
+-2114 unknownFormatErr unknownFormatErr
+-2113 pathNotVerifiedErr pathNotVerifiedErr
+-2112 noPathMappingErr noPathMappingErr
+-2111 emptyPathErr emptyPathErr
+-2110 pathTooLongErr pathTooLongErr
+-2109 cannotBeLeafAtomErr cannotBeLeafAtomErr
+-2108 invalidAtomTypeErr invalidAtomTypeErr
+-2107 invalidAtomContainerErr invalidAtomContainerErr
+-2106 invalidAtomErr invalidAtomErr
+-2105 duplicateAtomTypeAndIDErr duplicateAtomTypeAndIDErr
+-2104 atomIndexInvalidErr atomIndexInvalidErr
+-2103 atomsNotOfSameTypeErr atomsNotOfSameTypeErr
+-2102 notLeafAtomErr notLeafAtomErr
+-2101 cannotFindAtomErr cannotFindAtomErr
+-2097 unsupportedProcessorErr unsupportedProcessorErr
+-2096 unsupportedOSErr unsupportedOSErr
+-2095 qtmlUninitialized qtmlUninitialized
+-2094 qtmlDllEntryNotFoundErr Windows specific errors (when qtml is loading)
+-2093 qtmlDllLoadErr Windows specific errors (when qtml is loading)
+-2092 componentDllEntryNotFoundErr Windows specific errors (when component is loading)
+-2091 componentDllLoadErr Windows specific errors (when component is loading)
+-2090 videoOutputInUseErr videoOutputInUseErr
+-2089 noExportProcAvailableErr noExportProcAvailableErr
+-2087 tuneParseOSErr tuneParseOSErr
+-2086 tunePlayerFullOSErr tunePlayerFullOSErr
+-2085 noteChannelNotAllocatedOSErr noteChannelNotAllocatedOSErr
+-2084 illegalNoteChannelOSErr illegalNoteChannelOSErr
+-2083 synthesizerOSErr synthesizerOSErr
+-2082 synthesizerNotRespondingOSErr synthesizerNotRespondingOSErr
+-2081 midiManagerAbsentOSErr midiManagerAbsentOSErr
+-2080 illegalControllerOSErr illegalControllerOSErr
+-2079 illegalInstrumentOSErr illegalInstrumentOSErr
+-2078 illegalKnobValueOSErr illegalKnobValueOSErr
+-2077 illegalKnobOSErr illegalKnobOSErr
+-2076 illegalChannelOSErr illegalChannelOSErr
+-2075 illegalPartOSErr illegalPartOSErr
+-2074 illegalVoiceAllocationOSErr illegalVoiceAllocationOSErr
+-2073 cantReceiveFromSynthesizerOSErr cantReceiveFromSynthesizerOSErr
+-2072 cantSendToSynthesizerOSErr cantSendToSynthesizerOSErr
+-2071 notImplementedMusicOSErr notImplementedMusicOSErr
+-2070 internalComponentErr internalComponentErr
+-2069 invalidSpriteIDErr invalidSpriteIDErr
+-2068 invalidImageIndexErr invalidImageIndexErr
+-2067 invalidSpriteIndexErr invalidSpriteIndexErr
+-2066 gWorldsNotSameDepthAndSizeErr gWorldsNotSameDepthAndSizeErr
+-2065 invalidSpritePropertyErr invalidSpritePropertyErr
+-2064 invalidSpriteWorldPropertyErr invalidSpriteWorldPropertyErr
+-2063 missingRequiredParameterErr missingRequiredParameterErr
+-2062 movieTextNotFoundErr movieTextNotFoundErr
+-2061 sourceNotFoundErr sourceNotFoundErr
+-2060 noSourceTreeFoundErr noSourceTreeFoundErr
+-2059 samplesAlreadyInMediaErr samplesAlreadyInMediaErr
+-2058 auxiliaryExportDataUnavailable auxiliaryExportDataUnavailable
+-2057 unsupportedAuxiliaryImportData unsupportedAuxiliaryImportData
+-2056 soundSupportNotAvailableErr QT for Windows error
+-2055 noSoundTrackInMovieErr QT for Windows error
+-2054 noVideoTrackInMovieErr QT for Windows error
+-2053 featureUnsupported featureUnsupported
+-2052 couldNotUseAnExistingSample couldNotUseAnExistingSample
+-2051 noDefaultDataRef noDefaultDataRef
+-2050 badDataRefIndex badDataRefIndex
+-2049 invalidDataRefContainer invalidDataRefContainer
+-2048 noMovieFound noMovieFound
+-2047 dataNoDataRef dataNoDataRef
+-2046 endOfDataReached endOfDataReached
+-2045 dataAlreadyClosed dataAlreadyClosed
+-2044 dataAlreadyOpenForWrite dataAlreadyOpenForWrite
+-2043 dataNotOpenForWrite dataNotOpenForWrite
+-2042 dataNotOpenForRead dataNotOpenForRead
+-2041 invalidSampleDescription invalidSampleDescription
+-2040 invalidChunkCache invalidChunkCache
+-2039 invalidSampleDescIndex invalidSampleDescIndex
+-2038 invalidChunkNum invalidChunkNum
+-2037 invalidSampleNum invalidSampleNum
+-2036 invalidRect invalidRect
+-2035 cantEnableTrack cantEnableTrack
+-2034 internalQuickTimeError internalQuickTimeError
+-2033 badEditIndex badEditIndex
+-2032 timeNotInMedia timeNotInMedia
+-2031 timeNotInTrack timeNotInTrack
+-2030 trackNotInMovie trackNotInMovie
+-2029 trackIDNotFound trackIDNotFound
+-2028 badTrackIndex badTrackIndex
+-2027 maxSizeToGrowTooSmall maxSizeToGrowTooSmall
+-2026 userDataItemNotFound userDataItemNotFound
+-2025 staleEditState staleEditState
+-2024 nonMatchingEditState nonMatchingEditState
+-2023 invalidEditState invalidEditState
+-2022 cantCreateSingleForkFile happens when file already exists
+-2021 wfFileNotFound wfFileNotFound
+-2020 movieToolboxUninitialized movieToolboxUninitialized
+-2019 progressProcAborted progressProcAborted
+-2018 mediaTypesDontMatch mediaTypesDontMatch
+-2017 badEditList badEditList
+-2016 cantPutPublicMovieAtom cantPutPublicMovieAtom
+-2015 invalidTime invalidTime
+-2014 invalidDuration invalidDuration
+-2013 invalidHandler invalidHandler
+-2012 invalidDataRef invalidDataRef
+-2011 invalidSampleTable invalidSampleTable
+-2010 invalidMovie invalidMovie
+-2009 invalidTrack invalidTrack
+-2008 invalidMedia invalidMedia
+-2007 noDataHandler noDataHandler
+-2006 noMediaHandler noMediaHandler
+-2005 badComponentType badComponentType
+-2004 cantOpenHandler cantOpenHandler
+-2003 cantFindHandler cantFindHandler
+-2002 badPublicMovieAtom badPublicMovieAtom
+-2001 badImageDescription badImageDescription
+-2000 couldNotResolveDataRef couldNotResolveDataRef
+-1862 nonDragOriginatorErr illegal attempt at originator only data
+-1861 badImageErr bad translucent image PixMap
+-1860 badImageRgnErr bad translucent image region
+-1859 noSuitableDisplaysErr no displays support translucency
+-1858 unsupportedForPlatformErr call is for PowerPC only
+-1857 dragNotAcceptedErr drag was not accepted by receiver
+-1856 handlerNotFoundErr handler not found
+-1855 duplicateHandlerErr handler already exists
+-1854 cantGetFlavorErr error while trying to get flavor data
+-1853 duplicateFlavorErr flavor type already exists
+-1852 badDragFlavorErr unknown flavor type
+-1851 badDragItemErr unknown drag item reference
+-1850 badDragRefErr unknown drag reference
+-1813 errEndOfBody errEndOfBody
+-1812 errEndOfDocument errEndOfDocument
+-1811 errTopOfBody errTopOfBody
+-1810 errTopOfDocument errTopOfDocument
+-1801 errOffsetIsOutsideOfView errOffsetIsOutsideOfView
+-1800 errOffsetInvalid errOffsetInvalid
+-1762 errOSACantOpenComponent Can't connect to scripting system with that ID
+-1761 errOSAComponentMismatch Parameters are from 2 different components
+-1759 errOSADataFormatTooNew errOSADataFormatTooNew
+-1758 errOSADataFormatObsolete errOSADataFormatObsolete
+-1757 errOSANoSuchDialect errOSANoSuchDialect
+-1756 errOSASourceNotAvailable errOSASourceNotAvailable
+-1754 errOSABadSelector errOSABadSelector
+-1753 errOSAScriptError errOSAScriptError
+-1752 errOSABadStorageType errOSABadStorageType
+-1751 errOSAInvalidID errOSAInvalidID
+-1750 errOSASystemError errOSASystemError
+-1741 errAEBufferTooSmall buffer for AEFlattenDesc too small
+-1740 errAEBuildSyntaxError AEBuildDesc and friends detected a syntax error
+-1739 errAEDescIsNull attempting to perform an invalid operation on a null descriptor
+-1738 errAEStreamAlreadyConverted attempt to convert a stream that has already been converted
+-1737 errAEStreamBadNesting nesting violation while streaming
+-1736 errAEDuplicateHandler attempt to install handler in table for identical class and id (1.1 or greater)
+-1735 errAEEventFiltered event has been filtered, and should not be propogated (1.1 or greater)
+-1734 errAEReceiveEscapeCurrent break out of only lowest level of AEReceive (1.1 or greater)
+-1733 errAEReceiveTerminate break out of all levels of AEReceive to the topmost (1.1 or greater)
+-1732 errAERecordingIsAlreadyOn available only in version 1.0.1 or greater
+-1731 errAEUnknownObjectType available only in version 1.0.1 or greater
+-1730 errAEEmptyListContainer Attempt to pass empty list as container to accessor
+-1729 errAENegativeCount CountProc returned negative value
+-1728 errAENoSuchObject e.g.,: specifier asked for the 3rd, but there are only 2. Basically, this indicates a run-time resolution error.
+-1727 errAENotAnObjSpec Param to AEResolve not of type 'obj '
+-1726 errAEBadTestKey Test is neither typeLogicalDescriptor nor typeCompDescriptor
+-1725 errAENoSuchLogical Something other than AND, OR, or NOT
+-1723 errAEAccessorNotFound Accessor proc matching wantClass and containerType or wildcards not found
+-1721 errAEWrongNumberArgs Logical op kAENOT used with other than 1 term
+-1720 errAEImpossibleRange A range like 3rd to 2nd, or 1st to all.
+-1719 errAEIllegalIndex index is out of range in a put operation
+-1718 errAEReplyNotArrived the contents of the reply you are accessing have not arrived yet
+-1717 errAEHandlerNotFound no handler in the dispatch tables fits the parameters to AEGetEventHandler or AEGetCoercionHandler
+-1716 errAEUnknownAddressType the target address type is not known
+-1715 errAEParamMissed a required parameter was not accessed
+-1714 errAENotASpecialFunction there is no special function for/with this keyword
+-1713 errAENoUserInteraction no user interaction is allowed
+-1712 errAETimeout the AppleEvent timed out
+-1711 errAEWaitCanceled in AESend, the user cancelled out of wait loop for reply or receipt
+-1710 errAEUnknownSendMode mode wasn't NoReply, WaitReply, or QueueReply or Interaction level is unknown
+-1709 errAEReplyNotValid AEResetTimer was passed an invalid reply parameter
+-1708 errAEEventNotHandled the AppleEvent was not handled by any handler
+-1707 errAENotAppleEvent the event is not in AppleEvent format
+-1706 errAENewerVersion need newer version of the AppleEvent manager
+-1705 errAEBadListItem the specified list item does not exist
+-1704 errAENotAEDesc errAENotAEDesc
+-1703 errAEWrongDataType errAEWrongDataType
+-1702 errAECorruptData errAECorruptData
+-1701 errAEDescNotFound errAEDescNotFound
+-1700 errAECoercionFail bad parameter data or unable to coerce the data supplied
+-1424 errFSIteratorNotSupported The iterator's flags or container are not supported by this call
+-1423 errFSIteratorNotFound Passed FSIterator is not an open iterator
+-1422 errFSBadIteratorFlags Flags passed to FSOpenIterator are bad
+-1421 errFSForkExists Named fork already exists.
+-1420 errFSRefsDifferent FSCompareFSRefs; refs are for different objects
+-1419 errFSBadSearchParams Something wrong with CatalogSearch searchParams
+-1418 errFSBadItemCount maximumItems was zero
+-1417 errFSNoMoreItems Iteration ran out of items to return
+-1413 errFSBadAllocFlags Invalid bits set in allocationFlags
+-1412 errFSBadPosMode Newline bits set in positionMode
+-1411 errFSMissingName A Unicode name parameter was NULL or nameLength parameter was zero
+-1410 errFSNameTooLong File/fork name is too long to create/rename
+-1409 errFSForkNotFound Named fork does not exist
+-1407 errFSNotAFolder Expected a folder, got a file
+-1406 errFSMissingCatInfo A CatalogInfo parameter was NULL
+-1405 errFSBadInfoBitmap A CatalogInfoBitmap or VolumeInfoBitmap has reserved or invalid bits set
+-1404 errFSBadForkRef A ForkRefNum parameter was bad
+-1403 errFSBadBuffer A buffer parameter was bad
+-1402 errFSBadForkName Fork name parameter is bad
+-1401 errFSBadFSRef FSRef parameter is bad
+-1400 errFSUnknownCall selector is not recognized by this filesystem
+-1327 badFCBErr FCBRecPtr is not valid
+-1311 volVMBusyErr can't eject because volume is in use by VM
+-1310 fsDataTooBigErr file or volume is too big for system
+-1309 fileBoundsErr file's EOF, offset, mark or size is too big
+-1308 notARemountErr when _Mount allows only remounts and doesn't get one
+-1307 badFidErr file id is dangling or doesn't match with the file number
+-1306 sameFileErr can't exchange a file with itself
+-1305 desktopDamagedErr desktop database files are corrupted
+-1304 catChangedErr the catalog has been modified
+-1303 diffVolErr files on different volumes
+-1302 notAFileErr directory specified
+-1301 fidExists file id already exists
+-1300 fidNotFound no file thread exists.
+-1280 errRefNum bad connection refNum
+-1279 errAborted control call was aborted
+-1278 errState bad connection state for this operation
+-1277 errOpening open connection request failed
+-1276 errAttention attention message too long
+-1275 errFwdReset read terminated by forward reset
+-1274 errDSPQueueSize DSP Read/Write Queue Too small
+-1273 errOpenDenied open connection request was denied
+-1105 reqAborted reqAborted
+-1104 noDataArea noDataArea
+-1103 noSendResp noSendResp
+-1102 cbNotFound cbNotFound
+-1101 noRelErr noRelErr
+-1100 badBuffNum badBuffNum
+-1099 badATPSkt badATPSkt
+-1098 tooManySkts tooManySkts
+-1097 tooManyReqs tooManyReqs
+-1096 reqFailed reqFailed
+-1075 aspNoAck No ack on attention request (server err)
+-1074 aspTooMany Too many clients (server error)
+-1073 aspSizeErr Command block too big
+-1072 aspSessClosed Session closed
+-1071 aspServerBusy Server cannot open another session
+-1070 aspParamErr Parameter error
+-1069 aspNoServers No servers at that address
+-1068 aspNoMoreSess No more sessions on server
+-1067 aspBufTooSmall Buffer too small
+-1066 aspBadVersNum Server cannot support this ASP version
+-1029 nbpNISErr Error trying to open the NIS
+-1028 nbpNotFound Name not found on remove
+-1027 nbpDuplicate Duplicate name exists already
+-1026 nbpConfDiff Name confirmed at different socket
+-1025 nbpNoConfirm nbpNoConfirm
+-1024 nbpBuffOvr Buffer overflow in LookupName
+-1000 noMaskFoundErr Icon Utilties Error
+-985 kFMFontContainerAccessErr kFMFontContainerAccessErr
+-984 kFMFontTableAccessErr kFMFontTableAccessErr
+-983 kFMIterationScopeModifiedErr kFMIterationScopeModifiedErr
+-982 kFMInvalidFontErr kFMInvalidFontErr
+-981 kFMInvalidFontFamilyErr kFMInvalidFontFamilyErr
+-980 kFMIterationCompleted kFMIterationCompleted
+-932 guestNotAllowedErr destination port requires authentication
+-931 badLocNameErr location name malformed
+-930 badServiceMethodErr illegal service type, or not supported
+-928 noUserRecErr Invalid user reference number
+-927 authFailErr unable to authenticate user at destination
+-926 noInformErr PPCStart failed because destination did not have inform pending
+-925 networkErr An error has occurred in the network, not too likely
+-924 noUserRefErr unable to create a new userRefNum
+-923 notLoggedInErr The default userRefNum does not yet exist
+-922 noDefaultUserErr user hasn't typed in owners name in Network Setup Control Pannel
+-919 badPortNameErr PPCPortRec malformed
+-917 sessClosedErr session was closed
+-916 portClosedErr port was closed
+-915 noResponseErr unable to contact destination
+-914 noToolboxNameErr A system resource is missing, not too likely
+-913 noMachineNameErr user hasn't named his Macintosh in the Network Setup Control Panel
+-912 userRejectErr Destination rejected the session request
+-911 noUserNameErr user name unknown on destination machine
+-910 portNameExistsErr port is already open (perhaps in another app)
+-909 badReqErr bad parameter or invalid state for operation
+-908 noSessionErr Invalid session reference number
+-907 sessTableErr Out of session tables, try again later
+-906 destPortErr Port does not exist at destination
+-905 localOnlyErr Network activity is currently disabled
+-904 noGlobalsErr The system is hosed, better re-boot
+-903 noPortErr Unable to open port or bad portRefNum. If you're calling
+-902 nameTypeErr Invalid or inappropriate locationKindSelector in locationName
+-900 notInitErr PPCToolBox not initialized
+-877 notAppropriateForClassic This application won't or shouldn't run on Classic (Problem 2481058).
+-876 appVersionTooOld The application's creator and version are incompatible with the current version of Mac OS.
+-875 wrongApplicationPlatform The application could not launch because the required platform is not available
+-863 hmCloseViewActive Returned from HMRemoveBalloon if CloseView was active
+-862 hmNoBalloonUp Returned from HMRemoveBalloon if no balloon was visible when call was made
+-861 hmOperationUnsupported Returned from HMShowBalloon call if bad method passed to routine
+-859 hmUnknownHelpType Returned if help msg record contained a bad type
+-858 hmWrongVersion Returned if help mgr resource was the wrong version
+-857 hmSkippedBalloon Returned from calls if helpmsg specified a skip balloon
+-855 hmHelpManagerNotInited Returned from HMGetHelpMenuHandle if help menu not setup
+-854 hmSameAsLastBalloon Returned from HMShowMenuBalloon if menu & item is same as last time
+-853 hmBalloonAborted Returned if mouse was moving or mouse wasn't in window port rect
+-850 hmHelpDisabled Show Balloons mode was off, call to routine ignored
+-813 rcDBPackNotInited attempt to call other routine before InitDBPack
+-812 rcDBWrongVersion incompatible versions
+-811 rcDBNoHandler no app handler for specified data type
+-810 rcDBBadAsyncPB tried to kill a bad pb
+-809 rcDBAsyncNotSupp ddev does not support async calls
+-808 rcDBBadDDEV bad ddev specified on DBInit
+-807 rcDBBadSessNum bad session number for DBGetConnInfo
+-806 rcDBBadSessID rcDBBadSessID
+-805 rcDBExec rcDBExec
+-804 rcDBBreak rcDBBreak
+-803 rcDBBadType rcDBBadType
+-802 rcDBError rcDBError
+-801 rcDBValue rcDBValue
+-800 rcDBNull rcDBNull
+-677 icTooManyProfilesErr too many profiles in database
+-676 icProfileNotFoundErr profile not found
+-675 icConfigInappropriateErr incorrect manufacturer code
+-674 icConfigNotFoundErr no internet configuration was found
+-673 icNoURLErr no URL found
+-672 icNothingToOverrideErr no component for the override component to capture
+-671 icNoMoreWritersErr you cannot begin a write session because someone else is already doing it
+-670 icTruncatedErr more data was present than was returned
+-669 icInternalErr Internet Config internal error
+-668 icPrefDataErr problem with preference data
+-667 icPermErr cannot set preference
+-666 icPrefNotFoundErr Internet preference not found
+-648 vmInvalidOwningProcessErr current process does not own the BackingFileID or FileViewID
+-647 vmAddressNotInFileViewErr address is not in a FileView
+-646 vmNoMoreFileViewsErr no more FileViews were found
+-645 vmFileViewAccessErr requested FileViewAccess cannot be obtained
+-644 vmInvalidFileViewIDErr invalid FileViewID
+-643 vmNoMoreBackingFilesErr no more BackingFiles were found
+-642 vmBusyBackingFileErr open views found on BackingFile
+-641 vmMappingPrivilegesErr requested MappingPrivileges cannot be obtained
+-640 vmInvalidBackingFileIDErr invalid BackingFileID
+-626 noMMUErr no MMU present
+-625 cannotDeferErr unable to defer additional functions
+-624 interruptsMaskedErr donÕt call with interrupts masked
+-623 notLockedErr specified range of memory is not locked
+-622 cannotMakeContiguousErr cannot make specified range contiguous
+-621 notHeldErr specified range of memory is not held
+-620 notEnoughMemoryErr insufficient physical memory
+-619 threadProtocolErr threadProtocolErr
+-618 threadNotFoundErr threadNotFoundErr
+-617 threadTooManyReqsErr threadTooManyReqsErr
+-610 noUserInteractionAllowed no user interaction allowed
+-609 connectionInvalid connectionInvalid
+-608 noOutstandingHLE noOutstandingHLE
+-607 bufferIsSmall error returns from Post and Accept
+-606 appIsDaemon app is BG-only, and launch flags disallow this
+-605 appMemFullErr application SIZE not big enough for launch
+-604 hardwareConfigErr hardware configuration not correct for call
+-603 protocolErr app made module calls in improper order
+-602 appModeErr memory mode is 32-bit, but app not 32-bit clean
+-601 memFragErr not enough room to launch app w/special requirements
+-600 procNotFound no eligible process with specified descriptor
+-503 driverHardwareGoneErr disk driver's hardware was disconnected
+-502 hwParamErr bad selector for _HWPriv
+-501 teScrapSizeErr scrap item too big for text edit record
+-500 rgnTooBigErr rgnTooBigErr
+-492 exUserBreak user debugger break; execute debugger commands on stack
+-491 strUserBreak user debugger break; display string on stack
+-490 userBreak user debugger break
+-463 notThePublisherWrn not the first registered publisher for that container
+-462 containerAlreadyOpenWrn container already opened by this section
+-461 containerNotFoundWrn could not find editionContainer at this time
+-460 multiplePublisherWrn A Publisher is already registered for that container
+-454 badSubPartErr can not use sub parts in this release
+-453 badEditionFileErr edition file is corrupt
+-452 notRegisteredSectionErr not a registered SectionRecord
+-451 badSectionErr not a valid SectionRecord
+-450 editionMgrInitErr edition manager not inited by this app
+-438 fsmUnknownFSMMessageErr unknown message passed to FSM
+-437 fsmNoAlternateStackErr no alternate stack for HFS CI
+-436 fsmBadFSDVersionErr FSM version incompatible with FSD
+-435 fsmDuplicateFSIDErr FSID already exists on InstallFS
+-434 fsmBadFSDLenErr FSD size incompatible with current FSM vers
+-433 fsmBadFFSNameErr Name length not 1 <= length <= 31
+-432 fsmBusyFFSErr File system is busy, cannot be removed
+-431 fsmFFSNotFoundErr Foreign File system does not exist - new Pack2 could return this error too
+-417 btKeyAttrErr There is no such a key attribute.
+-416 btKeyLenErr Maximum key length is too long or equal to zero.
+-415 btRecNotFnd Record cannot be found.
+-414 btDupRecErr Record already exists.
+-413 btNoSpace Can't allocate disk space.
+-410 notBTree The file is not a dictionary.
+-400 gcrOnMFMErr gcr format on high density media error
+-360 slotNumErr invalid slot # error
+-351 smRecNotFnd Record not found in the SRT.
+-350 smSRTOvrFlErr SRT over flow.
+-349 smNoGoodOpens No opens were successfull in the loop.
+-348 smOffsetErr Offset was too big (temporary error
+-347 smByteLanesErr NumByteLanes was determined to be zero.
+-346 smBadsPtrErr Bad pointer was passed to sCalcsPointer
+-345 smsGetDrvrErr Error occurred during _sGetDriver.
+-344 smNoMoresRsrcs No more sResources
+-343 smDisDrvrNamErr Error occurred during _sDisDrvrName.
+-342 smGetDrvrNamErr Error occurred during _sGetDrvrName.
+-341 smCkStatusErr Status of slot = fail.
+-340 smBlkMoveErr _BlockMove error
+-339 smNewPErr _NewPtr error
+-338 smSelOOBErr Selector out of bounds error
+-337 smSlotOOBErr Slot out of bounds error
+-336 smNilsBlockErr Nil sBlock error (Dont allocate and try to use a nil sBlock)
+-335 smsPointerNil LPointer is nil From sOffsetData. If this error occurs; check sInfo rec for more information.
+-334 smCPUErr Code revision is wrong
+-333 smCodeRevErr Code revision is wrong
+-332 smReservedErr Reserved field not zero
+-331 smBadsList Bad sList: Id1 < Id2 < Id3 ...format is not followed.
+-330 smBadRefId Reference Id not found in List
+-320 smBusErrTO BusError time out.
+-319 smBadBoardId BoardId was wrong; re-init the PRAM record.
+-318 smReservedSlot slot is reserved, VM should not use this address space.
+-317 smInitTblVErr An error occurred while trying to initialize the Slot Resource Table.
+-316 smInitStatVErr The InitStatusV field was negative after primary or secondary init.
+-315 smNoBoardId No Board Id.
+-314 smGetPRErr Error occurred during _sGetPRAMRec (See SIMStatus).
+-313 smNoBoardSRsrc No Board sResource.
+-312 smDisposePErr _DisposePointer error
+-311 smFHBlkDispErr Error occurred during _sDisposePtr (Dispose of FHeader block).
+-310 smFHBlockRdErr Error occurred during _sGetFHeader.
+-309 smBLFieldBad ByteLanes field was bad.
+-308 smUnExBusErr Unexpected BusError
+-307 smResrvErr Fatal reserved error. Resreved field <> 0.
+-306 smNosInfoArray No sInfoArray. Memory Mgr error.
+-305 smDisabledSlot This slot is disabled (-305 use to be smLWTstBad)
+-304 smNoDir Directory offset is Nil
+-303 smRevisionErr Wrong revison level
+-302 smFormatErr FHeader Format is not Apple's
+-301 smCRCFail CRC check failed for declaration data
+-300 smEmptySlot No card in slot
+-299 nmTypErr Notification Manager:wrong queue type
+-293 smPriInitErr Error; Cards could not be initialized.
+-292 smPRAMInitErr Error; Slot Resource Table could not be initialized.
+-291 smSRTInitErr Error; Slot Resource Table could not be initialized.
+-290 smSDMInitErr Error; SDM could not be initialized.
+-261 midiInvalidCmdErr command not supported for port type
+-260 midiDupIDErr duplicate client ID
+-259 midiNameLenErr name supplied is longer than 31 characters
+-258 midiWriteErr MIDIWritePacket couldn't write to all connected ports
+-257 midiNoConErr no connection exists between specified ports
+-256 midiVConnectRmvd pending virtual connection removed
+-255 midiVConnectMade pending virtual connection resolved
+-254 midiVConnectErr pending virtual connection created
+-253 midiTooManyConsErr too many connections made
+-252 midiTooManyPortsErr too many ports already installed in the system
+-251 midiNoPortErr no port with that ID found
+-250 midiNoClientErr no client with that ID found
+-247 badInputText badInputText
+-246 badDictFormat badDictFormat
+-245 incompatibleVoice incompatibleVoice
+-244 voiceNotFound voiceNotFound
+-243 bufTooSmall bufTooSmall
+-242 synthNotReady synthNotReady
+-241 synthOpenFailed synthOpenFailed
+-240 noSynthFound noSynthFound
+-232 siUnknownQuality invalid quality selector (returned by driver)
+-231 siUnknownInfoType invalid info type selector (returned by driver)
+-230 siInputDeviceErr input device hardware failure
+-229 siBadRefNum invalid input device reference number
+-228 siBadDeviceName input device could not be opened
+-227 siDeviceBusyErr input device already in use
+-226 siInvalidSampleSize invalid sample size
+-225 siInvalidSampleRate invalid sample rate
+-224 siHardDriveTooSlow hard drive too slow to record to disk
+-223 siInvalidCompression invalid compression type
+-222 siNoBufferSpecified returned by synchronous SPBRecord if nil buffer passed
+-221 siBadSoundInDevice invalid index passed to SoundInGetIndexedDevice
+-220 siNoSoundInHardware no Sound Input hardware
+-213 siVBRCompressionNotSupported vbr audio compression not supported for this operation
+-212 noMoreRealTime not enough CPU cycles left to add another task
+-211 channelNotBusy channelNotBusy
+-210 buffersTooSmall can not operate in the memory allowed
+-209 channelBusy the Channel is being used for a PFD already
+-208 badFileFormat was not type AIFF or was of bad format,corrupt
+-207 notEnoughBufferSpace could not allocate enough memory
+-206 badFormat Sound Manager Error Returns
+-205 badChannel Sound Manager Error Returns
+-204 resProblem Sound Manager Error Returns
+-203 queueFull Sound Manager Error Returns
+-201 notEnoughHardwareErr Sound Manager Error Returns
+-200 noHardwareErr Sound Manager Error Returns
+-199 mapReadErr map inconsistent with operation
+-198 resAttrErr attribute inconsistent with operation
+-197 rmvRefFailed RmveReference failed
+-196 rmvResFailed RmveResource failed
+-195 addRefFailed AddReference failed
+-194 addResFailed AddResource failed
+-193 resFNotFound Resource file not found
+-192 resNotFound Resource not found
+-190 inputOutOfBounds Offset of Count out of bounds
+-189 writingPastEnd Writing past end of file
+-188 resourceInMemory Resource already in memory
+-186 CantDecompress resource bent ("the bends") - can't decompress a compressed resource
+-185 badExtResource extended resource has a bad format.
+-182 cmNoCurrentProfile Responder error
+-181 cmUnsupportedDataType Responder error
+-180 cmCantDeleteProfile Responder error
+-179 cmCantXYZ CMM cant handle XYZ space
+-178 cmCantConcatenateError Profile can't be concatenated
+-177 cmProfilesIdentical Profiles the same
+-176 cmProfileNotFound Responder error
+-175 cmMethodNotFound CMM not present
+-171 cmMethodError cmMethodError
+-170 cmProfileError cmProfileError
+-157 cDepthErr invalid pixel depth
+-156 cResErr invalid resolution for MakeITable
+-155 cDevErr invalid type of graphics device
+-154 cProtectErr colorTable entry protection violation
+-153 cRangeErr range error on colorTable request
+-152 cNoMemErr failed to allocate memory for structure
+-151 cTempMemErr failed to allocate memory for temporary structures
+-150 cMatchErr Color2Index failed to find an index
+-149 insufficientStackErr insufficientStackErr
+-148 pixMapTooDeepErr pixMapTooDeepErr
+-147 rgnOverflowErr rgnOverflowErr
+-145 noMemForPictPlaybackErr noMemForPictPlaybackErr
+-128 userCanceledErr userCanceledErr
+-127 hMenuFindErr could not find HMenu's parent in MenuKey (wrong error code - obsolete)
+-126 mBarNFnd system error code for MBDF not found
+-125 updPixMemErr insufficient memory to update a pixmap
+-124 volGoneErr Server volume has been disconnected.
+-123 wrgVolTypErr Wrong volume type error [operation not supported for MFS]
+-122 badMovErr Move into offspring error
+-121 tmwdoErr No free WDCB available
+-120 dirNFErr Directory not found
+-117 memLockedErr trying to move a locked block (MoveHHi)
+-116 memSCErr Size Check failed
+-115 memBCErr Block Check failed
+-114 memPCErr Pointer Check failed
+-113 memAZErr Address in zone check failed
+-112 memPurErr trying to purge a locked or non-purgeable block
+-111 memWZErr WhichZone failed (applied to free block)
+-110 memAdrErr address was odd; or out of range
+-109 nilHandleErr Master Pointer was NIL in HandleZone or other
+-108 memFullErr Not enough room in heap zone
+-102 noTypeErr No object of that type in scrap
+-100 noScrapErr No scrap exists error
+-99 memROZWarn soft error in ROZ
+-98 portNotCf driver Open error code (parameter RAM not configured for this connection)
+-97 portInUse driver Open error code (port is in use)
+-96 portNotPwr serial port not currently powered
+-95 excessCollsns excessive collisions on write
+-94 lapProtErr error in attaching/detaching protocol
+-93 noBridgeErr no network bridge for non-local send
+-92 eLenErr Length error ddpLenErr
+-91 eMultiErr Multicast address error ddpSktErr
+-90 breakRecd Break received (SCC)
+-89 rcvrErr SCC receiver error (framing; parity; OR)
+-88 prInitErr InitUtil found the parameter ram uninitialized
+-87 prWrErr parameter ram written didn't read-verify
+-86 clkWrErr time written did not verify
+-85 clkRdErr unable to read same clock value twice
+-84 verErr track failed to verify
+-83 fmt2Err can't get enough sync
+-82 fmt1Err can't find sector 0 after track format
+-81 sectNFErr sector number never found on a track
+-80 seekErr track number wrong on address mark
+-79 spdAdjErr unable to correctly adjust disk speed
+-78 twoSideErr tried to read 2nd side on a 1-sided drive
+-77 initIWMErr unable to initialize IWM
+-76 tk0BadErr track 0 detect doesn't change
+-75 cantStepErr step handshake failed
+-74 wrUnderrun write underrun occurred
+-73 badDBtSlp bad data mark bit slip nibbles
+-72 badDCksum bad data mark checksum
+-71 noDtaMkErr couldn't find a data mark header
+-70 badBtSlpErr bad addr mark bit slip nibbles
+-69 badCksmErr addr mark checksum didn't check
+-68 dataVerErr read verify compare failed
+-67 noAdrMkErr couldn't find valid addr mark
+-66 noNybErr couldn't find 5 nybbles in 200 tries
+-65 offLinErr r/w requested for an off-line drive
+-64 fontDecError error during font declaration
+-61 wrPermErr write permissions error
+-60 badMDBErr bad master directory block
+-59 fsRnErr file system internal error:during rename the old entry was deleted but could not be restored.
+-58 extFSErr volume in question belongs to an external fs
+-57 noMacDskErr not a mac diskette (sig bytes are wrong)
+-56 nsDrvErr no such drive (tried to mount a bad drive num)
+-55 volOnLinErr drive volume already on-line at MountVol
+-54 permErr permissions error (on file open)
+-53 volOffLinErr volume not on line error (was Ejected)
+-52 gfpErr get file position error
+-51 rfNumErr refnum error
+-50 paramErr error in user parameter list
+-49 opWrErr file already open with with write permission
+-48 dupFNErr duplicate filename (rename)
+-47 fBsyErr File is busy (delete)
+-46 vLckdErr volume is locked
+-45 fLckdErr file is locked
+-44 wPrErr diskette is write protected.
+-43 fnfErr File not found
+-42 tmfoErr too many files open
+-41 mFulErr memory full (open) or file won't fit (load)
+-40 posErr tried to position to before start of file (r/w)
+-39 eofErr End of file
+-38 fnOpnErr File not open
+-37 bdNamErr there may be no bad names in the final system!
+-36 ioErr I/O error (bummers)
+-35 nsvErr no such volume
+-34 dskFulErr disk full
+-33 dirFulErr Directory full
+-30 dceExtErr dce extension error
+-29 unitTblFullErr unit table has no more entries
+-28 notOpenErr Couldn't rd/wr/ctl/sts cause driver not opened
+-27 iIOAbortErr IO abort error (Printing Manager)
+-26 dInstErr DrvrInstall couldn't find driver in resources
+-25 dRemovErr tried to remove an open driver
+-24 closErr I/O System Errors
+-23 openErr I/O System Errors
+-22 unitEmptyErr I/O System Errors
+-21 badUnitErr I/O System Errors
+-20 writErr I/O System Errors
+-19 readErr I/O System Errors
+-18 statusErr I/O System Errors
+-17 controlErr I/O System Errors
+-13 dsExtensionsDisabled say –Extensions Disabled”
+-12 dsHD20Installed say –HD20 Startup”
+-11 dsDisassemblerInstalled say –Disassembler Installed”
+-10 dsMacsBugInstalled say –MacsBug Installed”
+-8 seNoDB no debugger installed to handle debugger command
+-5 SlpTypeErr invalid queue element
+-4 unimpErr unimplemented core routine
+-3 corErr core routine number out of range
+-2 dsNoExtsDisassembler not a SysErr, just a placeholder
+-1 qErr queue element not found during deletion
+0 tsmComponentNoErr component result = no error
+1 EPERM Operation not permitted
+2 ENOENT No such file or directory
+3 ESRCH No such process
+4 EINTR Interrupted system call
+5 EIO Input/output error
+6 ENXIO Device not configured
+7 E2BIG Argument list too long
+8 ENOEXEC Exec format error
+9 EBADF Bad file descriptor
+10 ECHILD No child processes
+11 EDEADLK Resource deadlock avoided
+12 ENOMEM Cannot allocate memory
+13 EACCES Permission denied
+14 EFAULT Bad address
+15 ECANCELED Operation cancelled
+16 EBUSY Device busy
+17 EEXIST File exists
+18 EXDEV Cross-device link
+19 ENODEV Operation not supported by device
+20 ENOTDIR Not a directory
+21 EISDIR Is a directory
+22 EINVAL Invalid argument
+23 ENFILE Too many open files in system
+24 EMFILE Too many open files
+25 ENOTTY Inappropriate ioctl for device
+26 ESIGPARM Signal error
+27 EFBIG File too large
+28 ENOSPC No space left on device
+29 ESPIPE Illegal seek
+30 EROFS Read-only file system
+31 EMLINK Too many links
+32 EPIPE Broken pipe
+33 EDOM Numerical argument out of domain
+34 ERANGE Result too large
+35 EAGAIN Resource temporarily unavailable
+36 EINPROGRESS Operation now in progress
+37 EALREADY Operation already in progress
+38 ENOTSOCK Socket operation on non-socket
+39 EDESTADDRREQ Destination address required
+40 EMSGSIZE Message too long
+41 EPROTOTYPE Protocol wrong type for socket
+42 ENOPROTOOPT Protocol not available
+43 EPROTONOSUPPORT Protocol not supported
+44 ESOCKTNOSUPPORT Socket type not supported
+45 EOPNOTSUPP Operation not supported
+46 EPFNOSUPPORT Protocol family not supported
+47 EAFNOSUPPORT Address family not supported by protocol family
+48 EADDRINUSE Address already in use
+49 EADDRNOTAVAIL Can't assign requested address
+50 ENETDOWN Network is down
+51 ENETUNREACH Network is unreachable
+52 ENETRESET Network dropped connection on reset
+53 ECONNABORTED Software caused connection abort
+54 ECONNRESET Connection reset by peer
+55 ENOBUFS No buffer space available
+56 EISCONN Socket is already connected
+57 ENOTCONN Socket is not connected
+58 ESHUTDOWN Can't send after socket shutdown
+59 ETOOMANYREFS Too many references: can't splice
+60 ETIMEDOUT Operation timed out
+61 ECONNREFUSED Connection refused
+62 ELOOP Too many levels of symbolic links
+63 ENAMETOOLONG File name too long
+64 EHOSTDOWN Host is down
+65 EHOSTUNREACH No route to host
+66 ENOTEMPTY Directory not empty
+67 ELOOK Internal mapping for kOTLookErr, don't return to client
+77 ENOLCK No locks available
+78 ENOSYS Function not implemented
+88 EILSEQ Wide character encoding error
+99 EUNKNOWN Unknown error
diff --git a/Mac/scripts/genallsuites.py b/Mac/scripts/genallsuites.py
new file mode 100644
index 0000000000..a556847670
--- /dev/null
+++ b/Mac/scripts/genallsuites.py
@@ -0,0 +1,52 @@
+# Generate all the standard scripting suite packages.
+# Note that this module needs *serious* hand-crafting because of all the
+# absolute paths. It is, however, a great leap forward compared to the time
+# when this information was only stored in Jack's brain:-)
+
+import sys
+import os
+import gensuitemodule
+
+verbose=sys.stdout
+
+DSTDIR="/Users/jack/src/python/Lib/plat-mac/lib-scriptpackages"
+OS9DISK="/Volumes/Moes"
+
+APPLESCRIPT=OS9DISK + "/Systeemmap/Extensies/AppleScript"
+SYSTEMEVENTS="/System/Library/CoreServices/System Events.app"
+
+CODEWARRIOR=OS9DISK + "/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/CodeWarrior IDE 4.2.6"
+EXPLORER="/Applications/Internet Explorer.app"
+FINDER="/System/Library/CoreServices/Finder.app"
+NETSCAPE=OS9DISK + "/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2"
+TERMINAL="/Applications/Utilities/Terminal.app"
+
+gensuitemodule.processfile_fromresource(APPLESCRIPT,
+ output=os.path.join(DSTDIR, 'StdSuites'),
+ basepkgname='_builtinSuites',
+ edit_modnames=[], verbose=verbose)
+gensuitemodule.processfile(SYSTEMEVENTS,
+ output=os.path.join(DSTDIR, 'SystemEvents'),
+ basepkgname='StdSuites',
+ edit_modnames=[('Disk_2d_Folder_2d_File_Suite', 'Disk_Folder_File_Suite')],
+ verbose=verbose)
+gensuitemodule.processfile(CODEWARRIOR,
+ output=os.path.join(DSTDIR, 'CodeWarrior'),
+ basepkgname='StdSuites',
+ edit_modnames=[], verbose=verbose)
+gensuitemodule.processfile(EXPLORER,
+ output=os.path.join(DSTDIR, 'Explorer'),
+ basepkgname='StdSuites',
+ edit_modnames=[], verbose=verbose)
+gensuitemodule.processfile(FINDER,
+ output=os.path.join(DSTDIR, 'Finder'),
+ basepkgname='StdSuites',
+ edit_modnames=[], verbose=verbose)
+gensuitemodule.processfile(NETSCAPE,
+ output=os.path.join(DSTDIR, 'Netscape'),
+ basepkgname='StdSuites',
+ edit_modnames=[('WorldWideWeb_suite_2c__as_d', 'WorldWideWeb_suite')], verbose=verbose)
+gensuitemodule.processfile(TERMINAL,
+ output=os.path.join(DSTDIR, 'Terminal'),
+ basepkgname='StdSuites',
+ edit_modnames=[], verbose=verbose)
diff --git a/Mac/scripts/mkestrres-errno.h b/Mac/scripts/mkestrres-errno.h
new file mode 100644
index 0000000000..702901b489
--- /dev/null
+++ b/Mac/scripts/mkestrres-errno.h
@@ -0,0 +1,7 @@
+/* These are defined in MSL errno.h, but unfortunately not documented */
+#define EFPOS 35 /* File positioning error */
+#define ESIGPARM 36 /* Signal argument error */
+#define ENOMEM 37 /* Cannot allocate memory */
+#define EACCES 38 /* Permission denied */
+#define ENOENT 39 /* No such file or directory */
+#define ENOSYS 40 /* Function not implemented */
diff --git a/Mac/scripts/mkestrres-macerrors.h b/Mac/scripts/mkestrres-macerrors.h
new file mode 100755
index 0000000000..26c583dfe2
--- /dev/null
+++ b/Mac/scripts/mkestrres-macerrors.h
@@ -0,0 +1,13 @@
+ /* Errors from InternetConfig.h */
+ icPrefNotFoundErr = -666, /* Internet preference not found */
+ icPermErr = -667, /* cannot set preference */
+ icPrefDataErr = -668, /* problem with preference data */
+ icInternalErr = -669, /* Internet Config internal error */
+ icTruncatedErr = -670, /* more data was present than was returned */
+ icNoMoreWritersErr = -671, /* you cannot begin a write session because someone else is already doing it */
+ icNothingToOverrideErr = -672, /* no component for the override component to capture */
+ icNoURLErr = -673, /* no URL found */
+ icConfigNotFoundErr = -674, /* no internet configuration was found */
+ icConfigInappropriateErr = -675, /* incorrect manufacturer code */
+ icProfileNotFoundErr = -676, /* profile not found */
+ icTooManyProfilesErr = -677 /* too many profiles in database */
diff --git a/Mac/scripts/mkestrres.py b/Mac/scripts/mkestrres.py
new file mode 100644
index 0000000000..715b8c62f6
--- /dev/null
+++ b/Mac/scripts/mkestrres.py
@@ -0,0 +1,157 @@
+"""Parse sys/errno.h and Errors.h and create Estr resource"""
+
+import re
+import string
+from Carbon import Res
+import os
+
+READ = 1
+WRITE = 2
+smAllScripts = -3
+
+ERRNO_PROG="#define[ \t]+" \
+ "([A-Z0-9a-z_]+)" \
+ "[ \t]+" \
+ "([0-9]+)" \
+ "[ \t]*/\*[ \t]*" \
+ "(.*)" \
+ "[ \t]*\*/"
+
+ERRORS_PROG="[ \t]*" \
+ "([A-Z0-9a-z_]+)" \
+ "[ \t]*=[ \t]*" \
+ "([-0-9]+)" \
+ "[, \t]*/\*[ \t]*" \
+ "(.*)" \
+ "[ \t]*\*/"
+
+ERRORS_PROG_2="[ \t]*" \
+ "([A-Z0-9a-z_]+)" \
+ "[ \t]*=[ \t]*" \
+ "([-0-9]+)" \
+ "[, \t]*"
+
+def Pstring(str):
+ if len(str) > 255:
+ raise ValueError, 'String too large'
+ return chr(len(str))+str
+
+def writeestr(dst, edict):
+ """Create Estr resource file given a dictionary of errors."""
+
+ os.unlink(dst.as_pathname())
+ Res.FSpCreateResFile(dst, 'RSED', 'rsrc', smAllScripts)
+ output = Res.FSpOpenResFile(dst, WRITE)
+ Res.UseResFile(output)
+ for num in edict.keys():
+ res = Res.Resource(Pstring(edict[num][0]))
+ res.AddResource('Estr', num, '')
+ res.WriteResource()
+ Res.CloseResFile(output)
+
+def writepython(fp, dict):
+ k = dict.keys()
+ k.sort()
+ for i in k:
+ fp.write("%s\t=\t%d\t#%s\n"%(dict[i][1], i, dict[i][0]))
+
+
+def parse_errno_h(fp, dict):
+ errno_prog = re.compile(ERRNO_PROG)
+ for line in fp.readlines():
+ m = errno_prog.match(line)
+ if m:
+ number = string.atoi(m.group(2))
+ name = m.group(1)
+ desc = string.strip(m.group(3))
+
+ if not dict.has_key(number):
+ dict[number] = desc, name
+ else:
+ print 'DUPLICATE', number
+ print '\t', dict[number]
+ print '\t', (desc, name)
+
+def parse_errors_h(fp, dict):
+ errno_prog = re.compile(ERRORS_PROG)
+ errno_prog_2 = re.compile(ERRORS_PROG_2)
+ for line in fp.readlines():
+ match = 0
+ m = errno_prog.match(line)
+ m2 = errno_prog_2.match(line)
+ if m:
+ number = string.atoi(m.group(2))
+ name = m.group(1)
+ desc = string.strip(m.group(3))
+ match=1
+ elif m2:
+ number = string.atoi(m2.group(2))
+ name = m2.group(1)
+ desc = name
+ match=1
+ if match:
+ if number > 0: continue
+
+ if not dict.has_key(number):
+ dict[number] = desc, name
+ else:
+ print 'DUPLICATE', number
+ print '\t', dict[number]
+ print '\t', (desc, name)
+ if len(desc) > len(dict[number][0]):
+ print 'Pick second one'
+ dict[number] = desc, name
+
+def main():
+ dict = {}
+ pathname = EasyDialogs.AskFileForOpen(message="Where is GUSI sys/errno.h?")
+ if pathname:
+ fp = open(pathname)
+ parse_errno_h(fp, dict)
+ fp.close()
+
+ pathname = EasyDialogs.AskFileForOpen(message="Select cerrno (MSL) or cancel")
+ if pathname:
+ fp = open(pathname)
+ parse_errno_h(fp, dict)
+ fp.close()
+
+ pathname = EasyDialogs.AskFileForOpen(message="Where is MacErrors.h?")
+ if pathname:
+ fp = open(pathname)
+ parse_errors_h(fp, dict)
+ fp.close()
+
+ pathname = EasyDialogs.AskFileForOpen(message="Where is mkestrres-MacErrors.h?")
+ if pathname:
+ fp = open(pathname)
+ parse_errors_h(fp, dict)
+ fp.close()
+
+ if not dict:
+ return
+
+ pathname = EasyDialogs.AskFileForSave(message="Resource output file?", savedFileName="errors.rsrc")
+ if pathname:
+ writeestr(fss, dict)
+
+ pathname = EasyDialogs.AskFileForSave(message="Python output file?", savedFileName="macerrors.py")
+ if pathname:
+ fp = open(pathname, "w")
+ writepython(fp, dict)
+ fp.close()
+ fss.SetCreatorType('Pyth', 'TEXT')
+
+ pathname = EasyDialogs.AskFileForSave(message="Text output file?", savedFileName="errors.txt")
+ if pathname:
+ fp = open(pathname, "w")
+
+ k = dict.keys()
+ k.sort()
+ for i in k:
+ fp.write("%d\t%s\t%s\n"%(i, dict[i][1], dict[i][0]))
+ fp.close()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/Mac/scripts/zappycfiles.py b/Mac/scripts/zappycfiles.py
new file mode 100644
index 0000000000..6d3574877d
--- /dev/null
+++ b/Mac/scripts/zappycfiles.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+"""Recursively zap all .pyc and .pyo files"""
+import os
+import sys
+
+# set doit true to actually delete files
+# set doit false to just print what would be deleted
+doit = 1
+
+def main():
+ if not sys.argv[1:]:
+ print 'Usage: zappyc dir ...'
+ sys.exit(1)
+ for dir in sys.argv[1:]:
+ zappyc(dir)
+
+def zappyc(dir):
+ os.path.walk(dir, walker, None)
+
+def walker(dummy, top, names):
+ for name in names:
+ if name[-4:] in ('.pyc', '.pyo'):
+ path = os.path.join(top, name)
+ print 'Zapping', path
+ if doit:
+ os.unlink(path)
+
+if __name__ == '__main__':
+ main()