热搜关键词: 电路基础ADC数字信号处理封装库PLC

pdf

tcl 中文教程

  • 1星
  • 2015-02-08
  • 1.18MB
  • 需要1积分
  • 7次下载
标签: tcl

tcl

tcl脚本语言简单教程  快速了解tcl

1
3/25/2006
10:11:08 PM
Tcl
教程
[Edit
by
roben_chen]
http://2316.vip.nease.net/scriptnet/ssdn/index.htm
2
3/25/2006
10:11:08 PM
目½
Tcl
............................................................................5
TCL
语法
..................................................................5
■脚本、½令和单词符号.......................................................................................................5
■½换(substitution)
.................................................................................................................6
■变量½换(variable
subtitution) .....................................................................................6
■½令½换(command
substitution).................................................................................6
■反斜杠½换(backslash
substitution) .............................................................................7
■双引号和花括号...........................................................................................................8
■注释.......................................................................................................................................9
变量
......................................................................10
■简单变量.............................................................................................................................10
■数组.....................................................................................................................................11
■相关½令.............................................................................................................................12
■set
................................................................................................................................12
■unset
............................................................................................................................12
■append和incr...............................................................................................................12
表达式
...................................................................14
■操½数.................................................................................................................................14
■运算符和优先级.................................................................................................................15
■数学½数.............................................................................................................................16
List......................................................................18
■list½令................................................................................................................................18
■concat½令
..........................................................................................................................19
■lindex½令...........................................................................................................................20
■llength½令
.........................................................................................................................21
■linsert½令...........................................................................................................................22
■lreplace½令
........................................................................................................................23
■lrange ½令.........................................................................................................................24
■lappend½令
........................................................................................................................25
■lsearch ½令
.......................................................................................................................26
■lsort½令
.............................................................................................................................27
■split½令..............................................................................................................................28
■join½令
..............................................................................................................................29
控制流
...................................................................30
■if½令
..................................................................................................................................30
■循环½令:while 、for、
foreach ...................................................................................31
3
3/25/2006
10:11:08 PM
■while½令....................................................................................................................31
■for½令
........................................................................................................................31
■foreach½令.................................................................................................................31
■break和continue½令
..................................................................................................32
■switch ½令
................................................................................................................32
■eval½令
..............................................................................................................................34
■source½令
..........................................................................................................................35
过程
(procedure)
...................................................36
■过程定义和返回值.............................................................................................................36
■局部变量和全局变量.........................................................................................................37
■缺省参数和可变个数参数.................................................................................................38
■引用:upvar........................................................................................................................39
字符串操½
.............................................................40
■format½令
..........................................................................................................................40
■scan½令
.............................................................................................................................41
■regexp½令..........................................................................................................................42
【TCL正则表达式规则详细说明】
.............................................................................44
■regsub½令
..........................................................................................................................55
■string½令
...........................................................................................................................56
■1、string
compare ?-nocase? ?-length int? string1 string2 .........................................56
■2、string
equal ?-nocase? ?-length int? string1 string2 ..............................................56
■3、string
first string1 string2 ?startindex?..................................................................56
■4、string
index string charIndex.................................................................................56
■5、string
last string1 string2 ?startindex?...................................................................57
■6、string
length string.................................................................................................57
■7、string
match ?-nocase? pattern string ....................................................................57
■8、string
range string first last....................................................................................58
■9、string
repeat string count.......................................................................................58
■10、string
replace string first last ?newstring?...........................................................58
■11、string
tolower string ?first? ?last?........................................................................58
■12、string
toupper string ?first? ?last? .......................................................................58
■13、string
trim string ?chars? .....................................................................................58
■14、string
trimleft string ?chars?................................................................................59
■15、string
trimright string ?chars? .............................................................................59
文件访问
................................................................60
■文件名.................................................................................................................................60
■基本文件输入输出½令.....................................................................................................61
■随机文件访问.....................................................................................................................63
■½前工½目½.....................................................................................................................64
■文件操½和获取文件信息.................................................................................................65
错误和异常
.............................................................69
4
3/25/2006
10:11:08 PM
■错误.....................................................................................................................................69
■从TCL脚本中产生错误
.....................................................................................................71
■½用catch捕获错误
............................................................................................................72
■其他异常.............................................................................................................................73
深入
TCL
................................................................75
■查询数组中的元素.............................................................................................................75
■info½令
..............................................................................................................................77
■变量信息.....................................................................................................................77
■过程信息.....................................................................................................................78
■½令信息.....................................................................................................................79
■TCL的版本和库
.........................................................................................................79
■½令的执行时间.........................................................................................................79
■跟踪变量.....................................................................................................................80
■½令的重½名和删除.................................................................................................82
■unknown½令..............................................................................................................83
■自动加½½.....................................................................................................................83
5
3/25/2006
10:11:08 PM
Tcl
TCL
语法
■脚本、½令和单词符号
一个
TCL
脚本可以包含一个或多个½令。½令之间必须用换行符或分号隔开,下面的两个脚本
½是合法的:
set a 1
set b 2
set a 1;set b 2
TCL
的每一个½令包含一个或几个单词,第一个单词代表½令名,另外的单词则是这个½令的
参数,单词之间必须用空格或
TAB
键隔开。
TCL
解释器对一个½令的求值过程分为两部分:分析和执行。在分析阶段,TCL 解释器运用规
则把½令分成一个个独立的单词,同时进行必要的½换(substitution); 在执行阶段,TCL 解
释器会把第一个单词½½½令名,
并查看这个½令是否有定义,
如果有定义就激活这个½令对应
C/C++过程,并把所有的单词½为参数传递给该½令过程,让½令过程进行处理。
展开预览

