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 | c817e27 | 1998-08-10 18:40:22 +0000 | [diff] [blame] | 42 | \section{\module{mac} --- |
Fred Drake | 59d8b73 | 1999-02-01 20:19:38 +0000 | [diff] [blame] | 43 | Implementations for the \module{os} module} |
Fred Drake | fe7f3bc | 1998-07-23 17:55:31 +0000 | [diff] [blame] | 44 | |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 45 | \declaremodule{builtin}{mac} |
| 46 | \platform{Mac} |
Fred Drake | 59d8b73 | 1999-02-01 20:19:38 +0000 | [diff] [blame] | 47 | \modulesynopsis{Implementations for the \module{os} module.} |
Fred Drake | fe7f3bc | 1998-07-23 17:55:31 +0000 | [diff] [blame] | 48 | |
Fred Drake | 55fca54 | 1998-02-18 15:21:26 +0000 | [diff] [blame] | 49 | |
Fred Drake | 59d8b73 | 1999-02-01 20:19:38 +0000 | [diff] [blame] | 50 | This module implements the operating system dependent functionality |
| 51 | provided by the standard module \module{os}\refstmodindex{os}. It is |
| 52 | best accessed through the \module{os} module. |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 53 | |
| 54 | The following functions are available in this module: |
Fred Drake | 55fca54 | 1998-02-18 15:21:26 +0000 | [diff] [blame] | 55 | \function{chdir()}, |
| 56 | \function{close()}, |
| 57 | \function{dup()}, |
| 58 | \function{fdopen()}, |
| 59 | \function{getcwd()}, |
| 60 | \function{lseek()}, |
| 61 | \function{listdir()}, |
| 62 | \function{mkdir()}, |
| 63 | \function{open()}, |
| 64 | \function{read()}, |
| 65 | \function{rename()}, |
| 66 | \function{rmdir()}, |
| 67 | \function{stat()}, |
| 68 | \function{sync()}, |
| 69 | \function{unlink()}, |
| 70 | \function{write()}, |
| 71 | as well as the exception \exception{error}. Note that the times |
| 72 | returned by \function{stat()} are floating-point values, like all time |
| 73 | values in MacPython. |
Guido van Rossum | 7e42cab | 1996-10-15 14:37:31 +0000 | [diff] [blame] | 74 | |
Fred Drake | 59d8b73 | 1999-02-01 20:19:38 +0000 | [diff] [blame] | 75 | One additional function is available: |
| 76 | |
| 77 | \begin{funcdesc}{xstat}{path} |
| 78 | This function returns the same information as \function{stat()}, but |
| 79 | with three additional values appended: the size of the resource fork |
| 80 | of the file and its 4-character creator and type. |
| 81 | \end{funcdesc} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 82 | |
Fred Drake | fe7f3bc | 1998-07-23 17:55:31 +0000 | [diff] [blame] | 83 | |
Fred Drake | c817e27 | 1998-08-10 18:40:22 +0000 | [diff] [blame] | 84 | \section{\module{macpath} --- |
Fred Drake | 59d8b73 | 1999-02-01 20:19:38 +0000 | [diff] [blame] | 85 | MacOS path manipulation functions} |
Fred Drake | fe7f3bc | 1998-07-23 17:55:31 +0000 | [diff] [blame] | 86 | |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 87 | \declaremodule{standard}{macpath} |
| 88 | % Could be labeled \platform{Mac}, but the module should work anywhere and |
| 89 | % is distributed with the standard library. |
Fred Drake | fe7f3bc | 1998-07-23 17:55:31 +0000 | [diff] [blame] | 90 | \modulesynopsis{MacOS path manipulation functions.} |
| 91 | |
Fred Drake | 55fca54 | 1998-02-18 15:21:26 +0000 | [diff] [blame] | 92 | |
Fred Drake | 59d8b73 | 1999-02-01 20:19:38 +0000 | [diff] [blame] | 93 | This module is the Macintosh implementation of the \module{os.path} |
Fred Drake | cf282cd | 1999-04-28 14:04:36 +0000 | [diff] [blame^] | 94 | module. It is most portably accessed as |
| 95 | \module{os.path}\refstmodindex{os.path}. Refer to the \emph{Python Library |
| 96 | Reference} for documentation of \module{os.path}. |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 97 | |
| 98 | The following functions are available in this module: |
Fred Drake | 55fca54 | 1998-02-18 15:21:26 +0000 | [diff] [blame] | 99 | \function{normcase()}, |
| 100 | \function{normpath()}, |
| 101 | \function{isabs()}, |
| 102 | \function{join()}, |
| 103 | \function{split()}, |
| 104 | \function{isdir()}, |
| 105 | \function{isfile()}, |
| 106 | \function{walk()}, |
| 107 | \function{exists()}. |
Fred Drake | 59d8b73 | 1999-02-01 20:19:38 +0000 | [diff] [blame] | 108 | For other functions available in \module{os.path} dummy counterparts |
Guido van Rossum | 66774a9 | 1996-07-21 02:20:58 +0000 | [diff] [blame] | 109 | are available. |