resource.n
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:7k
- '"
- '" Copyright (c) 1997 Sun Microsystems, Inc.
- '"
- '" See the file "license.terms" for information on usage and redistribution
- '" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- '" RCS: @(#) $Id: resource.n,v 1.7 2002/07/01 18:24:39 jenglish Exp $
- '"
- .so man.macros
- .TH resource n 8.0 Tcl "Tcl Built-In Commands"
- .BS
- '" Note: do not modify the .SH NAME line immediately below!
- .SH NAME
- resource - Manipulate Macintosh resources
- .SH SYNOPSIS
- fBresource fIoptionfR ?fIarg arg ...fR?
- .BE
- .SH DESCRIPTION
- .PP
- The fBresourcefR command provides some generic operations for
- dealing with Macintosh resources. This command is only supported on
- the Macintosh platform. Each Macintosh file consists of two
- fIforksfR: a fIdatafR fork and a fIresourcefR fork. You use the
- normal open, puts, close, etc. commands to manipulate the data fork.
- You must use this command, however, to interact with the resource
- fork. fIOptionfR indicates what resource command to perform. Any
- unique abbreviation for fIoptionfR is acceptable. The valid options
- are:
- .TP
- fBresource close fIrsrcReffR
- Closes the given resource reference (obtained from fBresource
- openfR). Resources from that resource file will no longer be
- available.
- .TP
- fBresource deletefR ?fIoptionsfR? fIresourceTypefR
- This command will delete the resource specified by fIoptionsfR and
- type fIresourceTypefR (see RESOURCE TYPES below). The options
- give you several ways to specify the resource to be deleted.
- .RS
- .TP
- fB-idfR fIresourceIdfR
- If the fB-idfR option is given the id fIresourceIdfR (see RESOURCE
- IDS below) is used to specify the resource to be deleted. The id must
- be a number - to specify a name use the fB-namefR option.
- .TP
- fB-namefR fIresourceNamefR
- If fB-namefR is specified, the resource named
- fIresourceNamefR will be deleted. If the fB-idfR is also
- provided, then there must be a resource with BOTH this name and
- this id. If no name is provided, then the id will be used regardless
- of the name of the actual resource.
- .TP
- fB-filefR fIresourceReffR
- If the fB-filefR option is specified then the resource will be
- deleted from the file pointed to by fIresourceReffR. Otherwise the
- first resource with the given fIresourceNamefR and or
- fIresourceIdfR which is found on the resource file path will be
- deleted. To inspect the file path, use the fIresource filesfR command.
- .RE
- .TP
- fBresource files ?fIresourceReffR?
- If fIresourceReffRis not provided, this command returns a Tcl list
- of the resource references for all the currently open resource files.
- The list is in the normal Macintosh search order for resources. If
- fIresourceReffR is specified, the command will
- return the path to the file whose resource fork is represented by that
- token.
- .TP
- fBresource list fIresourceTypefR ?fIresourceReffR?
- List all of the resources ids of type fIresourceTypefR (see RESOURCE
- TYPES below). If fIresourceReffR is specified then the command will
- limit the search to that particular resource file. Otherwise, all
- resource files currently opened by the application will be searched.
- A Tcl list of either the resource name's or resource id's of the found
- resources will be returned. See the RESOURCE IDS section below for
- more details about what a resource id is.
- .TP
- fBresource open fIfileNamefR ?fIaccessfR?
- Open the resource for the file fIfileNamefR. Standard file access
- permissions may also be specified (see the manual entry for fBopenfR
- for details). A resource reference (fIresourceReffR) is returned
- that can be used by the other resource commands. An error can occur
- if the file doesn't exist or the file does not have a resource fork.
- However, if you open the file with write permissions the file and/or
- resource fork will be created instead of generating an error.
- .TP
- fBresource read fIresourceTypefR fIresourceIdfR ?fIresourceReffR?
- Read the entire resource of type fIresourceTypefR (see RESOURCE
- TYPES below) and the name or id of fIresourceIdfR (see RESOURCE IDS
- below) into memory and return the result. If fIresourceReffR is
- specified we limit our search to that resource file, otherwise we
- search all open resource forks in the application. It is important to
- note that most Macintosh resource use a binary format and the data
- returned from this command may have embedded NULLs or other non-ASCII
- data.
- .TP
- fBresource types ?fIresourceReffR?
- This command returns a Tcl list of all resource types (see RESOURCE
- TYPES below) found in the resource file pointed to by
- fIresourceReffR. If fIresourceReffR is not specified it will
- return all the resource types found in every resource file currently
- opened by the application.
- .TP
- fBresource writefR ?fIoptionsfR? fIresourceTypefR fIdatafR
- This command will write the passed in fIdatafR as a new resource of
- type fIresourceTypefR (see RESOURCE TYPES below). Several options
- are available that describe where and how the resource is stored.
- .RS
- .TP
- fB-idfR fIresourceIdfR
- If the fB-idfR option is given the id fIresourceIdfR (see RESOURCE
- IDS below) is used for the new resource, otherwise a unique id will be
- generated that will not conflict with any existing resource. However,
- the id must be a number - to specify a name use the fB-namefR option.
- .TP
- fB-namefR fIresourceNamefR
- If fB-namefR is specified the resource will be named
- fIresourceNamefR, otherwise it will have the empty string as the
- name.
- .TP
- fB-filefR fIresourceReffR
- If the fB-filefR option is specified then the resource will be
- written in the file pointed to by fIresourceReffR, otherwise the
- most recently open resource will be used.
- .TP
- fB-forcefR
- If the target resource already exists, then by default Tcl will not
- overwrite it, but raise an error instead. Use the -force flag to
- force overwriting the extant resource.
- .RE
- .SH "RESOURCE TYPES"
- Resource types are defined as a four character string that is then
- mapped to an underlying id. For example, fBTEXTfR refers to the
- Macintosh resource type for text. The type fBSTR#fR is a list of
- counted strings. All Macintosh resources must be of some type. See
- Macintosh documentation for a more complete list of resource types
- that are commonly used.
- .SH "RESOURCE IDS"
- For this command the notion of a resource id actually refers to two
- ideas in Macintosh resources. Every place you can use a resource Id
- you can use either the resource name or a resource number. Names are
- always searched or returned in preference to numbers. For example,
- the fBresource listfR command will return names if they exist or
- numbers if the name is NULL.
- .SH "PORTABILITY ISSUES"
- The resource command is only available on Macintosh.
- .SH "SEE ALSO"
- open(n)
- .SH KEYWORDS
- open, resource