⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 code.n

📁 这是一个Linux下的集成开发环境
💻 N
字号:
'\"'\" Copyright (c) 1993-1998  Lucent Technologies, Inc.'\"'\" See the file "license.terms" for information on usage and redistribution'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.'\"'\" RCS: $Id: code.n,v 1.1 2003/02/05 10:53:53 mdejong Exp $'\".so man.macros.TH code n 3.0 itcl "[incr\ Tcl]".BS'\" Note:  do not modify the .SH NAME line immediately below!.SH NAMEcode \- capture the namespace context for a code fragment.SH SYNOPSIS\fBcode \fR?\fB-namespace \fIname\fR? \fIcommand \fR?\fIarg arg ...\fR?.BE.SH DESCRIPTION.PPCreates a scoped value for the specified \fIcommand\fR and itsassociated \fIarg\fR arguments.  A scoped value is a list with threeelements:  the "\fC@scope\fR" keyword, a namespace context,and a value string.  For example, the command.CSnamespace foo {    code puts "Hello World!"}.CEproduces the scoped value:.CS@scope ::foo {puts {Hello World!}}.CENote that the \fBcode\fR command captures the current namespacecontext.  If the \fB-namespace\fR flag is specified, then thecurrent context is ignored, and the \fIname\fR string is usedas the namespace context..PPExtensions like Tk execute ordinary code fragments in the globalnamespace.  A scoped value captures a code fragment together withits namespace context in a way that allows it to be executedproperly later.  It is needed, for example, to wrap up code fragmentswhen a Tk widget is used within a namespace:.CSnamespace foo {    private proc report {mesg} {        puts "click: $mesg"    }    button .b1 -text "Push Me" \        -command [code report "Hello World!"]    pack .b1}.CEThe code fragment associated with button \fC.b1\fR only makessense in the context of namespace "foo".  Furthermore, the"report" procedure is private, and can only be accessed withinthat namespace.  The \fBcode\fR command wraps up the codefragment in a way that allows it to be executed properlywhen the button is pressed..PPAlso, note that the \fBcode\fR command preserves the integrityof arguments on the command line.  This makes it a natural replacementfor the \fBlist\fR command, which is often used to format Tcl codefragments.  In other words, instead of using the \fBlist\fR commandlike this:.CSafter 1000 [list puts "Hello $name!"].CEuse the \fBcode\fR command like this:.CSafter 1000 [code puts "Hello $name!"].CEThis not only formats the command correctly, but also capturesits namespace context..PPScoped commands can be invoked like ordinary code fragments, withor without the \fBeval\fR command.  For example, the followingstatements work properly:.CSset cmd {@scope ::foo .b1}$cmd configure -background redset opts {-bg blue -fg white}eval $cmd configure $opts.CENote that scoped commands by-pass the usual protection mechanisms;the command:.CS@scope ::foo {report {Hello World!}}.CEcan be used to access the "foo::report" proc from any namespacecontext, even though it is private..SH KEYWORDSscope, callback, namespace, public, protected, private

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -