您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 项目/工程管理 > Tcl and the Tk Toolkit
TclandtheTkToolkitJohnK.OusterhoutComputerScienceDivisionDepartmentofElectricalEngineeringandComputerSciencesUniversityofCaliforniaBerkeley,CA94720Copyright©1993Addison-WesleyPublishingCompany,Inc.Allrightsreserved.Duplicationofthisdraftispermittedbyindividualsforpersonaluseonly.Anyotherformofduplicationorreproductionrequirespriorwrittenpermis-sionoftheauthororpublisher.Thisstatementmustbeeasilyvisibleonthefirstpageofanyreproducedcopies.Thepublisherdoesnotofferwarrantiesinregardtothisdraft.Notetoreaders:Thismanuscriptisapartialdraftofabooktobepublishedinearly1994byAddison-Wesley(ISBN0-201-63337-X).Addison-WesleyhasgivenmepermissiontomakedraftsofthebookavailabletotheTclcommunitytohelpmeettheneedforintroduc-torydocumentationonTclandTkuntilthebookbecomesavailable.Pleaseobservetherestrictionssetforthinthecopyrightnoticeabove:you’rewelcometomakeacopyforyourselforafriendbutanysortoflarge-scalereproductionorreproductionforprofitrequiresadvancepermissionfromAddison-Wesley.Iwouldbehappytoreceiveanycommentsyoumighthaveonthisdraft;sendthemtomeviaelectronicmailatouster@cs.berkeley.edu.I’mparticularlyinterestedinhearingaboutthingsthatyoufounddifficulttolearnorthatweren’tadequatelyexplainedinthisdocument,butI’malsointerestedinhearingaboutinaccuracies,typos,oranyotherconstructivecriticismyoumighthave.2DRAFT(8/12/93):DistributionRestricted1DRAFT(8/12/93):DistributionRestrictedChapter1Introduction11.1Introduction11.2Organizationofthebook31.3Notation4Chapter2AnOverviewofTclandTk52.1Gettingstarted52.2HelloworldwithTk72.3Scriptfiles92.4Variablesandsubstitutions102.5Controlstructures112.6Eventbindings132.7Subprocesses152.8AdditionalfeaturesofTclandTk182.9Extensionsandapplications182.9.1Expect192.9.2ExtendedTcl192.9.3XF202.9.4Distributedprogramming202.9.5Ak22Chapter3TclLanguageSyntax253.1Scripts,commands,andwords253.2Evaluatingacommand263.3Variablesubstitution283.4Commandsubstitution293.5Backslashsubstitution303.6Quotingwithdouble-quotes303.7Quotingwithbraces323.8Comments333.9Normalandexceptionalreturns333.10Moreonsubstitutions342DRAFT(8/12/93):DistributionRestrictedChapter4Variables374.1Simplevariablesandthesetcommand374.2Arrays384.3Variablesubstitution394.4Removingvariables:unset404.5Multi-dimensionalarrays414.6Theincrandappendcommands414.7Previewofothervariablefacilities42Chapter5Expressions435.1Numericoperands435.2Operatorsandprecedence445.2.1Arithmeticoperators445.2.2Relationaloperators465.2.3Logicaloperators465.2.4Bitwiseoperators465.2.5Choiceoperator465.3Mathfunctions475.4Substitutions475.5Stringmanipulation495.6Typesandconversions495.7Precision50Chapter6Lists516.1Basicliststructureandthelindexcommand516.2Creatinglists:concat,list,andllength536.3Modifyinglists:linsert,lreplace,lrange,andlappend546.4Searchinglists:lsearch566.5Sortinglists:lsort566.6Convertingbetweenstringsandlists:splitandjoin576.7Listsandcommands583DRAFT(8/12/93):DistributionRestrictedChapter7ControlFlow617.1Theifcommand617.2Loopingcommands:while,for,andforeach637.3Loopcontrol:breakandcontinue657.4Theswitchcommand657.5Eval677.6Executingfromfiles:source68Chapter8Procedures698.1Procedurebasics:procandreturn698.2Localandglobalvariables718.3Defaultsandvariablenumbersofarguments728.4Callbyreference:upvar738.5Creatingnewcontrolstructures:uplevel74Chapter9ErrorsandExceptions779.1Whathappensafteranerror?779.2GeneratingerrorsfromTclscripts799.3Trappingerrorswithcatch809.4Exceptionsingeneral81Chapter10StringManipulation8510.1Glob-stylepatternmatching8510.2Patternmatchingwithregularexpressions8810.3Usingregularexpressionsforsubstitutions9010.4Generatingstringswithformat9110.5Parsingstringswithscan9310.6Extractingcharacters:stringindexandstringrange9410.7Searchingandcomparison9410.8Length,caseconversion,andtrimming954DRAFT(8/12/93):DistributionRestrictedChapter11AccessingFiles9711.1Filenames9711.2BasicfileI/O9911.3Outputbuffering10111.4Randomaccesstofiles10111.5Thecurrentworkingdirectory10211.6Manipulatingfilenames:globandfile10211.7Fileinformationcommands10511.8Errorsinsystemcalls107Chapter12Processes10912.1Invokingsubprocesseswithexec10912.2I/Otoandfromacommandpipeline11212.3Processids11312.4Environmentvariables11312.5TerminatingtheTclprocesswithexit113Chapter13ManagingTclInternals11513.1Queryingtheelementsofanarray11513.2Theinfocommand11713.2.1Informationaboutvariables11713.2.2Informationaboutprocedures12013.2.3Informationaboutcommands12113.2.4Tclversionandlibrary12213.3Timingcommandexecution12213.4Tracingoperationsonvariables12313.5Renaminganddeletingcommands12513.6Unknowncommands12613.7Auto-loading128Chapter14History13114.1Thehistorylist1315DRAFT(8/12/93):DistributionRestricted14.2Specifyingevents13314.3Re-executingcommandsfromthehistorylist13314.4Shortcutsimplementedbyunknown13414.5Currenteventnumber:historynextid1346DRAFT(8/12/93):DistributionRestricted1Copyright©1993Addison-WesleyPublishingCompany,Inc.Allrightsreserved.Duplicationofthisdraftispermittedbyindividualsforpersonaluseonly.Anyotherformofduplicationorreproductionrequirespriorwrittenpermissionoftheauthororpub-
本文标题:Tcl and the Tk Toolkit
链接地址:https://www.777doc.com/doc-6222746 .html