[Python-3000-checkins] r63190 - in python/branches/py3k: Doc/library/aepack.rst Doc/library/aetools.rst Doc/library/aetypes.rst Doc/library/autogil.rst Doc/library/binhex.rst Doc/library/carbon.rst Doc/library/colorpicker.rst Doc/library/easydialogs.rst Doc/library/framework.rst Doc/library/ic.rst Doc/library/index.rst Doc/library/mac.rst Doc/library/macos.rst Doc/library/macosa.rst Doc/library/macostools.rst Doc/library/plistlib.rst Doc/library/undoc.rst Doc/using/mac.rst Lib/binhex.py Lib/plat-mac/Audio_mac.py Lib/plat-mac/Carbon Lib/plat-mac/EasyDialogs.py Lib/plat-mac/FrameWork.py Lib/plat-mac/MiniAEFrame.py Lib/plat-mac/PixMapWrapper.py Lib/plat-mac/aepack.py Lib/plat-mac/aetools.py Lib/plat-mac/aetypes.py Lib/plat-mac/applesingle.py Lib/plat-mac/appletrawmain.py Lib/plat-mac/appletrunner.py Lib/plat-mac/argvemulator.py Lib/plat-mac/bgenlocations.py Lib/plat-mac/buildtools.py Lib/plat-mac/bundlebuilder.py Lib/plat-mac/dialogs.rsrc Lib/plat-mac/errors.rsrc Lib/plat-mac/findertools.py Lib/plat-mac/gensuitemodule.py Lib/plat-mac/ic.py Lib/plat-mac/icopen.py Lib/plat-mac/lib-scriptpackages Lib/plat-mac/macerrors.py Lib/plat-mac/macostools.py Lib/plat-mac/macresource.py Lib/plat-mac/pimp.py Lib/plat-mac/terminalcommand.py Lib/plat-mac/videoreader.py Lib/plistlib.py Lib/test/test_aepack.py Lib/test/test_applesingle.py Lib/test/test_macostools.py Lib/test/test_scriptpackages.py Mac/Modules setup.py

benjamin.peterson python-3000-checkins at python.org
Tue May 13 00:25:20 CEST 2008


Author: benjamin.peterson
Date: Tue May 13 00:25:16 2008
New Revision: 63190

Log:
Remove the Mac modules


Removed:
   python/branches/py3k/Doc/library/aepack.rst
   python/branches/py3k/Doc/library/aetools.rst
   python/branches/py3k/Doc/library/aetypes.rst
   python/branches/py3k/Doc/library/autogil.rst
   python/branches/py3k/Doc/library/carbon.rst
   python/branches/py3k/Doc/library/colorpicker.rst
   python/branches/py3k/Doc/library/easydialogs.rst
   python/branches/py3k/Doc/library/framework.rst
   python/branches/py3k/Doc/library/ic.rst
   python/branches/py3k/Doc/library/mac.rst
   python/branches/py3k/Doc/library/macos.rst
   python/branches/py3k/Doc/library/macosa.rst
   python/branches/py3k/Doc/library/macostools.rst
   python/branches/py3k/Lib/plat-mac/Audio_mac.py
   python/branches/py3k/Lib/plat-mac/Carbon/
   python/branches/py3k/Lib/plat-mac/EasyDialogs.py
   python/branches/py3k/Lib/plat-mac/FrameWork.py
   python/branches/py3k/Lib/plat-mac/MiniAEFrame.py
   python/branches/py3k/Lib/plat-mac/PixMapWrapper.py
   python/branches/py3k/Lib/plat-mac/aepack.py
   python/branches/py3k/Lib/plat-mac/aetools.py
   python/branches/py3k/Lib/plat-mac/aetypes.py
   python/branches/py3k/Lib/plat-mac/applesingle.py
   python/branches/py3k/Lib/plat-mac/appletrawmain.py
   python/branches/py3k/Lib/plat-mac/appletrunner.py
   python/branches/py3k/Lib/plat-mac/argvemulator.py
   python/branches/py3k/Lib/plat-mac/bgenlocations.py
   python/branches/py3k/Lib/plat-mac/buildtools.py
   python/branches/py3k/Lib/plat-mac/bundlebuilder.py
   python/branches/py3k/Lib/plat-mac/dialogs.rsrc
   python/branches/py3k/Lib/plat-mac/errors.rsrc
   python/branches/py3k/Lib/plat-mac/findertools.py
   python/branches/py3k/Lib/plat-mac/gensuitemodule.py
   python/branches/py3k/Lib/plat-mac/ic.py
   python/branches/py3k/Lib/plat-mac/icopen.py
   python/branches/py3k/Lib/plat-mac/lib-scriptpackages/
   python/branches/py3k/Lib/plat-mac/macerrors.py
   python/branches/py3k/Lib/plat-mac/macostools.py
   python/branches/py3k/Lib/plat-mac/macresource.py
   python/branches/py3k/Lib/plat-mac/pimp.py
   python/branches/py3k/Lib/plat-mac/terminalcommand.py
   python/branches/py3k/Lib/plat-mac/videoreader.py
   python/branches/py3k/Lib/test/test_aepack.py
   python/branches/py3k/Lib/test/test_applesingle.py
   python/branches/py3k/Lib/test/test_macostools.py
   python/branches/py3k/Lib/test/test_scriptpackages.py
   python/branches/py3k/Mac/Modules/
Modified:
   python/branches/py3k/Doc/library/binhex.rst
   python/branches/py3k/Doc/library/index.rst
   python/branches/py3k/Doc/library/plistlib.rst
   python/branches/py3k/Doc/library/undoc.rst
   python/branches/py3k/Doc/using/mac.rst
   python/branches/py3k/Lib/binhex.py
   python/branches/py3k/Lib/plistlib.py
   python/branches/py3k/setup.py

Deleted: python/branches/py3k/Doc/library/aepack.rst
==============================================================================
--- python/branches/py3k/Doc/library/aepack.rst	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,86 +0,0 @@
-
-:mod:`aepack` --- Conversion between Python variables and AppleEvent data containers
-====================================================================================
-
-.. module:: aepack
-   :platform: Mac
-   :synopsis: Conversion between Python variables and AppleEvent data containers.
-.. sectionauthor:: Vincent Marchetti <vincem at en.com>
-.. moduleauthor:: Jack Jansen
-
-The :mod:`aepack` module defines functions for converting (packing) Python
-variables to AppleEvent descriptors and back (unpacking). Within Python the
-AppleEvent descriptor is handled by Python objects of built-in type
-:class:`AEDesc`, defined in module :mod:`Carbon.AE`.
-
-The :mod:`aepack` module defines the following functions:
-
-
-.. function:: pack(x[, forcetype])
-
-   Returns an :class:`AEDesc` object  containing a conversion of Python value x. If
-   *forcetype* is provided it specifies the descriptor type of the result.
-   Otherwise, a default mapping of Python types to Apple Event descriptor types is
-   used, as follows:
-
-   +-----------------+-----------------------------------+
-   | Python type     | descriptor type                   |
-   +=================+===================================+
-   | :class:`FSSpec` | typeFSS                           |
-   +-----------------+-----------------------------------+
-   | :class:`FSRef`  | typeFSRef                         |
-   +-----------------+-----------------------------------+
-   | :class:`Alias`  | typeAlias                         |
-   +-----------------+-----------------------------------+
-   | integer         | typeLong (32 bit integer)         |
-   +-----------------+-----------------------------------+
-   | float           | typeFloat (64 bit floating point) |
-   +-----------------+-----------------------------------+
-   | string          | typeText                          |
-   +-----------------+-----------------------------------+
-   | unicode         | typeUnicodeText                   |
-   +-----------------+-----------------------------------+
-   | list            | typeAEList                        |
-   +-----------------+-----------------------------------+
-   | dictionary      | typeAERecord                      |
-   +-----------------+-----------------------------------+
-   | instance        | *see below*                       |
-   +-----------------+-----------------------------------+
-
-   If *x* is a Python instance then this function attempts to call an
-   :meth:`__aepack__` method.  This method should return an :class:`AEDesc` object.
-
-   If the conversion *x* is not defined above, this function returns the Python
-   string representation of a value (the repr() function) encoded as a text
-   descriptor.
-
-
-.. function:: unpack(x[, formodulename])
-
-   *x* must be an object of type :class:`AEDesc`. This function returns a Python
-   object representation of the data in the Apple Event descriptor *x*. Simple
-   AppleEvent data types (integer, text, float) are returned as their obvious
-   Python counterparts. Apple Event lists are returned as Python lists, and the
-   list elements are recursively unpacked.  Object references (ex. ``line 3 of
-   document 1``) are returned as instances of :class:`aetypes.ObjectSpecifier`,
-   unless ``formodulename`` is specified.  AppleEvent descriptors with descriptor
-   type typeFSS are returned as :class:`FSSpec` objects.  AppleEvent record
-   descriptors are returned as Python dictionaries, with 4-character string keys
-   and elements recursively unpacked.
-
-   The optional ``formodulename`` argument is used by the stub packages generated
-   by :mod:`gensuitemodule`, and ensures that the OSA classes for object specifiers
-   are looked up in the correct module. This ensures that if, say, the Finder
-   returns an object specifier for a window you get an instance of
-   ``Finder.Window`` and not a generic ``aetypes.Window``. The former knows about
-   all the properties and elements a window has in the Finder, while the latter
-   knows no such things.
-
-
-.. seealso::
-
-   Module :mod:`Carbon.AE`
-      Built-in access to Apple Event Manager routines.
-
-   Module :mod:`aetypes`
-      Python definitions of codes for Apple Event descriptor types.

Deleted: python/branches/py3k/Doc/library/aetools.rst
==============================================================================
--- python/branches/py3k/Doc/library/aetools.rst	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,84 +0,0 @@
-
-:mod:`aetools` --- OSA client support
-=====================================
-
-.. module:: aetools
-   :platform: Mac
-   :synopsis: Basic support for sending Apple Events
-.. sectionauthor:: Jack Jansen <Jack.Jansen at cwi.nl>
-.. moduleauthor:: Jack Jansen
-
-The :mod:`aetools` module contains the basic functionality on which Python
-AppleScript client support is built. It also imports and re-exports the core
-functionality of the :mod:`aetypes` and :mod:`aepack` modules. The stub packages
-generated by :mod:`gensuitemodule` import the relevant portions of
-:mod:`aetools`, so usually you do not need to import it yourself. The exception
-to this is when you cannot use a generated suite package and need lower-level
-access to scripting.
-
-The :mod:`aetools` module itself uses the AppleEvent support provided by the
-:mod:`Carbon.AE` module. This has one drawback: you need access to the window
-manager, see section :ref:`osx-gui-scripts` for details. This restriction may be
-lifted in future releases.
-
-The :mod:`aetools` module defines the following functions:
-
-
-.. function:: packevent(ae, parameters, attributes)
-
-   Stores parameters and attributes in a pre-created ``Carbon.AE.AEDesc`` object.
-   ``parameters`` and ``attributes`` are  dictionaries mapping 4-character OSA
-   parameter keys to Python objects. The objects are packed using
-   ``aepack.pack()``.
-
-
-.. function:: unpackevent(ae[, formodulename])
-
-   Recursively unpacks a ``Carbon.AE.AEDesc`` event to Python objects. The function
-   returns the parameter dictionary and the attribute dictionary. The
-   ``formodulename`` argument is used by generated stub packages to control where
-   AppleScript classes are looked up.
-
-
-.. function:: keysubst(arguments, keydict)
-
-   Converts a Python keyword argument dictionary ``arguments`` to the format
-   required by ``packevent`` by replacing the keys, which are Python identifiers,
-   by the four-character OSA keys according to the mapping specified in
-   ``keydict``. Used by the generated suite packages.
-
-
-.. function:: enumsubst(arguments, key, edict)
-
-   If the ``arguments`` dictionary contains an entry for ``key`` convert the value
-   for that entry according to dictionary ``edict``. This converts human-readable
-   Python enumeration names to the OSA 4-character codes. Used by the generated
-   suite packages.
-
-The :mod:`aetools` module defines the following class:
-
-
-.. class:: TalkTo([signature=None, start=0, timeout=0])
-
-   Base class for the proxy used to talk to an application. ``signature`` overrides
-   the class attribute ``_signature`` (which is usually set by subclasses) and is
-   the 4-char creator code defining the application to talk to. ``start`` can be
-   set to true to enable running the application on class instantiation.
-   ``timeout`` can be specified to change the default timeout used while waiting
-   for an AppleEvent reply.
-
-
-.. method:: TalkTo._start()
-
-   Test whether the application is running, and attempt to start it if not.
-
-
-.. method:: TalkTo.send(code, subcode[, parameters, attributes])
-
-   Create the AppleEvent ``Carbon.AE.AEDesc`` for the verb with the OSA designation
-   ``code, subcode`` (which are the usual 4-character strings), pack the
-   ``parameters`` and ``attributes`` into it, send it to the target application,
-   wait for the reply, unpack the reply with ``unpackevent`` and return the reply
-   appleevent, the unpacked return values as a dictionary and the return
-   attributes.
-

Deleted: python/branches/py3k/Doc/library/aetypes.rst
==============================================================================
--- python/branches/py3k/Doc/library/aetypes.rst	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,148 +0,0 @@
-
-:mod:`aetypes` --- AppleEvent objects
-=====================================
-
-.. module:: aetypes
-   :platform: Mac
-   :synopsis: Python representation of the Apple Event Object Model.
-.. sectionauthor:: Vincent Marchetti <vincem at en.com>
-.. moduleauthor:: Jack Jansen
-
-The :mod:`aetypes` defines classes used to represent Apple Event data
-descriptors and Apple Event object specifiers.
-
-Apple Event data is contained in descriptors, and these descriptors are typed.
-For many descriptors the Python representation is simply the corresponding
-Python type: ``typeText`` in OSA is a Python string, ``typeFloat`` is a float,
-etc. For OSA types that have no direct Python counterpart this module declares
-classes. Packing and unpacking instances of these classes is handled
-automatically by :mod:`aepack`.
-
-An object specifier is essentially an address of an object implemented in a
-Apple Event server. An Apple Event specifier is used as the direct object for an
-Apple Event or as the argument of an optional parameter. The :mod:`aetypes`
-module contains the base classes for OSA classes and properties, which are used
-by the packages generated by :mod:`gensuitemodule` to populate the classes and
-properties in a given suite.
-
-For reasons of backward compatibility, and for cases where you need to script an
-application for which you have not generated the stub package this module also
-contains object specifiers for a number of common OSA classes such as
-``Document``, ``Window``, ``Character``, etc.
-
-The :mod:`AEObjects` module defines the following classes to represent Apple
-Event descriptor data:
-
-
-.. class:: Unknown(type, data)
-
-   The representation of OSA descriptor data for which the :mod:`aepack` and
-   :mod:`aetypes` modules have no support, i.e. anything that is not represented by
-   the other classes here and that is not equivalent to a simple Python value.
-
-
-.. class:: Enum(enum)
-
-   An enumeration value with the given 4-character string value.
-
-
-.. class:: InsertionLoc(of, pos)
-
-   Position ``pos`` in object ``of``.
-
-
-.. class:: Boolean(bool)
-
-   A boolean.
-
-
-.. class:: StyledText(style, text)
-
-   Text with style information (font, face, etc) included.
-
-
-.. class:: AEText(script, style, text)
-
-   Text with script system and style information included.
-
-
-.. class:: IntlText(script, language, text)
-
-   Text with script system and language information included.
-
-
-.. class:: IntlWritingCode(script, language)
-
-   Script system and language information.
-
-
-.. class:: QDPoint(v, h)
-
-   A quickdraw point.
-
-
-.. class:: QDRectangle(v0, h0, v1, h1)
-
-   A quickdraw rectangle.
-
-
-.. class:: RGBColor(r, g, b)
-
-   A color.
-
-
-.. class:: Type(type)
-
-   An OSA type value with the given 4-character name.
-
-
-.. class:: Keyword(name)
-
-   An OSA keyword with the given 4-character name.
-
-
-.. class:: Range(start, stop)
-
-   A range.
-
-
-.. class:: Ordinal(abso)
-
-   Non-numeric absolute positions, such as ``"firs"``, first, or ``"midd"``,
-   middle.
-
-
-.. class:: Logical(logc, term)
-
-   The logical expression of applying operator ``logc`` to ``term``.
-
-
-.. class:: Comparison(obj1, relo, obj2)
-
-   The comparison ``relo`` of ``obj1`` to ``obj2``.
-
-The following classes are used as base classes by the generated stub packages to
-represent AppleScript classes and properties in Python:
-
-
-.. class:: ComponentItem(which[, fr])
-
-   Abstract baseclass for an OSA class. The subclass should set the class attribute
-   ``want`` to the 4-character OSA class code. Instances of subclasses of this
-   class are equivalent to AppleScript Object Specifiers. Upon instantiation you
-   should pass a selector in ``which``, and optionally a parent object in ``fr``.
-
-
-.. class:: NProperty(fr)
-
-   Abstract baseclass for an OSA property. The subclass should set the class
-   attributes ``want`` and ``which`` to designate which property we are talking
-   about. Instances of subclasses of this class are Object Specifiers.
-
-
-.. class:: ObjectSpecifier(want, form, seld[, fr])
-
-   Base class of ``ComponentItem`` and ``NProperty``, a general OSA Object
-   Specifier. See the Apple Open Scripting Architecture documentation for the
-   parameters. Note that this class is not abstract.
-

Deleted: python/branches/py3k/Doc/library/autogil.rst
==============================================================================
--- python/branches/py3k/Doc/library/autogil.rst	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,30 +0,0 @@
-
-:mod:`autoGIL` --- Global Interpreter Lock handling in event loops
-==================================================================
-
-.. module:: autoGIL
-   :platform: Mac
-   :synopsis: Global Interpreter Lock handling in event loops.
-.. moduleauthor:: Just van Rossum <just at letterror.com>
-
-
-The :mod:`autoGIL` module provides a function :func:`installAutoGIL` that
-automatically locks and unlocks Python's :term:`Global Interpreter Lock` when
-running an event loop.
-
-
-.. exception:: AutoGILError
-
-   Raised if the observer callback cannot be installed, for example because the
-   current thread does not have a run loop.
-
-
-.. function:: installAutoGIL()
-
-   Install an observer callback in the event loop (CFRunLoop) for the current
-   thread, that will lock and unlock the Global Interpreter Lock (GIL) at
-   appropriate times, allowing other Python threads to run while the event loop is
-   idle.
-
-   Availability: OSX 10.1 or later.
-

Modified: python/branches/py3k/Doc/library/binhex.rst
==============================================================================
--- python/branches/py3k/Doc/library/binhex.rst	(original)
+++ python/branches/py3k/Doc/library/binhex.rst	Tue May 13 00:25:16 2008
@@ -7,9 +7,7 @@
 
 
 This module encodes and decodes files in binhex4 format, a format allowing
-representation of Macintosh files in ASCII.  On the Macintosh, both forks of a
-file and the finder information are encoded (or decoded), on other platforms
-only the data fork is handled.
+representation of Macintosh files in ASCII. Only the data fork is handled.
 
 The :mod:`binhex` module defines the following functions:
 

Deleted: python/branches/py3k/Doc/library/carbon.rst
==============================================================================
--- python/branches/py3k/Doc/library/carbon.rst	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,288 +0,0 @@
-
-.. _toolbox:
-
-*********************
-MacOS Toolbox Modules
-*********************
-
-There are a set of modules that provide interfaces to various MacOS toolboxes.
-If applicable the module will define a number of Python objects for the various
-structures declared by the toolbox, and operations will be implemented as
-methods of the object.  Other operations will be implemented as functions in the
-module.  Not all operations possible in C will also be possible in Python
-(callbacks are often a problem), and parameters will occasionally be different
-in Python (input and output buffers, especially).  All methods and functions
-have a :attr:`__doc__` string describing their arguments and return values, and
-for additional description you are referred to `Inside Macintosh
-<http://developer.apple.com/documentation/macos8/mac8.html>`_ or similar works.
-
-These modules all live in a package called :mod:`Carbon`. Despite that name they
-are not all part of the Carbon framework: CF is really in the CoreFoundation
-framework and Qt is in the QuickTime framework. The normal use pattern is ::
-
-   from Carbon import AE
-
-**Warning!**  These modules are not yet documented.  If you wish to contribute
-documentation of any of these modules, please get in touch with docs at python.org.
-
-
-:mod:`Carbon.AE` --- Apple Events
-=================================
-
-.. module:: Carbon.AE
-   :platform: Mac
-   :synopsis: Interface to the Apple Events toolbox.
-
-
-
-:mod:`Carbon.AH` --- Apple Help
-===============================
-
-.. module:: Carbon.AH
-   :platform: Mac
-   :synopsis: Interface to the Apple Help manager.
-
-
-
-:mod:`Carbon.App` --- Appearance Manager
-========================================
-
-.. module:: Carbon.App
-   :platform: Mac
-   :synopsis: Interface to the Appearance Manager.
-
-
-
-:mod:`Carbon.CF` --- Core Foundation
-====================================
-
-.. module:: Carbon.CF
-   :platform: Mac
-   :synopsis: Interface to the Core Foundation.
-
-
-The ``CFBase``, ``CFArray``, ``CFData``, ``CFDictionary``, ``CFString`` and
-``CFURL`` objects are supported, some only partially.
-
-
-:mod:`Carbon.CG` --- Core Graphics
-==================================
-
-.. module:: Carbon.CG
-   :platform: Mac
-   :synopsis: Interface to Core Graphics.
-
-
-
-:mod:`Carbon.CarbonEvt` --- Carbon Event Manager
-================================================
-
-.. module:: Carbon.CarbonEvt
-   :platform: Mac
-   :synopsis: Interface to the Carbon Event Manager.
-
-
-
-:mod:`Carbon.Cm` --- Component Manager
-======================================
-
-.. module:: Carbon.Cm
-   :platform: Mac
-   :synopsis: Interface to the Component Manager.
-
-
-
-:mod:`Carbon.Ctl` --- Control Manager
-=====================================
-
-.. module:: Carbon.Ctl
-   :platform: Mac
-   :synopsis: Interface to the Control Manager.
-
-
-
-:mod:`Carbon.Dlg` --- Dialog Manager
-====================================
-
-.. module:: Carbon.Dlg
-   :platform: Mac
-   :synopsis: Interface to the Dialog Manager.
-
-
-
-:mod:`Carbon.Evt` --- Event Manager
-===================================
-
-.. module:: Carbon.Evt
-   :platform: Mac
-   :synopsis: Interface to the classic Event Manager.
-
-
-
-:mod:`Carbon.Fm` --- Font Manager
-=================================
-
-.. module:: Carbon.Fm
-   :platform: Mac
-   :synopsis: Interface to the Font Manager.
-
-
-
-:mod:`Carbon.Folder` --- Folder Manager
-=======================================
-
-.. module:: Carbon.Folder
-   :platform: Mac
-   :synopsis: Interface to the Folder Manager.
-
-
-
-:mod:`Carbon.Help` --- Help Manager
-===================================
-
-.. module:: Carbon.Help
-   :platform: Mac
-   :synopsis: Interface to the Carbon Help Manager.
-
-
-
-:mod:`Carbon.List` --- List Manager
-===================================
-
-.. module:: Carbon.List
-   :platform: Mac
-   :synopsis: Interface to the List Manager.
-
-
-
-:mod:`Carbon.Menu` --- Menu Manager
-===================================
-
-.. module:: Carbon.Menu
-   :platform: Mac
-   :synopsis: Interface to the Menu Manager.
-
-
-
-:mod:`Carbon.Mlte` --- MultiLingual Text Editor
-===============================================
-
-.. module:: Carbon.Mlte
-   :platform: Mac
-   :synopsis: Interface to the MultiLingual Text Editor.
-
-
-
-:mod:`Carbon.Qd` --- QuickDraw
-==============================
-
-.. module:: Carbon.Qd
-   :platform: Mac
-   :synopsis: Interface to the QuickDraw toolbox.
-
-
-
-:mod:`Carbon.Qdoffs` --- QuickDraw Offscreen
-============================================
-
-.. module:: Carbon.Qdoffs
-   :platform: Mac
-   :synopsis: Interface to the QuickDraw Offscreen APIs.
-
-
-
-:mod:`Carbon.Qt` --- QuickTime
-==============================
-
-.. module:: Carbon.Qt
-   :platform: Mac
-   :synopsis: Interface to the QuickTime toolbox.
-
-
-
-:mod:`Carbon.Res` --- Resource Manager and Handles
-==================================================
-
-.. module:: Carbon.Res
-   :platform: Mac
-   :synopsis: Interface to the Resource Manager and Handles.
-
-
-
-:mod:`Carbon.Scrap` --- Scrap Manager
-=====================================
-
-.. module:: Carbon.Scrap
-   :platform: Mac
-   :synopsis: The Scrap Manager provides basic services for implementing cut & paste and
-              clipboard operations.
-
-
-This module is only fully available on MacOS9 and earlier under classic PPC
-MacPython.  Very limited functionality is available under Carbon MacPython.
-
-.. index:: single: Scrap Manager
-
-The Scrap Manager supports the simplest form of cut & paste operations on the
-Macintosh.  It can be use for both inter- and intra-application clipboard
-operations.
-
-The :mod:`Scrap` module provides low-level access to the functions of the Scrap
-Manager.  It contains the following functions:
-
-
-.. function:: InfoScrap()
-
-   Return current information about the scrap.  The information is encoded as a
-   tuple containing the fields ``(size, handle, count, state, path)``.
-
-   +----------+---------------------------------------------+
-   | Field    | Meaning                                     |
-   +==========+=============================================+
-   | *size*   | Size of the scrap in bytes.                 |
-   +----------+---------------------------------------------+
-   | *handle* | Resource object representing the scrap.     |
-   +----------+---------------------------------------------+
-   | *count*  | Serial number of the scrap contents.        |
-   +----------+---------------------------------------------+
-   | *state*  | Integer; positive if in memory, ``0`` if on |
-   |          | disk, negative if uninitialized.            |
-   +----------+---------------------------------------------+
-   | *path*   | Filename of the scrap when stored on disk.  |
-   +----------+---------------------------------------------+
-
-
-.. seealso::
-
-   `Scrap Manager <http://developer.apple.com/documentation/mac/MoreToolbox/MoreToolbox-109.html>`_
-      Apple's documentation for the Scrap Manager gives a lot of useful information
-      about using the Scrap Manager in applications.
-
-
-
-:mod:`Carbon.Snd` --- Sound Manager
-===================================
-
-.. module:: Carbon.Snd
-   :platform: Mac
-   :synopsis: Interface to the Sound Manager.
-
-
-
-:mod:`Carbon.TE` --- TextEdit
-=============================
-
-.. module:: Carbon.TE
-   :platform: Mac
-   :synopsis: Interface to TextEdit.
-
-
-
-:mod:`Carbon.Win` --- Window Manager
-====================================
-
-.. module:: Carbon.Win
-   :platform: Mac
-   :synopsis: Interface to the Window Manager.
-
-

Deleted: python/branches/py3k/Doc/library/colorpicker.rst
==============================================================================
--- python/branches/py3k/Doc/library/colorpicker.rst	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,23 +0,0 @@
-
-:mod:`ColorPicker` --- Color selection dialog
-=============================================
-
-.. module:: ColorPicker
-   :platform: Mac
-   :synopsis: Interface to the standard color selection dialog.
-.. moduleauthor:: Just van Rossum <just at letterror.com>
-.. sectionauthor:: Fred L. Drake, Jr. <fdrake at acm.org>
-
-
-The :mod:`ColorPicker` module provides access to the standard color picker
-dialog.
-
-
-.. function:: GetColor(prompt, rgb)
-
-   Show a standard color selection dialog and allow the user to select a color.
-   The user is given instruction by the *prompt* string, and the default color is
-   set to *rgb*.  *rgb* must be a tuple giving the red, green, and blue components
-   of the color. :func:`GetColor` returns a tuple giving the user's selected color
-   and a flag indicating whether they accepted the selection of cancelled.
-

Deleted: python/branches/py3k/Doc/library/easydialogs.rst
==============================================================================
--- python/branches/py3k/Doc/library/easydialogs.rst	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,202 +0,0 @@
-
-:mod:`EasyDialogs` --- Basic Macintosh dialogs
-==============================================
-
-.. module:: EasyDialogs
-   :platform: Mac
-   :synopsis: Basic Macintosh dialogs.
-
-
-The :mod:`EasyDialogs` module contains some simple dialogs for the Macintosh.
-All routines take an optional resource ID parameter *id* with which one can
-override the :const:`DLOG` resource used for the dialog, provided that the
-dialog items correspond (both type and item number) to those in the default
-:const:`DLOG` resource. See source code for details.
-
-The :mod:`EasyDialogs` module defines the following functions:
-
-
-.. function:: Message(str[, id[, ok]])
-
-   Displays a modal dialog with the message text *str*, which should be at most 255
-   characters long. The button text defaults to "OK", but is set to the string
-   argument *ok* if the latter is supplied. Control is returned when the user
-   clicks the "OK" button.
-
-
-.. function:: AskString(prompt[, default[, id[, ok[, cancel]]]])
-
-   Asks the user to input a string value via a modal dialog. *prompt* is the prompt
-   message, and the optional *default* supplies the initial value for the string
-   (otherwise ``""`` is used). The text of the "OK" and "Cancel" buttons can be
-   changed with the *ok* and *cancel* arguments. All strings can be at most 255
-   bytes long. :func:`AskString` returns the string entered or :const:`None` in
-   case the user cancelled.
-
-
-.. function:: AskPassword(prompt[, default[, id[, ok[, cancel]]]])
-
-   Asks the user to input a string value via a modal dialog. Like
-   :func:`AskString`, but with the text shown as bullets. The arguments have the
-   same meaning as for :func:`AskString`.
-
-
-.. function:: AskYesNoCancel(question[, default[, yes[, no[, cancel[, id]]]]])
-
-   Presents a dialog with prompt *question* and three buttons labelled "Yes", "No",
-   and "Cancel". Returns ``1`` for "Yes", ``0`` for "No" and ``-1`` for "Cancel".
-   The value of *default* (or ``0`` if *default* is not supplied) is returned when
-   the :kbd:`RETURN` key is pressed. The text of the buttons can be changed with
-   the *yes*, *no*, and *cancel* arguments; to prevent a button from appearing,
-   supply ``""`` for the corresponding argument.
-
-
-.. function:: ProgressBar([title[, maxval[, label[, id]]]])
-
-   Displays a modeless progress-bar dialog. This is the constructor for the
-   :class:`ProgressBar` class described below. *title* is the text string displayed
-   (default "Working..."), *maxval* is the value at which progress is complete
-   (default ``0``, indicating that an indeterminate amount of work remains to be
-   done), and *label* is the text that is displayed above the progress bar itself.
-
-
-.. function:: GetArgv([optionlist[ commandlist[, addoldfile[, addnewfile[, addfolder[, id]]]]]])
-
-   Displays a dialog which aids the user in constructing a command-line argument
-   list.  Returns the list in ``sys.argv`` format, suitable for passing as an
-   argument to :func:`getopt.getopt`.  *addoldfile*, *addnewfile*, and *addfolder*
-   are boolean arguments.  When nonzero, they enable the user to insert into the
-   command line paths to an existing file, a (possibly) not-yet-existent file, and
-   a folder, respectively.  (Note: Option arguments must appear in the command line
-   before file and folder arguments in order to be recognized by
-   :func:`getopt.getopt`.)  Arguments containing spaces can be specified by
-   enclosing them within single or double quotes.  A :exc:`SystemExit` exception is
-   raised if the user presses the "Cancel" button.
-
-   *optionlist* is a list that determines a popup menu from which the allowed
-   options are selected.  Its items can take one of two forms: *optstr* or
-   ``(optstr, descr)``.  When present, *descr* is a short descriptive string that
-   is displayed in the dialog while this option is selected in the popup menu.  The
-   correspondence between *optstr*\s and command-line arguments is:
-
-   +----------------------+------------------------------------------+
-   | *optstr* format      | Command-line format                      |
-   +======================+==========================================+
-   | ``x``                | :option:`-x` (short option)              |
-   +----------------------+------------------------------------------+
-   | ``x:`` or ``x=``     | :option:`-x` (short option with value)   |
-   +----------------------+------------------------------------------+
-   | ``xyz``              | :option:`--xyz` (long option)            |
-   +----------------------+------------------------------------------+
-   | ``xyz:`` or ``xyz=`` | :option:`--xyz` (long option with value) |
-   +----------------------+------------------------------------------+
-
-   *commandlist* is a list of items of the form *cmdstr* or ``(cmdstr, descr)``,
-   where *descr* is as above.  The *cmdstr*s will appear in a popup menu.  When
-   chosen, the text of *cmdstr* will be appended to the command line as is, except
-   that a trailing ``':'`` or ``'='`` (if present) will be trimmed off.
-
-
-.. function:: AskFileForOpen( [message] [, typeList] [, defaultLocation] [, defaultOptionFlags] [, location] [, clientName] [, windowTitle] [, actionButtonLabel] [, cancelButtonLabel] [, preferenceKey] [, popupExtension] [, eventProc] [, previewProc] [, filterProc] [, wanted] )
-
-   Post a dialog asking the user for a file to open, and return the file selected
-   or :const:`None` if the user cancelled. *message* is a text message to display,
-   *typeList* is a list of 4-char filetypes allowable, *defaultLocation* is the
-   pathname, :class:`FSSpec` or :class:`FSRef` of the folder to show initially,
-   *location* is the ``(x, y)`` position on the screen where the dialog is shown,
-   *actionButtonLabel* is a string to show instead of "Open" in the OK button,
-   *cancelButtonLabel* is a string to show instead of "Cancel" in the cancel
-   button, *wanted* is the type of value wanted as a return: :class:`str`,
-   :class:`FSSpec`, :class:`FSRef` and subtypes thereof are
-   acceptable.
-
-   .. index:: single: Navigation Services
-
-   For a description of the other arguments please see the Apple Navigation
-   Services documentation and the :mod:`EasyDialogs` source code.
-
-
-.. function:: AskFileForSave( [message] [, savedFileName] [, defaultLocation] [, defaultOptionFlags] [, location] [, clientName] [, windowTitle] [, actionButtonLabel] [, cancelButtonLabel] [, preferenceKey] [, popupExtension] [, fileType] [, fileCreator] [, eventProc] [, wanted] )
-
-   Post a dialog asking the user for a file to save to, and return the file
-   selected or :const:`None` if the user cancelled. *savedFileName* is the default
-   for the file name to save to (the return value). See :func:`AskFileForOpen` for
-   a description of the other arguments.
-
-
-.. function:: AskFolder( [message] [, defaultLocation] [, defaultOptionFlags] [, location] [, clientName] [, windowTitle] [, actionButtonLabel] [, cancelButtonLabel] [, preferenceKey] [, popupExtension] [, eventProc] [, filterProc] [, wanted] )
-
-   Post a dialog asking the user to select a folder, and return the folder selected
-   or :const:`None` if the user cancelled. See :func:`AskFileForOpen` for a
-   description of the arguments.
-
-
-.. seealso::
-
-   `Navigation Services Reference <http://developer.apple.com/documentation/Carbon/Reference/Navigation_Services_Ref/>`_
-      Programmer's reference documentation for the Navigation Services, a part of the
-      Carbon framework.
-
-
-.. _progressbar-objects:
-
-ProgressBar Objects
--------------------
-
-:class:`ProgressBar` objects provide support for modeless progress-bar dialogs.
-Both determinate (thermometer style) and indeterminate (barber-pole style)
-progress bars are supported.  The bar will be determinate if its maximum value
-is greater than zero; otherwise it will be indeterminate.
-
-The dialog is displayed immediately after creation. If the dialog's "Cancel"
-button is pressed, or if :kbd:`Cmd-.` or :kbd:`ESC` is typed, the dialog window
-is hidden and :exc:`KeyboardInterrupt` is raised (but note that this response
-does not occur until the progress bar is next updated, typically via a call to
-:meth:`inc` or :meth:`set`).  Otherwise, the bar remains visible until the
-:class:`ProgressBar` object is discarded.
-
-:class:`ProgressBar` objects possess the following attributes and methods:
-
-
-.. attribute:: ProgressBar.curval
-
-   The current value (of type integer) of the progress bar.  The
-   normal access methods coerce :attr:`curval` between ``0`` and :attr:`maxval`.
-   This attribute should not be altered directly.
-
-
-.. attribute:: ProgressBar.maxval
-
-   The maximum value (of type integer) of the progress bar; the
-   progress bar (thermometer style) is full when :attr:`curval` equals
-   :attr:`maxval`.  If :attr:`maxval` is ``0``, the bar will be indeterminate
-   (barber-pole).  This attribute should not be altered directly.
-
-
-.. method:: ProgressBar.title([newstr])
-
-   Sets the text in the title bar of the progress dialog to *newstr*.
-
-
-.. method:: ProgressBar.label([newstr])
-
-   Sets the text in the progress box of the progress dialog to *newstr*.
-
-
-.. method:: ProgressBar.set(value[, max])
-
-   Sets the progress bar's :attr:`curval` to *value*, and also :attr:`maxval` to
-   *max* if the latter is provided.  *value* is first coerced between 0 and
-   :attr:`maxval`.  The thermometer bar is updated to reflect the changes,
-   including a change from indeterminate to determinate or vice versa.
-
-
-.. method:: ProgressBar.inc([n])
-
-   Increments the progress bar's :attr:`curval` by *n*, or by ``1`` if *n* is not
-   provided.  (Note that *n* may be negative, in which case the effect is a
-   decrement.)  The progress bar is updated to reflect the change.  If the bar is
-   indeterminate, this causes one "spin" of the barber pole.  The resulting
-   :attr:`curval` is coerced between 0 and :attr:`maxval` if incrementing causes it
-   to fall outside this range.
-

Deleted: python/branches/py3k/Doc/library/framework.rst
==============================================================================
--- python/branches/py3k/Doc/library/framework.rst	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,335 +0,0 @@
-
-:mod:`FrameWork` --- Interactive application framework
-======================================================
-
-.. module:: FrameWork
-   :platform: Mac
-   :synopsis: Interactive application framework.
-
-
-The :mod:`FrameWork` module contains classes that together provide a framework
-for an interactive Macintosh application. The programmer builds an application
-by creating subclasses that override various methods of the bases classes,
-thereby implementing the functionality wanted. Overriding functionality can
-often be done on various different levels, i.e. to handle clicks in a single
-dialog window in a non-standard way it is not necessary to override the complete
-event handling.
-
-Work on the :mod:`FrameWork` has pretty much stopped, now that :mod:`PyObjC` is
-available for full Cocoa access from Python, and the documentation describes
-only the most important functionality, and not in the most logical manner at
-that. Examine the source or the examples for more details.  The following are
-some comments posted on the MacPython newsgroup about the strengths and
-limitations of :mod:`FrameWork`:
-
-
-.. epigraph::
-
-   The strong point of :mod:`FrameWork` is that it allows you to break into the
-   control-flow at many different places. :mod:`W`, for instance, uses a different
-   way to enable/disable menus and that plugs right in leaving the rest intact.
-   The weak points of :mod:`FrameWork` are that it has no abstract command
-   interface (but that shouldn't be difficult), that its dialog support is minimal
-   and that its control/toolbar support is non-existent.
-
-The :mod:`FrameWork` module defines the following functions:
-
-
-.. function:: Application()
-
-   An object representing the complete application. See below for a description of
-   the methods. The default :meth:`__init__` routine creates an empty window
-   dictionary and a menu bar with an apple menu.
-
-
-.. function:: MenuBar()
-
-   An object representing the menubar. This object is usually not created by the
-   user.
-
-
-.. function:: Menu(bar, title[, after])
-
-   An object representing a menu. Upon creation you pass the ``MenuBar`` the menu
-   appears in, the *title* string and a position (1-based) *after* where the menu
-   should appear (default: at the end).
-
-
-.. function:: MenuItem(menu, title[, shortcut, callback])
-
-   Create a menu item object. The arguments are the menu to create, the item title
-   string and optionally the keyboard shortcut and a callback routine. The callback
-   is called with the arguments menu-id, item number within menu (1-based), current
-   front window and the event record.
-
-   Instead of a callable object the callback can also be a string. In this case
-   menu selection causes the lookup of a method in the topmost window and the
-   application. The method name is the callback string with ``'domenu_'``
-   prepended.
-
-   Calling the ``MenuBar`` :meth:`fixmenudimstate` method sets the correct dimming
-   for all menu items based on the current front window.
-
-
-.. function:: Separator(menu)
-
-   Add a separator to the end of a menu.
-
-
-.. function:: SubMenu(menu, label)
-
-   Create a submenu named *label* under menu *menu*. The menu object is returned.
-
-
-.. function:: Window(parent)
-
-   Creates a (modeless) window. *Parent* is the application object to which the
-   window belongs. The window is not displayed until later.
-
-
-.. function:: DialogWindow(parent)
-
-   Creates a modeless dialog window.
-
-
-.. function:: windowbounds(width, height)
-
-   Return a ``(left, top, right, bottom)`` tuple suitable for creation of a window
-   of given width and height. The window will be staggered with respect to previous
-   windows, and an attempt is made to keep the whole window on-screen. However, the
-   window will however always be the exact size given, so parts may be offscreen.
-
-
-.. function:: setwatchcursor()
-
-   Set the mouse cursor to a watch.
-
-
-.. function:: setarrowcursor()
-
-   Set the mouse cursor to an arrow.
-
-
-.. _application-objects:
-
-Application Objects
--------------------
-
-Application objects have the following methods, among others:
-
-
-.. method:: Application.makeusermenus()
-
-   Override this method if you need menus in your application. Append the menus to
-   the attribute :attr:`menubar`.
-
-
-.. method:: Application.getabouttext()
-
-   Override this method to return a text string describing your application.
-   Alternatively, override the :meth:`do_about` method for more elaborate "about"
-   messages.
-
-
-.. method:: Application.mainloop([mask[, wait]])
-
-   This routine is the main event loop, call it to set your application rolling.
-   *Mask* is the mask of events you want to handle, *wait* is the number of ticks
-   you want to leave to other concurrent application (default 0, which is probably
-   not a good idea). While raising *self* to exit the mainloop is still supported
-   it is not recommended: call ``self._quit()`` instead.
-
-   The event loop is split into many small parts, each of which can be overridden.
-   The default methods take care of dispatching events to windows and dialogs,
-   handling drags and resizes, Apple Events, events for non-FrameWork windows, etc.
-
-   In general, all event handlers should return ``1`` if the event is fully handled
-   and ``0`` otherwise (because the front window was not a FrameWork window, for
-   instance). This is needed so that update events and such can be passed on to
-   other windows like the Sioux console window. Calling :func:`MacOS.HandleEvent`
-   is not allowed within *our_dispatch* or its callees, since this may result in an
-   infinite loop if the code is called through the Python inner-loop event handler.
-
-
-.. method:: Application.asyncevents(onoff)
-
-   Call this method with a nonzero parameter to enable asynchronous event handling.
-   This will tell the inner interpreter loop to call the application event handler
-   *async_dispatch* whenever events are available. This will cause FrameWork window
-   updates and the user interface to remain working during long computations, but
-   will slow the interpreter down and may cause surprising results in non-reentrant
-   code (such as FrameWork itself). By default *async_dispatch* will immediately
-   call *our_dispatch* but you may override this to handle only certain events
-   asynchronously. Events you do not handle will be passed to Sioux and such.
-
-   The old on/off value is returned.
-
-
-.. method:: Application._quit()
-
-   Terminate the running :meth:`mainloop` call at the next convenient moment.
-
-
-.. method:: Application.do_char(c, event)
-
-   The user typed character *c*. The complete details of the event can be found in
-   the *event* structure. This method can also be provided in a ``Window`` object,
-   which overrides the application-wide handler if the window is frontmost.
-
-
-.. method:: Application.do_dialogevent(event)
-
-   Called early in the event loop to handle modeless dialog events. The default
-   method simply dispatches the event to the relevant dialog (not through the
-   ``DialogWindow`` object involved). Override if you need special handling of
-   dialog events (keyboard shortcuts, etc).
-
-
-.. method:: Application.idle(event)
-
-   Called by the main event loop when no events are available. The null-event is
-   passed (so you can look at mouse position, etc).
-
-
-.. _window-objects:
-
-Window Objects
---------------
-
-Window objects have the following methods, among others:
-
-
-.. method:: Window.open()
-
-   Override this method to open a window. Store the MacOS window-id in
-   :attr:`self.wid` and call the :meth:`do_postopen` method to register the window
-   with the parent application.
-
-
-.. method:: Window.close()
-
-   Override this method to do any special processing on window close. Call the
-   :meth:`do_postclose` method to cleanup the parent state.
-
-
-.. method:: Window.do_postresize(width, height, macoswindowid)
-
-   Called after the window is resized. Override if more needs to be done than
-   calling ``InvalRect``.
-
-
-.. method:: Window.do_contentclick(local, modifiers, event)
-
-   The user clicked in the content part of a window. The arguments are the
-   coordinates (window-relative), the key modifiers and the raw event.
-
-
-.. method:: Window.do_update(macoswindowid, event)
-
-   An update event for the window was received. Redraw the window.
-
-
-.. method:: Window.do_activate(activate, event)
-
-   The window was activated (``activate == 1``) or deactivated (``activate == 0``).
-   Handle things like focus highlighting, etc.
-
-
-.. _controlswindow-object:
-
-ControlsWindow Object
----------------------
-
-ControlsWindow objects have the following methods besides those of ``Window``
-objects:
-
-
-.. method:: ControlsWindow.do_controlhit(window, control, pcode, event)
-
-   Part *pcode* of control *control* was hit by the user. Tracking and such has
-   already been taken care of.
-
-
-.. _scrolledwindow-object:
-
-ScrolledWindow Object
----------------------
-
-ScrolledWindow objects are ControlsWindow objects with the following extra
-methods:
-
-
-.. method:: ScrolledWindow.scrollbars([wantx[, wanty]])
-
-   Create (or destroy) horizontal and vertical scrollbars. The arguments specify
-   which you want (default: both). The scrollbars always have minimum ``0`` and
-   maximum ``32767``.
-
-
-.. method:: ScrolledWindow.getscrollbarvalues()
-
-   You must supply this method. It should return a tuple ``(x, y)`` giving the
-   current position of the scrollbars (between ``0`` and ``32767``). You can return
-   ``None`` for either to indicate the whole document is visible in that direction.
-
-
-.. method:: ScrolledWindow.updatescrollbars()
-
-   Call this method when the document has changed. It will call
-   :meth:`getscrollbarvalues` and update the scrollbars.
-
-
-.. method:: ScrolledWindow.scrollbar_callback(which, what, value)
-
-   Supplied by you and called after user interaction. *which* will be ``'x'`` or
-   ``'y'``, *what* will be ``'-'``, ``'--'``, ``'set'``, ``'++'`` or ``'+'``. For
-   ``'set'``, *value* will contain the new scrollbar position.
-
-
-.. method:: ScrolledWindow.scalebarvalues(absmin, absmax, curmin, curmax)
-
-   Auxiliary method to help you calculate values to return from
-   :meth:`getscrollbarvalues`. You pass document minimum and maximum value and
-   topmost (leftmost) and bottommost (rightmost) visible values and it returns the
-   correct number or ``None``.
-
-
-.. method:: ScrolledWindow.do_activate(onoff, event)
-
-   Takes care of dimming/highlighting scrollbars when a window becomes frontmost.
-   If you override this method, call this one at the end of your method.
-
-
-.. method:: ScrolledWindow.do_postresize(width, height, window)
-
-   Moves scrollbars to the correct position. Call this method initially if you
-   override it.
-
-
-.. method:: ScrolledWindow.do_controlhit(window, control, pcode, event)
-
-   Handles scrollbar interaction. If you override it call this method first, a
-   nonzero return value indicates the hit was in the scrollbars and has been
-   handled.
-
-
-.. _dialogwindow-objects:
-
-DialogWindow Objects
---------------------
-
-DialogWindow objects have the following methods besides those of ``Window``
-objects:
-
-
-.. method:: DialogWindow.open(resid)
-
-   Create the dialog window, from the DLOG resource with id *resid*. The dialog
-   object is stored in :attr:`self.wid`.
-
-
-.. method:: DialogWindow.do_itemhit(item, event)
-
-   Item number *item* was hit. You are responsible for redrawing toggle buttons,
-   etc.
-

Deleted: python/branches/py3k/Doc/library/ic.rst
==============================================================================
--- python/branches/py3k/Doc/library/ic.rst	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,119 +0,0 @@
-
-:mod:`ic` --- Access to the Mac OS X Internet Config
-====================================================
-
-.. module:: ic
-   :platform: Mac
-   :synopsis: Access to the Mac OS X Internet Config.
-
-
-This module provides access to various internet-related preferences set through
-:program:`System Preferences` or the :program:`Finder`.
-
-.. index:: module: icglue
-
-There is a low-level companion module :mod:`icglue` which provides the basic
-Internet Config access functionality.  This low-level module is not documented,
-but the docstrings of the routines document the parameters and the routine names
-are the same as for the Pascal or C API to Internet Config, so the standard IC
-programmers' documentation can be used if this module is needed.
-
-The :mod:`ic` module defines the :exc:`error` exception and symbolic names for
-all error codes Internet Config can produce; see the source for details.
-
-
-.. exception:: error
-
-   Exception raised on errors in the :mod:`ic` module.
-
-The :mod:`ic` module defines the following class and function:
-
-
-.. class:: IC([signature[, ic]])
-
-   Create an Internet Config object. The signature is a 4-character creator code of
-   the current application (default ``'Pyth'``) which may influence some of ICs
-   settings. The optional *ic* argument is a low-level ``icglue.icinstance``
-   created beforehand, this may be useful if you want to get preferences from a
-   different config file, etc.
-
-
-.. function:: launchurl(url[, hint])
-              parseurl(data[, start[, end[, hint]]])
-              mapfile(file)
-              maptypecreator(type, creator[, filename])
-              settypecreator(file)
-
-   These functions are "shortcuts" to the methods of the same name, described
-   below.
-
-
-IC Objects
-----------
-
-:class:`IC` objects have a mapping interface, hence to obtain the mail address
-you simply get ``ic['MailAddress']``. Assignment also works, and changes the
-option in the configuration file.
-
-The module knows about various datatypes, and converts the internal IC
-representation to a "logical" Python data structure. Running the :mod:`ic`
-module standalone will run a test program that lists all keys and values in your
-IC database, this will have to serve as documentation.
-
-If the module does not know how to represent the data it returns an instance of
-the ``ICOpaqueData`` type, with the raw data in its :attr:`data` attribute.
-Objects of this type are also acceptable values for assignment.
-
-Besides the dictionary interface, :class:`IC` objects have the following
-methods:
-
-
-.. method:: IC.launchurl(url[, hint])
-
-   Parse the given URL, launch the correct application and pass it the URL. The
-   optional *hint* can be a scheme name such as ``'mailto:'``, in which case
-   incomplete URLs are completed with this scheme.  If *hint* is not provided,
-   incomplete URLs are invalid.
-
-
-.. method:: IC.parseurl(data[, start[, end[, hint]]])
-
-   Find an URL somewhere in *data* and return start position, end position and the
-   URL. The optional *start* and *end* can be used to limit the search, so for
-   instance if a user clicks in a long text field you can pass the whole text field
-   and the click-position in *start* and this routine will return the whole URL in
-   which the user clicked.  As above, *hint* is an optional scheme used to complete
-   incomplete URLs.
-
-
-.. method:: IC.mapfile(file)
-
-   Return the mapping entry for the given *file*, which can be passed as either a
-   filename or an :func:`FSSpec` result, and which need not exist.
-
-   The mapping entry is returned as a tuple ``(version, type, creator, postcreator,
-   flags, extension, appname, postappname, mimetype, entryname)``, where *version*
-   is the entry version number, *type* is the 4-character filetype, *creator* is
-   the 4-character creator type, *postcreator* is the 4-character creator code of
-   an optional application to post-process the file after downloading, *flags* are
-   various bits specifying whether to transfer in binary or ascii and such,
-   *extension* is the filename extension for this file type, *appname* is the
-   printable name of the application to which this file belongs, *postappname* is
-   the name of the postprocessing application, *mimetype* is the MIME type of this
-   file and *entryname* is the name of this entry.
-
-
-.. method:: IC.maptypecreator(type, creator[, filename])
-
-   Return the mapping entry for files with given 4-character *type* and *creator*
-   codes. The optional *filename* may be specified to further help finding the
-   correct entry (if the creator code is ``'????'``, for instance).
-
-   The mapping entry is returned in the same format as for *mapfile*.
-
-
-.. method:: IC.settypecreator(file)
-
-   Given an existing *file*, specified either as a filename or as an :func:`FSSpec`
-   result, set its creator and type correctly based on its extension.  The finder
-   is told about the change, so the finder icon will be updated quickly.

Modified: python/branches/py3k/Doc/library/index.rst
==============================================================================
--- python/branches/py3k/Doc/library/index.rst	(original)
+++ python/branches/py3k/Doc/library/index.rst	Tue May 13 00:25:16 2008
@@ -73,6 +73,4 @@
    misc.rst
    windows.rst
    unix.rst
-   mac.rst
-   macosa.rst
    undoc.rst

Deleted: python/branches/py3k/Doc/library/mac.rst
==============================================================================
--- python/branches/py3k/Doc/library/mac.rst	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,23 +0,0 @@
-.. _mac-specific-services:
-
-*************************
-MacOS X specific services
-*************************
-
-This chapter describes modules that are only available on the Mac OS X platform.
-
-See the chapters :ref:`mac-scripting` and :ref:`undoc-mac-modules` for more
-modules, and the HOWTO :ref:`using-on-mac` for a general introduction to
-Mac-specific Python programming.
-
-
-.. toctree::
-
-   ic.rst
-   macos.rst
-   macostools.rst
-   easydialogs.rst
-   framework.rst
-   autogil.rst
-   carbon.rst
-   colorpicker.rst

Deleted: python/branches/py3k/Doc/library/macos.rst
==============================================================================
--- python/branches/py3k/Doc/library/macos.rst	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,93 +0,0 @@
-
-:mod:`MacOS` --- Access to Mac OS interpreter features
-======================================================
-
-.. module:: MacOS
-   :platform: Mac
-   :synopsis: Access to Mac OS-specific interpreter features.
-
-
-This module provides access to MacOS specific functionality in the Python
-interpreter, such as how the interpreter eventloop functions and the like. Use
-with care.
-
-Note the capitalization of the module name; this is a historical artifact.
-
-
-.. data:: runtimemodel
-
-   Always ``'macho'``.
-
-
-.. data:: linkmodel
-
-   The way the interpreter has been linked. As extension modules may be
-   incompatible between linking models, packages could use this information to give
-   more decent error messages. The value is one of ``'static'`` for a statically
-   linked Python, ``'framework'`` for Python in a Mac OS X framework, ``'shared'``
-   for Python in a standard Unix shared library. Older Pythons could also have the
-   value ``'cfm'`` for Mac OS 9-compatible Python.
-
-
-.. exception:: Error
-
-   .. index:: module: macerrors
-
-   This exception is raised on MacOS generated errors, either from functions in
-   this module or from other mac-specific modules like the toolbox interfaces. The
-   arguments are the integer error code (the :cdata:`OSErr` value) and a textual
-   description of the error code. Symbolic names for all known error codes are
-   defined in the standard module :mod:`macerrors`.
-
-
-.. function:: GetErrorString(errno)
-
-   Return the textual description of MacOS error code *errno*.
-
-
-.. function:: DebugStr(message [, object])
-
-   On Mac OS X the string is simply printed to stderr (on older Mac OS systems more
-   elaborate functionality was available), but it provides a convenient location to
-   attach a breakpoint in a low-level debugger like :program:`gdb`.
-
-
-.. function:: SysBeep()
-
-   Ring the bell.
-
-
-.. function:: GetTicks()
-
-   Get the number of clock ticks (1/60th of a second) since system boot.
-
-
-.. function:: GetCreatorAndType(file)
-
-   Return the file creator and file type as two four-character strings. The *file*
-   parameter can be a pathname or an ``FSSpec`` or  ``FSRef`` object.
-
-
-.. function:: SetCreatorAndType(file, creator, type)
-
-   Set the file creator and file type. The *file* parameter can be a pathname or an
-   ``FSSpec`` or  ``FSRef`` object. *creator* and *type* must be four character
-   strings.
-
-
-.. function:: openrf(name [, mode])
-
-   Open the resource fork of a file. Arguments are the same as for the built-in
-   function :func:`open`. The object returned has file-like semantics, but it is
-   not a Python file object, so there may be subtle differences.
-
-
-.. function:: WMAvailable()
-
-   Checks whether the current process has access to the window manager. The method
-   will return ``False`` if the window manager is not available, for instance when
-   running on Mac OS X Server or when logged in via ssh, or when the current
-   interpreter is not running from a fullblown application bundle. A script runs
-   from an application bundle either when it has been started with
-   :program:`pythonw` instead of :program:`python` or when running  as an applet.
-

Deleted: python/branches/py3k/Doc/library/macosa.rst
==============================================================================
--- python/branches/py3k/Doc/library/macosa.rst	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,92 +0,0 @@
-
-.. _mac-scripting:
-
-*********************
-MacPython OSA Modules
-*********************
-
-This chapter describes the current implementation of the Open Scripting
-Architecure (OSA, also commonly referred to as AppleScript) for Python, allowing
-you to control scriptable applications from your Python program, and with a
-fairly pythonic interface. Development on this set of modules has stopped, and a
-replacement is expected for Python 2.5.
-
-For a description of the various components of AppleScript and OSA, and to get
-an understanding of the architecture and terminology, you should read Apple's
-documentation. The "Applescript Language Guide" explains the conceptual model
-and the terminology, and documents the standard suite. The "Open Scripting
-Architecture" document explains how to use OSA from an application programmers
-point of view. In the Apple Help Viewer these books are located in the Developer
-Documentation, Core Technologies section.
-
-As an example of scripting an application, the following piece of AppleScript
-will get the name of the frontmost :program:`Finder` window and print it::
-
-   tell application "Finder"
-       get name of window 1
-   end tell
-
-In Python, the following code fragment will do the same::
-
-   import Finder
-
-   f = Finder.Finder()
-   print(f.get(f.window(1).name))
-
-As distributed the Python library includes packages that implement the standard
-suites, plus packages that interface to a small number of common applications.
-
-To send AppleEvents to an application you must first create the Python package
-interfacing to the terminology of the application (what :program:`Script Editor`
-calls the "Dictionary"). This can be done from within the :program:`PythonIDE`
-or by running the :file:`gensuitemodule.py` module as a standalone program from
-the command line.
-
-The generated output is a package with a number of modules, one for every suite
-used in the program plus an :mod:`__init__` module to glue it all together. The
-Python inheritance graph follows the AppleScript inheritance graph, so if a
-program's dictionary specifies that it includes support for the Standard Suite,
-but extends one or two verbs with extra arguments then the output suite will
-contain a module :mod:`Standard_Suite` that imports and re-exports everything
-from :mod:`StdSuites.Standard_Suite` but overrides the methods that have extra
-functionality. The output of :mod:`gensuitemodule` is pretty readable, and
-contains the documentation that was in the original AppleScript dictionary in
-Python docstrings, so reading it is a good source of documentation.
-
-The output package implements a main class with the same name as the package
-which contains all the AppleScript verbs as methods, with the direct object as
-the first argument and all optional parameters as keyword arguments. AppleScript
-classes are also implemented as Python classes, as are comparisons and all the
-other thingies.
-
-The main Python class implementing the verbs also allows access to the
-properties and elements declared in the AppleScript class "application". In the
-current release that is as far as the object orientation goes, so in the example
-above we need to use ``f.get(f.window(1).name)`` instead of the more Pythonic
-``f.window(1).name.get()``.
-
-If an AppleScript identifier is not a Python identifier the name is mangled
-according to a small number of rules:
-
-* spaces are replaced with underscores
-
-* other non-alphanumeric characters are replaced with ``_xx_`` where ``xx`` is
-  the hexadecimal character value
-
-* any Python reserved word gets an underscore appended
-
-Python also has support for creating scriptable applications in Python, but The
-following modules are relevant to MacPython AppleScript support:
-
-.. toctree::
-
-   gensuitemodule.rst
-   aetools.rst
-   aepack.rst
-   aetypes.rst
-   miniaeframe.rst
-
-
-In addition, support modules have been pre-generated for :mod:`Finder`,
-:mod:`Terminal`, :mod:`Explorer`, :mod:`Netscape`, :mod:`CodeWarrior`,
-:mod:`SystemEvents` and :mod:`StdSuites`.

Deleted: python/branches/py3k/Doc/library/macostools.rst
==============================================================================
--- python/branches/py3k/Doc/library/macostools.rst	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,115 +0,0 @@
-
-:mod:`macostools` --- Convenience routines for file manipulation
-================================================================
-
-.. module:: macostools
-   :platform: Mac
-   :synopsis: Convenience routines for file manipulation.
-
-
-This module contains some convenience routines for file-manipulation on the
-Macintosh. All file parameters can be specified as pathnames, :class:`FSRef` or
-:class:`FSSpec` objects.  This module expects a filesystem which supports forked
-files, so it should not be used on UFS partitions.
-
-The :mod:`macostools` module defines the following functions:
-
-
-.. function:: copy(src, dst[, createpath[, copytimes]])
-
-   Copy file *src* to *dst*.  If *createpath* is non-zero the folders leading to
-   *dst* are created if necessary. The method copies data and resource fork and
-   some finder information (creator, type, flags) and optionally the creation,
-   modification and backup times (default is to copy them). Custom icons, comments
-   and icon position are not copied.
-
-
-.. function:: copytree(src, dst)
-
-   Recursively copy a file tree from *src* to *dst*, creating folders as needed.
-   *src* and *dst* should be specified as pathnames.
-
-
-.. function:: mkalias(src, dst)
-
-   Create a finder alias *dst* pointing to *src*.
-
-
-.. function:: touched(dst)
-
-   Tell the finder that some bits of finder-information such as creator or type for
-   file *dst* has changed. The file can be specified by pathname or fsspec. This
-   call should tell the finder to redraw the files icon.
-
-   .. deprecated:: 2.6
-      The function is a no-op on OS X.
-
-
-.. data:: BUFSIZ
-
-   The buffer size for ``copy``, default 1 megabyte.
-
-Note that the process of creating finder aliases is not specified in the Apple
-documentation. Hence, aliases created with :func:`mkalias` could conceivably
-have incompatible behaviour in some cases.
-
-
-:mod:`findertools` --- The :program:`finder`'s Apple Events interface
-=====================================================================
-
-.. module:: findertools
-   :platform: Mac
-   :synopsis: Wrappers around the finder's Apple Events interface.
-
-
-.. index:: single: AppleEvents
-
-This module contains routines that give Python programs access to some
-functionality provided by the finder. They are implemented as wrappers around
-the AppleEvent interface to the finder.
-
-All file and folder parameters can be specified either as full pathnames, or as
-:class:`FSRef` or :class:`FSSpec` objects.
-
-The :mod:`findertools` module defines the following functions:
-
-
-.. function:: launch(file)
-
-   Tell the finder to launch *file*. What launching means depends on the file:
-   applications are started, folders are opened and documents are opened in the
-   correct application.
-
-
-.. function:: Print(file)
-
-   Tell the finder to print a file. The behaviour is identical to selecting the
-   file and using the print command in the finder's file menu.
-
-
-.. function:: copy(file, destdir)
-
-   Tell the finder to copy a file or folder *file* to folder *destdir*. The
-   function returns an :class:`Alias` object pointing to the new file.
-
-
-.. function:: move(file, destdir)
-
-   Tell the finder to move a file or folder *file* to folder *destdir*. The
-   function returns an :class:`Alias` object pointing to the new file.
-
-
-.. function:: sleep()
-
-   Tell the finder to put the Macintosh to sleep, if your machine supports it.
-
-
-.. function:: restart()
-
-   Tell the finder to perform an orderly restart of the machine.
-
-
-.. function:: shutdown()
-
-   Tell the finder to perform an orderly shutdown of the machine.
-

Modified: python/branches/py3k/Doc/library/plistlib.rst
==============================================================================
--- python/branches/py3k/Doc/library/plistlib.rst	(original)
+++ python/branches/py3k/Doc/library/plistlib.rst	Tue May 13 00:25:16 2008
@@ -65,19 +65,6 @@
    Return *rootObject* as a plist-formatted string.
 
 
-
-.. function:: readPlistFromResource(path[, restype='plst'[, resid=0]])
-
-    Read a plist from the resource with type *restype* from the resource fork of
-    *path*.  Availability: MacOS X.
-
-
-.. function:: writePlistToResource(rootObject, path[, restype='plst'[, resid=0]])
-
-    Write *rootObject* as a resource with type *restype* to the resource fork of
-    *path*.  Availability: MacOS X.
-
-
 The following class is available:
 
 .. class:: Data(data)

Modified: python/branches/py3k/Doc/library/undoc.rst
==============================================================================
--- python/branches/py3k/Doc/library/undoc.rst	(original)
+++ python/branches/py3k/Doc/library/undoc.rst	Tue May 13 00:25:16 2008
@@ -37,104 +37,6 @@
 :mod:`sunaudio`
    --- Interpret Sun audio headers (may become obsolete or a tool/demo).
 
-
-.. _undoc-mac-modules:
-
-Undocumented Mac OS modules
-===========================
-
-
-:mod:`applesingle` --- AppleSingle decoder
-------------------------------------------
-
-.. module:: applesingle
-   :platform: Mac
-   :synopsis: Rudimentary decoder for AppleSingle format files.
-
-
-:mod:`icopen` --- Internet Config replacement for :meth:`open`
---------------------------------------------------------------
-
-.. module:: icopen
-   :platform: Mac
-   :synopsis: Internet Config replacement for open().
-
-
-Importing :mod:`icopen` will replace the builtin :meth:`open` with a version
-that uses Internet Config to set file type and creator for new files.
-
-
-:mod:`macerrors` --- Mac OS Errors
-----------------------------------
-
-.. module:: macerrors
-   :platform: Mac
-   :synopsis: Constant definitions for many Mac OS error codes.
-
-
-:mod:`macerrors` contains constant definitions for many Mac OS error codes.
-
-
-:mod:`macresource` --- Locate script resources
-----------------------------------------------
-
-.. module:: macresource
-   :platform: Mac
-   :synopsis: Locate script resources.
-
-
-:mod:`macresource` helps scripts finding their resources, such as dialogs and
-menus, without requiring special case code for when the script is run under
-MacPython, as a MacPython applet or under OSX Python.
-
-
-:mod:`Nav` --- NavServices calls
---------------------------------
-
-.. module:: Nav
-   :platform: Mac
-   :synopsis: Interface to Navigation Services.
-
-
-A low-level interface to Navigation Services.
-
-
-:mod:`PixMapWrapper` --- Wrapper for PixMap objects
----------------------------------------------------
-
-.. module:: PixMapWrapper
-   :platform: Mac
-   :synopsis: Wrapper for PixMap objects.
-
-
-:mod:`PixMapWrapper` wraps a PixMap object with a Python object that allows
-access to the fields by name. It also has methods to convert to and from
-:mod:`PIL` images.
-
-
-:mod:`videoreader` --- Read QuickTime movies
---------------------------------------------
-
-.. module:: videoreader
-   :platform: Mac
-   :synopsis: Read QuickTime movies frame by frame for further processing.
-
-
-:mod:`videoreader` reads and decodes QuickTime movies and passes a stream of
-images to your program. It also provides some support for audio tracks.
-
-
-:mod:`W` --- Widgets built on :mod:`FrameWork`
-----------------------------------------------
-
-.. module:: W
-   :platform: Mac
-   :synopsis: Widgets for the Mac, built on top of FrameWork.
-
-
-The :mod:`W` widgets are used extensively in the :program:`IDE`.
-
-
 .. _obsolete-modules:
 
 Obsolete

Modified: python/branches/py3k/Doc/using/mac.rst
==============================================================================
--- python/branches/py3k/Doc/using/mac.rst	(original)
+++ python/branches/py3k/Doc/using/mac.rst	Tue May 13 00:25:16 2008
@@ -12,9 +12,6 @@
 any other Unix platform, but there are a number of additional features such as
 the IDE and the Package Manager that are worth pointing out.
 
-The Mac-specific modules are documented in :ref:`mac-specific-services`.
-
-
 .. _getting-osx:
 
 Getting and Installing MacPython

Modified: python/branches/py3k/Lib/binhex.py
==============================================================================
--- python/branches/py3k/Lib/binhex.py	(original)
+++ python/branches/py3k/Lib/binhex.py	Tue May 13 00:25:16 2008
@@ -43,68 +43,39 @@
 #
 # This code is no longer byte-order dependent
 
-#
-# Workarounds for non-mac machines.
-try:
-    from Carbon.File import FSSpec, FInfo
-    from MacOS import openrf
-
-    def getfileinfo(name):
-        finfo = FSSpec(name).FSpGetFInfo()
-        dir, file = os.path.split(name)
-        # XXX Get resource/data sizes
-        fp = io.open(name, 'rb')
-        fp.seek(0, 2)
-        dlen = fp.tell()
-        fp = openrf(name, '*rb')
-        fp.seek(0, 2)
-        rlen = fp.tell()
-        return file, finfo, dlen, rlen
-
-    def openrsrc(name, *mode):
-        if not mode:
-            mode = '*rb'
-        else:
-            mode = '*' + mode[0]
-        return openrf(name, mode)
 
-except ImportError:
-    #
-    # Glue code for non-macintosh usage
-    #
-
-    class FInfo:
-        def __init__(self):
-            self.Type = '????'
-            self.Creator = '????'
-            self.Flags = 0
-
-    def getfileinfo(name):
-        finfo = FInfo()
-        fp = io.open(name, 'rb')
-        # Quick check for textfile
-        data = fp.read(512)
-        if 0 not in data:
-            finfo.Type = 'TEXT'
-        fp.seek(0, 2)
-        dsize = fp.tell()
-        fp.close()
-        dir, file = os.path.split(name)
-        file = file.replace(':', '-', 1)
-        return file, finfo, dsize, 0
-
-    class openrsrc:
-        def __init__(self, *args):
-            pass
+class FInfo:
+    def __init__(self):
+        self.Type = '????'
+        self.Creator = '????'
+        self.Flags = 0
+
+def getfileinfo(name):
+    finfo = FInfo()
+    fp = io.open(name, 'rb')
+    # Quick check for textfile
+    data = fp.read(512)
+    if 0 not in data:
+        finfo.Type = 'TEXT'
+    fp.seek(0, 2)
+    dsize = fp.tell()
+    fp.close()
+    dir, file = os.path.split(name)
+    file = file.replace(':', '-', 1)
+    return file, finfo, dsize, 0
+
+class openrsrc:
+    def __init__(self, *args):
+        pass
 
-        def read(self, *args):
-            return b''
+    def read(self, *args):
+        return b''
 
-        def write(self, *args):
-            pass
+    def write(self, *args):
+        pass
 
-        def close(self):
-            pass
+    def close(self):
+        pass
 
 class _Hqxcoderengine:
     """Write data to the coder in 3-byte chunks"""

Deleted: python/branches/py3k/Lib/plat-mac/Audio_mac.py
==============================================================================
--- python/branches/py3k/Lib/plat-mac/Audio_mac.py	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,121 +0,0 @@
-QSIZE = 100000
-error='Audio_mac.error'
-
-class Play_Audio_mac:
-
-    def __init__(self, qsize=QSIZE):
-        self._chan = None
-        self._qsize = qsize
-        self._outrate = 22254
-        self._sampwidth = 1
-        self._nchannels = 1
-        self._gc = []
-        self._usercallback = None
-
-    def __del__(self):
-        self.stop()
-        self._usercallback = None
-
-    def wait(self):
-        import time
-        while self.getfilled():
-            time.sleep(0.1)
-        self._chan = None
-        self._gc = []
-
-    def stop(self, quietNow = 1):
-        ##chan = self._chan
-        self._chan = None
-        ##chan.SndDisposeChannel(1)
-        self._gc = []
-
-    def setoutrate(self, outrate):
-        self._outrate = outrate
-
-    def setsampwidth(self, sampwidth):
-        self._sampwidth = sampwidth
-
-    def setnchannels(self, nchannels):
-        self._nchannels = nchannels
-
-    def writeframes(self, data):
-        import time
-        from Carbon.Sound import bufferCmd, callBackCmd, extSH
-        import struct
-        import MacOS
-        if not self._chan:
-            from Carbon import Snd
-            self._chan = Snd.SndNewChannel(5, 0, self._callback)
-        nframes = len(data) / self._nchannels / self._sampwidth
-        if len(data) != nframes * self._nchannels * self._sampwidth:
-            raise error('data is not a whole number of frames')
-        while self._gc and \
-              self.getfilled() + nframes > \
-                self._qsize / self._nchannels / self._sampwidth:
-            time.sleep(0.1)
-        if self._sampwidth == 1:
-            import audioop
-            data = audioop.add(data, '\x80'*len(data), 1)
-        h1 = struct.pack('llHhllbbl',
-            id(data)+MacOS.string_id_to_buffer,
-            self._nchannels,
-            self._outrate, 0,
-            0,
-            0,
-            extSH,
-            60,
-            nframes)
-        h2 = 22*'\0'
-        h3 = struct.pack('hhlll',
-            self._sampwidth*8,
-            0,
-            0,
-            0,
-            0)
-        header = h1+h2+h3
-        self._gc.append((header, data))
-        self._chan.SndDoCommand((bufferCmd, 0, header), 0)
-        self._chan.SndDoCommand((callBackCmd, 0, 0), 0)
-
-    def _callback(self, *args):
-        del self._gc[0]
-        if self._usercallback:
-            self._usercallback()
-
-    def setcallback(self, callback):
-        self._usercallback = callback
-
-    def getfilled(self):
-        filled = 0
-        for header, data in self._gc:
-            filled = filled + len(data)
-        return filled / self._nchannels / self._sampwidth
-
-    def getfillable(self):
-        return (self._qsize / self._nchannels / self._sampwidth) - self.getfilled()
-
-    def ulaw2lin(self, data):
-        import audioop
-        return audioop.ulaw2lin(data, 2)
-
-def test():
-    import aifc
-    import EasyDialogs
-    fn = EasyDialogs.AskFileForOpen(message="Select an AIFF soundfile", typeList=("AIFF",))
-    if not fn: return
-    af = aifc.open(fn, 'r')
-    print(af.getparams())
-    p = Play_Audio_mac()
-    p.setoutrate(af.getframerate())
-    p.setsampwidth(af.getsampwidth())
-    p.setnchannels(af.getnchannels())
-    BUFSIZ = 10000
-    while 1:
-        data = af.readframes(BUFSIZ)
-        if not data: break
-        p.writeframes(data)
-        print('wrote', len(data), 'space', p.getfillable())
-    p.wait()
-
-if __name__ == '__main__':
-    test()

Deleted: python/branches/py3k/Lib/plat-mac/EasyDialogs.py
==============================================================================
--- python/branches/py3k/Lib/plat-mac/EasyDialogs.py	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,837 +0,0 @@
-"""Easy to use dialogs.
-
-Message(msg) -- display a message and an OK button.
-AskString(prompt, default) -- ask for a string, display OK and Cancel buttons.
-AskPassword(prompt, default) -- like AskString(), but shows text as bullets.
-AskYesNoCancel(question, default) -- display a question and Yes, No and Cancel buttons.
-GetArgv(optionlist, commandlist) -- fill a sys.argv-like list using a dialog
-AskFileForOpen(...) -- Ask the user for an existing file
-AskFileForSave(...) -- Ask the user for an output file
-AskFolder(...) -- Ask the user to select a folder
-bar = Progress(label, maxvalue) -- Display a progress bar
-bar.set(value) -- Set value
-bar.inc( *amount ) -- increment value by amount (default=1)
-bar.label( *newlabel ) -- get or set text label.
-
-More documentation in each function.
-This module uses DLOG resources 260 and on.
-Based upon STDWIN dialogs with the same names and functions.
-"""
-
-from Carbon.Dlg import GetNewDialog, SetDialogItemText, GetDialogItemText, ModalDialog
-from Carbon import Qd
-from Carbon import QuickDraw
-from Carbon import Dialogs
-from Carbon import Windows
-from Carbon import Dlg,Win,Evt,Events # sdm7g
-from Carbon import Ctl
-from Carbon import Controls
-from Carbon import Menu
-from Carbon import AE
-import Nav
-import MacOS
-from Carbon.ControlAccessor import *    # Also import Controls constants
-import Carbon.File
-import macresource
-import os
-import sys
-
-__all__ = ['Message', 'AskString', 'AskPassword', 'AskYesNoCancel',
-    'GetArgv', 'AskFileForOpen', 'AskFileForSave', 'AskFolder',
-    'ProgressBar']
-
-_initialized = 0
-
-def _initialize():
-    global _initialized
-    if _initialized: return
-    macresource.need("DLOG", 260, "dialogs.rsrc", __name__)
-
-def _interact():
-    """Make sure the application is in the foreground"""
-    AE.AEInteractWithUser(50000000)
-
-def cr2lf(text):
-    if '\r' in text:
-        text = '\n'.join(text.split('\r'))
-    return text
-
-def lf2cr(text):
-    if '\n' in text:
-        text = '\r'.join(text.split('\n'))
-    if len(text) > 253:
-        text = text[:253] + '\311'
-    return text
-
-def Message(msg, id=260, ok=None):
-    """Display a MESSAGE string.
-
-    Return when the user clicks the OK button or presses Return.
-
-    The MESSAGE string can be at most 255 characters long.
-    """
-    _initialize()
-    _interact()
-    d = GetNewDialog(id, -1)
-    if not d:
-        print("EasyDialogs: Can't get DLOG resource with id =", id, " (missing resource file?)")
-        return
-    h = d.GetDialogItemAsControl(2)
-    SetDialogItemText(h, lf2cr(msg))
-    if ok is not None:
-        h = d.GetDialogItemAsControl(1)
-        h.SetControlTitle(ok)
-    d.SetDialogDefaultItem(1)
-    d.AutoSizeDialog()
-    d.GetDialogWindow().ShowWindow()
-    while 1:
-        n = ModalDialog(None)
-        if n == 1:
-            return
-
-
-def AskString(prompt, default = "", id=261, ok=None, cancel=None):
-    """Display a PROMPT string and a text entry field with a DEFAULT string.
-
-    Return the contents of the text entry field when the user clicks the
-    OK button or presses Return.
-    Return None when the user clicks the Cancel button.
-
-    If omitted, DEFAULT is empty.
-
-    The PROMPT and DEFAULT strings, as well as the return value,
-    can be at most 255 characters long.
-    """
-
-    _initialize()
-    _interact()
-    d = GetNewDialog(id, -1)
-    if not d:
-        print("EasyDialogs: Can't get DLOG resource with id =", id, " (missing resource file?)")
-        return
-    h = d.GetDialogItemAsControl(3)
-    SetDialogItemText(h, lf2cr(prompt))
-    h = d.GetDialogItemAsControl(4)
-    SetDialogItemText(h, lf2cr(default))
-    d.SelectDialogItemText(4, 0, 999)
-#       d.SetDialogItem(4, 0, 255)
-    if ok is not None:
-        h = d.GetDialogItemAsControl(1)
-        h.SetControlTitle(ok)
-    if cancel is not None:
-        h = d.GetDialogItemAsControl(2)
-        h.SetControlTitle(cancel)
-    d.SetDialogDefaultItem(1)
-    d.SetDialogCancelItem(2)
-    d.AutoSizeDialog()
-    d.GetDialogWindow().ShowWindow()
-    while 1:
-        n = ModalDialog(None)
-        if n == 1:
-            h = d.GetDialogItemAsControl(4)
-            return cr2lf(GetDialogItemText(h))
-        if n == 2: return None
-
-def AskPassword(prompt,  default='', id=264, ok=None, cancel=None):
-    """Display a PROMPT string and a text entry field with a DEFAULT string.
-    The string is displayed as bullets only.
-
-    Return the contents of the text entry field when the user clicks the
-    OK button or presses Return.
-    Return None when the user clicks the Cancel button.
-
-    If omitted, DEFAULT is empty.
-
-    The PROMPT and DEFAULT strings, as well as the return value,
-    can be at most 255 characters long.
-    """
-    _initialize()
-    _interact()
-    d = GetNewDialog(id, -1)
-    if not d:
-        print("EasyDialogs: Can't get DLOG resource with id =", id, " (missing resource file?)")
-        return
-    h = d.GetDialogItemAsControl(3)
-    SetDialogItemText(h, lf2cr(prompt))
-    pwd = d.GetDialogItemAsControl(4)
-    bullets = '\245'*len(default)
-##      SetControlData(pwd, kControlEditTextPart, kControlEditTextTextTag, bullets)
-    SetControlData(pwd, kControlEditTextPart, kControlEditTextPasswordTag, default)
-    d.SelectDialogItemText(4, 0, 999)
-    Ctl.SetKeyboardFocus(d.GetDialogWindow(), pwd, kControlEditTextPart)
-    if ok is not None:
-        h = d.GetDialogItemAsControl(1)
-        h.SetControlTitle(ok)
-    if cancel is not None:
-        h = d.GetDialogItemAsControl(2)
-        h.SetControlTitle(cancel)
-    d.SetDialogDefaultItem(Dialogs.ok)
-    d.SetDialogCancelItem(Dialogs.cancel)
-    d.AutoSizeDialog()
-    d.GetDialogWindow().ShowWindow()
-    while 1:
-        n = ModalDialog(None)
-        if n == 1:
-            h = d.GetDialogItemAsControl(4)
-            return cr2lf(GetControlData(pwd, kControlEditTextPart, kControlEditTextPasswordTag))
-        if n == 2: return None
-
-def AskYesNoCancel(question, default = 0, yes=None, no=None, cancel=None, id=262):
-    """Display a QUESTION string which can be answered with Yes or No.
-
-    Return 1 when the user clicks the Yes button.
-    Return 0 when the user clicks the No button.
-    Return -1 when the user clicks the Cancel button.
-
-    When the user presses Return, the DEFAULT value is returned.
-    If omitted, this is 0 (No).
-
-    The QUESTION string can be at most 255 characters.
-    """
-
-    _initialize()
-    _interact()
-    d = GetNewDialog(id, -1)
-    if not d:
-        print("EasyDialogs: Can't get DLOG resource with id =", id, " (missing resource file?)")
-        return
-    # Button assignments:
-    # 1 = default (invisible)
-    # 2 = Yes
-    # 3 = No
-    # 4 = Cancel
-    # The question string is item 5
-    h = d.GetDialogItemAsControl(5)
-    SetDialogItemText(h, lf2cr(question))
-    if yes is not None:
-        if yes == '':
-            d.HideDialogItem(2)
-        else:
-            h = d.GetDialogItemAsControl(2)
-            h.SetControlTitle(yes)
-    if no is not None:
-        if no == '':
-            d.HideDialogItem(3)
-        else:
-            h = d.GetDialogItemAsControl(3)
-            h.SetControlTitle(no)
-    if cancel is not None:
-        if cancel == '':
-            d.HideDialogItem(4)
-        else:
-            h = d.GetDialogItemAsControl(4)
-            h.SetControlTitle(cancel)
-    d.SetDialogCancelItem(4)
-    if default == 1:
-        d.SetDialogDefaultItem(2)
-    elif default == 0:
-        d.SetDialogDefaultItem(3)
-    elif default == -1:
-        d.SetDialogDefaultItem(4)
-    d.AutoSizeDialog()
-    d.GetDialogWindow().ShowWindow()
-    while 1:
-        n = ModalDialog(None)
-        if n == 1: return default
-        if n == 2: return 1
-        if n == 3: return 0
-        if n == 4: return -1
-
-
-
-
-screenbounds = Qd.GetQDGlobalsScreenBits().bounds
-screenbounds = screenbounds[0]+4, screenbounds[1]+4, \
-    screenbounds[2]-4, screenbounds[3]-4
-
-kControlProgressBarIndeterminateTag = 'inde'    # from Controls.py
-
-
-class ProgressBar:
-    def __init__(self, title="Working...", maxval=0, label="", id=263):
-        self.w = None
-        self.d = None
-        _initialize()
-        self.d = GetNewDialog(id, -1)
-        self.w = self.d.GetDialogWindow()
-        self.label(label)
-        self.title(title)
-        self.set(0, maxval)
-        self.d.AutoSizeDialog()
-        self.w.ShowWindow()
-        self.d.DrawDialog()
-
-    def __del__(self):
-        if self.w:
-            self.w.BringToFront()
-            self.w.HideWindow()
-        del self.w
-        del self.d
-
-    def title(self, newstr=""):
-        """title(text) - Set title of progress window"""
-        self.w.BringToFront()
-        self.w.SetWTitle(newstr)
-
-    def label(self, *newstr):
-        """label(text) - Set text in progress box"""
-        self.w.BringToFront()
-        if newstr:
-            self._label = lf2cr(newstr[0])
-        text_h = self.d.GetDialogItemAsControl(2)
-        SetDialogItemText(text_h, self._label)
-
-    def _update(self, value):
-        maxval = self.maxval
-        if maxval == 0:     # an indeterminate bar
-            Ctl.IdleControls(self.w)    # spin the barber pole
-        else:               # a determinate bar
-            if maxval > 32767:
-                value = int(value/(maxval/32767.0))
-                maxval = 32767
-            maxval = int(maxval)
-            value = int(value)
-            progbar = self.d.GetDialogItemAsControl(3)
-            progbar.SetControlMaximum(maxval)
-            progbar.SetControlValue(value)  # set the bar length
-
-        # Test for cancel button
-        ready, ev = Evt.WaitNextEvent( Events.mDownMask, 1  )
-        if ready :
-            what,msg,when,where,mod = ev
-            part = Win.FindWindow(where)[0]
-            if Dlg.IsDialogEvent(ev):
-                ds = Dlg.DialogSelect(ev)
-                if ds[0] and ds[1] == self.d and ds[-1] == 1:
-                    self.w.HideWindow()
-                    self.w = None
-                    self.d = None
-                    raise KeyboardInterrupt(ev)
-            else:
-                if part == 4:   # inDrag
-                    self.w.DragWindow(where, screenbounds)
-                else:
-                    MacOS.HandleEvent(ev)
-
-
-    def set(self, value, max=None):
-        """set(value) - Set progress bar position"""
-        if max is not None:
-            self.maxval = max
-            bar = self.d.GetDialogItemAsControl(3)
-            if max <= 0:    # indeterminate bar
-                bar.SetControlData(0,kControlProgressBarIndeterminateTag,'\x01')
-            else:           # determinate bar
-                bar.SetControlData(0,kControlProgressBarIndeterminateTag,'\x00')
-        if value < 0:
-            value = 0
-        elif value > self.maxval:
-            value = self.maxval
-        self.curval = value
-        self._update(value)
-
-    def inc(self, n=1):
-        """inc(amt) - Increment progress bar position"""
-        self.set(self.curval + n)
-
-ARGV_ID=265
-ARGV_ITEM_OK=1
-ARGV_ITEM_CANCEL=2
-ARGV_OPTION_GROUP=3
-ARGV_OPTION_EXPLAIN=4
-ARGV_OPTION_VALUE=5
-ARGV_OPTION_ADD=6
-ARGV_COMMAND_GROUP=7
-ARGV_COMMAND_EXPLAIN=8
-ARGV_COMMAND_ADD=9
-ARGV_ADD_OLDFILE=10
-ARGV_ADD_NEWFILE=11
-ARGV_ADD_FOLDER=12
-ARGV_CMDLINE_GROUP=13
-ARGV_CMDLINE_DATA=14
-
-##def _myModalDialog(d):
-##      while 1:
-##          ready, ev = Evt.WaitNextEvent(0xffff, -1)
-##          print 'DBG: WNE', ready, ev
-##          if ready :
-##              what,msg,when,where,mod = ev
-##              part, window = Win.FindWindow(where)
-##              if Dlg.IsDialogEvent(ev):
-##                  didit, dlgdone, itemdone = Dlg.DialogSelect(ev)
-##                  print 'DBG: DialogSelect', didit, dlgdone, itemdone, d
-##                  if didit and dlgdone == d:
-##                      return itemdone
-##              elif window == d.GetDialogWindow():
-##                  d.GetDialogWindow().SelectWindow()
-##                  if part == 4:   # inDrag
-##                          d.DragWindow(where, screenbounds)
-##                  else:
-##                      MacOS.HandleEvent(ev)
-##              else:
-##                  MacOS.HandleEvent(ev)
-##
-def _setmenu(control, items):
-    mhandle = control.GetControlData_Handle(Controls.kControlMenuPart,
-            Controls.kControlPopupButtonMenuHandleTag)
-    menu = Menu.as_Menu(mhandle)
-    for item in items:
-        if type(item) == type(()):
-            label = item[0]
-        else:
-            label = item
-        if label[-1] == '=' or label[-1] == ':':
-            label = label[:-1]
-        menu.AppendMenu(label)
-##          mhandle, mid = menu.getpopupinfo()
-##          control.SetControlData_Handle(Controls.kControlMenuPart,
-##                  Controls.kControlPopupButtonMenuHandleTag, mhandle)
-    control.SetControlMinimum(1)
-    control.SetControlMaximum(len(items)+1)
-
-def _selectoption(d, optionlist, idx):
-    if idx < 0 or idx >= len(optionlist):
-        MacOS.SysBeep()
-        return
-    option = optionlist[idx]
-    if type(option) == type(()):
-        if len(option) == 4:
-            help = option[2]
-        elif len(option) > 1:
-            help = option[-1]
-        else:
-            help = ''
-    else:
-        help = ''
-    h = d.GetDialogItemAsControl(ARGV_OPTION_EXPLAIN)
-    if help and len(help) > 250:
-        help = help[:250] + '...'
-    Dlg.SetDialogItemText(h, help)
-    hasvalue = 0
-    if type(option) == type(()):
-        label = option[0]
-    else:
-        label = option
-    if label[-1] == '=' or label[-1] == ':':
-        hasvalue = 1
-    h = d.GetDialogItemAsControl(ARGV_OPTION_VALUE)
-    Dlg.SetDialogItemText(h, '')
-    if hasvalue:
-        d.ShowDialogItem(ARGV_OPTION_VALUE)
-        d.SelectDialogItemText(ARGV_OPTION_VALUE, 0, 0)
-    else:
-        d.HideDialogItem(ARGV_OPTION_VALUE)
-
-
-def GetArgv(optionlist=None, commandlist=None, addoldfile=1, addnewfile=1, addfolder=1, id=ARGV_ID):
-    _initialize()
-    _interact()
-    d = GetNewDialog(id, -1)
-    if not d:
-        print("EasyDialogs: Can't get DLOG resource with id =", id, " (missing resource file?)")
-        return
-#       h = d.GetDialogItemAsControl(3)
-#       SetDialogItemText(h, lf2cr(prompt))
-#       h = d.GetDialogItemAsControl(4)
-#       SetDialogItemText(h, lf2cr(default))
-#       d.SelectDialogItemText(4, 0, 999)
-#       d.SetDialogItem(4, 0, 255)
-    if optionlist:
-        _setmenu(d.GetDialogItemAsControl(ARGV_OPTION_GROUP), optionlist)
-        _selectoption(d, optionlist, 0)
-    else:
-        d.GetDialogItemAsControl(ARGV_OPTION_GROUP).DeactivateControl()
-    if commandlist:
-        _setmenu(d.GetDialogItemAsControl(ARGV_COMMAND_GROUP), commandlist)
-        if type(commandlist[0]) == type(()) and len(commandlist[0]) > 1:
-            help = commandlist[0][-1]
-            h = d.GetDialogItemAsControl(ARGV_COMMAND_EXPLAIN)
-            Dlg.SetDialogItemText(h, help)
-    else:
-        d.GetDialogItemAsControl(ARGV_COMMAND_GROUP).DeactivateControl()
-    if not addoldfile:
-        d.GetDialogItemAsControl(ARGV_ADD_OLDFILE).DeactivateControl()
-    if not addnewfile:
-        d.GetDialogItemAsControl(ARGV_ADD_NEWFILE).DeactivateControl()
-    if not addfolder:
-        d.GetDialogItemAsControl(ARGV_ADD_FOLDER).DeactivateControl()
-    d.SetDialogDefaultItem(ARGV_ITEM_OK)
-    d.SetDialogCancelItem(ARGV_ITEM_CANCEL)
-    d.GetDialogWindow().ShowWindow()
-    d.DrawDialog()
-    if hasattr(MacOS, 'SchedParams'):
-        appsw = MacOS.SchedParams(1, 0)
-    try:
-        while 1:
-            stringstoadd = []
-            n = ModalDialog(None)
-            if n == ARGV_ITEM_OK:
-                break
-            elif n == ARGV_ITEM_CANCEL:
-                raise SystemExit
-            elif n == ARGV_OPTION_GROUP:
-                idx = d.GetDialogItemAsControl(ARGV_OPTION_GROUP).GetControlValue()-1
-                _selectoption(d, optionlist, idx)
-            elif n == ARGV_OPTION_VALUE:
-                pass
-            elif n == ARGV_OPTION_ADD:
-                idx = d.GetDialogItemAsControl(ARGV_OPTION_GROUP).GetControlValue()-1
-                if 0 <= idx < len(optionlist):
-                    option = optionlist[idx]
-                    if type(option) == type(()):
-                        option = option[0]
-                    if option[-1] == '=' or option[-1] == ':':
-                        option = option[:-1]
-                        h = d.GetDialogItemAsControl(ARGV_OPTION_VALUE)
-                        value = Dlg.GetDialogItemText(h)
-                    else:
-                        value = ''
-                    if len(option) == 1:
-                        stringtoadd = '-' + option
-                    else:
-                        stringtoadd = '--' + option
-                    stringstoadd = [stringtoadd]
-                    if value:
-                        stringstoadd.append(value)
-                else:
-                    MacOS.SysBeep()
-            elif n == ARGV_COMMAND_GROUP:
-                idx = d.GetDialogItemAsControl(ARGV_COMMAND_GROUP).GetControlValue()-1
-                if 0 <= idx < len(commandlist) and type(commandlist[idx]) == type(()) and \
-                        len(commandlist[idx]) > 1:
-                    help = commandlist[idx][-1]
-                    h = d.GetDialogItemAsControl(ARGV_COMMAND_EXPLAIN)
-                    Dlg.SetDialogItemText(h, help)
-            elif n == ARGV_COMMAND_ADD:
-                idx = d.GetDialogItemAsControl(ARGV_COMMAND_GROUP).GetControlValue()-1
-                if 0 <= idx < len(commandlist):
-                    command = commandlist[idx]
-                    if type(command) == type(()):
-                        command = command[0]
-                    stringstoadd = [command]
-                else:
-                    MacOS.SysBeep()
-            elif n == ARGV_ADD_OLDFILE:
-                pathname = AskFileForOpen()
-                if pathname:
-                    stringstoadd = [pathname]
-            elif n == ARGV_ADD_NEWFILE:
-                pathname = AskFileForSave()
-                if pathname:
-                    stringstoadd = [pathname]
-            elif n == ARGV_ADD_FOLDER:
-                pathname = AskFolder()
-                if pathname:
-                    stringstoadd = [pathname]
-            elif n == ARGV_CMDLINE_DATA:
-                pass # Nothing to do
-            else:
-                raise RuntimeError("Unknown dialog item %d"%n)
-
-            for stringtoadd in stringstoadd:
-                if '"' in stringtoadd or "'" in stringtoadd or " " in stringtoadd:
-                    stringtoadd = repr(stringtoadd)
-                h = d.GetDialogItemAsControl(ARGV_CMDLINE_DATA)
-                oldstr = GetDialogItemText(h)
-                if oldstr and oldstr[-1] != ' ':
-                    oldstr = oldstr + ' '
-                oldstr = oldstr + stringtoadd
-                if oldstr[-1] != ' ':
-                    oldstr = oldstr + ' '
-                SetDialogItemText(h, oldstr)
-                d.SelectDialogItemText(ARGV_CMDLINE_DATA, 0x7fff, 0x7fff)
-        h = d.GetDialogItemAsControl(ARGV_CMDLINE_DATA)
-        oldstr = GetDialogItemText(h)
-        tmplist = oldstr.split()
-        newlist = []
-        while tmplist:
-            item = tmplist[0]
-            del tmplist[0]
-            if item[0] == '"':
-                while item[-1] != '"':
-                    if not tmplist:
-                        raise RuntimeError("Unterminated quoted argument")
-                    item = item + ' ' + tmplist[0]
-                    del tmplist[0]
-                item = item[1:-1]
-            if item[0] == "'":
-                while item[-1] != "'":
-                    if not tmplist:
-                        raise RuntimeError("Unterminated quoted argument")
-                    item = item + ' ' + tmplist[0]
-                    del tmplist[0]
-                item = item[1:-1]
-            newlist.append(item)
-        return newlist
-    finally:
-        if hasattr(MacOS, 'SchedParams'):
-            MacOS.SchedParams(*appsw)
-        del d
-
-def _process_Nav_args(dftflags, **args):
-    import aepack
-    import Carbon.AE
-    import Carbon.File
-    for k in args.keys():
-        if args[k] is None:
-            del args[k]
-    # Set some defaults, and modify some arguments
-    if 'dialogOptionFlags' not in args:
-        args['dialogOptionFlags'] = dftflags
-    if 'defaultLocation' in args and \
-            not isinstance(args['defaultLocation'], Carbon.AE.AEDesc):
-        defaultLocation = args['defaultLocation']
-        if isinstance(defaultLocation, (Carbon.File.FSSpec, Carbon.File.FSRef)):
-            args['defaultLocation'] = aepack.pack(defaultLocation)
-        else:
-            defaultLocation = Carbon.File.FSRef(defaultLocation)
-            args['defaultLocation'] = aepack.pack(defaultLocation)
-    if 'typeList' in args and not isinstance(args['typeList'], Carbon.Res.ResourceType):
-        typeList = args['typeList'][:]
-        # Workaround for OSX typeless files:
-        if 'TEXT' in typeList and not '\0\0\0\0' in typeList:
-            typeList = typeList + ('\0\0\0\0',)
-        data = 'Pyth' + struct.pack("hh", 0, len(typeList))
-        for type in typeList:
-            data = data+type
-        args['typeList'] = Carbon.Res.Handle(data)
-    tpwanted = str
-    if 'wanted' in args:
-        tpwanted = args['wanted']
-        del args['wanted']
-    return args, tpwanted
-
-def _dummy_Nav_eventproc(msg, data):
-    pass
-
-_default_Nav_eventproc = _dummy_Nav_eventproc
-
-def SetDefaultEventProc(proc):
-    global _default_Nav_eventproc
-    rv = _default_Nav_eventproc
-    if proc is None:
-        proc = _dummy_Nav_eventproc
-    _default_Nav_eventproc = proc
-    return rv
-
-def AskFileForOpen(
-        message=None,
-        typeList=None,
-        # From here on the order is not documented
-        version=None,
-        defaultLocation=None,
-        dialogOptionFlags=None,
-        location=None,
-        clientName=None,
-        windowTitle=None,
-        actionButtonLabel=None,
-        cancelButtonLabel=None,
-        preferenceKey=None,
-        popupExtension=None,
-        eventProc=_dummy_Nav_eventproc,
-        previewProc=None,
-        filterProc=None,
-        wanted=None,
-        multiple=None):
-    """Display a dialog asking the user for a file to open.
-
-    wanted is the return type wanted: FSSpec, FSRef, unicode or string (default)
-    the other arguments can be looked up in Apple's Navigation Services documentation"""
-
-    default_flags = 0x56 # Or 0xe4?
-    args, tpwanted = _process_Nav_args(default_flags, version=version,
-        defaultLocation=defaultLocation, dialogOptionFlags=dialogOptionFlags,
-        location=location,clientName=clientName,windowTitle=windowTitle,
-        actionButtonLabel=actionButtonLabel,cancelButtonLabel=cancelButtonLabel,
-        message=message,preferenceKey=preferenceKey,
-        popupExtension=popupExtension,eventProc=eventProc,previewProc=previewProc,
-        filterProc=filterProc,typeList=typeList,wanted=wanted,multiple=multiple)
-    _interact()
-    try:
-        rr = Nav.NavChooseFile(args)
-        good = 1
-    except Nav.error as arg:
-        if arg.args[0] != -128: # userCancelledErr
-            raise Nav.error(arg)
-        return None
-    if not rr.validRecord or not rr.selection:
-        return None
-    if issubclass(tpwanted, Carbon.File.FSRef):
-        return tpwanted(rr.selection_fsr[0])
-    if issubclass(tpwanted, Carbon.File.FSSpec):
-        return tpwanted(rr.selection[0])
-    if issubclass(tpwanted, str):
-        return tpwanted(rr.selection_fsr[0].as_pathname())
-    if issubclass(tpwanted, str):
-        return tpwanted(rr.selection_fsr[0].as_pathname(), 'utf8')
-    raise TypeError("Unknown value for argument 'wanted': %s" % repr(tpwanted))
-
-def AskFileForSave(
-        message=None,
-        savedFileName=None,
-        # From here on the order is not documented
-        version=None,
-        defaultLocation=None,
-        dialogOptionFlags=None,
-        location=None,
-        clientName=None,
-        windowTitle=None,
-        actionButtonLabel=None,
-        cancelButtonLabel=None,
-        preferenceKey=None,
-        popupExtension=None,
-        eventProc=_dummy_Nav_eventproc,
-        fileType=None,
-        fileCreator=None,
-        wanted=None,
-        multiple=None):
-    """Display a dialog asking the user for a filename to save to.
-
-    wanted is the return type wanted: FSSpec, FSRef, unicode or string (default)
-    the other arguments can be looked up in Apple's Navigation Services documentation"""
-
-
-    default_flags = 0x07
-    args, tpwanted = _process_Nav_args(default_flags, version=version,
-        defaultLocation=defaultLocation, dialogOptionFlags=dialogOptionFlags,
-        location=location,clientName=clientName,windowTitle=windowTitle,
-        actionButtonLabel=actionButtonLabel,cancelButtonLabel=cancelButtonLabel,
-        savedFileName=savedFileName,message=message,preferenceKey=preferenceKey,
-        popupExtension=popupExtension,eventProc=eventProc,fileType=fileType,
-        fileCreator=fileCreator,wanted=wanted,multiple=multiple)
-    _interact()
-    try:
-        rr = Nav.NavPutFile(args)
-        good = 1
-    except Nav.error as arg:
-        if arg.args[0] != -128: # userCancelledErr
-            raise Nav.error(arg)
-        return None
-    if not rr.validRecord or not rr.selection:
-        return None
-    if issubclass(tpwanted, Carbon.File.FSRef):
-        raise TypeError("Cannot pass wanted=FSRef to AskFileForSave")
-    if issubclass(tpwanted, Carbon.File.FSSpec):
-        return tpwanted(rr.selection[0])
-    if issubclass(tpwanted, str):
-        if sys.platform == 'mac':
-            fullpath = rr.selection[0].as_pathname()
-        else:
-            # This is gross, and probably incorrect too
-            vrefnum, dirid, name = rr.selection[0].as_tuple()
-            pardir_fss = Carbon.File.FSSpec((vrefnum, dirid, ''))
-            pardir_fsr = Carbon.File.FSRef(pardir_fss)
-            pardir_path = pardir_fsr.FSRefMakePath()  # This is utf-8
-            name_utf8 = str(name, 'macroman').encode('utf8')
-            fullpath = os.path.join(pardir_path, name_utf8)
-        if issubclass(tpwanted, str):
-            return str(fullpath, 'utf8')
-        return tpwanted(fullpath)
-    raise TypeError("Unknown value for argument 'wanted': %s" % repr(tpwanted))
-
-def AskFolder(
-        message=None,
-        # From here on the order is not documented
-        version=None,
-        defaultLocation=None,
-        dialogOptionFlags=None,
-        location=None,
-        clientName=None,
-        windowTitle=None,
-        actionButtonLabel=None,
-        cancelButtonLabel=None,
-        preferenceKey=None,
-        popupExtension=None,
-        eventProc=_dummy_Nav_eventproc,
-        filterProc=None,
-        wanted=None,
-        multiple=None):
-    """Display a dialog asking the user for select a folder.
-
-    wanted is the return type wanted: FSSpec, FSRef, unicode or string (default)
-    the other arguments can be looked up in Apple's Navigation Services documentation"""
-
-    default_flags = 0x17
-    args, tpwanted = _process_Nav_args(default_flags, version=version,
-        defaultLocation=defaultLocation, dialogOptionFlags=dialogOptionFlags,
-        location=location,clientName=clientName,windowTitle=windowTitle,
-        actionButtonLabel=actionButtonLabel,cancelButtonLabel=cancelButtonLabel,
-        message=message,preferenceKey=preferenceKey,
-        popupExtension=popupExtension,eventProc=eventProc,filterProc=filterProc,
-        wanted=wanted,multiple=multiple)
-    _interact()
-    try:
-        rr = Nav.NavChooseFolder(args)
-        good = 1
-    except Nav.error as arg:
-        if arg.args[0] != -128: # userCancelledErr
-            raise Nav.error(arg)
-        return None
-    if not rr.validRecord or not rr.selection:
-        return None
-    if issubclass(tpwanted, Carbon.File.FSRef):
-        return tpwanted(rr.selection_fsr[0])
-    if issubclass(tpwanted, Carbon.File.FSSpec):
-        return tpwanted(rr.selection[0])
-    if issubclass(tpwanted, str):
-        return tpwanted(rr.selection_fsr[0].as_pathname())
-    if issubclass(tpwanted, str):
-        return tpwanted(rr.selection_fsr[0].as_pathname(), 'utf8')
-    raise TypeError("Unknown value for argument 'wanted': %s" % repr(tpwanted))
-
-
-def test():
-    import time
-
-    Message("Testing EasyDialogs.")
-    optionlist = (('v', 'Verbose'), ('verbose', 'Verbose as long option'),
-                ('flags=', 'Valued option'), ('f:', 'Short valued option'))
-    commandlist = (('start', 'Start something'), ('stop', 'Stop something'))
-    argv = GetArgv(optionlist=optionlist, commandlist=commandlist, addoldfile=0)
-    Message("Command line: %s"%' '.join(argv))
-    for i in range(len(argv)):
-        print('arg[%d] = %r' % (i, argv[i]))
-    ok = AskYesNoCancel("Do you want to proceed?")
-    ok = AskYesNoCancel("Do you want to identify?", yes="Identify", no="No")
-    if ok > 0:
-        s = AskString("Enter your first name", "Joe")
-        s2 = AskPassword("Okay %s, tell us your nickname"%s, s, cancel="None")
-        if not s2:
-            Message("%s has no secret nickname"%s)
-        else:
-            Message("Hello everybody!!\nThe secret nickname of %s is %s!!!"%(s, s2))
-    else:
-        s = 'Anonymous'
-    rv = AskFileForOpen(message="Gimme a file, %s"%s, wanted=Carbon.File.FSSpec)
-    Message("rv: %s"%rv)
-    rv = AskFileForSave(wanted=Carbon.File.FSRef, savedFileName="%s.txt"%s)
-    Message("rv.as_pathname: %s"%rv.as_pathname())
-    rv = AskFolder()
-    Message("Folder name: %s"%rv)
-    text = ( "Working Hard...", "Hardly Working..." ,
-            "So far, so good!", "Keep on truckin'" )
-    bar = ProgressBar("Progress, progress...", 0, label="Ramping up...")
-    try:
-        if hasattr(MacOS, 'SchedParams'):
-            appsw = MacOS.SchedParams(1, 0)
-        for i in range(20):
-            bar.inc()
-            time.sleep(0.05)
-        bar.set(0,100)
-        for i in range(100):
-            bar.set(i)
-            time.sleep(0.05)
-            if i % 10 == 0:
-                bar.label(text[(i/10) % 4])
-        bar.label("Done.")
-        time.sleep(1.0)     # give'em a chance to see "Done."
-    finally:
-        del bar
-        if hasattr(MacOS, 'SchedParams'):
-            MacOS.SchedParams(*appsw)
-
-if __name__ == '__main__':
-    try:
-        test()
-    except KeyboardInterrupt:
-        Message("Operation Canceled.")

Deleted: python/branches/py3k/Lib/plat-mac/FrameWork.py
==============================================================================
--- python/branches/py3k/Lib/plat-mac/FrameWork.py	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,1123 +0,0 @@
-"A sort of application framework for the Mac"
-
-DEBUG=0
-
-import MacOS
-import traceback
-
-from Carbon.AE import *
-from Carbon.AppleEvents import *
-from Carbon.Ctl import *
-from Carbon.Controls import *
-from Carbon.Dlg import *
-from Carbon.Dialogs import *
-from Carbon.Evt import *
-from Carbon.Events import *
-from Carbon.Help import *
-from Carbon.Menu import *
-from Carbon.Menus import *
-from Carbon.Qd import *
-from Carbon.QuickDraw import *
-#from Carbon.Res import *
-#from Carbon.Resources import *
-#from Carbon.Snd import *
-#from Carbon.Sound import *
-from Carbon.Win import *
-from Carbon.Windows import *
-import types
-
-import EasyDialogs
-
-try:
-    MyFrontWindow = FrontNonFloatingWindow
-except NameError:
-    MyFrontWindow = FrontWindow
-
-kHighLevelEvent = 23    # Don't know what header file this should come from
-SCROLLBARWIDTH = 16         # Again, not a clue...
-
-# Trick to forestall a set of SIOUX menus being added to our menubar
-SIOUX_APPLEMENU_ID=32000
-
-
-# Map event 'what' field to strings
-eventname = {}
-eventname[1] = 'mouseDown'
-eventname[2] = 'mouseUp'
-eventname[3] = 'keyDown'
-eventname[4] = 'keyUp'
-eventname[5] = 'autoKey'
-eventname[6] = 'updateEvt'
-eventname[7] = 'diskEvt'
-eventname[8] = 'activateEvt'
-eventname[15] = 'osEvt'
-eventname[23] = 'kHighLevelEvent'
-
-# Map part codes returned by WhichWindow() to strings
-partname = {}
-partname[0] = 'inDesk'
-partname[1] = 'inMenuBar'
-partname[2] = 'inSysWindow'
-partname[3] = 'inContent'
-partname[4] = 'inDrag'
-partname[5] = 'inGrow'
-partname[6] = 'inGoAway'
-partname[7] = 'inZoomIn'
-partname[8] = 'inZoomOut'
-
-#
-# The useable portion of the screen
-#       ## but what happens with multiple screens? jvr
-screenbounds = GetQDGlobalsScreenBits().bounds
-screenbounds = screenbounds[0]+4, screenbounds[1]+4, \
-    screenbounds[2]-4, screenbounds[3]-4
-
-next_window_x = 16          # jvr
-next_window_y = 44          # jvr
-
-def windowbounds(width, height):
-    "Return sensible window bounds"
-    global next_window_x, next_window_y
-    r, b = next_window_x+width, next_window_y+height
-    if r > screenbounds[2]:
-        next_window_x = 16
-    if b > screenbounds[3]:
-        next_window_y = 44
-    l, t = next_window_x, next_window_y
-    r, b = next_window_x+width, next_window_y+height
-    next_window_x, next_window_y = next_window_x + 8, next_window_y + 20    # jvr
-    return l, t, r, b
-
-_watch = None
-def setwatchcursor():
-    global _watch
-
-    if _watch is None:
-        _watch = GetCursor(4).data
-    SetCursor(_watch)
-
-def setarrowcursor():
-    SetCursor(GetQDGlobalsArrow())
-
-class Application:
-
-    "Application framework -- your application should be a derived class"
-
-    def __init__(self, nomenubar=0):
-        self._doing_asyncevents = 0
-        self.quitting = 0
-        self.needmenubarredraw = 0
-        self._windows = {}
-        self._helpmenu = None
-        if nomenubar:
-            self.menubar = None
-        else:
-            self.makemenubar()
-
-    def __del__(self):
-        if self._doing_asyncevents:
-            self._doing_asyncevents = 0
-            MacOS.SetEventHandler()
-
-    def makemenubar(self):
-        self.menubar = MenuBar(self)
-        AppleMenu(self.menubar, self.getabouttext(), self.do_about)
-        self.makeusermenus()
-
-    def makeusermenus(self):
-        self.filemenu = m = Menu(self.menubar, "File")
-        self._quititem = MenuItem(m, "Quit", "Q", self._quit)
-
-    def gethelpmenu(self):
-        if self._helpmenu is None:
-            self._helpmenu = HelpMenu(self.menubar)
-        return self._helpmenu
-
-    def _quit(self, *args):
-        self.quitting = 1
-
-    def cleanup(self):
-        for w in self._windows.values():
-            w.do_close()
-        return self._windows == {}
-
-    def appendwindow(self, wid, window):
-        self._windows[wid] = window
-
-    def removewindow(self, wid):
-        del self._windows[wid]
-
-    def getabouttext(self):
-        return "About %s..." % self.__class__.__name__
-
-    def do_about(self, id, item, window, event):
-        EasyDialogs.Message("Hello, world!" + "\015(%s)" % self.__class__.__name__)
-
-    # The main event loop is broken up in several simple steps.
-    # This is done so you can override each individual part,
-    # if you have a need to do extra processing independent of the
-    # event type.
-    # Normally, however, you'd just define handlers for individual
-    # events.
-
-    schedparams = (0, 0)    # By default disable Python's event handling
-    default_wait = None         # By default we wait GetCaretTime in WaitNextEvent
-
-    def mainloop(self, mask = everyEvent, wait = None):
-        self.quitting = 0
-        if hasattr(MacOS, 'SchedParams'):
-            saveparams = MacOS.SchedParams(*self.schedparams)
-        try:
-            while not self.quitting:
-                try:
-                    self.do1event(mask, wait)
-                except (Application, SystemExit):
-                    # Note: the raising of "self" is old-fashioned idiom to
-                    # exit the mainloop. Calling _quit() is better for new
-                    # applications.
-                    break
-        finally:
-            if hasattr(MacOS, 'SchedParams'):
-                MacOS.SchedParams(*saveparams)
-
-    def dopendingevents(self, mask = everyEvent):
-        """dopendingevents - Handle all pending events"""
-        while self.do1event(mask, wait=0):
-            pass
-
-    def do1event(self, mask = everyEvent, wait = None):
-        ok, event = self.getevent(mask, wait)
-        if IsDialogEvent(event):
-            if self.do_dialogevent(event):
-                return
-        if ok:
-            self.dispatch(event)
-        else:
-            self.idle(event)
-
-    def idle(self, event):
-        pass
-
-    def getevent(self, mask = everyEvent, wait = None):
-        if self.needmenubarredraw:
-            DrawMenuBar()
-            self.needmenubarredraw = 0
-        if wait is None:
-            wait = self.default_wait
-            if wait is None:
-                wait = GetCaretTime()
-        ok, event = WaitNextEvent(mask, wait)
-        return ok, event
-
-    def dispatch(self, event):
-        # The following appears to be double work (already done in do1event)
-        # but we need it for asynchronous event handling
-        if IsDialogEvent(event):
-            if self.do_dialogevent(event):
-                return
-        (what, message, when, where, modifiers) = event
-        if what in eventname:
-            name = "do_" + eventname[what]
-        else:
-            name = "do_%d" % what
-        try:
-            handler = getattr(self, name)
-        except AttributeError:
-            handler = self.do_unknownevent
-        handler(event)
-
-    def asyncevents(self, onoff):
-        """asyncevents - Set asynchronous event handling on or off"""
-        if MacOS.runtimemodel == 'macho':
-            raise NotImplementedError('Unsupported in MachoPython')
-        old = self._doing_asyncevents
-        if old:
-            MacOS.SetEventHandler()
-            MacOS.SchedParams(*self.schedparams)
-        if onoff:
-            MacOS.SetEventHandler(self.dispatch)
-            doint, dummymask, benice, howoften, bgyield = \
-                   self.schedparams
-            MacOS.SchedParams(doint, everyEvent, benice,
-                      howoften, bgyield)
-        self._doing_asyncevents = onoff
-        return old
-
-    def do_dialogevent(self, event):
-        gotone, dlg, item = DialogSelect(event)
-        if gotone:
-            window = dlg.GetDialogWindow()
-            if window in self._windows:
-                self._windows[window].do_itemhit(item, event)
-            else:
-                print('Dialog event for unknown dialog')
-            return 1
-        return 0
-
-    def do_mouseDown(self, event):
-        (what, message, when, where, modifiers) = event
-        partcode, wid = FindWindow(where)
-
-        #
-        # Find the correct name.
-        #
-        if partcode in partname:
-            name = "do_" + partname[partcode]
-        else:
-            name = "do_%d" % partcode
-
-        if wid is None:
-            # No window, or a non-python window
-            try:
-                handler = getattr(self, name)
-            except AttributeError:
-                # Not menubar or something, so assume someone
-                # else's window
-                if hasattr(MacOS, 'HandleEvent'):
-                    MacOS.HandleEvent(event)
-                return
-        elif wid in self._windows:
-            # It is a window. Hand off to correct window.
-            window = self._windows[wid]
-            try:
-                handler = getattr(window, name)
-            except AttributeError:
-                handler = self.do_unknownpartcode
-        else:
-            # It is a python-toolbox window, but not ours.
-            handler = self.do_unknownwindow
-        handler(partcode, wid, event)
-
-    def do_inSysWindow(self, partcode, window, event):
-        if hasattr(MacOS, 'HandleEvent'):
-            MacOS.HandleEvent(event)
-
-    def do_inDesk(self, partcode, window, event):
-        if hasattr(MacOS, 'HandleEvent'):
-            MacOS.HandleEvent(event)
-
-    def do_inMenuBar(self, partcode, window, event):
-        if not self.menubar:
-            if hasattr(MacOS, 'HandleEvent'):
-                MacOS.HandleEvent(event)
-            return
-        (what, message, when, where, modifiers) = event
-        result = MenuSelect(where)
-        id = (result>>16) & 0xffff      # Hi word
-        if id >= 0x8000:
-            id = -65536 + id
-        item = result & 0xffff      # Lo word
-        self.do_rawmenu(id, item, window, event)
-
-    def do_rawmenu(self, id, item, window, event):
-        try:
-            self.do_menu(id, item, window, event)
-        finally:
-            HiliteMenu(0)
-
-    def do_menu(self, id, item, window, event):
-        if hasattr(MacOS, 'OutputSeen'):
-            MacOS.OutputSeen()
-        self.menubar.dispatch(id, item, window, event)
-
-
-    def do_unknownpartcode(self, partcode, window, event):
-        (what, message, when, where, modifiers) = event
-        if DEBUG: print("Mouse down at global:", where)
-        if DEBUG: print("\tUnknown part code:", partcode)
-        if DEBUG: print("\tEvent:", self.printevent(event))
-        if hasattr(MacOS, 'HandleEvent'):
-            MacOS.HandleEvent(event)
-
-    def do_unknownwindow(self, partcode, window, event):
-        if DEBUG: print('Unknown window:', window)
-        if hasattr(MacOS, 'HandleEvent'):
-            MacOS.HandleEvent(event)
-
-    def do_keyDown(self, event):
-        self.do_key(event)
-
-    def do_autoKey(self, event):
-        if not event[-1] & cmdKey:
-            self.do_key(event)
-
-    def do_key(self, event):
-        (what, message, when, where, modifiers) = event
-        c = chr(message & charCodeMask)
-        if self.menubar:
-            result = MenuEvent(event)
-            id = (result>>16) & 0xffff      # Hi word
-            item = result & 0xffff      # Lo word
-            if id:
-                self.do_rawmenu(id, item, None, event)
-                return
-            # Otherwise we fall-through
-        if modifiers & cmdKey:
-            if c == '.':
-                raise self
-            else:
-                if not self.menubar:
-                    if hasattr(MacOS, 'HandleEvent'):
-                        MacOS.HandleEvent(event)
-                return
-        else:
-            # See whether the front window wants it
-            w = MyFrontWindow()
-            if w and w in self._windows:
-                window = self._windows[w]
-                try:
-                    do_char = window.do_char
-                except AttributeError:
-                    do_char = self.do_char
-                do_char(c, event)
-            # else it wasn't for us, sigh...
-
-    def do_char(self, c, event):
-        if DEBUG: print("Character", repr(c))
-
-    def do_updateEvt(self, event):
-        (what, message, when, where, modifiers) = event
-        wid = WhichWindow(message)
-        if wid and wid in self._windows:
-            window = self._windows[wid]
-            window.do_rawupdate(wid, event)
-        else:
-            if hasattr(MacOS, 'HandleEvent'):
-                MacOS.HandleEvent(event)
-
-    def do_activateEvt(self, event):
-        (what, message, when, where, modifiers) = event
-        wid = WhichWindow(message)
-        if wid and wid in self._windows:
-            window = self._windows[wid]
-            window.do_activate(modifiers & 1, event)
-        else:
-            if hasattr(MacOS, 'HandleEvent'):
-                MacOS.HandleEvent(event)
-
-    def do_osEvt(self, event):
-        (what, message, when, where, modifiers) = event
-        which = (message >> 24) & 0xff
-        if which == 1:  # suspend/resume
-            self.do_suspendresume(event)
-        else:
-            if DEBUG:
-                print('unknown osEvt:', end=' ')
-                self.printevent(event)
-
-    def do_suspendresume(self, event):
-        (what, message, when, where, modifiers) = event
-        wid = MyFrontWindow()
-        if wid and wid in self._windows:
-            window = self._windows[wid]
-            window.do_activate(message & 1, event)
-
-    def do_kHighLevelEvent(self, event):
-        (what, message, when, where, modifiers) = event
-        if DEBUG:
-            print("High Level Event:", end=' ')
-            self.printevent(event)
-        try:
-            AEProcessAppleEvent(event)
-        except:
-            pass
-            #print "AEProcessAppleEvent error:"
-            #traceback.print_exc()
-
-    def do_unknownevent(self, event):
-        if DEBUG:
-            print("Unhandled event:", end=' ')
-            self.printevent(event)
-
-    def printevent(self, event):
-        (what, message, when, where, modifiers) = event
-        nicewhat = repr(what)
-        if what in eventname:
-            nicewhat = eventname[what]
-        print(nicewhat, end=' ')
-        if what == kHighLevelEvent:
-            h, v = where
-            print(repr(ostypecode(message)), hex(when), repr(ostypecode(h | (v<<16))), end=' ')
-        else:
-            print(hex(message), hex(when), where, end=' ')
-        print(hex(modifiers))
-
-
-class MenuBar:
-    """Represent a set of menus in a menu bar.
-
-    Interface:
-
-    - (constructor)
-    - (destructor)
-    - addmenu
-    - addpopup (normally used internally)
-    - dispatch (called from Application)
-    """
-
-    nextid = 1      # Necessarily a class variable
-
-    def getnextid(self):
-        id = MenuBar.nextid
-        MenuBar.nextid = id+1
-        return id
-
-    def __init__(self, parent=None):
-        self.parent = parent
-        ClearMenuBar()
-        self.bar = GetMenuBar()
-        self.menus = {}
-
-    # XXX necessary?
-    def close(self):
-        self.parent = None
-        self.bar = None
-        self.menus = None
-
-    def addmenu(self, title, after = 0, id=None):
-        if id is None:
-            id = self.getnextid()
-        if DEBUG: print('Newmenu', title, id) # XXXX
-        m = NewMenu(id, title)
-        m.InsertMenu(after)
-        if after >= 0:
-            if self.parent:
-                self.parent.needmenubarredraw = 1
-            else:
-                DrawMenuBar()
-        return id, m
-
-    def delmenu(self, id):
-        if DEBUG: print('Delmenu', id) # XXXX
-        DeleteMenu(id)
-
-    def addpopup(self, title = ''):
-        return self.addmenu(title, -1)
-
-# Useless:
-#       def install(self):
-#           if not self.bar: return
-#           SetMenuBar(self.bar)
-#           if self.parent:
-#               self.parent.needmenubarredraw = 1
-#           else:
-#               DrawMenuBar()
-
-    def fixmenudimstate(self):
-        for m in self.menus.keys():
-            menu = self.menus[m]
-            if menu.__class__ == FrameWork.AppleMenu:
-                continue
-            for i in range(len(menu.items)):
-                label, shortcut, callback, kind = menu.items[i]
-                if type(callback) == types.StringType:
-                    wid = MyFrontWindow()
-                    if wid and wid in self.parent._windows:
-                        window = self.parent._windows[wid]
-                        if hasattr(window, "domenu_" + callback):
-                            menu.menu.EnableMenuItem(i + 1)
-                        elif hasattr(self.parent, "domenu_" + callback):
-                            menu.menu.EnableMenuItem(i + 1)
-                        else:
-                            menu.menu.DisableMenuItem(i + 1)
-                    elif hasattr(self.parent, "domenu_" + callback):
-                        menu.menu.EnableMenuItem(i + 1)
-                    else:
-                        menu.menu.DisableMenuItem(i + 1)
-                elif callback:
-                    pass
-
-    def dispatch(self, id, item, window, event):
-        if id in self.menus:
-            self.menus[id].dispatch(id, item, window, event)
-        else:
-            if DEBUG: print("MenuBar.dispatch(%d, %d, %s, %s)" % \
-                (id, item, window, event))
-
-
-# XXX Need a way to get menus as resources and bind them to callbacks
-
-class Menu:
-    "One menu."
-
-    def __init__(self, bar, title, after=0, id=None):
-        self.bar = bar
-        self.id, self.menu = self.bar.addmenu(title, after, id)
-        bar.menus[self.id] = self
-        self.items = []
-        self._parent = None
-
-    def delete(self):
-        self.bar.delmenu(self.id)
-        del self.bar.menus[self.id]
-        self.menu.DisposeMenu()
-        del self.bar
-        del self.items
-        del self.menu
-        del self.id
-        del self._parent
-
-    def additem(self, label, shortcut=None, callback=None, kind=None):
-        self.menu.AppendMenu('x')           # add a dummy string
-        self.items.append((label, shortcut, callback, kind))
-        item = len(self.items)
-        if isinstance(label, str):
-            self.menu.SetMenuItemTextWithCFString(item, label)
-        else:
-            self.menu.SetMenuItemText(item, label)
-        if shortcut and type(shortcut) == type(()):
-            modifiers, char = shortcut[:2]
-            self.menu.SetItemCmd(item, ord(char))
-            self.menu.SetMenuItemModifiers(item, modifiers)
-            if len(shortcut) > 2:
-                self.menu.SetMenuItemKeyGlyph(item, shortcut[2])
-        elif shortcut:
-            self.menu.SetItemCmd(item, ord(shortcut))
-        return item
-
-    def delitem(self, item):
-        if item != len(self.items):
-            raise ValueError('Can only delete last item of a menu')
-        self.menu.DeleteMenuItem(item)
-        del self.items[item-1]
-
-    def addcheck(self, label, shortcut=None, callback=None):
-        return self.additem(label, shortcut, callback, 'check')
-
-    def addradio(self, label, shortcut=None, callback=None):
-        return self.additem(label, shortcut, callback, 'radio')
-
-    def addseparator(self):
-        self.menu.AppendMenu('(-')
-        self.items.append(('', None, None, 'separator'))
-
-    def addsubmenu(self, label, title=''):
-        sub = Menu(self.bar, title, -1)
-        item = self.additem(label, '\x1B', None, 'submenu')
-        self.menu.SetItemMark(item, sub.id)
-        sub._parent = self
-        sub._parent_item = item
-        return sub
-
-    def dispatch(self, id, item, window, event):
-        title, shortcut, callback, mtype = self.items[item-1]
-        if callback:
-            if not self.bar.parent or not isinstance(callback, str):
-                menuhandler = callback
-            else:
-                # callback is string
-                wid = MyFrontWindow()
-                if wid and wid in self.bar.parent._windows:
-                    window = self.bar.parent._windows[wid]
-                    if hasattr(window, "domenu_" + callback):
-                        menuhandler = getattr(window, "domenu_" + callback)
-                    elif hasattr(self.bar.parent, "domenu_" + callback):
-                        menuhandler = getattr(self.bar.parent, "domenu_" + callback)
-                    else:
-                        # nothing we can do. we shouldn't have come this far
-                        # since the menu item should have been disabled...
-                        return
-                elif hasattr(self.bar.parent, "domenu_" + callback):
-                    menuhandler = getattr(self.bar.parent, "domenu_" + callback)
-                else:
-                    # nothing we can do. we shouldn't have come this far
-                    # since the menu item should have been disabled...
-                    return
-            menuhandler(id, item, window, event)
-
-    def enable(self, onoff):
-        if onoff:
-            self.menu.EnableMenuItem(0)
-            if self._parent:
-                self._parent.menu.EnableMenuItem(self._parent_item)
-        else:
-            self.menu.DisableMenuItem(0)
-            if self._parent:
-                self._parent.menu.DisableMenuItem(self._parent_item)
-        if self.bar and self.bar.parent:
-            self.bar.parent.needmenubarredraw = 1
-
-class PopupMenu(Menu):
-    def __init__(self, bar):
-        Menu.__init__(self, bar, '(popup)', -1)
-
-    def popup(self, x, y, event, default=1, window=None):
-        # NOTE that x and y are global coordinates, and they should probably
-        # be topleft of the button the user clicked (not mouse-coordinates),
-        # so the popup nicely overlaps.
-        reply = self.menu.PopUpMenuSelect(x, y, default)
-        if not reply:
-            return
-        id = (reply >> 16) & 0xffff
-        item = reply & 0xffff
-        if not window:
-            wid = MyFrontWindow()
-            try:
-                window = self.bar.parent._windows[wid]
-            except:
-                pass # If we can't find the window we pass None
-        self.dispatch(id, item, window, event)
-
-class MenuItem:
-    def __init__(self, menu, title, shortcut=None, callback=None, kind=None):
-        self.item = menu.additem(title, shortcut, callback)
-        self.menu = menu
-
-    def delete(self):
-        self.menu.delitem(self.item)
-        del self.menu
-        del self.item
-
-    def check(self, onoff):
-        self.menu.menu.CheckMenuItem(self.item, onoff)
-
-    def enable(self, onoff):
-        if onoff:
-            self.menu.menu.EnableMenuItem(self.item)
-        else:
-            self.menu.menu.DisableMenuItem(self.item)
-
-    def settext(self, text):
-        self.menu.menu.SetMenuItemText(self.item, text)
-
-    def setstyle(self, style):
-        self.menu.menu.SetItemStyle(self.item, style)
-
-    def seticon(self, icon):
-        self.menu.menu.SetItemIcon(self.item, icon)
-
-    def setcmd(self, cmd):
-        self.menu.menu.SetItemCmd(self.item, cmd)
-
-    def setmark(self, cmd):
-        self.menu.menu.SetItemMark(self.item, cmd)
-
-
-class RadioItem(MenuItem):
-    def __init__(self, menu, title, shortcut=None, callback=None):
-        MenuItem.__init__(self, menu, title, shortcut, callback, 'radio')
-
-class CheckItem(MenuItem):
-    def __init__(self, menu, title, shortcut=None, callback=None):
-        MenuItem.__init__(self, menu, title, shortcut, callback, 'check')
-
-def Separator(menu):
-    menu.addseparator()
-
-def SubMenu(menu, label, title=''):
-    return menu.addsubmenu(label, title)
-
-
-class AppleMenu(Menu):
-
-    def __init__(self, bar, abouttext="About me...", aboutcallback=None):
-        Menu.__init__(self, bar, "\024", id=SIOUX_APPLEMENU_ID)
-        if MacOS.runtimemodel == 'ppc':
-            self.additem(abouttext, None, aboutcallback)
-            self.addseparator()
-            self.menu.AppendResMenu('DRVR')
-        else:
-            # Additem()'s tricks do not work for "apple" menu under Carbon
-            self.menu.InsertMenuItem(abouttext, 0)
-            self.items.append((abouttext, None, aboutcallback, None))
-
-    def dispatch(self, id, item, window, event):
-        if item == 1:
-            Menu.dispatch(self, id, item, window, event)
-        elif MacOS.runtimemodel == 'ppc':
-            name = self.menu.GetMenuItemText(item)
-            OpenDeskAcc(name)
-
-class HelpMenu(Menu):
-    def __init__(self, bar):
-        # Note we don't call Menu.__init__, we do the necessary things by hand
-        self.bar = bar
-        self.menu, index = HMGetHelpMenu()
-        self.id = self.menu.GetMenuID()
-        bar.menus[self.id] = self
-        # The next line caters for the entries the system already handles for us
-        self.items = [None]*(index-1)
-        self._parent = None
-
-
-class Window:
-    """A single window belonging to an application"""
-
-    def __init__(self, parent):
-        self.wid = None
-        self.parent = parent
-
-    def open(self, bounds=(40, 40, 400, 400), resid=None):
-        if resid is not None:
-            self.wid = GetNewWindow(resid, -1)
-        else:
-            self.wid = NewWindow(bounds, self.__class__.__name__, 1,
-                8, -1, 1, 0)    # changed to proc id 8 to include zoom box. jvr
-        self.do_postopen()
-
-    def do_postopen(self):
-        """Tell our parent we exist"""
-        self.parent.appendwindow(self.wid, self)
-
-    def close(self):
-        self.do_postclose()
-
-    def do_postclose(self):
-        self.parent.removewindow(self.wid)
-        self.parent = None
-        self.wid = None
-
-    def SetPort(self):
-        # Convinience method
-        SetPort(self.wid)
-
-    def GetWindow(self):
-        return self.wid
-
-    def do_inDrag(self, partcode, window, event):
-        where = event[3]
-        window.DragWindow(where, self.draglimit)
-
-    draglimit = screenbounds
-
-    def do_inGoAway(self, partcode, window, event):
-        where = event[3]
-        if window.TrackGoAway(where):
-            self.close()
-
-    def do_inZoom(self, partcode, window, event):
-        (what, message, when, where, modifiers) = event
-        if window.TrackBox(where, partcode):
-            window.ZoomWindow(partcode, 1)
-            rect = window.GetWindowUserState()                  # so that zoom really works... jvr
-            self.do_postresize(rect[2] - rect[0], rect[3] - rect[1], window)    # jvr
-
-    def do_inZoomIn(self, partcode, window, event):
-        SetPort(window) # !!!
-        self.do_inZoom(partcode, window, event)
-
-    def do_inZoomOut(self, partcode, window, event):
-        SetPort(window) # !!!
-        self.do_inZoom(partcode, window, event)
-
-    def do_inGrow(self, partcode, window, event):
-        (what, message, when, where, modifiers) = event
-        result = window.GrowWindow(where, self.growlimit)
-        if result:
-            height = (result>>16) & 0xffff  # Hi word
-            width = result & 0xffff     # Lo word
-            self.do_resize(width, height, window)
-
-    growlimit = (50, 50, screenbounds[2] - screenbounds[0], screenbounds[3] - screenbounds[1])      # jvr
-
-    def do_resize(self, width, height, window):
-        l, t, r, b = self.wid.GetWindowPort().GetPortBounds()           # jvr, forGrowIcon
-        self.SetPort()                          # jvr
-        self.wid.InvalWindowRect((r - SCROLLBARWIDTH + 1, b - SCROLLBARWIDTH + 1, r, b))    # jvr
-        window.SizeWindow(width, height, 1)         # changed updateFlag to true jvr
-        self.do_postresize(width, height, window)
-
-    def do_postresize(self, width, height, window):
-        SetPort(window)
-        self.wid.InvalWindowRect(window.GetWindowPort().GetPortBounds())
-
-    def do_inContent(self, partcode, window, event):
-        #
-        # If we're not frontmost, select ourselves and wait for
-        # the activate event.
-        #
-        if MyFrontWindow() != window:
-            window.SelectWindow()
-            return
-        # We are. Handle the event.
-        (what, message, when, where, modifiers) = event
-        SetPort(window)
-        local = GlobalToLocal(where)
-        self.do_contentclick(local, modifiers, event)
-
-    def do_contentclick(self, local, modifiers, event):
-        if DEBUG:
-            print('Click in contents at %s, modifiers %s'%(local, modifiers))
-
-    def do_rawupdate(self, window, event):
-        if DEBUG: print("raw update for", window)
-        SetPort(window)
-        window.BeginUpdate()
-        self.do_update(window, event)
-        window.EndUpdate()
-
-    def do_update(self, window, event):
-        if DEBUG:
-            import time
-            for i in range(8):
-                time.sleep(0.1)
-                InvertRgn(window.GetWindowPort().visRgn)
-            FillRgn(window.GetWindowPort().visRgn, GetQDGlobalsGray())
-        else:
-            EraseRgn(window.GetWindowPort().visRgn)
-
-    def do_activate(self, activate, event):
-        if DEBUG: print('Activate %d for %s'%(activate, self.wid))
-
-class ControlsWindow(Window):
-
-    def do_rawupdate(self, window, event):
-        if DEBUG: print("raw update for", window)
-        SetPort(window)
-        window.BeginUpdate()
-        self.do_update(window, event)
-        #DrawControls(window)                   # jvr
-        UpdateControls(window, window.GetWindowPort().visRgn)   # jvr
-        window.DrawGrowIcon()
-        window.EndUpdate()
-
-    def do_controlhit(self, window, control, pcode, event):
-        if DEBUG: print("control hit in", window, "on", control, "; pcode =", pcode)
-
-    def do_inContent(self, partcode, window, event):
-        if MyFrontWindow() != window:
-            window.SelectWindow()
-            return
-        (what, message, when, where, modifiers) = event
-        SetPort(window)  # XXXX Needed?
-        local = GlobalToLocal(where)
-        pcode, control = FindControl(local, window)
-        if pcode and control:
-            self.do_rawcontrolhit(window, control, pcode, local, event)
-        else:
-            if DEBUG: print("FindControl(%s, %s) -> (%s, %s)" % \
-                (local, window, pcode, control))
-            self.do_contentclick(local, modifiers, event)
-
-    def do_rawcontrolhit(self, window, control, pcode, local, event):
-        pcode = control.TrackControl(local)
-        if pcode:
-            self.do_controlhit(window, control, pcode, event)
-
-class ScrolledWindow(ControlsWindow):
-    def __init__(self, parent):
-        self.barx = self.bary = None
-        self.barx_enabled = self.bary_enabled = 1
-        self.activated = 1
-        ControlsWindow.__init__(self, parent)
-
-    def scrollbars(self, wantx=1, wanty=1):
-        SetPort(self.wid)
-        self.barx = self.bary = None
-        self.barx_enabled = self.bary_enabled = 1
-        x0, y0, x1, y1 = self.wid.GetWindowPort().GetPortBounds()
-        vx, vy = self.getscrollbarvalues()
-        if vx is None: self.barx_enabled, vx = 0, 0
-        if vy is None: self.bary_enabled, vy = 0, 0
-        if wantx:
-            rect = x0-1, y1-(SCROLLBARWIDTH-1), x1-(SCROLLBARWIDTH-2), y1+1
-            self.barx = NewControl(self.wid, rect, "", 1, vx, 0, 32767, 16, 0)
-            if not self.barx_enabled: self.barx.HiliteControl(255)
-##              self.wid.InvalWindowRect(rect)
-        if wanty:
-            rect = x1-(SCROLLBARWIDTH-1), y0-1, x1+1, y1-(SCROLLBARWIDTH-2)
-            self.bary = NewControl(self.wid, rect, "", 1, vy, 0, 32767, 16, 0)
-            if not self.bary_enabled: self.bary.HiliteControl(255)
-##              self.wid.InvalWindowRect(rect)
-
-    def do_postclose(self):
-        self.barx = self.bary = None
-        ControlsWindow.do_postclose(self)
-
-    def do_activate(self, onoff, event):
-        self.activated = onoff
-        if onoff:
-            if self.barx and self.barx_enabled:
-                self.barx.ShowControl() # jvr
-            if self.bary and self.bary_enabled:
-                self.bary.ShowControl() # jvr
-        else:
-            if self.barx:
-                self.barx.HideControl() # jvr; An inactive window should have *hidden*
-                            # scrollbars, not just dimmed (no matter what
-                            # BBEdit does... look at the Finder)
-            if self.bary:
-                self.bary.HideControl() # jvr
-        self.wid.DrawGrowIcon()         # jvr
-
-    def do_postresize(self, width, height, window):
-        l, t, r, b = self.wid.GetWindowPort().GetPortBounds()
-        self.SetPort()
-        if self.barx:
-            self.barx.HideControl()     # jvr
-            self.barx.MoveControl(l-1, b-(SCROLLBARWIDTH-1))
-            self.barx.SizeControl((r-l)-(SCROLLBARWIDTH-3), SCROLLBARWIDTH) # jvr
-        if self.bary:
-            self.bary.HideControl()     # jvr
-            self.bary.MoveControl(r-(SCROLLBARWIDTH-1), t-1)
-            self.bary.SizeControl(SCROLLBARWIDTH, (b-t)-(SCROLLBARWIDTH-3)) # jvr
-        if self.barx:
-            self.barx.ShowControl()     # jvr
-            self.wid.ValidWindowRect((l, b - SCROLLBARWIDTH + 1, r - SCROLLBARWIDTH + 2, b))    # jvr
-        if self.bary:
-            self.bary.ShowControl()     # jvr
-            self.wid.ValidWindowRect((r - SCROLLBARWIDTH + 1, t, r, b - SCROLLBARWIDTH + 2))    # jvr
-        self.wid.InvalWindowRect((r - SCROLLBARWIDTH + 1, b - SCROLLBARWIDTH + 1, r, b))    # jvr, growicon
-
-
-    def do_rawcontrolhit(self, window, control, pcode, local, event):
-        if control == self.barx:
-            which = 'x'
-        elif control == self.bary:
-            which = 'y'
-        else:
-            return 0
-        if pcode in (inUpButton, inDownButton, inPageUp, inPageDown):
-            # We do the work for the buttons and grey area in the tracker
-            dummy = control.TrackControl(local, self.do_controltrack)
-        else:
-            # but the thumb is handled here
-            pcode = control.TrackControl(local)
-            if pcode == inThumb:
-                value = control.GetControlValue()
-                print('setbars', which, value) #DBG
-                self.scrollbar_callback(which, 'set', value)
-                self.updatescrollbars()
-            else:
-                print('funny part', pcode) #DBG
-        return 1
-
-    def do_controltrack(self, control, pcode):
-        if control == self.barx:
-            which = 'x'
-        elif control == self.bary:
-            which = 'y'
-        else:
-            return
-
-        if pcode == inUpButton:
-            what = '-'
-        elif pcode == inDownButton:
-            what = '+'
-        elif pcode == inPageUp:
-            what = '--'
-        elif pcode == inPageDown:
-            what = '++'
-        else:
-            return
-        self.scrollbar_callback(which, what, None)
-        self.updatescrollbars()
-
-    def updatescrollbars(self):
-        SetPort(self.wid)
-        vx, vy = self.getscrollbarvalues()
-        if self.barx:
-            if vx is None:
-                self.barx.HiliteControl(255)
-                self.barx_enabled = 0
-            else:
-                if not self.barx_enabled:
-                    self.barx_enabled = 1
-                    if self.activated:
-                        self.barx.HiliteControl(0)
-                self.barx.SetControlValue(vx)
-        if self.bary:
-            if vy is None:
-                self.bary.HiliteControl(255)
-                self.bary_enabled = 0
-            else:
-                if not self.bary_enabled:
-                    self.bary_enabled = 1
-                    if self.activated:
-                        self.bary.HiliteControl(0)
-                self.bary.SetControlValue(vy)
-
-    # Auxiliary function: convert standard text/image/etc coordinate
-    # to something palatable as getscrollbarvalues() return
-    def scalebarvalue(self, absmin, absmax, curmin, curmax):
-        if curmin <= absmin and curmax >= absmax:
-            return None
-        if curmin <= absmin:
-            return 0
-        if curmax >= absmax:
-            return 32767
-        perc = float(curmin-absmin)/float(absmax-absmin)
-        return int(perc*32767)
-
-    # To be overridden:
-
-    def getscrollbarvalues(self):
-        return 0, 0
-
-    def scrollbar_callback(self, which, what, value):
-        print('scroll', which, what, value)
-
-class DialogWindow(Window):
-    """A modeless dialog window"""
-
-    def open(self, resid):
-        self.dlg = GetNewDialog(resid, -1)
-        self.wid = self.dlg.GetDialogWindow()
-        self.do_postopen()
-
-    def close(self):
-        self.do_postclose()
-
-    def do_postclose(self):
-        self.dlg = None
-        Window.do_postclose(self)
-
-    def do_itemhit(self, item, event):
-        print('Dialog %s, item %d hit'%(self.dlg, item))
-
-    def do_rawupdate(self, window, event):
-        pass
-
-def ostypecode(x):
-    "Convert a long int to the 4-character code it really is"
-    s = ''
-    for i in range(4):
-        x, c = divmod(x, 256)
-        s = chr(c) + s
-    return s
-
-
-class TestApp(Application):
-
-    "This class is used by the test() function"
-
-    def makeusermenus(self):
-        self.filemenu = m = Menu(self.menubar, "File")
-        self.saveitem = MenuItem(m, "Save", "S", self.save)
-        Separator(m)
-        self.optionsmenu = mm = SubMenu(m, "Options")
-        self.opt1 = CheckItem(mm, "Arguments", "A")
-        self.opt2 = CheckItem(mm, "Being hit on the head lessons", (kMenuOptionModifier, "A"))
-        self.opt3 = CheckItem(mm, "Complaints", (kMenuOptionModifier|kMenuNoCommandModifier, "A"))
-        Separator(m)
-        self.itemeh = MenuItem(m, "Enable Help", None, self.enablehelp)
-        self.itemdbg = MenuItem(m, "Debug", None, self.debug)
-        Separator(m)
-        self.quititem = MenuItem(m, "Quit", "Q", self.quit)
-
-    def save(self, *args):
-        print("Save")
-
-    def quit(self, *args):
-        raise self
-
-    def enablehelp(self, *args):
-        hm = self.gethelpmenu()
-        self.nohelpitem = MenuItem(hm, "There isn't any", None, self.nohelp)
-
-    def nohelp(self, *args):
-        print("I told you there isn't any!")
-
-    def debug(self, *args):
-        import pdb
-        pdb.set_trace()
-
-
-def test():
-    "Test program"
-    app = TestApp()
-    app.mainloop()
-
-
-if __name__ == '__main__':
-    test()

Deleted: python/branches/py3k/Lib/plat-mac/MiniAEFrame.py
==============================================================================
--- python/branches/py3k/Lib/plat-mac/MiniAEFrame.py	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,198 +0,0 @@
-"""MiniAEFrame - A minimal AppleEvent Application framework.
-
-There are two classes:
-    AEServer -- a mixin class offering nice AE handling.
-    MiniApplication -- a very minimal alternative to FrameWork.py,
-        only suitable for the simplest of AppleEvent servers.
-"""
-
-import traceback
-import MacOS
-from Carbon import AE
-from Carbon.AppleEvents import *
-from Carbon import Evt
-from Carbon.Events import *
-from Carbon import Menu
-from Carbon import Win
-from Carbon.Windows import *
-from Carbon import Qd
-
-import aetools
-import EasyDialogs
-
-kHighLevelEvent = 23                # Not defined anywhere for Python yet?
-
-
-class MiniApplication:
-
-    """A minimal FrameWork.Application-like class"""
-
-    def __init__(self):
-        self.quitting = 0
-        # Initialize menu
-        self.appleid = 1
-        self.quitid = 2
-        Menu.ClearMenuBar()
-        self.applemenu = applemenu = Menu.NewMenu(self.appleid, "\024")
-        applemenu.AppendMenu("%s;(-" % self.getaboutmenutext())
-        if MacOS.runtimemodel == 'ppc':
-            applemenu.AppendResMenu('DRVR')
-        applemenu.InsertMenu(0)
-        self.quitmenu = Menu.NewMenu(self.quitid, "File")
-        self.quitmenu.AppendMenu("Quit")
-        self.quitmenu.SetItemCmd(1, ord("Q"))
-        self.quitmenu.InsertMenu(0)
-        Menu.DrawMenuBar()
-
-    def __del__(self):
-        self.close()
-
-    def close(self):
-        pass
-
-    def mainloop(self, mask = everyEvent, timeout = 60*60):
-        while not self.quitting:
-            self.dooneevent(mask, timeout)
-
-    def _quit(self):
-        self.quitting = 1
-
-    def dooneevent(self, mask = everyEvent, timeout = 60*60):
-        got, event = Evt.WaitNextEvent(mask, timeout)
-        if got:
-            self.lowlevelhandler(event)
-
-    def lowlevelhandler(self, event):
-        what, message, when, where, modifiers = event
-        h, v = where
-        if what == kHighLevelEvent:
-            msg = "High Level Event: %r %r" % (code(message), code(h | (v<<16)))
-            try:
-                AE.AEProcessAppleEvent(event)
-            except AE.Error as err:
-                print('AE error: ', err)
-                print('in', msg)
-                traceback.print_exc()
-            return
-        elif what == keyDown:
-            c = chr(message & charCodeMask)
-            if modifiers & cmdKey:
-                if c == '.':
-                    raise KeyboardInterrupt("Command-period")
-                if c == 'q':
-                    if hasattr(MacOS, 'OutputSeen'):
-                        MacOS.OutputSeen()
-                    self.quitting = 1
-                    return
-        elif what == mouseDown:
-            partcode, window = Win.FindWindow(where)
-            if partcode == inMenuBar:
-                result = Menu.MenuSelect(where)
-                id = (result>>16) & 0xffff      # Hi word
-                item = result & 0xffff      # Lo word
-                if id == self.appleid:
-                    if item == 1:
-                        EasyDialogs.Message(self.getabouttext())
-                    elif item > 1 and hasattr(Menu, 'OpenDeskAcc'):
-                        name = self.applemenu.GetMenuItemText(item)
-                        Menu.OpenDeskAcc(name)
-                elif id == self.quitid and item == 1:
-                    if hasattr(MacOS, 'OutputSeen'):
-                        MacOS.OutputSeen()
-                    self.quitting = 1
-                Menu.HiliteMenu(0)
-                return
-        # Anything not handled is passed to Python/SIOUX
-        if hasattr(MacOS, 'HandleEvent'):
-            MacOS.HandleEvent(event)
-        else:
-            print("Unhandled event:", event)
-
-    def getabouttext(self):
-        return self.__class__.__name__
-
-    def getaboutmenutext(self):
-        return "About %s\311" % self.__class__.__name__
-
-
-class AEServer:
-
-    def __init__(self):
-        self.ae_handlers = {}
-
-    def installaehandler(self, classe, type, callback):
-        AE.AEInstallEventHandler(classe, type, self.callback_wrapper)
-        self.ae_handlers[(classe, type)] = callback
-
-    def close(self):
-        for classe, type in self.ae_handlers.keys():
-            AE.AERemoveEventHandler(classe, type)
-
-    def callback_wrapper(self, _request, _reply):
-        _parameters, _attributes = aetools.unpackevent(_request)
-        _class = _attributes['evcl'].type
-        _type = _attributes['evid'].type
-
-        if (_class, _type) in self.ae_handlers:
-            _function = self.ae_handlers[(_class, _type)]
-        elif (_class, '****') in self.ae_handlers:
-            _function = self.ae_handlers[(_class, '****')]
-        elif ('****', '****') in self.ae_handlers:
-            _function = self.ae_handlers[('****', '****')]
-        else:
-            raise RuntimeError('AE callback without handler: '
-                               + str((_class, _type)))
-
-        # XXXX Do key-to-name mapping here
-
-        _parameters['_attributes'] = _attributes
-        _parameters['_class'] = _class
-        _parameters['_type'] = _type
-        if '----' in _parameters:
-            _object = _parameters['----']
-            del _parameters['----']
-            # The try/except that used to be here can mask programmer errors.
-            # Let the program crash, the programmer can always add a **args
-            # to the formal parameter list.
-            rv = _function(_object, **_parameters)
-        else:
-            #Same try/except comment as above
-            rv = _function(**_parameters)
-
-        if rv is None:
-            aetools.packevent(_reply, {})
-        else:
-            aetools.packevent(_reply, {'----':rv})
-
-
-def code(x):
-    "Convert a long int to the 4-character code it really is"
-    s = ''
-    for i in range(4):
-        x, c = divmod(x, 256)
-        s = chr(c) + s
-    return s
-
-class _Test(AEServer, MiniApplication):
-    """Mini test application, handles required events"""
-
-    def __init__(self):
-        MiniApplication.__init__(self)
-        AEServer.__init__(self)
-        self.installaehandler('aevt', 'oapp', self.open_app)
-        self.installaehandler('aevt', 'quit', self.quit)
-        self.installaehandler('****', '****', self.other)
-        self.mainloop()
-
-    def quit(self, **args):
-        self._quit()
-
-    def open_app(self, **args):
-        pass
-
-    def other(self, _object=None, _class=None, _type=None, **args):
-        print('AppleEvent', (_class, _type), 'for', _object, 'Other args:', args)
-
-
-if __name__ == '__main__':
-    _Test()

Deleted: python/branches/py3k/Lib/plat-mac/PixMapWrapper.py
==============================================================================
--- python/branches/py3k/Lib/plat-mac/PixMapWrapper.py	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,215 +0,0 @@
-"""PixMapWrapper - defines the PixMapWrapper class, which wraps an opaque
-QuickDraw PixMap data structure in a handy Python class.  Also provides
-methods to convert to/from pixel data (from, e.g., the img module) or a
-Python Imaging Library Image object.
-
-J. Strout <joe at strout.net>  February 1999"""
-
-from Carbon import Qd
-from Carbon import QuickDraw
-import struct
-import MacOS
-import img
-import imgformat
-
-# PixMap data structure element format (as used with struct)
-_pmElemFormat = {
-    'baseAddr':'l',     # address of pixel data
-    'rowBytes':'H',     # bytes per row, plus 0x8000
-    'bounds':'hhhh',    # coordinates imposed over pixel data
-        'top':'h',
-        'left':'h',
-        'bottom':'h',
-        'right':'h',
-    'pmVersion':'h',    # flags for Color QuickDraw
-    'packType':'h',     # format of compression algorithm
-    'packSize':'l',     # size after compression
-    'hRes':'l',         # horizontal pixels per inch
-    'vRes':'l',         # vertical pixels per inch
-    'pixelType':'h',    # pixel format
-    'pixelSize':'h',    # bits per pixel
-    'cmpCount':'h',     # color components per pixel
-    'cmpSize':'h',      # bits per component
-    'planeBytes':'l',   # offset in bytes to next plane
-    'pmTable':'l',      # handle to color table
-    'pmReserved':'l'    # reserved for future use
-}
-
-# PixMap data structure element offset
-_pmElemOffset = {
-    'baseAddr':0,
-    'rowBytes':4,
-    'bounds':6,
-        'top':6,
-        'left':8,
-        'bottom':10,
-        'right':12,
-    'pmVersion':14,
-    'packType':16,
-    'packSize':18,
-    'hRes':22,
-    'vRes':26,
-    'pixelType':30,
-    'pixelSize':32,
-    'cmpCount':34,
-    'cmpSize':36,
-    'planeBytes':38,
-    'pmTable':42,
-    'pmReserved':46
-}
-
-class PixMapWrapper:
-    """PixMapWrapper -- wraps the QD PixMap object in a Python class,
-    with methods to easily get/set various pixmap fields.  Note: Use the
-    PixMap() method when passing to QD calls."""
-
-    def __init__(self):
-        self.__dict__['data'] = ''
-        self._header = struct.pack("lhhhhhhhlllhhhhlll",
-            id(self.data)+MacOS.string_id_to_buffer,
-            0,                      # rowBytes
-            0, 0, 0, 0,             # bounds
-            0,                      # pmVersion
-            0, 0,                   # packType, packSize
-            72<<16, 72<<16,         # hRes, vRes
-            QuickDraw.RGBDirect,    # pixelType
-            16,                     # pixelSize
-            2, 5,                   # cmpCount, cmpSize,
-            0, 0, 0)                # planeBytes, pmTable, pmReserved
-        self.__dict__['_pm'] = Qd.RawBitMap(self._header)
-
-    def _stuff(self, element, bytes):
-        offset = _pmElemOffset[element]
-        fmt = _pmElemFormat[element]
-        self._header = self._header[:offset] \
-            + struct.pack(fmt, bytes) \
-            + self._header[offset + struct.calcsize(fmt):]
-        self.__dict__['_pm'] = None
-
-    def _unstuff(self, element):
-        offset = _pmElemOffset[element]
-        fmt = _pmElemFormat[element]
-        return struct.unpack(fmt, self._header[offset:offset+struct.calcsize(fmt)])[0]
-
-    def __setattr__(self, attr, val):
-        if attr == 'baseAddr':
-            raise RuntimeError("don't assign to .baseAddr "
-                               "-- assign to .data instead")
-        elif attr == 'data':
-            self.__dict__['data'] = val
-            self._stuff('baseAddr', id(self.data) + MacOS.string_id_to_buffer)
-        elif attr == 'rowBytes':
-            # high bit is always set for some odd reason
-            self._stuff('rowBytes', val | 0x8000)
-        elif attr == 'bounds':
-            # assume val is in official Left, Top, Right, Bottom order!
-            self._stuff('left',val[0])
-            self._stuff('top',val[1])
-            self._stuff('right',val[2])
-            self._stuff('bottom',val[3])
-        elif attr == 'hRes' or attr == 'vRes':
-            # 16.16 fixed format, so just shift 16 bits
-            self._stuff(attr, int(val) << 16)
-        elif attr in _pmElemFormat.keys():
-            # any other pm attribute -- just stuff
-            self._stuff(attr, val)
-        else:
-            self.__dict__[attr] = val
-
-    def __getattr__(self, attr):
-        if attr == 'rowBytes':
-            # high bit is always set for some odd reason
-            return self._unstuff('rowBytes') & 0x7FFF
-        elif attr == 'bounds':
-            # return bounds in official Left, Top, Right, Bottom order!
-            return (
-                self._unstuff('left'),
-                self._unstuff('top'),
-                self._unstuff('right'),
-                self._unstuff('bottom') )
-        elif attr == 'hRes' or attr == 'vRes':
-            # 16.16 fixed format, so just shift 16 bits
-            return self._unstuff(attr) >> 16
-        elif attr in _pmElemFormat.keys():
-            # any other pm attribute -- just unstuff
-            return self._unstuff(attr)
-        else:
-            return self.__dict__[attr]
-
-
-    def PixMap(self):
-        "Return a QuickDraw PixMap corresponding to this data."
-        if not self.__dict__['_pm']:
-            self.__dict__['_pm'] = Qd.RawBitMap(self._header)
-        return self.__dict__['_pm']
-
-    def blit(self, x1=0,y1=0,x2=None,y2=None, port=None):
-        """Draw this pixmap into the given (default current) grafport."""
-        src = self.bounds
-        dest = [x1,y1,x2,y2]
-        if x2 is None:
-            dest[2] = x1 + src[2]-src[0]
-        if y2 is None:
-            dest[3] = y1 + src[3]-src[1]
-        if not port: port = Qd.GetPort()
-        Qd.CopyBits(self.PixMap(), port.GetPortBitMapForCopyBits(), src, tuple(dest),
-                QuickDraw.srcCopy, None)
-
-    def fromstring(self,s,width,height,format=imgformat.macrgb):
-        """Stuff this pixmap with raw pixel data from a string.
-        Supply width, height, and one of the imgformat specifiers."""
-        # we only support 16- and 32-bit mac rgb...
-        # so convert if necessary
-        if format != imgformat.macrgb and format != imgformat.macrgb16:
-            # (LATER!)
-            raise NotImplementedError("conversion to macrgb or macrgb16")
-        self.data = s
-        self.bounds = (0,0,width,height)
-        self.cmpCount = 3
-        self.pixelType = QuickDraw.RGBDirect
-        if format == imgformat.macrgb:
-            self.pixelSize = 32
-            self.cmpSize = 8
-        else:
-            self.pixelSize = 16
-            self.cmpSize = 5
-        self.rowBytes = width*self.pixelSize/8
-
-    def tostring(self, format=imgformat.macrgb):
-        """Return raw data as a string in the specified format."""
-        # is the native format requested?  if so, just return data
-        if (format == imgformat.macrgb and self.pixelSize == 32) or \
-           (format == imgformat.macrgb16 and self.pixelsize == 16):
-            return self.data
-        # otherwise, convert to the requested format
-        # (LATER!)
-            raise NotImplementedError("data format conversion")
-
-    def fromImage(self,im):
-        """Initialize this PixMap from a PIL Image object."""
-        # We need data in ARGB format; PIL can't currently do that,
-        # but it can do RGBA, which we can use by inserting one null
-        # up frontpm =
-        if im.mode != 'RGBA': im = im.convert('RGBA')
-        data = chr(0) + im.tostring()
-        self.fromstring(data, im.size[0], im.size[1])
-
-    def toImage(self):
-        """Return the contents of this PixMap as a PIL Image object."""
-        import Image
-        # our tostring() method returns data in ARGB format,
-        # whereas Image uses RGBA; a bit of slicing fixes this...
-        data = self.tostring()[1:] + chr(0)
-        bounds = self.bounds
-        return Image.fromstring('RGBA',(bounds[2]-bounds[0],bounds[3]-bounds[1]),data)
-
-def test():
-    import MacOS
-    import EasyDialogs
-    import Image
-    path = EasyDialogs.AskFileForOpen("Image File:")
-    if not path: return
-    pm = PixMapWrapper()
-    pm.fromImage( Image.open(path) )
-    pm.blit(20,20)
-    return pm

Deleted: python/branches/py3k/Lib/plat-mac/aepack.py
==============================================================================
--- python/branches/py3k/Lib/plat-mac/aepack.py	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,375 +0,0 @@
-"""Tools for use in AppleEvent clients and servers:
-conversion between AE types and python types
-
-pack(x) converts a Python object to an AEDesc object
-unpack(desc) does the reverse
-coerce(x, wanted_sample) coerces a python object to another python object
-"""
-
-#
-# This code was originally written by Guido, and modified/extended by Jack
-# to include the various types that were missing. The reference used is
-# Apple Event Registry, chapter 9.
-#
-
-import struct
-from Carbon import AE
-from Carbon.AppleEvents import *
-import MacOS
-import Carbon.File
-import io
-import aetypes
-from aetypes import mkenum, ObjectSpecifier
-
-# These ones seem to be missing from AppleEvents
-# (they're in AERegistry.h)
-
-#typeColorTable = b'clrt'
-#typeDrawingArea = b'cdrw'
-#typePixelMap = b'cpix'
-#typePixelMapMinus = b'tpmm'
-#typeRotation = b'trot'
-#typeTextStyles = b'tsty'
-#typeStyledText = b'STXT'
-#typeAEText = b'tTXT'
-#typeEnumeration = b'enum'
-
-def b2i(byte_string):
-    result = 0
-    for byte in byte_string:
-        result <<= 8
-        result += byte
-    return result
-#
-# Some AE types are immedeately coerced into something
-# we like better (and which is equivalent)
-#
-unpacker_coercions = {
-    b2i(typeComp) : typeFloat,
-    b2i(typeColorTable) : typeAEList,
-    b2i(typeDrawingArea) : typeAERecord,
-    b2i(typeFixed) : typeFloat,
-    b2i(typeExtended) : typeFloat,
-    b2i(typePixelMap) : typeAERecord,
-    b2i(typeRotation) : typeAERecord,
-    b2i(typeStyledText) : typeAERecord,
-    b2i(typeTextStyles) : typeAERecord,
-};
-
-#
-# Some python types we need in the packer:
-#
-AEDescType = AE.AEDescType
-FSSType = Carbon.File.FSSpecType
-FSRefType = Carbon.File.FSRefType
-AliasType = Carbon.File.AliasType
-
-def packkey(ae, key, value):
-    if hasattr(key, 'which'):
-        keystr = key.which
-    elif hasattr(key, 'want'):
-        keystr = key.want
-    else:
-        keystr = key
-    ae.AEPutParamDesc(keystr, pack(value))
-
-def pack(x, forcetype = None):
-    """Pack a python object into an AE descriptor"""
-
-    if forcetype:
-        if isinstance(x, bytes):
-            return AE.AECreateDesc(forcetype, x)
-        else:
-            return pack(x).AECoerceDesc(forcetype)
-
-    if x is None:
-        return AE.AECreateDesc(b'null', '')
-
-    if isinstance(x, AEDescType):
-        return x
-    if isinstance(x, FSSType):
-        return AE.AECreateDesc(b'fss ', x.data)
-    if isinstance(x, FSRefType):
-        return AE.AECreateDesc(b'fsrf', x.data)
-    if isinstance(x, AliasType):
-        return AE.AECreateDesc(b'alis', x.data)
-    if isinstance(x, int):
-        return AE.AECreateDesc(b'long', struct.pack('l', x))
-    if isinstance(x, float):
-        return AE.AECreateDesc(b'doub', struct.pack('d', x))
-    if isinstance(x, (bytes, bytearray)):
-        return AE.AECreateDesc(b'TEXT', x)
-    if isinstance(x, str):
-        # See http://developer.apple.com/documentation/Carbon/Reference/Apple_Event_Manager/Reference/reference.html#//apple_ref/doc/constant_group/typeUnicodeText
-        # for the possible encodings.
-        data = x.encode('utf16')
-        if data[:2] == b'\xfe\xff':
-            data = data[2:]
-        return AE.AECreateDesc(b'utxt', data)
-    if isinstance(x, list):
-        lst = AE.AECreateList('', 0)
-        for item in x:
-            lst.AEPutDesc(0, pack(item))
-        return lst
-    if isinstance(x, dict):
-        record = AE.AECreateList('', 1)
-        for key, value in x.items():
-            packkey(record, key, value)
-            #record.AEPutParamDesc(key, pack(value))
-        return record
-    if isinstance(x, type) and issubclass(x, ObjectSpecifier):
-        # Note: we are getting a class object here, not an instance
-        return AE.AECreateDesc(b'type', x.want)
-    if hasattr(x, '__aepack__'):
-        return x.__aepack__()
-    if hasattr(x, 'which'):
-        return AE.AECreateDesc(b'TEXT', x.which)
-    if hasattr(x, 'want'):
-        return AE.AECreateDesc(b'TEXT', x.want)
-    return AE.AECreateDesc(b'TEXT', repr(x)) # Copout
-
-def unpack(desc, formodulename=""):
-    """Unpack an AE descriptor to a python object"""
-    t = desc.type
-
-    if b2i(t) in unpacker_coercions:
-        desc = desc.AECoerceDesc(unpacker_coercions[b2i(t)])
-        t = desc.type # This is a guess by Jack....
-
-    if t == typeAEList:
-        l = []
-        for i in range(desc.AECountItems()):
-            keyword, item = desc.AEGetNthDesc(i+1, b'****')
-            l.append(unpack(item, formodulename))
-        return l
-    if t == typeAERecord:
-        d = {}
-        for i in range(desc.AECountItems()):
-            keyword, item = desc.AEGetNthDesc(i+1, b'****')
-            d[b2i(keyword)] = unpack(item, formodulename)
-        return d
-    if t == typeAEText:
-        record = desc.AECoerceDesc(b'reco')
-        return mkaetext(unpack(record, formodulename))
-    if t == typeAlias:
-        return Carbon.File.Alias(rawdata=desc.data)
-    # typeAppleEvent returned as unknown
-    if t == typeBoolean:
-        return struct.unpack('b', desc.data)[0]
-    if t == typeChar:
-        return desc.data
-    if t == typeUnicodeText:
-        return str(desc.data, 'utf16')
-    # typeColorTable coerced to typeAEList
-    # typeComp coerced to extended
-    # typeData returned as unknown
-    # typeDrawingArea coerced to typeAERecord
-    if t == typeEnumeration:
-        return mkenum(desc.data)
-    # typeEPS returned as unknown
-    if t == typeFalse:
-        return 0
-    if t == typeFloat:
-        data = desc.data
-        return struct.unpack('d', data)[0]
-    if t == typeFSS:
-        return Carbon.File.FSSpec(rawdata=desc.data)
-    if t == typeFSRef:
-        return Carbon.File.FSRef(rawdata=desc.data)
-    if t == typeInsertionLoc:
-        record = desc.AECoerceDesc(b'reco')
-        return mkinsertionloc(unpack(record, formodulename))
-    # typeInteger equal to typeLongInteger
-    if t == typeIntlText:
-        script, language = struct.unpack('hh', desc.data[:4])
-        return aetypes.IntlText(script, language, desc.data[4:])
-    if t == typeIntlWritingCode:
-        script, language = struct.unpack('hh', desc.data)
-        return aetypes.IntlWritingCode(script, language)
-    if t == typeKeyword:
-        return mkkeyword(desc.data)
-    if t == typeLongInteger:
-        return struct.unpack('l', desc.data)[0]
-    if t == typeLongDateTime:
-        a, b = struct.unpack('lL', desc.data)
-        return (int(a) << 32) + b
-    if t == typeNull:
-        return None
-    if t == typeMagnitude:
-        v = struct.unpack('l', desc.data)
-        if v < 0:
-            v = 0x100000000 + v
-        return v
-    if t == typeObjectSpecifier:
-        record = desc.AECoerceDesc(b'reco')
-        # If we have been told the name of the module we are unpacking aedescs for,
-        # we can attempt to create the right type of python object from that module.
-        if formodulename:
-            return mkobjectfrommodule(unpack(record, formodulename), formodulename)
-        return mkobject(unpack(record, formodulename))
-    # typePict returned as unknown
-    # typePixelMap coerced to typeAERecord
-    # typePixelMapMinus returned as unknown
-    # typeProcessSerialNumber returned as unknown
-    if t == typeQDPoint:
-        v, h = struct.unpack('hh', desc.data)
-        return aetypes.QDPoint(v, h)
-    if t == typeQDRectangle:
-        v0, h0, v1, h1 = struct.unpack('hhhh', desc.data)
-        return aetypes.QDRectangle(v0, h0, v1, h1)
-    if t == typeRGBColor:
-        r, g, b = struct.unpack('hhh', desc.data)
-        return aetypes.RGBColor(r, g, b)
-    # typeRotation coerced to typeAERecord
-    # typeScrapStyles returned as unknown
-    # typeSessionID returned as unknown
-    if t == typeShortFloat:
-        return struct.unpack('f', desc.data)[0]
-    if t == typeShortInteger:
-        return struct.unpack('h', desc.data)[0]
-    # typeSMFloat identical to typeShortFloat
-    # typeSMInt indetical to typeShortInt
-    # typeStyledText coerced to typeAERecord
-    if t == typeTargetID:
-        return mktargetid(desc.data)
-    # typeTextStyles coerced to typeAERecord
-    # typeTIFF returned as unknown
-    if t == typeTrue:
-        return 1
-    if t == typeType:
-        return mktype(desc.data, formodulename)
-    #
-    # The following are special
-    #
-    if t == b'rang':
-        record = desc.AECoerceDesc(b'reco')
-        return mkrange(unpack(record, formodulename))
-    if t == b'cmpd':
-        record = desc.AECoerceDesc(b'reco')
-        return mkcomparison(unpack(record, formodulename))
-    if t == b'logi':
-        record = desc.AECoerceDesc(b'reco')
-        return mklogical(unpack(record, formodulename))
-    return mkunknown(desc.type, desc.data)
-
-def coerce(data, egdata):
-    """Coerce a python object to another type using the AE coercers"""
-    pdata = pack(data)
-    pegdata = pack(egdata)
-    pdata = pdata.AECoerceDesc(pegdata.type)
-    return unpack(pdata)
-
-#
-# Helper routines for unpack
-#
-def mktargetid(data):
-    sessionID = getlong(data[:4])
-    name = mkppcportrec(data[4:4+72])
-    location = mklocationnamerec(data[76:76+36])
-    rcvrName = mkppcportrec(data[112:112+72])
-    return sessionID, name, location, rcvrName
-
-def mkppcportrec(rec):
-    namescript = getword(rec[:2])
-    name = getpstr(rec[2:2+33])
-    portkind = getword(rec[36:38])
-    if portkind == 1:
-        ctor = rec[38:42]
-        type = rec[42:46]
-        identity = (ctor, type)
-    else:
-        identity = getpstr(rec[38:38+33])
-    return namescript, name, portkind, identity
-
-def mklocationnamerec(rec):
-    kind = getword(rec[:2])
-    stuff = rec[2:]
-    if kind == 0: stuff = None
-    if kind == 2: stuff = getpstr(stuff)
-    return kind, stuff
-
-def mkunknown(type, data):
-    return aetypes.Unknown(type, data)
-
-def getpstr(s):
-    return s[1:1+ord(s[0])]
-
-def getlong(s):
-    return (ord(s[0])<<24) | (ord(s[1])<<16) | (ord(s[2])<<8) | ord(s[3])
-
-def getword(s):
-    return (ord(s[0])<<8) | (ord(s[1])<<0)
-
-def mkkeyword(keyword):
-    return aetypes.Keyword(keyword)
-
-def mkrange(dict):
-    return aetypes.Range(dict[b2i(b'star')], dict[b2i(b'stop')])
-
-def mkcomparison(dict):
-    return aetypes.Comparison(dict[b2i(b'obj1')],
-                              dict[b2i(b'relo')].enum,
-                              dict[b2i(b'obj2')])
-
-def mklogical(dict):
-    return aetypes.Logical(dict[b2i(b'logc')], dict[b2i(b'term')])
-
-def mkstyledtext(dict):
-    return aetypes.StyledText(dict[b2i(b'ksty')], dict[b2i(b'ktxt')])
-
-def mkaetext(dict):
-    return aetypes.AEText(dict[b2i(keyAEScriptTag)],
-                          dict[b2i(keyAEStyles)],
-                          dict[b2i(keyAEText)])
-
-def mkinsertionloc(dict):
-    return aetypes.InsertionLoc(dict[b2i(keyAEObject)],
-                                dict[b2i(keyAEPosition)])
-
-def mkobject(dict):
-    want = dict[b2i(b'want')].type
-    form = dict[b2i(b'form')].enum
-    seld = dict[b2i(b'seld')]
-    fr   = dict[b2i(b'from')]
-    if form in (b'name', b'indx', b'rang', b'test'):
-        if want == b'text': return aetypes.Text(seld, fr)
-        if want == b'cha ': return aetypes.Character(seld, fr)
-        if want == b'cwor': return aetypes.Word(seld, fr)
-        if want == b'clin': return aetypes.Line(seld, fr)
-        if want == b'cpar': return aetypes.Paragraph(seld, fr)
-        if want == b'cwin': return aetypes.Window(seld, fr)
-        if want == b'docu': return aetypes.Document(seld, fr)
-        if want == b'file': return aetypes.File(seld, fr)
-        if want == b'cins': return aetypes.InsertionPoint(seld, fr)
-    if want == b'prop' and form == b'prop' and aetypes.IsType(seld):
-        return aetypes.Property(seld.type, fr)
-    return aetypes.ObjectSpecifier(want, form, seld, fr)
-
-# Note by Jack: I'm not 100% sure of the following code. This was
-# provided by Donovan Preston, but I wonder whether the assignment
-# to __class__ is safe. Moreover, shouldn't there be a better
-# initializer for the classes in the suites?
-def mkobjectfrommodule(dict, modulename):
-    if (isinstance(dict[b2i(b'want')], type) and
-        issubclass(dict[b2i(b'want')], ObjectSpecifier)):
-        # The type has already been converted to Python. Convert back:-(
-        classtype = dict[b2i(b'want')]
-        dict[b2i(b'want')] = aetypes.mktype(classtype.want)
-    want = dict[b2i(b'want')].type
-    module = __import__(modulename)
-    codenamemapper = module._classdeclarations
-    classtype = codenamemapper.get(b2i(want), None)
-    newobj = mkobject(dict)
-    if classtype:
-        assert issubclass(classtype, ObjectSpecifier)
-        newobj.__class__ = classtype
-    return newobj
-
-def mktype(typecode, modulename=None):
-    if modulename:
-        module = __import__(modulename)
-        codenamemapper = module._classdeclarations
-        classtype = codenamemapper.get(b2i(typecode), None)
-        if classtype:
-            return classtype
-    return aetypes.mktype(typecode)

Deleted: python/branches/py3k/Lib/plat-mac/aetools.py
==============================================================================
--- python/branches/py3k/Lib/plat-mac/aetools.py	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,364 +0,0 @@
-"""Tools for use in AppleEvent clients and servers.
-
-pack(x) converts a Python object to an AEDesc object
-unpack(desc) does the reverse
-
-packevent(event, parameters, attributes) sets params and attrs in an AEAppleEvent record
-unpackevent(event) returns the parameters and attributes from an AEAppleEvent record
-
-Plus...  Lots of classes and routines that help representing AE objects,
-ranges, conditionals, logicals, etc., so you can write, e.g.:
-
-    x = Character(1, Document("foobar"))
-
-and pack(x) will create an AE object reference equivalent to AppleScript's
-
-    character 1 of document "foobar"
-
-Some of the stuff that appears to be exported from this module comes from other
-files: the pack stuff from aepack, the objects from aetypes.
-
-"""
-
-
-from Carbon import AE
-from Carbon import Evt
-from Carbon import AppleEvents
-import MacOS
-import sys
-import time
-
-from aetypes import *
-from aepack import packkey, pack, unpack, coerce, AEDescType
-
-Error = 'aetools.Error'
-
-# Amount of time to wait for program to be launched
-LAUNCH_MAX_WAIT_TIME=10
-
-# Special code to unpack an AppleEvent (which is *not* a disguised record!)
-# Note by Jack: No??!? If I read the docs correctly it *is*....
-
-aekeywords = [
-    'tran',
-    'rtid',
-    'evcl',
-    'evid',
-    'addr',
-    'optk',
-    'timo',
-    'inte', # this attribute is read only - will be set in AESend
-    'esrc', # this attribute is read only
-    'miss', # this attribute is read only
-    'from'  # new in 1.0.1
-]
-
-def missed(ae):
-    try:
-        desc = ae.AEGetAttributeDesc('miss', 'keyw')
-    except AE.Error as msg:
-        return None
-    return desc.data
-
-def unpackevent(ae, formodulename=""):
-    parameters = {}
-    try:
-        dirobj = ae.AEGetParamDesc('----', '****')
-    except AE.Error:
-        pass
-    else:
-        parameters['----'] = unpack(dirobj, formodulename)
-        del dirobj
-    # Workaround for what I feel is a bug in OSX 10.2: 'errn' won't show up in missed...
-    try:
-        dirobj = ae.AEGetParamDesc('errn', '****')
-    except AE.Error:
-        pass
-    else:
-        parameters['errn'] = unpack(dirobj, formodulename)
-        del dirobj
-    while 1:
-        key = missed(ae)
-        if not key: break
-        parameters[key] = unpack(ae.AEGetParamDesc(key, '****'), formodulename)
-    attributes = {}
-    for key in aekeywords:
-        try:
-            desc = ae.AEGetAttributeDesc(key, '****')
-        except (AE.Error, MacOS.Error) as msg:
-            if msg.args[0] not in (-1701, -1704):
-                raise
-            continue
-        attributes[key] = unpack(desc, formodulename)
-    return parameters, attributes
-
-def packevent(ae, parameters = {}, attributes = {}):
-    for key, value in parameters.items():
-        packkey(ae, key, value)
-    for key, value in attributes.items():
-        ae.AEPutAttributeDesc(key, pack(value))
-
-#
-# Support routine for automatically generated Suite interfaces
-# These routines are also useable for the reverse function.
-#
-def keysubst(arguments, keydict):
-    """Replace long name keys by their 4-char counterparts, and check"""
-    ok = keydict.values()
-    for k in arguments.keys():
-        if k in keydict:
-            v = arguments[k]
-            del arguments[k]
-            arguments[keydict[k]] = v
-        elif k != '----' and k not in ok:
-            raise TypeError('Unknown keyword argument: %s'%k)
-
-def enumsubst(arguments, key, edict):
-    """Substitute a single enum keyword argument, if it occurs"""
-    if key not in arguments or edict is None:
-        return
-    v = arguments[key]
-    ok = edict.values()
-    if v in edict:
-        arguments[key] = Enum(edict[v])
-    elif not v in ok:
-        raise TypeError('Unknown enumerator: %s'%v)
-
-def decodeerror(arguments):
-    """Create the 'best' argument for a raise MacOS.Error"""
-    errn = arguments['errn']
-    err_a1 = errn
-    if 'errs' in arguments:
-        err_a2 = arguments['errs']
-    else:
-        err_a2 = MacOS.GetErrorString(errn)
-    if 'erob' in arguments:
-        err_a3 = arguments['erob']
-    else:
-        err_a3 = None
-
-    return (err_a1, err_a2, err_a3)
-
-class TalkTo:
-    """An AE connection to an application"""
-    _signature = None   # Can be overridden by subclasses
-    _moduleName = None  # Can be overridden by subclasses
-    _elemdict = {}      # Can be overridden by subclasses
-    _propdict = {}      # Can be overridden by subclasses
-
-    __eventloop_initialized = 0
-    def __ensure_WMAvailable(klass):
-        if klass.__eventloop_initialized: return 1
-        if not MacOS.WMAvailable(): return 0
-        # Workaround for a but in MacOSX 10.2: we must have an event
-        # loop before we can call AESend.
-        Evt.WaitNextEvent(0,0)
-        return 1
-    __ensure_WMAvailable = classmethod(__ensure_WMAvailable)
-
-    def __init__(self, signature=None, start=0, timeout=0):
-        """Create a communication channel with a particular application.
-
-        Addressing the application is done by specifying either a
-        4-byte signature, an AEDesc or an object that will __aepack__
-        to an AEDesc.
-        """
-        self.target_signature = None
-        if signature is None:
-            signature = self._signature
-        if isinstance(signature, AEDescType):
-            self.target = signature
-        elif hasattr(signature, '__aepack__'):
-            self.target = signature.__aepack__()
-        elif isinstance(signature, str) and len(signature) == 4:
-            self.target = AE.AECreateDesc(AppleEvents.typeApplSignature, signature)
-            self.target_signature = signature
-        else:
-            raise TypeError("signature should be 4-char string or AEDesc")
-        self.send_flags = AppleEvents.kAEWaitReply
-        self.send_priority = AppleEvents.kAENormalPriority
-        if timeout:
-            self.send_timeout = timeout
-        else:
-            self.send_timeout = AppleEvents.kAEDefaultTimeout
-        if start:
-            self._start()
-
-    def _start(self):
-        """Start the application, if it is not running yet"""
-        try:
-            self.send('ascr', 'noop')
-        except AE.Error:
-            _launch(self.target_signature)
-            for i in range(LAUNCH_MAX_WAIT_TIME):
-                try:
-                    self.send('ascr', 'noop')
-                except AE.Error:
-                    pass
-                else:
-                    break
-                time.sleep(1)
-
-    def start(self):
-        """Deprecated, used _start()"""
-        self._start()
-
-    def newevent(self, code, subcode, parameters = {}, attributes = {}):
-        """Create a complete structure for an apple event"""
-
-        event = AE.AECreateAppleEvent(code, subcode, self.target,
-                  AppleEvents.kAutoGenerateReturnID, AppleEvents.kAnyTransactionID)
-        packevent(event, parameters, attributes)
-        return event
-
-    def sendevent(self, event):
-        """Send a pre-created appleevent, await the reply and unpack it"""
-        if not self.__ensure_WMAvailable():
-            raise RuntimeError("No window manager access, cannot send AppleEvent")
-        reply = event.AESend(self.send_flags, self.send_priority,
-                                  self.send_timeout)
-        parameters, attributes = unpackevent(reply, self._moduleName)
-        return reply, parameters, attributes
-
-    def send(self, code, subcode, parameters = {}, attributes = {}):
-        """Send an appleevent given code/subcode/pars/attrs and unpack the reply"""
-        return self.sendevent(self.newevent(code, subcode, parameters, attributes))
-
-    #
-    # The following events are somehow "standard" and don't seem to appear in any
-    # suite...
-    #
-    def activate(self):
-        """Send 'activate' command"""
-        self.send('misc', 'actv')
-
-    def _get(self, _object, asfile=None, _attributes={}):
-        """_get: get data from an object
-        Required argument: the object
-        Keyword argument _attributes: AppleEvent attribute dictionary
-        Returns: the data
-        """
-        _code = 'core'
-        _subcode = 'getd'
-
-        _arguments = {'----':_object}
-        if asfile:
-            _arguments['rtyp'] = mktype(asfile)
-
-        _reply, _arguments, _attributes = self.send(_code, _subcode,
-                _arguments, _attributes)
-        if 'errn' in _arguments:
-            raise Error(decodeerror(_arguments))
-
-        if '----' in _arguments:
-            return _arguments['----']
-            if asfile:
-                item.__class__ = asfile
-            return item
-
-    get = _get
-
-    _argmap_set = {
-        'to' : 'data',
-    }
-
-    def _set(self, _object, _attributes={}, **_arguments):
-        """set: Set an object's data.
-        Required argument: the object for the command
-        Keyword argument to: The new value.
-        Keyword argument _attributes: AppleEvent attribute dictionary
-        """
-        _code = 'core'
-        _subcode = 'setd'
-
-        keysubst(_arguments, self._argmap_set)
-        _arguments['----'] = _object
-
-
-        _reply, _arguments, _attributes = self.send(_code, _subcode,
-                _arguments, _attributes)
-        if _arguments.get('errn', 0):
-            raise Error(decodeerror(_arguments))
-        # XXXX Optionally decode result
-        if '----' in _arguments:
-            return _arguments['----']
-
-    set = _set
-
-    # Magic glue to allow suite-generated classes to function somewhat
-    # like the "application" class in OSA.
-
-    def __getattr__(self, name):
-        if name in self._elemdict:
-            cls = self._elemdict[name]
-            return DelayedComponentItem(cls, None)
-        if name in self._propdict:
-            cls = self._propdict[name]
-            return cls()
-        raise AttributeError(name)
-
-# Tiny Finder class, for local use only
-
-class _miniFinder(TalkTo):
-    def open(self, _object, _attributes={}, **_arguments):
-        """open: Open the specified object(s)
-        Required argument: list of objects to open
-        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 'errn' in _arguments:
-            raise Error(decodeerror(_arguments))
-        # XXXX Optionally decode result
-        if '----' in _arguments:
-            return _arguments['----']
-#pass
-
-_finder = _miniFinder('MACS')
-
-def _launch(appfile):
-    """Open a file thru the finder. Specify file by name or fsspec"""
-    _finder.open(_application_file(('ID  ', appfile)))
-
-
-class _application_file(ComponentItem):
-    """application file - An application's file on disk"""
-    want = 'appf'
-
-_application_file._propdict = {
-}
-_application_file._elemdict = {
-}
-
-# Test program
-# XXXX Should test more, really...
-
-def test():
-    def raw_input(prompt):
-        sys.stdout.write(prompt)
-        sys.stdout.flush()
-        return sys.stdin.readline()
-
-    target = AE.AECreateDesc('sign', 'quil')
-    ae = AE.AECreateAppleEvent('aevt', 'oapp', target, -1, 0)
-    print(unpackevent(ae))
-    raw_input(":")
-    ae = AE.AECreateAppleEvent('core', 'getd', target, -1, 0)
-    obj = Character(2, Word(1, Document(1)))
-    print(obj)
-    print(repr(obj))
-    packevent(ae, {'----': obj})
-    params, attrs = unpackevent(ae)
-    print(params['----'])
-    raw_input(":")
-
-if __name__ == '__main__':
-    test()
-    sys.exit(1)

Deleted: python/branches/py3k/Lib/plat-mac/aetypes.py
==============================================================================
--- python/branches/py3k/Lib/plat-mac/aetypes.py	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,584 +0,0 @@
-"""aetypes - Python objects representing various AE types."""
-
-from Carbon.AppleEvents import *
-import struct
-
-#
-# convoluted, since there are cyclic dependencies between this file and
-# aetools_convert.
-#
-def pack(*args, **kwargs):
-    from aepack import pack
-    return pack( *args, **kwargs)
-
-def nice(s):
-    """'nice' representation of an object"""
-    if isinstance(s, str): return repr(s)
-    else: return str(s)
-
-def _four_char_code(four_chars):
-    """Convert a str or bytes object into a 4-byte array.
-
-    four_chars must contain only ASCII characters.
-
-    """
-    if isinstance(four_chars, (bytes, bytearray)):
-        b = bytes(four_chars[:4])
-        n = len(b)
-        if n < 4:
-            b += b' ' * (4 - n)
-        return b
-    else:
-        s = str(four_chars)[:4]
-        n = len(s)
-        if n < 4:
-            s += ' ' * (4 - n)
-        return bytes(s, "latin-1")  # MacRoman?
-
-class Unknown:
-    """An uninterpreted AE object"""
-
-    def __init__(self, type, data):
-        self.type = type
-        self.data = data
-
-    def __repr__(self):
-        return "Unknown(%r, %r)" % (self.type, self.data)
-
-    def __aepack__(self):
-        return pack(self.data, self.type)
-
-class Enum:
-    """An AE enumeration value"""
-
-    def __init__(self, enum):
-        self.enum = _four_char_code(enum)
-
-    def __repr__(self):
-        return "Enum(%r)" % (self.enum,)
-
-    def __str__(self):
-        return self.enum.decode("latin-1").strip(" ")
-
-    def __aepack__(self):
-        return pack(self.enum, typeEnumeration)
-
-def IsEnum(x):
-    return isinstance(x, Enum)
-
-def mkenum(enum):
-    if IsEnum(enum): return enum
-    return Enum(enum)
-
-# Jack changed the way this is done
-class InsertionLoc:
-    def __init__(self, of, pos):
-        self.of = of
-        self.pos = pos
-
-    def __repr__(self):
-        return "InsertionLoc(%r, %r)" % (self.of, self.pos)
-
-    def __aepack__(self):
-        rec = {'kobj': self.of, 'kpos': self.pos}
-        return pack(rec, forcetype='insl')
-
-# Convenience functions for dsp:
-def beginning(of):
-    return InsertionLoc(of, Enum('bgng'))
-
-def end(of):
-    return InsertionLoc(of, Enum('end '))
-
-class Boolean:
-    """An AE boolean value"""
-
-    def __init__(self, bool):
-        self.bool = (not not bool)
-
-    def __repr__(self):
-        return "Boolean(%r)" % (self.bool,)
-
-    def __str__(self):
-        if self.bool:
-            return "True"
-        else:
-            return "False"
-
-    def __aepack__(self):
-        return pack(struct.pack('b', self.bool), 'bool')
-
-def IsBoolean(x):
-    return isinstance(x, Boolean)
-
-def mkboolean(bool):
-    if IsBoolean(bool): return bool
-    return Boolean(bool)
-
-class Type:
-    """An AE 4-char typename object"""
-
-    def __init__(self, type):
-        self.type = _four_char_code(type)
-
-    def __repr__(self):
-        return "Type(%r)" % (self.type,)
-
-    def __str__(self):
-        return self.type.strip()
-
-    def __aepack__(self):
-        return pack(self.type, typeType)
-
-def IsType(x):
-    return isinstance(x, Type)
-
-def mktype(type):
-    if IsType(type): return type
-    return Type(type)
-
-
-class Keyword:
-    """An AE 4-char keyword object"""
-
-    def __init__(self, keyword):
-        self.keyword = _four_char_code(keyword)
-
-    def __repr__(self):
-        return "Keyword(%r)" % self.keyword
-
-    def __str__(self):
-        return self.keyword.strip()
-
-    def __aepack__(self):
-        return pack(self.keyword, typeKeyword)
-
-def IsKeyword(x):
-    return isinstance(x, Keyword)
-
-class Range:
-    """An AE range object"""
-
-    def __init__(self, start, stop):
-        self.start = start
-        self.stop = stop
-
-    def __repr__(self):
-        return "Range(%r, %r)" % (self.start, self.stop)
-
-    def __str__(self):
-        return "%s thru %s" % (nice(self.start), nice(self.stop))
-
-    def __aepack__(self):
-        return pack({'star': self.start, 'stop': self.stop}, 'rang')
-
-def IsRange(x):
-    return isinstance(x, Range)
-
-class Comparison:
-    """An AE Comparison"""
-
-    def __init__(self, obj1, relo, obj2):
-        self.obj1 = obj1
-        self.relo = _four_char_code(relo)
-        self.obj2 = obj2
-
-    def __repr__(self):
-        return "Comparison(%r, %r, %r)" % (self.obj1, self.relo, self.obj2)
-
-    def __str__(self):
-        return "%s %s %s" % (nice(self.obj1), self.relo.strip(), nice(self.obj2))
-
-    def __aepack__(self):
-        return pack({'obj1': self.obj1,
-                 'relo': mkenum(self.relo),
-                 'obj2': self.obj2},
-                'cmpd')
-
-def IsComparison(x):
-    return isinstance(x, Comparison)
-
-class NComparison(Comparison):
-    # The class attribute 'relo' must be set in a subclass
-
-    def __init__(self, obj1, obj2):
-        Comparison.__init__(obj1, self.relo, obj2)
-
-class Ordinal:
-    """An AE Ordinal"""
-
-    def __init__(self, abso):
-#       self.obj1 = obj1
-        self.abso = _four_char_code(abso)
-
-    def __repr__(self):
-        return "Ordinal(%r)" % (self.abso,)
-
-    def __str__(self):
-        return "%s" % (self.abso.strip())
-
-    def __aepack__(self):
-        return pack(self.abso, 'abso')
-
-def IsOrdinal(x):
-    return isinstance(x, Ordinal)
-
-class NOrdinal(Ordinal):
-    # The class attribute 'abso' must be set in a subclass
-
-    def __init__(self):
-        Ordinal.__init__(self, self.abso)
-
-class Logical:
-    """An AE logical expression object"""
-
-    def __init__(self, logc, term):
-        self.logc = _four_char_code(logc)
-        self.term = term
-
-    def __repr__(self):
-        return "Logical(%r, %r)" % (self.logc, self.term)
-
-    def __str__(self):
-        if isinstance(self.term, list) and len(self.term) == 2:
-            return "%s %s %s" % (nice(self.term[0]),
-                                 self.logc.strip(),
-                                 nice(self.term[1]))
-        else:
-            return "%s(%s)" % (self.logc.strip(), nice(self.term))
-
-    def __aepack__(self):
-        return pack({'logc': mkenum(self.logc), 'term': self.term}, 'logi')
-
-def IsLogical(x):
-    return isinstance(x, Logical)
-
-class StyledText:
-    """An AE object respresenting text in a certain style"""
-
-    def __init__(self, style, text):
-        self.style = style
-        self.text = text
-
-    def __repr__(self):
-        return "StyledText(%r, %r)" % (self.style, self.text)
-
-    def __str__(self):
-        return self.text
-
-    def __aepack__(self):
-        return pack({'ksty': self.style, 'ktxt': self.text}, 'STXT')
-
-def IsStyledText(x):
-    return isinstance(x, StyledText)
-
-class AEText:
-    """An AE text object with style, script and language specified"""
-
-    def __init__(self, script, style, text):
-        self.script = script
-        self.style = style
-        self.text = text
-
-    def __repr__(self):
-        return "AEText(%r, %r, %r)" % (self.script, self.style, self.text)
-
-    def __str__(self):
-        return self.text
-
-    def __aepack__(self):
-        return pack({keyAEScriptTag: self.script, keyAEStyles: self.style,
-                 keyAEText: self.text}, typeAEText)
-
-def IsAEText(x):
-    return isinstance(x, AEText)
-
-class IntlText:
-    """A text object with script and language specified"""
-
-    def __init__(self, script, language, text):
-        self.script = script
-        self.language = language
-        self.text = text
-
-    def __repr__(self):
-        return "IntlText(%r, %r, %r)" % (self.script, self.language, self.text)
-
-    def __str__(self):
-        return self.text
-
-    def __aepack__(self):
-        return pack(struct.pack('hh', self.script, self.language)+self.text,
-            typeIntlText)
-
-def IsIntlText(x):
-    return isinstance(x, IntlText)
-
-class IntlWritingCode:
-    """An object representing script and language"""
-
-    def __init__(self, script, language):
-        self.script = script
-        self.language = language
-
-    def __repr__(self):
-        return "IntlWritingCode(%r, %r)" % (self.script, self.language)
-
-    def __str__(self):
-        return "script system %d, language %d"%(self.script, self.language)
-
-    def __aepack__(self):
-        return pack(struct.pack('hh', self.script, self.language),
-            typeIntlWritingCode)
-
-def IsIntlWritingCode(x):
-    return isinstance(x, IntlWritingCode)
-
-class QDPoint:
-    """A point"""
-
-    def __init__(self, v, h):
-        self.v = v
-        self.h = h
-
-    def __repr__(self):
-        return "QDPoint(%r, %r)" % (self.v, self.h)
-
-    def __str__(self):
-        return "(%d, %d)"%(self.v, self.h)
-
-    def __aepack__(self):
-        return pack(struct.pack('hh', self.v, self.h),
-            typeQDPoint)
-
-def IsQDPoint(x):
-    return isinstance(x, QDPoint)
-
-class QDRectangle:
-    """A rectangle"""
-
-    def __init__(self, v0, h0, v1, h1):
-        self.v0 = v0
-        self.h0 = h0
-        self.v1 = v1
-        self.h1 = h1
-
-    def __repr__(self):
-        return "QDRectangle(%r, %r, %r, %r)" % (self.v0, self.h0, self.v1, self.h1)
-
-    def __str__(self):
-        return "(%d, %d)-(%d, %d)"%(self.v0, self.h0, self.v1, self.h1)
-
-    def __aepack__(self):
-        return pack(struct.pack('hhhh', self.v0, self.h0, self.v1, self.h1),
-            typeQDRectangle)
-
-def IsQDRectangle(x):
-    return isinstance(x, QDRectangle)
-
-class RGBColor:
-    """An RGB color"""
-
-    def __init__(self, r, g, b):
-        self.r = r
-        self.g = g
-        self.b = b
-
-    def __repr__(self):
-        return "RGBColor(%r, %r, %r)" % (self.r, self.g, self.b)
-
-    def __str__(self):
-        return "0x%x red, 0x%x green, 0x%x blue"% (self.r, self.g, self.b)
-
-    def __aepack__(self):
-        return pack(struct.pack('hhh', self.r, self.g, self.b),
-            typeRGBColor)
-
-def IsRGBColor(x):
-    return isinstance(x, RGBColor)
-
-class ObjectSpecifier:
-
-    """A class for constructing and manipulation AE object specifiers in python.
-
-    An object specifier is actually a record with four fields:
-
-    key type    description
-    --- ----    -----------
-
-    'want'  type    4-char class code of thing we want,
-            e.g. word, paragraph or property
-
-    'form'  enum    how we specify which 'want' thing(s) we want,
-            e.g. by index, by range, by name, or by property specifier
-
-    'seld'  any which thing(s) we want,
-            e.g. its index, its name, or its property specifier
-
-    'from'  object  the object in which it is contained,
-            or null, meaning look for it in the application
-
-    Note that we don't call this class plain "Object", since that name
-    is likely to be used by the application.
-    """
-
-    def __init__(self, want, form, seld, fr = None):
-        self.want = want
-        self.form = form
-        self.seld = seld
-        self.fr = fr
-
-    def __repr__(self):
-        s = "ObjectSpecifier(%r, %r, %r" % (self.want, self.form, self.seld)
-        if self.fr:
-            s = s + ", %r)" % (self.fr,)
-        else:
-            s = s + ")"
-        return s
-
-    def __aepack__(self):
-        return pack({'want': mktype(self.want),
-                 'form': mkenum(self.form),
-                 'seld': self.seld,
-                 'from': self.fr},
-                'obj ')
-
-def IsObjectSpecifier(x):
-    return isinstance(x, ObjectSpecifier)
-
-
-# Backwards compatibility, sigh...
-class Property(ObjectSpecifier):
-
-    def __init__(self, which, fr = None, want='prop'):
-        ObjectSpecifier.__init__(self, want, 'prop', mktype(which), fr)
-
-    def __repr__(self):
-        if self.fr:
-            return "Property(%r, %r)" % (self.seld.type, self.fr)
-        else:
-            return "Property(%r)" % (self.seld.type,)
-
-    def __str__(self):
-        if self.fr:
-            return "Property %s of %s" % (str(self.seld), str(self.fr))
-        else:
-            return "Property %s" % str(self.seld)
-
-
-class NProperty(ObjectSpecifier):
-    # Subclasses *must* self baseclass attributes:
-    # want is the type of this property
-    # which is the property name of this property
-
-    def __init__(self, fr = None):
-        #try:
-        #   dummy = self.want
-        #except:
-        #   self.want = 'prop'
-        self.want = 'prop'
-        ObjectSpecifier.__init__(self, self.want, 'prop',
-                    mktype(self.which), fr)
-
-    def __repr__(self):
-        rv = "Property(%r" % (self.seld.type,)
-        if self.fr:
-            rv = rv + ", fr=%r" % (self.fr,)
-        if self.want != 'prop':
-            rv = rv + ", want=%r" % (self.want,)
-        return rv + ")"
-
-    def __str__(self):
-        if self.fr:
-            return "Property %s of %s" % (str(self.seld), str(self.fr))
-        else:
-            return "Property %s" % str(self.seld)
-
-
-class SelectableItem(ObjectSpecifier):
-
-    def __init__(self, want, seld, fr = None):
-        t = type(seld)
-        if isinstance(t, str):
-            form = 'name'
-        elif IsRange(seld):
-            form = 'rang'
-        elif IsComparison(seld) or IsLogical(seld):
-            form = 'test'
-        elif isinstance(t, tuple):
-            # Breakout: specify both form and seld in a tuple
-            # (if you want ID or rele or somesuch)
-            form, seld = seld
-        else:
-            form = 'indx'
-        ObjectSpecifier.__init__(self, want, form, seld, fr)
-
-
-class ComponentItem(SelectableItem):
-    # Derived classes *must* set the *class attribute* 'want' to some constant
-    # Also, dictionaries _propdict and _elemdict must be set to map property
-    # and element names to the correct classes
-
-    _propdict = {}
-    _elemdict = {}
-    def __init__(self, which, fr = None):
-        SelectableItem.__init__(self, self.want, which, fr)
-
-    def __repr__(self):
-        if not self.fr:
-            return "%s(%r)" % (self.__class__.__name__, self.seld)
-        return "%s(%r, %r)" % (self.__class__.__name__, self.seld, self.fr)
-
-    def __str__(self):
-        seld = self.seld
-        if isinstance(seld, str):
-            ss = repr(seld)
-        elif IsRange(seld):
-            start, stop = seld.start, seld.stop
-            if type(start) == type(stop) == type(self):
-                ss = str(start.seld) + " thru " + str(stop.seld)
-            else:
-                ss = str(seld)
-        else:
-            ss = str(seld)
-        s = "%s %s" % (self.__class__.__name__, ss)
-        if self.fr: s = s + " of %s" % str(self.fr)
-        return s
-
-    def __getattr__(self, name):
-        if name in self._elemdict:
-            cls = self._elemdict[name]
-            return DelayedComponentItem(cls, self)
-        if name in self._propdict:
-            cls = self._propdict[name]
-            return cls(self)
-        raise AttributeError(name)
-
-
-class DelayedComponentItem:
-    def __init__(self, compclass, fr):
-        self.compclass = compclass
-        self.fr = fr
-
-    def __call__(self, which):
-        return self.compclass(which, self.fr)
-
-    def __repr__(self):
-        return "%s(???, %r)" % (self.__class__.__name__, self.fr)
-
-    def __str__(self):
-        return "selector for element %s of %s"%(self.__class__.__name__, str(self.fr))
-
-template = """
-class %s(ComponentItem): want = %r
-"""
-
-exec(template % ("Text", b'text'))
-exec(template % ("Character", b'cha '))
-exec(template % ("Word", b'cwor'))
-exec(template % ("Line", b'clin'))
-exec(template % ("paragraph", b'cpar'))
-exec(template % ("Window", b'cwin'))
-exec(template % ("Document", b'docu'))
-exec(template % ("File", b'file'))
-exec(template % ("InsertionPoint", b'cins'))

Deleted: python/branches/py3k/Lib/plat-mac/applesingle.py
==============================================================================
--- python/branches/py3k/Lib/plat-mac/applesingle.py	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,137 +0,0 @@
-r"""Routines to decode AppleSingle files
-"""
-import struct
-import sys
-try:
-    import MacOS
-    import Carbon.File
-except:
-    class MacOS:
-        def openrf(path, mode):
-            return open(path + '.rsrc', mode)
-        openrf = classmethod(openrf)
-    class Carbon:
-        class File:
-            class FSSpec:
-                pass
-            class FSRef:
-                pass
-            class Alias:
-                pass
-
-# all of the errors in this module are really errors in the input
-# so I think it should test positive against ValueError.
-class Error(ValueError):
-    pass
-
-# File header format: magic, version, unused, number of entries
-AS_HEADER_FORMAT=">LL16sh"
-AS_HEADER_LENGTH=26
-# The flag words for AppleSingle
-AS_MAGIC=0x00051600
-AS_VERSION=0x00020000
-
-# Entry header format: id, offset, length
-AS_ENTRY_FORMAT=">lll"
-AS_ENTRY_LENGTH=12
-
-# The id values
-AS_DATAFORK=1
-AS_RESOURCEFORK=2
-AS_IGNORE=(3,4,5,6,8,9,10,11,12,13,14,15)
-
-class AppleSingle(object):
-    datafork = None
-    resourcefork = None
-
-    def __init__(self, fileobj, verbose=False):
-        header = fileobj.read(AS_HEADER_LENGTH)
-        try:
-            magic, version, ig, nentry = struct.unpack(AS_HEADER_FORMAT, header)
-        except ValueError as arg:
-            raise Error("Unpack header error: %s" % (arg,))
-        if verbose:
-            print('Magic:   0x%8.8x' % (magic,))
-            print('Version: 0x%8.8x' % (version,))
-            print('Entries: %d' % (nentry,))
-        if magic != AS_MAGIC:
-            raise Error("Unknown AppleSingle magic number 0x%8.8x" % (magic,))
-        if version != AS_VERSION:
-            raise Error("Unknown AppleSingle version number 0x%8.8x" % (version,))
-        if nentry <= 0:
-            raise Error("AppleSingle file contains no forks")
-        headers = [fileobj.read(AS_ENTRY_LENGTH) for i in range(nentry)]
-        self.forks = []
-        for hdr in headers:
-            try:
-                restype, offset, length = struct.unpack(AS_ENTRY_FORMAT, hdr)
-            except ValueError as arg:
-                raise Error("Unpack entry error: %s" % (arg,))
-            if verbose:
-                print("Fork %d, offset %d, length %d" % (restype, offset, length))
-            fileobj.seek(offset)
-            data = fileobj.read(length)
-            if len(data) != length:
-                raise Error("Short read: expected %d bytes got %d" % (length, len(data)))
-            self.forks.append((restype, data))
-            if restype == AS_DATAFORK:
-                self.datafork = data
-            elif restype == AS_RESOURCEFORK:
-                self.resourcefork = data
-
-    def tofile(self, path, resonly=False):
-        outfile = open(path, 'wb')
-        data = False
-        if resonly:
-            if self.resourcefork is None:
-                raise Error("No resource fork found")
-            fp = open(path, 'wb')
-            fp.write(self.resourcefork)
-            fp.close()
-        elif (self.resourcefork is None and self.datafork is None):
-            raise Error("No useful forks found")
-        else:
-            if self.datafork is not None:
-                fp = open(path, 'wb')
-                fp.write(self.datafork)
-                fp.close()
-            if self.resourcefork is not None:
-                fp = MacOS.openrf(path, '*wb')
-                fp.write(self.resourcefork)
-                fp.close()
-
-def decode(infile, outpath, resonly=False, verbose=False):
-    """decode(infile, outpath [, resonly=False, verbose=False])
-
-    Creates a decoded file from an AppleSingle encoded file.
-    If resonly is True, then it will create a regular file at
-    outpath containing only the resource fork from infile.
-    Otherwise it will create an AppleDouble file at outpath
-    with the data and resource forks from infile.  On platforms
-    without the MacOS module, it will create inpath and inpath+'.rsrc'
-    with the data and resource forks respectively.
-
-    """
-    if not hasattr(infile, 'read'):
-        if isinstance(infile, Carbon.File.Alias):
-            infile = infile.ResolveAlias()[0]
-        if isinstance(infile, (Carbon.File.FSSpec, Carbon.File.FSRef)):
-            infile = infile.as_pathname()
-        infile = open(infile, 'rb')
-
-    asfile = AppleSingle(infile, verbose=verbose)
-    asfile.tofile(outpath, resonly=resonly)
-
-def _test():
-    if len(sys.argv) < 3 or sys.argv[1] == '-r' and len(sys.argv) != 4:
-        print('Usage: applesingle.py [-r] applesinglefile decodedfile')
-        sys.exit(1)
-    if sys.argv[1] == '-r':
-        resonly = True
-        del sys.argv[1]
-    else:
-        resonly = False
-    decode(sys.argv[1], sys.argv[2], resonly=resonly)
-
-if __name__ == '__main__':
-    _test()

Deleted: python/branches/py3k/Lib/plat-mac/appletrawmain.py
==============================================================================
--- python/branches/py3k/Lib/plat-mac/appletrawmain.py	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,63 +0,0 @@
-# Emulate sys.argv and run __main__.py or __main__.pyc in an environment that
-# is as close to "normal" as possible.
-#
-# This script is put into __rawmain__.pyc for applets that need argv
-# emulation, by BuildApplet and friends.
-#
-import argvemulator
-import os
-import sys
-import marshal
-
-#
-# Make sure we have an argv[0], and make _dir point to the Resources
-# directory.
-#
-if not sys.argv or sys.argv[0][:1] == '-':
-    # Insert our (guessed) name.
-    _dir = os.path.split(sys.executable)[0] # removes "python"
-    _dir = os.path.split(_dir)[0] # Removes "MacOS"
-    _dir = os.path.join(_dir, 'Resources')
-    sys.argv.insert(0, '__rawmain__')
-else:
-    _dir = os.path.split(sys.argv[0])[0]
-#
-# Add the Resources directory to the path. This is where files installed
-# by BuildApplet.py with the --extra option show up, and if those files are
-# modules this sys.path modification is necessary to be able to import them.
-#
-sys.path.insert(0, _dir)
-#
-# Create sys.argv
-#
-argvemulator.ArgvCollector().mainloop()
-#
-# Find the real main program to run
-#
-__file__ = os.path.join(_dir, '__main__.py')
-if os.path.exists(__file__):
-    #
-    # Setup something resembling a normal environment and go.
-    #
-    sys.argv[0] = __file__
-    del argvemulator, os, sys, _dir
-    exec(open(__file__).read())
-else:
-    __file__ = os.path.join(_dir, '__main__.pyc')
-    if os.path.exists(__file__):
-        #
-        # If we have only a .pyc file we read the code object from that
-        #
-        sys.argv[0] = __file__
-        _fp = open(__file__, 'rb')
-        _fp.read(8)
-        __code__ = marshal.load(_fp)
-        #
-        # Again, we create an almost-normal environment (only __code__ is
-        # funny) and go.
-        #
-        del argvemulator, os, sys, marshal, _dir, _fp
-        exec(__code__)
-    else:
-        sys.stderr.write("%s: neither __main__.py nor __main__.pyc found\n"%sys.argv[0])
-        sys.exit(1)

Deleted: python/branches/py3k/Lib/plat-mac/appletrunner.py
==============================================================================
--- python/branches/py3k/Lib/plat-mac/appletrunner.py	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,17 +0,0 @@
-#!/usr/bin/env python
-# This file is meant as an executable script for running applets.
-# BuildApplet will use it as the main executable in the .app bundle if
-# we are not running in a framework build.
-
-import os
-import sys
-for name in ["__rawmain__.py", "__rawmain__.pyc", "__main__.py", "__main__.pyc"]:
-    realmain = os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])),
-                      "Resources", name)
-    if os.path.exists(realmain):
-        break
-else:
-    sys.stderr.write("%s: cannot find applet main program\n" % sys.argv[0])
-    sys.exit(1)
-sys.argv.insert(1, realmain)
-os.execve(sys.executable, sys.argv, os.environ)

Deleted: python/branches/py3k/Lib/plat-mac/argvemulator.py
==============================================================================
--- python/branches/py3k/Lib/plat-mac/argvemulator.py	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,89 +0,0 @@
-"""argvemulator - create sys.argv from OSA events. Used by applets that
-want unix-style arguments.
-"""
-
-import sys
-import traceback
-from Carbon import AE
-from Carbon.AppleEvents import *
-from Carbon import Evt
-from Carbon import File
-from Carbon.Events import *
-import aetools
-
-class ArgvCollector:
-
-    """A minimal FrameWork.Application-like class"""
-
-    def __init__(self):
-        self.quitting = 0
-        # Remove the funny -psn_xxx_xxx argument
-        if len(sys.argv) > 1 and sys.argv[1][:4] == '-psn':
-            del sys.argv[1]
-
-        AE.AEInstallEventHandler(kCoreEventClass, kAEOpenApplication, self.__runapp)
-        AE.AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments, self.__openfiles)
-
-    def close(self):
-        AE.AERemoveEventHandler(kCoreEventClass, kAEOpenApplication)
-        AE.AERemoveEventHandler(kCoreEventClass, kAEOpenDocuments)
-
-    def mainloop(self, mask = highLevelEventMask, timeout = 1*60):
-        # Note: this is not the right way to run an event loop in OSX or even
-        # "recent" versions of MacOS9. This is however code that has proven
-        # itself.
-        stoptime = Evt.TickCount() + timeout
-        while not self.quitting and Evt.TickCount() < stoptime:
-            self._dooneevent(mask, timeout)
-
-        if not self.quitting:
-            print("argvemulator: timeout waiting for arguments")
-
-        self.close()
-
-    def _dooneevent(self, mask = highLevelEventMask, timeout = 1*60):
-        got, event = Evt.WaitNextEvent(mask, timeout)
-        if got:
-            self._lowlevelhandler(event)
-
-    def _lowlevelhandler(self, event):
-        what, message, when, where, modifiers = event
-        h, v = where
-        if what == kHighLevelEvent:
-            try:
-                AE.AEProcessAppleEvent(event)
-            except AE.Error as err:
-                msg = "High Level Event: %r %r" % (hex(message), hex(h | (v<<16)))
-                print('AE error: ', err)
-                print('in', msg)
-                traceback.print_exc()
-            return
-        else:
-            print("Unhandled event:", event)
-
-
-    def _quit(self):
-        self.quitting = 1
-
-    def __runapp(self, requestevent, replyevent):
-        self._quit()
-
-    def __openfiles(self, requestevent, replyevent):
-        try:
-            listdesc = requestevent.AEGetParamDesc(keyDirectObject, typeAEList)
-            for i in range(listdesc.AECountItems()):
-                aliasdesc = listdesc.AEGetNthDesc(i+1, typeAlias)[1]
-                alias = File.Alias(rawdata=aliasdesc.data)
-                fsref = alias.FSResolveAlias(None)[0]
-                pathname = fsref.as_pathname()
-                sys.argv.append(pathname)
-        except  Exception as e:
-            print("argvemulator.py warning: can't unpack an open document event")
-            import traceback
-            traceback.print_exc()
-
-        self._quit()
-
-if __name__ == '__main__':
-    ArgvCollector().mainloop()
-    print("sys.argv=", sys.argv)

Deleted: python/branches/py3k/Lib/plat-mac/bgenlocations.py
==============================================================================
--- python/branches/py3k/Lib/plat-mac/bgenlocations.py	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,55 +0,0 @@
-#
-# Local customizations for generating the Carbon interface modules.
-# Edit this file to reflect where things should be on your system.
-# Note that pathnames are unix-style for OSX MachoPython/unix-Python,
-# but mac-style for MacPython, whether running on OS9 or OSX.
-#
-
-import os
-
-Error = "bgenlocations.Error"
-#
-# Where bgen is. For unix-Python bgen isn't installed, so you have to refer to
-# the source tree here.
-BGENDIR="/Users/jack/src/python/Tools/bgen/bgen"
-
-#
-# Where to find the Universal Header include files. If you have CodeWarrior
-# installed you can use the Universal Headers from there, otherwise you can
-# download them from the Apple website. Bgen can handle both unix- and mac-style
-# end of lines, so don't worry about that.
-#
-INCLUDEDIR="/Users/jack/src/Universal/Interfaces/CIncludes"
-
-#
-# Where to put the python definitions files. Note that, on unix-Python,
-# if you want to commit your changes to the CVS repository this should refer to
-# your source directory, not your installed directory.
-#
-TOOLBOXDIR="/Users/jack/src/python/Lib/plat-mac/Carbon"
-
-# Creator for C files:
-CREATOR="CWIE"
-
-# The previous definitions can be overriden by creating a module
-# bgenlocationscustomize.py and putting it in site-packages (or anywere else
-# on sys.path, actually)
-try:
-    from bgenlocationscustomize import *
-except ImportError:
-    pass
-
-if not os.path.exists(BGENDIR):
-    raise Error("Please fix bgenlocations.py, BGENDIR does not exist: %s" % BGENDIR)
-if not os.path.exists(INCLUDEDIR):
-    raise Error("Please fix bgenlocations.py, INCLUDEDIR does not exist: %s" % INCLUDEDIR)
-if not os.path.exists(TOOLBOXDIR):
-    raise Error("Please fix bgenlocations.py, TOOLBOXDIR does not exist: %s" % TOOLBOXDIR)
-
-# Sigh, due to the way these are used make sure they end with : or /.
-if BGENDIR[-1] != os.sep:
-    BGENDIR = BGENDIR + os.sep
-if INCLUDEDIR[-1] != os.sep:
-    INCLUDEDIR = INCLUDEDIR + os.sep
-if TOOLBOXDIR[-1] != os.sep:
-    TOOLBOXDIR = TOOLBOXDIR + os.sep

Deleted: python/branches/py3k/Lib/plat-mac/buildtools.py
==============================================================================
--- python/branches/py3k/Lib/plat-mac/buildtools.py	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,423 +0,0 @@
-"""tools for BuildApplet and BuildApplication"""
-
-import sys
-import os
-import imp
-import marshal
-from Carbon import Res
-import Carbon.Files
-import Carbon.File
-import MacOS
-import macostools
-import macresource
-import EasyDialogs
-import shutil
-
-import warnings
-warnings.warn("the buildtools module is deprecated", DeprecationWarning, 2)
-
-
-class BuildError(Exception):
-    pass
-
-# .pyc file (and 'PYC ' resource magic number)
-MAGIC = imp.get_magic()
-
-# Template file (searched on sys.path)
-TEMPLATE = "PythonInterpreter"
-
-# Specification of our resource
-RESTYPE = 'PYC '
-RESNAME = '__main__'
-
-# A resource with this name sets the "owner" (creator) of the destination
-# It should also have ID=0. Either of these alone is not enough.
-OWNERNAME = "owner resource"
-
-# Default applet creator code
-DEFAULT_APPLET_CREATOR="Pyta"
-
-# OpenResFile mode parameters
-READ = 1
-WRITE = 2
-
-# Parameter for FSOpenResourceFile
-RESOURCE_FORK_NAME=Carbon.File.FSGetResourceForkName()
-
-def findtemplate(template=None):
-    """Locate the applet template along sys.path"""
-    if MacOS.runtimemodel == 'macho':
-        return None
-    if not template:
-        template=TEMPLATE
-    for p in sys.path:
-        file = os.path.join(p, template)
-        try:
-            file, d1, d2 = Carbon.File.FSResolveAliasFile(file, 1)
-            break
-        except (Carbon.File.Error, ValueError):
-            continue
-    else:
-        raise BuildError("Template %r not found on sys.path" % (template,))
-    file = file.as_pathname()
-    return file
-
-def process(template, filename, destname, copy_codefragment=0,
-        rsrcname=None, others=[], raw=0, progress="default", destroot=""):
-
-    if progress == "default":
-        progress = EasyDialogs.ProgressBar("Processing %s..."%os.path.split(filename)[1], 120)
-        progress.label("Compiling...")
-        progress.inc(0)
-    # check for the script name being longer than 32 chars. This may trigger a bug
-    # on OSX that can destroy your sourcefile.
-    if '#' in os.path.split(filename)[1]:
-        raise BuildError("BuildApplet could destroy your sourcefile on OSX, please rename: %s" % filename)
-    # Read the source and compile it
-    # (there's no point overwriting the destination if it has a syntax error)
-
-    fp = open(filename, 'rU')
-    text = fp.read()
-    fp.close()
-    try:
-        code = compile(text + '\n', filename, "exec")
-    except SyntaxError as arg:
-        raise BuildError("Syntax error in script %s: %s" % (filename, arg))
-    except EOFError:
-        raise BuildError("End-of-file in script %s" % (filename,))
-
-    # Set the destination file name. Note that basename
-    # does contain the whole filepath, only a .py is stripped.
-
-    if filename[-3:].lower() == ".py":
-        basename = filename[:-3]
-        if MacOS.runtimemodel != 'macho' and not destname:
-            destname = basename
-    else:
-        basename = filename
-
-    if not destname:
-        if MacOS.runtimemodel == 'macho':
-            destname = basename + '.app'
-        else:
-            destname = basename + '.applet'
-    if not rsrcname:
-        rsrcname = basename + '.rsrc'
-
-    # Try removing the output file. This fails in MachO, but it should
-    # do any harm.
-    try:
-        os.remove(destname)
-    except os.error:
-        pass
-    process_common(template, progress, code, rsrcname, destname, 0,
-        copy_codefragment, raw, others, filename, destroot)
-
-
-def update(template, filename, output):
-    if MacOS.runtimemodel == 'macho':
-        raise BuildError("No updating yet for MachO applets")
-    if progress:
-        progress = EasyDialogs.ProgressBar("Updating %s..."%os.path.split(filename)[1], 120)
-    else:
-        progress = None
-    if not output:
-        output = filename + ' (updated)'
-
-    # Try removing the output file
-    try:
-        os.remove(output)
-    except os.error:
-        pass
-    process_common(template, progress, None, filename, output, 1, 1)
-
-
-def process_common(template, progress, code, rsrcname, destname, is_update,
-        copy_codefragment, raw=0, others=[], filename=None, destroot=""):
-    if MacOS.runtimemodel == 'macho':
-        return process_common_macho(template, progress, code, rsrcname, destname,
-            is_update, raw, others, filename, destroot)
-    if others:
-        raise BuildError("Extra files only allowed for MachoPython applets")
-    # Create FSSpecs for the various files
-    template_fsr, d1, d2 = Carbon.File.FSResolveAliasFile(template, 1)
-    template = template_fsr.as_pathname()
-
-    # Copy data (not resources, yet) from the template
-    if progress:
-        progress.label("Copy data fork...")
-        progress.set(10)
-
-    if copy_codefragment:
-        tmpl = open(template, "rb")
-        dest = open(destname, "wb")
-        data = tmpl.read()
-        if data:
-            dest.write(data)
-        dest.close()
-        tmpl.close()
-        del dest
-        del tmpl
-
-    # Open the output resource fork
-
-    if progress:
-        progress.label("Copy resources...")
-        progress.set(20)
-    try:
-        output = Res.FSOpenResourceFile(destname, RESOURCE_FORK_NAME, WRITE)
-    except MacOS.Error:
-        destdir, destfile = os.path.split(destname)
-        Res.FSCreateResourceFile(destdir, str(destfile), RESOURCE_FORK_NAME)
-        output = Res.FSOpenResourceFile(destname, RESOURCE_FORK_NAME, WRITE)
-
-    # Copy the resources from the target specific resource template, if any
-    typesfound, ownertype = [], None
-    try:
-        input = Res.FSOpenResourceFile(rsrcname, RESOURCE_FORK_NAME, READ)
-    except (MacOS.Error, ValueError):
-        pass
-        if progress:
-            progress.inc(50)
-    else:
-        if is_update:
-            skip_oldfile = ['cfrg']
-        else:
-            skip_oldfile = []
-        typesfound, ownertype = copyres(input, output, skip_oldfile, 0, progress)
-        Res.CloseResFile(input)
-
-    # Check which resource-types we should not copy from the template
-    skiptypes = []
-    if 'vers' in typesfound: skiptypes.append('vers')
-    if 'SIZE' in typesfound: skiptypes.append('SIZE')
-    if 'BNDL' in typesfound: skiptypes = skiptypes + ['BNDL', 'FREF', 'icl4',
-            'icl8', 'ics4', 'ics8', 'ICN#', 'ics#']
-    if not copy_codefragment:
-        skiptypes.append('cfrg')
-##  skipowner = (ownertype != None)
-
-    # Copy the resources from the template
-
-    input = Res.FSOpenResourceFile(template, RESOURCE_FORK_NAME, READ)
-    dummy, tmplowner = copyres(input, output, skiptypes, 1, progress)
-
-    Res.CloseResFile(input)
-##  if ownertype is None:
-##      raise BuildError, "No owner resource found in either resource file or template"
-    # Make sure we're manipulating the output resource file now
-
-    Res.UseResFile(output)
-
-    if ownertype is None:
-        # No owner resource in the template. We have skipped the
-        # Python owner resource, so we have to add our own. The relevant
-        # bundle stuff is already included in the interpret/applet template.
-        newres = Res.Resource('\0')
-        newres.AddResource(DEFAULT_APPLET_CREATOR, 0, "Owner resource")
-        ownertype = DEFAULT_APPLET_CREATOR
-
-    if code:
-        # Delete any existing 'PYC ' resource named __main__
-
-        try:
-            res = Res.Get1NamedResource(RESTYPE, RESNAME)
-            res.RemoveResource()
-        except Res.Error:
-            pass
-
-        # Create the raw data for the resource from the code object
-        if progress:
-            progress.label("Write PYC resource...")
-            progress.set(120)
-
-        data = marshal.dumps(code)
-        del code
-        data = (MAGIC + '\0\0\0\0') + data
-
-        # Create the resource and write it
-
-        id = 0
-        while id < 128:
-            id = Res.Unique1ID(RESTYPE)
-        res = Res.Resource(data)
-        res.AddResource(RESTYPE, id, RESNAME)
-        attrs = res.GetResAttrs()
-        attrs = attrs | 0x04    # set preload
-        res.SetResAttrs(attrs)
-        res.WriteResource()
-        res.ReleaseResource()
-
-    # Close the output file
-
-    Res.CloseResFile(output)
-
-    # Now set the creator, type and bundle bit of the destination.
-    # Done with FSSpec's, FSRef FInfo isn't good enough yet (2.3a1+)
-    dest_fss = Carbon.File.FSSpec(destname)
-    dest_finfo = dest_fss.FSpGetFInfo()
-    dest_finfo.Creator = ownertype
-    dest_finfo.Type = 'APPL'
-    dest_finfo.Flags = dest_finfo.Flags | Carbon.Files.kHasBundle | Carbon.Files.kIsShared
-    dest_finfo.Flags = dest_finfo.Flags & ~Carbon.Files.kHasBeenInited
-    dest_fss.FSpSetFInfo(dest_finfo)
-
-    macostools.touched(destname)
-    if progress:
-        progress.label("Done.")
-        progress.inc(0)
-
-def process_common_macho(template, progress, code, rsrcname, destname, is_update,
-        raw=0, others=[], filename=None, destroot=""):
-    # Check that we have a filename
-    if filename is None:
-        raise BuildError("Need source filename on MacOSX")
-    # First make sure the name ends in ".app"
-    if destname[-4:] != '.app':
-        destname = destname + '.app'
-    # Now deduce the short name
-    destdir, shortname = os.path.split(destname)
-    if shortname[-4:] == '.app':
-        # Strip the .app suffix
-        shortname = shortname[:-4]
-    # And deduce the .plist and .icns names
-    plistname = None
-    icnsname = None
-    if rsrcname and rsrcname[-5:] == '.rsrc':
-        tmp = rsrcname[:-5]
-        plistname = tmp + '.plist'
-        if os.path.exists(plistname):
-            icnsname = tmp + '.icns'
-            if not os.path.exists(icnsname):
-                icnsname = None
-        else:
-            plistname = None
-    if not icnsname:
-        dft_icnsname = os.path.join(sys.prefix, 'Resources/Python.app/Contents/Resources/PythonApplet.icns')
-        if os.path.exists(dft_icnsname):
-            icnsname = dft_icnsname
-    if not os.path.exists(rsrcname):
-        rsrcname = None
-    if progress:
-        progress.label('Creating bundle...')
-    import bundlebuilder
-    builder = bundlebuilder.AppBuilder(verbosity=0)
-    builder.mainprogram = filename
-    builder.builddir = destdir
-    builder.name = shortname
-    builder.destroot = destroot
-    if rsrcname:
-        realrsrcname = macresource.resource_pathname(rsrcname)
-        builder.files.append((realrsrcname,
-            os.path.join('Contents/Resources', os.path.basename(rsrcname))))
-    for o in others:
-        if type(o) == str:
-            builder.resources.append(o)
-        else:
-            builder.files.append(o)
-    if plistname:
-        import plistlib
-        builder.plist = plistlib.Plist.fromFile(plistname)
-    if icnsname:
-        builder.iconfile = icnsname
-    if not raw:
-        builder.argv_emulation = 1
-    builder.setup()
-    builder.build()
-    if progress:
-        progress.label('Done.')
-        progress.inc(0)
-
-##  macostools.touched(dest_fss)
-
-# Copy resources between two resource file descriptors.
-# skip a resource named '__main__' or (if skipowner is set) with ID zero.
-# Also skip resources with a type listed in skiptypes.
-#
-def copyres(input, output, skiptypes, skipowner, progress=None):
-    ctor = None
-    alltypes = []
-    Res.UseResFile(input)
-    ntypes = Res.Count1Types()
-    progress_type_inc = 50/ntypes
-    for itype in range(1, 1+ntypes):
-        type = Res.Get1IndType(itype)
-        if type in skiptypes:
-            continue
-        alltypes.append(type)
-        nresources = Res.Count1Resources(type)
-        progress_cur_inc = progress_type_inc/nresources
-        for ires in range(1, 1+nresources):
-            res = Res.Get1IndResource(type, ires)
-            id, type, name = res.GetResInfo()
-            lcname = name.lower()
-
-            if lcname == OWNERNAME and id == 0:
-                if skipowner:
-                    continue # Skip this one
-                else:
-                    ctor = type
-            size = res.size
-            attrs = res.GetResAttrs()
-            if progress:
-                progress.label("Copy %s %d %s"%(type, id, name))
-                progress.inc(progress_cur_inc)
-            res.LoadResource()
-            res.DetachResource()
-            Res.UseResFile(output)
-            try:
-                res2 = Res.Get1Resource(type, id)
-            except MacOS.Error:
-                res2 = None
-            if res2:
-                if progress:
-                    progress.label("Overwrite %s %d %s"%(type, id, name))
-                    progress.inc(0)
-                res2.RemoveResource()
-            res.AddResource(type, id, name)
-            res.WriteResource()
-            attrs = attrs | res.GetResAttrs()
-            res.SetResAttrs(attrs)
-            Res.UseResFile(input)
-    return alltypes, ctor
-
-def copyapptree(srctree, dsttree, exceptlist=[], progress=None):
-    names = []
-    if os.path.exists(dsttree):
-        shutil.rmtree(dsttree)
-    os.mkdir(dsttree)
-    todo = os.listdir(srctree)
-    while todo:
-        this, todo = todo[0], todo[1:]
-        if this in exceptlist:
-            continue
-        thispath = os.path.join(srctree, this)
-        if os.path.isdir(thispath):
-            thiscontent = os.listdir(thispath)
-            for t in thiscontent:
-                todo.append(os.path.join(this, t))
-        names.append(this)
-    for this in names:
-        srcpath = os.path.join(srctree, this)
-        dstpath = os.path.join(dsttree, this)
-        if os.path.isdir(srcpath):
-            os.mkdir(dstpath)
-        elif os.path.islink(srcpath):
-            endpoint = os.readlink(srcpath)
-            os.symlink(endpoint, dstpath)
-        else:
-            if progress:
-                progress.label('Copy '+this)
-                progress.inc(0)
-            shutil.copy2(srcpath, dstpath)
-
-def writepycfile(codeobject, cfile):
-    import marshal
-    fc = open(cfile, 'wb')
-    fc.write('\0\0\0\0') # MAGIC placeholder, written later
-    fc.write('\0\0\0\0') # Timestap placeholder, not needed
-    marshal.dump(codeobject, fc)
-    fc.flush()
-    fc.seek(0, 0)
-    fc.write(MAGIC)
-    fc.close()

Deleted: python/branches/py3k/Lib/plat-mac/bundlebuilder.py
==============================================================================
--- python/branches/py3k/Lib/plat-mac/bundlebuilder.py	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,939 +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 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, "w")
-        f.write(self.type + self.creator)
-        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'
-]
-
-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()
-fp = os.path.join(os.path.split(__file__)[0], "%(realmainprogram)s")
-try:
-    script = fp.read()
-finally:
-    fp.close()
-exec(script)
-"""
-
-#
-# 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(findPackageContents(name).keys())
-        for name in includeModules:
-            try:
-                mf.import_hook(name)
-            except ImportError:
-                self.missingModules.append(name)
-
-        mf.run_script(self.mainprogram)
-        modules = 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 neccesary 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()

Deleted: python/branches/py3k/Lib/plat-mac/dialogs.rsrc
==============================================================================
Binary file. No diff available.

Deleted: python/branches/py3k/Lib/plat-mac/errors.rsrc
==============================================================================
Binary file. No diff available.

Deleted: python/branches/py3k/Lib/plat-mac/findertools.py
==============================================================================
--- python/branches/py3k/Lib/plat-mac/findertools.py	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,833 +0,0 @@
-"""Utility routines depending on the finder,
-a combination of code by Jack Jansen and erik at letterror.com.
-
-Most events have been captured from
-Lasso Capture AE and than translated to python code.
-
-IMPORTANT
-Note that the processes() function returns different values
-depending on the OS version it is running on. On MacOS 9
-the Finder returns the process *names* which can then be
-used to find out more about them. On MacOS 8.6 and earlier
-the Finder returns a code which does not seem to work.
-So bottom line: the processes() stuff does not work on < MacOS9
-
-Mostly written by erik at letterror.com
-"""
-import Finder
-from Carbon import AppleEvents
-import aetools
-import MacOS
-import sys
-import Carbon.File
-import Carbon.Folder
-import aetypes
-
-__version__ = '1.1'
-Error = 'findertools.Error'
-
-_finder_talker = None
-
-def _getfinder():
-    """returns basic (recyclable) Finder AE interface object"""
-    global _finder_talker
-    if not _finder_talker:
-        _finder_talker = Finder.Finder()
-    _finder_talker.send_flags = ( _finder_talker.send_flags |
-        AppleEvents.kAECanInteract | AppleEvents.kAECanSwitchLayer)
-    return _finder_talker
-
-def launch(file):
-    """Open a file thru the finder. Specify file by name or fsspec"""
-    finder = _getfinder()
-    fss = Carbon.File.FSSpec(file)
-    return finder.open(fss)
-
-def Print(file):
-    """Print a file thru the finder. Specify file by name or fsspec"""
-    finder = _getfinder()
-    fss = Carbon.File.FSSpec(file)
-    return finder._print(fss)
-
-def copy(src, dstdir):
-    """Copy a file to a folder"""
-    finder = _getfinder()
-    if type(src) == type([]):
-        src_fss = []
-        for s in src:
-            src_fss.append(Carbon.File.FSSpec(s))
-    else:
-        src_fss = Carbon.File.FSSpec(src)
-    dst_fss = Carbon.File.FSSpec(dstdir)
-    return finder.duplicate(src_fss, to=dst_fss)
-
-def move(src, dstdir):
-    """Move a file to a folder"""
-    finder = _getfinder()
-    if type(src) == type([]):
-        src_fss = []
-        for s in src:
-            src_fss.append(Carbon.File.FSSpec(s))
-    else:
-        src_fss = Carbon.File.FSSpec(src)
-    dst_fss = Carbon.File.FSSpec(dstdir)
-    return finder.move(src_fss, to=dst_fss)
-
-def sleep():
-    """Put the mac to sleep"""
-    finder = _getfinder()
-    finder.sleep()
-
-def shutdown():
-    """Shut the mac down"""
-    finder = _getfinder()
-    finder.shut_down()
-
-def restart():
-    """Restart the mac"""
-    finder = _getfinder()
-    finder.restart()
-
-
-#---------------------------------------------------
-#   Additional findertools
-#
-
-def reveal(file):
-    """Reveal a file in the finder. Specify file by name, fsref or fsspec."""
-    finder = _getfinder()
-    fsr = Carbon.File.FSRef(file)
-    file_alias = fsr.FSNewAliasMinimal()
-    return finder.reveal(file_alias)
-
-def select(file):
-    """select a file in the finder. Specify file by name, fsref or fsspec."""
-    finder = _getfinder()
-    fsr = Carbon.File.FSRef(file)
-    file_alias = fsr.FSNewAliasMinimal()
-    return finder.select(file_alias)
-
-def update(file):
-    """Update the display of the specified object(s) to match
-    their on-disk representation. Specify file by name, fsref or fsspec."""
-    finder = _getfinder()
-    fsr = Carbon.File.FSRef(file)
-    file_alias = fsr.FSNewAliasMinimal()
-    return finder.update(file_alias)
-
-
-#---------------------------------------------------
-#   More findertools
-#
-
-def comment(object, comment=None):
-    """comment: get or set the Finder-comment of the item, displayed in the 'Get Info' window."""
-    object = Carbon.File.FSRef(object)
-    object_alias = object.FSNewAliasMonimal()
-    if comment is None:
-        return _getcomment(object_alias)
-    else:
-        return _setcomment(object_alias, comment)
-
-def _setcomment(object_alias, comment):
-    finder = _getfinder()
-    args = {}
-    attrs = {}
-    aeobj_00 = aetypes.ObjectSpecifier(want=aetypes.Type('cobj'), form="alis", seld=object_alias, fr=None)
-    aeobj_01 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('comt'), fr=aeobj_00)
-    args['----'] = aeobj_01
-    args["data"] = comment
-    _reply, args, attrs = finder.send("core", "setd", args, attrs)
-    if 'errn' in args:
-        raise Error(aetools.decodeerror(args))
-    if '----' in args:
-        return args['----']
-
-def _getcomment(object_alias):
-    finder = _getfinder()
-    args = {}
-    attrs = {}
-    aeobj_00 = aetypes.ObjectSpecifier(want=aetypes.Type('cobj'), form="alis", seld=object_alias, fr=None)
-    aeobj_01 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('comt'), fr=aeobj_00)
-    args['----'] = aeobj_01
-    _reply, args, attrs = finder.send("core", "getd", args, attrs)
-    if 'errn' in args:
-        raise Error(aetools.decodeerror(args))
-    if '----' in args:
-        return args['----']
-
-
-#---------------------------------------------------
-#   Get information about current processes in the Finder.
-
-def processes():
-    """processes returns a list of all active processes running on this computer and their creators."""
-    finder = _getfinder()
-    args = {}
-    attrs = {}
-    processnames = []
-    processnumbers = []
-    creators = []
-    partitions = []
-    used = []
-    ## get the processnames or else the processnumbers
-    args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('prcs'), form="indx", seld=aetypes.Unknown('abso', "all "), fr=None)
-    _reply, args, attrs = finder.send('core', 'getd', args, attrs)
-    if 'errn' in args:
-        raise Error(aetools.decodeerror(args))
-    p = []
-    if '----' in args:
-        p =  args['----']
-        for proc in p:
-            if hasattr(proc, 'seld'):
-                # it has a real name
-                processnames.append(proc.seld)
-            elif hasattr(proc, 'type'):
-                if proc.type == "psn ":
-                    # it has a process number
-                    processnumbers.append(proc.data)
-    ## get the creators
-    args = {}
-    attrs = {}
-    aeobj_0 = aetypes.ObjectSpecifier(want=aetypes.Type('prcs'), form="indx", seld=aetypes.Unknown('abso', "all "), fr=None)
-    args['----'] =  aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('fcrt'), fr=aeobj_0)
-    _reply, args, attrs = finder.send('core', 'getd', args, attrs)
-    if 'errn' in args:
-        raise Error(aetools.decodeerror(_arg))
-    if '----' in args:
-        p =  args['----']
-        creators = p[:]
-    ## concatenate in one dict
-    result = []
-    if len(processnames) > len(processnumbers):
-        data = processnames
-    else:
-        data = processnumbers
-    for i in range(len(creators)):
-        result.append((data[i], creators[i]))
-    return result
-
-class _process:
-    pass
-
-def isactiveprocess(processname):
-    """Check of processname is active. MacOS9"""
-    all = processes()
-    ok = 0
-    for n, c in all:
-        if n == processname:
-            return 1
-    return 0
-
-def processinfo(processname):
-    """Return an object with all process properties as attributes for processname. MacOS9"""
-    p = _process()
-
-    if processname == "Finder":
-        p.partition = None
-        p.used = None
-    else:
-        p.partition = _processproperty(processname, 'appt')
-        p.used = _processproperty(processname, 'pusd')
-    p.visible = _processproperty(processname, 'pvis')       #Is the process' layer visible?
-    p.frontmost = _processproperty(processname, 'pisf') #Is the process the frontmost process?
-    p.file = _processproperty(processname, 'file')          #the file from which the process was launched
-    p.filetype  = _processproperty(processname, 'asty')     #the OSType of the file type of the process
-    p.creatortype = _processproperty(processname, 'fcrt')   #the OSType of the creator of the process (the signature)
-    p.accepthighlevel = _processproperty(processname, 'revt')   #Is the process high-level event aware (accepts open application, open document, print document, and quit)?
-    p.hasscripting = _processproperty(processname, 'hscr')      #Does the process have a scripting terminology, i.e., can it be scripted?
-    return p
-
-def _processproperty(processname, property):
-    """return the partition size and memory used for processname"""
-    finder = _getfinder()
-    args = {}
-    attrs = {}
-    aeobj_00 = aetypes.ObjectSpecifier(want=aetypes.Type('prcs'), form="name", seld=processname, fr=None)
-    aeobj_01 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type(property), fr=aeobj_00)
-    args['----'] = aeobj_01
-    _reply, args, attrs = finder.send("core", "getd", args, attrs)
-    if 'errn' in args:
-        raise Error(aetools.decodeerror(args))
-    if '----' in args:
-        return args['----']
-
-
-#---------------------------------------------------
-#   Mess around with Finder windows.
-
-def openwindow(object):
-    """Open a Finder window for object, Specify object by name or fsspec."""
-    finder = _getfinder()
-    object = Carbon.File.FSRef(object)
-    object_alias = object.FSNewAliasMinimal()
-    args = {}
-    attrs = {}
-    _code = 'aevt'
-    _subcode = 'odoc'
-    aeobj_0 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'), form="alis", seld=object_alias, fr=None)
-    args['----'] = aeobj_0
-    _reply, args, attrs = finder.send(_code, _subcode, args, attrs)
-    if 'errn' in args:
-        raise Error(aetools.decodeerror(args))
-
-def closewindow(object):
-    """Close a Finder window for folder, Specify by path."""
-    finder = _getfinder()
-    object = Carbon.File.FSRef(object)
-    object_alias = object.FSNewAliasMinimal()
-    args = {}
-    attrs = {}
-    _code = 'core'
-    _subcode = 'clos'
-    aeobj_0 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'), form="alis", seld=object_alias, fr=None)
-    args['----'] = aeobj_0
-    _reply, args, attrs = finder.send(_code, _subcode, args, attrs)
-    if 'errn' in args:
-        raise Error(aetools.decodeerror(args))
-
-def location(object, pos=None):
-    """Set the position of a Finder window for folder to pos=(w, h). Specify file by name or fsspec.
-    If pos=None, location will return the current position of the object."""
-    object = Carbon.File.FSRef(object)
-    object_alias = object.FSNewAliasMinimal()
-    if not pos:
-        return _getlocation(object_alias)
-    return _setlocation(object_alias, pos)
-
-def _setlocation(object_alias, location):
-    """_setlocation: Set the location of the icon for the object."""
-    x, y = location
-    finder = _getfinder()
-    args = {}
-    attrs = {}
-    aeobj_00 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'), form="alis", seld=object_alias, fr=None)
-    aeobj_01 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('posn'), fr=aeobj_00)
-    args['----'] = aeobj_01
-    args["data"] = [x, y]
-    _reply, args, attrs = finder.send("core", "setd", args, attrs)
-    if 'errn' in args:
-        raise Error(aetools.decodeerror(args))
-    return (x,y)
-
-def _getlocation(object_alias):
-    """_getlocation: get the location of the icon for the object."""
-    finder = _getfinder()
-    args = {}
-    attrs = {}
-    aeobj_00 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'), form="alis", seld=object_alias, fr=None)
-    aeobj_01 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('posn'), fr=aeobj_00)
-    args['----'] = aeobj_01
-    _reply, args, attrs = finder.send("core", "getd", args, attrs)
-    if 'errn' in args:
-        raise Error(aetools.decodeerror(args))
-    if '----' in args:
-        pos = args['----']
-        return pos.h, pos.v
-
-def label(object, index=None):
-    """label: set or get the label of the item. Specify file by name or fsspec."""
-    object = Carbon.File.FSRef(object)
-    object_alias = object.FSNewAliasMinimal()
-    if index is None:
-        return _getlabel(object_alias)
-    if index < 0 or index > 7:
-        index = 0
-    return _setlabel(object_alias, index)
-
-def _getlabel(object_alias):
-    """label: Get the label for the object."""
-    finder = _getfinder()
-    args = {}
-    attrs = {}
-    aeobj_00 = aetypes.ObjectSpecifier(want=aetypes.Type('cobj'), form="alis", seld=object_alias, fr=None)
-    aeobj_01 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('labi'), fr=aeobj_00)
-    args['----'] = aeobj_01
-    _reply, args, attrs = finder.send("core", "getd", args, attrs)
-    if 'errn' in args:
-        raise Error(aetools.decodeerror(args))
-    if '----' in args:
-        return args['----']
-
-def _setlabel(object_alias, index):
-    """label: Set the label for the object."""
-    finder = _getfinder()
-    args = {}
-    attrs = {}
-    _code = 'core'
-    _subcode = 'setd'
-    aeobj_0 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'),
-            form="alis", seld=object_alias, fr=None)
-    aeobj_1 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'),
-            form="prop", seld=aetypes.Type('labi'), fr=aeobj_0)
-    args['----'] = aeobj_1
-    args["data"] = index
-    _reply, args, attrs = finder.send(_code, _subcode, args, attrs)
-    if 'errn' in args:
-        raise Error(aetools.decodeerror(args))
-    return index
-
-def windowview(folder, view=None):
-    """windowview: Set the view of the window for the folder. Specify file by name or fsspec.
-    0 = by icon (default)
-    1 = by name
-    2 = by button
-    """
-    fsr = Carbon.File.FSRef(folder)
-    folder_alias = fsr.FSNewAliasMinimal()
-    if view is None:
-        return _getwindowview(folder_alias)
-    return _setwindowview(folder_alias, view)
-
-def _setwindowview(folder_alias, view=0):
-    """set the windowview"""
-    attrs = {}
-    args = {}
-    if view == 1:
-        _v = aetypes.Type('pnam')
-    elif view == 2:
-        _v = aetypes.Type('lgbu')
-    else:
-        _v = aetypes.Type('iimg')
-    finder = _getfinder()
-    aeobj_0 = aetypes.ObjectSpecifier(want = aetypes.Type('cfol'),
-            form = 'alis', seld = folder_alias, fr=None)
-    aeobj_1 = aetypes.ObjectSpecifier(want = aetypes.Type('prop'),
-            form = 'prop', seld = aetypes.Type('cwnd'), fr=aeobj_0)
-    aeobj_2 = aetypes.ObjectSpecifier(want = aetypes.Type('prop'),
-            form = 'prop', seld = aetypes.Type('pvew'), fr=aeobj_1)
-    aeobj_3 = aetypes.ObjectSpecifier(want = aetypes.Type('prop'),
-            form = 'prop', seld = _v, fr=None)
-    _code = 'core'
-    _subcode = 'setd'
-    args['----'] = aeobj_2
-    args['data'] = aeobj_3
-    _reply, args, attrs = finder.send(_code, _subcode, args, attrs)
-    if 'errn' in args:
-        raise Error(aetools.decodeerror(args))
-    if '----' in args:
-        return args['----']
-
-def _getwindowview(folder_alias):
-    """get the windowview"""
-    attrs = {}
-    args = {}
-    finder = _getfinder()
-    args = {}
-    attrs = {}
-    aeobj_00 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'), form="alis", seld=folder_alias, fr=None)
-    aeobj_01 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('cwnd'), fr=aeobj_00)
-    aeobj_02 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('pvew'), fr=aeobj_01)
-    args['----'] = aeobj_02
-    _reply, args, attrs = finder.send("core", "getd", args, attrs)
-    if 'errn' in args:
-        raise Error(aetools.decodeerror(args))
-    views = {'iimg':0, 'pnam':1, 'lgbu':2}
-    if '----' in args:
-        return views[args['----'].enum]
-
-def windowsize(folder, size=None):
-    """Set the size of a Finder window for folder to size=(w, h), Specify by path.
-    If size=None, windowsize will return the current size of the window.
-    Specify file by name or fsspec.
-    """
-    fsr = Carbon.File.FSRef(folder)
-    folder_alias = fsr.FSNewAliasMinimal()
-    openwindow(fsr)
-    if not size:
-        return _getwindowsize(folder_alias)
-    return _setwindowsize(folder_alias, size)
-
-def _setwindowsize(folder_alias, size):
-    """Set the size of a Finder window for folder to (w, h)"""
-    w, h = size
-    finder = _getfinder()
-    args = {}
-    attrs = {}
-    _code = 'core'
-    _subcode = 'setd'
-    aevar00 = [w, h]
-    aeobj_0 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'),
-            form="alis", seld=folder_alias, fr=None)
-    aeobj_1 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'),
-            form="prop", seld=aetypes.Type('cwnd'), fr=aeobj_0)
-    aeobj_2 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'),
-            form="prop", seld=aetypes.Type('ptsz'), fr=aeobj_1)
-    args['----'] = aeobj_2
-    args["data"] = aevar00
-    _reply, args, attrs = finder.send(_code, _subcode, args, attrs)
-    if 'errn' in args:
-        raise Error(aetools.decodeerror(args))
-    return (w, h)
-
-def _getwindowsize(folder_alias):
-    """Set the size of a Finder window for folder to (w, h)"""
-    finder = _getfinder()
-    args = {}
-    attrs = {}
-    aeobj_0 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'),
-            form="alis", seld=folder_alias, fr=None)
-    aeobj_1 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'),
-            form="prop", seld=aetypes.Type('cwnd'), fr=aeobj_0)
-    aeobj_2 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'),
-            form="prop", seld=aetypes.Type('posn'), fr=aeobj_1)
-    args['----'] = aeobj_2
-    _reply, args, attrs = finder.send('core', 'getd', args, attrs)
-    if 'errn' in args:
-        raise Error(aetools.decodeerror(args))
-    if '----' in args:
-        return args['----']
-
-def windowposition(folder, pos=None):
-    """Set the position of a Finder window for folder to pos=(w, h)."""
-    fsr = Carbon.File.FSRef(folder)
-    folder_alias = fsr.FSNewAliasMinimal()
-    openwindow(fsr)
-    if not pos:
-        return _getwindowposition(folder_alias)
-    if aetypes.IsQDPoint(pos):
-        # QDPoint object as returned by _getwindowposition
-        pos = (pos.h, pos.v)
-    return _setwindowposition(folder_alias, pos)
-
-def _setwindowposition(folder_alias, position):
-    """Set the size of a Finder window for folder to (w, h)."""
-    x, y = position
-    finder = _getfinder()
-    args = {}
-    attrs = {}
-    aeobj_0 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'),
-            form="alis", seld=folder_alias, fr=None)
-    aeobj_1 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'),
-            form="prop", seld=aetypes.Type('cwnd'), fr=aeobj_0)
-    aeobj_2 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'),
-            form="prop", seld=aetypes.Type('posn'), fr=aeobj_1)
-    args['----'] = aeobj_2
-    args["data"] = [x, y]
-    _reply, args, attrs = finder.send('core', 'setd', args, attrs)
-    if 'errn' in args:
-        raise Error(aetools.decodeerror(args))
-    if '----' in args:
-        return args['----']
-
-def _getwindowposition(folder_alias):
-    """Get the size of a Finder window for folder, Specify by path."""
-    finder = _getfinder()
-    args = {}
-    attrs = {}
-    aeobj_0 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'),
-            form="alis", seld=folder_alias, fr=None)
-    aeobj_1 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'),
-            form="prop", seld=aetypes.Type('cwnd'), fr=aeobj_0)
-    aeobj_2 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'),
-            form="prop", seld=aetypes.Type('ptsz'), fr=aeobj_1)
-    args['----'] = aeobj_2
-    _reply, args, attrs = finder.send('core', 'getd', args, attrs)
-    if 'errn' in args:
-        raise Error(aetools.decodeerror(args))
-    if '----' in args:
-        return args['----']
-
-def icon(object, icondata=None):
-    """icon sets the icon of object, if no icondata is given,
-    icon will return an AE object with binary data for the current icon.
-    If left untouched, this data can be used to paste the icon on another file.
-    Development opportunity: get and set the data as PICT."""
-    fsr = Carbon.File.FSRef(object)
-    object_alias = fsr.FSNewAliasMinimal()
-    if icondata is None:
-        return _geticon(object_alias)
-    return _seticon(object_alias, icondata)
-
-def _geticon(object_alias):
-    """get the icondata for object. Binary data of some sort."""
-    finder = _getfinder()
-    args = {}
-    attrs = {}
-    aeobj_00 = aetypes.ObjectSpecifier(want=aetypes.Type('cobj'),
-            form="alis", seld=object_alias, fr=None)
-    aeobj_01 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'),
-            form="prop", seld=aetypes.Type('iimg'), fr=aeobj_00)
-    args['----'] = aeobj_01
-    _reply, args, attrs = finder.send("core", "getd", args, attrs)
-    if 'errn' in args:
-        raise Error(aetools.decodeerror(args))
-    if '----' in args:
-        return args['----']
-
-def _seticon(object_alias, icondata):
-    """set the icondata for object, formatted as produced by _geticon()"""
-    finder = _getfinder()
-    args = {}
-    attrs = {}
-    aeobj_00 = aetypes.ObjectSpecifier(want=aetypes.Type('cobj'),
-            form="alis", seld=object_alias, fr=None)
-    aeobj_01 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'),
-            form="prop", seld=aetypes.Type('iimg'), fr=aeobj_00)
-    args['----'] = aeobj_01
-    args["data"] = icondata
-    _reply, args, attrs = finder.send("core", "setd", args, attrs)
-    if 'errn' in args:
-        raise Error(aetools.decodeerror(args))
-    if '----' in args:
-        return args['----'].data
-
-
-#---------------------------------------------------
-#   Volumes and servers.
-
-def mountvolume(volume, server=None, username=None, password=None):
-    """mount a volume, local or on a server on AppleTalk.
-    Note: mounting a ASIP server requires a different operation.
-    server is the name of the server where the volume belongs
-    username, password belong to a registered user of the volume."""
-    finder = _getfinder()
-    args = {}
-    attrs = {}
-    if password:
-        args["PASS"] = password
-    if username:
-        args["USER"] = username
-    if server:
-        args["SRVR"] = server
-    args['----'] = volume
-    _reply, args, attrs = finder.send("aevt", "mvol", args, attrs)
-    if 'errn' in args:
-        raise Error(aetools.decodeerror(args))
-    if '----' in args:
-        return args['----']
-
-def unmountvolume(volume):
-    """unmount a volume that's on the desktop"""
-    putaway(volume)
-
-def putaway(object):
-    """puth the object away, whereever it came from."""
-    finder = _getfinder()
-    args = {}
-    attrs = {}
-    args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('cdis'), form="name", seld=object, fr=None)
-    _reply, args, attrs = talker.send("fndr", "ptwy", args, attrs)
-    if 'errn' in args:
-        raise Error(aetools.decodeerror(args))
-    if '----' in args:
-        return args['----']
-
-
-#---------------------------------------------------
-#   Miscellaneous functions
-#
-
-def volumelevel(level):
-    """set the audio output level, parameter between 0 (silent) and 7 (full blast)"""
-    finder = _getfinder()
-    args = {}
-    attrs = {}
-    if level < 0:
-        level = 0
-    elif level > 7:
-        level = 7
-    args['----'] = level
-    _reply, args, attrs = finder.send("aevt", "stvl", args, attrs)
-    if 'errn' in args:
-        raise Error(aetools.decodeerror(args))
-    if '----' in args:
-        return args['----']
-
-def OSversion():
-    """return the version of the system software"""
-    finder = _getfinder()
-    args = {}
-    attrs = {}
-    aeobj_00 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('ver2'), fr=None)
-    args['----'] = aeobj_00
-    _reply, args, attrs = finder.send("core", "getd", args, attrs)
-    if 'errn' in args:
-        raise Error(aetools.decodeerror(args))
-    if '----' in args:
-        return args['----']
-
-def filesharing():
-    """return the current status of filesharing and whether it is starting up or not:
-        -1  file sharing is off and not starting up
-        0   file sharing is off and starting up
-        1   file sharing is on"""
-    status = -1
-    finder = _getfinder()
-    # see if it is on
-    args = {}
-    attrs = {}
-    args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('fshr'), fr=None)
-    _reply, args, attrs = finder.send("core", "getd", args, attrs)
-    if 'errn' in args:
-        raise Error(aetools.decodeerror(args))
-    if '----' in args:
-        if args['----'] == 0:
-            status = -1
-        else:
-            status = 1
-    # is it starting up perchance?
-    args = {}
-    attrs = {}
-    args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('fsup'), fr=None)
-    _reply, args, attrs = finder.send("core", "getd", args, attrs)
-    if 'errn' in args:
-        raise Error(aetools.decodeerror(args))
-    if '----' in args:
-        if args['----'] == 1:
-            status = 0
-    return status
-
-def movetotrash(path):
-    """move the object to the trash"""
-    fss = Carbon.File.FSSpec(path)
-    trashfolder = Carbon.Folder.FSFindFolder(fss.as_tuple()[0], 'trsh', 0)
-    move(path, trashfolder)
-
-def emptytrash():
-    """empty the trash"""
-    finder = _getfinder()
-    args = {}
-    attrs = {}
-    args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('trsh'), fr=None)
-    _reply, args, attrs = finder.send("fndr", "empt", args, attrs)
-    if 'errn' in args:
-        raise aetools.Error(aetools.decodeerror(args))
-
-
-def _test():
-    import EasyDialogs
-    print('Original findertools functionality test...')
-    print('Testing launch...')
-    pathname = EasyDialogs.AskFileForOpen('File to launch:')
-    if pathname:
-        result = launch(pathname)
-        if result:
-            print('Result: ', result)
-        print('Press return-', end=' ')
-        sys.stdin.readline()
-    print('Testing print...')
-    pathname = EasyDialogs.AskFileForOpen('File to print:')
-    if pathname:
-        result = Print(pathname)
-        if result:
-            print('Result: ', result)
-        print('Press return-', end=' ')
-        sys.stdin.readline()
-    print('Testing copy...')
-    pathname = EasyDialogs.AskFileForOpen('File to copy:')
-    if pathname:
-        destdir = EasyDialogs.AskFolder('Destination:')
-        if destdir:
-            result = copy(pathname, destdir)
-            if result:
-                print('Result:', result)
-            print('Press return-', end=' ')
-            sys.stdin.readline()
-    print('Testing move...')
-    pathname = EasyDialogs.AskFileForOpen('File to move:')
-    if pathname:
-        destdir = EasyDialogs.AskFolder('Destination:')
-        if destdir:
-            result = move(pathname, destdir)
-            if result:
-                print('Result:', result)
-            print('Press return-', end=' ')
-            sys.stdin.readline()
-    print('Testing sleep...')
-    if EasyDialogs.AskYesNoCancel('Sleep?') > 0:
-        result = sleep()
-        if result:
-            print('Result:', result)
-        print('Press return-', end=' ')
-        sys.stdin.readline()
-    print('Testing shutdown...')
-    if EasyDialogs.AskYesNoCancel('Shut down?') > 0:
-        result = shutdown()
-        if result:
-            print('Result:', result)
-        print('Press return-', end=' ')
-        sys.stdin.readline()
-    print('Testing restart...')
-    if EasyDialogs.AskYesNoCancel('Restart?') > 0:
-        result = restart()
-        if result:
-            print('Result:', result)
-        print('Press return-', end=' ')
-        sys.stdin.readline()
-
-def _test2():
-    print('\nmorefindertools version %s\nTests coming up...' %__version__)
-    import os
-    import random
-
-    # miscellaneous
-    print('\tfilesharing on?',  filesharing())       # is file sharing on, off, starting up?
-    print('\tOS version',       OSversion())     # the version of the system software
-
-    # set the soundvolume in a simple way
-    print('\tSystem beep volume')
-    for i in range(0, 7):
-        volumelevel(i)
-        MacOS.SysBeep()
-
-    # Finder's windows, file location, file attributes
-    open("@findertoolstest", "w")
-    f = "@findertoolstest"
-    reveal(f)               # reveal this file in a Finder window
-    select(f)               # select this file
-
-    base, file = os.path.split(f)
-    closewindow(base)   # close the window this file is in  (opened by reveal)
-    openwindow(base)        # open it again
-    windowview(base, 1) # set the view by list
-
-    label(f, 2)             # set the label of this file to something orange
-    print('\tlabel', label(f))   # get the label of this file
-
-    # the file location only works in a window with icon view!
-    print('Random locations for an icon')
-    windowview(base, 0)     # set the view by icon
-    windowsize(base, (600, 600))
-    for i in range(50):
-        location(f, (random.randint(10, 590), random.randint(10, 590)))
-
-    windowsize(base, (200, 400))
-    windowview(base, 1)     # set the view by icon
-
-    orgpos = windowposition(base)
-    print('Animated window location')
-    for i in range(10):
-        pos = (100+i*10, 100+i*10)
-        windowposition(base, pos)
-        print('\twindow position', pos)
-    windowposition(base, orgpos)    # park it where it was before
-
-    print('Put a comment in file', f, ':')
-    print('\t', comment(f))      # print the Finder comment this file has
-    s = 'This is a comment no one reads!'
-    comment(f, s)           # set the Finder comment
-
-def _test3():
-    print('MacOS9 or better specific functions')
-    # processes
-    pr = processes()        # return a list of tuples with (active_processname, creatorcode)
-    print('Return a list of current active processes:')
-    for p in pr:
-        print('\t', p)
-
-    # get attributes of the first process in the list
-    print('Attributes of the first process in the list:')
-    pinfo = processinfo(pr[0][0])
-    print('\t', pr[0][0])
-    print('\t\tmemory partition', pinfo.partition)       # the memory allocated to this process
-    print('\t\tmemory used', pinfo.used)         # the memory actuall used by this process
-    print('\t\tis visible', pinfo.visible)           # is the process visible to the user
-    print('\t\tis frontmost', pinfo.frontmost)       # is the process the front most one?
-    print('\t\thas scripting', pinfo.hasscripting)       # is the process scriptable?
-    print('\t\taccepts high level events',  pinfo.accepthighlevel)   # does the process accept high level appleevents?
-
-if __name__ == '__main__':
-    _test()
-    _test2()
-    _test3()

Deleted: python/branches/py3k/Lib/plat-mac/gensuitemodule.py
==============================================================================
--- python/branches/py3k/Lib/plat-mac/gensuitemodule.py	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,1213 +0,0 @@
-"""
-gensuitemodule - Generate an AE suite module from an aete/aeut resource
-
-Based on aete.py.
-
-Reading and understanding this code is left as an exercise to the reader.
-"""
-
-import MacOS
-import EasyDialogs
-import os
-import string
-import sys
-import types
-import io
-import keyword
-import macresource
-import aetools
-import distutils.sysconfig
-import OSATerminology
-from Carbon.Res import *
-import Carbon.Folder
-import MacOS
-import getopt
-import plistlib
-
-_MAC_LIB_FOLDER=os.path.dirname(aetools.__file__)
-DEFAULT_STANDARD_PACKAGEFOLDER=os.path.join(_MAC_LIB_FOLDER, 'lib-scriptpackages')
-DEFAULT_USER_PACKAGEFOLDER=distutils.sysconfig.get_python_lib()
-
-def usage():
-    sys.stderr.write("Usage: %s [opts] application-or-resource-file\n" % sys.argv[0])
-    sys.stderr.write("""Options:
---output pkgdir  Pathname of the output package (short: -o)
---resource       Parse resource file in stead of launching application (-r)
---base package   Use another base package in stead of default StdSuites (-b)
---edit old=new   Edit suite names, use empty new to skip a suite (-e)
---creator code   Set creator code for package (-c)
---dump           Dump aete resource to stdout in stead of creating module (-d)
---verbose        Tell us what happens (-v)
-""")
-    sys.exit(1)
-
-def main():
-    if len(sys.argv) > 1:
-        SHORTOPTS = "rb:o:e:c:dv"
-        LONGOPTS = ("resource", "base=", "output=", "edit=", "creator=", "dump", "verbose")
-        try:
-            opts, args = getopt.getopt(sys.argv[1:], SHORTOPTS, LONGOPTS)
-        except getopt.GetoptError:
-            usage()
-
-        process_func = processfile
-        basepkgname = 'StdSuites'
-        output = None
-        edit_modnames = []
-        creatorsignature = None
-        dump = None
-        verbose = None
-
-        for o, a in opts:
-            if o in ('-r', '--resource'):
-                process_func = processfile_fromresource
-            if o in ('-b', '--base'):
-                basepkgname = a
-            if o in ('-o', '--output'):
-                output = a
-            if o in ('-e', '--edit'):
-                split = a.split('=')
-                if len(split) != 2:
-                    usage()
-                edit_modnames.append(split)
-            if o in ('-c', '--creator'):
-                if len(a) != 4:
-                    sys.stderr.write("creator must be 4-char string\n")
-                    sys.exit(1)
-                creatorsignature = a
-            if o in ('-d', '--dump'):
-                dump = sys.stdout
-            if o in ('-v', '--verbose'):
-                verbose = sys.stderr
-
-
-        if output and len(args) > 1:
-            sys.stderr.write("%s: cannot specify --output with multiple inputs\n" % sys.argv[0])
-            sys.exit(1)
-
-        for filename in args:
-            process_func(filename, output=output, basepkgname=basepkgname,
-                edit_modnames=edit_modnames, creatorsignature=creatorsignature,
-                dump=dump, verbose=verbose)
-    else:
-        main_interactive()
-
-def main_interactive(interact=0, basepkgname='StdSuites'):
-    if interact:
-        # Ask for save-filename for each module
-        edit_modnames = None
-    else:
-        # Use default filenames for each module
-        edit_modnames = []
-    appsfolder = Carbon.Folder.FSFindFolder(-32765, 'apps', 0)
-    filename = EasyDialogs.AskFileForOpen(
-        message='Select scriptable application',
-        dialogOptionFlags=0x1056,       # allow selection of .app bundles
-        defaultLocation=appsfolder)
-    if not filename:
-        return
-    if not is_scriptable(filename):
-        if EasyDialogs.AskYesNoCancel(
-                "Warning: application does not seem scriptable",
-                yes="Continue", default=2, no="") <= 0:
-            return
-    try:
-        processfile(filename, edit_modnames=edit_modnames, basepkgname=basepkgname,
-        verbose=sys.stderr)
-    except MacOS.Error as arg:
-        print("Error getting terminology:", arg)
-        print("Retry, manually parsing resources")
-        processfile_fromresource(filename, edit_modnames=edit_modnames,
-            basepkgname=basepkgname, verbose=sys.stderr)
-
-def is_scriptable(application):
-    """Return true if the application is scriptable"""
-    if os.path.isdir(application):
-        plistfile = os.path.join(application, 'Contents', 'Info.plist')
-        if not os.path.exists(plistfile):
-            return False
-        plist = plistlib.Plist.fromFile(plistfile)
-        return plist.get('NSAppleScriptEnabled', False)
-    # If it is a file test for an aete/aeut resource.
-    currf = CurResFile()
-    try:
-        refno = macresource.open_pathname(application)
-    except MacOS.Error:
-        return False
-    UseResFile(refno)
-    n_terminology = Count1Resources('aete') + Count1Resources('aeut') + \
-        Count1Resources('scsz') + Count1Resources('osiz')
-    CloseResFile(refno)
-    UseResFile(currf)
-    return n_terminology > 0
-
-def processfile_fromresource(fullname, output=None, basepkgname=None,
-        edit_modnames=None, creatorsignature=None, dump=None, verbose=None):
-    """Process all resources in a single file"""
-    if not is_scriptable(fullname) and verbose:
-        print("Warning: app does not seem scriptable: %s" % fullname, file=verbose)
-    cur = CurResFile()
-    if verbose:
-        print("Processing", fullname, file=verbose)
-    rf = macresource.open_pathname(fullname)
-    try:
-        UseResFile(rf)
-        resources = []
-        for i in range(Count1Resources('aete')):
-            res = Get1IndResource('aete', 1+i)
-            resources.append(res)
-        for i in range(Count1Resources('aeut')):
-            res = Get1IndResource('aeut', 1+i)
-            resources.append(res)
-        if verbose:
-            print("\nLISTING aete+aeut RESOURCES IN", repr(fullname), file=verbose)
-        aetelist = []
-        for res in resources:
-            if verbose:
-                print("decoding", res.GetResInfo(), "...", file=verbose)
-            data = res.data
-            aete = decode(data, verbose)
-            aetelist.append((aete, res.GetResInfo()))
-    finally:
-        if rf != cur:
-            CloseResFile(rf)
-            UseResFile(cur)
-    # switch back (needed for dialogs in Python)
-    UseResFile(cur)
-    if dump:
-        dumpaetelist(aetelist, dump)
-    compileaetelist(aetelist, fullname, output=output,
-        basepkgname=basepkgname, edit_modnames=edit_modnames,
-        creatorsignature=creatorsignature, verbose=verbose)
-
-def processfile(fullname, output=None, basepkgname=None,
-        edit_modnames=None, creatorsignature=None, dump=None,
-        verbose=None):
-    """Ask an application for its terminology and process that"""
-    if not is_scriptable(fullname) and verbose:
-        print("Warning: app does not seem scriptable: %s" % fullname, file=verbose)
-    if verbose:
-        print("\nASKING FOR aete DICTIONARY IN", repr(fullname), file=verbose)
-    try:
-        aedescobj, launched = OSATerminology.GetAppTerminology(fullname)
-    except MacOS.Error as arg:
-        if arg.args[0] in (-1701, -192): # errAEDescNotFound, resNotFound
-            if verbose:
-                print("GetAppTerminology failed with errAEDescNotFound/resNotFound, trying manually", file=verbose)
-            aedata, sig = getappterminology(fullname, verbose=verbose)
-            if not creatorsignature:
-                creatorsignature = sig
-        else:
-            raise
-    else:
-        if launched:
-            if verbose:
-                print("Launched", fullname, file=verbose)
-        raw = aetools.unpack(aedescobj)
-        if not raw:
-            if verbose:
-                print('Unpack returned empty value:', raw, file=verbose)
-            return
-        if not raw[0].data:
-            if verbose:
-                print('Unpack returned value without data:', raw, file=verbose)
-            return
-        aedata = raw[0]
-    aete = decode(aedata.data, verbose)
-    if dump:
-        dumpaetelist([aete], dump)
-        return
-    compileaete(aete, None, fullname, output=output, basepkgname=basepkgname,
-        creatorsignature=creatorsignature, edit_modnames=edit_modnames,
-        verbose=verbose)
-
-def getappterminology(fullname, verbose=None):
-    """Get application terminology by sending an AppleEvent"""
-    # First check that we actually can send AppleEvents
-    if not MacOS.WMAvailable():
-        raise RuntimeError("Cannot send AppleEvents, no access to window manager")
-    # Next, a workaround for a bug in MacOS 10.2: sending events will hang unless
-    # you have created an event loop first.
-    import Carbon.Evt
-    Carbon.Evt.WaitNextEvent(0,0)
-    if os.path.isdir(fullname):
-        # Now get the signature of the application, hoping it is a bundle
-        pkginfo = os.path.join(fullname, 'Contents', 'PkgInfo')
-        if not os.path.exists(pkginfo):
-            raise RuntimeError("No PkgInfo file found")
-        tp_cr = open(pkginfo, 'rb').read()
-        cr = tp_cr[4:8]
-    else:
-        # Assume it is a file
-        cr, tp = MacOS.GetCreatorAndType(fullname)
-    # Let's talk to it and ask for its AETE
-    talker = aetools.TalkTo(cr)
-    try:
-        talker._start()
-    except (MacOS.Error, aetools.Error) as arg:
-        if verbose:
-            print('Warning: start() failed, continuing anyway:', arg, file=verbose)
-    reply = talker.send("ascr", "gdte")
-    #reply2 = talker.send("ascr", "gdut")
-    # Now pick the bits out of the return that we need.
-    return reply[1]['----'], cr
-
-
-def compileaetelist(aetelist, fullname, output=None, basepkgname=None,
-            edit_modnames=None, creatorsignature=None, verbose=None):
-    for aete, resinfo in aetelist:
-        compileaete(aete, resinfo, fullname, output=output,
-            basepkgname=basepkgname, edit_modnames=edit_modnames,
-            creatorsignature=creatorsignature, verbose=verbose)
-
-def dumpaetelist(aetelist, output):
-    import pprint
-    pprint.pprint(aetelist, output)
-
-def decode(data, verbose=None):
-    """Decode a resource into a python data structure"""
-    f = io.StringIO(data)
-    aete = generic(getaete, f)
-    aete = simplify(aete)
-    processed = f.tell()
-    unprocessed = len(f.read())
-    total = f.tell()
-    if unprocessed and verbose:
-        verbose.write("%d processed + %d unprocessed = %d total\n" %
-                         (processed, unprocessed, total))
-    return aete
-
-def simplify(item):
-    """Recursively replace singleton tuples by their constituent item"""
-    if isinstance(item, list):
-        return map(simplify, item)
-    elif isinstance(item, tuple) and len(item) == 2:
-        return simplify(item[1])
-    else:
-        return item
-
-
-# Here follows the aete resource decoder.
-# It is presented bottom-up instead of top-down because there are  direct
-# references to the lower-level part-decoders from the high-level part-decoders.
-
-def getbyte(f, *args):
-    c = f.read(1)
-    if not c:
-        raise EOFError('in getbyte' + str(args))
-    return ord(c)
-
-def getword(f, *args):
-    getalign(f)
-    s = f.read(2)
-    if len(s) < 2:
-        raise EOFError('in getword' + str(args))
-    return (ord(s[0])<<8) | ord(s[1])
-
-def getlong(f, *args):
-    getalign(f)
-    s = f.read(4)
-    if len(s) < 4:
-        raise EOFError('in getlong' + str(args))
-    return (ord(s[0])<<24) | (ord(s[1])<<16) | (ord(s[2])<<8) | ord(s[3])
-
-def getostype(f, *args):
-    getalign(f)
-    s = f.read(4)
-    if len(s) < 4:
-        raise EOFError('in getostype' + str(args))
-    return s
-
-def getpstr(f, *args):
-    c = f.read(1)
-    if len(c) < 1:
-        raise EOFError('in getpstr[1]' + str(args))
-    nbytes = ord(c)
-    if nbytes == 0: return ''
-    s = f.read(nbytes)
-    if len(s) < nbytes:
-        raise EOFError('in getpstr[2]' + str(args))
-    return s
-
-def getalign(f):
-    if f.tell() & 1:
-        c = f.read(1)
-        ##if c != '\0':
-        ##  print align:', repr(c)
-
-def getlist(f, description, getitem):
-    count = getword(f)
-    list = []
-    for i in range(count):
-        list.append(generic(getitem, f))
-        getalign(f)
-    return list
-
-def alt_generic(what, f, *args):
-    print("generic", repr(what), args)
-    res = vageneric(what, f, args)
-    print('->', repr(res))
-    return res
-
-def generic(what, f, *args):
-    if type(what) == types.FunctionType:
-        return what(f, *args)
-    if isinstance(what, list):
-        record = []
-        for thing in what:
-            item = generic(thing[:1], f, *thing[1:])
-            record.append((thing[1], item))
-        return record
-    return "BAD GENERIC ARGS: %r" % (what,)
-
-getdata = [
-    (getostype, "type"),
-    (getpstr, "description"),
-    (getword, "flags")
-    ]
-getargument = [
-    (getpstr, "name"),
-    (getostype, "keyword"),
-    (getdata, "what")
-    ]
-getevent = [
-    (getpstr, "name"),
-    (getpstr, "description"),
-    (getostype, "suite code"),
-    (getostype, "event code"),
-    (getdata, "returns"),
-    (getdata, "accepts"),
-    (getlist, "optional arguments", getargument)
-    ]
-getproperty = [
-    (getpstr, "name"),
-    (getostype, "code"),
-    (getdata, "what")
-    ]
-getelement = [
-    (getostype, "type"),
-    (getlist, "keyform", getostype)
-    ]
-getclass = [
-    (getpstr, "name"),
-    (getostype, "class code"),
-    (getpstr, "description"),
-    (getlist, "properties", getproperty),
-    (getlist, "elements", getelement)
-    ]
-getcomparison = [
-    (getpstr, "operator name"),
-    (getostype, "operator ID"),
-    (getpstr, "operator comment"),
-    ]
-getenumerator = [
-    (getpstr, "enumerator name"),
-    (getostype, "enumerator ID"),
-    (getpstr, "enumerator comment")
-    ]
-getenumeration = [
-    (getostype, "enumeration ID"),
-    (getlist, "enumerator", getenumerator)
-    ]
-getsuite = [
-    (getpstr, "suite name"),
-    (getpstr, "suite description"),
-    (getostype, "suite ID"),
-    (getword, "suite level"),
-    (getword, "suite version"),
-    (getlist, "events", getevent),
-    (getlist, "classes", getclass),
-    (getlist, "comparisons", getcomparison),
-    (getlist, "enumerations", getenumeration)
-    ]
-getaete = [
-    (getword, "major/minor version in BCD"),
-    (getword, "language code"),
-    (getword, "script code"),
-    (getlist, "suites", getsuite)
-    ]
-
-def compileaete(aete, resinfo, fname, output=None, basepkgname=None,
-        edit_modnames=None, creatorsignature=None, verbose=None):
-    """Generate code for a full aete resource. fname passed for doc purposes"""
-    [version, language, script, suites] = aete
-    major, minor = divmod(version, 256)
-    if not creatorsignature:
-        creatorsignature, dummy = MacOS.GetCreatorAndType(fname)
-    packagename = identify(os.path.splitext(os.path.basename(fname))[0])
-    if language:
-        packagename = packagename+'_lang%d'%language
-    if script:
-        packagename = packagename+'_script%d'%script
-    if len(packagename) > 27:
-        packagename = packagename[:27]
-    if output:
-        # XXXX Put this in site-packages if it isn't a full pathname?
-        if not os.path.exists(output):
-            os.mkdir(output)
-        pathname = output
-    else:
-        pathname = EasyDialogs.AskFolder(message='Create and select package folder for %s'%packagename,
-            defaultLocation=DEFAULT_USER_PACKAGEFOLDER)
-        output = pathname
-    if not pathname:
-        return
-    packagename = os.path.split(os.path.normpath(pathname))[1]
-    if not basepkgname:
-        basepkgname = EasyDialogs.AskFolder(message='Package folder for base suite (usually StdSuites)',
-            defaultLocation=DEFAULT_STANDARD_PACKAGEFOLDER)
-    if basepkgname:
-        dirname, basepkgname = os.path.split(os.path.normpath(basepkgname))
-        if dirname and not dirname in sys.path:
-            sys.path.insert(0, dirname)
-        basepackage = __import__(basepkgname)
-    else:
-        basepackage = None
-    suitelist = []
-    allprecompinfo = []
-    allsuites = []
-    for suite in suites:
-        compiler = SuiteCompiler(suite, basepackage, output, edit_modnames, verbose)
-        code, modname, precompinfo = compiler.precompilesuite()
-        if not code:
-            continue
-        allprecompinfo = allprecompinfo + precompinfo
-        suiteinfo = suite, pathname, modname
-        suitelist.append((code, modname))
-        allsuites.append(compiler)
-    for compiler in allsuites:
-        compiler.compilesuite(major, minor, language, script, fname, allprecompinfo)
-    initfilename = os.path.join(output, '__init__.py')
-    fp = open(initfilename, 'w')
-    MacOS.SetCreatorAndType(initfilename, 'Pyth', 'TEXT')
-    fp.write('"""\n')
-    fp.write("Package generated from %s\n"%ascii(fname))
-    if resinfo:
-        fp.write("Resource %s resid %d %s\n"%(ascii(resinfo[1]), resinfo[0], ascii(resinfo[2])))
-    fp.write('"""\n')
-    fp.write('import aetools\n')
-    fp.write('Error = aetools.Error\n')
-    suitelist.sort()
-    for code, modname in suitelist:
-        fp.write("import %s\n" % modname)
-    fp.write("\n\n_code_to_module = {\n")
-    for code, modname in suitelist:
-        fp.write("    '%s' : %s,\n"%(ascii(code), modname))
-    fp.write("}\n\n")
-    fp.write("\n\n_code_to_fullname = {\n")
-    for code, modname in suitelist:
-        fp.write("    '%s' : ('%s.%s', '%s'),\n"%(ascii(code), packagename, modname, modname))
-    fp.write("}\n\n")
-    for code, modname in suitelist:
-        fp.write("from %s import *\n"%modname)
-
-    # Generate property dicts and element dicts for all types declared in this module
-    fp.write("\ndef getbaseclasses(v):\n")
-    fp.write("    if not getattr(v, '_propdict', None):\n")
-    fp.write("        v._propdict = {}\n")
-    fp.write("        v._elemdict = {}\n")
-    fp.write("        for superclassname in getattr(v, '_superclassnames', []):\n")
-    fp.write("            superclass = eval(superclassname)\n")
-    fp.write("            getbaseclasses(superclass)\n")
-    fp.write("            v._propdict.update(getattr(superclass, '_propdict', {}))\n")
-    fp.write("            v._elemdict.update(getattr(superclass, '_elemdict', {}))\n")
-    fp.write("        v._propdict.update(getattr(v, '_privpropdict', {}))\n")
-    fp.write("        v._elemdict.update(getattr(v, '_privelemdict', {}))\n")
-    fp.write("\n")
-    fp.write("import StdSuites\n")
-    allprecompinfo.sort()
-    if allprecompinfo:
-        fp.write("\n#\n# Set property and element dictionaries now that all classes have been defined\n#\n")
-        for codenamemapper in allprecompinfo:
-            for k, v in codenamemapper.getall('class'):
-                fp.write("getbaseclasses(%s)\n" % v)
-
-    # Generate a code-to-name mapper for all of the types (classes) declared in this module
-    application_class = None
-    if allprecompinfo:
-        fp.write("\n#\n# Indices of types declared in this module\n#\n")
-        fp.write("_classdeclarations = {\n")
-        for codenamemapper in allprecompinfo:
-            for k, v in codenamemapper.getall('class'):
-                fp.write("    %r : %s,\n" % (k, v))
-                if k == 'capp':
-                    application_class = v
-        fp.write("}\n")
-
-
-    if suitelist:
-        fp.write("\n\nclass %s(%s_Events"%(packagename, suitelist[0][1]))
-        for code, modname in suitelist[1:]:
-            fp.write(",\n        %s_Events"%modname)
-        fp.write(",\n        aetools.TalkTo):\n")
-        fp.write("    _signature = %r\n\n"%(creatorsignature,))
-        fp.write("    _moduleName = '%s'\n\n"%packagename)
-        if application_class:
-            fp.write("    _elemdict = %s._elemdict\n" % application_class)
-            fp.write("    _propdict = %s._propdict\n" % application_class)
-    fp.close()
-
-class SuiteCompiler:
-    def __init__(self, suite, basepackage, output, edit_modnames, verbose):
-        self.suite = suite
-        self.basepackage = basepackage
-        self.edit_modnames = edit_modnames
-        self.output = output
-        self.verbose = verbose
-
-        # Set by precompilesuite
-        self.pathname = None
-        self.modname = None
-
-        # Set by compilesuite
-        self.fp = None
-        self.basemodule = None
-        self.enumsneeded = {}
-
-    def precompilesuite(self):
-        """Parse a single suite without generating the output. This step is needed
-        so we can resolve recursive references by suites to enums/comps/etc declared
-        in other suites"""
-        [name, desc, code, level, version, events, classes, comps, enums] = self.suite
-
-        modname = identify(name)
-        if len(modname) > 28:
-            modname = modname[:27]
-        if self.edit_modnames is None:
-            self.pathname = EasyDialogs.AskFileForSave(message='Python output file',
-                savedFileName=modname+'.py')
-        else:
-            for old, new in self.edit_modnames:
-                if old == modname:
-                    modname = new
-            if modname:
-                self.pathname = os.path.join(self.output, modname + '.py')
-            else:
-                self.pathname = None
-        if not self.pathname:
-            return None, None, None
-
-        self.modname = os.path.splitext(os.path.split(self.pathname)[1])[0]
-
-        if self.basepackage and code in self.basepackage._code_to_module:
-            # We are an extension of a baseclass (usually an application extending
-            # Standard_Suite or so). Import everything from our base module
-            basemodule = self.basepackage._code_to_module[code]
-        else:
-            # We are not an extension.
-            basemodule = None
-
-        self.enumsneeded = {}
-        for event in events:
-            self.findenumsinevent(event)
-
-        objc = ObjectCompiler(None, self.modname, basemodule, interact=(self.edit_modnames is None),
-            verbose=self.verbose)
-        for cls in classes:
-            objc.compileclass(cls)
-        for cls in classes:
-            objc.fillclasspropsandelems(cls)
-        for comp in comps:
-            objc.compilecomparison(comp)
-        for enum in enums:
-            objc.compileenumeration(enum)
-
-        for enum in self.enumsneeded.keys():
-            objc.checkforenum(enum)
-
-        objc.dumpindex()
-
-        precompinfo = objc.getprecompinfo(self.modname)
-
-        return code, self.modname, precompinfo
-
-    def compilesuite(self, major, minor, language, script, fname, precompinfo):
-        """Generate code for a single suite"""
-        [name, desc, code, level, version, events, classes, comps, enums] = self.suite
-        # Sort various lists, so re-generated source is easier compared
-        def class_sorter(k1, k2):
-            """Sort classes by code, and make sure main class sorts before synonyms"""
-            # [name, code, desc, properties, elements] = cls
-            if k1[1] < k2[1]: return -1
-            if k1[1] > k2[1]: return 1
-            if not k2[3] or k2[3][0][1] == 'c@#!':
-                # This is a synonym, the other one is better
-                return -1
-            if not k1[3] or k1[3][0][1] == 'c@#!':
-                # This is a synonym, the other one is better
-                return 1
-            return 0
-
-        events.sort()
-        classes.sort(class_sorter)
-        comps.sort()
-        enums.sort()
-
-        self.fp = fp = open(self.pathname, 'w')
-        MacOS.SetCreatorAndType(self.pathname, 'Pyth', 'TEXT')
-
-        fp.write('"""Suite %s: %s\n' % (ascii(name), ascii(desc)))
-        fp.write("Level %d, version %d\n\n" % (level, version))
-        fp.write("Generated from %s\n"%ascii(fname))
-        fp.write("AETE/AEUT resource version %d/%d, language %d, script %d\n" % \
-            (major, minor, language, script))
-        fp.write('"""\n\n')
-
-        fp.write('import aetools\n')
-        fp.write('import MacOS\n\n')
-        fp.write("_code = %r\n\n"% (code,))
-        if self.basepackage and code in self.basepackage._code_to_module:
-            # We are an extension of a baseclass (usually an application extending
-            # Standard_Suite or so). Import everything from our base module
-            fp.write('from %s import *\n'%self.basepackage._code_to_fullname[code][0])
-            basemodule = self.basepackage._code_to_module[code]
-        elif self.basepackage and code.lower() in self.basepackage._code_to_module:
-            # This is needed by CodeWarrior and some others.
-            fp.write('from %s import *\n'%self.basepackage._code_to_fullname[code.lower()][0])
-            basemodule = self.basepackage._code_to_module[code.lower()]
-        else:
-            # We are not an extension.
-            basemodule = None
-        self.basemodule = basemodule
-        self.compileclassheader()
-
-        self.enumsneeded = {}
-        if events:
-            for event in events:
-                self.compileevent(event)
-        else:
-            fp.write("    pass\n\n")
-
-        objc = ObjectCompiler(fp, self.modname, basemodule, precompinfo, interact=(self.edit_modnames is None),
-            verbose=self.verbose)
-        for cls in classes:
-            objc.compileclass(cls)
-        for cls in classes:
-            objc.fillclasspropsandelems(cls)
-        for comp in comps:
-            objc.compilecomparison(comp)
-        for enum in enums:
-            objc.compileenumeration(enum)
-
-        for enum in self.enumsneeded.keys():
-            objc.checkforenum(enum)
-
-        objc.dumpindex()
-
-    def compileclassheader(self):
-        """Generate class boilerplate"""
-        classname = '%s_Events'%self.modname
-        if self.basemodule:
-            modshortname = self.basemodule.__name__.split('.')[-1]
-            baseclassname = '%s_Events'%modshortname
-            self.fp.write("class %s(%s):\n\n"%(classname, baseclassname))
-        else:
-            self.fp.write("class %s:\n\n"%classname)
-
-    def compileevent(self, event):
-        """Generate code for a single event"""
-        [name, desc, code, subcode, returns, accepts, arguments] = event
-        fp = self.fp
-        funcname = identify(name)
-        #
-        # generate name->keyword map
-        #
-        if arguments:
-            fp.write("    _argmap_%s = {\n"%funcname)
-            for a in arguments:
-                fp.write("        %r : %r,\n"%(identify(a[0]), a[1]))
-            fp.write("    }\n\n")
-
-        #
-        # Generate function header
-        #
-        has_arg = (not is_null(accepts))
-        opt_arg = (has_arg and is_optional(accepts))
-
-        fp.write("    def %s(self, "%funcname)
-        if has_arg:
-            if not opt_arg:
-                fp.write("_object, ")       # Include direct object, if it has one
-            else:
-                fp.write("_object=None, ")  # Also include if it is optional
-        else:
-            fp.write("_no_object=None, ")   # For argument checking
-        fp.write("_attributes={}, **_arguments):\n")    # include attribute dict and args
-        #
-        # Generate doc string (important, since it may be the only
-        # available documentation, due to our name-remaping)
-        #
-        fp.write('        """%s: %s\n'%(ascii(name), ascii(desc)))
-        if has_arg:
-            fp.write("        Required argument: %s\n"%getdatadoc(accepts))
-        elif opt_arg:
-            fp.write("        Optional argument: %s\n"%getdatadoc(accepts))
-        for arg in arguments:
-            fp.write("        Keyword argument %s: %s\n"%(identify(arg[0]),
-                    getdatadoc(arg[2])))
-        fp.write("        Keyword argument _attributes: AppleEvent attribute dictionary\n")
-        if not is_null(returns):
-            fp.write("        Returns: %s\n"%getdatadoc(returns))
-        fp.write('        """\n')
-        #
-        # Fiddle the args so everything ends up in 'arguments' dictionary
-        #
-        fp.write("        _code = %r\n"% (code,))
-        fp.write("        _subcode = %r\n\n"% (subcode,))
-        #
-        # Do keyword name substitution
-        #
-        if arguments:
-            fp.write("        aetools.keysubst(_arguments, self._argmap_%s)\n"%funcname)
-        else:
-            fp.write("        if _arguments: raise TypeError, 'No optional args expected'\n")
-        #
-        # Stuff required arg (if there is one) into arguments
-        #
-        if has_arg:
-            fp.write("        _arguments['----'] = _object\n")
-        elif opt_arg:
-            fp.write("        if _object:\n")
-            fp.write("            _arguments['----'] = _object\n")
-        else:
-            fp.write("        if _no_object is not None: raise TypeError, 'No direct arg expected'\n")
-        fp.write("\n")
-        #
-        # Do enum-name substitution
-        #
-        for a in arguments:
-            if is_enum(a[2]):
-                kname = a[1]
-                ename = a[2][0]
-                if ename != '****':
-                    fp.write("        aetools.enumsubst(_arguments, %r, _Enum_%s)\n" %
-                        (kname, identify(ename)))
-                    self.enumsneeded[ename] = 1
-        fp.write("\n")
-        #
-        # Do the transaction
-        #
-        fp.write("        _reply, _arguments, _attributes = self.send(_code, _subcode,\n")
-        fp.write("                _arguments, _attributes)\n")
-        #
-        # Error handling
-        #
-        fp.write("        if _arguments.get('errn', 0):\n")
-        fp.write("            raise aetools.Error, aetools.decodeerror(_arguments)\n")
-        fp.write("        # XXXX Optionally decode result\n")
-        #
-        # Decode result
-        #
-        fp.write("        if '----' in _arguments:\n")
-        if is_enum(returns):
-            fp.write("            # XXXX Should do enum remapping here...\n")
-        fp.write("            return _arguments['----']\n")
-        fp.write("\n")
-
-    def findenumsinevent(self, event):
-        """Find all enums for a single event"""
-        [name, desc, code, subcode, returns, accepts, arguments] = event
-        for a in arguments:
-            if is_enum(a[2]):
-                ename = a[2][0]
-                if ename != '****':
-                    self.enumsneeded[ename] = 1
-
-#
-# This class stores the code<->name translations for a single module. It is used
-# to keep the information while we're compiling the module, but we also keep these objects
-# around so if one suite refers to, say, an enum in another suite we know where to
-# find it. Finally, if we really can't find a code, the user can add modules by
-# hand.
-#
-class CodeNameMapper:
-
-    def __init__(self, interact=1, verbose=None):
-        self.code2name = {
-            "property" : {},
-            "class" : {},
-            "enum" : {},
-            "comparison" : {},
-        }
-        self.name2code =  {
-            "property" : {},
-            "class" : {},
-            "enum" : {},
-            "comparison" : {},
-        }
-        self.modulename = None
-        self.star_imported = 0
-        self.can_interact = interact
-        self.verbose = verbose
-
-    def addnamecode(self, type, name, code):
-        self.name2code[type][name] = code
-        if code not in self.code2name[type]:
-            self.code2name[type][code] = name
-
-    def hasname(self, name):
-        for dict in self.name2code.values():
-            if name in dict:
-                return True
-        return False
-
-    def hascode(self, type, code):
-        return code in self.code2name[type]
-
-    def findcodename(self, type, code):
-        if not self.hascode(type, code):
-            return None, None, None
-        name = self.code2name[type][code]
-        if self.modulename and not self.star_imported:
-            qualname = '%s.%s'%(self.modulename, name)
-        else:
-            qualname = name
-        return name, qualname, self.modulename
-
-    def getall(self, type):
-        return self.code2name[type].items()
-
-    def addmodule(self, module, name, star_imported):
-        self.modulename = name
-        self.star_imported = star_imported
-        for code, name in module._propdeclarations.items():
-            self.addnamecode('property', name, code)
-        for code, name in module._classdeclarations.items():
-            self.addnamecode('class', name, code)
-        for code in module._enumdeclarations.keys():
-            self.addnamecode('enum', '_Enum_'+identify(code), code)
-        for code, name in module._compdeclarations.items():
-            self.addnamecode('comparison', name, code)
-
-    def prepareforexport(self, name=None):
-        if not self.modulename:
-            self.modulename = name
-        return self
-
-class ObjectCompiler:
-    def __init__(self, fp, modname, basesuite, othernamemappers=None, interact=1,
-            verbose=None):
-        self.fp = fp
-        self.verbose = verbose
-        self.basesuite = basesuite
-        self.can_interact = interact
-        self.modulename = modname
-        self.namemappers = [CodeNameMapper(self.can_interact, self.verbose)]
-        if othernamemappers:
-            self.othernamemappers = othernamemappers[:]
-        else:
-            self.othernamemappers = []
-        if basesuite:
-            basemapper = CodeNameMapper(self.can_interact, self.verbose)
-            basemapper.addmodule(basesuite, '', 1)
-            self.namemappers.append(basemapper)
-
-    def getprecompinfo(self, modname):
-        list = []
-        for mapper in self.namemappers:
-            emapper = mapper.prepareforexport(modname)
-            if emapper:
-                list.append(emapper)
-        return list
-
-    def findcodename(self, type, code):
-        while 1:
-            # First try: check whether we already know about this code.
-            for mapper in self.namemappers:
-                if mapper.hascode(type, code):
-                    return mapper.findcodename(type, code)
-            # Second try: maybe one of the other modules knows about it.
-            for mapper in self.othernamemappers:
-                if mapper.hascode(type, code):
-                    self.othernamemappers.remove(mapper)
-                    self.namemappers.append(mapper)
-                    if self.fp:
-                        self.fp.write("import %s\n"%mapper.modulename)
-                    break
-            else:
-                # If all this has failed we ask the user for a guess on where it could
-                # be and retry.
-                if self.fp:
-                    m = self.askdefinitionmodule(type, code)
-                else:
-                    m = None
-                if not m: return None, None, None
-                mapper = CodeNameMapper(self.can_interact, self.verbose)
-                mapper.addmodule(m, m.__name__, 0)
-                self.namemappers.append(mapper)
-
-    def hasname(self, name):
-        for mapper in self.othernamemappers:
-            if mapper.hasname(name) and mapper.modulename != self.modulename:
-                if self.verbose:
-                    print("Duplicate Python identifier:", name, self.modulename, mapper.modulename, file=self.verbose)
-                return True
-        return False
-
-    def askdefinitionmodule(self, type, code):
-        if not self.can_interact:
-            if self.verbose:
-                print("** No definition for %s '%s' found" % (type, code), file=self.verbose)
-            return None
-        path = EasyDialogs.AskFileForSave(message='Where is %s %s declared?'%(type, code))
-        if not path: return
-        path, file = os.path.split(path)
-        modname = os.path.splitext(file)[0]
-        if not path in sys.path:
-            sys.path.insert(0, path)
-        m = __import__(modname)
-        self.fp.write("import %s\n"%modname)
-        return m
-
-    def compileclass(self, cls):
-        [name, code, desc, properties, elements] = cls
-        pname = identify(name)
-        if self.namemappers[0].hascode('class', code):
-            # plural forms and such
-            othername, dummy, dummy = self.namemappers[0].findcodename('class', code)
-            if self.fp:
-                self.fp.write("\n%s = %s\n"%(pname, othername))
-        else:
-            if self.fp:
-                self.fp.write('\nclass %s(aetools.ComponentItem):\n' % pname)
-                self.fp.write('    """%s - %s """\n' % (ascii(name), ascii(desc)))
-                self.fp.write('    want = %r\n' % (code,))
-        self.namemappers[0].addnamecode('class', pname, code)
-        is_application_class = (code == 'capp')
-        properties.sort()
-        for prop in properties:
-            self.compileproperty(prop, is_application_class)
-        elements.sort()
-        for elem in elements:
-            self.compileelement(elem)
-
-    def compileproperty(self, prop, is_application_class=False):
-        [name, code, what] = prop
-        if code == 'c@#!':
-            # Something silly with plurals. Skip it.
-            return
-        pname = identify(name)
-        if self.namemappers[0].hascode('property', code):
-            # plural forms and such
-            othername, dummy, dummy = self.namemappers[0].findcodename('property', code)
-            if pname == othername:
-                return
-            if self.fp:
-                self.fp.write("\n_Prop_%s = _Prop_%s\n"%(pname, othername))
-        else:
-            if self.fp:
-                self.fp.write("class _Prop_%s(aetools.NProperty):\n" % pname)
-                self.fp.write('    """%s - %s """\n' % (ascii(name), ascii(what[1])))
-                self.fp.write("    which = %r\n" % (code,))
-                self.fp.write("    want = %r\n" % (what[0],))
-        self.namemappers[0].addnamecode('property', pname, code)
-        if is_application_class and self.fp:
-            self.fp.write("%s = _Prop_%s()\n" % (pname, pname))
-
-    def compileelement(self, elem):
-        [code, keyform] = elem
-        if self.fp:
-            self.fp.write("#        element %r as %s\n" % (code, keyform))
-
-    def fillclasspropsandelems(self, cls):
-        [name, code, desc, properties, elements] = cls
-        cname = identify(name)
-        if self.namemappers[0].hascode('class', code) and \
-                self.namemappers[0].findcodename('class', code)[0] != cname:
-            # This is an other name (plural or so) for something else. Skip.
-            if self.fp and (elements or len(properties) > 1 or (len(properties) == 1 and
-                properties[0][1] != 'c@#!')):
-                if self.verbose:
-                    print('** Skip multiple %s of %s (code %r)' % (cname, self.namemappers[0].findcodename('class', code)[0], code), file=self.verbose)
-                raise RuntimeError("About to skip non-empty class")
-            return
-        plist = []
-        elist = []
-        superclasses = []
-        for prop in properties:
-            [pname, pcode, what] = prop
-            if pcode == "c@#^":
-                superclasses.append(what)
-            if pcode == 'c@#!':
-                continue
-            pname = identify(pname)
-            plist.append(pname)
-
-        superclassnames = []
-        for superclass in superclasses:
-            superId, superDesc, dummy = superclass
-            superclassname, fullyqualifiedname, module = self.findcodename("class", superId)
-            # I don't think this is correct:
-            if superclassname == cname:
-                pass # superclassnames.append(fullyqualifiedname)
-            else:
-                superclassnames.append(superclassname)
-
-        if self.fp:
-            self.fp.write("%s._superclassnames = %r\n"%(cname, superclassnames))
-
-        for elem in elements:
-            [ecode, keyform] = elem
-            if ecode == 'c@#!':
-                continue
-            name, ename, module = self.findcodename('class', ecode)
-            if not name:
-                if self.fp:
-                    self.fp.write("# XXXX %s element %r not found!!\n"%(cname, ecode))
-            else:
-                elist.append((name, ename))
-
-        plist.sort()
-        elist.sort()
-
-        if self.fp:
-            self.fp.write("%s._privpropdict = {\n"%cname)
-            for n in plist:
-                self.fp.write("    '%s' : _Prop_%s,\n"%(n, n))
-            self.fp.write("}\n")
-            self.fp.write("%s._privelemdict = {\n"%cname)
-            for n, fulln in elist:
-                self.fp.write("    '%s' : %s,\n"%(n, fulln))
-            self.fp.write("}\n")
-
-    def compilecomparison(self, comp):
-        [name, code, comment] = comp
-        iname = identify(name)
-        self.namemappers[0].addnamecode('comparison', iname, code)
-        if self.fp:
-            self.fp.write("class %s(aetools.NComparison):\n" % iname)
-            self.fp.write('    """%s - %s """\n' % (ascii(name), ascii(comment)))
-
-    def compileenumeration(self, enum):
-        [code, items] = enum
-        name = "_Enum_%s" % identify(code)
-        if self.fp:
-            self.fp.write("%s = {\n" % name)
-            for item in items:
-                self.compileenumerator(item)
-            self.fp.write("}\n\n")
-        self.namemappers[0].addnamecode('enum', name, code)
-        return code
-
-    def compileenumerator(self, item):
-        [name, code, desc] = item
-        self.fp.write("    %r : %r,\t# %s\n" % (identify(name), code, ascii(desc)))
-
-    def checkforenum(self, enum):
-        """This enum code is used by an event. Make sure it's available"""
-        name, fullname, module = self.findcodename('enum', enum)
-        if not name:
-            if self.fp:
-                self.fp.write("_Enum_%s = None # XXXX enum %s not found!!\n"%(identify(enum), ascii(enum)))
-            return
-        if module:
-            if self.fp:
-                self.fp.write("from %s import %s\n"%(module, name))
-
-    def dumpindex(self):
-        if not self.fp:
-            return
-        self.fp.write("\n#\n# Indices of types declared in this module\n#\n")
-
-        self.fp.write("_classdeclarations = {\n")
-        classlist = self.namemappers[0].getall('class')
-        classlist.sort()
-        for k, v in classlist:
-            self.fp.write("    %r : %s,\n" % (k, v))
-        self.fp.write("}\n")
-
-        self.fp.write("\n_propdeclarations = {\n")
-        proplist = self.namemappers[0].getall('property')
-        proplist.sort()
-        for k, v in proplist:
-            self.fp.write("    %r : _Prop_%s,\n" % (k, v))
-        self.fp.write("}\n")
-
-        self.fp.write("\n_compdeclarations = {\n")
-        complist = self.namemappers[0].getall('comparison')
-        complist.sort()
-        for k, v in complist:
-            self.fp.write("    %r : %s,\n" % (k, v))
-        self.fp.write("}\n")
-
-        self.fp.write("\n_enumdeclarations = {\n")
-        enumlist = self.namemappers[0].getall('enum')
-        enumlist.sort()
-        for k, v in enumlist:
-            self.fp.write("    %r : %s,\n" % (k, v))
-        self.fp.write("}\n")
-
-def compiledata(data):
-    [type, description, flags] = data
-    return "%r -- %r %s" % (type, description, compiledataflags(flags))
-
-def is_null(data):
-    return data[0] == 'null'
-
-def is_optional(data):
-    return (data[2] & 0x8000)
-
-def is_enum(data):
-    return (data[2] & 0x2000)
-
-def getdatadoc(data):
-    [type, descr, flags] = data
-    if descr:
-        return ascii(descr)
-    if type == '****':
-        return 'anything'
-    if type == 'obj ':
-        return 'an AE object reference'
-    return "undocumented, typecode %r"%(type,)
-
-dataflagdict = {15: "optional", 14: "list", 13: "enum", 12: "mutable"}
-def compiledataflags(flags):
-    bits = []
-    for i in range(16):
-        if flags & (1<<i):
-            if i in dataflagdict.keys():
-                bits.append(dataflagdict[i])
-            else:
-                bits.append(repr(i))
-    return '[%s]' % ' '.join(bits)
-
-def ascii(str):
-    """Return a string with all non-ascii characters hex-encoded"""
-    if type(str) != type(''):
-        return map(ascii, str)
-    rv = ''
-    for c in str:
-        if c in ('\t', '\n', '\r') or ' ' <= c < chr(0x7f):
-            rv = rv + c
-        else:
-            rv = rv + '\\' + 'x%02.2x' % ord(c)
-    return rv
-
-def identify(str):
-    """Turn any string into an identifier:
-    - replace space by _
-    - replace other illegal chars by _xx_ (hex code)
-    - append _ if the result is a python keyword
-    """
-    if not str:
-        return "empty_ae_name_"
-    rv = ''
-    ok = string.ascii_letters + '_'
-    ok2 = ok + string.digits
-    for c in str:
-        if c in ok:
-            rv = rv + c
-        elif c == ' ':
-            rv = rv + '_'
-        else:
-            rv = rv + '_%02.2x_'%ord(c)
-        ok = ok2
-    if keyword.iskeyword(rv):
-        rv = rv + '_'
-    return rv
-
-# Call the main program
-
-if __name__ == '__main__':
-    main()
-    sys.exit(1)

Deleted: python/branches/py3k/Lib/plat-mac/ic.py
==============================================================================
--- python/branches/py3k/Lib/plat-mac/ic.py	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,264 +0,0 @@
-"""IC wrapper module, based on Internet Config 1.3"""
-
-import icglue
-import sys
-import os
-from Carbon import Res
-import Carbon.File
-import macostools
-
-error=icglue.error
-
-# From ictypes.h:
-icPrefNotFoundErr = -666        # preference not found (duh!)
-icPermErr = -667                # cannot set preference
-icPrefDataErr = -668            # problem with preference data
-icInternalErr = -669            # hmm, this is not good
-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 configuration was found
-icConfigInappropriateErr = -675 # incorrect manufacturer code
-
-ICattr_no_change = -1
-
-icNoPerm = 0
-icReadOnlyPerm = 1
-icReadWritePerm = 2
-# End of ictypes.h
-
-class ICOpaqueData:
-    """An unparseable IC entry"""
-    def __init__(self, data):
-        self.data = data
-
-    def __repr__(self):
-        return "ICOpaqueData(%r)"%(self.data,)
-
-_ICOpaqueDataType=type(ICOpaqueData(''))
-
-def _decode_default(data, key):
-    if len(data) == 0:
-        return data
-    if data[0] == len(data)-1:
-        # Assume Pstring
-        return data[1:]
-    return ICOpaqueData(data)
-
-
-def _decode_multistr(data, key):
-    numstr = data[0] << 8 | data[1]
-    rv = []
-    ptr = 2
-    for i in range(numstr):
-        strlen = data[ptr]
-        str = data[ptr+1:ptr+strlen+1]
-        rv.append(str)
-        ptr = ptr + strlen + 1
-    return rv
-
-def _decode_fontrecord(data, key):
-    size = data[0] << 8 | data[1]
-    face = data[2]
-    namelen = data[4]
-    return size, face, data[5:5+namelen]
-
-def _decode_boolean(data, key):
-    return data[0]
-
-def _decode_text(data, key):
-    return data
-
-def _decode_charset(data, key):
-    return data[:256], data[256:]
-
-def _decode_appspec(data, key):
-    namelen = data[4]
-    return data[0:4], data[5:5+namelen]
-
-def _code_default(data, key):
-    return chr(len(data)) + data
-
-def _code_multistr(data, key):
-    numstr = len(data)
-    rv = chr((numstr>>8) & 0xff) + chr(numstr & 0xff)
-    for i in data:
-        rv = rv + _code_default(i)
-    return rv
-
-def _code_fontrecord(data, key):
-    size, face, name = data
-    return chr((size>>8) & 0xff) + chr(size & 0xff) + chr(face & 0xff) + \
-        chr(0) + _code_default(name)
-
-def _code_boolean(data, key):
-    print('XXXX boolean:', repr(data))
-    return chr(data)
-
-def _code_text(data, key):
-    return data
-
-def _code_charset(data, key):
-    return data[0] + data[1]
-
-def _code_appspec(data, key):
-    return data[0] + _code_default(data[1])
-
-_decoder_table = {
-    "ArchieAll" : (_decode_multistr , _code_multistr),
-    "UMichAll" : (_decode_multistr , _code_multistr),
-    "InfoMacAll" : (_decode_multistr , _code_multistr),
-    "ListFont" : (_decode_fontrecord , _code_fontrecord),
-    "ScreenFont" : (_decode_fontrecord , _code_fontrecord),
-    "PrinterFont" : (_decode_fontrecord , _code_fontrecord),
-#   "DownloadFolder" : (_decode_filespec , _code_filespec),
-    "Signature": (_decode_text , _code_text),
-    "Plan" : (_decode_text , _code_text),
-    "MailHeaders" : (_decode_text , _code_text),
-    "NewsHeaders" : (_decode_text , _code_text),
-#   "Mapping"
-    "CharacterSet" : (_decode_charset , _code_charset),
-    "Helper\245" : (_decode_appspec , _code_appspec),
-#   "Services" : (_decode_services, ????),
-    "NewMailFlashIcon" : (_decode_boolean , _code_boolean),
-    "NewMailDialog" : (_decode_boolean , _code_boolean),
-    "NewMailPlaySound" : (_decode_boolean , _code_boolean),
-#   "WebBackgroundColor" : _decode_color,
-    "NoProxyDomains" : (_decode_multistr , _code_multistr),
-    "UseHTTPProxy" : (_decode_boolean , _code_boolean),
-    "UseGopherProxy": (_decode_boolean , _code_boolean),
-    "UseFTPProxy" : (_decode_boolean , _code_boolean),
-    "UsePassiveFTP" : (_decode_boolean , _code_boolean),
-}
-
-def _decode(data, key):
-    if '\245' in key:
-        key2 = key[:key.index('\245')+1]
-    else:
-        key2 = key
-    if key2 in _decoder_table:
-        decoder = _decoder_table[key2][0]
-    else:
-        decoder = _decode_default
-    return decoder(data, key)
-
-def _code(data, key):
-    if type(data) == _ICOpaqueDataType:
-        return data.data
-    if '\245' in key:
-        key2 = key[:key.index('\245')+1]
-    else:
-        key2 = key
-    if key2 in _decoder_table:
-        coder = _decoder_table[key2][1]
-    else:
-        coder = _code_default
-    return coder(data, key)
-
-class IC:
-    def __init__(self, signature='Pyth', ic=None):
-        if ic:
-            self.ic = ic
-        else:
-            self.ic = icglue.ICStart(signature)
-            if hasattr(self.ic, 'ICFindConfigFile'):
-                self.ic.ICFindConfigFile()
-        self.h = Res.Resource('')
-
-    def keys(self):
-        rv = []
-        self.ic.ICBegin(icReadOnlyPerm)
-        num = self.ic.ICCountPref()
-        for i in range(num):
-            rv.append(self.ic.ICGetIndPref(i+1))
-        self.ic.ICEnd()
-        return rv
-
-    def __contains__(self, key):
-        try:
-            dummy = self.ic.ICFindPrefHandle(key, self.h)
-        except icglue.error:
-            return 0
-        return 1
-
-    def __getitem__(self, key):
-        attr = self.ic.ICFindPrefHandle(key, self.h)
-        return _decode(self.h.data, key)
-
-    def __setitem__(self, key, value):
-        value = _code(value, key)
-        self.ic.ICSetPref(key, ICattr_no_change, value)
-
-    def launchurl(self, url, hint=""):
-        # Work around a bug in ICLaunchURL: file:/foo does
-        # not work but file:///foo does.
-        if url[:6] == 'file:/' and url[6] != '/':
-            url = 'file:///' + url[6:]
-        self.ic.ICLaunchURL(hint, url, 0, len(url))
-
-    def parseurl(self, data, start=None, end=None, hint=""):
-        if start is None:
-            selStart = 0
-            selEnd = len(data)
-        else:
-            selStart = selEnd = start
-        if end is not None:
-            selEnd = end
-        selStart, selEnd = self.ic.ICParseURL(hint, data, selStart, selEnd, self.h)
-        return self.h.data, selStart, selEnd
-
-    def mapfile(self, file):
-        if type(file) != type(''):
-            file = file.as_tuple()[2]
-        return self.ic.ICMapFilename(file)
-
-    def maptypecreator(self, type, creator, filename=""):
-        return self.ic.ICMapTypeCreator(type, creator, filename)
-
-    def settypecreator(self, file):
-        file = Carbon.File.pathname(file)
-        record = self.mapfile(os.path.split(file)[1])
-        MacOS.SetCreatorAndType(file, record[2], record[1])
-        macostools.touched(fss)
-
-# Convenience routines
-_dft_ic = None
-
-def launchurl(url, hint=""):
-    global _dft_ic
-    if _dft_ic is None: _dft_ic = IC()
-    return _dft_ic.launchurl(url, hint)
-
-def parseurl(data, start=None, end=None, hint=""):
-    global _dft_ic
-    if _dft_ic is None: _dft_ic = IC()
-    return _dft_ic.parseurl(data, start, end, hint)
-
-def mapfile(filename):
-    global _dft_ic
-    if _dft_ic is None: _dft_ic = IC()
-    return _dft_ic.mapfile(filename)
-
-def maptypecreator(type, creator, filename=""):
-    global _dft_ic
-    if _dft_ic is None: _dft_ic = IC()
-    return _dft_ic.maptypecreator(type, creator, filename)
-
-def settypecreator(file):
-    global _dft_ic
-    if _dft_ic is None: _dft_ic = IC()
-    return _dft_ic.settypecreator(file)
-
-def _test():
-    ic = IC()
-    for k in ic.keys():
-        try:
-            v = ic[k]
-        except error:
-            v = '????'
-        print(k, '\t', v)
-    sys.exit(1)
-
-if __name__ == '__main__':
-    _test()

Deleted: python/branches/py3k/Lib/plat-mac/icopen.py
==============================================================================
--- python/branches/py3k/Lib/plat-mac/icopen.py	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,66 +0,0 @@
-"""icopen patch
-
-OVERVIEW
-
-icopen patches MacOS Python to use the Internet Config file mappings to select
-the type and creator for a file.
-
-Version 1 released to the public domain 3 November 1999
-by Oliver Steele (steele at cs.brandeis.edu).
-
-DETAILS
-
-This patch causes files created by Python's open(filename, 'w') command (and
-by functions and scripts that call it) to set the type and creator of the file
-to the type and creator associated with filename's extension (the
-portion of the filename after the last period), according to Internet Config.
-Thus, a script that creates a file foo.html will create one that opens in whatever
-browser you've set to handle *.html files, and so on.
-
-Python IDE uses its own algorithm to select the type and creator for saved
-editor windows, so this patch won't effect their types.
-
-As of System 8.6 at least, Internet Config is built into the system, and the
-file mappings are accessed from the Advanced pane of the Internet control
-panel.  User Mode (in the Edit menu) needs to be set to Advanced in order to
-access this pane.
-
-INSTALLATION
-
-Put this file in your Python path, and create a file named {Python}:sitecustomize.py
-that contains:
-        import icopen
-
-(If {Python}:sitecustomizer.py already exists, just add the 'import' line to it.)
-
-The next time you launch PythonInterpreter or Python IDE, the patch will take
-effect.
-"""
-
-import builtins
-
-_builtin_open = globals().get('_builtin_open', builtins.open)
-
-def _open_with_typer(*args):
-    file = _builtin_open(*args)
-    filename = args[0]
-    mode = 'r'
-    if args[1:]:
-        mode = args[1]
-    if mode[0] == 'w':
-        from ic import error, settypecreator
-        try:
-            settypecreator(filename)
-        except error:
-            pass
-    return file
-
-builtins.open = _open_with_typer
-
-"""
-open('test.py')
-_open_with_typer('test.py', 'w')
-_open_with_typer('test.txt', 'w')
-_open_with_typer('test.html', 'w')
-_open_with_typer('test.foo', 'w')
-"""

Deleted: python/branches/py3k/Lib/plat-mac/macerrors.py
==============================================================================
--- python/branches/py3k/Lib/plat-mac/macerrors.py	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,1853 +0,0 @@
-# -coding=latin1-
-svTempDisable   =   -32768  #svTempDisable
-svDisabled  =   -32640  #Reserve range -32640 to -32768 for Apple temp disables.
-fontNotOutlineErr   =   -32615  #bitmap font passed to routine that does outlines only
-kURL68kNotSupportedError    =   -30788  #kURL68kNotSupportedError
-kURLAccessNotAvailableError =   -30787  #kURLAccessNotAvailableError
-kURLInvalidConfigurationError   =   -30786  #kURLInvalidConfigurationError
-kURLExtensionFailureError   =   -30785  #kURLExtensionFailureError
-kURLFileEmptyError  =   -30783  #kURLFileEmptyError
-kURLInvalidCallError    =   -30781  #kURLInvalidCallError
-kURLUnsettablePropertyError =   -30780  #kURLUnsettablePropertyError
-kURLPropertyBufferTooSmallError =   -30779  #kURLPropertyBufferTooSmallError
-kURLUnknownPropertyError    =   -30778  #kURLUnknownPropertyError
-kURLPropertyNotYetKnownError    =   -30777  #kURLPropertyNotYetKnownError
-kURLAuthenticationError =   -30776  #kURLAuthenticationError
-kURLServerBusyError =   -30775  #kURLServerBusyError
-kURLUnsupportedSchemeError  =   -30774  #kURLUnsupportedSchemeError
-kURLInvalidURLError =   -30773  #kURLInvalidURLError
-kURLDestinationExistsError  =   -30772  #kURLDestinationExistsError
-kURLProgressAlreadyDisplayedError   =   -30771  #kURLProgressAlreadyDisplayedError
-kURLInvalidURLReferenceError    =   -30770  #kURLInvalidURLReferenceError
-controlHandleInvalidErr =   -30599  #controlHandleInvalidErr
-controlInvalidDataVersionErr    =   -30597  #controlInvalidDataVersionErr
-errItemNotControl   =   -30596  #errItemNotControl
-errCantEmbedRoot    =   -30595  #errCantEmbedRoot
-errCantEmbedIntoSelf    =   -30594  #errCantEmbedIntoSelf
-errWindowRegionCodeInvalid  =   -30593  #errWindowRegionCodeInvalid
-errControlHiddenOrDisabled  =   -30592  #errControlHiddenOrDisabled
-errDataSizeMismatch =   -30591  #errDataSizeMismatch
-errControlIsNotEmbedder =   -30590  #errControlIsNotEmbedder
-errControlsAlreadyExist =   -30589  #errControlsAlreadyExist
-errInvalidPartCode  =   -30588  #errInvalidPartCode
-errRootAlreadyExists    =   -30587  #errRootAlreadyExists
-errNoRootControl    =   -30586  #errNoRootControl
-errCouldntSetFocus  =   -30585  #errCouldntSetFocus
-errUnknownControl   =   -30584  #errUnknownControl
-errWindowDoesntSupportFocus =   -30583  #errWindowDoesntSupportFocus
-errControlDoesntSupportFocus    =   -30582  #errControlDoesntSupportFocus
-errDataNotSupported =   -30581  #errDataNotSupported
-errMessageNotSupported  =   -30580  #errMessageNotSupported
-themeMonitorDepthNotSupportedErr    =   -30567  #theme not supported at monitor depth
-themeScriptFontNotFoundErr  =   -30566  #theme font requested for uninstalled script system
-themeBadCursorIndexErr  =   -30565  #themeBadCursorIndexErr
-themeHasNoAccentsErr    =   -30564  #themeHasNoAccentsErr
-themeBadTextColorErr    =   -30563  #themeBadTextColorErr
-themeProcessNotRegisteredErr    =   -30562  #themeProcessNotRegisteredErr
-themeProcessRegisteredErr   =   -30561  #themeProcessRegisteredErr
-themeInvalidBrushErr    =   -30560  #pattern index invalid
-qtvrUninitialized   =   -30555  #qtvrUninitialized
-qtvrLibraryLoadErr  =   -30554  #qtvrLibraryLoadErr
-streamingNodeNotReadyErr    =   -30553  #streamingNodeNotReadyErr
-noMemoryNodeFailedInitialize    =   -30552  #noMemoryNodeFailedInitialize
-invalidHotSpotIDErr =   -30551  #invalidHotSpotIDErr
-invalidNodeFormatErr    =   -30550  #invalidNodeFormatErr
-limitReachedErr =   -30549  #limitReachedErr
-settingNotSupportedByNodeErr    =   -30548  #settingNotSupportedByNodeErr
-propertyNotSupportedByNodeErr   =   -30547  #propertyNotSupportedByNodeErr
-timeNotInViewErr    =   -30546  #timeNotInViewErr
-invalidViewStateErr =   -30545  #invalidViewStateErr
-invalidNodeIDErr    =   -30544  #invalidNodeIDErr
-selectorNotSupportedByNodeErr   =   -30543  #selectorNotSupportedByNodeErr
-callNotSupportedByNodeErr   =   -30542  #callNotSupportedByNodeErr
-constraintReachedErr    =   -30541  #constraintReachedErr
-notAQTVRMovieErr    =   -30540  #notAQTVRMovieErr
-kFBCnoSuchHit   =   -30532  #kFBCnoSuchHit
-kFBCbadSearchSession    =   -30531  #kFBCbadSearchSession
-kFBCindexDiskIOFailed   =   -30530  #kFBCindexDiskIOFailed
-kFBCsummarizationCanceled   =   -30529  #kFBCsummarizationCanceled
-kFBCbadIndexFileVersion =   -30528  #kFBCbadIndexFileVersion
-kFBCanalysisNotAvailable    =   -30527  #kFBCanalysisNotAvailable
-kFBCillegalSessionChange    =   -30526  #tried to add/remove vols to a session
-kFBCsomeFilesNotIndexed =   -30525  #kFBCsomeFilesNotIndexed
-kFBCsearchFailed    =   -30524  #kFBCsearchFailed
-kFBCindexNotAvailable   =   -30523  #kFBCindexNotAvailable
-kFBCindexFileDestroyed  =   -30522  #kFBCindexFileDestroyed
-kFBCaccessCanceled  =   -30521  #kFBCaccessCanceled
-kFBCindexingCanceled    =   -30520  #kFBCindexingCanceled
-kFBCnoSearchSession =   -30519  #kFBCnoSearchSession
-kFBCindexNotFound   =   -30518  #kFBCindexNotFound
-kFBCflushFailed =   -30517  #kFBCflushFailed
-kFBCaddDocFailed    =   -30516  #kFBCaddDocFailed
-kFBCaccessorStoreFailed =   -30515  #kFBCaccessorStoreFailed
-kFBCindexCreationFailed =   -30514  #couldn't create index
-kFBCmergingFailed   =   -30513  #couldn't merge index files
-kFBCtokenizationFailed  =   -30512  #couldn't read from document or query
-kFBCmoveFailed  =   -30511  #V-Twin exception caught
-kFBCdeletionFailed  =   -30510  #V-Twin exception caught
-kFBCcommitFailed    =   -30509  #V-Twin exception caught
-kFBCindexingFailed  =   -30508  #V-Twin exception caught
-kFBCvalidationFailed    =   -30507  #V-Twin exception caught
-kFBCcompactionFailed    =   -30506  #V-Twin exception caught
-kFBCbadIndexFile    =   -30505  #bad FSSpec, or bad data in file
-kFBCfileNotIndexed  =   -30504  #kFBCfileNotIndexed
-kFBCbadParam    =   -30503  #kFBCbadParam
-kFBCallocFailed =   -30502  #probably low memory
-kFBCnoIndexesFound  =   -30501  #kFBCnoIndexesFound
-kFBCvTwinExceptionErr   =   -30500  #no telling what it was
-kDSpStereoContextErr    =   -30450  #kDSpStereoContextErr
-kDSpInternalErr =   -30449  #kDSpInternalErr
-kDSpConfirmSwitchWarning    =   -30448  #kDSpConfirmSwitchWarning
-kDSpFrameRateNotReadyErr    =   -30447  #kDSpFrameRateNotReadyErr
-kDSpContextNotFoundErr  =   -30446  #kDSpContextNotFoundErr
-kDSpContextNotReservedErr   =   -30445  #kDSpContextNotReservedErr
-kDSpContextAlreadyReservedErr   =   -30444  #kDSpContextAlreadyReservedErr
-kDSpInvalidAttributesErr    =   -30443  #kDSpInvalidAttributesErr
-kDSpInvalidContextErr   =   -30442  #kDSpInvalidContextErr
-kDSpSystemSWTooOldErr   =   -30441  #kDSpSystemSWTooOldErr
-kDSpNotInitializedErr   =   -30440  #kDSpNotInitializedErr
-kISpListBusyErr =   -30429  #kISpListBusyErr
-kISpDeviceActiveErr =   -30428  #kISpDeviceActiveErr
-kISpSystemActiveErr =   -30427  #kISpSystemActiveErr
-kISpDeviceInactiveErr   =   -30426  #kISpDeviceInactiveErr
-kISpSystemInactiveErr   =   -30425  #kISpSystemInactiveErr
-kISpElementNotInListErr =   -30424  #kISpElementNotInListErr
-kISpElementInListErr    =   -30423  #kISpElementInListErr
-kISpBufferToSmallErr    =   -30422  #kISpBufferToSmallErr
-kISpSystemListErr   =   -30421  #kISpSystemListErr
-kISpInternalErr =   -30420  #kISpInternalErr
-kNSpJoinFailedErr   =   -30399  #kNSpJoinFailedErr
-kNSpCantBlockErr    =   -30398  #kNSpCantBlockErr
-kNSpMessageTooBigErr    =   -30397  #kNSpMessageTooBigErr
-kNSpSendFailedErr   =   -30396  #kNSpSendFailedErr
-kNSpConnectFailedErr    =   -30395  #kNSpConnectFailedErr
-kNSpGameTerminatedErr   =   -30394  #kNSpGameTerminatedErr
-kNSpTimeoutErr  =   -30393  #kNSpTimeoutErr
-kNSpInvalidProtocolListErr  =   -30392  #kNSpInvalidProtocolListErr
-kNSpInvalidProtocolRefErr   =   -30391  #kNSpInvalidProtocolRefErr
-kNSpInvalidDefinitionErr    =   -30390  #kNSpInvalidDefinitionErr
-kNSpAddPlayerFailedErr  =   -30389  #kNSpAddPlayerFailedErr
-kNSpCreateGroupFailedErr    =   -30388  #kNSpCreateGroupFailedErr
-kNSpNoHostVolunteersErr =   -30387  #kNSpNoHostVolunteersErr
-kNSpNoGroupsErr =   -30386  #kNSpNoGroupsErr
-kNSpNoPlayersErr    =   -30385  #kNSpNoPlayersErr
-kNSpInvalidGroupIDErr   =   -30384  #kNSpInvalidGroupIDErr
-kNSpInvalidPlayerIDErr  =   -30383  #kNSpInvalidPlayerIDErr
-kNSpNameRequiredErr =   -30382  #kNSpNameRequiredErr
-kNSpFeatureNotImplementedErr    =   -30381  #kNSpFeatureNotImplementedErr
-kNSpAddressInUseErr =   -30380  #kNSpAddressInUseErr
-kNSpRemovePlayerFailedErr   =   -30379  #kNSpRemovePlayerFailedErr
-kNSpFreeQExhaustedErr   =   -30378  #kNSpFreeQExhaustedErr
-kNSpInvalidAddressErr   =   -30377  #kNSpInvalidAddressErr
-kNSpNotAdvertisingErr   =   -30376  #kNSpNotAdvertisingErr
-kNSpAlreadyAdvertisingErr   =   -30374  #kNSpAlreadyAdvertisingErr
-kNSpMemAllocationErr    =   -30373  #kNSpMemAllocationErr
-kNSpOTVersionTooOldErr  =   -30371  #kNSpOTVersionTooOldErr
-kNSpOTNotPresentErr =   -30370  #kNSpOTNotPresentErr
-kNSpInvalidParameterErr =   -30369  #kNSpInvalidParameterErr
-kNSpInvalidGameRefErr   =   -30367  #kNSpInvalidGameRefErr
-kNSpProtocolNotAvailableErr =   -30366  #kNSpProtocolNotAvailableErr
-kNSpHostFailedErr   =   -30365  #kNSpHostFailedErr
-kNSpPipeFullErr =   -30364  #kNSpPipeFullErr
-kNSpTopologyNotSupportedErr =   -30362  #kNSpTopologyNotSupportedErr
-kNSpAlreadyInitializedErr   =   -30361  #kNSpAlreadyInitializedErr
-kNSpInitializationFailedErr =   -30360  #kNSpInitializationFailedErr
-kSSpScaleToZeroErr  =   -30344  #kSSpScaleToZeroErr
-kSSpParallelUpVectorErr =   -30343  #kSSpParallelUpVectorErr
-kSSpCantInstallErr  =   -30342  #kSSpCantInstallErr
-kSSpVersionErr  =   -30341  #kSSpVersionErr
-kSSpInternalErr =   -30340  #kSSpInternalErr
-kALMInternalErr =   -30049  #kALMInternalErr
-kALMGroupNotFoundErr    =   -30048  #kALMGroupNotFoundErr
-kALMNoSuchModuleErr =   -30047  #kALMNoSuchModuleErr
-kALMModuleCommunicationErr  =   -30046  #kALMModuleCommunicationErr
-kALMDuplicateModuleErr  =   -30045  #kALMDuplicateModuleErr
-kALMInstallationErr =   -30044  #kALMInstallationErr
-kALMDeferSwitchErr  =   -30043  #kALMDeferSwitchErr
-kALMRebootFlagsLevelErr =   -30042  #kALMRebootFlagsLevelErr
-kLocalesDefaultDisplayStatus    =   -30029  #Requested display locale unavailable, used default
-kLocalesTableFormatErr  =   -30002  #kLocalesTableFormatErr
-kLocalesBufferTooSmallErr   =   -30001  #kLocalesBufferTooSmallErr
-kFNSNameNotFoundErr =   -29589  #The name with the requested paramters was not found
-kFNSBadFlattenedSizeErr =   -29587  #flattened size didn't match input or was too small
-kFNSInsufficientDataErr =   -29586  #insufficient data for the operation
-kFNSMismatchErr =   -29585  #reference didn't match or wasn't found in profile
-kFNSDuplicateReferenceErr   =   -29584  #the ref. being added is already in the profile
-kFNSBadProfileVersionErr    =   -29583  #profile version is out of known range
-kFNSInvalidProfileErr   =   -29582  #profile is NULL or otherwise bad
-kFNSBadReferenceVersionErr  =   -29581  #ref. version is out of known range
-kFNSInvalidReferenceErr =   -29580  #ref. was NULL or otherwise bad
-kCollateInvalidCollationRef =   -29507  #kCollateInvalidCollationRef
-kCollateBufferTooSmall  =   -29506  #kCollateBufferTooSmall
-kCollateInvalidChar =   -29505  #kCollateInvalidChar
-kCollatePatternNotFoundErr  =   -29504  #kCollatePatternNotFoundErr
-kCollateUnicodeConvertFailedErr =   -29503  #kCollateUnicodeConvertFailedErr
-kCollateMissingUnicodeTableErr  =   -29502  #kCollateMissingUnicodeTableErr
-kCollateInvalidOptions  =   -29501  #kCollateInvalidOptions
-kCollateAttributesNotFoundErr   =   -29500  #kCollateAttributesNotFoundErr
-kMPInvalidIDErr =   -29299  #kMPInvalidIDErr
-kMPInsufficientResourcesErr =   -29298  #kMPInsufficientResourcesErr
-kMPTaskAbortedErr   =   -29297  #kMPTaskAbortedErr
-kMPTimeoutErr   =   -29296  #kMPTimeoutErr
-kMPDeletedErr   =   -29295  #kMPDeletedErr
-kMPBlueBlockingErr  =   -29293  #kMPBlueBlockingErr
-kMPTaskStoppedErr   =   -29292  #A convention used with MPThrowException.
-kMPTaskBlockedErr   =   -29291  #kMPTaskBlockedErr
-kMPTaskCreatedErr   =   -29290  #kMPTaskCreatedErr
-kMPProcessTerminatedErr =   -29289  #kMPProcessTerminatedErr
-kMPProcessCreatedErr    =   -29288  #kMPProcessCreatedErr
-kMPPrivilegedErr    =   -29276  #kMPPrivilegedErr
-kMPIterationEndErr  =   -29275  #kMPIterationEndErr
-kUCTextBreakLocatorMissingType  =   -25341  #Unicode text break error
-kUCOutputBufferTooSmall =   -25340  #Output buffer too small for Unicode string result
-errKCCreateChainFailed  =   -25318  #errKCCreateChainFailed
-errKCDataNotModifiable  =   -25317  #errKCDataNotModifiable
-errKCDataNotAvailable   =   -25316  #errKCDataNotAvailable
-errKCInteractionRequired    =   -25315  #errKCInteractionRequired
-errKCNoPolicyModule =   -25314  #errKCNoPolicyModule
-errKCNoCertificateModule    =   -25313  #errKCNoCertificateModule
-errKCNoStorageModule    =   -25312  #errKCNoStorageModule
-errKCKeySizeNotAllowed  =   -25311  #errKCKeySizeNotAllowed
-errKCWrongKCVersion =   -25310  #errKCWrongKCVersion
-errKCReadOnlyAttr   =   -25309  #errKCReadOnlyAttr
-errKCInteractionNotAllowed  =   -25308  #errKCInteractionNotAllowed
-errKCNoDefaultKeychain  =   -25307  #errKCNoDefaultKeychain
-errKCNoSuchClass    =   -25306  #errKCNoSuchClass
-errKCInvalidSearchRef   =   -25305  #errKCInvalidSearchRef
-errKCInvalidItemRef =   -25304  #errKCInvalidItemRef
-errKCNoSuchAttr =   -25303  #errKCNoSuchAttr
-errKCDataTooLarge   =   -25302  #errKCDataTooLarge
-errKCBufferTooSmall =   -25301  #errKCBufferTooSmall
-errKCItemNotFound   =   -25300  #errKCItemNotFound
-errKCDuplicateItem  =   -25299  #errKCDuplicateItem
-errKCInvalidCallback    =   -25298  #errKCInvalidCallback
-errKCDuplicateCallback  =   -25297  #errKCDuplicateCallback
-errKCDuplicateKeychain  =   -25296  #errKCDuplicateKeychain
-errKCInvalidKeychain    =   -25295  #errKCInvalidKeychain
-errKCNoSuchKeychain =   -25294  #errKCNoSuchKeychain
-errKCAuthFailed =   -25293  #errKCAuthFailed
-errKCReadOnly   =   -25292  #errKCReadOnly
-errKCNotAvailable   =   -25291  #errKCNotAvailable
-printerStatusOpCodeNotSupportedErr  =   -25280  #printerStatusOpCodeNotSupportedErr
-kTXNOutsideOfFrameErr   =   -22018  #kTXNOutsideOfFrameErr
-kTXNOutsideOfLineErr    =   -22017  #kTXNOutsideOfLineErr
-kTXNATSUIIsNotInstalledErr  =   -22016  #kTXNATSUIIsNotInstalledErr
-kTXNDataTypeNotAllowedErr   =   -22015  #kTXNDataTypeNotAllowedErr
-kTXNCopyNotAllowedInEchoModeErr =   -22014  #kTXNCopyNotAllowedInEchoModeErr
-kTXNCannotTurnTSMOffWhenUsingUnicodeErr =   -22013  #kTXNCannotTurnTSMOffWhenUsingUnicodeErr
-kTXNAlreadyInitializedErr   =   -22012  #kTXNAlreadyInitializedErr
-kTXNInvalidRunIndex =   -22011  #kTXNInvalidRunIndex
-kTXNSomeOrAllTagsInvalidForRunErr   =   -22010  #kTXNSomeOrAllTagsInvalidForRunErr
-kTXNAttributeTagInvalidForRunErr    =   -22009  #dataValue is set to this per invalid tag
-kTXNNoMatchErr  =   -22008  #kTXNNoMatchErr
-kTXNRunIndexOutofBoundsErr  =   -22007  #kTXNRunIndexOutofBoundsErr
-kTXNCannotSetAutoIndentErr  =   -22006  #kTXNCannotSetAutoIndentErr
-kTXNBadDefaultFileTypeWarning   =   -22005  #kTXNBadDefaultFileTypeWarning
-kTXNUserCanceledOperationErr    =   -22004  #kTXNUserCanceledOperationErr
-kTXNIllegalToCrossDataBoundariesErr =   -22003  #kTXNIllegalToCrossDataBoundariesErr
-kTXNInvalidFrameIDErr   =   -22002  #kTXNInvalidFrameIDErr
-kTXNCannotAddFrameErr   =   -22001  #kTXNCannotAddFrameErr
-kTXNEndIterationErr =   -22000  #kTXNEndIterationErr
-invalidIndexErr =   -20002  #The recordIndex parameter is not valid.
-recordDataTooBigErr =   -20001  #The record data is bigger than buffer size (1024 bytes).
-unknownInsertModeErr    =   -20000  #There is no such an insert mode.
-kModemScriptMissing =   -14002  #kModemScriptMissing
-kModemPreferencesMissing    =   -14001  #kModemPreferencesMissing
-kModemOutOfMemory   =   -14000  #kModemOutOfMemory
-kHIDBaseError   =   -13950  #kHIDBaseError
-kHIDNullStateErr    =   -13949  #kHIDNullStateErr
-kHIDBufferTooSmallErr   =   -13948  #kHIDBufferTooSmallErr
-kHIDValueOutOfRangeErr  =   -13947  #kHIDValueOutOfRangeErr
-kHIDUsageNotFoundErr    =   -13946  #kHIDUsageNotFoundErr
-kHIDNotValueArrayErr    =   -13945  #kHIDNotValueArrayErr
-kHIDInvalidPreparsedDataErr =   -13944  #kHIDInvalidPreparsedDataErr
-kHIDIncompatibleReportErr   =   -13943  #kHIDIncompatibleReportErr
-kHIDBadLogPhysValuesErr =   -13942  #kHIDBadLogPhysValuesErr
-kHIDInvalidReportTypeErr    =   -13941  #kHIDInvalidReportTypeErr
-kHIDInvalidReportLengthErr  =   -13940  #kHIDInvalidReportLengthErr
-kHIDNullPointerErr  =   -13939  #kHIDNullPointerErr
-kHIDBadParameterErr =   -13938  #kHIDBadParameterErr
-kHIDNotEnoughMemoryErr  =   -13937  #kHIDNotEnoughMemoryErr
-kHIDEndOfDescriptorErr  =   -13936  #kHIDEndOfDescriptorErr
-kHIDUsagePageZeroErr    =   -13935  #kHIDUsagePageZeroErr
-kHIDBadLogicalMinimumErr    =   -13934  #kHIDBadLogicalMinimumErr
-kHIDBadLogicalMaximumErr    =   -13933  #kHIDBadLogicalMaximumErr
-kHIDInvertedLogicalRangeErr =   -13932  #kHIDInvertedLogicalRangeErr
-kHIDInvertedPhysicalRangeErr    =   -13931  #kHIDInvertedPhysicalRangeErr
-kHIDUnmatchedUsageRangeErr  =   -13930  #kHIDUnmatchedUsageRangeErr
-kHIDInvertedUsageRangeErr   =   -13929  #kHIDInvertedUsageRangeErr
-kHIDUnmatchedStringRangeErr =   -13928  #kHIDUnmatchedStringRangeErr
-kHIDUnmatchedDesignatorRangeErr =   -13927  #kHIDUnmatchedDesignatorRangeErr
-kHIDReportSizeZeroErr   =   -13926  #kHIDReportSizeZeroErr
-kHIDReportCountZeroErr  =   -13925  #kHIDReportCountZeroErr
-kHIDReportIDZeroErr =   -13924  #kHIDReportIDZeroErr
-kHIDInvalidRangePageErr =   -13923  #kHIDInvalidRangePageErr
-kHIDDeviceNotReady  =   -13910  #The device is still initializing, try again later
-kHIDVersionIncompatibleErr  =   -13909  #kHIDVersionIncompatibleErr
-debuggingNoMatchErr =   -13887  #debugging component or option not found at this index
-debuggingNoCallbackErr  =   -13886  #debugging component has no callback
-debuggingInvalidNameErr =   -13885  #componentName or optionName is invalid (NULL)
-debuggingInvalidOptionErr   =   -13884  #optionSelectorNum is not registered
-debuggingInvalidSignatureErr    =   -13883  #componentSignature not registered
-debuggingDuplicateOptionErr =   -13882  #optionSelectorNum already registered
-debuggingDuplicateSignatureErr  =   -13881  #componentSignature already registered
-debuggingExecutionContextErr    =   -13880  #routine cannot be called at this time
-kBridgeSoftwareRunningCantSleep =   -13038  #kBridgeSoftwareRunningCantSleep
-kNoSuchPowerSource  =   -13020  #kNoSuchPowerSource
-kProcessorTempRoutineRequiresMPLib2 =   -13014  #kProcessorTempRoutineRequiresMPLib2
-kCantReportProcessorTemperatureErr  =   -13013  #kCantReportProcessorTemperatureErr
-kPowerMgtRequestDenied  =   -13010  #kPowerMgtRequestDenied
-kPowerMgtMessageNotHandled  =   -13009  #kPowerMgtMessageNotHandled
-kPowerHandlerNotFoundForProcErr =   -13008  #kPowerHandlerNotFoundForProcErr
-kPowerHandlerNotFoundForDeviceErr   =   -13007  #kPowerHandlerNotFoundForDeviceErr
-kPowerHandlerExistsForDeviceErr =   -13006  #kPowerHandlerExistsForDeviceErr
-pmRecvEndErr    =   -13005  #during receive, pmgr did not finish hs configured for this connection
-pmRecvStartErr  =   -13004  #during receive, pmgr did not start hs
-pmSendEndErr    =   -13003  #during send, pmgr did not finish hs
-pmSendStartErr  =   -13002  #during send, pmgr did not start hs
-pmReplyTOErr    =   -13001  #Timed out waiting for reply
-pmBusyErr   =   -13000  #Power Mgr never ready to start handshake
-pictureDataErr  =   -11005  #the picture data was invalid
-colorsRequestedErr  =   -11004  #the number of colors requested was illegal
-cantLoadPickMethodErr   =   -11003  #unable to load the custom pick proc
-pictInfoVerbErr =   -11002  #the passed verb was invalid
-pictInfoIDErr   =   -11001  #the internal consistancy check for the PictInfoID is wrong
-pictInfoVersionErr  =   -11000  #wrong version of the PictInfo structure
-errTaskNotFound =   -10780  #no task with that task id exists
-telNotEnoughdspBW   =   -10116  #not enough real-time for allocation
-telBadSampleRate    =   -10115  #incompatible sample rate
-telBadSWErr =   -10114  #Software not installed properly
-telDetAlreadyOn =   -10113  #detection is already turned on
-telAutoAnsNotOn =   -10112  #autoAnswer in not turned on
-telValidateFailed   =   -10111  #telValidate failed
-telBadProcID    =   -10110  #invalid procID
-telDeviceNotFound   =   -10109  #device not found
-telBadCodeResource  =   -10108  #code resource not found
-telInitFailed   =   -10107  #initialization failed
-telNoCommFolder =   -10106  #Communications/Extensions € not found
-telUnknownErr   =   -10103  #unable to set config
-telNoSuchTool   =   -10102  #unable to find tool with name specified
-telBadFunction  =   -10091  #bad msgCode specified
-telPBErr    =   -10090  #parameter block error, bad format
-telCANotDeflectable =   -10082  #CA not "deflectable"
-telCANotRejectable  =   -10081  #CA not "rejectable"
-telCANotAcceptable  =   -10080  #CA not "acceptable"
-telTermNotOpen  =   -10072  #terminal not opened via TELOpenTerm
-telStillNeeded  =   -10071  #terminal driver still needed by someone else
-telAlreadyOpen  =   -10070  #terminal already open
-telNoCallbackRef    =   -10064  #no call back reference was specified, but is required
-telDisplayModeNotSupp   =   -10063  #display mode not supported by tool
-telBadDisplayMode   =   -10062  #bad display mode specified
-telFwdTypeNotSupp   =   -10061  #forward type not supported by tool
-telDNTypeNotSupp    =   -10060  #DN type not supported by tool
-telBadRate  =   -10059  #bad rate specified
-telBadBearerType    =   -10058  #bad bearerType specified
-telBadSelect    =   -10057  #unable to select or deselect DN
-telBadParkID    =   -10056  #bad park id specified
-telBadPickupGroupID =   -10055  #bad pickup group ID specified
-telBadFwdType   =   -10054  #bad fwdType specified
-telBadFeatureID =   -10053  #bad feature ID specified
-telBadIntercomID    =   -10052  #bad intercom ID specified
-telBadPageID    =   -10051  #bad page ID specified
-telBadDNType    =   -10050  #DN type invalid
-telConfLimitExceeded    =   -10047  #attempt to exceed switch conference limits
-telCBErr    =   -10046  #call back feature not set previously
-telTransferRej  =   -10045  #transfer request rejected
-telTransferErr  =   -10044  #transfer not prepared
-telConfRej  =   -10043  #conference request was rejected
-telConfErr  =   -10042  #conference was not prepared
-telConfNoLimit  =   -10041  #no limit was specified but required
-telConfLimitErr =   -10040  #limit specified is too high for this configuration
-telFeatNotSupp  =   -10033  #feature program call not supported by this tool
-telFeatActive   =   -10032  #feature already active
-telFeatNotAvail =   -10031  #feature subscribed but not available
-telFeatNotSub   =   -10030  #feature not subscribed
-errAEPropertiesClash    =   -10025  #illegal combination of properties settings for Set Data, make new, or duplicate
-errAECantPutThatThere   =   -10024  #in make new, duplicate, etc. class can't be an element of container
-errAENotAnEnumMember    =   -10023  #enumerated value in SetData is not allowed for this property
-telIntExtNotSupp    =   -10022  #internal external type not supported by this tool
-telBadIntExt    =   -10021  #bad internal external error
-telStateNotSupp =   -10020  #device state not supported by tool
-telBadStateErr  =   -10019  #bad device state specified
-telIndexNotSupp =   -10018  #index not supported by this tool
-telBadIndex =   -10017  #bad index specified
-telAPattNotSupp =   -10016  #alerting pattern not supported by tool
-telBadAPattErr  =   -10015  #bad alerting pattern specified
-telVTypeNotSupp =   -10014  #volume type not supported by this tool
-telBadVTypeErr  =   -10013  #bad volume type error
-telBadLevelErr  =   -10012  #bad volume level setting
-telHTypeNotSupp =   -10011  #hook type not supported by this tool
-telBadHTypeErr  =   -10010  #bad hook type specified
-errAECantSupplyType =   -10009  #errAECantSupplyType
-telNoOpenErr    =   -10008  #unable to open terminal
-telNoMemErr =   -10007  #no memory to allocate handle
-errOSACantAssign    =   -10006  #Signaled when an object cannot be set in a container.
-telBadProcErr   =   -10005  #bad msgProc specified
-telBadHandErr   =   -10004  #bad handle specified
-OSAIllegalAssign    =   -10003  #Signaled when an object can never be set in a container
-telBadDNErr =   -10002  #TELDNHandle not found or invalid
-telBadTermErr   =   -10001  #invalid TELHandle or handle not found
-errAEEventFailed    =   -10000  #errAEEventFailed
-cannotMoveAttachedController    =   -9999   #cannotMoveAttachedController
-controllerHasFixedHeight    =   -9998   #controllerHasFixedHeight
-cannotSetWidthOfAttachedController  =   -9997   #cannotSetWidthOfAttachedController
-controllerBoundsNotExact    =   -9996   #controllerBoundsNotExact
-editingNotAllowed   =   -9995   #editingNotAllowed
-badControllerHeight =   -9994   #badControllerHeight
-deviceCantMeetRequest   =   -9408   #deviceCantMeetRequest
-seqGrabInfoNotAvailable =   -9407   #seqGrabInfoNotAvailable
-badSGChannel    =   -9406   #badSGChannel
-couldntGetRequiredComponent =   -9405   #couldntGetRequiredComponent
-notEnoughDiskSpaceToGrab    =   -9404   #notEnoughDiskSpaceToGrab
-notEnoughMemoryToGrab   =   -9403   #notEnoughMemoryToGrab
-cantDoThatInCurrentMode =   -9402   #cantDoThatInCurrentMode
-grabTimeComplete    =   -9401   #grabTimeComplete
-noDeviceForChannel  =   -9400   #noDeviceForChannel
-kNoCardBusCISErr    =   -9109   #No valid CIS exists for this CardBus card
-kNotZVCapableErr    =   -9108   #This socket does not support Zoomed Video
-kCardPowerOffErr    =   -9107   #Power to the card has been turned off
-kAttemptDupCardEntryErr =   -9106   #The Enabler was asked to create a duplicate card entry
-kAlreadySavedStateErr   =   -9105   #The state has been saved on previous call
-kTooManyIOWindowsErr    =   -9104   #device requested more than one I/O window
-kNotReadyErr    =   -9103   #PC Card failed to go ready
-kClientRequestDenied    =   -9102   #CS Clients should return this code inorder to
-kNoCompatibleNameErr    =   -9101   #There is no compatible driver name for this device
-kNoEnablerForCardErr    =   -9100   #No Enablers were found that can support the card
-kNoCardEnablersFoundErr =   -9099   #No Enablers were found
-kUnsupportedCardErr =   -9098   #Card not supported by generic enabler
-kNoClientTableErr   =   -9097   #The client table has not be initialized yet
-kNoMoreInterruptSlotsErr    =   -9096   #All internal Interrupt slots are in use
-kNoMoreTimerClientsErr  =   -9095   #All timer callbacks are in use
-kNoIOWindowRequestedErr =   -9094   #Request I/O window before calling configuration
-kBadCustomIFIDErr   =   -9093   #Custom interface ID is invalid
-kBadTupleDataErr    =   -9092   #Data in tuple is invalid
-kInvalidCSClientErr =   -9091   #Card Services ClientID is not registered
-kUnsupportedVsErr   =   -9090   #Unsupported Voltage Sense
-kInvalidDeviceNumber    =   -9089   #kInvalidDeviceNumber
-kPostCardEventErr   =   -9088   #_PCCSLPostCardEvent failed and dropped an event
-kCantConfigureCardErr   =   -9087   #kCantConfigureCardErr
-kPassCallToChainErr =   -9086   #kPassCallToChainErr
-kCardBusCardErr =   -9085   #kCardBusCardErr
-k16BitCardErr   =   -9084   #k16BitCardErr
-kBadDeviceErr   =   -9083   #kBadDeviceErr
-kBadLinkErr =   -9082   #kBadLinkErr
-kInvalidRegEntryErr =   -9081   #kInvalidRegEntryErr
-kNoCardSevicesSocketsErr    =   -9080   #kNoCardSevicesSocketsErr
-kOutOfResourceErr   =   -9079   #Card Services has exhausted the resource
-kNoMoreItemsErr =   -9078   #there are no more of the requested item
-kInUseErr   =   -9077   #requested resource is being used by a client
-kConfigurationLockedErr =   -9076   #a configuration has already been locked
-kWriteProtectedErr  =   -9075   #media is write-protected
-kBusyErr    =   -9074   #unable to process request at this time - try later
-kUnsupportedModeErr =   -9073   #mode is not supported
-kUnsupportedFunctionErr =   -9072   #function is not supported by this implementation
-kNoCardErr  =   -9071   #no PC card in the socket
-kGeneralFailureErr  =   -9070   #an undefined error has occurred
-kWriteFailureErr    =   -9069   #unable to complete write request
-kReadFailureErr =   -9068   #unable to complete read request
-kBadSpeedErr    =   -9067   #specified speed is unavailable
-kBadCISErr  =   -9066   #CIS on card is invalid
-kBadHandleErr   =   -9065   #clientHandle is invalid
-kBadArgsErr =   -9064   #values in argument packet are invalid
-kBadArgLengthErr    =   -9063   #ArgLength argument is invalid
-kBadWindowErr   =   -9062   #specified window is invalid
-kBadVppErr  =   -9061   #specified Vpp1 or Vpp2 power level index is invalid
-kBadVccErr  =   -9060   #specified Vcc power level index is invalid
-kBadTypeErr =   -9059   #specified window or interface type is invalid
-kBadSocketErr   =   -9058   #specified logical or physical socket number is invalid
-kBadSizeErr =   -9057   #specified size is invalid
-kBadPageErr =   -9056   #specified page is invalid
-kBadOffsetErr   =   -9055   #specified PC card memory array offset is invalid
-kBadIRQErr  =   -9054   #specified IRQ level is invalid
-kBadEDCErr  =   -9053   #specified EDC generator specified is invalid
-kBadBaseErr =   -9052   #specified base system memory address is invalid
-kBadAttributeErr    =   -9051   #specified attributes field value is invalid
-kBadAdapterErr  =   -9050   #invalid adapter number
-codecOffscreenFailedPleaseRetryErr  =   -8992   #codecOffscreenFailedPleaseRetryErr
-lockPortBitsWrongGDeviceErr =   -8991   #lockPortBitsWrongGDeviceErr
-directXObjectAlreadyExists  =   -8990   #directXObjectAlreadyExists
-codecDroppedFrameErr    =   -8989   #returned from ImageCodecDrawBand
-codecOffscreenFailedErr =   -8988   #codecOffscreenFailedErr
-codecNeedAccessKeyErr   =   -8987   #codec needs password in order to decompress
-codecParameterDialogConfirm =   -8986   #codecParameterDialogConfirm
-lockPortBitsSurfaceLostErr  =   -8985   #lockPortBitsSurfaceLostErr
-lockPortBitsBadPortErr  =   -8984   #lockPortBitsBadPortErr
-lockPortBitsWindowClippedErr    =   -8983   #lockPortBitsWindowClippedErr
-lockPortBitsWindowResizedErr    =   -8982   #lockPortBitsWindowResizedErr
-lockPortBitsWindowMovedErr  =   -8981   #lockPortBitsWindowMovedErr
-lockPortBitsBadSurfaceErr   =   -8980   #lockPortBitsBadSurfaceErr
-codecNeedToFlushChainErr    =   -8979   #codecNeedToFlushChainErr
-codecDisabledErr    =   -8978   #codec disabled itself -- pass codecFlagReenable to reset
-codecNoMemoryPleaseWaitErr  =   -8977   #codecNoMemoryPleaseWaitErr
-codecNothingToBlitErr   =   -8976   #codecNothingToBlitErr
-codecCantQueueErr   =   -8975   #codecCantQueueErr
-codecCantWhenErr    =   -8974   #codecCantWhenErr
-codecOpenErr    =   -8973   #codecOpenErr
-codecConditionErr   =   -8972   #codecConditionErr
-codecExtensionNotFoundErr   =   -8971   #codecExtensionNotFoundErr
-codecDataVersErr    =   -8970   #codecDataVersErr
-codecBadDataErr =   -8969   #codecBadDataErr
-codecWouldOffscreenErr  =   -8968   #codecWouldOffscreenErr
-codecAbortErr   =   -8967   #codecAbortErr
-codecSpoolErr   =   -8966   #codecSpoolErr
-codecImageBufErr    =   -8965   #codecImageBufErr
-codecScreenBufErr   =   -8964   #codecScreenBufErr
-codecSizeErr    =   -8963   #codecSizeErr
-codecUnimpErr   =   -8962   #codecUnimpErr
-noCodecErr  =   -8961   #noCodecErr
-codecErr    =   -8960   #codecErr
-kIllegalClockValueErr   =   -8852   #kIllegalClockValueErr
-kUTCOverflowErr =   -8851   #kUTCOverflowErr
-kUTCUnderflowErr    =   -8850   #kUTCUnderflowErr
-kATSULastErr    =   -8809   #The last ATSUI error code.
-kATSULineBreakInWord    =   -8808   #This is not an error code but is returned by ATSUBreakLine to
-kATSUCoordinateOverflowErr  =   -8807   #Used to indicate the coordinates provided to an ATSUI routine caused
-kATSUNoFontScalerAvailableErr   =   -8806   #Used when no font scaler is available for the font passed
-kATSUNoFontCmapAvailableErr =   -8805   #Used when no CMAP table can be accessed or synthesized for the
-kATSULowLevelErr    =   -8804   #Used when an error was encountered within the low level ATS
-kATSUQuickDrawTextErr   =   -8803   #Used when QuickDraw Text encounters an error rendering or measuring
-kATSUNoStyleRunsAssignedErr =   -8802   #Used when an attempt was made to measure, highlight or draw
-kATSUNotSetErr  =   -8801   #Used when the client attempts to retrieve an attribute,
-kATSUInvalidCacheErr    =   -8800   #Used when an attempt was made to read in style data
-kATSUInvalidAttributeTagErr =   -8799   #Used when an attempt was made to use a tag value that
-kATSUInvalidAttributeSizeErr    =   -8798   #Used when an attempt was made to use an attribute with a
-kATSUInvalidAttributeValueErr   =   -8797   #Used when an attempt was made to use an attribute with
-kATSUInvalidFontErr =   -8796   #Used when an attempt was made to use an invalid font ID.
-kATSUNoCorrespondingFontErr =   -8795   #This value is retrned by font ID conversion
-kATSUFontsNotMatched    =   -8794   #This value is returned by ATSUMatchFontsToText()
-kATSUFontsMatched   =   -8793   #This is not an error code but is returned by
-kATSUInvalidTextRangeErr    =   -8792   #An attempt was made to extract information
-kATSUInvalidStyleErr    =   -8791   #An attempt was made to use a ATSUStyle which
-kATSUInvalidTextLayoutErr   =   -8790   #An attempt was made to use a ATSUTextLayout
-kTECOutputBufferFullStatus  =   -8785   #output buffer has no room for conversion of next input text element (partial conversion)
-kTECNeedFlushStatus =   -8784   #kTECNeedFlushStatus
-kTECUsedFallbacksStatus =   -8783   #kTECUsedFallbacksStatus
-kTECItemUnavailableErr  =   -8771   #item (e.g. name) not available for specified region (& encoding if relevant)
-kTECGlobalsUnavailableErr   =   -8770   #globals have already been deallocated (premature TERM)
-unicodeChecksumErr  =   -8769   #unicodeChecksumErr
-unicodeNoTableErr   =   -8768   #unicodeNoTableErr
-unicodeVariantErr   =   -8767   #unicodeVariantErr
-unicodeFallbacksErr =   -8766   #unicodeFallbacksErr
-unicodePartConvertErr   =   -8765   #unicodePartConvertErr
-unicodeBufErr   =   -8764   #unicodeBufErr
-unicodeCharErr  =   -8763   #unicodeCharErr
-unicodeElementErr   =   -8762   #unicodeElementErr
-unicodeNotFoundErr  =   -8761   #unicodeNotFoundErr
-unicodeTableFormatErr   =   -8760   #unicodeTableFormatErr
-unicodeDirectionErr =   -8759   #unicodeDirectionErr
-unicodeContextualErr    =   -8758   #unicodeContextualErr
-unicodeTextEncodingDataErr  =   -8757   #unicodeTextEncodingDataErr
-kTECDirectionErr    =   -8756   #direction stack overflow, etc.
-kTECIncompleteElementErr    =   -8755   #text element may be incomplete or is too long for internal buffers
-kTECUnmappableElementErr    =   -8754   #kTECUnmappableElementErr
-kTECPartialCharErr  =   -8753   #input buffer ends in the middle of a multibyte character, conversion stopped
-kTECBadTextRunErr   =   -8752   #kTECBadTextRunErr
-kTECArrayFullErr    =   -8751   #supplied name buffer or TextRun, TextEncoding, or UnicodeMapping array is too small
-kTECBufferBelowMinimumSizeErr   =   -8750   #output buffer too small to allow processing of first input text element
-kTECNoConversionPathErr =   -8749   #kTECNoConversionPathErr
-kTECCorruptConverterErr =   -8748   #invalid converter object reference
-kTECTableFormatErr  =   -8747   #kTECTableFormatErr
-kTECTableChecksumErr    =   -8746   #kTECTableChecksumErr
-kTECMissingTableErr =   -8745   #kTECMissingTableErr
-kTextUndefinedElementErr    =   -8740   #text conversion errors
-kTextMalformedInputErr  =   -8739   #in DBCS, for example, high byte followed by invalid low byte
-kTextUnsupportedEncodingErr =   -8738   #specified encoding not supported for this operation
-kRANotEnabled   =   -7139   #kRANotEnabled
-kRACallBackFailed   =   -7138   #kRACallBackFailed
-kRADuplicateIPAddr  =   -7137   #kRADuplicateIPAddr
-kRANCPRejectedbyPeer    =   -7136   #kRANCPRejectedbyPeer
-kRAExtAuthenticationFailed  =   -7135   #kRAExtAuthenticationFailed
-kRAATalkInactive    =   -7134   #kRAATalkInactive
-kRAPeerNotResponding    =   -7133   #kRAPeerNotResponding
-kRAPPPPeerDisconnected  =   -7132   #kRAPPPPeerDisconnected
-kRAPPPUserDisconnected  =   -7131   #kRAPPPUserDisconnected
-kRAPPPNegotiationFailed =   -7130   #kRAPPPNegotiationFailed
-kRAPPPAuthenticationFailed  =   -7129   #kRAPPPAuthenticationFailed
-kRAPPPProtocolRejected  =   -7128   #kRAPPPProtocolRejected
-dcmBufferOverflowErr    =   -7127   #data is larger than buffer size
-kRANotPrimaryInterface  =   -7126   #when IPCP is not primary TCP/IP intf.
-kRATCPIPNotConfigured   =   -7125   #TCP/IP not configured, could be loaded
-kRATCPIPInactive    =   -7124   #TCP/IP inactive, cannot be loaded
-kRARemoteAccessNotReady =   -7123   #kRARemoteAccessNotReady
-kRAInitOpenTransportFailed  =   -7122   #kRAInitOpenTransportFailed
-dcmProtectedErr =   -7121   #need keyword to use dictionary
-kRAUserPwdEntryRequired =   -7120   #kRAUserPwdEntryRequired
-kRAUserPwdChangeRequired    =   -7119   #kRAUserPwdChangeRequired
-dcmBadFindMethodErr =   -7118   #no such find method supported
-kRAInvalidSerialProtocol    =   -7117   #kRAInvalidSerialProtocol
-kRAInvalidPortState =   -7116   #kRAInvalidPortState
-dcmBadKeyErr    =   -7115   #bad key information
-kRAPortBusy =   -7114   #kRAPortBusy
-kRAInstallationDamaged  =   -7113   #kRAInstallationDamaged
-dcmBadFieldTypeErr  =   -7112   #no such field type supported
-dcmBadFieldInfoErr  =   -7111   #incomplete information
-dcmNecessaryFieldErr    =   -7110   #lack required/identify field
-dcmDupRecordErr =   -7109   #same record already exist
-kRANotConnected =   -7108   #kRANotConnected
-dcmBlockFullErr =   -7107   #dictionary block full
-kRAMissingResources =   -7106   #kRAMissingResources
-dcmDictionaryBusyErr    =   -7105   #dictionary is busy
-dcmDictionaryNotOpenErr =   -7104   #dictionary not opened
-dcmPermissionErr    =   -7103   #invalid permission
-dcmBadDictionaryErr =   -7102   #invalid dictionary
-dcmNotDictionaryErr =   -7101   #not dictionary
-kRAInvalidParameter =   -7100   #kRAInvalidParameter
-laEngineNotFoundErr =   -7000   #can't find the engine
-laPropertyErr   =   -6999   #Error in properties
-kUSBUnknownDeviceErr    =   -6998   #device ref not recognised
-laPropertyIsReadOnlyErr =   -6997   #the property is read only
-laPropertyUnknownErr    =   -6996   #the property is unknown to this environment
-laPropertyValueErr  =   -6995   #Invalid property value
-laDictionaryTooManyErr  =   -6994   #too many dictionaries
-laDictionaryUnknownErr  =   -6993   #can't use this dictionary with this environment
-laDictionaryNotOpenedErr    =   -6992   #the dictionary is not opened
-laTextOverFlowErr   =   -6991   #text is too long
-laFailAnalysisErr   =   -6990   #analysis failed
-laNoMoreMorphemeErr =   -6989   #nothing to read
-laInvalidPathErr    =   -6988   #path is not correct
-kUSBNotHandled  =   -6987   #Notification was not handled   (same as NotFound)
-laEnvironmentNotFoundErr    =   -6986   #can't fint the specified environment
-laEnvironmentBusyErr    =   -6985   #specified environment is used
-laTooSmallBufferErr =   -6984   #output buffer is too small to store any result
-kUSBFlagsError  =   -6983   #Unused flags not zeroed
-kUSBAbortedError    =   -6982   #Pipe aborted
-kUSBNoBandwidthError    =   -6981   #Not enough bandwidth available
-kUSBPipeIdleError   =   -6980   #Pipe is Idle, it will not accept transactions
-kUSBPipeStalledError    =   -6979   #Pipe has stalled, error needs to be cleared
-kUSBUnknownInterfaceErr =   -6978   #Interface ref not recognised
-kUSBDeviceBusy  =   -6977   #Device is already being configured
-kUSBDevicePowerProblem  =   -6976   #Device has a power problem
-kUSBInvalidBuffer   =   -6975   #bad buffer, usually nil
-kUSBDeviceSuspended =   -6974   #Device is suspended
-kUSBDeviceNotSuspended  =   -6973   #device is not suspended for resume
-kUSBDeviceDisconnected  =   -6972   #Disconnected during suspend or reset
-kUSBTimedOut    =   -6971   #Transaction timed out.
-kUSBQueueAborted    =   -6970   #Pipe zero stall cleared.
-kUSBPortDisabled    =   -6969   #The port you are attached to is disabled, use USBDeviceReset.
-kUSBBadDispatchTable    =   -6950   #Improper driver dispatch table
-kUSBUnknownNotification =   -6949   #Notification type not defined
-kUSBQueueFull   =   -6948   #Internal queue maxxed
-kUSBLinkErr =   -6916   #kUSBLinkErr
-kUSBCRCErr  =   -6915   #Pipe stall, bad CRC
-kUSBBitstufErr  =   -6914   #Pipe stall, bitstuffing
-kUSBDataToggleErr   =   -6913   #Pipe stall, Bad data toggle
-kUSBEndpointStallErr    =   -6912   #Device didn't understand
-kUSBNotRespondingErr    =   -6911   #Pipe stall, No device, device hung
-kUSBPIDCheckErr =   -6910   #Pipe stall, PID CRC error
-kUSBWrongPIDErr =   -6909   #Pipe stall, Bad or wrong PID
-kUSBOverRunErr  =   -6908   #Packet too large or more data than buffer
-kUSBUnderRunErr =   -6907   #Less data than buffer
-kUSBRes1Err =   -6906   #kUSBRes1Err
-kUSBRes2Err =   -6905   #kUSBRes2Err
-kUSBBufOvrRunErr    =   -6904   #Host hardware failure on data in, PCI busy?
-kUSBBufUnderRunErr  =   -6903   #Host hardware failure on data out, PCI busy?
-kUSBNotSent1Err =   -6902   #Transaction not sent
-kUSBNotSent2Err =   -6901   #Transaction not sent
-kDMFoundErr =   -6232   #Did not proceed because we found an item
-kDMMainDisplayCannotMoveErr =   -6231   #Trying to move main display (or a display mirrored to it)
-kDMDisplayAlreadyInstalledErr   =   -6230   #Attempt to add an already installed display.
-kDMDisplayNotFoundErr   =   -6229   #Could not find item (will someday remove).
-kDMDriverNotDisplayMgrAwareErr  =   -6228   #Video Driver does not support display manager.
-kDMSWNotInitializedErr  =   -6227   #Required software not initialized (eg windowmanager or display mgr).
-kSysSWTooOld    =   -6226   #Missing critical pieces of System Software.
-kDMMirroringNotOn   =   -6225   #Returned by all calls that need mirroring to be on to do their thing.
-kDMCantBlock    =   -6224   #Mirroring is already on, canÕt Block now (call DMUnMirror() first).
-kDMMirroringBlocked =   -6223   #DMBlockMirroring() has been called.
-kDMWrongNumberOfDisplays    =   -6222   #Can only handle 2 displays for now.
-kDMMirroringOnAlready   =   -6221   #Returned by all calls that need mirroring to be off to do their thing.
-kDMGenErr   =   -6220   #Unexpected Error
-kQTSSUnknownErr =   -6150   #kQTSSUnknownErr
-collectionVersionErr    =   -5753   #collectionVersionErr
-collectionIndexRangeErr =   -5752   #collectionIndexRangeErr
-collectionItemNotFoundErr   =   -5751   #collectionItemNotFoundErr
-collectionItemLockedErr =   -5750   #collectionItemLockedErr
-kNavMissingKindStringErr    =   -5699   #kNavMissingKindStringErr
-kNavInvalidCustomControlMessageErr  =   -5698   #kNavInvalidCustomControlMessageErr
-kNavCustomControlMessageFailedErr   =   -5697   #kNavCustomControlMessageFailedErr
-kNavInvalidSystemConfigErr  =   -5696   #kNavInvalidSystemConfigErr
-kNavWrongDialogClassErr =   -5695   #kNavWrongDialogClassErr
-kNavWrongDialogStateErr =   -5694   #kNavWrongDialogStateErr
-dialogNoTimeoutErr  =   -5640   #dialogNoTimeoutErr
-menuInvalidErr  =   -5623   #menu is invalid
-menuItemNotFoundErr =   -5622   #specified menu item wasn't found
-menuUsesSystemDefErr    =   -5621   #GetMenuDefinition failed because the menu uses the system MDEF
-menuNotFoundErr =   -5620   #specified menu or menu ID wasn't found
-windowWrongStateErr =   -5615   #window is not in a state that is valid for the current action
-windowManagerInternalErr    =   -5614   #something really weird happened inside the window manager
-windowAttributesConflictErr =   -5613   #passed some attributes that are mutually exclusive
-windowAttributeImmutableErr =   -5612   #tried to change attributes which can't be changed
-errWindowDoesNotFitOnscreen =   -5611   #ConstrainWindowToScreen could not make the window fit onscreen
-errWindowNotFound   =   -5610   #returned from FindWindowOfClass
-errFloatingWindowsNotInitialized    =   -5609   #called HideFloatingWindows or ShowFloatingWindows without calling InitFloatingWindows
-errWindowsAlreadyInitialized    =   -5608   #tried to call InitFloatingWindows twice, or called InitWindows and then floating windows
-errUserWantsToDragWindow    =   -5607   #if returned from TrackWindowProxyDrag, you should call DragWindow on the window
-errCorruptWindowDescription =   -5606   #tried to load a corrupt window description (size or version fields incorrect)
-errUnrecognizedWindowClass  =   -5605   #tried to create a window with a bad WindowClass
-errWindowPropertyNotFound   =   -5604   #tried to get a nonexistent property
-errInvalidWindowProperty    =   -5603   #tried to access a property tag with private creator
-errWindowDoesNotHaveProxy   =   -5602   #tried to do something requiring a proxy to a window which doesnÕt have a proxy
-errUnsupportedWindowAttributesForClass  =   -5601   #tried to create a window with WindowAttributes not supported by the WindowClass
-errInvalidWindowPtr =   -5600   #tried to pass a bad WindowRef argument
-gestaltLocationErr  =   -5553   #gestalt function ptr wasn't in sysheap
-gestaltDupSelectorErr   =   -5552   #tried to add an entry that already existed
-gestaltUndefSelectorErr =   -5551   #undefined selector was passed to Gestalt
-gestaltUnknownErr   =   -5550   #value returned if Gestalt doesn't know the answer
-envVersTooBig   =   -5502   #Version bigger than call can handle
-envBadVers  =   -5501   #Version non-positive
-envNotPresent   =   -5500   #returned by glue.
-qtsAddressBusyErr   =   -5421   #qtsAddressBusyErr
-qtsConnectionFailedErr  =   -5420   #qtsConnectionFailedErr
-qtsTimeoutErr   =   -5408   #qtsTimeoutErr
-qtsUnknownValueErr  =   -5407   #qtsUnknownValueErr
-qtsTooMuchDataErr   =   -5406   #qtsTooMuchDataErr
-qtsUnsupportedFeatureErr    =   -5405   #qtsUnsupportedFeatureErr
-qtsUnsupportedRateErr   =   -5404   #qtsUnsupportedRateErr
-qtsUnsupportedDataTypeErr   =   -5403   #qtsUnsupportedDataTypeErr
-qtsBadDataErr   =   -5402   #something is wrong with the data
-qtsBadStateErr  =   -5401   #qtsBadStateErr
-qtsBadSelectorErr   =   -5400   #qtsBadSelectorErr
-errIAEndOfTextRun   =   -5388   #errIAEndOfTextRun
-errIATextExtractionErr  =   -5387   #errIATextExtractionErr
-errIAInvalidDocument    =   -5386   #errIAInvalidDocument
-errIACanceled   =   -5385   #errIACanceled
-errIABufferTooSmall =   -5384   #errIABufferTooSmall
-errIANoMoreItems    =   -5383   #errIANoMoreItems
-errIAParamErr   =   -5382   #errIAParamErr
-errIAAllocationErr  =   -5381   #errIAAllocationErr
-errIAUnknownErr =   -5380   #errIAUnknownErr
-hrURLNotHandledErr  =   -5363   #hrURLNotHandledErr
-hrUnableToResizeHandleErr   =   -5362   #hrUnableToResizeHandleErr
-hrMiscellaneousExceptionErr =   -5361   #hrMiscellaneousExceptionErr
-hrHTMLRenderingLibNotInstalledErr   =   -5360   #hrHTMLRenderingLibNotInstalledErr
-errCannotUndo   =   -5253   #errCannotUndo
-errNonContiuousAttribute    =   -5252   #errNonContiuousAttribute
-errUnknownElement   =   -5251   #errUnknownElement
-errReadOnlyText =   -5250   #errReadOnlyText
-errEmptyScrap   =   -5249   #errEmptyScrap
-errNoHiliteText =   -5248   #errNoHiliteText
-errOffsetNotOnElementBounday    =   -5247   #errOffsetNotOnElementBounday
-errInvalidRange =   -5246   #errInvalidRange
-errIteratorReachedEnd   =   -5245   #errIteratorReachedEnd
-errEngineNotFound   =   -5244   #errEngineNotFound
-errAlreadyInImagingMode =   -5243   #errAlreadyInImagingMode
-errNotInImagingMode =   -5242   #errNotInImagingMode
-errMarginWilllNotFit    =   -5241   #errMarginWilllNotFit
-errUnknownAttributeTag  =   -5240   #errUnknownAttributeTag
-afpSameNodeErr  =   -5063   #An Attempt was made to connect to a file server running on the same machine
-afpAlreadyMounted   =   -5062   #The volume is already mounted
-afpCantMountMoreSrvre   =   -5061   #The Maximum number of server connections has been reached
-afpBadDirIDType =   -5060   #afpBadDirIDType
-afpCallNotAllowed   =   -5048   #The server knows what you wanted to do, but won't let you do it just now
-afpAlreadyLoggedInErr   =   -5047   #User has been authenticated but is already logged in from another machine (and that's not allowed on this server)
-afpPwdPolicyErr =   -5046   #Password does not conform to servers password policy
-afpPwdNeedsChangeErr    =   -5045   #The password needs to be changed
-afpInsideTrashErr   =   -5044   #The folder being shared is inside the trash folder OR the shared folder is being moved into the trash folder
-afpInsideSharedErr  =   -5043   #The folder being shared is inside a shared folder OR the folder contains a shared folder and is being moved into a shared folder
-afpPwdExpiredErr    =   -5042   #The password being used is too old: this requires the user to change the password before log-in can continue
-afpPwdTooShortErr   =   -5041   #The password being set is too short: there is a minimum length that must be met or exceeded
-afpPwdSameErr   =   -5040   #Someone tried to change their password to the same password on a mantadory password change
-afpBadIDErr =   -5039   #afpBadIDErr
-afpSameObjectErr    =   -5038   #afpSameObjectErr
-afpCatalogChanged   =   -5037   #afpCatalogChanged
-afpDiffVolErr   =   -5036   #afpDiffVolErr
-afpIDExists =   -5035   #afpIDExists
-afpIDNotFound   =   -5034   #afpIDNotFound
-afpContainsSharedErr    =   -5033   #the folder being shared contains a shared folder
-afpObjectLocked =   -5032   #Object is M/R/D/W inhibited
-afpVolLocked    =   -5031   #Volume is Read-Only
-afpIconTypeError    =   -5030   #Icon size specified different from existing icon size
-afpDirNotFound  =   -5029   #Unknown directory specified
-afpCantRename   =   -5028   #AFPRename cannot rename volume
-afpServerGoingDown  =   -5027   #Server is shutting down
-afpTooManyFilesOpen =   -5026   #Maximum open file count reached
-afpObjectTypeErr    =   -5025   #File/Directory specified where Directory/File expected
-afpCallNotSupported =   -5024   #Unsupported AFP call was made
-afpUserNotAuth  =   -5023   #No AFPLogin call has successfully been made for this session
-afpSessClosed   =   -5022   #Session closed
-afpRangeOverlap =   -5021   #Some or all of range already locked by same user
-afpRangeNotLocked   =   -5020   #Tried to unlock range that was not locked by user
-afpParmErr  =   -5019   #A specified parameter was out of allowable range
-afpObjectNotFound   =   -5018   #Specified file or directory does not exist
-afpObjectExists =   -5017   #Specified destination file or directory already exists
-afpNoServer =   -5016   #Server not responding
-afpNoMoreLocks  =   -5015   #Maximum lock limit reached
-afpMiscErr  =   -5014   #Unexpected error encountered during execution
-afpLockErr  =   -5013   #Some or all of requested range is locked by another user
-afpItemNotFound =   -5012   #Unknown UserName/UserID or missing comment/APPL entry
-afpFlatVol  =   -5011   #Cannot create directory on specified volume
-afpFileBusy =   -5010   #Cannot delete an open file
-afpEofError =   -5009   #Read beyond logical end-of-file
-afpDiskFull =   -5008   #Insufficient free space on volume for operation
-afpDirNotEmpty  =   -5007   #Cannot delete non-empty directory
-afpDenyConflict =   -5006   #Specified open/deny modes conflict with current open modes
-afpCantMove =   -5005   #Move destination is offspring of source, or root was specified
-afpBitmapErr    =   -5004   #Bitmap contained bits undefined for call
-afpBadVersNum   =   -5003   #Unknown AFP protocol version number specified
-afpBadUAM   =   -5002   #Unknown user authentication method specified
-afpAuthContinue =   -5001   #Further information required to complete AFPLogin call
-afpAccessDenied =   -5000   #Insufficient access privileges for operation
-illegalScrapFlavorSizeErr   =   -4999   #illegalScrapFlavorSizeErr
-illegalScrapFlavorTypeErr   =   -4998   #illegalScrapFlavorTypeErr
-illegalScrapFlavorFlagsErr  =   -4997   #illegalScrapFlavorFlagsErr
-scrapFlavorSizeMismatchErr  =   -4996   #scrapFlavorSizeMismatchErr
-scrapFlavorFlagsMismatchErr =   -4995   #scrapFlavorFlagsMismatchErr
-nilScrapFlavorDataErr   =   -4994   #nilScrapFlavorDataErr
-noScrapPromiseKeeperErr =   -4993   #noScrapPromiseKeeperErr
-scrapPromiseNotKeptErr  =   -4992   #scrapPromiseNotKeptErr
-processStateIncorrectErr    =   -4991   #processStateIncorrectErr
-badScrapRefErr  =   -4990   #badScrapRefErr
-duplicateScrapFlavorErr =   -4989   #duplicateScrapFlavorErr
-internalScrapErr    =   -4988   #internalScrapErr
-coreFoundationUnknownErr    =   -4960   #coreFoundationUnknownErr
-badRoutingSizeErr   =   -4276   #badRoutingSizeErr
-routingNotFoundErr  =   -4275   #routingNotFoundErr
-duplicateRoutingErr =   -4274   #duplicateRoutingErr
-invalidFolderTypeErr    =   -4273   #invalidFolderTypeErr
-noMoreFolderDescErr =   -4272   #noMoreFolderDescErr
-duplicateFolderDescErr  =   -4271   #duplicateFolderDescErr
-badFolderDescErr    =   -4270   #badFolderDescErr
-cmCantGamutCheckError   =   -4217   #Gammut checking not supported by this ColorWorld
-cmNamedColorNotFound    =   -4216   #NamedColor not found
-cmCantCopyModifiedV1Profile =   -4215   #Illegal to copy version 1 profiles that have been modified
-cmRangeOverFlow =   -4214   #Color conversion warning that some output color values over/underflowed and were clipped
-cmInvalidProfileComment =   -4213   #Bad Profile comment during drawpicture
-cmNoGDevicesError   =   -4212   #Begin/End Matching -- no gdevices available
-cmInvalidDstMap =   -4211   #Destination pix/bit map was invalid
-cmInvalidSrcMap =   -4210   #Source pix/bit map was invalid
-cmInvalidColorSpace =   -4209   #Profile colorspace does not match bitmap type
-cmErrIncompatibleProfile    =   -4208   #Other ColorSync Errors
-cmSearchError   =   -4207   #cmSearchError
-cmInvalidSearch =   -4206   #Bad Search Handle
-cmInvalidProfileLocation    =   -4205   #Operation not supported for this profile location
-cmInvalidProfile    =   -4204   #A Profile must contain a 'cs1 ' tag to be valid
-cmFatalProfileErr   =   -4203   #cmFatalProfileErr
-cmCantDeleteElement =   -4202   #cmCantDeleteElement
-cmIndexRangeErr =   -4201   #Tag index out of range
-kNSLInitializationFailed    =   -4200   #UNABLE TO INITIALIZE THE MANAGER!!!!! DO NOT CONTINUE!!!!
-kNSLNotInitialized  =   -4199   #kNSLNotInitialized
-kNSLInsufficientSysVer  =   -4198   #kNSLInsufficientSysVer
-kNSLInsufficientOTVer   =   -4197   #kNSLInsufficientOTVer
-kNSLNoElementsInList    =   -4196   #kNSLNoElementsInList
-kNSLBadReferenceErr =   -4195   #kNSLBadReferenceErr
-kNSLBadServiceTypeErr   =   -4194   #kNSLBadServiceTypeErr
-kNSLBadDataTypeErr  =   -4193   #kNSLBadDataTypeErr
-kNSLBadNetConnection    =   -4192   #kNSLBadNetConnection
-kNSLNoSupportForService =   -4191   #kNSLNoSupportForService
-kNSLInvalidPluginSpec   =   -4190   #kNSLInvalidPluginSpec
-kNSLRequestBufferAlreadyInList  =   -4189   #kNSLRequestBufferAlreadyInList
-kNSLNoContextAvailable  =   -4188   #(ContinueLookup function ptr invalid)
-kNSLBufferTooSmallForData   =   -4187   #(Client buffer too small for data from plugin)
-kNSLCannotContinueLookup    =   -4186   #(Can't continue lookup; error or bad state)
-kNSLBadClientInfoPtr    =   -4185   #(nil ClientAsyncInfoPtr; no reference available)
-kNSLNullListPtr =   -4184   #(client is trying to add items to a nil list)
-kNSLBadProtocolTypeErr  =   -4183   #(client is trying to add a null protocol type)
-kNSLPluginLoadFailed    =   -4182   #(manager unable to load one of the plugins)
-kNSLNoPluginsFound  =   -4181   #(manager didn't find any valid plugins to load)
-kNSLSearchAlreadyInProgress =   -4180   #(you can only have one ongoing search per clientRef)
-kNSLNoPluginsForSearch  =   -4179   #(no plugins will respond to search request; bad protocol(s)?)
-kNSLNullNeighborhoodPtr =   -4178   #(client passed a null neighborhood ptr)
-kNSLSomePluginsFailedToLoad =   -4177   #(one or more plugins failed to load, but at least one did load; this error isn't fatal)
-kNSLErrNullPtrError =   -4176   #kNSLErrNullPtrError
-kNSLNotImplementedYet   =   -4175   #kNSLNotImplementedYet
-kNSLUILibraryNotAvailable   =   -4174   #The NSL UI Library needs to be in the Extensions Folder
-kNSLNoCarbonLib =   -4173   #kNSLNoCarbonLib
-kNSLBadURLSyntax    =   -4172   #URL contains illegal characters
-kNSLSchedulerError  =   -4171   #A custom thread routine encountered an error
-kNSL68kContextNotSupported  =   -4170   #no 68k allowed
-noHelpForItem   =   -4009   #noHelpForItem
-badProfileError =   -4008   #badProfileError
-colorSyncNotInstalled   =   -4007   #colorSyncNotInstalled
-pickerCantLive  =   -4006   #pickerCantLive
-cantLoadPackage =   -4005   #cantLoadPackage
-cantCreatePickerWindow  =   -4004   #cantCreatePickerWindow
-cantLoadPicker  =   -4003   #cantLoadPicker
-pickerResourceError =   -4002   #pickerResourceError
-requiredFlagsDontMatch  =   -4001   #requiredFlagsDontMatch
-firstPickerError    =   -4000   #firstPickerError
-kOTPortLostConnection   =   -3285   #
-kOTUserRequestedErr =   -3284   #
-kOTConfigurationChangedErr  =   -3283   #
-kOTBadConfigurationErr  =   -3282   #
-kOTPortWasEjectedErr    =   -3281   #
-kOTPortHasDiedErr   =   -3280   #
-kOTClientNotInittedErr  =   -3279   #
-kENOMSGErr  =   -3278   #
-kESRCHErr   =   -3277   #
-kEINPROGRESSErr =   -3276   #
-kENODATAErr =   -3275   #
-kENOSTRErr  =   -3274   #
-kECANCELErr =   -3273   #
-kEBADMSGErr =   -3272   #
-kENOSRErr   =   -3271   #
-kETIMEErr   =   -3270   #
-kEPROTOErr  =   -3269   #‚‚‚ fill out missing codes ‚‚‚
-kEHOSTUNREACHErr    =   -3264   #No route to host
-kEHOSTDOWNErr   =   -3263   #Host is down
-kECONNREFUSEDErr    =   -3260   #Connection refused
-kETIMEDOUTErr   =   -3259   #Connection timed out
-kETOOMANYREFSErr    =   -3258   #Too many references: can't splice
-kESHUTDOWNErr   =   -3257   #Can't send after socket shutdown
-kENOTCONNErr    =   -3256   #Socket is not connected
-kEISCONNErr =   -3255   #Socket is already connected
-kENOBUFSErr =   -3254   #No buffer space available
-kECONNRESETErr  =   -3253   #Connection reset by peer
-kECONNABORTEDErr    =   -3252   #Software caused connection abort
-kENETRESETErr   =   -3251   #Network dropped connection on reset
-kENETUNREACHErr =   -3250   #Network is unreachable
-kENETDOWNErr    =   -3249   #Network is down
-kEADDRNOTAVAILErr   =   -3248   #Can't assign requested address
-kEADDRINUSEErr  =   -3247   #Address already in use
-kEOPNOTSUPPErr  =   -3244   #Operation not supported on socket
-kESOCKTNOSUPPORTErr =   -3243   #Socket type not supported
-kEPROTONOSUPPORTErr =   -3242   #Protocol not supported
-kENOPROTOOPTErr =   -3241   #Protocol not available
-kEPROTOTYPEErr  =   -3240   #Protocol wrong type for socket
-kEMSGSIZEErr    =   -3239   #Message too long
-kEDESTADDRREQErr    =   -3238   #Destination address required
-kENOTSOCKErr    =   -3237   #Socket operation on non-socket
-kEALREADYErr    =   -3236   #
-kEWOULDBLOCKErr =   -3234   #Call would block, so was aborted
-kERANGEErr  =   -3233   #Message size too large for STREAM
-kEPIPEErr   =   -3231   #Broken pipe
-kENOTTYErr  =   -3224   #Not a character device
-kEINVALErr  =   -3221   #Invalid argument
-kENODEVErr  =   -3218   #No such device
-kOTDuplicateFoundErr    =   -3216   #OT generic duplicate found error
-kEBUSYErr   =   -3215   #Device or resource busy
-kEFAULTErr  =   -3213   #Bad address
-kEACCESErr  =   -3212   #Permission denied
-kOTOutOfMemoryErr   =   -3211   #OT ran out of memory, may be a temporary
-kEAGAINErr  =   -3210   #Try operation again later
-kEBADFErr   =   -3208   #Bad file number
-kENXIOErr   =   -3205   #No such device or address
-kEIOErr =   -3204   #I/O error
-kEINTRErr   =   -3203   #Interrupted system service
-kENORSRCErr =   -3202   #No such resource
-kOTNotFoundErr  =   -3201   #OT generic not found error
-kEPERMErr   =   -3200   #Permission denied
-kOTCanceledErr  =   -3180   #XTI2OSStatus(TCANCELED) The command was cancelled
-kOTBadSyncErr   =   -3179   #XTI2OSStatus(TBADSYNC) A synchronous call at interrupt time
-kOTProtocolErr  =   -3178   #XTI2OSStatus(TPROTO) An unspecified provider error occurred
-kOTQFullErr =   -3177   #XTI2OSStatus(TQFULL)
-kOTResAddressErr    =   -3176   #XTI2OSStatus(TRESADDR)
-kOTResQLenErr   =   -3175   #XTI2OSStatus(TRESQLEN)
-kOTProviderMismatchErr  =   -3174   #XTI2OSStatus(TPROVMISMATCH) Tried to accept on incompatible endpoint
-kOTIndOutErr    =   -3173   #XTI2OSStatus(TINDOUT) Accept failed because of pending listen
-kOTAddressBusyErr   =   -3172   #XTI2OSStatus(TADDRBUSY) Address requested is already in use
-kOTBadQLenErr   =   -3171   #XTI2OSStatus(TBADQLEN) A Bind to an in-use addr with qlen > 0
-kOTBadNameErr   =   -3170   #XTI2OSStatus(TBADNAME) A bad endpoint name was supplied
-kOTNoStructureTypeErr   =   -3169   #XTI2OSStatus(TNOSTRUCTYPE) Bad structure type requested for OTAlloc
-kOTStateChangeErr   =   -3168   #XTI2OSStatus(TSTATECHNG) State is changing - try again later
-kOTNotSupportedErr  =   -3167   #XTI2OSStatus(TNOTSUPPORT) Command is not supported
-kOTNoReleaseErr =   -3166   #XTI2OSStatus(TNOREL) No orderly release indication available
-kOTBadFlagErr   =   -3165   #XTI2OSStatus(TBADFLAG) A Bad flag value was supplied
-kOTNoUDErrErr   =   -3164   #XTI2OSStatus(TNOUDERR) No Unit Data Error indication available
-kOTNoDisconnectErr  =   -3163   #XTI2OSStatus(TNODIS) No disconnect indication available
-kOTNoDataErr    =   -3162   #XTI2OSStatus(TNODATA) No data available for reading
-kOTFlowErr  =   -3161   #XTI2OSStatus(TFLOW) Provider is flow-controlled
-kOTBufferOverflowErr    =   -3160   #XTI2OSStatus(TBUFOVFLW) Passed buffer not big enough
-kOTBadDataErr   =   -3159   #XTI2OSStatus(TBADDATA) An illegal amount of data was specified
-kOTLookErr  =   -3158   #XTI2OSStatus(TLOOK) An event occurred - call Look()
-kOTSysErrorErr  =   -3157   #XTI2OSStatus(TSYSERR) A system error occurred
-kOTBadSequenceErr   =   -3156   #XTI2OSStatus(TBADSEQ) Sequence specified does not exist
-kOTOutStateErr  =   -3155   #XTI2OSStatus(TOUTSTATE) Call issued in wrong state
-kOTNoAddressErr =   -3154   #XTI2OSStatus(TNOADDR) No address was specified
-kOTBadReferenceErr  =   -3153   #XTI2OSStatus(TBADF) Bad provider reference
-kOTAccessErr    =   -3152   #XTI2OSStatus(TACCES) Missing access permission
-kOTBadOptionErr =   -3151   #XTI2OSStatus(TBADOPT) A Bad option was specified
-kOTBadAddressErr    =   -3150   #XTI2OSStatus(TBADADDR) A Bad address was specified
-sktClosedErr    =   -3109   #sktClosedErr
-recNotFnd   =   -3108   #recNotFnd
-atpBadRsp   =   -3107   #atpBadRsp
-atpLenErr   =   -3106   #atpLenErr
-readQErr    =   -3105   #readQErr
-extractErr  =   -3104   #extractErr
-ckSumErr    =   -3103   #ckSumErr
-noMPPErr    =   -3102   #noMPPErr
-buf2SmallErr    =   -3101   #buf2SmallErr
-noPrefAppErr    =   -3032   #noPrefAppErr
-badTranslationSpecErr   =   -3031   #badTranslationSpecErr
-noTranslationPathErr    =   -3030   #noTranslationPathErr
-couldNotParseSourceFileErr  =   -3026   #Source document does not contain source type
-invalidTranslationPathErr   =   -3025   #Source type to destination type not a valid path
-retryComponentRegistrationErr   =   -3005   #retryComponentRegistrationErr
-unresolvedComponentDLLErr   =   -3004   #unresolvedComponentDLLErr
-componentDontRegister   =   -3003   #componentDontRegister
-componentNotCaptured    =   -3002   #componentNotCaptured
-validInstancesExist =   -3001   #validInstancesExist
-invalidComponentID  =   -3000   #invalidComponentID
-cfragLastErrCode    =   -2899   #The last value in the range of CFM errors.
-cfragOutputLengthErr    =   -2831   #An output parameter is too small to hold the value.
-cfragAbortClosureErr    =   -2830   #Used by notification handlers to abort a closure.
-cfragClosureIDErr   =   -2829   #The closure ID was not valid.
-cfragContainerIDErr =   -2828   #The fragment container ID was not valid.
-cfragNoRegistrationErr  =   -2827   #The registration name was not found.
-cfragNotClosureErr  =   -2826   #The closure ID was actually a connection ID.
-cfragFileSizeErr    =   -2825   #A file was too large to be mapped.
-cfragFragmentUsageErr   =   -2824   #A semantic error in usage of the fragment.
-cfragArchitectureErr    =   -2823   #A fragment has an unacceptable architecture.
-cfragNoApplicationErr   =   -2822   #No application member found in the cfrg resource.
-cfragInitFunctionErr    =   -2821   #A fragment's initialization routine returned an error.
-cfragFragmentCorruptErr =   -2820   #A fragment's container was corrupt (known format).
-cfragCFMInternalErr =   -2819   #An internal inconstistancy has been detected.
-cfragCFMStartupErr  =   -2818   #Internal error during CFM initialization.
-cfragLibConnErr =   -2817   #
-cfragInitAtBootErr  =   -2816   #A boot library has an initialization function.  (System 7 only)
-cfragInitLoopErr    =   -2815   #Circularity in required initialization order.
-cfragImportTooNewErr    =   -2814   #An import library was too new for a client.
-cfragImportTooOldErr    =   -2813   #An import library was too old for a client.
-cfragInitOrderErr   =   -2812   #
-cfragNoIDsErr   =   -2811   #No more CFM IDs for contexts, connections, etc.
-cfragNoClientMemErr =   -2810   #Out of memory for fragment mapping or section instances.
-cfragNoPrivateMemErr    =   -2809   #Out of memory for internal bookkeeping.
-cfragNoPositionErr  =   -2808   #The registration insertion point was not found.
-cfragUnresolvedErr  =   -2807   #A fragment had "hard" unresolved imports.
-cfragFragmentFormatErr  =   -2806   #A fragment's container format is unknown.
-cfragDupRegistrationErr =   -2805   #The registration name was already in use.
-cfragNoLibraryErr   =   -2804   #The named library was not found.
-cfragNoSectionErr   =   -2803   #The specified section was not found.
-cfragNoSymbolErr    =   -2802   #The specified symbol was not found.
-cfragConnectionIDErr    =   -2801   #The connection ID was not valid.
-cfragFirstErrCode   =   -2800   #The first value in the range of CFM errors.
-errASInconsistentNames  =   -2780   #English errors:
-errASNoResultReturned   =   -2763   #The range -2780 thru -2799 is reserved for dialect specific error codes. (Error codes from different dialects may overlap.)
-errASParameterNotForEvent   =   -2762   #errASParameterNotForEvent
-errASIllegalFormalParameter =   -2761   #errASIllegalFormalParameter
-errASTerminologyNestingTooDeep  =   -2760   #errASTerminologyNestingTooDeep
-OSAControlFlowError =   -2755   #Signaled when illegal control flow occurs in an application (no catcher for throw, non-lexical loop exit, etc.)
-OSAInconsistentDeclarations =   -2754   #Signaled when a variable is declared inconsistently in the same scope, such as both local and global
-OSAUndefinedVariable    =   -2753   #Signaled when a variable is accessed that has no value
-OSADuplicateHandler =   -2752   #Signaled when more than one handler is defined with the same name in a scope where the language doesn't allow it
-OSADuplicateProperty    =   -2751   #Signaled when a formal parameter, local variable, or instance variable is specified more than once.
-OSADuplicateParameter   =   -2750   #Signaled when a formal parameter, local variable, or instance variable is specified more than once
-OSATokenTooLong =   -2742   #Signaled when a name or number is too long to be parsed
-OSASyntaxTypeError  =   -2741   #Signaled when another form of syntax was expected. (e.g. "expected a <type> but found <this>")
-OSASyntaxError  =   -2740   #Signaled when a syntax error occurs. (e.g. "Syntax error" or "<this> can't go after <that>")
-errASCantCompareMoreThan32k =   -2721   #Parser/Compiler errors:
-errASCantConsiderAndIgnore  =   -2720   #errASCantConsiderAndIgnore
-errOSACantCreate    =   -2710   #errOSACantCreate
-errOSACantGetTerminology    =   -2709   #errOSACantGetTerminology
-errOSADataBlockTooLarge =   -2708   #Signaled when an intrinsic limitation is exceeded for the size of a value or data structure.
-errOSAInternalTableOverflow =   -2707   #Signaled when a runtime internal data structure overflows
-errOSAStackOverflow =   -2706   #Signaled when the runtime stack overflows
-errOSACorruptTerminology    =   -2705   #Signaled when an application's terminology resource is not readable
-errOSAAppNotHighLevelEventAware =   -2704   #Signaled when an application can't respond to AppleEvents
-errOSACantLaunch    =   -2703   #Signaled when application can't be launched or when it is remote and program linking is not enabled
-errOSANumericOverflow   =   -2702   #Signaled when integer or real value is too large to be represented
-errOSADivideByZero  =   -2701   #Signaled when there is an attempt to divide by zero
-errOSAGeneralError  =   -2700   #Signaled by user scripts or applications when no actual error code is to be returned.
-noIconDataAvailableErr  =   -2582   #The necessary icon data is not available
-noSuchIconErr   =   -2581   #The requested icon could not be found
-invalidIconRefErr   =   -2580   #The icon ref is not valid
-nrCallNotSupported  =   -2557   #This call is not available or supported on this machine
-nrTransactionAborted    =   -2556   #transaction was aborted
-nrExitedIteratorScope   =   -2555   #outer scope of iterator was exited
-nrIterationDone =   -2554   #iteration operation is done
-nrPropertyAlreadyExists =   -2553   #property already exists
-nrInvalidEntryIterationOp   =   -2552   #invalid entry iteration operation
-nrPathBufferTooSmall    =   -2551   #buffer for path is too small
-nrPathNotFound  =   -2550   #a path component lookup failed
-nrResultCodeBase    =   -2549   #nrResultCodeBase
-nrOverrunErr    =   -2548   #nrOverrunErr
-nrNotModifiedErr    =   -2547   #nrNotModifiedErr
-nrTypeMismatchErr   =   -2546   #nrTypeMismatchErr
-nrPowerSwitchAbortErr   =   -2545   #nrPowerSwitchAbortErr
-nrPowerErr  =   -2544   #nrPowerErr
-nrDataTruncatedErr  =   -2543   #nrDataTruncatedErr
-nrNotSlotDeviceErr  =   -2542   #nrNotSlotDeviceErr
-nrNameErr   =   -2541   #nrNameErr
-nrNotCreatedErr =   -2540   #nrNotCreatedErr
-nrNotFoundErr   =   -2539   #nrNotFoundErr
-nrInvalidNodeErr    =   -2538   #nrInvalidNodeErr
-nrNotEnoughMemoryErr    =   -2537   #nrNotEnoughMemoryErr
-nrLockedErr =   -2536   #nrLockedErr
-mmInternalError =   -2526   #mmInternalError
-tsmDefaultIsNotInputMethodErr   =   -2524   #Current Input source is KCHR or uchr, not Input Method  (GetDefaultInputMethod)
-tsmNoStem   =   -2523   #No stem exists for the token
-tsmNoMoreTokens =   -2522   #No more tokens are available for the source text
-tsmNoHandler    =   -2521   #No Callback Handler exists for callback
-tsmInvalidContext   =   -2520   #Invalid TSMContext specified in call
-tsmUnknownErr   =   -2519   #any other errors
-tsmUnsupportedTypeErr   =   -2518   #unSupported interface type error
-tsmScriptHasNoIMErr =   -2517   #script has no imput method or is using old IM
-tsmInputMethodIsOldErr  =   -2516   #returned by GetDefaultInputMethod
-tsmComponentAlreadyOpenErr  =   -2515   #text service already opened for the document
-tsmTSNotOpenErr =   -2514   #text service is not open
-tsmTSHasNoMenuErr   =   -2513   #the text service has no menu
-tsmUseInputWindowErr    =   -2512   #not TSM aware because we are using input window
-tsmDocumentOpenErr  =   -2511   #there are open documents
-tsmTextServiceNotFoundErr   =   -2510   #no text service found
-tsmCantOpenComponentErr =   -2509   #canÕt open the component
-tsmNoOpenTSErr  =   -2508   #no open text service
-tsmDocNotActiveErr  =   -2507   #document is NOT active
-tsmTSMDocBusyErr    =   -2506   #document is still active
-tsmInvalidDocIDErr  =   -2505   #invalid TSM documentation id
-tsmNeverRegisteredErr   =   -2504   #app never registered error (not TSM aware)
-tsmAlreadyRegisteredErr =   -2503   #want to register again error
-tsmNotAnAppErr  =   -2502   #not an application error
-tsmInputMethodNotFoundErr   =   -2501   #tsmInputMethodNotFoundErr
-tsmUnsupScriptLanguageErr   =   -2500   #tsmUnsupScriptLanguageErr
-kernelUnrecoverableErr  =   -2499   #kernelUnrecoverableErr
-kernelReturnValueErr    =   -2422   #kernelReturnValueErr
-kernelAlreadyFreeErr    =   -2421   #kernelAlreadyFreeErr
-kernelIDErr =   -2419   #kernelIDErr
-kernelExceptionErr  =   -2418   #kernelExceptionErr
-kernelTerminatedErr =   -2417   #kernelTerminatedErr
-kernelInUseErr  =   -2416   #kernelInUseErr
-kernelTimeoutErr    =   -2415   #kernelTimeoutErr
-kernelAsyncReceiveLimitErr  =   -2414   #kernelAsyncReceiveLimitErr
-kernelAsyncSendLimitErr =   -2413   #kernelAsyncSendLimitErr
-kernelAttributeErr  =   -2412   #kernelAttributeErr
-kernelExecutionLevelErr =   -2411   #kernelExecutionLevelErr
-kernelDeletePermissionErr   =   -2410   #kernelDeletePermissionErr
-kernelExecutePermissionErr  =   -2409   #kernelExecutePermissionErr
-kernelReadPermissionErr =   -2408   #kernelReadPermissionErr
-kernelWritePermissionErr    =   -2407   #kernelWritePermissionErr
-kernelObjectExistsErr   =   -2406   #kernelObjectExistsErr
-kernelUnsupportedErr    =   -2405   #kernelUnsupportedErr
-kernelPrivilegeErr  =   -2404   #kernelPrivilegeErr
-kernelOptionsErr    =   -2403   #kernelOptionsErr
-kernelCanceledErr   =   -2402   #kernelCanceledErr
-kernelIncompleteErr =   -2401   #kernelIncompleteErr
-badCallOrderErr =   -2209   #Usually due to a status call being called prior to being setup first
-noDMAErr    =   -2208   #CanÕt do DMA digitizing (i.e. can't go to requested dest
-badDepthErr =   -2207   #CanÕt digitize into this depth
-notExactSizeErr =   -2206   #CanÕt do exact size requested
-noMoreKeyColorsErr  =   -2205   #all key indexes in use
-notExactMatrixErr   =   -2204   #warning of bad matrix, digitizer did its best
-matrixErr   =   -2203   #bad matrix, digitizer did nothing
-qtParamErr  =   -2202   #bad input parameter (out of range, etc)
-digiUnimpErr    =   -2201   #feature unimplemented
-qtXMLApplicationErr =   -2159   #qtXMLApplicationErr
-qtXMLParseErr   =   -2158   #qtXMLParseErr
-qtActionNotHandledErr   =   -2157   #qtActionNotHandledErr
-notEnoughDataErr    =   -2149   #notEnoughDataErr
-urlDataHFTPURLErr   =   -2148   #urlDataHFTPURLErr
-urlDataHFTPServerDisconnectedErr    =   -2147   #urlDataHFTPServerDisconnectedErr
-urlDataHFTPNoPasswordErr    =   -2146   #urlDataHFTPNoPasswordErr
-urlDataHFTPNeedPasswordErr  =   -2145   #urlDataHFTPNeedPasswordErr
-urlDataHFTPBadNameListErr   =   -2144   #urlDataHFTPBadNameListErr
-urlDataHFTPNoNetDriverErr   =   -2143   #urlDataHFTPNoNetDriverErr
-urlDataHFTPFilenameErr  =   -2142   #urlDataHFTPFilenameErr
-urlDataHFTPPermissionsErr   =   -2141   #urlDataHFTPPermissionsErr
-urlDataHFTPQuotaErr =   -2140   #urlDataHFTPQuotaErr
-urlDataHFTPNoDirectoryErr   =   -2139   #urlDataHFTPNoDirectoryErr
-urlDataHFTPDataConnectionErr    =   -2138   #urlDataHFTPDataConnectionErr
-urlDataHFTPServerErr    =   -2137   #urlDataHFTPServerErr
-urlDataHFTPBadPasswordErr   =   -2136   #urlDataHFTPBadPasswordErr
-urlDataHFTPBadUserErr   =   -2135   #urlDataHFTPBadUserErr
-urlDataHFTPShutdownErr  =   -2134   #urlDataHFTPShutdownErr
-urlDataHFTPProtocolErr  =   -2133   #urlDataHFTPProtocolErr
-urlDataHHTTPRedirectErr =   -2132   #urlDataHHTTPRedirectErr
-urlDataHHTTPURLErr  =   -2131   #urlDataHHTTPURLErr
-urlDataHHTTPNoNetDriverErr  =   -2130   #urlDataHHTTPNoNetDriverErr
-urlDataHHTTPProtocolErr =   -2129   #urlDataHHTTPProtocolErr
-qtNetworkAlreadyAllocatedErr    =   -2127   #qtNetworkAlreadyAllocatedErr
-notAllowedToSaveMovieErr    =   -2126   #notAllowedToSaveMovieErr
-fileOffsetTooBigErr =   -2125   #fileOffsetTooBigErr
-ASDEntryNotFoundErr =   -2124   #ASDEntryNotFoundErr
-ASDBadForkErr   =   -2123   #ASDBadForkErr
-ASDBadHeaderErr =   -2122   #ASDBadHeaderErr
-AAPNotFoundErr  =   -2121   #AAPNotFoundErr
-AAPNotCreatedErr    =   -2120   #AAPNotCreatedErr
-qfcbNotCreatedErr   =   -2119   #qfcbNotCreatedErr
-qfcbNotFoundErr =   -2118   #qfcbNotFoundErr
-wackBadMetaDataErr  =   -2117   #wackBadMetaDataErr
-wackForkNotFoundErr =   -2116   #wackForkNotFoundErr
-wackBadFileErr  =   -2115   #wackBadFileErr
-unknownFormatErr    =   -2114   #unknownFormatErr
-pathNotVerifiedErr  =   -2113   #pathNotVerifiedErr
-noPathMappingErr    =   -2112   #noPathMappingErr
-emptyPathErr    =   -2111   #emptyPathErr
-pathTooLongErr  =   -2110   #pathTooLongErr
-cannotBeLeafAtomErr =   -2109   #cannotBeLeafAtomErr
-invalidAtomTypeErr  =   -2108   #invalidAtomTypeErr
-invalidAtomContainerErr =   -2107   #invalidAtomContainerErr
-invalidAtomErr  =   -2106   #invalidAtomErr
-duplicateAtomTypeAndIDErr   =   -2105   #duplicateAtomTypeAndIDErr
-atomIndexInvalidErr =   -2104   #atomIndexInvalidErr
-atomsNotOfSameTypeErr   =   -2103   #atomsNotOfSameTypeErr
-notLeafAtomErr  =   -2102   #notLeafAtomErr
-cannotFindAtomErr   =   -2101   #cannotFindAtomErr
-unsupportedProcessorErr =   -2097   #unsupportedProcessorErr
-unsupportedOSErr    =   -2096   #unsupportedOSErr
-qtmlUninitialized   =   -2095   #qtmlUninitialized
-qtmlDllEntryNotFoundErr =   -2094   #Windows specific errors (when qtml is loading)
-qtmlDllLoadErr  =   -2093   #Windows specific errors (when qtml is loading)
-componentDllEntryNotFoundErr    =   -2092   #Windows specific errors (when component is loading)
-componentDllLoadErr =   -2091   #Windows specific errors (when component is loading)
-videoOutputInUseErr =   -2090   #videoOutputInUseErr
-noExportProcAvailableErr    =   -2089   #noExportProcAvailableErr
-tuneParseOSErr  =   -2087   #tuneParseOSErr
-tunePlayerFullOSErr =   -2086   #tunePlayerFullOSErr
-noteChannelNotAllocatedOSErr    =   -2085   #noteChannelNotAllocatedOSErr
-illegalNoteChannelOSErr =   -2084   #illegalNoteChannelOSErr
-synthesizerOSErr    =   -2083   #synthesizerOSErr
-synthesizerNotRespondingOSErr   =   -2082   #synthesizerNotRespondingOSErr
-midiManagerAbsentOSErr  =   -2081   #midiManagerAbsentOSErr
-illegalControllerOSErr  =   -2080   #illegalControllerOSErr
-illegalInstrumentOSErr  =   -2079   #illegalInstrumentOSErr
-illegalKnobValueOSErr   =   -2078   #illegalKnobValueOSErr
-illegalKnobOSErr    =   -2077   #illegalKnobOSErr
-illegalChannelOSErr =   -2076   #illegalChannelOSErr
-illegalPartOSErr    =   -2075   #illegalPartOSErr
-illegalVoiceAllocationOSErr =   -2074   #illegalVoiceAllocationOSErr
-cantReceiveFromSynthesizerOSErr =   -2073   #cantReceiveFromSynthesizerOSErr
-cantSendToSynthesizerOSErr  =   -2072   #cantSendToSynthesizerOSErr
-notImplementedMusicOSErr    =   -2071   #notImplementedMusicOSErr
-internalComponentErr    =   -2070   #internalComponentErr
-invalidSpriteIDErr  =   -2069   #invalidSpriteIDErr
-invalidImageIndexErr    =   -2068   #invalidImageIndexErr
-invalidSpriteIndexErr   =   -2067   #invalidSpriteIndexErr
-gWorldsNotSameDepthAndSizeErr   =   -2066   #gWorldsNotSameDepthAndSizeErr
-invalidSpritePropertyErr    =   -2065   #invalidSpritePropertyErr
-invalidSpriteWorldPropertyErr   =   -2064   #invalidSpriteWorldPropertyErr
-missingRequiredParameterErr =   -2063   #missingRequiredParameterErr
-movieTextNotFoundErr    =   -2062   #movieTextNotFoundErr
-sourceNotFoundErr   =   -2061   #sourceNotFoundErr
-noSourceTreeFoundErr    =   -2060   #noSourceTreeFoundErr
-samplesAlreadyInMediaErr    =   -2059   #samplesAlreadyInMediaErr
-auxiliaryExportDataUnavailable  =   -2058   #auxiliaryExportDataUnavailable
-unsupportedAuxiliaryImportData  =   -2057   #unsupportedAuxiliaryImportData
-soundSupportNotAvailableErr =   -2056   #QT for Windows error
-noSoundTrackInMovieErr  =   -2055   #QT for Windows error
-noVideoTrackInMovieErr  =   -2054   #QT for Windows error
-featureUnsupported  =   -2053   #featureUnsupported
-couldNotUseAnExistingSample =   -2052   #couldNotUseAnExistingSample
-noDefaultDataRef    =   -2051   #noDefaultDataRef
-badDataRefIndex =   -2050   #badDataRefIndex
-invalidDataRefContainer =   -2049   #invalidDataRefContainer
-noMovieFound    =   -2048   #noMovieFound
-dataNoDataRef   =   -2047   #dataNoDataRef
-endOfDataReached    =   -2046   #endOfDataReached
-dataAlreadyClosed   =   -2045   #dataAlreadyClosed
-dataAlreadyOpenForWrite =   -2044   #dataAlreadyOpenForWrite
-dataNotOpenForWrite =   -2043   #dataNotOpenForWrite
-dataNotOpenForRead  =   -2042   #dataNotOpenForRead
-invalidSampleDescription    =   -2041   #invalidSampleDescription
-invalidChunkCache   =   -2040   #invalidChunkCache
-invalidSampleDescIndex  =   -2039   #invalidSampleDescIndex
-invalidChunkNum =   -2038   #invalidChunkNum
-invalidSampleNum    =   -2037   #invalidSampleNum
-invalidRect =   -2036   #invalidRect
-cantEnableTrack =   -2035   #cantEnableTrack
-internalQuickTimeError  =   -2034   #internalQuickTimeError
-badEditIndex    =   -2033   #badEditIndex
-timeNotInMedia  =   -2032   #timeNotInMedia
-timeNotInTrack  =   -2031   #timeNotInTrack
-trackNotInMovie =   -2030   #trackNotInMovie
-trackIDNotFound =   -2029   #trackIDNotFound
-badTrackIndex   =   -2028   #badTrackIndex
-maxSizeToGrowTooSmall   =   -2027   #maxSizeToGrowTooSmall
-userDataItemNotFound    =   -2026   #userDataItemNotFound
-staleEditState  =   -2025   #staleEditState
-nonMatchingEditState    =   -2024   #nonMatchingEditState
-invalidEditState    =   -2023   #invalidEditState
-cantCreateSingleForkFile    =   -2022   #happens when file already exists
-wfFileNotFound  =   -2021   #wfFileNotFound
-movieToolboxUninitialized   =   -2020   #movieToolboxUninitialized
-progressProcAborted =   -2019   #progressProcAborted
-mediaTypesDontMatch =   -2018   #mediaTypesDontMatch
-badEditList =   -2017   #badEditList
-cantPutPublicMovieAtom  =   -2016   #cantPutPublicMovieAtom
-invalidTime =   -2015   #invalidTime
-invalidDuration =   -2014   #invalidDuration
-invalidHandler  =   -2013   #invalidHandler
-invalidDataRef  =   -2012   #invalidDataRef
-invalidSampleTable  =   -2011   #invalidSampleTable
-invalidMovie    =   -2010   #invalidMovie
-invalidTrack    =   -2009   #invalidTrack
-invalidMedia    =   -2008   #invalidMedia
-noDataHandler   =   -2007   #noDataHandler
-noMediaHandler  =   -2006   #noMediaHandler
-badComponentType    =   -2005   #badComponentType
-cantOpenHandler =   -2004   #cantOpenHandler
-cantFindHandler =   -2003   #cantFindHandler
-badPublicMovieAtom  =   -2002   #badPublicMovieAtom
-badImageDescription =   -2001   #badImageDescription
-couldNotResolveDataRef  =   -2000   #couldNotResolveDataRef
-nonDragOriginatorErr    =   -1862   #illegal attempt at originator only data
-badImageErr =   -1861   #bad translucent image PixMap
-badImageRgnErr  =   -1860   #bad translucent image region
-noSuitableDisplaysErr   =   -1859   #no displays support translucency
-unsupportedForPlatformErr   =   -1858   #call is for PowerPC only
-dragNotAcceptedErr  =   -1857   #drag was not accepted by receiver
-handlerNotFoundErr  =   -1856   #handler not found
-duplicateHandlerErr =   -1855   #handler already exists
-cantGetFlavorErr    =   -1854   #error while trying to get flavor data
-duplicateFlavorErr  =   -1853   #flavor type already exists
-badDragFlavorErr    =   -1852   #unknown flavor type
-badDragItemErr  =   -1851   #unknown drag item reference
-badDragRefErr   =   -1850   #unknown drag reference
-errEndOfBody    =   -1813   #errEndOfBody
-errEndOfDocument    =   -1812   #errEndOfDocument
-errTopOfBody    =   -1811   #errTopOfBody
-errTopOfDocument    =   -1810   #errTopOfDocument
-errOffsetIsOutsideOfView    =   -1801   #errOffsetIsOutsideOfView
-errOffsetInvalid    =   -1800   #errOffsetInvalid
-errOSACantOpenComponent =   -1762   #Can't connect to scripting system with that ID
-errOSAComponentMismatch =   -1761   #Parameters are from 2 different components
-errOSADataFormatTooNew  =   -1759   #errOSADataFormatTooNew
-errOSADataFormatObsolete    =   -1758   #errOSADataFormatObsolete
-errOSANoSuchDialect =   -1757   #errOSANoSuchDialect
-errOSASourceNotAvailable    =   -1756   #errOSASourceNotAvailable
-errOSABadSelector   =   -1754   #errOSABadSelector
-errOSAScriptError   =   -1753   #errOSAScriptError
-errOSABadStorageType    =   -1752   #errOSABadStorageType
-errOSAInvalidID =   -1751   #errOSAInvalidID
-errOSASystemError   =   -1750   #errOSASystemError
-errAEBufferTooSmall =   -1741   #buffer for AEFlattenDesc too small
-errAEBuildSyntaxError   =   -1740   #AEBuildDesc and friends detected a syntax error
-errAEDescIsNull =   -1739   #attempting to perform an invalid operation on a null descriptor
-errAEStreamAlreadyConverted =   -1738   #attempt to convert a stream that has already been converted
-errAEStreamBadNesting   =   -1737   #nesting violation while streaming
-errAEDuplicateHandler   =   -1736   #attempt to install handler in table for identical class and id (1.1 or greater)
-errAEEventFiltered  =   -1735   #event has been filtered, and should not be propogated (1.1 or greater)
-errAEReceiveEscapeCurrent   =   -1734   #break out of only lowest level of AEReceive (1.1 or greater)
-errAEReceiveTerminate   =   -1733   #break out of all levels of AEReceive to the topmost (1.1 or greater)
-errAERecordingIsAlreadyOn   =   -1732   #available only in version 1.0.1 or greater
-errAEUnknownObjectType  =   -1731   #available only in version 1.0.1 or greater
-errAEEmptyListContainer =   -1730   #Attempt to pass empty list as container to accessor
-errAENegativeCount  =   -1729   #CountProc returned negative value
-errAENoSuchObject   =   -1728   #e.g.,: specifier asked for the 3rd, but there are only 2. Basically, this indicates a run-time resolution error.
-errAENotAnObjSpec   =   -1727   #Param to AEResolve not of type 'obj '
-errAEBadTestKey =   -1726   #Test is neither typeLogicalDescriptor nor typeCompDescriptor
-errAENoSuchLogical  =   -1725   #Something other than AND, OR, or NOT
-errAEAccessorNotFound   =   -1723   #Accessor proc matching wantClass and containerType or wildcards not found
-errAEWrongNumberArgs    =   -1721   #Logical op kAENOT used with other than 1 term
-errAEImpossibleRange    =   -1720   #A range like 3rd to 2nd, or 1st to all.
-errAEIllegalIndex   =   -1719   #index is out of range in a put operation
-errAEReplyNotArrived    =   -1718   #the contents of the reply you are accessing have not arrived yet
-errAEHandlerNotFound    =   -1717   #no handler in the dispatch tables fits the parameters to AEGetEventHandler or AEGetCoercionHandler
-errAEUnknownAddressType =   -1716   #the target address type is not known
-errAEParamMissed    =   -1715   #a required parameter was not accessed
-errAENotASpecialFunction    =   -1714   #there is no special function for/with this keyword
-errAENoUserInteraction  =   -1713   #no user interaction is allowed
-errAETimeout    =   -1712   #the AppleEvent timed out
-errAEWaitCanceled   =   -1711   #in AESend, the user cancelled out of wait loop for reply or receipt
-errAEUnknownSendMode    =   -1710   #mode wasn't NoReply, WaitReply, or QueueReply or Interaction level is unknown
-errAEReplyNotValid  =   -1709   #AEResetTimer was passed an invalid reply parameter
-errAEEventNotHandled    =   -1708   #the AppleEvent was not handled by any handler
-errAENotAppleEvent  =   -1707   #the event is not in AppleEvent format
-errAENewerVersion   =   -1706   #need newer version of the AppleEvent manager
-errAEBadListItem    =   -1705   #the specified list item does not exist
-errAENotAEDesc  =   -1704   #errAENotAEDesc
-errAEWrongDataType  =   -1703   #errAEWrongDataType
-errAECorruptData    =   -1702   #errAECorruptData
-errAEDescNotFound   =   -1701   #errAEDescNotFound
-errAECoercionFail   =   -1700   #bad parameter data or unable to coerce the data supplied
-errFSIteratorNotSupported   =   -1424   #The iterator's flags or container are not supported by this call
-errFSIteratorNotFound   =   -1423   #Passed FSIterator is not an open iterator
-errFSBadIteratorFlags   =   -1422   #Flags passed to FSOpenIterator are bad
-errFSForkExists =   -1421   #Named fork already exists.
-errFSRefsDifferent  =   -1420   #FSCompareFSRefs; refs are for different objects
-errFSBadSearchParams    =   -1419   #Something wrong with CatalogSearch searchParams
-errFSBadItemCount   =   -1418   #maximumItems was zero
-errFSNoMoreItems    =   -1417   #Iteration ran out of items to return
-errFSBadAllocFlags  =   -1413   #Invalid bits set in allocationFlags
-errFSBadPosMode =   -1412   #Newline bits set in positionMode
-errFSMissingName    =   -1411   #A Unicode name parameter was NULL or nameLength parameter was zero
-errFSNameTooLong    =   -1410   #File/fork name is too long to create/rename
-errFSForkNotFound   =   -1409   #Named fork does not exist
-errFSNotAFolder =   -1407   #Expected a folder, got a file
-errFSMissingCatInfo =   -1406   #A CatalogInfo parameter was NULL
-errFSBadInfoBitmap  =   -1405   #A CatalogInfoBitmap or VolumeInfoBitmap has reserved or invalid bits set
-errFSBadForkRef =   -1404   #A ForkRefNum parameter was bad
-errFSBadBuffer  =   -1403   #A buffer parameter was bad
-errFSBadForkName    =   -1402   #Fork name parameter is bad
-errFSBadFSRef   =   -1401   #FSRef parameter is bad
-errFSUnknownCall    =   -1400   #selector is not recognized by this filesystem
-badFCBErr   =   -1327   #FCBRecPtr is not valid
-volVMBusyErr    =   -1311   #can't eject because volume is in use by VM
-fsDataTooBigErr =   -1310   #file or volume is too big for system
-fileBoundsErr   =   -1309   #file's EOF, offset, mark or size is too big
-notARemountErr  =   -1308   #when _Mount allows only remounts and doesn't get one
-badFidErr   =   -1307   #file id is dangling or doesn't match with the file number
-sameFileErr =   -1306   #can't exchange a file with itself
-desktopDamagedErr   =   -1305   #desktop database files are corrupted
-catChangedErr   =   -1304   #the catalog has been modified
-diffVolErr  =   -1303   #files on different volumes
-notAFileErr =   -1302   #directory specified
-fidExists   =   -1301   #file id already exists
-fidNotFound =   -1300   #no file thread exists.
-errRefNum   =   -1280   #bad connection refNum
-errAborted  =   -1279   #control call was aborted
-errState    =   -1278   #bad connection state for this operation
-errOpening  =   -1277   #open connection request failed
-errAttention    =   -1276   #attention message too long
-errFwdReset =   -1275   #read terminated by forward reset
-errDSPQueueSize =   -1274   #DSP Read/Write Queue Too small
-errOpenDenied   =   -1273   #open connection request was denied
-reqAborted  =   -1105   #reqAborted
-noDataArea  =   -1104   #noDataArea
-noSendResp  =   -1103   #noSendResp
-cbNotFound  =   -1102   #cbNotFound
-noRelErr    =   -1101   #noRelErr
-badBuffNum  =   -1100   #badBuffNum
-badATPSkt   =   -1099   #badATPSkt
-tooManySkts =   -1098   #tooManySkts
-tooManyReqs =   -1097   #tooManyReqs
-reqFailed   =   -1096   #reqFailed
-aspNoAck    =   -1075   #No ack on attention request (server err)
-aspTooMany  =   -1074   #Too many clients (server error)
-aspSizeErr  =   -1073   #Command block too big
-aspSessClosed   =   -1072   #Session closed
-aspServerBusy   =   -1071   #Server cannot open another session
-aspParamErr =   -1070   #Parameter error
-aspNoServers    =   -1069   #No servers at that address
-aspNoMoreSess   =   -1068   #No more sessions on server
-aspBufTooSmall  =   -1067   #Buffer too small
-aspBadVersNum   =   -1066   #Server cannot support this ASP version
-nbpNISErr   =   -1029   #Error trying to open the NIS
-nbpNotFound =   -1028   #Name not found on remove
-nbpDuplicate    =   -1027   #Duplicate name exists already
-nbpConfDiff =   -1026   #Name confirmed at different socket
-nbpNoConfirm    =   -1025   #nbpNoConfirm
-nbpBuffOvr  =   -1024   #Buffer overflow in LookupName
-noMaskFoundErr  =   -1000   #Icon Utilties Error
-kFMFontContainerAccessErr   =   -985    #kFMFontContainerAccessErr
-kFMFontTableAccessErr   =   -984    #kFMFontTableAccessErr
-kFMIterationScopeModifiedErr    =   -983    #kFMIterationScopeModifiedErr
-kFMInvalidFontErr   =   -982    #kFMInvalidFontErr
-kFMInvalidFontFamilyErr =   -981    #kFMInvalidFontFamilyErr
-kFMIterationCompleted   =   -980    #kFMIterationCompleted
-guestNotAllowedErr  =   -932    #destination port requires authentication
-badLocNameErr   =   -931    #location name malformed
-badServiceMethodErr =   -930    #illegal service type, or not supported
-noUserRecErr    =   -928    #Invalid user reference number
-authFailErr =   -927    #unable to authenticate user at destination
-noInformErr =   -926    #PPCStart failed because destination did not have inform pending
-networkErr  =   -925    #An error has occurred in the network, not too likely
-noUserRefErr    =   -924    #unable to create a new userRefNum
-notLoggedInErr  =   -923    #The default userRefNum does not yet exist
-noDefaultUserErr    =   -922    #user hasn't typed in owners name in Network Setup Control Pannel
-badPortNameErr  =   -919    #PPCPortRec malformed
-sessClosedErr   =   -917    #session was closed
-portClosedErr   =   -916    #port was closed
-noResponseErr   =   -915    #unable to contact destination
-noToolboxNameErr    =   -914    #A system resource is missing, not too likely
-noMachineNameErr    =   -913    #user hasn't named his Macintosh in the Network Setup Control Panel
-userRejectErr   =   -912    #Destination rejected the session request
-noUserNameErr   =   -911    #user name unknown on destination machine
-portNameExistsErr   =   -910    #port is already open (perhaps in another app)
-badReqErr   =   -909    #bad parameter or invalid state for operation
-noSessionErr    =   -908    #Invalid session reference number
-sessTableErr    =   -907    #Out of session tables, try again later
-destPortErr =   -906    #Port does not exist at destination
-localOnlyErr    =   -905    #Network activity is currently disabled
-noGlobalsErr    =   -904    #The system is hosed, better re-boot
-noPortErr   =   -903    #Unable to open port or bad portRefNum.  If you're calling
-nameTypeErr =   -902    #Invalid or inappropriate locationKindSelector in locationName
-notInitErr  =   -900    #PPCToolBox not initialized
-notAppropriateForClassic    =   -877    #This application won't or shouldn't run on Classic (Problem 2481058).
-appVersionTooOld    =   -876    #The application's creator and version are incompatible with the current version of Mac OS.
-wrongApplicationPlatform    =   -875    #The application could not launch because the required platform is not available
-hmCloseViewActive   =   -863    #Returned from HMRemoveBalloon if CloseView was active
-hmNoBalloonUp   =   -862    #Returned from HMRemoveBalloon if no balloon was visible when call was made
-hmOperationUnsupported  =   -861    #Returned from HMShowBalloon call if bad method passed to routine
-hmUnknownHelpType   =   -859    #Returned if help msg record contained a bad type
-hmWrongVersion  =   -858    #Returned if help mgr resource was the wrong version
-hmSkippedBalloon    =   -857    #Returned from calls if helpmsg specified a skip balloon
-hmHelpManagerNotInited  =   -855    #Returned from HMGetHelpMenuHandle if help menu not setup
-hmSameAsLastBalloon =   -854    #Returned from HMShowMenuBalloon if menu & item is same as last time
-hmBalloonAborted    =   -853    #Returned if mouse was moving or mouse wasn't in window port rect
-hmHelpDisabled  =   -850    #Show Balloons mode was off, call to routine ignored
-rcDBPackNotInited   =   -813    #attempt to call other routine before InitDBPack
-rcDBWrongVersion    =   -812    #incompatible versions
-rcDBNoHandler   =   -811    #no app handler for specified data type
-rcDBBadAsyncPB  =   -810    #tried to kill a bad pb
-rcDBAsyncNotSupp    =   -809    #ddev does not support async calls
-rcDBBadDDEV =   -808    #bad ddev specified on DBInit
-rcDBBadSessNum  =   -807    #bad session number for DBGetConnInfo
-rcDBBadSessID   =   -806    #rcDBBadSessID
-rcDBExec    =   -805    #rcDBExec
-rcDBBreak   =   -804    #rcDBBreak
-rcDBBadType =   -803    #rcDBBadType
-rcDBError   =   -802    #rcDBError
-rcDBValue   =   -801    #rcDBValue
-rcDBNull    =   -800    #rcDBNull
-icTooManyProfilesErr    =   -677    #too many profiles in database
-icProfileNotFoundErr    =   -676    #profile not found
-icConfigInappropriateErr    =   -675    #incorrect manufacturer code
-icConfigNotFoundErr =   -674    #no internet configuration was found
-icNoURLErr  =   -673    #no URL found
-icNothingToOverrideErr  =   -672    #no component for the override component to capture
-icNoMoreWritersErr  =   -671    #you cannot begin a write session because someone else is already doing it
-icTruncatedErr  =   -670    #more data was present than was returned
-icInternalErr   =   -669    #Internet Config internal error
-icPrefDataErr   =   -668    #problem with preference data
-icPermErr   =   -667    #cannot set preference
-icPrefNotFoundErr   =   -666    #Internet preference not found
-vmInvalidOwningProcessErr   =   -648    #current process does not own the BackingFileID or FileViewID
-vmAddressNotInFileViewErr   =   -647    #address is not in a FileView
-vmNoMoreFileViewsErr    =   -646    #no more FileViews were found
-vmFileViewAccessErr =   -645    #requested FileViewAccess cannot be obtained
-vmInvalidFileViewIDErr  =   -644    #invalid FileViewID
-vmNoMoreBackingFilesErr =   -643    #no more BackingFiles were found
-vmBusyBackingFileErr    =   -642    #open views found on BackingFile
-vmMappingPrivilegesErr  =   -641    #requested MappingPrivileges cannot be obtained
-vmInvalidBackingFileIDErr   =   -640    #invalid BackingFileID
-noMMUErr    =   -626    #no MMU present
-cannotDeferErr  =   -625    #unable to defer additional functions
-interruptsMaskedErr =   -624    #donÕt call with interrupts masked
-notLockedErr    =   -623    #specified range of memory is not locked
-cannotMakeContiguousErr =   -622    #cannot make specified range contiguous
-notHeldErr  =   -621    #specified range of memory is not held
-notEnoughMemoryErr  =   -620    #insufficient physical memory
-threadProtocolErr   =   -619    #threadProtocolErr
-threadNotFoundErr   =   -618    #threadNotFoundErr
-threadTooManyReqsErr    =   -617    #threadTooManyReqsErr
-noUserInteractionAllowed    =   -610    #no user interaction allowed
-connectionInvalid   =   -609    #connectionInvalid
-noOutstandingHLE    =   -608    #noOutstandingHLE
-bufferIsSmall   =   -607    #error returns from Post and Accept
-appIsDaemon =   -606    #app is BG-only, and launch flags disallow this
-appMemFullErr   =   -605    #application SIZE not big enough for launch
-hardwareConfigErr   =   -604    #hardware configuration not correct for call
-protocolErr =   -603    #app made module calls in improper order
-appModeErr  =   -602    #memory mode is 32-bit, but app not 32-bit clean
-memFragErr  =   -601    #not enough room to launch app w/special requirements
-procNotFound    =   -600    #no eligible process with specified descriptor
-driverHardwareGoneErr   =   -503    #disk driver's hardware was disconnected
-hwParamErr  =   -502    #bad selector for _HWPriv
-teScrapSizeErr  =   -501    #scrap item too big for text edit record
-rgnTooBigErr    =   -500    #rgnTooBigErr
-exUserBreak =   -492    #user debugger break; execute debugger commands on stack
-strUserBreak    =   -491    #user debugger break; display string on stack
-userBreak   =   -490    #user debugger break
-notThePublisherWrn  =   -463    #not the first registered publisher for that container
-containerAlreadyOpenWrn =   -462    #container already opened by this section
-containerNotFoundWrn    =   -461    #could not find editionContainer at this time
-multiplePublisherWrn    =   -460    #A Publisher is already registered for that container
-badSubPartErr   =   -454    #can not use sub parts in this release
-badEditionFileErr   =   -453    #edition file is corrupt
-notRegisteredSectionErr =   -452    #not a registered SectionRecord
-badSectionErr   =   -451    #not a valid SectionRecord
-editionMgrInitErr   =   -450    #edition manager not inited by this app
-fsmUnknownFSMMessageErr =   -438    #unknown message passed to FSM
-fsmNoAlternateStackErr  =   -437    #no alternate stack for HFS CI
-fsmBadFSDVersionErr =   -436    #FSM version incompatible with FSD
-fsmDuplicateFSIDErr =   -435    #FSID already exists on InstallFS
-fsmBadFSDLenErr =   -434    #FSD size incompatible with current FSM vers
-fsmBadFFSNameErr    =   -433    #Name length not 1 <= length <= 31
-fsmBusyFFSErr   =   -432    #File system is busy, cannot be removed
-fsmFFSNotFoundErr   =   -431    #Foreign File system does not exist - new Pack2 could return this error too
-btKeyAttrErr    =   -417    #There is no such a key attribute.
-btKeyLenErr =   -416    #Maximum key length is too long or equal to zero.
-btRecNotFnd =   -415    #Record cannot be found.
-btDupRecErr =   -414    #Record already exists.
-btNoSpace   =   -413    #Can't allocate disk space.
-notBTree    =   -410    #The file is not a dictionary.
-gcrOnMFMErr =   -400    #gcr format on high density media error
-slotNumErr  =   -360    #invalid slot # error
-smRecNotFnd =   -351    #Record not found in the SRT.
-smSRTOvrFlErr   =   -350    #SRT over flow.
-smNoGoodOpens   =   -349    #No opens were successfull in the loop.
-smOffsetErr =   -348    #Offset was too big (temporary error
-smByteLanesErr  =   -347    #NumByteLanes was determined to be zero.
-smBadsPtrErr    =   -346    #Bad pointer was passed to sCalcsPointer
-smsGetDrvrErr   =   -345    #Error occurred during _sGetDriver.
-smNoMoresRsrcs  =   -344    #No more sResources
-smDisDrvrNamErr =   -343    #Error occurred during _sDisDrvrName.
-smGetDrvrNamErr =   -342    #Error occurred during _sGetDrvrName.
-smCkStatusErr   =   -341    #Status of slot = fail.
-smBlkMoveErr    =   -340    #_BlockMove error
-smNewPErr   =   -339    #_NewPtr error
-smSelOOBErr =   -338    #Selector out of bounds error
-smSlotOOBErr    =   -337    #Slot out of bounds error
-smNilsBlockErr  =   -336    #Nil sBlock error (Dont allocate and try to use a nil sBlock)
-smsPointerNil   =   -335    #LPointer is nil From sOffsetData. If this error occurs; check sInfo rec for more information.
-smCPUErr    =   -334    #Code revision is wrong
-smCodeRevErr    =   -333    #Code revision is wrong
-smReservedErr   =   -332    #Reserved field not zero
-smBadsList  =   -331    #Bad sList: Id1 < Id2 < Id3 ...format is not followed.
-smBadRefId  =   -330    #Reference Id not found in List
-smBusErrTO  =   -320    #BusError time out.
-smBadBoardId    =   -319    #BoardId was wrong; re-init the PRAM record.
-smReservedSlot  =   -318    #slot is reserved, VM should not use this address space.
-smInitTblVErr   =   -317    #An error occurred while trying to initialize the Slot Resource Table.
-smInitStatVErr  =   -316    #The InitStatusV field was negative after primary or secondary init.
-smNoBoardId =   -315    #No Board Id.
-smGetPRErr  =   -314    #Error occurred during _sGetPRAMRec (See SIMStatus).
-smNoBoardSRsrc  =   -313    #No Board sResource.
-smDisposePErr   =   -312    #_DisposePointer error
-smFHBlkDispErr  =   -311    #Error occurred during _sDisposePtr (Dispose of FHeader block).
-smFHBlockRdErr  =   -310    #Error occurred during _sGetFHeader.
-smBLFieldBad    =   -309    #ByteLanes field was bad.
-smUnExBusErr    =   -308    #Unexpected BusError
-smResrvErr  =   -307    #Fatal reserved error. Resreved field != 0.
-smNosInfoArray  =   -306    #No sInfoArray. Memory Mgr error.
-smDisabledSlot  =   -305    #This slot is disabled (-305 use to be smLWTstBad)
-smNoDir =   -304    #Directory offset is Nil
-smRevisionErr   =   -303    #Wrong revison level
-smFormatErr =   -302    #FHeader Format is not Apple's
-smCRCFail   =   -301    #CRC check failed for declaration data
-smEmptySlot =   -300    #No card in slot
-nmTypErr    =   -299    #Notification Manager:wrong queue type
-smPriInitErr    =   -293    #Error; Cards could not be initialized.
-smPRAMInitErr   =   -292    #Error; Slot Resource Table could not be initialized.
-smSRTInitErr    =   -291    #Error; Slot Resource Table could not be initialized.
-smSDMInitErr    =   -290    #Error; SDM could not be initialized.
-midiInvalidCmdErr   =   -261    #command not supported for port type
-midiDupIDErr    =   -260    #duplicate client ID
-midiNameLenErr  =   -259    #name supplied is longer than 31 characters
-midiWriteErr    =   -258    #MIDIWritePacket couldn't write to all connected ports
-midiNoConErr    =   -257    #no connection exists between specified ports
-midiVConnectRmvd    =   -256    #pending virtual connection removed
-midiVConnectMade    =   -255    #pending virtual connection resolved
-midiVConnectErr =   -254    #pending virtual connection created
-midiTooManyConsErr  =   -253    #too many connections made
-midiTooManyPortsErr =   -252    #too many ports already installed in the system
-midiNoPortErr   =   -251    #no port with that ID found
-midiNoClientErr =   -250    #no client with that ID found
-badInputText    =   -247    #badInputText
-badDictFormat   =   -246    #badDictFormat
-incompatibleVoice   =   -245    #incompatibleVoice
-voiceNotFound   =   -244    #voiceNotFound
-bufTooSmall =   -243    #bufTooSmall
-synthNotReady   =   -242    #synthNotReady
-synthOpenFailed =   -241    #synthOpenFailed
-noSynthFound    =   -240    #noSynthFound
-siUnknownQuality    =   -232    #invalid quality selector (returned by driver)
-siUnknownInfoType   =   -231    #invalid info type selector (returned by driver)
-siInputDeviceErr    =   -230    #input device hardware failure
-siBadRefNum =   -229    #invalid input device reference number
-siBadDeviceName =   -228    #input device could not be opened
-siDeviceBusyErr =   -227    #input device already in use
-siInvalidSampleSize =   -226    #invalid sample size
-siInvalidSampleRate =   -225    #invalid sample rate
-siHardDriveTooSlow  =   -224    #hard drive too slow to record to disk
-siInvalidCompression    =   -223    #invalid compression type
-siNoBufferSpecified =   -222    #returned by synchronous SPBRecord if nil buffer passed
-siBadSoundInDevice  =   -221    #invalid index passed to SoundInGetIndexedDevice
-siNoSoundInHardware =   -220    #no Sound Input hardware
-siVBRCompressionNotSupported    =   -213    #vbr audio compression not supported for this operation
-noMoreRealTime  =   -212    #not enough CPU cycles left to add another task
-channelNotBusy  =   -211    #channelNotBusy
-buffersTooSmall =   -210    #can not operate in the memory allowed
-channelBusy =   -209    #the Channel is being used for a PFD already
-badFileFormat   =   -208    #was not type AIFF or was of bad format,corrupt
-notEnoughBufferSpace    =   -207    #could not allocate enough memory
-badFormat   =   -206    #Sound Manager Error Returns
-badChannel  =   -205    #Sound Manager Error Returns
-resProblem  =   -204    #Sound Manager Error Returns
-queueFull   =   -203    #Sound Manager Error Returns
-notEnoughHardwareErr    =   -201    #Sound Manager Error Returns
-noHardwareErr   =   -200    #Sound Manager Error Returns
-mapReadErr  =   -199    #map inconsistent with operation
-resAttrErr  =   -198    #attribute inconsistent with operation
-rmvRefFailed    =   -197    #RmveReference failed
-rmvResFailed    =   -196    #RmveResource failed
-addRefFailed    =   -195    #AddReference failed
-addResFailed    =   -194    #AddResource failed
-resFNotFound    =   -193    #Resource file not found
-resNotFound =   -192    #Resource not found
-inputOutOfBounds    =   -190    #Offset of Count out of bounds
-writingPastEnd  =   -189    #Writing past end of file
-resourceInMemory    =   -188    #Resource already in memory
-CantDecompress  =   -186    #resource bent ("the bends") - can't decompress a compressed resource
-badExtResource  =   -185    #extended resource has a bad format.
-cmNoCurrentProfile  =   -182    #Responder error
-cmUnsupportedDataType   =   -181    #Responder error
-cmCantDeleteProfile =   -180    #Responder error
-cmCantXYZ   =   -179    #CMM cant handle XYZ space
-cmCantConcatenateError  =   -178    #Profile can't be concatenated
-cmProfilesIdentical =   -177    #Profiles the same
-cmProfileNotFound   =   -176    #Responder error
-cmMethodNotFound    =   -175    #CMM not present
-cmMethodError   =   -171    #cmMethodError
-cmProfileError  =   -170    #cmProfileError
-cDepthErr   =   -157    #invalid pixel depth
-cResErr =   -156    #invalid resolution for MakeITable
-cDevErr =   -155    #invalid type of graphics device
-cProtectErr =   -154    #colorTable entry protection violation
-cRangeErr   =   -153    #range error on colorTable request
-cNoMemErr   =   -152    #failed to allocate memory for structure
-cTempMemErr =   -151    #failed to allocate memory for temporary structures
-cMatchErr   =   -150    #Color2Index failed to find an index
-insufficientStackErr    =   -149    #insufficientStackErr
-pixMapTooDeepErr    =   -148    #pixMapTooDeepErr
-rgnOverflowErr  =   -147    #rgnOverflowErr
-noMemForPictPlaybackErr =   -145    #noMemForPictPlaybackErr
-userCanceledErr =   -128    #userCanceledErr
-hMenuFindErr    =   -127    #could not find HMenu's parent in MenuKey (wrong error code - obsolete)
-mBarNFnd    =   -126    #system error code for MBDF not found
-updPixMemErr    =   -125    #insufficient memory to update a pixmap
-volGoneErr  =   -124    #Server volume has been disconnected.
-wrgVolTypErr    =   -123    #Wrong volume type error [operation not supported for MFS]
-badMovErr   =   -122    #Move into offspring error
-tmwdoErr    =   -121    #No free WDCB available
-dirNFErr    =   -120    #Directory not found
-memLockedErr    =   -117    #trying to move a locked block (MoveHHi)
-memSCErr    =   -116    #Size Check failed
-memBCErr    =   -115    #Block Check failed
-memPCErr    =   -114    #Pointer Check failed
-memAZErr    =   -113    #Address in zone check failed
-memPurErr   =   -112    #trying to purge a locked or non-purgeable block
-memWZErr    =   -111    #WhichZone failed (applied to free block)
-memAdrErr   =   -110    #address was odd; or out of range
-nilHandleErr    =   -109    #Master Pointer was NIL in HandleZone or other
-memFullErr  =   -108    #Not enough room in heap zone
-noTypeErr   =   -102    #No object of that type in scrap
-noScrapErr  =   -100    #No scrap exists error
-memROZWarn  =   -99 #soft error in ROZ
-portNotCf   =   -98 #driver Open error code (parameter RAM not configured for this connection)
-portInUse   =   -97 #driver Open error code (port is in use)
-portNotPwr  =   -96 #serial port not currently powered
-excessCollsns   =   -95 #excessive collisions on write
-lapProtErr  =   -94 #error in attaching/detaching protocol
-noBridgeErr =   -93 #no network bridge for non-local send
-eLenErr =   -92 #Length error ddpLenErr
-eMultiErr   =   -91 #Multicast address error ddpSktErr
-breakRecd   =   -90 #Break received (SCC)
-rcvrErr =   -89 #SCC receiver error (framing; parity; OR)
-prInitErr   =   -88 #InitUtil found the parameter ram uninitialized
-prWrErr =   -87 #parameter ram written didn't read-verify
-clkWrErr    =   -86 #time written did not verify
-clkRdErr    =   -85 #unable to read same clock value twice
-verErr  =   -84 #track failed to verify
-fmt2Err =   -83 #can't get enough sync
-fmt1Err =   -82 #can't find sector 0 after track format
-sectNFErr   =   -81 #sector number never found on a track
-seekErr =   -80 #track number wrong on address mark
-spdAdjErr   =   -79 #unable to correctly adjust disk speed
-twoSideErr  =   -78 #tried to read 2nd side on a 1-sided drive
-initIWMErr  =   -77 #unable to initialize IWM
-tk0BadErr   =   -76 #track 0 detect doesn't change
-cantStepErr =   -75 #step handshake failed
-wrUnderrun  =   -74 #write underrun occurred
-badDBtSlp   =   -73 #bad data mark bit slip nibbles
-badDCksum   =   -72 #bad data mark checksum
-noDtaMkErr  =   -71 #couldn't find a data mark header
-badBtSlpErr =   -70 #bad addr mark bit slip nibbles
-badCksmErr  =   -69 #addr mark checksum didn't check
-dataVerErr  =   -68 #read verify compare failed
-noAdrMkErr  =   -67 #couldn't find valid addr mark
-noNybErr    =   -66 #couldn't find 5 nybbles in 200 tries
-offLinErr   =   -65 #r/w requested for an off-line drive
-fontDecError    =   -64 #error during font declaration
-wrPermErr   =   -61 #write permissions error
-badMDBErr   =   -60 #bad master directory block
-fsRnErr =   -59 #file system internal error:during rename the old entry was deleted but could not be restored.
-extFSErr    =   -58 #volume in question belongs to an external fs
-noMacDskErr =   -57 #not a mac diskette (sig bytes are wrong)
-nsDrvErr    =   -56 #no such drive (tried to mount a bad drive num)
-volOnLinErr =   -55 #drive volume already on-line at MountVol
-permErr =   -54 #permissions error (on file open)
-volOffLinErr    =   -53 #volume not on line error (was Ejected)
-gfpErr  =   -52 #get file position error
-rfNumErr    =   -51 #refnum error
-paramErr    =   -50 #error in user parameter list
-opWrErr =   -49 #file already open with with write permission
-dupFNErr    =   -48 #duplicate filename (rename)
-fBsyErr =   -47 #File is busy (delete)
-vLckdErr    =   -46 #volume is locked
-fLckdErr    =   -45 #file is locked
-wPrErr  =   -44 #diskette is write protected.
-fnfErr  =   -43 #File not found
-tmfoErr =   -42 #too many files open
-mFulErr =   -41 #memory full (open) or file won't fit (load)
-posErr  =   -40 #tried to position to before start of file (r/w)
-eofErr  =   -39 #End of file
-fnOpnErr    =   -38 #File not open
-bdNamErr    =   -37 #there may be no bad names in the final system!
-ioErr   =   -36 #I/O error (bummers)
-nsvErr  =   -35 #no such volume
-dskFulErr   =   -34 #disk full
-dirFulErr   =   -33 #Directory full
-dceExtErr   =   -30 #dce extension error
-unitTblFullErr  =   -29 #unit table has no more entries
-notOpenErr  =   -28 #Couldn't rd/wr/ctl/sts cause driver not opened
-iIOAbortErr =   -27 #IO abort error (Printing Manager)
-dInstErr    =   -26 #DrvrInstall couldn't find driver in resources
-dRemovErr   =   -25 #tried to remove an open driver
-closErr =   -24 #I/O System Errors
-openErr =   -23 #I/O System Errors
-unitEmptyErr    =   -22 #I/O System Errors
-badUnitErr  =   -21 #I/O System Errors
-writErr =   -20 #I/O System Errors
-readErr =   -19 #I/O System Errors
-statusErr   =   -18 #I/O System Errors
-controlErr  =   -17 #I/O System Errors
-dsExtensionsDisabled    =   -13 #say –Extensions Disabled”
-dsHD20Installed =   -12 #say –HD20 Startup”
-dsDisassemblerInstalled =   -11 #say –Disassembler Installed”
-dsMacsBugInstalled  =   -10 #say –MacsBug Installed”
-seNoDB  =   -8  #no debugger installed to handle debugger command
-SlpTypeErr  =   -5  #invalid queue element
-unimpErr    =   -4  #unimplemented core routine
-corErr  =   -3  #core routine number out of range
-dsNoExtsDisassembler    =   -2  #not a SysErr, just a placeholder
-qErr    =   -1  #queue element not found during deletion
-tsmComponentNoErr   =   0   #component result = no error
-EPERM   =   1   #Operation not permitted
-ENOENT  =   2   #No such file or directory
-ESRCH   =   3   #No such process
-EINTR   =   4   #Interrupted system call
-EIO =   5   #Input/output error
-ENXIO   =   6   #Device not configured
-E2BIG   =   7   #Argument list too long
-ENOEXEC =   8   #Exec format error
-EBADF   =   9   #Bad file descriptor
-ECHILD  =   10  #No child processes
-EDEADLK =   11  #Resource deadlock avoided
-ENOMEM  =   12  #Cannot allocate memory
-EACCES  =   13  #Permission denied
-EFAULT  =   14  #Bad address
-ECANCELED   =   15  #Operation cancelled
-EBUSY   =   16  #Device busy
-EEXIST  =   17  #File exists
-EXDEV   =   18  #Cross-device link
-ENODEV  =   19  #Operation not supported by device
-ENOTDIR =   20  #Not a directory
-EISDIR  =   21  #Is a directory
-EINVAL  =   22  #Invalid argument
-ENFILE  =   23  #Too many open files in system
-EMFILE  =   24  #Too many open files
-ENOTTY  =   25  #Inappropriate ioctl for device
-ESIGPARM    =   26  #Signal error
-EFBIG   =   27  #File too large
-ENOSPC  =   28  #No space left on device
-ESPIPE  =   29  #Illegal seek
-EROFS   =   30  #Read-only file system
-EMLINK  =   31  #Too many links
-EPIPE   =   32  #Broken pipe
-EDOM    =   33  #Numerical argument out of domain
-ERANGE  =   34  #Result too large
-EAGAIN  =   35  #Resource temporarily unavailable
-EINPROGRESS =   36  #Operation now in progress
-EALREADY    =   37  #Operation already in progress
-ENOTSOCK    =   38  #Socket operation on non-socket
-EDESTADDRREQ    =   39  #Destination address required
-EMSGSIZE    =   40  #Message too long
-EPROTOTYPE  =   41  #Protocol wrong type for socket
-ENOPROTOOPT =   42  #Protocol not available
-EPROTONOSUPPORT =   43  #Protocol not supported
-ESOCKTNOSUPPORT =   44  #Socket type not supported
-EOPNOTSUPP  =   45  #Operation not supported
-EPFNOSUPPORT    =   46  #Protocol family not supported
-EAFNOSUPPORT    =   47  #Address family not supported by protocol family
-EADDRINUSE  =   48  #Address already in use
-EADDRNOTAVAIL   =   49  #Can't assign requested address
-ENETDOWN    =   50  #Network is down
-ENETUNREACH =   51  #Network is unreachable
-ENETRESET   =   52  #Network dropped connection on reset
-ECONNABORTED    =   53  #Software caused connection abort
-ECONNRESET  =   54  #Connection reset by peer
-ENOBUFS =   55  #No buffer space available
-EISCONN =   56  #Socket is already connected
-ENOTCONN    =   57  #Socket is not connected
-ESHUTDOWN   =   58  #Can't send after socket shutdown
-ETOOMANYREFS    =   59  #Too many references: can't splice
-ETIMEDOUT   =   60  #Operation timed out
-ECONNREFUSED    =   61  #Connection refused
-ELOOP   =   62  #Too many levels of symbolic links
-ENAMETOOLONG    =   63  #File name too long
-EHOSTDOWN   =   64  #Host is down
-EHOSTUNREACH    =   65  #No route to host
-ENOTEMPTY   =   66  #Directory not empty
-ELOOK   =   67  #Internal mapping for kOTLookErr, don't return to client
-ENOLCK  =   77  #No locks available
-ENOSYS  =   78  #Function not implemented
-EILSEQ  =   88  #Wide character encoding error
-EUNKNOWN    =   99  #Unknown error

Deleted: python/branches/py3k/Lib/plat-mac/macostools.py
==============================================================================
--- python/branches/py3k/Lib/plat-mac/macostools.py	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,127 +0,0 @@
-"""macostools - Various utility functions for MacOS.
-
-mkalias(src, dst) - Create a finder alias 'dst' pointing to 'src'
-copy(src, dst) - Full copy of 'src' to 'dst'
-"""
-
-from Carbon import Res
-from Carbon import File, Files
-import os
-import MacOS
-try:
-    openrf = MacOS.openrf
-except AttributeError:
-    # Backward compatibility
-    openrf = open
-
-Error = 'macostools.Error'
-
-BUFSIZ=0x80000      # Copy in 0.5Mb chunks
-
-COPY_FLAGS = (Files.kIsStationary|Files.kNameLocked|Files.kHasBundle|
-              Files.kIsInvisible|Files.kIsAlias)
-
-#
-# Not guaranteed to be correct or stay correct (Apple doesn't tell you
-# how to do this), but it seems to work.
-#
-def mkalias(src, dst, relative=None):
-    """Create a finder alias"""
-    srcfsr = File.FSRef(src)
-    # The next line will fail under unix-Python if the destination
-    # doesn't exist yet. We should change this code to be fsref-based.
-    dstdir, dstname = os.path.split(dst)
-    if not dstdir: dstdir = os.curdir
-    dstdirfsr = File.FSRef(dstdir)
-    if relative:
-        relativefsr = File.FSRef(relative)
-        # ik mag er geen None in stoppen :-(
-        alias = File.FSNewAlias(relativefsr, srcfsr)
-    else:
-        alias = srcfsr.FSNewAliasMinimal()
-
-    dstfsr, dstfss = Res.FSCreateResourceFile(dstdirfsr, str(dstname),
-        File.FSGetResourceForkName())
-    h = Res.FSOpenResourceFile(dstfsr, File.FSGetResourceForkName(), 3)
-    resource = Res.Resource(alias.data)
-    resource.AddResource('alis', 0, '')
-    Res.CloseResFile(h)
-
-    dstfinfo = dstfss.FSpGetFInfo()
-    dstfinfo.Flags = dstfinfo.Flags|0x8000    # Alias flag
-    dstfss.FSpSetFInfo(dstfinfo)
-
-def mkdirs(dst):
-    """Make directories leading to 'dst' if they don't exist yet"""
-    if dst == '' or os.path.exists(dst):
-        return
-    head, tail = os.path.split(dst)
-    if os.sep == ':' and not ':' in head:
-        head = head + ':'
-    mkdirs(head)
-    os.mkdir(dst, 0o777)
-
-def touched(dst):
-    """Tell the finder a file has changed. No-op on MacOSX."""
-    import warnings
-    warnings.warn("macostools.touched() has been deprecated",
-                    DeprecationWarning, 2)
-
-def touched_ae(dst):
-    """Tell the finder a file has changed"""
-    pardir = os.path.split(dst)[0]
-    if not pardir:
-        pardir = os.curdir
-    import Finder
-    f = Finder.Finder()
-    f.update(File.FSRef(pardir))
-
-def copy(src, dst, createpath=0, copydates=1, forcetype=None):
-    """Copy a file, including finder info, resource fork, etc"""
-    src = File.pathname(src)
-    dst = File.pathname(dst)
-    if createpath:
-        mkdirs(os.path.split(dst)[0])
-
-    ifp = open(src, 'rb')
-    ofp = open(dst, 'wb')
-    d = ifp.read(BUFSIZ)
-    while d:
-        ofp.write(d)
-        d = ifp.read(BUFSIZ)
-    ifp.close()
-    ofp.close()
-
-    ifp = openrf(src, '*rb')
-    ofp = openrf(dst, '*wb')
-    d = ifp.read(BUFSIZ)
-    while d:
-        ofp.write(d)
-        d = ifp.read(BUFSIZ)
-    ifp.close()
-    ofp.close()
-
-    srcfss = File.FSSpec(src)
-    dstfss = File.FSSpec(dst)
-    sf = srcfss.FSpGetFInfo()
-    df = dstfss.FSpGetFInfo()
-    df.Creator, df.Type = sf.Creator, sf.Type
-    if forcetype is not None:
-        df.Type = forcetype
-    df.Flags = (sf.Flags & COPY_FLAGS)
-    dstfss.FSpSetFInfo(df)
-    if copydates:
-        srcfsr = File.FSRef(src)
-        dstfsr = File.FSRef(dst)
-        catinfo, _, _, _ = srcfsr.FSGetCatalogInfo(Files.kFSCatInfoAllDates)
-        dstfsr.FSSetCatalogInfo(Files.kFSCatInfoAllDates, catinfo)
-
-def copytree(src, dst, copydates=1):
-    """Copy a complete file tree to a new destination"""
-    if os.path.isdir(src):
-        mkdirs(dst)
-        files = os.listdir(src)
-        for f in files:
-            copytree(os.path.join(src, f), os.path.join(dst, f), copydates)
-    else:
-        copy(src, dst, 1, copydates)

Deleted: python/branches/py3k/Lib/plat-mac/macresource.py
==============================================================================
--- python/branches/py3k/Lib/plat-mac/macresource.py	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,146 +0,0 @@
-"""macresource - Locate and open the resources needed for a script."""
-
-from Carbon import Res
-import os
-import sys
-import MacOS
-import macostools
-
-class ArgumentError(TypeError): pass
-class ResourceFileNotFoundError(ImportError): pass
-
-def need(restype, resid, filename=None, modname=None):
-    """Open a resource file, if needed. restype and resid
-    are required parameters, and identify the resource for which to test. If it
-    is available we are done. If it is not available we look for a file filename
-    (default: modname with .rsrc appended) either in the same folder as
-    where modname was loaded from, or otherwise across sys.path.
-
-    Returns the refno of the resource file opened (or None)"""
-
-    if modname is None and filename is None:
-        raise ArgumentError("Either filename or modname argument (or both) must be given")
-
-    if type(resid) is type(1):
-        try:
-            h = Res.GetResource(restype, resid)
-        except Res.Error:
-            pass
-        else:
-            return None
-    else:
-        try:
-            h = Res.GetNamedResource(restype, resid)
-        except Res.Error:
-            pass
-        else:
-            return None
-
-    # Construct a filename if we don't have one
-    if not filename:
-        if '.' in modname:
-            filename = modname.split('.')[-1] + '.rsrc'
-        else:
-            filename = modname + '.rsrc'
-
-    # Now create a list of folders to search
-    searchdirs = []
-    if modname == '__main__':
-        # If we're main we look in the current directory
-        searchdirs = [os.curdir]
-    if modname in sys.modules:
-        mod = sys.modules[modname]
-        if hasattr(mod, '__file__'):
-            searchdirs = [os.path.dirname(mod.__file__)]
-    searchdirs.extend(sys.path)
-
-    # And look for the file
-    for dir in searchdirs:
-        pathname = os.path.join(dir, filename)
-        if os.path.exists(pathname):
-            break
-    else:
-        raise ResourceFileNotFoundError(filename)
-
-    refno = open_pathname(pathname)
-
-    # And check that the resource exists now
-    if type(resid) is type(1):
-        h = Res.GetResource(restype, resid)
-    else:
-        h = Res.GetNamedResource(restype, resid)
-    return refno
-
-def open_pathname(pathname, verbose=0):
-    """Open a resource file given by pathname, possibly decoding an
-    AppleSingle file"""
-    try:
-        refno = Res.FSpOpenResFile(pathname, 1)
-    except Res.Error as error:
-        if error.args[0] in (-37, -39):
-            # No resource fork. We may be on OSX, and this may be either
-            # a data-fork based resource file or a AppleSingle file
-            # from the CVS repository.
-            try:
-                refno = Res.FSOpenResourceFile(pathname, '', 1)
-            except Res.Error as error:
-                if error.args[0] != -199:
-                    # -199 is "bad resource map"
-                    raise
-            else:
-                return refno
-            # Finally try decoding an AppleSingle file
-            pathname = _decode(pathname, verbose=verbose)
-            refno = Res.FSOpenResourceFile(pathname, '', 1)
-        else:
-            raise
-    return refno
-
-def resource_pathname(pathname, verbose=0):
-    """Return the pathname for a resource file (either DF or RF based).
-    If the pathname given already refers to such a file simply return it,
-    otherwise first decode it."""
-    try:
-        refno = Res.FSpOpenResFile(pathname, 1)
-        Res.CloseResFile(refno)
-    except Res.Error as error:
-        if error.args[0] in (-37, -39):
-            # No resource fork. We may be on OSX, and this may be either
-            # a data-fork based resource file or a AppleSingle file
-            # from the CVS repository.
-            try:
-                refno = Res.FSOpenResourceFile(pathname, '', 1)
-            except Res.Error as error:
-                if error.args[0] != -199:
-                    # -199 is "bad resource map"
-                    raise
-            else:
-                return refno
-            # Finally try decoding an AppleSingle file
-            pathname = _decode(pathname, verbose=verbose)
-        else:
-            raise
-    return pathname
-
-def open_error_resource():
-    """Open the resource file containing the error code to error message
-    mapping."""
-    need('Estr', 1, filename="errors.rsrc", modname=__name__)
-
-def _decode(pathname, verbose=0):
-    # Decode an AppleSingle resource file, return the new pathname.
-    newpathname = pathname + '.df.rsrc'
-    if os.path.exists(newpathname) and \
-        os.stat(newpathname).st_mtime >= os.stat(pathname).st_mtime:
-        return newpathname
-    if hasattr(os, 'access') and not \
-        os.access(os.path.dirname(pathname), os.W_OK|os.X_OK):
-        # The destination directory isn't writable. Create the file in
-        # a temporary directory
-        import tempfile
-        fd, newpathname = tempfile.mkstemp(".rsrc")
-    if verbose:
-        print('Decoding', pathname, 'to', newpathname)
-    import applesingle
-    applesingle.decode(pathname, newpathname, resonly=1)
-    return newpathname

Deleted: python/branches/py3k/Lib/plat-mac/pimp.py
==============================================================================
--- python/branches/py3k/Lib/plat-mac/pimp.py	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,1178 +0,0 @@
-"""Package Install Manager for Python.
-
-This is currently a MacOSX-only strawman implementation.
-Despite other rumours the name stands for "Packman IMPlementation".
-
-Tools to allow easy installation of packages. The idea is that there is
-an online XML database per (platform, python-version) containing packages
-known to work with that combination. This module contains tools for getting
-and parsing the database, testing whether packages are installed, computing
-dependencies and installing packages.
-
-There is a minimal main program that works as a command line tool, but the
-intention is that the end user will use this through a GUI.
-"""
-import sys
-import os
-import subprocess
-import urllib
-import urllib2
-import urlparse
-import plistlib
-import distutils.util
-import distutils.sysconfig
-import hashlib
-import tarfile
-import tempfile
-import shutil
-import time
-
-__all__ = ["PimpPreferences", "PimpDatabase", "PimpPackage", "main",
-    "getDefaultDatabase", "PIMP_VERSION", "main"]
-
-_scriptExc_NotInstalled = "pimp._scriptExc_NotInstalled"
-_scriptExc_OldInstalled = "pimp._scriptExc_OldInstalled"
-_scriptExc_BadInstalled = "pimp._scriptExc_BadInstalled"
-
-NO_EXECUTE=0
-
-PIMP_VERSION="0.5"
-
-# Flavors:
-# source: setup-based package
-# binary: tar (or other) archive created with setup.py bdist.
-# installer: something that can be opened
-DEFAULT_FLAVORORDER=['source', 'binary', 'installer']
-DEFAULT_DOWNLOADDIR='/tmp'
-DEFAULT_BUILDDIR='/tmp'
-DEFAULT_INSTALLDIR=distutils.sysconfig.get_python_lib()
-DEFAULT_PIMPDATABASE_FMT="http://www.python.org/packman/version-%s/%s-%s-%s-%s-%s.plist"
-
-def getDefaultDatabase(experimental=False):
-    if experimental:
-        status = "exp"
-    else:
-        status = "prod"
-
-    major, minor, micro, state, extra = sys.version_info
-    pyvers = '%d.%d' % (major, minor)
-    if micro == 0 and state != 'final':
-        pyvers = pyvers + '%s%d' % (state, extra)
-
-    longplatform = distutils.util.get_platform()
-    osname, release, machine = longplatform.split('-')
-    # For some platforms we may want to differentiate between
-    # installation types
-    if osname == 'darwin':
-        if sys.prefix.startswith('/System/Library/Frameworks/Python.framework'):
-            osname = 'darwin_apple'
-        elif sys.prefix.startswith('/Library/Frameworks/Python.framework'):
-            osname = 'darwin_macpython'
-        # Otherwise we don't know...
-    # Now we try various URLs by playing with the release string.
-    # We remove numbers off the end until we find a match.
-    rel = release
-    while True:
-        url = DEFAULT_PIMPDATABASE_FMT % (PIMP_VERSION, status, pyvers, osname, rel, machine)
-        try:
-            urllib2.urlopen(url)
-        except urllib2.HTTPError as arg:
-            pass
-        else:
-            break
-        if not rel:
-            # We're out of version numbers to try. Use the
-            # full release number, this will give a reasonable
-            # error message later
-            url = DEFAULT_PIMPDATABASE_FMT % (PIMP_VERSION, status, pyvers, osname, release, machine)
-            break
-        idx = rel.rfind('.')
-        if idx < 0:
-            rel = ''
-        else:
-            rel = rel[:idx]
-    return url
-
-def _cmd(output, dir, *cmditems):
-    """Internal routine to run a shell command in a given directory."""
-
-    cmd = ("cd \"%s\"; " % dir) + " ".join(cmditems)
-    if output:
-        output.write("+ %s\n" % cmd)
-    if NO_EXECUTE:
-        return 0
-    child = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE,
-                             stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
-    child.stdin.close()
-    while 1:
-        line = child.stdout.readline()
-        if not line:
-            break
-        if output:
-            output.write(line)
-    return child.wait()
-
-class PimpDownloader:
-    """Abstract base class - Downloader for archives"""
-
-    def __init__(self, argument,
-            dir="",
-            watcher=None):
-        self.argument = argument
-        self._dir = dir
-        self._watcher = watcher
-
-    def download(self, url, filename, output=None):
-        return None
-
-    def update(self, str):
-        if self._watcher:
-            return self._watcher.update(str)
-        return True
-
-class PimpCurlDownloader(PimpDownloader):
-
-    def download(self, url, filename, output=None):
-        self.update("Downloading %s..." % url)
-        exitstatus = _cmd(output, self._dir,
-                    "curl",
-                    "--output", filename,
-                    url)
-        self.update("Downloading %s: finished" % url)
-        return (not exitstatus)
-
-class PimpUrllibDownloader(PimpDownloader):
-
-    def download(self, url, filename, output=None):
-        output = open(filename, 'wb')
-        self.update("Downloading %s: opening connection" % url)
-        keepgoing = True
-        download = urllib2.urlopen(url)
-        if "content-length" in download.headers:
-            length = int(download.headers['content-length'])
-        else:
-            length = -1
-
-        data = download.read(4096) #read 4K at a time
-        dlsize = 0
-        lasttime = 0
-        while keepgoing:
-            dlsize = dlsize + len(data)
-            if len(data) == 0:
-                #this is our exit condition
-                break
-            output.write(data)
-            if int(time.time()) != lasttime:
-                # Update at most once per second
-                lasttime = int(time.time())
-                if length == -1:
-                    keepgoing = self.update("Downloading %s: %d bytes..." % (url, dlsize))
-                else:
-                    keepgoing = self.update("Downloading %s: %d%% (%d bytes)..." % (url, int(100.0*dlsize/length), dlsize))
-            data = download.read(4096)
-        if keepgoing:
-            self.update("Downloading %s: finished" % url)
-        return keepgoing
-
-class PimpUnpacker:
-    """Abstract base class - Unpacker for archives"""
-
-    _can_rename = False
-
-    def __init__(self, argument,
-            dir="",
-            renames=[],
-            watcher=None):
-        self.argument = argument
-        if renames and not self._can_rename:
-            raise RuntimeError("This unpacker cannot rename files")
-        self._dir = dir
-        self._renames = renames
-        self._watcher = watcher
-
-    def unpack(self, archive, output=None, package=None):
-        return None
-
-    def update(self, str):
-        if self._watcher:
-            return self._watcher.update(str)
-        return True
-
-class PimpCommandUnpacker(PimpUnpacker):
-    """Unpack archives by calling a Unix utility"""
-
-    _can_rename = False
-
-    def unpack(self, archive, output=None, package=None):
-        cmd = self.argument % archive
-        if _cmd(output, self._dir, cmd):
-            return "unpack command failed"
-
-class PimpTarUnpacker(PimpUnpacker):
-    """Unpack tarfiles using the builtin tarfile module"""
-
-    _can_rename = True
-
-    def unpack(self, archive, output=None, package=None):
-        tf = tarfile.open(archive, "r")
-        members = tf.getmembers()
-        skip = []
-        if self._renames:
-            for member in members:
-                for oldprefix, newprefix in self._renames:
-                    if oldprefix[:len(self._dir)] == self._dir:
-                        oldprefix2 = oldprefix[len(self._dir):]
-                    else:
-                        oldprefix2 = None
-                    if member.name[:len(oldprefix)] == oldprefix:
-                        if newprefix is None:
-                            skip.append(member)
-                            #print 'SKIP', member.name
-                        else:
-                            member.name = newprefix + member.name[len(oldprefix):]
-                            print('    ', member.name)
-                        break
-                    elif oldprefix2 and member.name[:len(oldprefix2)] == oldprefix2:
-                        if newprefix is None:
-                            skip.append(member)
-                            #print 'SKIP', member.name
-                        else:
-                            member.name = newprefix + member.name[len(oldprefix2):]
-                            #print '    ', member.name
-                        break
-                else:
-                    skip.append(member)
-                    #print '????', member.name
-        for member in members:
-            if member in skip:
-                self.update("Skipping %s" % member.name)
-                continue
-            self.update("Extracting %s" % member.name)
-            tf.extract(member, self._dir)
-        if skip:
-            names = [member.name for member in skip if member.name[-1] != '/']
-            if package:
-                names = package.filterExpectedSkips(names)
-            if names:
-                return "Not all files were unpacked: %s" % " ".join(names)
-
-ARCHIVE_FORMATS = [
-    (".tar.Z", PimpTarUnpacker, None),
-    (".taz", PimpTarUnpacker, None),
-    (".tar.gz", PimpTarUnpacker, None),
-    (".tgz", PimpTarUnpacker, None),
-    (".tar.bz", PimpTarUnpacker, None),
-    (".zip", PimpCommandUnpacker, "unzip \"%s\""),
-]
-
-class PimpPreferences:
-    """Container for per-user preferences, such as the database to use
-    and where to install packages."""
-
-    def __init__(self,
-            flavorOrder=None,
-            downloadDir=None,
-            buildDir=None,
-            installDir=None,
-            pimpDatabase=None):
-        if not flavorOrder:
-            flavorOrder = DEFAULT_FLAVORORDER
-        if not downloadDir:
-            downloadDir = DEFAULT_DOWNLOADDIR
-        if not buildDir:
-            buildDir = DEFAULT_BUILDDIR
-        if not pimpDatabase:
-            pimpDatabase = getDefaultDatabase()
-        self.setInstallDir(installDir)
-        self.flavorOrder = flavorOrder
-        self.downloadDir = downloadDir
-        self.buildDir = buildDir
-        self.pimpDatabase = pimpDatabase
-        self.watcher = None
-
-    def setWatcher(self, watcher):
-        self.watcher = watcher
-
-    def setInstallDir(self, installDir=None):
-        if installDir:
-            # Installing to non-standard location.
-            self.installLocations = [
-                ('--install-lib', installDir),
-                ('--install-headers', None),
-                ('--install-scripts', None),
-                ('--install-data', None)]
-        else:
-            installDir = DEFAULT_INSTALLDIR
-            self.installLocations = []
-        self.installDir = installDir
-
-    def isUserInstall(self):
-        return self.installDir != DEFAULT_INSTALLDIR
-
-    def check(self):
-        """Check that the preferences make sense: directories exist and are
-        writable, the install directory is on sys.path, etc."""
-
-        rv = ""
-        RWX_OK = os.R_OK|os.W_OK|os.X_OK
-        if not os.path.exists(self.downloadDir):
-            rv += "Warning: Download directory \"%s\" does not exist\n" % self.downloadDir
-        elif not os.access(self.downloadDir, RWX_OK):
-            rv += "Warning: Download directory \"%s\" is not writable or not readable\n" % self.downloadDir
-        if not os.path.exists(self.buildDir):
-            rv += "Warning: Build directory \"%s\" does not exist\n" % self.buildDir
-        elif not os.access(self.buildDir, RWX_OK):
-            rv += "Warning: Build directory \"%s\" is not writable or not readable\n" % self.buildDir
-        if not os.path.exists(self.installDir):
-            rv += "Warning: Install directory \"%s\" does not exist\n" % self.installDir
-        elif not os.access(self.installDir, RWX_OK):
-            rv += "Warning: Install directory \"%s\" is not writable or not readable\n" % self.installDir
-        else:
-            installDir = os.path.realpath(self.installDir)
-            for p in sys.path:
-                try:
-                    realpath = os.path.realpath(p)
-                except:
-                    pass
-                if installDir == realpath:
-                    break
-            else:
-                rv += "Warning: Install directory \"%s\" is not on sys.path\n" % self.installDir
-        return rv
-
-    def compareFlavors(self, left, right):
-        """Compare two flavor strings. This is part of your preferences
-        because whether the user prefers installing from source or binary is."""
-        if left in self.flavorOrder:
-            if right in self.flavorOrder:
-                return cmp(self.flavorOrder.index(left), self.flavorOrder.index(right))
-            return -1
-        if right in self.flavorOrder:
-            return 1
-        return cmp(left, right)
-
-class PimpDatabase:
-    """Class representing a pimp database. It can actually contain
-    information from multiple databases through inclusion, but the
-    toplevel database is considered the master, as its maintainer is
-    "responsible" for the contents."""
-
-    def __init__(self, prefs):
-        self._packages = []
-        self.preferences = prefs
-        self._url = ""
-        self._urllist = []
-        self._version = ""
-        self._maintainer = ""
-        self._description = ""
-
-    # Accessor functions
-    def url(self): return self._url
-    def version(self): return self._version
-    def maintainer(self): return self._maintainer
-    def description(self): return self._description
-
-    def close(self):
-        """Clean up"""
-        self._packages = []
-        self.preferences = None
-
-    def appendURL(self, url, included=0):
-        """Append packages from the database with the given URL.
-        Only the first database should specify included=0, so the
-        global information (maintainer, description) get stored."""
-
-        if url in self._urllist:
-            return
-        self._urllist.append(url)
-        fp = urllib2.urlopen(url).fp
-        plistdata = plistlib.Plist.fromFile(fp)
-        # Test here for Pimp version, etc
-        if included:
-            version = plistdata.get('Version')
-            if version and version > self._version:
-                sys.stderr.write("Warning: included database %s is for pimp version %s\n" %
-                    (url, version))
-        else:
-            self._version = plistdata.get('Version')
-            if not self._version:
-                sys.stderr.write("Warning: database has no Version information\n")
-            elif self._version > PIMP_VERSION:
-                sys.stderr.write("Warning: database version %s newer than pimp version %s\n"
-                    % (self._version, PIMP_VERSION))
-            self._maintainer = plistdata.get('Maintainer', '')
-            self._description = plistdata.get('Description', '').strip()
-            self._url = url
-        self._appendPackages(plistdata['Packages'], url)
-        others = plistdata.get('Include', [])
-        for o in others:
-            o = urllib.basejoin(url, o)
-            self.appendURL(o, included=1)
-
-    def _appendPackages(self, packages, url):
-        """Given a list of dictionaries containing package
-        descriptions create the PimpPackage objects and append them
-        to our internal storage."""
-
-        for p in packages:
-            p = dict(p)
-            if 'Download-URL' in p:
-                p['Download-URL'] = urllib.basejoin(url, p['Download-URL'])
-            flavor = p.get('Flavor')
-            if flavor == 'source':
-                pkg = PimpPackage_source(self, p)
-            elif flavor == 'binary':
-                pkg = PimpPackage_binary(self, p)
-            elif flavor == 'installer':
-                pkg = PimpPackage_installer(self, p)
-            elif flavor == 'hidden':
-                pkg = PimpPackage_installer(self, p)
-            else:
-                pkg = PimpPackage(self, dict(p))
-            self._packages.append(pkg)
-
-    def list(self):
-        """Return a list of all PimpPackage objects in the database."""
-
-        return self._packages
-
-    def listnames(self):
-        """Return a list of names of all packages in the database."""
-
-        rv = []
-        for pkg in self._packages:
-            rv.append(pkg.fullname())
-        rv.sort()
-        return rv
-
-    def dump(self, pathOrFile):
-        """Dump the contents of the database to an XML .plist file.
-
-        The file can be passed as either a file object or a pathname.
-        All data, including included databases, is dumped."""
-
-        packages = []
-        for pkg in self._packages:
-            packages.append(pkg.dump())
-        plistdata = {
-            'Version': self._version,
-            'Maintainer': self._maintainer,
-            'Description': self._description,
-            'Packages': packages
-            }
-        plist = plistlib.Plist(**plistdata)
-        plist.write(pathOrFile)
-
-    def find(self, ident):
-        """Find a package. The package can be specified by name
-        or as a dictionary with name, version and flavor entries.
-
-        Only name is obligatory. If there are multiple matches the
-        best one (higher version number, flavors ordered according to
-        users' preference) is returned."""
-
-        if type(ident) == str:
-            # Remove ( and ) for pseudo-packages
-            if ident[0] == '(' and ident[-1] == ')':
-                ident = ident[1:-1]
-            # Split into name-version-flavor
-            fields = ident.split('-')
-            if len(fields) < 1 or len(fields) > 3:
-                return None
-            name = fields[0]
-            if len(fields) > 1:
-                version = fields[1]
-            else:
-                version = None
-            if len(fields) > 2:
-                flavor = fields[2]
-            else:
-                flavor = None
-        else:
-            name = ident['Name']
-            version = ident.get('Version')
-            flavor = ident.get('Flavor')
-        found = None
-        for p in self._packages:
-            if name == p.name() and \
-                    (not version or version == p.version()) and \
-                    (not flavor or flavor == p.flavor()):
-                if not found or found < p:
-                    found = p
-        return found
-
-ALLOWED_KEYS = [
-    "Name",
-    "Version",
-    "Flavor",
-    "Description",
-    "Home-page",
-    "Download-URL",
-    "Install-test",
-    "Install-command",
-    "Pre-install-command",
-    "Post-install-command",
-    "Prerequisites",
-    "MD5Sum",
-    "User-install-skips",
-    "Systemwide-only",
-]
-
-class PimpPackage:
-    """Class representing a single package."""
-
-    def __init__(self, db, plistdata):
-        self._db = db
-        name = plistdata["Name"]
-        for k in plistdata.keys():
-            if not k in ALLOWED_KEYS:
-                sys.stderr.write("Warning: %s: unknown key %s\n" % (name, k))
-        self._dict = plistdata
-
-    def __getitem__(self, key):
-        return self._dict[key]
-
-    def name(self): return self._dict['Name']
-    def version(self): return self._dict.get('Version')
-    def flavor(self): return self._dict.get('Flavor')
-    def description(self): return self._dict['Description'].strip()
-    def shortdescription(self): return self.description().splitlines()[0]
-    def homepage(self): return self._dict.get('Home-page')
-    def downloadURL(self): return self._dict.get('Download-URL')
-    def systemwideOnly(self): return self._dict.get('Systemwide-only')
-
-    def fullname(self):
-        """Return the full name "name-version-flavor" of a package.
-
-        If the package is a pseudo-package, something that cannot be
-        installed through pimp, return the name in (parentheses)."""
-
-        rv = self._dict['Name']
-        if 'Version' in self._dict:
-            rv = rv + '-%s' % self._dict['Version']
-        if 'Flavor' in self._dict:
-            rv = rv + '-%s' % self._dict['Flavor']
-        if self._dict.get('Flavor') == 'hidden':
-            # Pseudo-package, show in parentheses
-            rv = '(%s)' % rv
-        return rv
-
-    def dump(self):
-        """Return a dict object containing the information on the package."""
-        return self._dict
-
-    def __cmp__(self, other):
-        """Compare two packages, where the "better" package sorts lower."""
-
-        if not isinstance(other, PimpPackage):
-            return cmp(id(self), id(other))
-        if self.name() != other.name():
-            return cmp(self.name(), other.name())
-        if self.version() != other.version():
-            return -cmp(self.version(), other.version())
-        return self._db.preferences.compareFlavors(self.flavor(), other.flavor())
-
-    def installed(self):
-        """Test wheter the package is installed.
-
-        Returns two values: a status indicator which is one of
-        "yes", "no", "old" (an older version is installed) or "bad"
-        (something went wrong during the install test) and a human
-        readable string which may contain more details."""
-
-        namespace = {
-            "NotInstalled": _scriptExc_NotInstalled,
-            "OldInstalled": _scriptExc_OldInstalled,
-            "BadInstalled": _scriptExc_BadInstalled,
-            "os": os,
-            "sys": sys,
-            }
-        installTest = self._dict['Install-test'].strip() + '\n'
-        try:
-            exec(installTest, namespace)
-        except ImportError as arg:
-            return "no", str(arg)
-        except _scriptExc_NotInstalled as arg:
-            return "no", str(arg)
-        except _scriptExc_OldInstalled as arg:
-            return "old", str(arg)
-        except _scriptExc_BadInstalled as arg:
-            return "bad", str(arg)
-        except:
-            sys.stderr.write("-------------------------------------\n")
-            sys.stderr.write("---- %s: install test got exception\n" % self.fullname())
-            sys.stderr.write("---- source:\n")
-            sys.stderr.write(installTest)
-            sys.stderr.write("---- exception:\n")
-            import traceback
-            traceback.print_exc(file=sys.stderr)
-            if self._db._maintainer:
-                sys.stderr.write("---- Please copy this and mail to %s\n" % self._db._maintainer)
-            sys.stderr.write("-------------------------------------\n")
-            return "bad", "Package install test got exception"
-        return "yes", ""
-
-    def prerequisites(self):
-        """Return a list of prerequisites for this package.
-
-        The list contains 2-tuples, of which the first item is either
-        a PimpPackage object or None, and the second is a descriptive
-        string. The first item can be None if this package depends on
-        something that isn't pimp-installable, in which case the descriptive
-        string should tell the user what to do."""
-
-        rv = []
-        if not self._dict.get('Download-URL'):
-            # For pseudo-packages that are already installed we don't
-            # return an error message
-            status, _  = self.installed()
-            if status == "yes":
-                return []
-            return [(None,
-                "Package %s cannot be installed automatically, see the description" %
-                    self.fullname())]
-        if self.systemwideOnly() and self._db.preferences.isUserInstall():
-            return [(None,
-                "Package %s can only be installed system-wide" %
-                    self.fullname())]
-        if not self._dict.get('Prerequisites'):
-            return []
-        for item in self._dict['Prerequisites']:
-            if type(item) == str:
-                pkg = None
-                descr = str(item)
-            else:
-                name = item['Name']
-                if 'Version' in item:
-                    name = name + '-' + item['Version']
-                if 'Flavor' in item:
-                    name = name + '-' + item['Flavor']
-                pkg = self._db.find(name)
-                if not pkg:
-                    descr = "Requires unknown %s"%name
-                else:
-                    descr = pkg.shortdescription()
-            rv.append((pkg, descr))
-        return rv
-
-
-    def downloadPackageOnly(self, output=None):
-        """Download a single package, if needed.
-
-        An MD5 signature is used to determine whether download is needed,
-        and to test that we actually downloaded what we expected.
-        If output is given it is a file-like object that will receive a log
-        of what happens.
-
-        If anything unforeseen happened the method returns an error message
-        string.
-        """
-
-        scheme, loc, path, query, frag = urlparse.urlsplit(self._dict['Download-URL'])
-        path = urllib.url2pathname(path)
-        filename = os.path.split(path)[1]
-        self.archiveFilename = os.path.join(self._db.preferences.downloadDir, filename)
-        if not self._archiveOK():
-            if scheme == 'manual':
-                return "Please download package manually and save as %s" % self.archiveFilename
-            downloader = PimpUrllibDownloader(None, self._db.preferences.downloadDir,
-                watcher=self._db.preferences.watcher)
-            if not downloader.download(self._dict['Download-URL'],
-                    self.archiveFilename, output):
-                return "download command failed"
-        if not os.path.exists(self.archiveFilename) and not NO_EXECUTE:
-            return "archive not found after download"
-        if not self._archiveOK():
-            return "archive does not have correct MD5 checksum"
-
-    def _archiveOK(self):
-        """Test an archive. It should exist and the MD5 checksum should be correct."""
-
-        if not os.path.exists(self.archiveFilename):
-            return 0
-        if not self._dict.get('MD5Sum'):
-            sys.stderr.write("Warning: no MD5Sum for %s\n" % self.fullname())
-            return 1
-        data = open(self.archiveFilename, 'rb').read()
-        checksum = hashlib.md5(data).hexdigest()
-        return checksum == self._dict['MD5Sum']
-
-    def unpackPackageOnly(self, output=None):
-        """Unpack a downloaded package archive."""
-
-        filename = os.path.split(self.archiveFilename)[1]
-        for ext, unpackerClass, arg in ARCHIVE_FORMATS:
-            if filename[-len(ext):] == ext:
-                break
-        else:
-            return "unknown extension for archive file: %s" % filename
-        self.basename = filename[:-len(ext)]
-        unpacker = unpackerClass(arg, dir=self._db.preferences.buildDir,
-                watcher=self._db.preferences.watcher)
-        rv = unpacker.unpack(self.archiveFilename, output=output)
-        if rv:
-            return rv
-
-    def installPackageOnly(self, output=None):
-        """Default install method, to be overridden by subclasses"""
-        return "%s: This package needs to be installed manually (no support for flavor=\"%s\")" \
-            % (self.fullname(), self._dict.get(flavor, ""))
-
-    def installSinglePackage(self, output=None):
-        """Download, unpack and install a single package.
-
-        If output is given it should be a file-like object and it
-        will receive a log of what happened."""
-
-        if not self._dict.get('Download-URL'):
-            return "%s: This package needs to be installed manually (no Download-URL field)" % self.fullname()
-        msg = self.downloadPackageOnly(output)
-        if msg:
-            return "%s: download: %s" % (self.fullname(), msg)
-
-        msg = self.unpackPackageOnly(output)
-        if msg:
-            return "%s: unpack: %s" % (self.fullname(), msg)
-
-        return self.installPackageOnly(output)
-
-    def beforeInstall(self):
-        """Bookkeeping before installation: remember what we have in site-packages"""
-        self._old_contents = os.listdir(self._db.preferences.installDir)
-
-    def afterInstall(self):
-        """Bookkeeping after installation: interpret any new .pth files that have
-        appeared"""
-
-        new_contents = os.listdir(self._db.preferences.installDir)
-        for fn in new_contents:
-            if fn in self._old_contents:
-                continue
-            if fn[-4:] != '.pth':
-                continue
-            fullname = os.path.join(self._db.preferences.installDir, fn)
-            f = open(fullname)
-            for line in f.readlines():
-                if not line:
-                    continue
-                if line[0] == '#':
-                    continue
-                if line[:6] == 'import':
-                    exec(line)
-                    continue
-                if line[-1] == '\n':
-                    line = line[:-1]
-                if not os.path.isabs(line):
-                    line = os.path.join(self._db.preferences.installDir, line)
-                line = os.path.realpath(line)
-                if not line in sys.path:
-                    sys.path.append(line)
-
-    def filterExpectedSkips(self, names):
-        """Return a list that contains only unpexpected skips"""
-        if not self._db.preferences.isUserInstall():
-            return names
-        expected_skips = self._dict.get('User-install-skips')
-        if not expected_skips:
-            return names
-        newnames = []
-        for name in names:
-            for skip in expected_skips:
-                if name[:len(skip)] == skip:
-                    break
-            else:
-                newnames.append(name)
-        return newnames
-
-class PimpPackage_binary(PimpPackage):
-
-    def unpackPackageOnly(self, output=None):
-        """We don't unpack binary packages until installing"""
-        pass
-
-    def installPackageOnly(self, output=None):
-        """Install a single source package.
-
-        If output is given it should be a file-like object and it
-        will receive a log of what happened."""
-
-        if 'Install-command' in self._dict:
-            return "%s: Binary package cannot have Install-command" % self.fullname()
-
-        if 'Pre-install-command' in self._dict:
-            if _cmd(output, '/tmp', self._dict['Pre-install-command']):
-                return "pre-install %s: running \"%s\" failed" % \
-                    (self.fullname(), self._dict['Pre-install-command'])
-
-        self.beforeInstall()
-
-        # Install by unpacking
-        filename = os.path.split(self.archiveFilename)[1]
-        for ext, unpackerClass, arg in ARCHIVE_FORMATS:
-            if filename[-len(ext):] == ext:
-                break
-        else:
-            return "%s: unknown extension for archive file: %s" % (self.fullname(), filename)
-        self.basename = filename[:-len(ext)]
-
-        install_renames = []
-        for k, newloc in self._db.preferences.installLocations:
-            if not newloc:
-                continue
-            if k == "--install-lib":
-                oldloc = DEFAULT_INSTALLDIR
-            else:
-                return "%s: Don't know installLocation %s" % (self.fullname(), k)
-            install_renames.append((oldloc, newloc))
-
-        unpacker = unpackerClass(arg, dir="/", renames=install_renames)
-        rv = unpacker.unpack(self.archiveFilename, output=output, package=self)
-        if rv:
-            return rv
-
-        self.afterInstall()
-
-        if 'Post-install-command' in self._dict:
-            if _cmd(output, '/tmp', self._dict['Post-install-command']):
-                return "%s: post-install: running \"%s\" failed" % \
-                    (self.fullname(), self._dict['Post-install-command'])
-
-        return None
-
-
-class PimpPackage_source(PimpPackage):
-
-    def unpackPackageOnly(self, output=None):
-        """Unpack a source package and check that setup.py exists"""
-        PimpPackage.unpackPackageOnly(self, output)
-        # Test that a setup script has been create
-        self._buildDirname = os.path.join(self._db.preferences.buildDir, self.basename)
-        setupname = os.path.join(self._buildDirname, "setup.py")
-        if not os.path.exists(setupname) and not NO_EXECUTE:
-            return "no setup.py found after unpack of archive"
-
-    def installPackageOnly(self, output=None):
-        """Install a single source package.
-
-        If output is given it should be a file-like object and it
-        will receive a log of what happened."""
-
-        if 'Pre-install-command' in self._dict:
-            if _cmd(output, self._buildDirname, self._dict['Pre-install-command']):
-                return "pre-install %s: running \"%s\" failed" % \
-                    (self.fullname(), self._dict['Pre-install-command'])
-
-        self.beforeInstall()
-        installcmd = self._dict.get('Install-command')
-        if installcmd and self._install_renames:
-            return "Package has install-command and can only be installed to standard location"
-        # This is the "bit-bucket" for installations: everything we don't
-        # want. After installation we check that it is actually empty
-        unwanted_install_dir = None
-        if not installcmd:
-            extra_args = ""
-            for k, v in self._db.preferences.installLocations:
-                if not v:
-                    # We don't want these files installed. Send them
-                    # to the bit-bucket.
-                    if not unwanted_install_dir:
-                        unwanted_install_dir = tempfile.mkdtemp()
-                    v = unwanted_install_dir
-                extra_args = extra_args + " %s \"%s\"" % (k, v)
-            installcmd = '"%s" setup.py install %s' % (sys.executable, extra_args)
-        if _cmd(output, self._buildDirname, installcmd):
-            return "install %s: running \"%s\" failed" % \
-                (self.fullname(), installcmd)
-        if unwanted_install_dir and os.path.exists(unwanted_install_dir):
-            unwanted_files = os.listdir(unwanted_install_dir)
-            if unwanted_files:
-                rv = "Warning: some files were not installed: %s" % " ".join(unwanted_files)
-            else:
-                rv = None
-            shutil.rmtree(unwanted_install_dir)
-            return rv
-
-        self.afterInstall()
-
-        if 'Post-install-command' in self._dict:
-            if _cmd(output, self._buildDirname, self._dict['Post-install-command']):
-                return "post-install %s: running \"%s\" failed" % \
-                    (self.fullname(), self._dict['Post-install-command'])
-        return None
-
-class PimpPackage_installer(PimpPackage):
-
-    def unpackPackageOnly(self, output=None):
-        """We don't unpack dmg packages until installing"""
-        pass
-
-    def installPackageOnly(self, output=None):
-        """Install a single source package.
-
-        If output is given it should be a file-like object and it
-        will receive a log of what happened."""
-
-        if 'Post-install-command' in self._dict:
-            return "%s: Installer package cannot have Post-install-command" % self.fullname()
-
-        if 'Pre-install-command' in self._dict:
-            if _cmd(output, '/tmp', self._dict['Pre-install-command']):
-                return "pre-install %s: running \"%s\" failed" % \
-                    (self.fullname(), self._dict['Pre-install-command'])
-
-        self.beforeInstall()
-
-        installcmd = self._dict.get('Install-command')
-        if installcmd:
-            if '%' in installcmd:
-                installcmd = installcmd % self.archiveFilename
-        else:
-            installcmd = 'open \"%s\"' % self.archiveFilename
-        if _cmd(output, "/tmp", installcmd):
-            return '%s: install command failed (use verbose for details)' % self.fullname()
-        return '%s: downloaded and opened. Install manually and restart Package Manager' % self.archiveFilename
-
-class PimpInstaller:
-    """Installer engine: computes dependencies and installs
-    packages in the right order."""
-
-    def __init__(self, db):
-        self._todo = []
-        self._db = db
-        self._curtodo = []
-        self._curmessages = []
-
-    def __contains__(self, package):
-        return package in self._todo
-
-    def _addPackages(self, packages):
-        for package in packages:
-            if not package in self._todo:
-                self._todo.append(package)
-
-    def _prepareInstall(self, package, force=0, recursive=1):
-        """Internal routine, recursive engine for prepareInstall.
-
-        Test whether the package is installed and (if not installed
-        or if force==1) prepend it to the temporary todo list and
-        call ourselves recursively on all prerequisites."""
-
-        if not force:
-            status, message = package.installed()
-            if status == "yes":
-                return
-        if package in self._todo or package in self._curtodo:
-            return
-        self._curtodo.insert(0, package)
-        if not recursive:
-            return
-        prereqs = package.prerequisites()
-        for pkg, descr in prereqs:
-            if pkg:
-                self._prepareInstall(pkg, False, recursive)
-            else:
-                self._curmessages.append("Problem with dependency: %s" % descr)
-
-    def prepareInstall(self, package, force=0, recursive=1):
-        """Prepare installation of a package.
-
-        If the package is already installed and force is false nothing
-        is done. If recursive is true prerequisites are installed first.
-
-        Returns a list of packages (to be passed to install) and a list
-        of messages of any problems encountered.
-        """
-
-        self._curtodo = []
-        self._curmessages = []
-        self._prepareInstall(package, force, recursive)
-        rv = self._curtodo, self._curmessages
-        self._curtodo = []
-        self._curmessages = []
-        return rv
-
-    def install(self, packages, output):
-        """Install a list of packages."""
-
-        self._addPackages(packages)
-        status = []
-        for pkg in self._todo:
-            msg = pkg.installSinglePackage(output)
-            if msg:
-                status.append(msg)
-        return status
-
-
-
-def _run(mode, verbose, force, args, prefargs, watcher):
-    """Engine for the main program"""
-
-    prefs = PimpPreferences(**prefargs)
-    if watcher:
-        prefs.setWatcher(watcher)
-    rv = prefs.check()
-    if rv:
-        sys.stdout.write(rv)
-    db = PimpDatabase(prefs)
-    db.appendURL(prefs.pimpDatabase)
-
-    if mode == 'dump':
-        db.dump(sys.stdout)
-    elif mode =='list':
-        if not args:
-            args = db.listnames()
-        print("%-20.20s\t%s" % ("Package", "Description"))
-        print()
-        for pkgname in args:
-            pkg = db.find(pkgname)
-            if pkg:
-                description = pkg.shortdescription()
-                pkgname = pkg.fullname()
-            else:
-                description = 'Error: no such package'
-            print("%-20.20s\t%s" % (pkgname, description))
-            if verbose:
-                print("\tHome page:\t", pkg.homepage())
-                try:
-                    print("\tDownload URL:\t", pkg.downloadURL())
-                except KeyError:
-                    pass
-                description = pkg.description()
-                description = '\n\t\t\t\t\t'.join(description.splitlines())
-                print("\tDescription:\t%s" % description)
-    elif mode =='status':
-        if not args:
-            args = db.listnames()
-            print("%-20.20s\t%s\t%s" % ("Package", "Installed", "Message"))
-            print()
-        for pkgname in args:
-            pkg = db.find(pkgname)
-            if pkg:
-                status, msg = pkg.installed()
-                pkgname = pkg.fullname()
-            else:
-                status = 'error'
-                msg = 'No such package'
-            print("%-20.20s\t%-9.9s\t%s" % (pkgname, status, msg))
-            if verbose and status == "no":
-                prereq = pkg.prerequisites()
-                for pkg, msg in prereq:
-                    if not pkg:
-                        pkg = ''
-                    else:
-                        pkg = pkg.fullname()
-                    print("%-20.20s\tRequirement: %s %s" % ("", pkg, msg))
-    elif mode == 'install':
-        if not args:
-            print('Please specify packages to install')
-            sys.exit(1)
-        inst = PimpInstaller(db)
-        for pkgname in args:
-            pkg = db.find(pkgname)
-            if not pkg:
-                print('%s: No such package' % pkgname)
-                continue
-            list, messages = inst.prepareInstall(pkg, force)
-            if messages and not force:
-                print("%s: Not installed:" % pkgname)
-                for m in messages:
-                    print("\t", m)
-            else:
-                if verbose:
-                    output = sys.stdout
-                else:
-                    output = None
-                messages = inst.install(list, output)
-                if messages:
-                    print("%s: Not installed:" % pkgname)
-                    for m in messages:
-                        print("\t", m)
-
-def main():
-    """Minimal commandline tool to drive pimp."""
-
-    import getopt
-    def _help():
-        print("Usage: pimp [options] -s [package ...]  List installed status")
-        print("       pimp [options] -l [package ...]  Show package information")
-        print("       pimp [options] -i package ...    Install packages")
-        print("       pimp -d                          Dump database to stdout")
-        print("       pimp -V                          Print version number")
-        print("Options:")
-        print("       -v     Verbose")
-        print("       -f     Force installation")
-        print("       -D dir Set destination directory")
-        print("              (default: %s)" % DEFAULT_INSTALLDIR)
-        print("       -u url URL for database")
-        sys.exit(1)
-
-    class _Watcher:
-        def update(self, msg):
-            sys.stderr.write(msg + '\r')
-            return 1
-
-    try:
-        opts, args = getopt.getopt(sys.argv[1:], "slifvdD:Vu:")
-    except getopt.GetoptError:
-        _help()
-    if not opts and not args:
-        _help()
-    mode = None
-    force = 0
-    verbose = 0
-    prefargs = {}
-    watcher = None
-    for o, a in opts:
-        if o == '-s':
-            if mode:
-                _help()
-            mode = 'status'
-        if o == '-l':
-            if mode:
-                _help()
-            mode = 'list'
-        if o == '-d':
-            if mode:
-                _help()
-            mode = 'dump'
-        if o == '-V':
-            if mode:
-                _help()
-            mode = 'version'
-        if o == '-i':
-            mode = 'install'
-        if o == '-f':
-            force = 1
-        if o == '-v':
-            verbose = 1
-            watcher = _Watcher()
-        if o == '-D':
-            prefargs['installDir'] = a
-        if o == '-u':
-            prefargs['pimpDatabase'] = a
-    if not mode:
-        _help()
-    if mode == 'version':
-        print('Pimp version %s; module name is %s' % (PIMP_VERSION, __name__))
-    else:
-        _run(mode, verbose, force, args, prefargs, watcher)
-
-# Finally, try to update ourselves to a newer version.
-# If the end-user updates pimp through pimp the new version
-# will be called pimp_update and live in site-packages
-# or somewhere similar
-if __name__ != 'pimp_update':
-    try:
-        import pimp_update
-    except ImportError:
-        pass
-    else:
-        if pimp_update.PIMP_VERSION <= PIMP_VERSION:
-            import warnings
-            warnings.warn("pimp_update is version %s, not newer than pimp version %s" %
-                (pimp_update.PIMP_VERSION, PIMP_VERSION))
-        else:
-            from pimp_update import *
-
-if __name__ == '__main__':
-    main()

Deleted: python/branches/py3k/Lib/plat-mac/terminalcommand.py
==============================================================================
--- python/branches/py3k/Lib/plat-mac/terminalcommand.py	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,47 +0,0 @@
-"""terminalcommand.py -- A minimal interface to Terminal.app.
-
-To run a shell command in a new Terminal.app window:
-
-    import terminalcommand
-    terminalcommand.run("ls -l")
-
-No result is returned; it is purely meant as a quick way to run a script
-with a decent input/output window.
-"""
-
-#
-# This module is a fairly straightforward translation of Jack Jansen's
-# Mac/OSX/PythonLauncher/doscript.m.
-#
-
-import time
-import os
-from Carbon import AE
-from Carbon.AppleEvents import *
-
-
-TERMINAL_SIG = "trmx"
-START_TERMINAL = "/usr/bin/open /Applications/Utilities/Terminal.app"
-SEND_MODE = kAENoReply  # kAEWaitReply hangs when run from Terminal.app itself
-
-
-def run(command):
-    """Run a shell command in a new Terminal.app window."""
-    termAddress = AE.AECreateDesc(typeApplicationBundleID, "com.apple.Terminal")
-    theEvent = AE.AECreateAppleEvent(kAECoreSuite, kAEDoScript, termAddress,
-                                     kAutoGenerateReturnID, kAnyTransactionID)
-    commandDesc = AE.AECreateDesc(typeChar, command)
-    theEvent.AEPutParamDesc(kAECommandClass, commandDesc)
-
-    try:
-        theEvent.AESend(SEND_MODE, kAENormalPriority, kAEDefaultTimeout)
-    except AE.Error as why:
-        if why.args[0] != -600:  # Terminal.app not yet running
-            raise
-        os.system(START_TERMINAL)
-        time.sleep(1)
-        theEvent.AESend(SEND_MODE, kAENormalPriority, kAEDefaultTimeout)
-
-
-if __name__ == "__main__":
-    run("ls -l")

Deleted: python/branches/py3k/Lib/plat-mac/videoreader.py
==============================================================================
--- python/branches/py3k/Lib/plat-mac/videoreader.py	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,291 +0,0 @@
-# Video file reader, using QuickTime
-#
-# This module was quickly ripped out of another software package, so there is a good
-# chance that it does not work as-is and it needs some hacking.
-#
-# Jack Jansen, August 2000
-#
-import sys
-from Carbon import Qt
-from Carbon import QuickTime
-from Carbon import Qd
-from Carbon import Qdoffs
-from Carbon import QDOffscreen
-from Carbon import Res
-try:
-    import MediaDescr
-except ImportError:
-    def _audiodescr(data):
-        return None
-else:
-    def _audiodescr(data):
-        return MediaDescr.SoundDescription.decode(data)
-try:
-    from imgformat import macrgb
-except ImportError:
-    macrgb = "Macintosh RGB format"
-import os
-# import audio.format
-
-class VideoFormat:
-    def __init__(self, name, descr, width, height, format):
-        self.__name = name
-        self.__descr = descr
-        self.__width = width
-        self.__height = height
-        self.__format = format
-
-    def getname(self):
-        return self.__name
-
-    def getdescr(self):
-        return self.__descr
-
-    def getsize(self):
-        return self.__width, self.__height
-
-    def getformat(self):
-        return self.__format
-
-class _Reader:
-    def __init__(self, path):
-        fd = Qt.OpenMovieFile(path, 0)
-        self.movie, d1, d2 = Qt.NewMovieFromFile(fd, 0, 0)
-        self.movietimescale = self.movie.GetMovieTimeScale()
-        try:
-            self.audiotrack = self.movie.GetMovieIndTrackType(1,
-                QuickTime.AudioMediaCharacteristic, QuickTime.movieTrackCharacteristic)
-            self.audiomedia = self.audiotrack.GetTrackMedia()
-        except Qt.Error:
-            self.audiotrack = self.audiomedia = None
-            self.audiodescr = {}
-        else:
-            handle = Res.Handle('')
-            n = self.audiomedia.GetMediaSampleDescriptionCount()
-            self.audiomedia.GetMediaSampleDescription(1, handle)
-            self.audiodescr = _audiodescr(handle.data)
-            self.audiotimescale = self.audiomedia.GetMediaTimeScale()
-            del handle
-
-        try:
-            self.videotrack = self.movie.GetMovieIndTrackType(1,
-                QuickTime.VisualMediaCharacteristic, QuickTime.movieTrackCharacteristic)
-            self.videomedia = self.videotrack.GetTrackMedia()
-        except Qt.Error:
-            self.videotrack = self.videomedia = self.videotimescale = None
-        if self.videotrack:
-            self.videotimescale = self.videomedia.GetMediaTimeScale()
-            x0, y0, x1, y1 = self.movie.GetMovieBox()
-            self.videodescr = {'width':(x1-x0), 'height':(y1-y0)}
-            self._initgworld()
-        self.videocurtime = None
-        self.audiocurtime = None
-
-
-    def __del__(self):
-        self.audiomedia = None
-        self.audiotrack = None
-        self.videomedia = None
-        self.videotrack = None
-        self.movie = None
-
-    def _initgworld(self):
-        old_port, old_dev = Qdoffs.GetGWorld()
-        try:
-            movie_w = self.videodescr['width']
-            movie_h = self.videodescr['height']
-            movie_rect = (0, 0, movie_w, movie_h)
-            self.gworld = Qdoffs.NewGWorld(32,  movie_rect, None, None, QDOffscreen.keepLocal)
-            self.pixmap = self.gworld.GetGWorldPixMap()
-            Qdoffs.LockPixels(self.pixmap)
-            Qdoffs.SetGWorld(self.gworld.as_GrafPtr(), None)
-            Qd.EraseRect(movie_rect)
-            self.movie.SetMovieGWorld(self.gworld.as_GrafPtr(), None)
-            self.movie.SetMovieBox(movie_rect)
-            self.movie.SetMovieActive(1)
-            self.movie.MoviesTask(0)
-            self.movie.SetMoviePlayHints(QuickTime.hintsHighQuality, QuickTime.hintsHighQuality)
-            # XXXX framerate
-        finally:
-            Qdoffs.SetGWorld(old_port, old_dev)
-
-    def _gettrackduration_ms(self, track):
-        tracktime = track.GetTrackDuration()
-        return self._movietime_to_ms(tracktime)
-
-    def _movietime_to_ms(self, time):
-        value, d1, d2 = Qt.ConvertTimeScale((time, self.movietimescale, None), 1000)
-        return value
-
-    def _videotime_to_ms(self, time):
-        value, d1, d2 = Qt.ConvertTimeScale((time, self.videotimescale, None), 1000)
-        return value
-
-    def _audiotime_to_ms(self, time):
-        value, d1, d2 = Qt.ConvertTimeScale((time, self.audiotimescale, None), 1000)
-        return value
-
-    def _videotime_to_movietime(self, time):
-        value, d1, d2 = Qt.ConvertTimeScale((time, self.videotimescale, None),
-                self.movietimescale)
-        return value
-
-    def HasAudio(self):
-        return not self.audiotrack is None
-
-    def HasVideo(self):
-        return not self.videotrack is None
-
-    def GetAudioDuration(self):
-        if not self.audiotrack:
-            return 0
-        return self._gettrackduration_ms(self.audiotrack)
-
-    def GetVideoDuration(self):
-        if not self.videotrack:
-            return 0
-        return self._gettrackduration_ms(self.videotrack)
-
-    def GetAudioFormat(self):
-        if not self.audiodescr:
-            return None, None, None, None, None
-        bps = self.audiodescr['sampleSize']
-        nch = self.audiodescr['numChannels']
-        if nch == 1:
-            channels = ['mono']
-        elif nch == 2:
-            channels = ['left', 'right']
-        else:
-            channels = map(lambda x: str(x+1), range(nch))
-        if bps % 8:
-            # Funny bits-per sample. We pretend not to understand
-            blocksize = 0
-            fpb = 0
-        else:
-            # QuickTime is easy (for as far as we support it): samples are always a whole
-            # number of bytes, so frames are nchannels*samplesize, and there's one frame per block.
-            blocksize = (bps/8)*nch
-            fpb = 1
-        if self.audiodescr['dataFormat'] == 'raw ':
-            encoding = 'linear-excess'
-        elif self.audiodescr['dataFormat'] == 'twos':
-            encoding = 'linear-signed'
-        else:
-            encoding = 'quicktime-coding-%s'%self.audiodescr['dataFormat']
-##      return audio.format.AudioFormatLinear('quicktime_audio', 'QuickTime Audio Format',
-##          channels, encoding, blocksize=blocksize, fpb=fpb, bps=bps)
-        return channels, encoding, blocksize, fpb, bps
-
-    def GetAudioFrameRate(self):
-        if not self.audiodescr:
-            return None
-        return int(self.audiodescr['sampleRate'])
-
-    def GetVideoFormat(self):
-        width = self.videodescr['width']
-        height = self.videodescr['height']
-        return VideoFormat('dummy_format', 'Dummy Video Format', width, height, macrgb)
-
-    def GetVideoFrameRate(self):
-        tv = self.videocurtime
-        if tv is None:
-            tv = 0
-        flags = QuickTime.nextTimeStep|QuickTime.nextTimeEdgeOK
-        tv, dur = self.videomedia.GetMediaNextInterestingTime(flags, tv, 1.0)
-        dur = self._videotime_to_ms(dur)
-        return int((1000.0/dur)+0.5)
-
-    def ReadAudio(self, nframes, time=None):
-        if not time is None:
-            self.audiocurtime = time
-        flags = QuickTime.nextTimeStep|QuickTime.nextTimeEdgeOK
-        if self.audiocurtime is None:
-            self.audiocurtime = 0
-        tv = self.audiomedia.GetMediaNextInterestingTimeOnly(flags, self.audiocurtime, 1.0)
-        if tv < 0 or (self.audiocurtime and tv < self.audiocurtime):
-            return self._audiotime_to_ms(self.audiocurtime), None
-        h = Res.Handle('')
-        desc_h = Res.Handle('')
-        size, actualtime, sampleduration, desc_index, actualcount, flags = \
-            self.audiomedia.GetMediaSample(h, 0, tv, desc_h, nframes)
-        self.audiocurtime = actualtime + actualcount*sampleduration
-        return self._audiotime_to_ms(actualtime), h.data
-
-    def ReadVideo(self, time=None):
-        if not time is None:
-            self.videocurtime = time
-        flags = QuickTime.nextTimeStep
-        if self.videocurtime is None:
-            flags = flags | QuickTime.nextTimeEdgeOK
-            self.videocurtime = 0
-        tv = self.videomedia.GetMediaNextInterestingTimeOnly(flags, self.videocurtime, 1.0)
-        if tv < 0 or (self.videocurtime and tv <= self.videocurtime):
-            return self._videotime_to_ms(self.videocurtime), None
-        self.videocurtime = tv
-        moviecurtime = self._videotime_to_movietime(self.videocurtime)
-        self.movie.SetMovieTimeValue(moviecurtime)
-        self.movie.MoviesTask(0)
-        return self._videotime_to_ms(self.videocurtime), self._getpixmapcontent()
-
-    def _getpixmapcontent(self):
-        """Shuffle the offscreen PixMap data, because it may have funny stride values"""
-        rowbytes = Qdoffs.GetPixRowBytes(self.pixmap)
-        width = self.videodescr['width']
-        height = self.videodescr['height']
-        start = 0
-        rv = ''
-        for i in range(height):
-            nextline = Qdoffs.GetPixMapBytes(self.pixmap, start, width*4)
-            start = start + rowbytes
-            rv = rv + nextline
-        return rv
-
-def reader(url):
-    try:
-        rdr = _Reader(url)
-    except IOError:
-        return None
-    return rdr
-
-def _test():
-    import EasyDialogs
-    try:
-        import img
-    except ImportError:
-        img = None
-    import MacOS
-    Qt.EnterMovies()
-    path = EasyDialogs.AskFileForOpen(message='Video to convert')
-    if not path: sys.exit(0)
-    rdr = reader(path)
-    if not rdr:
-        sys.exit(1)
-    dstdir = EasyDialogs.AskFileForSave(message='Name for output folder')
-    if not dstdir: sys.exit(0)
-    num = 0
-    os.mkdir(dstdir)
-    videofmt = rdr.GetVideoFormat()
-    imgfmt = videofmt.getformat()
-    imgw, imgh = videofmt.getsize()
-    timestamp, data = rdr.ReadVideo()
-    while data:
-        fname = 'frame%04.4d.jpg'%num
-        num = num+1
-        pname = os.path.join(dstdir, fname)
-        if not img: print('Not', end=' ')
-        print('Writing %s, size %dx%d, %d bytes'%(fname, imgw, imgh, len(data)))
-        if img:
-            wrt = img.writer(imgfmt, pname)
-            wrt.width = imgw
-            wrt.height = imgh
-            wrt.write(data)
-            timestamp, data = rdr.ReadVideo()
-            MacOS.SetCreatorAndType(pname, 'ogle', 'JPEG')
-            if num > 20:
-                print('stopping at 20 frames so your disk does not fill up:-)')
-                break
-    print('Total frames:', num)
-
-if __name__ == '__main__':
-    _test()
-    sys.exit(1)

Modified: python/branches/py3k/Lib/plistlib.py
==============================================================================
--- python/branches/py3k/Lib/plistlib.py	(original)
+++ python/branches/py3k/Lib/plistlib.py	Tue May 13 00:25:16 2008
@@ -53,7 +53,6 @@
 
 __all__ = [
     "readPlist", "writePlist", "readPlistFromBytes", "writePlistToBytes",
-    "readPlistFromResource", "writePlistToResource",
     "Plist", "Data", "Dict"
 ]
 # Note: the Plist and Dict classes have been deprecated.
@@ -110,40 +109,6 @@
     return f.getvalue()
 
 
-def readPlistFromResource(path, restype='plst', resid=0):
-    """Read plst resource from the resource fork of path.
-    """
-    from Carbon.File import FSRef, FSGetResourceForkName
-    from Carbon.Files import fsRdPerm
-    from Carbon import Res
-    fsRef = FSRef(path)
-    resNum = Res.FSOpenResourceFile(fsRef, FSGetResourceForkName(), fsRdPerm)
-    Res.UseResFile(resNum)
-    plistData = Res.Get1Resource(restype, resid).data
-    Res.CloseResFile(resNum)
-    return readPlistFromString(plistData)
-
-
-def writePlistToResource(rootObject, path, restype='plst', resid=0):
-    """Write 'rootObject' as a plst resource to the resource fork of path.
-    """
-    from Carbon.File import FSRef, FSGetResourceForkName
-    from Carbon.Files import fsRdWrPerm
-    from Carbon import Res
-    plistData = writePlistToString(rootObject)
-    fsRef = FSRef(path)
-    resNum = Res.FSOpenResourceFile(fsRef, FSGetResourceForkName(), fsRdWrPerm)
-    Res.UseResFile(resNum)
-    try:
-        Res.Get1Resource(restype, resid).RemoveResource()
-    except Res.Error:
-        pass
-    res = Res.Resource(plistData)
-    res.AddResource(restype, resid, '')
-    res.WriteResource()
-    Res.CloseResFile(resNum)
-
-
 class DumbXMLWriter:
     def __init__(self, file, indentLevel=0, indent="\t"):
         self.file = file

Deleted: python/branches/py3k/Lib/test/test_aepack.py
==============================================================================
--- python/branches/py3k/Lib/test/test_aepack.py	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,84 +0,0 @@
-# Copyright (C) 2003 Python Software Foundation
-
-import unittest
-import aepack
-import aetypes
-import os
-from test import test_support
-
-class TestAepack(unittest.TestCase):
-    OBJECTS = [
-        aetypes.Enum(b'enum'),
-        aetypes.Type(b'type'),
-        aetypes.Keyword(b'kwrd'),
-        aetypes.Range(1, 10),
-        aetypes.Comparison(1, b'<   ', 10),
-        aetypes.Logical(b'not ', 1),
-        aetypes.IntlText(0, 0, b'international text'),
-        aetypes.IntlWritingCode(0,0),
-        aetypes.QDPoint(50,100),
-        aetypes.QDRectangle(50,100,150,200),
-        aetypes.RGBColor(0x7000, 0x6000, 0x5000),
-        aetypes.Unknown(b'xxxx', b'unknown type data'),
-        aetypes.Character(1),
-        aetypes.Character(2, aetypes.Line(2)),
-    ]
-
-    def test_roundtrip_string(self):
-        o = 'a string'
-        packed = aepack.pack(o)
-        unpacked = aepack.unpack(packed)
-        self.assertEqual(o, unpacked)
-
-    def test_roundtrip_int(self):
-        o = 12
-        packed = aepack.pack(o)
-        unpacked = aepack.unpack(packed)
-        self.assertEqual(o, unpacked)
-
-    def test_roundtrip_float(self):
-        o = 12.1
-        packed = aepack.pack(o)
-        unpacked = aepack.unpack(packed)
-        self.assertEqual(o, unpacked)
-
-    def test_roundtrip_None(self):
-        o = None
-        packed = aepack.pack(o)
-        unpacked = aepack.unpack(packed)
-        self.assertEqual(o, unpacked)
-
-    def test_roundtrip_aeobjects(self):
-        for o in self.OBJECTS:
-            packed = aepack.pack(o)
-            unpacked = aepack.unpack(packed)
-            self.assertEqual(repr(o), repr(unpacked))
-
-    def test_roundtrip_FSSpec(self):
-        try:
-            import Carbon.File
-        except:
-            return
-        o = Carbon.File.FSSpec(os.curdir)
-        packed = aepack.pack(o)
-        unpacked = aepack.unpack(packed)
-        self.assertEqual(o.as_pathname(), unpacked.as_pathname())
-
-    def test_roundtrip_Alias(self):
-        try:
-            import Carbon.File
-        except:
-            return
-        o = Carbon.File.FSSpec(os.curdir).NewAliasMinimal()
-        packed = aepack.pack(o)
-        unpacked = aepack.unpack(packed)
-        self.assertEqual(o.FSResolveAlias(None)[0].as_pathname(),
-            unpacked.FSResolveAlias(None)[0].as_pathname())
-
-
-def test_main():
-    test_support.run_unittest(TestAepack)
-
-
-if __name__ == '__main__':
-    test_main()

Deleted: python/branches/py3k/Lib/test/test_applesingle.py
==============================================================================
--- python/branches/py3k/Lib/test/test_applesingle.py	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,71 +0,0 @@
-# Copyright (C) 2003 Python Software Foundation
-
-import unittest
-import macostools
-import Carbon.File
-import MacOS
-import os
-from test import test_support
-import struct
-import applesingle
-
-AS_MAGIC=0x00051600
-AS_VERSION=0x00020000
-dataforkdata = b'hello\r\0world\n'
-resourceforkdata = b'goodbye\ncruel\0world\r'
-
-applesingledata = struct.pack(">ll16sh", AS_MAGIC, AS_VERSION, "foo", 2) + \
-    struct.pack(">llllll", 1, 50, len(dataforkdata),
-        2, 50+len(dataforkdata), len(resourceforkdata)) + \
-    dataforkdata + \
-    resourceforkdata
-TESTFN2 = test_support.TESTFN + '2'
-
-class TestApplesingle(unittest.TestCase):
-
-    def setUp(self):
-        fp = open(test_support.TESTFN, 'wb')
-        fp.write(applesingledata)
-        fp.close()
-
-    def tearDown(self):
-        try:
-            os.unlink(test_support.TESTFN)
-        except:
-            pass
-        try:
-            os.unlink(TESTFN2)
-        except:
-            pass
-
-    def compareData(self, isrf, data):
-        if isrf:
-            fp = MacOS.openrf(TESTFN2, '*rb')
-        else:
-            fp = open(TESTFN2, 'rb')
-        filedata = fp.read(1000)
-        self.assertEqual(data, filedata)
-
-    def test_applesingle(self):
-        try:
-            os.unlink(TESTFN2)
-        except:
-            pass
-        applesingle.decode(test_support.TESTFN, TESTFN2)
-        self.compareData(False, dataforkdata)
-        self.compareData(True, resourceforkdata)
-
-    def test_applesingle_resonly(self):
-        try:
-            os.unlink(TESTFN2)
-        except:
-            pass
-        applesingle.decode(test_support.TESTFN, TESTFN2, resonly=True)
-        self.compareData(False, resourceforkdata)
-
-def test_main():
-    test_support.run_unittest(TestApplesingle)
-
-
-if __name__ == '__main__':
-    test_main()

Deleted: python/branches/py3k/Lib/test/test_macostools.py
==============================================================================
--- python/branches/py3k/Lib/test/test_macostools.py	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,98 +0,0 @@
-# Copyright (C) 2003 Python Software Foundation
-
-import unittest
-import macostools
-import Carbon.File
-import MacOS
-import os
-import sys
-from test import test_support
-
-TESTFN2 = test_support.TESTFN + '2'
-
-class TestMacostools(unittest.TestCase):
-
-    def setUp(self):
-        fp = open(test_support.TESTFN, 'w')
-        fp.write('hello world\n')
-        fp.close()
-        rfp = MacOS.openrf(test_support.TESTFN, '*wb')
-        rfp.write('goodbye world\n')
-        rfp.close()
-
-    def tearDown(self):
-        try:
-            os.unlink(test_support.TESTFN)
-        except:
-            pass
-        try:
-            os.unlink(TESTFN2)
-        except:
-            pass
-
-    def compareData(self):
-        fp = open(test_support.TESTFN, 'r')
-        data1 = fp.read()
-        fp.close()
-        fp = open(TESTFN2, 'r')
-        data2 = fp.read()
-        fp.close()
-        if data1 != data2:
-            return 'Data forks differ'
-        rfp = MacOS.openrf(test_support.TESTFN, '*rb')
-        data1 = rfp.read(1000)
-        rfp.close()
-        rfp = MacOS.openrf(TESTFN2, '*rb')
-        data2 = rfp.read(1000)
-        rfp.close()
-        if data1 != data2:
-            return 'Resource forks differ'
-        return ''
-
-    def test_touched(self):
-        # This really only tests that nothing unforeseen happens.
-        import warnings
-        with test_support.catch_warning():
-            warnings.filterwarnings('ignore', 'macostools.touched*',
-                                    DeprecationWarning)
-            macostools.touched(test_support.TESTFN)
-
-    def test_copy(self):
-        try:
-            os.unlink(TESTFN2)
-        except:
-            pass
-        macostools.copy(test_support.TESTFN, TESTFN2)
-        self.assertEqual(self.compareData(), '')
-
-    def test_mkalias(self):
-        try:
-            os.unlink(TESTFN2)
-        except:
-            pass
-        macostools.mkalias(test_support.TESTFN, TESTFN2)
-        fss, _, _ = Carbon.File.ResolveAliasFile(TESTFN2, 0)
-        self.assertEqual(fss.as_pathname(), os.path.realpath(test_support.TESTFN))
-
-    def test_mkalias_relative(self):
-        try:
-            os.unlink(TESTFN2)
-        except:
-            pass
-        # If the directory doesn't exist, then chances are this is a new
-        # install of Python so don't create it since the user might end up
-        # running ``sudo make install`` and creating the directory here won't
-        # leave it with the proper permissions.
-        if not os.path.exists(sys.prefix):
-            return
-        macostools.mkalias(test_support.TESTFN, TESTFN2, sys.prefix)
-        fss, _, _ = Carbon.File.ResolveAliasFile(TESTFN2, 0)
-        self.assertEqual(fss.as_pathname(), os.path.realpath(test_support.TESTFN))
-
-
-def test_main():
-    test_support.run_unittest(TestMacostools)
-
-
-if __name__ == '__main__':
-    test_main()

Deleted: python/branches/py3k/Lib/test/test_scriptpackages.py
==============================================================================
--- python/branches/py3k/Lib/test/test_scriptpackages.py	Tue May 13 00:25:16 2008
+++ (empty file)
@@ -1,49 +0,0 @@
-# Copyright (C) 2003 Python Software Foundation
-
-import unittest
-from test import test_support
-import aetools
-
-class TestScriptpackages(unittest.TestCase):
-
-    def _test_scriptpackage(self, package, testobject=1):
-        # Check that we can import the package
-        mod = __import__(package)
-        # Test that we can get the main event class
-        klass = getattr(mod, package)
-        # Test that we can instantiate that class
-        talker = klass()
-        if testobject:
-            # Test that we can get an application object
-            obj = mod.application(0)
-
-    def test__builtinSuites(self):
-        self._test_scriptpackage('_builtinSuites', testobject=0)
-
-    def test_StdSuites(self):
-        self._test_scriptpackage('StdSuites')
-
-    def test_SystemEvents(self):
-        self._test_scriptpackage('SystemEvents')
-
-    def test_Finder(self):
-        self._test_scriptpackage('Finder')
-
-    def test_Terminal(self):
-        self._test_scriptpackage('Terminal')
-
-    def test_Netscape(self):
-        self._test_scriptpackage('Netscape')
-
-    def test_Explorer(self):
-        self._test_scriptpackage('Explorer')
-
-    def test_CodeWarrior(self):
-        self._test_scriptpackage('CodeWarrior')
-
-def test_main():
-    test_support.run_unittest(TestScriptpackages)
-
-
-if __name__ == '__main__':
-    test_main()

Modified: python/branches/py3k/setup.py
==============================================================================
--- python/branches/py3k/setup.py	(original)
+++ python/branches/py3k/setup.py	Tue May 13 00:25:16 2008
@@ -132,12 +132,6 @@
 
         # Platform-dependent module source and include directories
         platform = self.get_platform()
-        if platform in ('darwin', 'mac') and ("--disable-toolbox-glue" not in
-            sysconfig.get_config_var("CONFIG_ARGS")):
-            # Mac OS X also includes some mac-specific modules
-            macmoddir = os.path.join(os.getcwd(), srcdir, 'Mac/Modules')
-            moddirlist.append(macmoddir)
-            incdirlist.append('./Mac/Include')
 
         alldirlist = moddirlist + incdirlist
 
@@ -1124,88 +1118,6 @@
         else:
             missing.append('ossaudiodev')
 
-        if platform == 'darwin' and ("--disable-toolbox-glue" not in
-                sysconfig.get_config_var("CONFIG_ARGS")):
-
-            if os.uname()[2] > '8.':
-                # We're on Mac OS X 10.4 or later, the compiler should
-                # support '-Wno-deprecated-declarations'. This will
-                # surpress deprecation warnings for the Carbon extensions,
-                # these extensions wrap the Carbon APIs and even those
-                # parts that are deprecated.
-                carbon_extra_compile_args = ['-Wno-deprecated-declarations']
-            else:
-                carbon_extra_compile_args = []
-
-            # Mac OS X specific modules.
-            def macSrcExists(name1, name2=''):
-                if not name1:
-                    return None
-                names = (name1,)
-                if name2:
-                    names = (name1, name2)
-                path = os.path.join(srcdir, 'Mac', 'Modules', *names)
-                return os.path.exists(path)
-
-            def addMacExtension(name, kwds, extra_srcs=[]):
-                dirname = ''
-                if name[0] == '_':
-                    dirname = name[1:].lower()
-                cname = name + '.c'
-                cmodulename = name + 'module.c'
-                # Check for NNN.c, NNNmodule.c, _nnn/NNN.c, _nnn/NNNmodule.c
-                if macSrcExists(cname):
-                    srcs = [cname]
-                elif macSrcExists(cmodulename):
-                    srcs = [cmodulename]
-                elif macSrcExists(dirname, cname):
-                    # XXX(nnorwitz): If all the names ended with module, we
-                    # wouldn't need this condition.  ibcarbon is the only one.
-                    srcs = [os.path.join(dirname, cname)]
-                elif macSrcExists(dirname, cmodulename):
-                    srcs = [os.path.join(dirname, cmodulename)]
-                else:
-                    raise RuntimeError("%s not found" % name)
-
-                # Here's the whole point:  add the extension with sources
-                exts.append(Extension(name, srcs + extra_srcs, **kwds))
-
-            # Core Foundation
-            core_kwds = {'extra_compile_args': carbon_extra_compile_args,
-                         'extra_link_args': ['-framework', 'CoreFoundation'],
-                        }
-            addMacExtension('_CF', core_kwds, ['cf/pycfbridge.c'])
-            addMacExtension('autoGIL', core_kwds)
-
-            # Carbon
-            carbon_kwds = {'extra_compile_args': carbon_extra_compile_args,
-                           'extra_link_args': ['-framework', 'Carbon'],
-                          }
-            CARBON_EXTS = ['ColorPicker', 'gestalt', 'MacOS', 'Nav',
-                           'OSATerminology', 'icglue',
-                           # All these are in subdirs
-                           '_AE', '_AH', '_App', '_CarbonEvt', '_Cm', '_Ctl',
-                           '_Dlg', '_Drag', '_Evt', '_File', '_Folder', '_Fm',
-                           '_Help', '_Icn', '_IBCarbon', '_List',
-                           '_Menu', '_Mlte', '_OSA', '_Res', '_Qd', '_Qdoffs',
-                           '_Scrap', '_Snd', '_TE', '_Win',
-                          ]
-            for name in CARBON_EXTS:
-                addMacExtension(name, carbon_kwds)
-
-            # Application Services & QuickTime
-            app_kwds = {'extra_compile_args': carbon_extra_compile_args,
-                        'extra_link_args': ['-framework','ApplicationServices'],
-                       }
-            addMacExtension('_Launch', app_kwds)
-            addMacExtension('_CG', app_kwds)
-
-            exts.append( Extension('_Qt', ['qt/_Qtmodule.c'],
-                        extra_compile_args=carbon_extra_compile_args,
-                        extra_link_args=['-framework', 'QuickTime',
-                                     '-framework', 'Carbon']) )
-
-
         self.extensions.extend(exts)
 
         # Call the method for detecting whether _tkinter can be compiled


More information about the Python-3000-checkins mailing list