'\" '\" 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: dde.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: dde.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 dde 3tcl 8.1 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME dde \- 執行一個動態資料交換命令 .SH "總覽 SYNOPSIS" .sp \fBpackage require dde 1.1\fR .sp \fBdde \fIservername \fR?\fItopic\fR? .sp \fBdde ?\-async?\fR \fIcommand service topic \fR?\fIdata\fR? .BE .SH "描述 DESCRIPTION" .PP 當執行在 Microsoft Windows 下的時候,這個命令允許一個應用來發送動態資料交換(Dynamic Data Exchange:DDE)命令。動態資料交換是一種機制,在這裡應用可以交換原始資料。每個 DDE 事務都需要一個\fI服務名(service name)\fR和一個\fI主題(topic)\fR。\fI服務名\fR和主題均由應用來定義;Tcl 使用的服務名是 \fBTclEval\fR,而主題名是用\fBdde servername \fR給出的直譯器的名字。其他的應用有其自己的\fI服務名\fR和\fI主題\fR。例如,Microsoft Excel 的服務名是 \fBExcel\fR。 .PP \fBdde\fR 命令的唯一的選項是: .TP \fB\-async\fR 要求非同步激發(invocation)。這隻對\fBexecute\fR 子命令有效。正常的,\fBdde execute\fR 子命令等待直到命令完成,返回適當的出錯資訊。當使用了 \fB-async\fR 選項,命令立刻返回,不能獲得出錯資訊。 .SH "DDE 命令 COMMANDS" .PP 下面的命令是完整的動態資料交換命令集的子集。 .TP \fBdde servername \fR?\fItopic\fR? \fBdde servername\fR 用服務名 \fBTclEval\fR 和由 \fItopic \fR指定的主題名來把直譯器註冊為一個 DDE 伺服器。如果沒有給出 \fItopic\fR,\fBdde servername\fR返回當前的主題的名字,如果未被註冊為一個服務則返回空串。 .TP \fBdde execute \fIservice topic data\fR \fBdde execute\fR 接受 \fIdata\fR 並把它傳送到由 \fIservice\fR 指示出的伺服器並由 \fItopic \fR指示出主題。典型的,\fIservice\fR 是一個應用的名字,而 \fItopic\fR 是要在其上工作的一個檔案。給予遠端應用的是 \fIdata\fR 域(field)。典型的,應用把 \fIdata\fR 域作為指令碼對待,接著在應用中執行指令碼。如果指令碼沒有執行,命令返回一個錯誤。如果使用了 \fB-async\fR標誌,命令立即返回而沒有錯誤。 .TP \fBdde poke \fIservice topic item data\fR \fBdde poke\fR 傳遞 \fIdata\fR 到由 \fIservice\fR指示的伺服器並用 \fItopic\fR 和 \fIitem\fR 加以指定。典型的, \fIservice\fR 是一個應用的名字。\fItopic\fR 由應用指定,可以是給伺服器的一個命令或一個要在其上工作的一個檔案的名字。\fIitem\fR 也由應用指定,不常用,但必須總是非空。給予遠端應用的是 \fIdata\fR 域( field)。 .TP \fBdde request \fIservice topic item\fR \fBdde request\fR 典型的用於得到某種東西的值;如 Microsoft Excel 中的一個單元格(cell)的值或在 Microsoft Word 中一個選擇的文字。 \fIservice\fR 典型的是一個應用的名字。 \fItopic\fR典型的是檔案的名字,\fIitem\fR由使用者來指定。命令返回在應用中定義的 \fIitem\fR的值。 .TP \fBdde services \fIservice topic\fR \fBdde services\fR 返回當前在機器上存在的服務-主題對的一個列表。如果 \fIservice\fR 和 \fItopic\fR 都是空串({}), 則返回在系統上當前可獲得的所有的服務-主題對。如果 \fIservice\fR 是空而 \fItopic\fR 不是,則返回指定主題的所有服務。如果 \fIservice\fR 不空而 \fItopic\fR 空,則返回指定服務的所有主題。如果均不空,若當前存在這個服務-主題對則返回它,否則返回空。 .TP \fBdde eval \fItopic cmd \fR?\fIarg arg ...\fR? \fBdde eval\fR 求值一個命令和它的引數,直譯器用 \fItopic\fR 指定。DDE 服務必須是\fBTclEval\fR 服務。這個命令可以用於在 Windows 上替換 send。 .SH "DDE 和 TCL" 一個 Tcl 直譯器總是有一個服務名 \fBTclEval\fR。每個不同的執行 Tcl 應用的直譯器必須給予一個用 \fBdde servername\fR指定的唯一的名字。每個直譯器只有使用 \fBdde servername\fR命令來設定名字,這個直譯器才可作為一個 DDE 主題來獲得。所以一個 \fBdde services TclEval {}\fR 命令將返回一個服務-主題對的列表,這裡每個當前執行的直譯器都將是一個主題。 .PP 當 Tcl 處理一個 \fBdde execute\fR 命令時,用於執行的資料作為一個指令碼在 \fBdde execute\fR 命令的主題指明的直譯器中執行。 .PP 當 Tcl 處理一個 \fBdde request\fR命令時,它返回在 dde 命令中給出的變數的值,變數在由 dde主題指名的直譯器的上下文中的。Tcl 為內部使用而保留變數 \fB$TCLEVAL $EXECUTE $RESULT\fR,對這些變數的\fBdde request\fR 命令將返回不可預測的(unpredictable)結果。 .PP 打算執行一個Tcl 指令碼的一個外部(external)應用應當使這個指令碼在一個變數中儲存它的結果,執行 \fBdde execute\fR 命令,接著執行 \fBdde request\fR 得到這個變數的值。 .PP 當使用 DDE 時,注意要確保使用 \fBupdate\fR或者 \fBvwait \fR來重新整理事件佇列。在使用\fBwish\fR時這是預設的,但不包括呼叫了一個阻塞命令的情況(例如 \fBexec\fR 而不填加 \fB&\fR 來在後臺執行程序)。如果由於某種原因而導致事件佇列沒被重新整理,DDE 命令將掛起(hang)直到事件佇列被重新整理。這可能產生死鎖的情況。 .SH "參見 SEE ALSO" tk(n), winfo(n), send(n) .SH "關鍵字 KEYWORDS" application, dde, name, remote execution .SH "[中文版維護人]" .B 寒蟬退士 .SH "[中文版最新更新]" .B 2001/06/18 .SH "《中國 Linux 論壇 man 手冊頁翻譯計劃》:" .BI http://cmpp.linuxforum.net .SH "跋" .br 本頁面中文版由中文 man 手冊頁計劃提供。 .br 中文 man 手冊頁計劃:\fBhttps://github.com/man-pages-zh/manpages-zh\fR