'\" '\" Copyright (c) 1995-1996 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: fconfigure.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: fconfigure.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 fconfigure 3tcl 8.1 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME fconfigure \- 設定和獲得一個通道上的選項 .SH "總覽 SYNOPSIS" .nf \fBfconfigure \fIchannelId\fR \fBfconfigure \fIchannelId\fR \fIname\fR \fBfconfigure \fIchannelId\fR \fIname value \fR?\fIname value ...\fR? .fi .BE .SH "描述 DESCRIPTION" .PP \fBfconfigure\fR 命令設定和檢索一個通道的選項。\fIChannelId\fR 標識要設定或查詢某個選項的那個通道。如果沒有提供 \fIname\fR 或 \fIvalue\fR 引數,命令返回一個列表,它包含著這個通道上可變更的選項名字和值。如果提供了 \fIname\fR 而沒有 \fIvalue\fR 則命令返回給定選項的當前值。如果提供一對或多對 \fIname\fR和 \fIvalue\fR,命令把每個指名的選項設定成相應的 \fIvalue \fR;在這種情況下返回值是一個空串。 .PP 所有通道都支援下面描述的選項。額外的,每個通道型別都可以增加只有它自己支援的選項。參見建立各種型別通道的命令的手冊條目來得到這個特定型別的通道所支援的選項。例如,參見 \fBsocket\fR命令的手冊條目來得到增補的選項。 .TP \fB\-blocking\fR \fIboolean\fR \fB-blocking\fR 選項決定在通道上的 I/O 操作是否可以導致程序無限的阻塞。選項的值必須是一個正確的 boolean 值。通道通常在阻塞模式中;如果把一個通道轉換到非阻塞模式中,它將影響 \fBgets\fR、\fBread\fR、\fBputs\fR、\fBflush\fR、和 \fBclose\fR 命令的操作;詳見這些命令的文件。要使非阻塞模式正常工作,應用必須使用 Tcl 事件迴圈(例如,透過呼叫 \fBTcl_DoOneEvent\fR 或呼叫 \fBvwait\fR 命令)。 .TP \fB\-buffering\fR \fInewValue\fR . 如果 \fInewValue\fR 是 \fBfull\fR,則 I/O 系統直到它的內部緩衝變滿或呼叫 \fBflush\fR 命令之後才將緩衝輸出。如果 \fInewValue\fR 是 \fBline\fR,則 I/O 系統將在輸出一個換行符的時候自動的重新整理此通道的輸出。如果 \fInewValue\fR 是 \fBnone\fR,則 I/O 系統將在每次輸出操作之後自動重新整理。除了連線到終端類裝置的通道被初始設定成 \fBline \fR之外,\fB-buffering\fR 的預設被設定成 \fBfull\fR。補充一下,\fBstdin\fR 和 \fBstdout\fR 被初始設定成 \fBline\fR,而 \fBstderr\fR 被設定成 \fBnone\fR。 .TP \fB\-buffersize\fR \fInewSize\fR . \fINewvalue\fR必須是一個整數;使用它的值來設定隨後分配給這個通道用來儲存輸入和輸出的緩衝區的大小,以位元組為單位。\fINewvalue\fR 必須在十到一百萬之間,即允許十到一百萬位元組大小的緩衝區。 .VS 8.1 br .TP \fB\-encoding\fR \fIname\fR . 用這個選項來指定通道的編碼,為了在 Tcl 中使用資料,資料可以轉換成 Unicode 或從 Unicode 轉換過來。例如,要使 Tcl 從用 \fBshiftjis\fR 編碼的日文檔案中讀取字元並正確的處理和顯示其中的內容,編碼就應該設定成 \fBshiftjis\fR。此後,當從一個通道讀取的時候,在這個日文檔案中的位元組如其所讀的將被轉換成 Unicode。同樣也支援寫入 - 即把要寫到通道中的 Tcl 字串自動的轉換成輸出上的特定編碼。 .RS .PP 如果一個檔案包含純二進位制資料(例如,一個 JPEG 圖象),這種通道應當被配置成 \fBbinary\fR。Tcl 將對這種檔案中的資料不賦予任何解釋,而是簡單的讀或寫原始(raw)的位元組。使用Tcl \fBbinary\fR 命令操縱這種原始位元組資料。 .PP 給新開啟的通道的預設編碼與同作業系統互動時使用的依賴於平臺或本地的編碼是一樣的。 .RE .VE .TP \fB\-eofchar\fR \fIchar\fR .TP \fB\-eofchar\fR \fB{\fIinChar outChar\fB}\fR . 這個選項支援 DOS 檔案系統,它使用 Control-z (\ex1a)作為檔案結束的標記符(marker)。如果 \fIchar\fR 不是一個空串,則在輸入期間遇到這個字元時指示(signal)檔案結束。對於輸出,在關閉通道的時候輸出檔案結束字元。如果 \fIchar\fR 是一個空串,則沒有特定的檔案結束字元標記符。對於讀寫通道,一個有兩個元素的列表分別指定給輸入和輸出的檔案結束標記符。作為一種約定,在給讀寫通道設定檔案結束符的時候,你可以指定一個單一的值,同時提供給讀和寫。在查詢一個讀寫通道的檔案結束符時,將返回一個兩個元素的列表。除了在 Windows 下的檔案之外的情況下,\fB-eofchar\fR 預設值是一個空串。在Windows 的情況下,對於讀 \fB-eofchar\fR 是 Control-z (\ex1a),對於寫是空串。 .TP \fB\-translation\fR \fImode\fR .TP \fB\-translation\fR \fB{\fIinMode outMode\fB}\fR . 在 Tcl 指令碼中總是使用一個單一的換行符(\en)來表示一行的結束。但是在實際的檔案和裝置中的行結束在不同的平臺上可能有不同的表示,甚至在相同的平臺的不同的裝置上也可能有不同的表示。例如,在 UNIX 下在檔案中是換行符,而在網路連線中通常使用回車-換行(carriage-return-linefeed)序列。在輸入上 (例如,使用 \fBgets\fR 和 \fBread\fR),Tcl I/O 系統自動的把外部的行結束表示轉換成換行符。在輸出上(例如,使用 \fBputs\fR),I/O 系統把換行符轉換成外部的行結束表示。預設的轉換模式是 \fBauto\fR,即自動的處理所有一般情況,而 \fB-translation\fR 選項在提供顯式的對行結束轉換的控制。 .PP 對於只讀和只寫通道,與 \fB-translation\fR 相關聯的值是一個單一的專案。對於讀寫通道這個值是一個兩個元素的列表;列表的第一個元素是讀轉換模式,第二個元素是寫轉換模式。作為一種約定,在給讀寫通道設定行結束符的時候,你可以指定一個單一的值,同時提供給讀和寫。在查詢一個讀寫通道的行結束符時,將返回一個兩個元素的列表。當前支援下列值: .TP \fBauto\fR . 作為輸入轉換模式,\fBauto\fR 把所有的換行(\fBlf\fR)、回車(\fBcr\fR)、或一個回車並跟隨一個換行(\fBcrlf\fR) 作為行結束表示。行結束表示甚至可以從行到行的改變,並且所有的情況都被轉換成一個換行符。作為輸出轉換模式,\fBauto\fR 選擇一個特定於平臺的表示;對於套介面,Tcl 在所有平臺上均選擇 \fBcrlf\fR,對於所有 Unix 版本(flavor),它選擇 \fBlf\fR,對Macintosh 平臺它選擇 \fBcr\fR,對於各種版本的Windows 它選擇 \fBcrlf\fR。對於輸入和輸出二者,\fB-translation\fR的預設設定是 \fBauto\fR。 .VS 8.1 br .TP \fBbinary\fR . 不進行行結束轉換。除了 \fBbinary\fR模式額外的把檔案結束符設定成空串(禁用檔案結束符),並且把編碼設定成 \fBbinary\fR (禁用編碼過濾)之外,它與\fBlf\fR 模式基本一致。詳細資訊參見 \fB-eofchar\fR 和 \fB-encoding\fR。 .VE .TP \fBcr\fR . 在底層檔案或裝置中的行結束被表示為一個單一的回車符。作為輸入轉換模式,\fBcr\fR模式把回車符轉換成換行符。作為輸出轉換模式,\fBcr\fR模式把換行符轉換成回車符。這種模式典型的在 Macintosh 平臺上使用。 .TP \fBcrlf\fR . 在底層檔案或裝置中的行結束被表示一個回車符並跟隨一個換行符。作為輸入轉換模式,\fBcrlf\fR模式把回車換行序列轉換成換行符。作為輸出模式,\fBcrlf\fR 模式把換行符轉換成回車換行序列。這種模式典型的在 Windows 平臺和網路連線上使用。 .TP \fBlf\fR . 在底層檔案或裝置中的行結束被表示為一個單一的換行符。在這種模式下在輸入或輸出期間沒有轉換髮生。這種模式典型的在UNIX 平臺上使用。 .RE .PP .SH "參見 SEE ALSO" close(n), flush(n), gets(n), puts(n), read(n), socket(n) .SH "關鍵字 KEYWORDS" blocking, buffering, carriage return, end of line, flushing, linemode, newline, nonblocking, platform, translation, encoding, filter, byte array, binary .SH "[中文版維護人]" .B 寒蟬退士 .SH "[中文版最新更新]" .B 2001/08/02 .SH "《中國 Linux 論壇 man 手冊頁翻譯計劃》:" .BI http://cmpp.linuxforum.net .SH "跋" .br 本頁面中文版由中文 man 手冊頁計劃提供。 .br 中文 man 手冊頁計劃:\fBhttps://github.com/man-pages-zh/manpages-zh\fR