Fred Drake | a2890b0 | 1998-04-17 20:07:21 +0000 | [diff] [blame] | 1 | \section{Introduction} |
| 2 | \label{intro} |
| 3 | |
Fred Drake | b51429a | 1998-04-17 02:46:34 +0000 | [diff] [blame] | 4 | The modules in this manual are available on the Apple Macintosh only. |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 5 | |
Guido van Rossum | 66774a9 | 1996-07-21 02:20:58 +0000 | [diff] [blame] | 6 | Aside from the modules described here there are also interfaces to |
| 7 | various MacOS toolboxes, which are currently not extensively |
| 8 | described. The toolboxes for which modules exist are: |
Fred Drake | 55fca54 | 1998-02-18 15:21:26 +0000 | [diff] [blame] | 9 | \module{AE} (Apple Events), |
| 10 | \module{Cm} (Component Manager), |
| 11 | \module{Ctl} (Control Manager), |
| 12 | \module{Dlg} (Dialog Manager), |
| 13 | \module{Evt} (Event Manager), |
| 14 | \module{Fm} (Font Manager), |
| 15 | \module{List} (List Manager), |
| 16 | \module{Menu} (Moenu Manager), |
| 17 | \module{Qd} (QuickDraw), |
| 18 | \module{Qt} (QuickTime), |
| 19 | \module{Res} (Resource Manager and Handles), |
| 20 | \module{Scrap} (Scrap Manager), |
| 21 | \module{Snd} (Sound Manager), |
| 22 | \module{TE} (TextEdit), |
| 23 | \module{Waste} (non-Apple \program{TextEdit} replacement) and |
| 24 | \module{Win} (Window Manager). |
Guido van Rossum | 66774a9 | 1996-07-21 02:20:58 +0000 | [diff] [blame] | 25 | |
| 26 | If applicable the module will define a number of Python objects for |
| 27 | the various structures declared by the toolbox, and operations will be |
| 28 | implemented as methods of the object. Other operations will be |
| 29 | implemented as functions in the module. Not all operations possible in |
Fred Drake | af9b6e6 | 1998-02-19 19:45:19 +0000 | [diff] [blame] | 30 | \C{} will also be possible in Python (callbacks are often a problem), and |
Guido van Rossum | 66774a9 | 1996-07-21 02:20:58 +0000 | [diff] [blame] | 31 | parameters will occasionally be different in Python (input and output |
| 32 | buffers, especially). All methods and functions have a \code{__doc__} |
| 33 | string describing their arguments and return values, and for |
Fred Drake | af9b6e6 | 1998-02-19 19:45:19 +0000 | [diff] [blame] | 34 | additional description you are referred to \emph{Inside Macintosh} or |
| 35 | similar works. |
| 36 | |
| 37 | The following modules are documented here: |
| 38 | |
Fred Drake | fe7f3bc | 1998-07-23 17:55:31 +0000 | [diff] [blame^] | 39 | \localmoduletable |
Fred Drake | af9b6e6 | 1998-02-19 19:45:19 +0000 | [diff] [blame] | 40 | |
Guido van Rossum | 66774a9 | 1996-07-21 02:20:58 +0000 | [diff] [blame] | 41 | |
Fred Drake | 3a0351c | 1998-04-04 07:23:21 +0000 | [diff] [blame] | 42 | \section{Built-in Module \module{mac}} |
Fred Drake | fe7f3bc | 1998-07-23 17:55:31 +0000 | [diff] [blame^] | 43 | \declaremodule{builtin}{mac} |
| 44 | |
| 45 | \modulesynopsis{Similar interfaces to the \module{posix} module.} |
| 46 | |
Fred Drake | 55fca54 | 1998-02-18 15:21:26 +0000 | [diff] [blame] | 47 | |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 48 | This module provides a subset of the operating system dependent |
Fred Drake | 55fca54 | 1998-02-18 15:21:26 +0000 | [diff] [blame] | 49 | functionality provided by the optional built-in module \module{posix}. |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 50 | It is best accessed through the more portable standard module |
Fred Drake | 55fca54 | 1998-02-18 15:21:26 +0000 | [diff] [blame] | 51 | \module{os}. |
Fred Drake | 8a528bd | 1997-12-15 21:40:15 +0000 | [diff] [blame] | 52 | \refbimodindex{posix} |
| 53 | \refstmodindex{os} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 54 | |
| 55 | The following functions are available in this module: |
Fred Drake | 55fca54 | 1998-02-18 15:21:26 +0000 | [diff] [blame] | 56 | \function{chdir()}, |
| 57 | \function{close()}, |
| 58 | \function{dup()}, |
| 59 | \function{fdopen()}, |
| 60 | \function{getcwd()}, |
| 61 | \function{lseek()}, |
| 62 | \function{listdir()}, |
| 63 | \function{mkdir()}, |
| 64 | \function{open()}, |
| 65 | \function{read()}, |
| 66 | \function{rename()}, |
| 67 | \function{rmdir()}, |
| 68 | \function{stat()}, |
| 69 | \function{sync()}, |
| 70 | \function{unlink()}, |
| 71 | \function{write()}, |
| 72 | as well as the exception \exception{error}. Note that the times |
| 73 | returned by \function{stat()} are floating-point values, like all time |
| 74 | values in MacPython. |
Guido van Rossum | 7e42cab | 1996-10-15 14:37:31 +0000 | [diff] [blame] | 75 | |
Fred Drake | 55fca54 | 1998-02-18 15:21:26 +0000 | [diff] [blame] | 76 | One additional function is available: \function{xstat()}. This function |
| 77 | returns the same information as \function{stat()}, but with three extra |
Guido van Rossum | 7e42cab | 1996-10-15 14:37:31 +0000 | [diff] [blame] | 78 | values appended: the size of the resource fork of the file and its |
Fred Drake | b51429a | 1998-04-17 02:46:34 +0000 | [diff] [blame] | 79 | 4-character creator and type. |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 80 | |
Fred Drake | fe7f3bc | 1998-07-23 17:55:31 +0000 | [diff] [blame^] | 81 | |
Fred Drake | 3a0351c | 1998-04-04 07:23:21 +0000 | [diff] [blame] | 82 | \section{Standard Module \module{macpath}} |
Fred Drake | fe7f3bc | 1998-07-23 17:55:31 +0000 | [diff] [blame^] | 83 | \declaremodule{standard}{macpath} |
| 84 | |
| 85 | \modulesynopsis{MacOS path manipulation functions.} |
| 86 | |
Fred Drake | 55fca54 | 1998-02-18 15:21:26 +0000 | [diff] [blame] | 87 | |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 88 | This module provides a subset of the pathname manipulation functions |
Fred Drake | 55fca54 | 1998-02-18 15:21:26 +0000 | [diff] [blame] | 89 | available from the optional standard module \module{posixpath}. It is |
| 90 | best accessed through the more portable standard module \module{os}, as |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 91 | \code{os.path}. |
Fred Drake | 8a528bd | 1997-12-15 21:40:15 +0000 | [diff] [blame] | 92 | \refstmodindex{posixpath} |
| 93 | \refstmodindex{os} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 94 | |
| 95 | The following functions are available in this module: |
Fred Drake | 55fca54 | 1998-02-18 15:21:26 +0000 | [diff] [blame] | 96 | \function{normcase()}, |
| 97 | \function{normpath()}, |
| 98 | \function{isabs()}, |
| 99 | \function{join()}, |
| 100 | \function{split()}, |
| 101 | \function{isdir()}, |
| 102 | \function{isfile()}, |
| 103 | \function{walk()}, |
| 104 | \function{exists()}. |
| 105 | For other functions available in \module{posixpath} dummy counterparts |
Guido van Rossum | 66774a9 | 1996-07-21 02:20:58 +0000 | [diff] [blame] | 106 | are available. |