1998-08-10 15:40:22 -03:00
|
|
|
\section{\module{ic} ---
|
1999-03-02 12:37:17 -04:00
|
|
|
Access to Internet Config}
|
1998-07-23 14:55:31 -03:00
|
|
|
|
1999-03-02 12:37:17 -04:00
|
|
|
\declaremodule{builtin}{ic}
|
|
|
|
\platform{Mac}
|
1998-08-07 14:37:15 -03:00
|
|
|
\modulesynopsis{Access to Internet Config.}
|
1998-07-23 14:55:31 -03:00
|
|
|
|
1997-08-18 12:14:26 -03:00
|
|
|
|
1999-03-04 15:00:26 -04:00
|
|
|
This module provides access to Macintosh Internet
|
|
|
|
Config\index{Internet Config} package,
|
1997-08-18 12:14:26 -03:00
|
|
|
which stores preferences for Internet programs such as mail address,
|
|
|
|
default homepage, etc. Also, Internet Config contains an elaborate set
|
|
|
|
of mappings from Macintosh creator/type codes to foreign filename
|
|
|
|
extensions plus information on how to transfer files (binary, ascii,
|
2000-10-14 01:45:22 -03:00
|
|
|
etc.). Since MacOS 9, this module is a control panel named Internet.
|
1997-08-18 12:14:26 -03:00
|
|
|
|
1998-03-14 18:22:14 -04:00
|
|
|
There is a low-level companion module
|
|
|
|
\module{icglue}\refbimodindex{icglue} which provides the basic
|
|
|
|
Internet Config access functionality. This low-level module is not
|
1997-08-18 12:14:26 -03:00
|
|
|
documented, but the docstrings of the routines document the parameters
|
1998-03-14 18:22:14 -04:00
|
|
|
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
|
1997-08-18 12:14:26 -03:00
|
|
|
used if this module is needed.
|
|
|
|
|
1998-03-14 18:22:14 -04:00
|
|
|
The \module{ic} module defines the \exception{error} exception and
|
|
|
|
symbolic names for all error codes Internet Config can produce; see
|
|
|
|
the source for details.
|
1997-08-18 12:14:26 -03:00
|
|
|
|
1998-03-14 18:22:14 -04:00
|
|
|
\begin{excdesc}{error}
|
|
|
|
Exception raised on errors in the \module{ic} module.
|
|
|
|
\end{excdesc}
|
1997-08-18 12:14:26 -03:00
|
|
|
|
1998-03-14 18:22:14 -04:00
|
|
|
|
1998-04-07 19:01:33 -03:00
|
|
|
The \module{ic} module defines the following class and function:
|
1998-03-14 18:22:14 -04:00
|
|
|
|
1998-04-07 19:01:33 -03:00
|
|
|
\begin{classdesc}{IC}{\optional{signature\optional{, ic}}}
|
1998-04-04 02:23:02 -04:00
|
|
|
Create an internet config object. The signature is a 4-character creator
|
1997-08-18 12:14:26 -03:00
|
|
|
code of the current application (default \code{'Pyth'}) which may
|
|
|
|
influence some of ICs settings. The optional \var{ic} argument is a
|
1998-03-14 18:22:14 -04:00
|
|
|
low-level \code{icglue.icinstance} created beforehand, this may be
|
|
|
|
useful if you want to get preferences from a different config file,
|
|
|
|
etc.
|
1998-04-07 19:01:33 -03:00
|
|
|
\end{classdesc}
|
1997-08-18 12:14:26 -03:00
|
|
|
|
1998-03-14 18:22:14 -04:00
|
|
|
\begin{funcdesc}{launchurl}{url\optional{, hint}}
|
|
|
|
\funcline{parseurl}{data\optional{, start\optional{, end\optional{, hint}}}}
|
|
|
|
\funcline{mapfile}{file}
|
|
|
|
\funcline{maptypecreator}{type, creator\optional{, filename}}
|
|
|
|
\funcline{settypecreator}{file}
|
1997-08-18 12:14:26 -03:00
|
|
|
These functions are ``shortcuts'' to the methods of the same name,
|
|
|
|
described below.
|
|
|
|
\end{funcdesc}
|
|
|
|
|
|
|
|
|
1998-04-07 19:01:33 -03:00
|
|
|
\subsection{IC Objects}
|
1997-08-18 12:14:26 -03:00
|
|
|
|
1998-04-07 19:01:33 -03:00
|
|
|
\class{IC} objects have a mapping interface, hence to obtain the mail
|
|
|
|
address you simply get \code{\var{ic}['MailAddress']}. Assignment also
|
|
|
|
works, and changes the option in the configuration file.
|
1997-08-18 12:14:26 -03:00
|
|
|
|
|
|
|
The module knows about various datatypes, and converts the internal IC
|
1998-04-07 19:01:33 -03:00
|
|
|
representation to a ``logical'' Python data structure. Running the
|
1998-03-14 18:22:14 -04:00
|
|
|
\module{ic} module standalone will run a test program that lists all
|
2000-10-14 01:45:22 -03:00
|
|
|
keys and values in your IC database, this will have to serve as
|
1997-08-18 12:14:26 -03:00
|
|
|
documentation.
|
|
|
|
|
|
|
|
If the module does not know how to represent the data it returns an
|
1998-03-14 18:22:14 -04:00
|
|
|
instance of the \code{ICOpaqueData} type, with the raw data in its
|
1998-04-04 02:23:02 -04:00
|
|
|
\member{data} attribute. Objects of this type are also acceptable values
|
1997-08-18 12:14:26 -03:00
|
|
|
for assignment.
|
|
|
|
|
1998-04-07 19:01:33 -03:00
|
|
|
Besides the dictionary interface, \class{IC} objects have the
|
|
|
|
following methods:
|
1997-08-18 12:14:26 -03:00
|
|
|
|
|
|
|
|
1998-04-07 19:01:33 -03:00
|
|
|
\begin{methoddesc}{launchurl}{url\optional{, hint}}
|
1997-08-18 12:14:26 -03:00
|
|
|
Parse the given URL, lauch the correct application and pass it the
|
|
|
|
URL. The optional \var{hint} can be a scheme name such as
|
1998-03-14 18:22:14 -04:00
|
|
|
\code{'mailto:'}, in which case incomplete URLs are completed with this
|
|
|
|
scheme. If \var{hint} is not provided, incomplete URLs are invalid.
|
1998-04-07 19:01:33 -03:00
|
|
|
\end{methoddesc}
|
1997-08-18 12:14:26 -03:00
|
|
|
|
1998-04-07 19:01:33 -03:00
|
|
|
\begin{methoddesc}{parseurl}{data\optional{, start\optional{, end\optional{, hint}}}}
|
1997-08-18 12:14:26 -03:00
|
|
|
Find an URL somewhere in \var{data} and return start position, end
|
|
|
|
position and the URL. The optional \var{start} and \var{end} can be
|
|
|
|
used to limit the search, so for instance if a user clicks in a long
|
2000-10-14 01:45:22 -03:00
|
|
|
text field you can pass the whole text field and the click-position in
|
1997-08-18 12:14:26 -03:00
|
|
|
\var{start} and this routine will return the whole URL in which the
|
1998-04-04 02:23:02 -04:00
|
|
|
user clicked. As above, \var{hint} is an optional scheme used to
|
|
|
|
complete incomplete URLs.
|
1998-04-07 19:01:33 -03:00
|
|
|
\end{methoddesc}
|
1997-08-18 12:14:26 -03:00
|
|
|
|
1998-04-07 19:01:33 -03:00
|
|
|
\begin{methoddesc}{mapfile}{file}
|
1997-08-18 12:14:26 -03:00
|
|
|
Return the mapping entry for the given \var{file}, which can be passed
|
1998-04-04 02:23:02 -04:00
|
|
|
as either a filename or an \function{macfs.FSSpec()} result, and which
|
|
|
|
need not exist.
|
1997-08-18 12:14:26 -03:00
|
|
|
|
1999-03-02 12:37:17 -04:00
|
|
|
The mapping entry is returned as a tuple \code{(\var{version},
|
1997-12-29 14:53:31 -04:00
|
|
|
\var{type}, \var{creator}, \var{postcreator}, \var{flags},
|
|
|
|
\var{extension}, \var{appname}, \var{postappname}, \var{mimetype},
|
1999-03-02 12:37:17 -04:00
|
|
|
\var{entryname})}, where \var{version} is the entry version
|
1998-04-04 02:23:02 -04:00
|
|
|
number, \var{type} is the 4-character filetype, \var{creator} is the
|
|
|
|
4-character creator type, \var{postcreator} is the 4-character creator
|
|
|
|
code of an
|
1997-08-18 12:14:26 -03:00
|
|
|
optional application to post-process the file after downloading,
|
|
|
|
\var{flags} are various bits specifying whether to transfer in binary
|
|
|
|
or ascii and such, \var{extension} is the filename extension for this
|
|
|
|
file type, \var{appname} is the printable name of the application to
|
|
|
|
which this file belongs, \var{postappname} is the name of the
|
|
|
|
postprocessing application, \var{mimetype} is the MIME type of this
|
|
|
|
file and \var{entryname} is the name of this entry.
|
1998-04-07 19:01:33 -03:00
|
|
|
\end{methoddesc}
|
1997-08-18 12:14:26 -03:00
|
|
|
|
1998-04-07 19:01:33 -03:00
|
|
|
\begin{methoddesc}{maptypecreator}{type, creator\optional{, filename}}
|
1998-04-04 02:23:02 -04:00
|
|
|
Return the mapping entry for files with given 4-character \var{type} and
|
1997-08-18 12:14:26 -03:00
|
|
|
\var{creator} codes. The optional \var{filename} may be specified to
|
|
|
|
further help finding the correct entry (if the creator code is
|
|
|
|
\code{'????'}, for instance).
|
|
|
|
|
|
|
|
The mapping entry is returned in the same format as for \var{mapfile}.
|
1998-04-07 19:01:33 -03:00
|
|
|
\end{methoddesc}
|
1997-08-18 12:14:26 -03:00
|
|
|
|
1998-04-07 19:01:33 -03:00
|
|
|
\begin{methoddesc}{settypecreator}{file}
|
1997-08-18 12:14:26 -03:00
|
|
|
Given an existing \var{file}, specified either as a filename or as an
|
1998-04-04 02:23:02 -04:00
|
|
|
\function{macfs.FSSpec()} result, set its creator and type correctly based
|
1998-03-14 18:22:14 -04:00
|
|
|
on its extension. The finder is told about the change, so the finder
|
|
|
|
icon will be updated quickly.
|
1998-04-07 19:01:33 -03:00
|
|
|
\end{methoddesc}
|