OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [insight/] [tcl/] [doc/] [resource.n] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
'\"
2
'\" Copyright (c) 1997 Sun Microsystems, Inc.
3
'\"
4
'\" See the file "license.terms" for information on usage and redistribution
5
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
6
'\" RCS: @(#) $Id: resource.n,v 1.1.1.1 2002-01-16 10:25:25 markom Exp $
7
'\"
8
.so man.macros
9
.TH resource n 8.0 Tcl "Tcl Built-In Commands"
10
.BS
11
'\" Note:  do not modify the .SH NAME line immediately below!
12
.SH NAME
13
resource \- Manipulate Macintosh resources
14
.SH SYNOPSIS
15
\fBresource \fIoption\fR ?\fIarg arg ...\fR?
16
.BE
17
 
18
.SH DESCRIPTION
19
.PP
20
The \fBresource\fR command provides some generic operations for
21
dealing with Macintosh resources.  This command is only supported on
22
the Macintosh platform.  Each Macintosh file consists of two
23
\fIforks\fR: a \fIdata\fR fork and a \fIresource\fR fork.  You use the
24
normal open, puts, close, etc. commands to manipulate the data fork.
25
You must use this command, however, to interact with the resource
26
fork.  \fIOption\fR indicates what resource command to perform.  Any
27
unique abbreviation for \fIoption\fR is acceptable.  The valid options
28
are:
29
.TP
30
\fBresource close \fIrsrcRef\fR
31
Closes the given resource reference (obtained from \fBresource
32
open\fR).  Resources from that resource file will no longer be
33
available.
34
.TP
35
\fBresource delete\fR ?\fIoptions\fR? \fIresourceType\fR
36
This command will delete the resource specified by \fIoptions\fR and
37
type \fIresourceType\fR (see RESOURCE TYPES below).  The options
38
give you several ways to specify the resource to be deleted.
39
.RS
40
.TP
41
\fB\-id\fR \fIresourceId\fR
42
If the \fB-id\fR option is given the id \fIresourceId\fR (see RESOURCE
43
IDS below) is used to specify the resource to be deleted.  The id must
44
be a number - to specify a name use the \fB\-name\fR option.
45
.TP
46
\fB\-name\fR \fIresourceName\fR
47
If \fB-name\fR is specified, the resource named
48
\fIresourceName\fR will be deleted.  If the \fB-id\fR is also
49
provided, then there must be a resource with BOTH this name and
50
this id.  If no name is provided, then the id will be used regardless
51
of the name of the actual resource.
52
.TP
53
\fB\-file\fR \fIresourceRef\fR
54
If the \fB-file\fR option is specified then the resource will be
55
deleted from the file pointed to by \fIresourceRef\fR.  Otherwise the
56
first resource with the given \fIresourceName\fR and or
57
\fIresourceId\fR which is found on the resource file path will be
58
deleted.  To inspect the file path, use the \fIresource files\fB command.
59
.RE
60
.TP
61
\fBresource files ?\fIresourceRef\fR?
62
If \fIresourceRef\fRis not provided, this command returns a Tcl list
63
of the resource references for all the currently open resource files.
64
The list is in the normal Macintosh search order for resources.  If
65
\fIresourceRef\fR is specified, the command will
66
return the path to the file whose resource fork is represented by that
67
token.
68
.TP
69
\fBresource list \fIresourceType\fR ?\fIresourceRef\fR?
70
List all of the resources ids of type \fIresourceType\fR (see RESOURCE
71
TYPES below).  If \fIresourceRef\fR is specified then the command will
72
limit the search to that particular resource file.  Otherwise, all
73
resource files currently opened by the application will be searched.
74
A Tcl list of either the resource name's or resource id's of the found
75
resources will be returned.  See the RESOURCE IDS section below for
76
more details about what a resource id is.
77
.TP
78
\fBresource open \fIfileName\fR ?\fIpermissions\fR?
79
Open the resource for the file \fIfileName\fR.  Standard file
80
permissions may also be specified (see the manual entry for \fBopen\fR
81
for details).  A resource reference (\fIresourceRef\fR) is returned
82
that can be used by the other resource commands.  An error can occur
83
if the file doesn't exist or the file does not have a resource fork.
84
However, if you open the file with write permissions the file and/or
85
resource fork will be created instead of generating an error.
86
.TP
87
\fBresource read \fIresourceType\fR \fIresourceId\fR ?\fIresourceRef\fR?
88
Read the entire resource of type \fIresourceType\fR (see RESOURCE
89
TYPES below) and the name or id of \fIresourceId\fR (see RESOURCE IDS
90
below) into memory and return the result.  If \fIresourceRef\fR is
91
specified we limit our search to that resource file, otherwise we
92
search all open resource forks in the application.  It is important to
93
note that most Macintosh resource use a binary format and the data
94
returned from this command may have embedded NULLs or other non-ASCII
95
data.
96
.TP
97
\fBresource types ?\fIresourceRef\fR?
98
This command returns a Tcl list of all resource types (see RESOURCE
99
TYPES below) found in the resource file pointed to by
100
\fIresourceRef\fR.  If \fIresourceRef\fR is not specified it will
101
return all the resource types found in every resource file currently
102
opened by the application.
103
.TP
104
\fBresource write\fR ?\fIoptions\fR? \fIresourceType\fR \fIdata\fR
105
This command will write the passed in \fIdata\fR as a new resource of
106
type \fIresourceType\fR (see RESOURCE TYPES below).  Several options
107
are available that describe where and how the resource is stored.
108
.RS
109
.TP
110
\fB\-id\fR \fIresourceId\fR
111
If the \fB-id\fR option is given the id \fIresourceId\fR (see RESOURCE
112
IDS below) is used for the new resource, otherwise a unique id will be
113
generated that will not conflict with any existing resource.  However,
114
the id must be a number - to specify a name use the \fB\-name\fR option.
115
.TP
116
\fB\-name\fR \fIresourceName\fR
117
If \fB-name\fR is specified the resource will be named
118
\fIresourceName\fR, otherwise it will have the empty string as the
119
name.
120
.TP
121
\fB\-file\fR \fIresourceRef\fR
122
If the \fB-file\fR option is specified then the resource will be
123
written in the file pointed to by \fIresourceRef\fR, otherwise the
124
most resently open resource will be used.
125
.TP
126
\fB\-force\fR
127
If the target resource already exists, then by default Tcl will not
128
overwrite it, but raise an error instead.  Use the -force flag to
129
force overwriting the extant resource.
130
.RE
131
 
132
.SH "RESOURCE TYPES"
133
Resource types are defined as a four character string that is then
134
mapped to an underlying id.  For example, \fBTEXT\fR refers to the
135
Macintosh resource type for text.  The type \fBSTR#\fR is a list of
136
counted strings.  All Macintosh resources must be of some type.  See
137
Macintosh documentation for a more complete list of resource types
138
that are commonly used.
139
 
140
.SH "RESOURCE IDS"
141
For this command the notion of a resource id actually refers to two
142
ideas in Macintosh resources.  Every place you can use a resource Id
143
you can use either the resource name or a resource number.  Names are
144
always searched or returned in preference to numbers.  For example,
145
the \fBresource list\fR command will return names if they exist or
146
numbers if the name is NULL.
147
 
148
.SH "SEE ALSO"
149
open
150
 
151
.SH "PORTABILITY ISSUES"
152
The resource command is only available on Macintosh.
153
 
154
.SH KEYWORDS
155
open, resource

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.