HXP TCL Manual

HXP TCL Manual

HXP Hexapod Motion Controller Tcl Manual Intaller Pack Version #30002 HXP Controller Tcl Manual NOTE Tcl/Tk has been distributed freely for over 10 years and is now used in thousands of applications by companies and individuals worldwide. You are free to use it however you wish, even in commercial applications. ©2018 by Newport Corporation, Irvine, CA. All rights reserved. Original instructions. No part of this document may be reproduced or copied without the prior written approval of Newport Corporation. This document is provided for information only, and product specifications are subject to change without notice. Any change will be reflected in future publishings. EDH0336En1032 — 12/18 ii HXP Controller Tcl Manual Table of Contents 1.0 Introduction ............................................................................................. 1 1.1 Tcl is a String-Based Command Language ..................................................................... 1 1.1.1 Tcl Commands ..................................................................................................... 1 1.2 Tcl script examples .......................................................................................................... 2 1.2.1 Hello, World! ....................................................................................................... 2 1.2.2 Variables .............................................................................................................. 2 1.2.3 Command Substitution ......................................................................................... 3 1.2.4 Math Expressions ................................................................................................. 3 1.2.5 Backslash Substitution ......................................................................................... 4 1.2.6 Grouping with Braces and Double Quotes ........................................................... 5 1.2.6.1 Square Brackets Do Not Group .................................................................... 5 1.2.6.2 Grouping Before Substitution ....................................................................... 5 1.2.6.3 Grouping Math Expressions with Braces ..................................................... 6 1.2.6.4 More Substitution Examples ........................................................................ 6 1.2.7 Procedures ............................................................................................................ 6 1.2.8 A Factorial Example ............................................................................................ 7 1.2.9 More About Variables .......................................................................................... 9 1.2.9.1 Funny Variable Names ................................................................................. 9 1.2.9.2 The unset Command ................................................................................ 9 1.2.9.3 Using info to Find Out About Variables ................................................ 10 1.2.10 More About Math Expressions ........................................................................ 11 1.2.11 Comments ........................................................................................................ 12 1.2.12 Substitution and Grouping Summary ............................................................... 13 1.2.13 Fine Points ....................................................................................................... 14 1.3 Reference ........................................................................................................................15 1.3.1 Backslash Sequences ......................................................................................... 15 1.3.2 Arithmetic Operators ......................................................................................... 15 1.3.3 Built-in Math Functions ..................................................................................... 15 2.0 Tcl Command Descriptions .................................................................. 17 2.1 Tcl - Summary of Tcl Language Syntax .........................................................................17 2.2 after - Execute a Command After a Time Delay ............................................................20 2.3 append - Append to Variable ..........................................................................................21 2.4 array - Manipulate Array Variables ................................................................................22 2.5 binary - Insert and Extract Fields from Binary strings....................................................24 2.6 break - Abort Looping Command ...................................................................................30 2.7 catch - Evaluate Script and Trap Exceptional Returns ...................................................31 2.8 cd - Change Working Directory .....................................................................................32 iii EDH0337En1032 — 12/18 HXP Controller Tcl Manual 2.9 clock - Obtain and Manipulate Time ..............................................................................33 2.10 close - Close an Open Channel .......................................................................................36 2.11 concat - Join Lists Together ............................................................................................37 2.12 continue - Skip to the Next Iteration of a Loop ..............................................................38 2.13 eof - Check for End of File Condition on Channel .........................................................39 2.14 error - Generate an Error.................................................................................................40 2.15 eval - Evaluate a Tcl Script .............................................................................................41 2.16 exec - Invoke Subprocess(es) .........................................................................................42 2.17 exit - End the Application ...............................................................................................44 2.18 expr - Evaluate an Expression ........................................................................................45 2.19 fconfigure - Set and Get Options on a Channel ..............................................................50 2.20 fcopy - Copy Data From One Channel to Another .........................................................53 2.21 file - Manipulate File Names and Attributes...................................................................55 2.22 fileevent - Execute a Script When a Channel Becomes Readable or Writable ...............59 2.23 flush - Flush Buffered Output for a Channel ..................................................................61 2.24 for - ``For'' Loop .............................................................................................................62 2.25 foreach - Iterate Over All Elements in One or More Lists ..............................................63 2.26 format - Format a String in the Style of sprintf ..............................................................64 2.27 gets - Read a Line from a Channel .................................................................................67 2.28 glob - Return Names of Files that Match Patterns ..........................................................68 2.29 global - Access Global Variables ...................................................................................69 2.30 if - Execute Scripts Conditionally ...................................................................................70 2.31 incr - Increment the Value of a Variable ........................................................................71 2.32 info - Return Information About the State of the Tcl Interpreter ....................................72 2.33 join - Create a String by Joining Together List Elements ...............................................75 2.34 lappend - Append List Elements Onto a Variable ..........................................................76 2.35 lindex - Retrieve an Element From a List .......................................................................77 2.36 linsert - Insert Elements Into a List .................................................................................78 2.37 list - Create a List............................................................................................................79 2.38 llength - Count the Number of Elements in a List ..........................................................80 2.39 lrange - Return One or More Adjacent Elements From a List ........................................81 2.40 lreplace - Replace Elements in a List With New Elements ............................................82 2.41 lsearch - See if a List Contains a Particular Element ......................................................83 2.42 lsort - Sort the Elements of a List ...................................................................................84 2.43 namespace - Create and Manipulate Contexts for Commands and Variables ................85 2.44 open - Open a File-Based or Command Pipeline Channel .............................................92 2.45 pid - Retrieve Process id(s) .............................................................................................95 2.46 proc - Create a Tcl Procedure .........................................................................................96

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    186 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us