'\" '\" 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.2 2003/11/24 05:09:59 bbbush Exp $ '\" '\" The definitions below are for supplemental macros used in Tcl/Tk '\" manual entries. '\" '\" .AP type name in/out ?indent? '\" Start paragraph describing an argument to a library procedure. '\" type is type of argument (int, etc.), in/out is either "in", "out", '\" or "in/out" to describe whether procedure reads or modifies arg, '\" and indent is equivalent to second arg of .IP (shouldn't ever be '\" needed; use .AS below instead) '\" '\" .AS ?type? ?name? '\" Give maximum sizes of arguments for setting tab stops. Type and '\" name are examples of largest possible arguments that will be passed '\" to .AP later. If args are omitted, default tab stops are used. '\" '\" .BS '\" Start box enclosure. From here until next .BE, everything will be '\" enclosed in one large box. '\" '\" .BE '\" End of box enclosure. '\" '\" .CS '\" Begin code excerpt. '\" '\" .CE '\" End code excerpt. '\" '\" .VS ?version? ?br? '\" Begin vertical sidebar, for use in marking newly-changed parts '\" of man pages. The first argument is ignored and used for recording '\" the version when the .VS was added, so that the sidebars can be '\" found and removed when they reach a certain age. If another argument '\" is present, then a line break is forced before starting the sidebar. '\" '\" .VE '\" End of vertical sidebar. '\" '\" .DS '\" Begin an indented unfilled display. '\" '\" .DE '\" End of indented unfilled display. '\" '\" .SO '\" Start of list of standard options for a Tk widget. The '\" options follow on successive lines, in four columns separated '\" by tabs. '\" '\" .SE '\" End of list of standard options for a Tk widget. '\" '\" .OP cmdName dbName dbClass '\" Start of description of a specific option. cmdName gives the '\" option's name as specified in the class command, dbName gives '\" the option's name in the option database, and dbClass gives '\" the option's class in the option database. '\" '\" .UL arg1 arg2 '\" Print arg1 underlined, then print arg2 normally. '\" '\" RCS: @(#) $Id: resource.n,v 1.2 2003/11/24 05:09:59 bbbush Exp $ '\" '\" # Set up traps and other miscellaneous stuff for Tcl/Tk man pages. .if t .wh -1.3i ^B .nr ^l \n(.l .ad b '\" # Start an argument description .de AP .ie !"\\$4"" .TP \\$4 .el \{\ . ie !"\\$2"" .TP \\n()Cu . el .TP 15 .\} .ta \\n()Au \\n()Bu .ie !"\\$3"" \{\ \&\\$1 \\fI\\$2\\fP (\\$3) .\".b .\} .el \{\ .br .ie !"\\$2"" \{\ \&\\$1 \\fI\\$2\\fP .\} .el \{\ \&\\fI\\$1\\fP .\} .\} .. '\" # define tabbing values for .AP .de AS .nr )A 10n .if !"\\$1"" .nr )A \\w'\\$1'u+3n .nr )B \\n()Au+15n .\" .if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n .nr )C \\n()Bu+\\w'(in/out)'u+2n .. .AS Tcl_Interp Tcl_CreateInterp in/out '\" # BS - start boxed text '\" # ^y = starting y location '\" # ^b = 1 .de BS .br .mk ^y .nr ^b 1u .if n .nf .if n .ti 0 .if n \l'\\n(.lu\(ul' .if n .fi .. '\" # BE - end boxed text (draw box now) .de BE .nf .ti 0 .mk ^t .ie n \l'\\n(^lu\(ul' .el \{\ .\" Draw four-sided box normally, but don't draw top of .\" box if the box started on an earlier page. .ie !\\n(^b-1 \{\ \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' .\} .el \}\ \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' .\} .\} .fi .br .nr ^b 0 .. '\" # VS - start vertical sidebar '\" # ^Y = starting y location '\" # ^v = 1 (for troff; for nroff this doesn't matter) .de VS .if !"\\$2"" .br .mk ^Y .ie n 'mc \s12\(br\s0 .el .nr ^v 1u .. '\" # VE - end of vertical sidebar .de VE .ie n 'mc .el \{\ .ev 2 .nf .ti 0 .mk ^t \h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n' .sp -1 .fi .ev .\} .nr ^v 0 .. '\" # Special macro to handle page bottom: finish off current '\" # box/sidebar if in box/sidebar mode, then invoked standard '\" # page bottom macro. .de ^B .ev 2 'ti 0 'nf .mk ^t .if \\n(^b \{\ .\" Draw three-sided box if this is the box's first page, .\" draw two sides but no top otherwise. .ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c .el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c .\} .if \\n(^v \{\ .nr ^x \\n(^tu+1v-\\n(^Yu \kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c .\} .bp 'fi .ev .if \\n(^b \{\ .mk ^y .nr ^b 2 .\} .if \\n(^v \{\ .mk ^Y .\} .. '\" # DS - begin display .de DS .RS .nf .sp .. '\" # DE - end display .de DE .fi .RE .sp .. '\" # SO - start of list of standard options .de SO .SH "STANDARD OPTIONS" .LP .nf .ta 5.5c 11c .ft B .. '\" # SE - end of list of standard options .de SE .fi .ft R .LP See the \\fBoptions\\fR manual entry for details on the standard options. .. '\" # OP - start of full description for a single option .de OP .LP .nf .ta 4c Command-Line Name: \\fB\\$1\\fR Database Name: \\fB\\$2\\fR Database Class: \\fB\\$3\\fR .fi .IP .. '\" # CS - begin code excerpt .de CS .RS .nf .ta .25i .5i .75i 1i .. '\" # CE - end code excerpt .de CE .fi .RE .. .de UL \\$1\l'|0\(ul'\\$2 .. .TH resource 3tcl 8.0 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME resource \- 操縱 Macintosh 資源 .SH "總覽 SYNOPSIS" \fBresource \fIoption\fR ?\fIarg arg ...\fR? .BE .SH "描述 DESCRIPTION" .PP \fBresource\fR 命令爲處理 Macintosh 資源提供了一些一般操作。只在Macintosh 平臺上支持這個命令。每個 Macintosh 文件由兩個 \fBfork\fR組成: 一個數據 fork 和一個資源 fork。你可以使用通常的open、puts、 close 等命令來操縱數據 fork。但是要與資源 fork 交互你必須使用這個命令。\fIOption\fR 指示完成什麼資源命令。可以接受 \fIoption\fR 的一個唯一的縮寫。有效的選項有: .TP \fBresource close \fIrsrcRef\fR 關閉給定的資源引用(獲取自 \fBresource open\fR)。來自這個資源文件的資源將不再可獲得。 .TP \fBresource delete\fR ?\fIoptions\fR? \fIresourceType\fR 這個命令將刪除用 \fIoptions\fR 和類型 \fIresourceType\fR (參見下面的RESOURCE TYPES 資源類型) 指定的資源。下列選項給出指定要刪除資源的一些方式。 .RS .TP \fB\-id\fR \fIresourceId\fR 如果給出了 \fB-id\fR 選項,則使用 id \fIresourceId\fR (參見下面的RESOURCE IDS 資源ID)指定要被刪除的資源。id 必須是一個數 - 要指定一個名字請使用 \fB-name\fR 選項。 .TP \fB\-name\fR \fIresourceName\fR 如果指定了 \fB-name\fR,則刪除叫做 \fIresourceName\fR 的資源。如果還提供了 \fB-id\fR,則要刪除的資源必須有這個名字和這個 id 二者。如果未提供名字,則使用 id 而不管實際資源的名字。 .TP \fB\-file\fR \fIresourceRef\fR 如果指定了 \fB-file\fR 選項,則從 \fIresourceRef\fR 所指向的文件中刪除資源。否則刪除在資源文件路徑上找到的有給定的 \fIresourceName\fR 和/或 \fIresourceId\fR 的第一個資源。要檢查文件路徑,應使用 \fIresource files\fR 命令。 .RE .TP \fBresource files ?\fIresourceRef\fR? 如果未提供 \fIresourceRef\fR,這個命令返回所有當前打開的資源文件的資源引用的一個 Tcl 列表。這個列表按 Macintosh 通常查找資源的次序來排序。如果指定了 \fIresourceRef\fR,這個命令將返回到那個記號表示的資源 fork 所在的文件的路徑。 .TP \fBresource list \fIresourceType\fR ?\fIresourceRef\fR? 列出所有的類型 \fIresourceType\fR 的 id(參見下面的 RESOURCE TYPES 資源類型)。如果指定了\fIresourceRef\fR ,則這個命令把查找限制爲這個特定的資源文件。否則,查找應用當前當前打開的所有資源文件。返回找到的資源的要麼是資源名字要麼是資源id 的一個 Tcl 列表。關於資源 id 的詳情請參見下面的 RESOURCE IDS 資源 ID。 .TP \fBresource open \fIfileName\fR ?\fIaccess\fR? 打開文件 \fIfileName \fR的中資源。還可以指定標準文件訪問權限(詳情參見 \fBopen\fR 手冊條目)。它返回可被其他資源命令使用的一個資源引用(\fIresourceRef\fR)。如果文件不存在或文件沒有資源 fork 則產生一個錯誤。但是,如果你打開文件時加上了寫權限,則建立這個文件和/或資源 fork 而不生成一個錯誤。 .TP \fBresource read \fIresourceType\fR \fIresourceId\fR ?\fIresourceRef\fR? 把類型是 \fIresourceType\fR (參見下面的 RESOURCE TYPES資源類型)並且名字或 id 是 \fIresourceId\fR 的全部資源(參見下面的 RESOURCE IDS 資源 ID)讀到內存中並返回這個結果。如果指定了 \fIresourceRef\fR ,則這個命令把我們的查找限制爲這個特定的資源文件,否則我們查找在應用中所有打開的資源。要注意:多數 Macintosh 資源使用二進制格式,並且從這個命令返回的數據可能包含嵌入的 NULL 或其他非 ASCII 數據。 .TP \fBresource types ?\fIresourceRef\fR? 這個命令返回在 \fIresourceRef \fR所指向的資源文件中找到的所有資源類型(參見下面的 RESOURCE TYPES資源類型)的一個Tcl 列表。如果未指定 \fIresourceRef\fR ,則它返回在應用當前打開的所有資源文件中找到的所有資源類型。 .TP \fBresource write\fR ?\fIoptions\fR? \fIresourceType\fR \fIdata\fR 這個命令把在 \fIdata\fR 中傳遞進來的數據寫爲類型是 \fIresourceType\fR (參見下面的 RESOURCE TYPES資源類型)的一個新資源。可獲得許多描述資源存儲在那裏和如何存儲的選項。 .RS .TP \fB\-id\fR \fIresourceId\fR 如果給出了 \fB-id\fR 選項,則爲新資源使用 id \fIresourceId\fR ( 參見下面的SOURCE TYPES資源類型),否則生成一個與任何現存的資源不衝突的一個唯一的 id。但是,id 必須是一個數 - 要指定一個名字請使用 \fB-name\fR 選項。 .TP \fB\-name\fR \fIresourceName\fR 如果指定了 \fB-name\fR,則這個資源將叫做 \fIresourceName\fR,否則它將以空串作爲名字。 .TP \fB\-file\fR \fIresourceRef\fR 如果指定了 \fB-file\fR 選項,則把資源被寫入 \fIresourceRef \fR所指向的文件中,否則使用最新近打開的資源。 .TP \fB\-force\fR 如果目標資源已經存在,則 Tcl 缺省的不是覆寫它,而是引發一個錯誤。使用 -force 標誌來強行覆寫現存的資源。 .RE .SH "資源類型 RESOURCE TYPES" 資源類型被定義爲一個四字符的字符串,它被映射成一個底層 id。例如,\fBTEXT\fR 參照的 Macintosh 資源類型是文本。類型 \fBSTR#\fR 是已計數的(counted)的字符串的一個列表。所有 Macintosh 資源必須是某種類型的。要得到通常使用的資源類型的一個完整列表請參見 Macintosh 文檔。 .SH "資源 RESOURCE IDS" 對於本命令,一個資源的 id 的概念(notion)實際上涉及 Macintosh 資源中的兩個概念。在你可以使用資源 Id 的每個地方,你可以使用資源名字或者一個資源數。查找和返回總是偏好名字而不是數。例如,如果一個資源的名字存在則 \fBresource list\fR 命令將返回這個名字,如果資源的名字是 NULL 則返回數。 .SH "移植要點 PORTABILITY ISSUES" 只在 Macintosh 上可獲得這個命令。 .SH "參見 SEE ALSO" open(n) .SH "關鍵字 KEYWORDS" open, resource .SH "[中文版維護人]" .B 寒蟬退士 .SH "[中文版最新更新]" .B 2001/10/29 .SH "《中國 Linux 論壇 man 手冊頁翻譯計劃》:" .BI http://cmpp.linuxforum.net .SH "跋" .br 本頁面中文版由中文 man 手冊頁計劃提供。 .br 中文 man 手冊頁計劃:\fBhttps://github.com/man-pages-zh/manpages-zh\fR