Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1bd905e

Browse files
committed
Documentation for the aepack and aetypes modules, by Vincent Marchetti
<[email protected]>.
1 parent 8f6ca15 commit 1bd905e

2 files changed

Lines changed: 112 additions & 0 deletions

File tree

Doc/mac/libaepack.tex

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
\section{\module{aepack} ---
2+
Conversion between Python variables and AppleEvent data containers}
3+
4+
\declaremodule{standard}{aepack}
5+
\platform{Mac}
6+
%\moduleauthor{Jack Jansen?}{email}
7+
\modulesynopsis{Conversion between Python variables and AppleEvent
8+
data containers.}
9+
\sectionauthor{Vincent Marchetti}{[email protected]}
10+
11+
12+
The \module{aepack} module defines functions for converting (packing)
13+
Python variables to AppleEvent descriptors and back (unpacking).
14+
Within Python the AppleEvent descriptor is handled by Python objects
15+
of built-in type \pytype{AEDesc}, defined in module \refmodule{AE}.
16+
17+
The \module{aepack} module defines the following functions:
18+
19+
20+
\begin{funcdesc}{pack}{x\optional{, forcetype}}
21+
Returns an \class{AEDesc} object containing a conversion of Python
22+
value x. If \var{forcetype} is provided it specifies the descriptor
23+
type of the result. Otherwise, a default mapping of Python types to
24+
Apple Event descriptor types is used, as follows:
25+
26+
\begin{tableii}{l|l}{textrm}{Python type}{descriptor type}
27+
\lineii{\class{FSSpec}}{typeFSS}
28+
\lineii{\class{Alias}}{typeAlias}
29+
\lineii{integer}{typeLong (32 bit integer)}
30+
\lineii{float}{typeFloat (64 bit floating point)}
31+
\lineii{string}{typeText}
32+
\lineii{list}{typeAEList}
33+
\lineii{dictionary}{typeAERecord}
34+
\lineii{instance}{\emph{see below}}
35+
\end{tableii}
36+
37+
\pytype{FSSpec} and \pytype{Alias} are built-in object types defined
38+
in the module \refmodule{macfs}.
39+
40+
If \var{x} is a Python instance then this function attempts to call an
41+
\method{__aepack__()} method. This method should return an
42+
\pytype{AE.AEDesc} object.
43+
44+
If the conversion \var{x} is not defined above, this function returns
45+
the Python string representation of a value (the repr() function)
46+
encoded as a text descriptor.
47+
\end{funcdesc}
48+
49+
\begin{funcdesc}{unpack}{x}
50+
\var{x} must be an object of type \class{AEDesc}. This function
51+
returns a Python object representation of the data in the Apple
52+
Event descriptor \var{x}. Simple AppleEvent data types (integer,
53+
text, float) are returned as their obvious Python counterparts.
54+
Apple Event lists are returned as Python lists, and the list
55+
elements are recursively unpacked. Object references
56+
(ex. \code{line 3 of document 1}) are returned as instances of
57+
\class{aetypes.ObjectSpecifier}. AppleEvent descriptors with
58+
descriptor type typeFSS are returned as \class{FSSpec}
59+
objects. AppleEvent record descriptors are returned as Python
60+
dictionaries, with keys of type \class{?} and elements recursively
61+
unpacked.
62+
\end{funcdesc}
63+
64+
65+
\begin{seealso}
66+
\seemodule{AE}{Built-in access to Apple Event Manager routines.}
67+
\seemodule{aetypes}{Python definitions of codes for Apple Event
68+
descriptor types.}
69+
\seetitle[http://developer.apple.com/techpubs/mac/IAC/IAC-2.html]{
70+
Inside Macintosh: Interapplication
71+
Communication}{Information about inter-process
72+
communications on the Macintosh.}
73+
\end{seealso}

Doc/mac/libaetypes.tex

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
\section{\module{aetypes} ---
2+
AppleEvent objects}
3+
4+
\declaremodule{standard}{aetypes}
5+
\platform{Mac}
6+
%\moduleauthor{Jack Jansen?}{email}
7+
\modulesynopsis{Python representation of the Apple Event Object Model.}
8+
\sectionauthor{Vincent Marchetti}{[email protected]}
9+
10+
11+
The \module{aetypes} defines classes used to represent Apple Event
12+
object specifiers. An object specifier is essentially an address of an
13+
object implemented in a Apple Event server. An Apple Event specifier
14+
is used as the direct object for an Apple Event or as the argument of
15+
an optional parameter. In AppleScript an object specifier is
16+
represented by a phrase such as:
17+
\code{character 23 of document "Semprini"}. The classes defined in
18+
this module allow this specifier to be represented by a Python object
19+
which is initialized as follows:
20+
\code{res = Document(1).Character(23)}
21+
22+
23+
The \module{AEObjects} module defines the following class:
24+
25+
\begin{classdesc}{ObjectSpecifier}{want, form, seld, from}
26+
This is the base class for representing object specifiers and is
27+
generally not constructed directly by the user. Its important
28+
functionality is to define an \function{__aepack__()} function,
29+
which returns the Apple Event descriptor containing the object
30+
specifier. Its data members, set directly from the constructor
31+
arguments, are:
32+
\end{classdesc}
33+
34+
\begin{memberdesc}{want}
35+
A four character string representing the class code of the
36+
object. These class codes are specified in Apple Event Suites; for
37+
example the standard code for a character object is the 4 bytes
38+
\samp{char}.
39+
\end{memberdesc}

0 commit comments

Comments
 (0)