猜您喜欢

推荐帖子

评论

登录/注册

意见反馈

求资源

回顶部

推荐内容

热门活动

热门器件

随便看看

  • 从零开始学FPGA我的第二个实验(记录一下)
    感谢小梅哥!!昨天做了我FPGA的第一个实验[url=https://bbs.eeworld.com.cn/forum.php?mod=viewthread&tid=494785&page=1#pid2040429]从零开始学FPGA我的第一个实验(记录一下)[/url]今天第二个实验38译码器真值表原理:有三个(一位)输入一个输出(8位)使用了一个always块,always块语句注意阻塞赋值和非
  • 大爱TI_M3与M4
    最近想深入学习一下LM3S9B96或者LM4F232,就是官网带液晶那种,可以跑跑操作系统,进行cotex-M3的深入学习,不知道论坛坛友们有没有闲置的可以借用呀呵呵!!!不胜感激,嘿嘿!!!![[i] 本帖最后由 鑫海宝贝 于 2012-5-22 14:57 编辑 [/i]]
  • 摩托车用直流无刷起动磁电机及驱动电路设计
    摘 要:针对将直流无刷电机与摩托车磁电机集合在一起的直流无刷起动磁电机,分析了电机定、转子及驱动电路的设计特点,提出了设计方法。 关键词:直流无刷起动磁电机;直流无刷电机;磁电机;摩托车起动电机 1 引 言 目前电起动摩托车上起动电机和磁电机是2台独立的电机。起动电机为有刷永磁直流电动机,工作转速高,需经减速机构和超越离合器与发动机曲轴相连。磁电机飞轮永磁转子与发动机曲轴直接相连,起到发电和给发动
  • vxworks 驱动要怎么调试
    我在搭建vxworks5.5 下的文件系统TFFS,现在MTD程序写完了我要怎么调试,tffsShow 这个函数调用通过了,下面怎么走我使用usrtffsconfig(0,0,“/tffs0”) 出错?:titter:
  • wince里comman.bib里那么多冒号问题
    comman.bib里为什么有那么多的冒号啊,屏蔽了那么多的东西,比如:; @CESYSGEN IF FONTS_ARIALBD_1_08;arialbd.ttf$(_WINCEROOT)\public\common\oak\files\arialbd_1_08.ttfNKSHU; @CESYSGEN ENDIF1. 我的理解是FONTS_ARIALBD_1_08是个环境变量,如果再工程中加入这个
  • 大家说说手上的板子来自何方呀
  • 2410+wince500 网卡问题
  • TI 电源EMI规格概述
  • 检测线路的断点问题
  • C语言符号求问

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved
×