Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Comment: |
* NOTES: New file. Read here about the new modularization macros,
interdependencies, implications, etc.
* static.sizes.html: New file. Report on the cuts achieved so far. Regarding the object files only the files which did change in size are reported. Usage of the MODULAR_TCL macro currently cuts about 17 % of the code (measured using strip'ped object files and libraries). * Changed files so far .. [cut, see changelog for full list] * Working on modularization of the tcl core. *************************** **** mod-8-3-4-branch **** *************************** |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | mod-8-3-4-branch |
Files: | files | file ages | folders |
SHA1: |
052bbd8095f0661b8829ef61f127d5fe |
User & Date: | andreas_kupries 2001-11-28 17:58:35 |
2001-12-03
| ||
18:23 | NRE1 patch by Miguel Sofer. Several new controlling macros for information on the stack. Parser i... check-in: fc43051481 user: andreas_kupries tags: mod-8-3-4-branch | |
2001-11-28
| ||
17:58 | * NOTES: New file. Read here about the new modularization macros, interdependencies, implicatio... check-in: 052bbd8095 user: andreas_kupries tags: mod-8-3-4-branch | |
2001-11-20
| ||
15:14 | * generic/tclCmdMZ.c (Tcl_TimeObjCmd) Added extra parentheses to a cast expression to remove ambigui... check-in: 3bbc2d5a88 user: kennykb tags: core-8-3-1-branch | |
Changes to ChangeLog.
1 2 3 4 5 6 7 | 2001-11-20 Kevin B. Kenny <[email protected]> * generic/tclCmdMZ.c (Tcl_TimeObjCmd) Added extra parentheses to a cast expression to remove ambiguity and conform with Tcl Engineering Manual. [Suggestion by Donal Fellows in commentary on patch #483500] | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | 2001-11-28 Andreas Kupries <[email protected]> * NOTES: New file. Read here about the new modularization macros, interdependencies, implications, etc. * static.sizes.html: New file. Report on the cuts achieved so far. Regarding the object files only the files which did change in size are reported. Usage of the MODULAR_TCL macro currently cuts about 17 % of the code (measured using strip'ped object files and libraries). * Changed files so far * tcl.decls * tcl.h * tclBasic.c * tclCmdAH.c * tclCmdMZ.c * tclEncoding.c * tclEvent.c * tclFCmd.c * tclFileName.c * tclIO.c * tclIOCmd.c * tclIOGT.c * tclIOUtil.c * tclInt.decls * tclInterp.c * tclLoad.c * tclLoadNone.c * tclMain.c * tclPipe.c * tclStubInit.c * tclUtil.c * genStubs.tcl * tclLoadAout.c * tclLoadDl.c * tclLoadDld.c * tclLoadDyld.c * tclLoadNext.c * tclLoadOSF.c * tclLoadShl.c * tclUnixChan.c * tclUnixFCmd.c * tclUnixFile.c * tclUnixInit.c * tclUnixNotfy.c * tclUnixPipe.c * tclUnixSock.c * Working on modularization of the tcl core. *************************** **** mod-8-3-4-branch **** *************************** 2001-11-20 Kevin B. Kenny <[email protected]> * generic/tclCmdMZ.c (Tcl_TimeObjCmd) Added extra parentheses to a cast expression to remove ambiguity and conform with Tcl Engineering Manual. [Suggestion by Donal Fellows in commentary on patch #483500] |
︙ | ︙ |
Added NOTES.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | Pre-notes The cutting of the channel system is not as clean as I would like it to be, simply because cisco has the special need of a channel system trimmed down to the std* channels, without complete removal. I am not sure that I have removed the maximum amount of C Api's and functions possible for this specific configuration. A first step in rationalizing this section would be NO_CHANNELS to remove the I/O system completely, and then NO_NONSTDCHAN for minial exposure of channels. NO_FILEEVENTS is orthogonal to NO_NONSTDCHAN. Drivers are possible only if not NO_CHANNELS, but can be disabled separately. The standard channels need the "file" driver (currently not disable-able), should use #ifdef's to ensure integrity. => Would be interesting to have a configuration tool which is able to express and enforce these constraints. => The linux core configuration uses the domain specific language CML2 (Eric Raymond, written in Python). ! Investigate possible usage of SourceNavigator as basic for parsing the Tcl core. Use custom tools to follow dependencies between structures and functions. (What-If tools: What if I exclude this function/struct, what else can be removed, or requires this). Also: What are the leaf functions in the system ... ! Mapping help: Associate functions with functional areas and see how the areas relate, how much can be removed whenever an area is excluded ... ------------------------------------------------------------------------ ------------------------------------------------------------------------ ------------------------------------------------------------------------ Shrinking the core. Filesystem Shrinking the usage of stack Large static arrays on the stack Look for #define's, check usage, create #defines if necessary DString !! (initial dstring data in structure!) RE's ? NRE1 == running a stack test of the full test suite for a build is 1.5 hours == == something for the evening and the night == Document methodology of testing stack Macros TCL_NO_<feature> to deactivate/cut feature MODULAR_TCL activates all TCL_NO_<feature> macros ------------------------------------------------------------------------ Cut 1 The cut currently restricts itself to the UNIX and GENERIC parts. No changes in Win* and Mac areas. channel system - no sockets TCL_NO_SOCKETS / - no serial/tty TCL_NO_TTY / - no pipes TCL_NO_PIPES / - no pid command TCL_NO_PIDCMD / - channel system provides TCL_NO_NONSTDCHAN / only std* channels [x] - no channel copying TCL_NO_CHANNELCOPY / - no [read]ing TCL_NO_CHANNEL_READ / - no [eof] [/] TCL_NO_CHANNEL_EOF / - no channel set/get cfg TCL_NO_CHANNEL_CONFIG [+] / - no [fblocked] TCL_NO_CHANNEL_BLOCKED [/] / - no fileevents TCL_NO_FILEEVENTS [=] / filesystem - disable filesystem TCL_NO_FILESYSTEM [%] /* - disable load'ing TCL_NO_LOADCMD / master/slave interpreters - disable slave interp TCL_NO_SLAVEINTERP /* - disable command aliases TCL_NO_CMDALIASES /* [*] Access from the C level is not removed. [x] Implies that no .rc can be read during unix init. Implies that no startup script can be read by tclsh. Implies NO_SOCKETS, NO_TTY, NO_PIPES Implies currently 'no "source" cmd' and no loading of encoding files. In the generic case this functionality can the reimplemented by direct OS calls without using the channel system. Makes the implementation platform dependent. As Cisco doesn't want this functionality we disable them without adding a new implementation. Implies that channels cannot be moved/shared between master/slave interps. (seek is removed under the assumption that the std* channels are not seekable) [/] Tcl_Eof, Tcl_InputBlocked stay because they are required by [gets]. [+] Tcl_SetChannelOption stays, required for initial config of std channels. [=] Implies no socket servers. Reason: Accept callback for socket server is done through fev's [%] Ripping the filesystem intrudes heavily on the startup sequence of the interpreter as auto_path, package paths, etc. can't be initialized anymore. This also cuts into the initialization of encodings. Given that encodings will be changed later to not use UTF internally this is no big deal. For Cisco. Others might want to have 'no fs', but UTF. We have to check that the startup sequence is still operational. Given that without a FS loading of encoding from files is impossible the loss of initialization is again not so big a deal. ------------------------------------------------------------------------ ------------------------------------------------------------------------ ------------------------------------------------------------------------ Handling of stub table when cutting features: 1. Disable all functions for the feature, from the bottom up to the top (script level command). This includes full disabling of stub functions too. The bottom-up approach enforces link errors in the higher levels and thus allows us to use the compiler to find all relevant places where we have to cut. Cutting stub functions is essential to find everything. 2. Go through the functions causing link errors in tclStubInit.o == stub functions. Add variants which are empty, return errors etc. and compile these when the feature is disabled. ** Changed ** Add suppressor definitions to "tcl*.decls" and regen the code. ------------------------------------------------------------------------ ------------------------------------------------------------------------ ------------------------------------------------------------------------ Future: Implement a mechanism for 'tcl.decls' which allows the definition of (static, loadable) sub packages. So that the stub table is minimally initialized and sub packages initialize their slots when loaded. ------------------------------------------------------------------------ ------------------------------------------------------------------------ ------------------------------------------------------------------------ |
Changes to generic/tcl.decls.
1 2 3 4 5 6 7 8 9 10 11 12 | # tcl.decls -- # # This file contains the declarations for all supported public # functions that are exported by the Tcl library via the stubs table. # This file is used to generate the tclDecls.h, tclPlatDecls.h, # tclStub.c, and tclPlatStub.c files. # # # Copyright (c) 1998-1999 by Scriptics Corporation. # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # tcl.decls -- # # This file contains the declarations for all supported public # functions that are exported by the Tcl library via the stubs table. # This file is used to generate the tclDecls.h, tclPlatDecls.h, # tclStub.c, and tclPlatStub.c files. # # # Copyright (c) 1998-1999 by Scriptics Corporation. # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # RCS: @(#) $Id: tcl.decls,v 1.33.2.2.2.1 2001/11/28 17:58:35 andreas_kupries Exp $ library tcl # Define the tcl interface with several sub interfaces: # tclPlat - platform specific public # tclInt - generic private # tclPlatInt - platform specific private |
︙ | ︙ | |||
56 57 58 59 60 61 62 | char * Tcl_DbCkrealloc(char *ptr, unsigned int size, char *file, int line) } # Tcl_CreateFileHandler and Tcl_DeleteFileHandler are only available on unix, # but they are part of the old generic interface, so we include them here for # compatibility reasons. | | | | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | char * Tcl_DbCkrealloc(char *ptr, unsigned int size, char *file, int line) } # Tcl_CreateFileHandler and Tcl_DeleteFileHandler are only available on unix, # but they are part of the old generic interface, so we include them here for # compatibility reasons. declare 9 unix {TCL_NO_FILEEVENTS} { void Tcl_CreateFileHandler(int fd, int mask, Tcl_FileProc *proc, \ ClientData clientData) } declare 10 unix {TCL_NO_FILEEVENTS} { void Tcl_DeleteFileHandler(int fd) } declare 11 generic { void Tcl_SetTimer(Tcl_Time *timePtr) } declare 12 generic { |
︙ | ︙ | |||
306 307 308 309 310 311 312 | declare 84 generic { int Tcl_ConvertElement(CONST char *src, char *dst, int flags) } declare 85 generic { int Tcl_ConvertCountedElement(CONST char *src, int length, char *dst, \ int flags) } | | | | | 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | declare 84 generic { int Tcl_ConvertElement(CONST char *src, char *dst, int flags) } declare 85 generic { int Tcl_ConvertCountedElement(CONST char *src, int length, char *dst, \ int flags) } declare 86 generic {TCL_NO_CMDALIASES} { int Tcl_CreateAlias(Tcl_Interp *slave, char *slaveCmd, \ Tcl_Interp *target, char *targetCmd, int argc, char **argv) } declare 87 generic {TCL_NO_CMDALIASES} { int Tcl_CreateAliasObj(Tcl_Interp *slave, char *slaveCmd, \ Tcl_Interp *target, char *targetCmd, int objc, \ Tcl_Obj *CONST objv[]) } declare 88 generic { Tcl_Channel Tcl_CreateChannel(Tcl_ChannelType *typePtr, char *chanName, \ ClientData instanceData, int mask) } declare 89 generic {TCL_NO_FILEEVENTS} { void Tcl_CreateChannelHandler(Tcl_Channel chan, int mask, \ Tcl_ChannelProc *proc, ClientData clientData) } declare 90 generic { void Tcl_CreateCloseHandler(Tcl_Channel chan, Tcl_CloseProc *proc, \ ClientData clientData) } |
︙ | ︙ | |||
351 352 353 354 355 356 357 | Tcl_ValueType *argTypes, Tcl_MathProc *proc, ClientData clientData) } declare 96 generic { Tcl_Command Tcl_CreateObjCommand(Tcl_Interp *interp, char *cmdName, \ Tcl_ObjCmdProc *proc, ClientData clientData, \ Tcl_CmdDeleteProc *deleteProc) } | | | | 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 | Tcl_ValueType *argTypes, Tcl_MathProc *proc, ClientData clientData) } declare 96 generic { Tcl_Command Tcl_CreateObjCommand(Tcl_Interp *interp, char *cmdName, \ Tcl_ObjCmdProc *proc, ClientData clientData, \ Tcl_CmdDeleteProc *deleteProc) } declare 97 generic {TCL_NO_SLAVEINTERP} { Tcl_Interp * Tcl_CreateSlave(Tcl_Interp *interp, char *slaveName, \ int isSafe) } declare 98 generic { Tcl_TimerToken Tcl_CreateTimerHandler(int milliseconds, \ Tcl_TimerProc *proc, ClientData clientData) } declare 99 generic { Tcl_Trace Tcl_CreateTrace(Tcl_Interp *interp, int level, \ Tcl_CmdTraceProc *proc, ClientData clientData) } declare 100 generic { void Tcl_DeleteAssocData(Tcl_Interp *interp, char *name) } declare 101 generic {TCL_NO_FILEEVENTS} { void Tcl_DeleteChannelHandler(Tcl_Channel chan, Tcl_ChannelProc *proc, \ ClientData clientData) } declare 102 generic { void Tcl_DeleteCloseHandler(Tcl_Channel chan, Tcl_CloseProc *proc, \ ClientData clientData) } |
︙ | ︙ | |||
399 400 401 402 403 404 405 | } declare 109 generic { void Tcl_DeleteHashTable(Tcl_HashTable *tablePtr) } declare 110 generic { void Tcl_DeleteInterp(Tcl_Interp *interp) } | | | 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 | } declare 109 generic { void Tcl_DeleteHashTable(Tcl_HashTable *tablePtr) } declare 110 generic { void Tcl_DeleteInterp(Tcl_Interp *interp) } declare 111 {unix win} {TCL_NO_PIPES} { void Tcl_DetachPids(int numPids, Tcl_Pid *pidPtr) } declare 112 generic { void Tcl_DeleteTimerHandler(Tcl_TimerToken token) } declare 113 generic { void Tcl_DeleteTrace(Tcl_Interp *interp, Tcl_Trace trace) |
︙ | ︙ | |||
457 458 459 460 461 462 463 | } declare 128 generic { char * Tcl_ErrnoMsg(int err) } declare 129 generic { int Tcl_Eval(Tcl_Interp *interp, char *string) } | | | 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 | } declare 128 generic { char * Tcl_ErrnoMsg(int err) } declare 129 generic { int Tcl_Eval(Tcl_Interp *interp, char *string) } declare 130 generic {TCL_NO_FILESYSTEM TCL_NO_NONSTDCHAN} { int Tcl_EvalFile(Tcl_Interp *interp, char *fileName) } declare 131 generic { int Tcl_EvalObj(Tcl_Interp *interp, Tcl_Obj *objPtr) } declare 132 generic { void Tcl_EventuallyFree(ClientData clientData, Tcl_FreeProc *freeProc) |
︙ | ︙ | |||
514 515 516 517 518 519 520 | } declare 146 generic { int Tcl_Flush(Tcl_Channel chan) } declare 147 generic { void Tcl_FreeResult(Tcl_Interp *interp) } | | | | 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 | } declare 146 generic { int Tcl_Flush(Tcl_Channel chan) } declare 147 generic { void Tcl_FreeResult(Tcl_Interp *interp) } declare 148 generic {TCL_NO_CMDALIASES} { int Tcl_GetAlias(Tcl_Interp *interp, char *slaveCmd, \ Tcl_Interp **targetInterpPtr, char **targetCmdPtr, int *argcPtr, \ char ***argvPtr) } declare 149 generic {TCL_NO_CMDALIASES} { int Tcl_GetAliasObj(Tcl_Interp *interp, char *slaveCmd, \ Tcl_Interp **targetInterpPtr, char **targetCmdPtr, int *objcPtr, \ Tcl_Obj ***objv) } declare 150 generic { ClientData Tcl_GetAssocData(Tcl_Interp *interp, char *name, \ Tcl_InterpDeleteProc **procPtr) |
︙ | ︙ | |||
548 549 550 551 552 553 554 | } declare 155 generic { int Tcl_GetChannelMode(Tcl_Channel chan) } declare 156 generic { char * Tcl_GetChannelName(Tcl_Channel chan) } | | | | | | | 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 | } declare 155 generic { int Tcl_GetChannelMode(Tcl_Channel chan) } declare 156 generic { char * Tcl_GetChannelName(Tcl_Channel chan) } declare 157 generic {TCL_NO_CHANNEL_CONFIG} { int Tcl_GetChannelOption(Tcl_Interp *interp, Tcl_Channel chan, \ char *optionName, Tcl_DString *dsPtr) } declare 158 generic { Tcl_ChannelType * Tcl_GetChannelType(Tcl_Channel chan) } declare 159 generic { int Tcl_GetCommandInfo(Tcl_Interp *interp, char *cmdName, \ Tcl_CmdInfo *infoPtr) } declare 160 generic { char * Tcl_GetCommandName(Tcl_Interp *interp, Tcl_Command command) } declare 161 generic { int Tcl_GetErrno(void) } declare 162 generic { char * Tcl_GetHostName(void) } declare 163 generic {{TCL_NO_SLAVEINTERP TCL_NO_CMDALIASES}} { int Tcl_GetInterpPath(Tcl_Interp *askInterp, Tcl_Interp *slaveInterp) } declare 164 generic {{TCL_NO_SLAVEINTERP TCL_NO_CMDALIASES}} { Tcl_Interp * Tcl_GetMaster(Tcl_Interp *interp) } declare 165 generic { CONST char * Tcl_GetNameOfExecutable(void) } declare 166 generic { Tcl_Obj * Tcl_GetObjResult(Tcl_Interp *interp) } # Tcl_GetOpenFile is only available on unix, but it is a part of the old # generic interface, so we inlcude it here for compatibility reasons. declare 167 unix { int Tcl_GetOpenFile(Tcl_Interp *interp, char *str, int forWriting, \ int checkUsage, ClientData *filePtr) } declare 168 generic {TCL_NO_FILESYSTEM} { Tcl_PathType Tcl_GetPathType(char *path) } declare 169 generic { int Tcl_Gets(Tcl_Channel chan, Tcl_DString *dsPtr) } declare 170 generic { int Tcl_GetsObj(Tcl_Channel chan, Tcl_Obj *objPtr) } declare 171 generic { int Tcl_GetServiceMode(void) } declare 172 generic {{TCL_NO_SLAVEINTERP TCL_NO_CMDALIASES}} { Tcl_Interp * Tcl_GetSlave(Tcl_Interp *interp, char *slaveName) } declare 173 generic { Tcl_Channel Tcl_GetStdChannel(int type) } declare 174 generic { char * Tcl_GetStringResult(Tcl_Interp *interp) |
︙ | ︙ | |||
644 645 646 647 648 649 650 | } declare 184 generic { int Tcl_InterpDeleted(Tcl_Interp *interp) } declare 185 generic { int Tcl_IsSafe(Tcl_Interp *interp) } | | | | | | | | | 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 | } declare 184 generic { int Tcl_InterpDeleted(Tcl_Interp *interp) } declare 185 generic { int Tcl_IsSafe(Tcl_Interp *interp) } declare 186 generic {TCL_NO_FILESYSTEM} { char * Tcl_JoinPath(int argc, char **argv, Tcl_DString *resultPtr) } declare 187 generic { int Tcl_LinkVar(Tcl_Interp *interp, char *varName, char *addr, int type) } # This slot is reserved for use by the plus patch: # declare 188 generic { # Tcl_MainLoop # } declare 189 generic { Tcl_Channel Tcl_MakeFileChannel(ClientData handle, int mode) } declare 190 generic { int Tcl_MakeSafe(Tcl_Interp *interp) } declare 191 generic {TCL_NO_SOCKETS} { Tcl_Channel Tcl_MakeTcpClientChannel(ClientData tcpSocket) } declare 192 generic { char * Tcl_Merge(int argc, char **argv) } declare 193 generic { Tcl_HashEntry * Tcl_NextHashEntry(Tcl_HashSearch *searchPtr) } declare 194 generic {TCL_NO_FILEEVENTS} { void Tcl_NotifyChannel(Tcl_Channel channel, int mask) } declare 195 generic { Tcl_Obj * Tcl_ObjGetVar2(Tcl_Interp *interp, Tcl_Obj *part1Ptr, \ Tcl_Obj *part2Ptr, int flags) } declare 196 generic { Tcl_Obj * Tcl_ObjSetVar2(Tcl_Interp *interp, Tcl_Obj *part1Ptr, \ Tcl_Obj *part2Ptr, Tcl_Obj *newValuePtr, int flags) } declare 197 {unix win} {TCL_NO_FILESYSTEM TCL_NO_PIPES} { Tcl_Channel Tcl_OpenCommandChannel(Tcl_Interp *interp, int argc, \ char **argv, int flags) } declare 198 generic {TCL_NO_FILESYSTEM TCL_NO_FILEEVENTS} { Tcl_Channel Tcl_OpenFileChannel(Tcl_Interp *interp, char *fileName, \ char *modeString, int permissions) } declare 199 generic {TCL_NO_SOCKETS} { Tcl_Channel Tcl_OpenTcpClient(Tcl_Interp *interp, int port, \ char *address, char *myaddr, int myport, int async) } declare 200 generic {TCL_NO_SOCKETS TCL_NO_FILEEVENTS} { Tcl_Channel Tcl_OpenTcpServer(Tcl_Interp *interp, int port, char *host, \ Tcl_TcpAcceptProc *acceptProc, ClientData callbackData) } declare 201 generic { void Tcl_Preserve(ClientData data) } declare 202 generic { |
︙ | ︙ | |||
716 717 718 719 720 721 722 | } declare 205 generic { void Tcl_QueueEvent(Tcl_Event *evPtr, Tcl_QueuePosition position) } declare 206 generic { int Tcl_Read(Tcl_Channel chan, char *bufPtr, int toRead) } | | | | 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 | } declare 205 generic { void Tcl_QueueEvent(Tcl_Event *evPtr, Tcl_QueuePosition position) } declare 206 generic { int Tcl_Read(Tcl_Channel chan, char *bufPtr, int toRead) } declare 207 {unix win} {TCL_NO_PIPES} { void Tcl_ReapDetachedProcs(void) } declare 208 generic { int Tcl_RecordAndEval(Tcl_Interp *interp, char *cmd, int flags) } declare 209 generic { int Tcl_RecordAndEvalObj(Tcl_Interp *interp, Tcl_Obj *cmdPtr, int flags) } declare 210 generic {TCL_NO_NONSTDCHAN} { void Tcl_RegisterChannel(Tcl_Interp *interp, Tcl_Channel chan) } declare 211 generic { void Tcl_RegisterObjType(Tcl_ObjType *typePtr) } declare 212 generic { Tcl_RegExp Tcl_RegExpCompile(Tcl_Interp *interp, char *string) |
︙ | ︙ | |||
757 758 759 760 761 762 763 | } declare 218 generic { int Tcl_ScanElement(CONST char *str, int *flagPtr) } declare 219 generic { int Tcl_ScanCountedElement(CONST char *str, int length, int *flagPtr) } | | | 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 | } declare 218 generic { int Tcl_ScanElement(CONST char *str, int *flagPtr) } declare 219 generic { int Tcl_ScanCountedElement(CONST char *str, int length, int *flagPtr) } declare 220 generic {TCL_NO_NONSTDCHAN} { int Tcl_Seek(Tcl_Channel chan, int offset, int mode) } declare 221 generic { int Tcl_ServiceAll(void) } declare 222 generic { int Tcl_ServiceEvent(int flags) |
︙ | ︙ | |||
833 834 835 836 837 838 839 | declare 241 generic { void Tcl_SourceRCFile(Tcl_Interp *interp) } declare 242 generic { int Tcl_SplitList(Tcl_Interp *interp, CONST char *listStr, int *argcPtr, \ char ***argvPtr) } | | | | 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 | declare 241 generic { void Tcl_SourceRCFile(Tcl_Interp *interp) } declare 242 generic { int Tcl_SplitList(Tcl_Interp *interp, CONST char *listStr, int *argcPtr, \ char ***argvPtr) } declare 243 generic {TCL_NO_FILESYSTEM} { void Tcl_SplitPath(CONST char *path, int *argcPtr, char ***argvPtr) } declare 244 generic { void Tcl_StaticPackage(Tcl_Interp *interp, char *pkgName, \ Tcl_PackageInitProc *initProc, Tcl_PackageInitProc *safeInitProc) } declare 245 generic { int Tcl_StringMatch(CONST char *str, CONST char *pattern) } declare 246 generic { int Tcl_Tell(Tcl_Channel chan) } declare 247 generic { int Tcl_TraceVar(Tcl_Interp *interp, char *varName, int flags, \ Tcl_VarTraceProc *proc, ClientData clientData) } declare 248 generic { int Tcl_TraceVar2(Tcl_Interp *interp, char *part1, char *part2, \ int flags, Tcl_VarTraceProc *proc, ClientData clientData) } declare 249 generic {TCL_NO_FILESYSTEM} { char * Tcl_TranslateFileName(Tcl_Interp *interp, char *name, \ Tcl_DString *bufferPtr) } declare 250 generic { int Tcl_Ungets(Tcl_Channel chan, char *str, int len, int atHead) } declare 251 generic { |
︙ | ︙ | |||
950 951 952 953 954 955 956 | } declare 275 generic { void Tcl_SetErrorCodeVA(Tcl_Interp *interp, va_list argList) } declare 276 generic { int Tcl_VarEvalVA(Tcl_Interp *interp, va_list argList) } | | | 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 | } declare 275 generic { void Tcl_SetErrorCodeVA(Tcl_Interp *interp, va_list argList) } declare 276 generic { int Tcl_VarEvalVA(Tcl_Interp *interp, va_list argList) } declare 277 generic {TCL_NO_PIPES} { Tcl_Pid Tcl_WaitPid(Tcl_Pid pid, int *statPtr, int options) } declare 278 {unix win} { void Tcl_PanicVA(char *format, va_list argList) } declare 279 generic { void Tcl_GetVersion(int *major, int *minor, int *patchLevel, int *type) |
︙ | ︙ | |||
1090 1091 1092 1093 1094 1095 1096 | declare 311 generic { void Tcl_ConditionWait(Tcl_Condition *condPtr, Tcl_Mutex *mutexPtr, \ Tcl_Time *timePtr) } declare 312 generic { int Tcl_NumUtfChars(CONST char *src, int len) } | | | 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 | declare 311 generic { void Tcl_ConditionWait(Tcl_Condition *condPtr, Tcl_Mutex *mutexPtr, \ Tcl_Time *timePtr) } declare 312 generic { int Tcl_NumUtfChars(CONST char *src, int len) } declare 313 generic {{TCL_NO_CHANNEL_READ TCL_NO_PIPES}} { int Tcl_ReadChars(Tcl_Channel channel, Tcl_Obj *objPtr, int charsToRead, \ int appendFlag) } declare 314 generic { void Tcl_RestoreResult(Tcl_Interp *interp, Tcl_SavedResult *statePtr) } declare 315 generic { |
︙ | ︙ | |||
1181 1182 1183 1184 1185 1186 1187 | } declare 339 generic { int Tcl_WriteObj(Tcl_Channel chan, Tcl_Obj *objPtr) } declare 340 generic { char * Tcl_GetString(Tcl_Obj *objPtr) } | | | | 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 | } declare 339 generic { int Tcl_WriteObj(Tcl_Channel chan, Tcl_Obj *objPtr) } declare 340 generic { char * Tcl_GetString(Tcl_Obj *objPtr) } declare 341 generic {TCL_NO_FILESYSTEM} { char * Tcl_GetDefaultEncodingDir(void) } declare 342 generic {TCL_NO_FILESYSTEM} { void Tcl_SetDefaultEncodingDir(char *path) } declare 343 generic { void Tcl_AlertNotifier(ClientData clientData) } declare 344 generic { void Tcl_ServiceModeHook(int mode) |
︙ | ︙ | |||
1264 1265 1266 1267 1268 1269 1270 | int Tcl_ParseQuotedString(Tcl_Interp *interp, char *string, int numBytes, \ Tcl_Parse *parsePtr, int append, char **termPtr) } declare 364 generic { int Tcl_ParseVarName (Tcl_Interp *interp, char *string, \ int numBytes, Tcl_Parse *parsePtr, int append) } | | | | | | 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 | int Tcl_ParseQuotedString(Tcl_Interp *interp, char *string, int numBytes, \ Tcl_Parse *parsePtr, int append, char **termPtr) } declare 364 generic { int Tcl_ParseVarName (Tcl_Interp *interp, char *string, \ int numBytes, Tcl_Parse *parsePtr, int append) } declare 365 generic {TCL_NO_FILESYSTEM} { char *Tcl_GetCwd(Tcl_Interp *interp, Tcl_DString *cwdPtr) } declare 366 generic {TCL_NO_FILESYSTEM} { int Tcl_Chdir(CONST char *dirName) } declare 367 generic {TCL_NO_FILESYSTEM} { int Tcl_Access(CONST char *path, int mode) } declare 368 generic {TCL_NO_FILESYSTEM} { int Tcl_Stat(CONST char *path, struct stat *bufPtr) } declare 369 generic { int Tcl_UtfNcmp(CONST char *s1, CONST char *s2, unsigned long n) } declare 370 generic { int Tcl_UtfNcasecmp(CONST char *s1, CONST char *s2, unsigned long n) |
︙ | ︙ |
Changes to generic/tcl.h.
︙ | ︙ | |||
8 9 10 11 12 13 14 | * Copyright (c) 1993-1996 Lucent Technologies. * Copyright (c) 1994-1998 Sun Microsystems, Inc. * Copyright (c) 1998-2000 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | * Copyright (c) 1993-1996 Lucent Technologies. * Copyright (c) 1994-1998 Sun Microsystems, Inc. * Copyright (c) 1998-2000 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tcl.h,v 1.70.2.9.2.1 2001/11/28 17:58:35 andreas_kupries Exp $ */ #ifndef _TCL #define _TCL /* * For C++ compilers, use extern "C" */ #ifdef __cplusplus extern "C" { #endif /* The following are * - a clause to activate all macros cutting features out of the core. * - feature dependencies */ #ifdef MODULAR_TCL #define TCL_NO_SOCKETS /* Disable "tcp" channel driver */ #define TCL_NO_TTY /* Disable "tty" channel driver */ #define TCL_NO_PIPES /* Disable "pipe" channel driver */ #define TCL_NO_PIDCMD /* Disable "pid" command */ #define TCL_NO_NONSTDCHAN /* Disable creation of channels beyond std* */ #define TCL_NO_CHANNELCOPY /* Disable channel copying, C/Tcl [fcopy] */ #define TCL_NO_CHANNEL_READ /* Disable Tcl_ReadChars, [read] */ #define TCL_NO_CHANNEL_EOF /* Disable [eof] */ #define TCL_NO_CHANNEL_CONFIG /* Disable [fconfigure] and Tcl_GetChannelOption */ #define TCL_NO_CHANNEL_BLOCKED /* Disable [fblocked] */ #define TCL_NO_FILEEVENTS /* Disable [fileevent] and underlying APIs */ #define TCL_NO_FILESYSTEM /* Disable everything related to the filesystem */ #define TCL_NO_LOADCMD /* Disable [load] and machinery below */ #define TCL_NO_SLAVEINTERP /* No slave interp's */ #define TCL_NO_CMDALIASES /* No command aliases */ #endif #ifdef TCL_NO_NONSTDCHAN #define TCL_NO_SOCKETS /* Disable "tcp" channel driver */ #define TCL_NO_TTY /* Disable "tty" channel driver */ #define TCL_NO_PIPES /* Disable "pipe" channel driver */ #endif /* * The following defines are used to indicate the various release levels. */ #define TCL_ALPHA_RELEASE 0 #define TCL_BETA_RELEASE 1 #define TCL_FINAL_RELEASE 2 |
︙ | ︙ |
Changes to generic/tclBasic.c.
︙ | ︙ | |||
8 9 10 11 12 13 14 | * Copyright (c) 1987-1994 The Regents of the University of California. * Copyright (c) 1994-1997 Sun Microsystems, Inc. * Copyright (c) 1998-1999 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | * Copyright (c) 1987-1994 The Regents of the University of California. * Copyright (c) 1994-1997 Sun Microsystems, Inc. * Copyright (c) 1998-1999 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclBasic.c,v 1.27.6.1 2001/11/28 17:58:35 andreas_kupries Exp $ */ #include "tclInt.h" #include "tclCompile.h" #ifndef TCL_GENERIC_ONLY # include "tclPort.h" #endif |
︙ | ︙ | |||
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | (CompileProc *) NULL, 1}, {"eval", (Tcl_CmdProc *) NULL, Tcl_EvalObjCmd, (CompileProc *) NULL, 1}, {"exit", (Tcl_CmdProc *) NULL, Tcl_ExitObjCmd, (CompileProc *) NULL, 0}, {"expr", (Tcl_CmdProc *) NULL, Tcl_ExprObjCmd, TclCompileExprCmd, 1}, {"fcopy", (Tcl_CmdProc *) NULL, Tcl_FcopyObjCmd, (CompileProc *) NULL, 1}, {"fileevent", (Tcl_CmdProc *) NULL, Tcl_FileEventObjCmd, (CompileProc *) NULL, 1}, {"for", (Tcl_CmdProc *) NULL, Tcl_ForObjCmd, TclCompileForCmd, 1}, {"foreach", (Tcl_CmdProc *) NULL, Tcl_ForeachObjCmd, TclCompileForeachCmd, 1}, {"format", (Tcl_CmdProc *) NULL, Tcl_FormatObjCmd, (CompileProc *) NULL, 1}, {"global", (Tcl_CmdProc *) NULL, Tcl_GlobalObjCmd, | > > > > | 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | (CompileProc *) NULL, 1}, {"eval", (Tcl_CmdProc *) NULL, Tcl_EvalObjCmd, (CompileProc *) NULL, 1}, {"exit", (Tcl_CmdProc *) NULL, Tcl_ExitObjCmd, (CompileProc *) NULL, 0}, {"expr", (Tcl_CmdProc *) NULL, Tcl_ExprObjCmd, TclCompileExprCmd, 1}, #ifndef TCL_NO_CHANNELCOPY {"fcopy", (Tcl_CmdProc *) NULL, Tcl_FcopyObjCmd, (CompileProc *) NULL, 1}, #endif #ifndef TCL_NO_FILEEVENTS {"fileevent", (Tcl_CmdProc *) NULL, Tcl_FileEventObjCmd, (CompileProc *) NULL, 1}, #endif {"for", (Tcl_CmdProc *) NULL, Tcl_ForObjCmd, TclCompileForCmd, 1}, {"foreach", (Tcl_CmdProc *) NULL, Tcl_ForeachObjCmd, TclCompileForeachCmd, 1}, {"format", (Tcl_CmdProc *) NULL, Tcl_FormatObjCmd, (CompileProc *) NULL, 1}, {"global", (Tcl_CmdProc *) NULL, Tcl_GlobalObjCmd, |
︙ | ︙ | |||
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | (CompileProc *) NULL, 1}, {"linsert", (Tcl_CmdProc *) NULL, Tcl_LinsertObjCmd, (CompileProc *) NULL, 1}, {"list", (Tcl_CmdProc *) NULL, Tcl_ListObjCmd, (CompileProc *) NULL, 1}, {"llength", (Tcl_CmdProc *) NULL, Tcl_LlengthObjCmd, (CompileProc *) NULL, 1}, {"load", (Tcl_CmdProc *) NULL, Tcl_LoadObjCmd, (CompileProc *) NULL, 0}, {"lrange", (Tcl_CmdProc *) NULL, Tcl_LrangeObjCmd, (CompileProc *) NULL, 1}, {"lreplace", (Tcl_CmdProc *) NULL, Tcl_LreplaceObjCmd, (CompileProc *) NULL, 1}, {"lsearch", (Tcl_CmdProc *) NULL, Tcl_LsearchObjCmd, (CompileProc *) NULL, 1}, {"lsort", (Tcl_CmdProc *) NULL, Tcl_LsortObjCmd, | > > > > | 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | (CompileProc *) NULL, 1}, {"linsert", (Tcl_CmdProc *) NULL, Tcl_LinsertObjCmd, (CompileProc *) NULL, 1}, {"list", (Tcl_CmdProc *) NULL, Tcl_ListObjCmd, (CompileProc *) NULL, 1}, {"llength", (Tcl_CmdProc *) NULL, Tcl_LlengthObjCmd, (CompileProc *) NULL, 1}, #ifndef TCL_NO_FILESYSTEM #ifndef TCL_NO_LOADCMD {"load", (Tcl_CmdProc *) NULL, Tcl_LoadObjCmd, (CompileProc *) NULL, 0}, #endif #endif {"lrange", (Tcl_CmdProc *) NULL, Tcl_LrangeObjCmd, (CompileProc *) NULL, 1}, {"lreplace", (Tcl_CmdProc *) NULL, Tcl_LreplaceObjCmd, (CompileProc *) NULL, 1}, {"lsearch", (Tcl_CmdProc *) NULL, Tcl_LsearchObjCmd, (CompileProc *) NULL, 1}, {"lsort", (Tcl_CmdProc *) NULL, Tcl_LsortObjCmd, |
︙ | ︙ | |||
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | /* * Commands in the UNIX core: */ #ifndef TCL_GENERIC_ONLY {"after", (Tcl_CmdProc *) NULL, Tcl_AfterObjCmd, (CompileProc *) NULL, 1}, {"cd", (Tcl_CmdProc *) NULL, Tcl_CdObjCmd, (CompileProc *) NULL, 0}, {"close", (Tcl_CmdProc *) NULL, Tcl_CloseObjCmd, (CompileProc *) NULL, 1}, {"eof", (Tcl_CmdProc *) NULL, Tcl_EofObjCmd, (CompileProc *) NULL, 1}, {"fblocked", (Tcl_CmdProc *) NULL, Tcl_FblockedObjCmd, (CompileProc *) NULL, 1}, {"fconfigure", (Tcl_CmdProc *) NULL, Tcl_FconfigureObjCmd, (CompileProc *) NULL, 0}, {"file", (Tcl_CmdProc *) NULL, Tcl_FileObjCmd, (CompileProc *) NULL, 0}, {"flush", (Tcl_CmdProc *) NULL, Tcl_FlushObjCmd, (CompileProc *) NULL, 1}, {"gets", (Tcl_CmdProc *) NULL, Tcl_GetsObjCmd, (CompileProc *) NULL, 1}, {"glob", (Tcl_CmdProc *) NULL, Tcl_GlobObjCmd, (CompileProc *) NULL, 0}, {"open", (Tcl_CmdProc *) NULL, Tcl_OpenObjCmd, (CompileProc *) NULL, 0}, {"pid", (Tcl_CmdProc *) NULL, Tcl_PidObjCmd, (CompileProc *) NULL, 1}, {"puts", (Tcl_CmdProc *) NULL, Tcl_PutsObjCmd, (CompileProc *) NULL, 1}, {"pwd", (Tcl_CmdProc *) NULL, Tcl_PwdObjCmd, (CompileProc *) NULL, 0}, {"read", (Tcl_CmdProc *) NULL, Tcl_ReadObjCmd, (CompileProc *) NULL, 1}, {"seek", (Tcl_CmdProc *) NULL, Tcl_SeekObjCmd, (CompileProc *) NULL, 1}, {"socket", (Tcl_CmdProc *) NULL, Tcl_SocketObjCmd, (CompileProc *) NULL, 0}, {"tell", (Tcl_CmdProc *) NULL, Tcl_TellObjCmd, (CompileProc *) NULL, 1}, {"time", (Tcl_CmdProc *) NULL, Tcl_TimeObjCmd, (CompileProc *) NULL, 1}, {"update", (Tcl_CmdProc *) NULL, Tcl_UpdateObjCmd, (CompileProc *) NULL, 1}, {"vwait", (Tcl_CmdProc *) NULL, Tcl_VwaitObjCmd, (CompileProc *) NULL, 1}, #ifdef MAC_TCL {"beep", (Tcl_CmdProc *) NULL, Tcl_BeepObjCmd, (CompileProc *) NULL, 0}, {"echo", Tcl_EchoCmd, (Tcl_ObjCmdProc *) NULL, (CompileProc *) NULL, 0}, {"ls", (Tcl_CmdProc *) NULL, Tcl_LsObjCmd, (CompileProc *) NULL, 0}, {"resource", (Tcl_CmdProc *) NULL, Tcl_ResourceObjCmd, (CompileProc *) NULL, 1}, {"source", (Tcl_CmdProc *) NULL, Tcl_MacSourceObjCmd, (CompileProc *) NULL, 0}, #else {"exec", (Tcl_CmdProc *) NULL, Tcl_ExecObjCmd, (CompileProc *) NULL, 0}, {"source", (Tcl_CmdProc *) NULL, Tcl_SourceObjCmd, (CompileProc *) NULL, 0}, #endif /* MAC_TCL */ #endif /* TCL_GENERIC_ONLY */ {NULL, (Tcl_CmdProc *) NULL, (Tcl_ObjCmdProc *) NULL, (CompileProc *) NULL, 0} }; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | /* * Commands in the UNIX core: */ #ifndef TCL_GENERIC_ONLY {"after", (Tcl_CmdProc *) NULL, Tcl_AfterObjCmd, (CompileProc *) NULL, 1}, #ifndef TCL_NO_FILESYSTEM {"cd", (Tcl_CmdProc *) NULL, Tcl_CdObjCmd, (CompileProc *) NULL, 0}, #endif #ifndef TCL_NO_NONSTDCHAN {"close", (Tcl_CmdProc *) NULL, Tcl_CloseObjCmd, (CompileProc *) NULL, 1}, #endif #ifndef TCL_NO_CHANNEL_EOF {"eof", (Tcl_CmdProc *) NULL, Tcl_EofObjCmd, (CompileProc *) NULL, 1}, #endif #ifndef TCL_NO_CHANNEL_BLOCKED {"fblocked", (Tcl_CmdProc *) NULL, Tcl_FblockedObjCmd, (CompileProc *) NULL, 1}, #endif #ifndef TCL_NO_CHANNEL_CONFIG {"fconfigure", (Tcl_CmdProc *) NULL, Tcl_FconfigureObjCmd, (CompileProc *) NULL, 0}, #endif #ifndef TCL_NO_FILESYSTEM {"file", (Tcl_CmdProc *) NULL, Tcl_FileObjCmd, (CompileProc *) NULL, 0}, #endif {"flush", (Tcl_CmdProc *) NULL, Tcl_FlushObjCmd, (CompileProc *) NULL, 1}, {"gets", (Tcl_CmdProc *) NULL, Tcl_GetsObjCmd, (CompileProc *) NULL, 1}, #ifndef TCL_NO_FILESYSTEM {"glob", (Tcl_CmdProc *) NULL, Tcl_GlobObjCmd, (CompileProc *) NULL, 0}, #endif #ifndef TCL_NO_FILESYSTEM #ifndef TCL_NO_NONSTDCHAN {"open", (Tcl_CmdProc *) NULL, Tcl_OpenObjCmd, (CompileProc *) NULL, 0}, #endif #endif #ifndef TCL_NO_PIDCMD {"pid", (Tcl_CmdProc *) NULL, Tcl_PidObjCmd, (CompileProc *) NULL, 1}, #endif {"puts", (Tcl_CmdProc *) NULL, Tcl_PutsObjCmd, (CompileProc *) NULL, 1}, #ifndef TCL_NO_FILESYSTEM {"pwd", (Tcl_CmdProc *) NULL, Tcl_PwdObjCmd, (CompileProc *) NULL, 0}, #endif #ifndef TCL_NO_CHANNEL_READ {"read", (Tcl_CmdProc *) NULL, Tcl_ReadObjCmd, (CompileProc *) NULL, 1}, #endif #ifndef TCL_NO_NONSTDCHAN {"seek", (Tcl_CmdProc *) NULL, Tcl_SeekObjCmd, (CompileProc *) NULL, 1}, #endif #ifndef TCL_NO_SOCKETS {"socket", (Tcl_CmdProc *) NULL, Tcl_SocketObjCmd, (CompileProc *) NULL, 0}, #endif {"tell", (Tcl_CmdProc *) NULL, Tcl_TellObjCmd, (CompileProc *) NULL, 1}, {"time", (Tcl_CmdProc *) NULL, Tcl_TimeObjCmd, (CompileProc *) NULL, 1}, {"update", (Tcl_CmdProc *) NULL, Tcl_UpdateObjCmd, (CompileProc *) NULL, 1}, {"vwait", (Tcl_CmdProc *) NULL, Tcl_VwaitObjCmd, (CompileProc *) NULL, 1}, #ifdef MAC_TCL {"beep", (Tcl_CmdProc *) NULL, Tcl_BeepObjCmd, (CompileProc *) NULL, 0}, {"echo", Tcl_EchoCmd, (Tcl_ObjCmdProc *) NULL, (CompileProc *) NULL, 0}, {"ls", (Tcl_CmdProc *) NULL, Tcl_LsObjCmd, (CompileProc *) NULL, 0}, {"resource", (Tcl_CmdProc *) NULL, Tcl_ResourceObjCmd, (CompileProc *) NULL, 1}, #ifndef TCL_NO_FILESYSTEM {"source", (Tcl_CmdProc *) NULL, Tcl_MacSourceObjCmd, (CompileProc *) NULL, 0}, #endif #else #ifndef TCL_NO_FILESYSTEM #ifndef TCL_NO_PIPES {"exec", (Tcl_CmdProc *) NULL, Tcl_ExecObjCmd, (CompileProc *) NULL, 0}, #endif #endif #ifndef TCL_NO_FILESYSTEM #ifndef TCL_NO_NONSTDCHAN /* IOS FIXME : in the generic case this functionality can be made * available, it just has to read the file directly instead of using * the channel system. This makes the code platform dependent. * * => See Tcl_EvalFile */ {"source", (Tcl_CmdProc *) NULL, Tcl_SourceObjCmd, (CompileProc *) NULL, 0}, #endif #endif /* TCL_NO_FILESYSTEM */ #endif /* MAC_TCL */ #endif /* TCL_GENERIC_ONLY */ {NULL, (Tcl_CmdProc *) NULL, (Tcl_ObjCmdProc *) NULL, (CompileProc *) NULL, 0} }; |
︙ | ︙ | |||
471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 | } mathFuncPtr = (MathFunc *) Tcl_GetHashValue(hPtr); mathFuncPtr->builtinFuncIndex = i; i++; } iPtr->flags |= EXPR_INITIALIZED; /* * Do Multiple/Safe Interps Tcl init stuff */ TclInterpInit(interp); /* * We used to create the "errorInfo" and "errorCode" global vars at this * point because so much of the Tcl implementation assumes they already * exist. This is not quite enough, however, since they can be unset * at any time. * | > > | 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 | } mathFuncPtr = (MathFunc *) Tcl_GetHashValue(hPtr); mathFuncPtr->builtinFuncIndex = i; i++; } iPtr->flags |= EXPR_INITIALIZED; #if !(defined(TCL_NO_SLAVEINTERP) && defined(TCL_NO_CMDALIASES)) /* * Do Multiple/Safe Interps Tcl init stuff */ TclInterpInit(interp); #endif /* !(defined(TCL_NO_SLAVEINTERP) && defined(TCL_NO_CMDALIASES)) */ /* * We used to create the "errorInfo" and "errorCode" global vars at this * point because so much of the Tcl implementation assumes they already * exist. This is not quite enough, however, since they can be unset * at any time. * |
︙ | ︙ | |||
1887 1888 1889 1890 1891 1892 1893 | { Interp *iPtr = (Interp *) interp; char *newTail; Namespace *cmdNsPtr, *newNsPtr, *dummy1, *dummy2; Tcl_Command cmd; Command *cmdPtr; Tcl_HashEntry *hPtr, *oldHPtr; | | > > > | 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 | { Interp *iPtr = (Interp *) interp; char *newTail; Namespace *cmdNsPtr, *newNsPtr, *dummy1, *dummy2; Tcl_Command cmd; Command *cmdPtr; Tcl_HashEntry *hPtr, *oldHPtr; int new; #ifndef TCL_NO_CMDALIASES int result; #endif /* * Find the existing command. An error is returned if cmdName can't * be found. */ cmd = Tcl_FindCommand(interp, oldName, (Tcl_Namespace *) NULL, |
︙ | ︙ | |||
1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 | oldHPtr = cmdPtr->hPtr; hPtr = Tcl_CreateHashEntry(&newNsPtr->cmdTable, newTail, &new); Tcl_SetHashValue(hPtr, (ClientData) cmdPtr); cmdPtr->hPtr = hPtr; cmdPtr->nsPtr = newNsPtr; TclResetShadowedCmdRefs(interp, cmdPtr); /* * Now check for an alias loop. If we detect one, put everything back * the way it was and report the error. */ result = TclPreventAliasLoop(interp, interp, (Tcl_Command) cmdPtr); if (result != TCL_OK) { Tcl_DeleteHashEntry(cmdPtr->hPtr); cmdPtr->hPtr = oldHPtr; cmdPtr->nsPtr = cmdNsPtr; return result; } /* * The new command name is okay, so remove the command from its * current namespace. This is like deleting the command, so bump * the cmdEpoch to invalidate any cached references to the command. */ | > > | 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 | oldHPtr = cmdPtr->hPtr; hPtr = Tcl_CreateHashEntry(&newNsPtr->cmdTable, newTail, &new); Tcl_SetHashValue(hPtr, (ClientData) cmdPtr); cmdPtr->hPtr = hPtr; cmdPtr->nsPtr = newNsPtr; TclResetShadowedCmdRefs(interp, cmdPtr); #ifndef TCL_NO_CMDALIASES /* * Now check for an alias loop. If we detect one, put everything back * the way it was and report the error. */ result = TclPreventAliasLoop(interp, interp, (Tcl_Command) cmdPtr); if (result != TCL_OK) { Tcl_DeleteHashEntry(cmdPtr->hPtr); cmdPtr->hPtr = oldHPtr; cmdPtr->nsPtr = cmdNsPtr; return result; } #endif /* * The new command name is okay, so remove the command from its * current namespace. This is like deleting the command, so bump * the cmdEpoch to invalidate any cached references to the command. */ |
︙ | ︙ |
Changes to generic/tclCmdAH.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tclCmdAH.c -- * * This file contains the top-level command routines for most of * the Tcl built-in commands whose names begin with the letters * A to H. * * Copyright (c) 1987-1993 The Regents of the University of California. * Copyright (c) 1994-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. * | | > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | /* * tclCmdAH.c -- * * This file contains the top-level command routines for most of * the Tcl built-in commands whose names begin with the letters * A to H. * * Copyright (c) 1987-1993 The Regents of the University of California. * Copyright (c) 1994-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: tclCmdAH.c,v 1.12.2.2.2.1 2001/11/28 17:58:35 andreas_kupries Exp $ */ #include "tclInt.h" #include "tclPort.h" #ifdef MAC_TCL #include "tclMacInt.h" #endif #include <locale.h> typedef int (StatProc)_ANSI_ARGS_((CONST char *path, struct stat *buf)); /* * Prototypes for local procedures defined in this file: */ #ifndef TCL_NO_FILESYSTEM static int CheckAccess _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *objPtr, int mode)); static int GetStatBuf _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *objPtr, StatProc *statProc, struct stat *statPtr)); static char * GetTypeFromMode _ANSI_ARGS_((int mode)); static int SplitPath _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *objPtr, int *argcPtr, char ***argvPtr)); static int StoreStatData _ANSI_ARGS_((Tcl_Interp *interp, char *varName, struct stat *statPtr)); static char ** StringifyObjects _ANSI_ARGS_((int objc, Tcl_Obj *CONST objv[])); #endif /* *---------------------------------------------------------------------- * * Tcl_BreakObjCmd -- * * This procedure is invoked to process the "break" Tcl command. |
︙ | ︙ | |||
298 299 300 301 302 303 304 305 306 307 308 309 310 311 | * * Side effects: * See the user documentation. * *---------------------------------------------------------------------- */ /* ARGSUSED */ int Tcl_CdObjCmd(dummy, interp, objc, objv) ClientData dummy; /* Not used. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ | > | 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | * * Side effects: * See the user documentation. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM /* ARGSUSED */ int Tcl_CdObjCmd(dummy, interp, objc, objv) ClientData dummy; /* Not used. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ |
︙ | ︙ | |||
334 335 336 337 338 339 340 341 342 343 344 345 346 347 | if (result != 0) { Tcl_AppendResult(interp, "couldn't change working directory to \"", dirName, "\": ", Tcl_PosixError(interp), (char *) NULL); return TCL_ERROR; } return TCL_OK; } /* *---------------------------------------------------------------------- * * Tcl_ConcatObjCmd -- * * This object-based procedure is invoked to process the "concat" Tcl | > | 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 | if (result != 0) { Tcl_AppendResult(interp, "couldn't change working directory to \"", dirName, "\": ", Tcl_PosixError(interp), (char *) NULL); return TCL_ERROR; } return TCL_OK; } #endif /* *---------------------------------------------------------------------- * * Tcl_ConcatObjCmd -- * * This object-based procedure is invoked to process the "concat" Tcl |
︙ | ︙ | |||
774 775 776 777 778 779 780 781 782 783 784 785 786 787 | * * Side effects: * See the user documentation. * *---------------------------------------------------------------------- */ /* ARGSUSED */ int Tcl_FileObjCmd(dummy, interp, objc, objv) ClientData dummy; /* Not used. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ | > | 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 | * * Side effects: * See the user documentation. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM /* ARGSUSED */ int Tcl_FileObjCmd(dummy, interp, objc, objv) ClientData dummy; /* Not used. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ |
︙ | ︙ | |||
1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 | } } only3Args: Tcl_WrongNumArgs(interp, 2, objv, "name"); return TCL_ERROR; } /* *--------------------------------------------------------------------------- * * SplitPath -- * * Utility procedure used by Tcl_FileObjCmd() to split a path. | > | 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 | } } only3Args: Tcl_WrongNumArgs(interp, 2, objv, "name"); return TCL_ERROR; } #endif /* *--------------------------------------------------------------------------- * * SplitPath -- * * Utility procedure used by Tcl_FileObjCmd() to split a path. |
︙ | ︙ | |||
1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 | * Side effects: * Memory allocated. The caller must eventually free this memory * by calling ckfree() on *argvPtr. * *--------------------------------------------------------------------------- */ static int SplitPath(interp, objPtr, argcPtr, argvPtr) Tcl_Interp *interp; /* Interp for error return. May be NULL. */ Tcl_Obj *objPtr; /* Path to be split. */ int *argcPtr; /* Filled with length of following array. */ char ***argvPtr; /* Filled with array of strings representing * the elements of the specified path. */ | > | 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 | * Side effects: * Memory allocated. The caller must eventually free this memory * by calling ckfree() on *argvPtr. * *--------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM static int SplitPath(interp, objPtr, argcPtr, argvPtr) Tcl_Interp *interp; /* Interp for error return. May be NULL. */ Tcl_Obj *objPtr; /* Path to be split. */ int *argcPtr; /* Filled with length of following array. */ char ***argvPtr; /* Filled with array of strings representing * the elements of the specified path. */ |
︙ | ︙ | |||
1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 | return TCL_ERROR; } Tcl_SplitPath(fileName, argcPtr, argvPtr); Tcl_DStringFree(&ds); } return TCL_OK; } /* *--------------------------------------------------------------------------- * * CheckAccess -- * * Utility procedure used by Tcl_FileObjCmd() to query file * attributes available through the access() system call. * * Results: * Always returns TCL_OK. Sets interp's result to boolean true or * false depending on whether the file has the specified attribute. * * Side effects: * None. * *--------------------------------------------------------------------------- */ static int CheckAccess(interp, objPtr, mode) Tcl_Interp *interp; /* Interp for status return. Must not be * NULL. */ Tcl_Obj *objPtr; /* Name of file to check. */ int mode; /* Attribute to check; passed as argument to * access(). */ | > > | 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 | return TCL_ERROR; } Tcl_SplitPath(fileName, argcPtr, argvPtr); Tcl_DStringFree(&ds); } return TCL_OK; } #endif /* *--------------------------------------------------------------------------- * * CheckAccess -- * * Utility procedure used by Tcl_FileObjCmd() to query file * attributes available through the access() system call. * * Results: * Always returns TCL_OK. Sets interp's result to boolean true or * false depending on whether the file has the specified attribute. * * Side effects: * None. * *--------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM static int CheckAccess(interp, objPtr, mode) Tcl_Interp *interp; /* Interp for status return. Must not be * NULL. */ Tcl_Obj *objPtr; /* Name of file to check. */ int mode; /* Attribute to check; passed as argument to * access(). */ |
︙ | ︙ | |||
1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 | value = (TclAccess(fileName, mode) == 0); Tcl_DStringFree(&ds); } Tcl_SetBooleanObj(Tcl_GetObjResult(interp), value); return TCL_OK; } /* *--------------------------------------------------------------------------- * * GetStatBuf -- * * Utility procedure used by Tcl_FileObjCmd() to query file | > | 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 | value = (TclAccess(fileName, mode) == 0); Tcl_DStringFree(&ds); } Tcl_SetBooleanObj(Tcl_GetObjResult(interp), value); return TCL_OK; } #endif /* *--------------------------------------------------------------------------- * * GetStatBuf -- * * Utility procedure used by Tcl_FileObjCmd() to query file |
︙ | ︙ | |||
1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 | * * Side effects: * None. * *--------------------------------------------------------------------------- */ static int GetStatBuf(interp, objPtr, statProc, statPtr) Tcl_Interp *interp; /* Interp for error return. May be NULL. */ Tcl_Obj *objPtr; /* Path name to examine. */ StatProc *statProc; /* Either stat() or lstat() depending on * desired behavior. */ struct stat *statPtr; /* Filled with info about file obtained by | > | 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 | * * Side effects: * None. * *--------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM static int GetStatBuf(interp, objPtr, statProc, statPtr) Tcl_Interp *interp; /* Interp for error return. May be NULL. */ Tcl_Obj *objPtr; /* Path name to examine. */ StatProc *statProc; /* Either stat() or lstat() depending on * desired behavior. */ struct stat *statPtr; /* Filled with info about file obtained by |
︙ | ︙ | |||
1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 | Tcl_GetString(objPtr), "\": ", Tcl_PosixError(interp), (char *) NULL); } return TCL_ERROR; } return TCL_OK; } /* *---------------------------------------------------------------------- * * StoreStatData -- * * This is a utility procedure that breaks out the fields of a * "stat" structure and stores them in textual form into the * elements of an associative array. * * Results: * Returns a standard Tcl return value. If an error occurs then * a message is left in interp's result. * * Side effects: * Elements of the associative array given by "varName" are modified. * *---------------------------------------------------------------------- */ static int StoreStatData(interp, varName, statPtr) Tcl_Interp *interp; /* Interpreter for error reports. */ char *varName; /* Name of associative array variable * in which to store stat results. */ struct stat *statPtr; /* Pointer to buffer containing * stat data to store in varName. */ | > > | 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 | Tcl_GetString(objPtr), "\": ", Tcl_PosixError(interp), (char *) NULL); } return TCL_ERROR; } return TCL_OK; } #endif /* *---------------------------------------------------------------------- * * StoreStatData -- * * This is a utility procedure that breaks out the fields of a * "stat" structure and stores them in textual form into the * elements of an associative array. * * Results: * Returns a standard Tcl return value. If an error occurs then * a message is left in interp's result. * * Side effects: * Elements of the associative array given by "varName" are modified. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM static int StoreStatData(interp, varName, statPtr) Tcl_Interp *interp; /* Interpreter for error reports. */ char *varName; /* Name of associative array variable * in which to store stat results. */ struct stat *statPtr; /* Pointer to buffer containing * stat data to store in varName. */ |
︙ | ︙ | |||
1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 | if (Tcl_SetVar2(interp, varName, "type", GetTypeFromMode((unsigned short) statPtr->st_mode), TCL_LEAVE_ERR_MSG) == NULL) { return TCL_ERROR; } return TCL_OK; } /* *---------------------------------------------------------------------- * * GetTypeFromMode -- * * Given a mode word, returns a string identifying the type of a * file. * * Results: * A static text string giving the file type from mode. * * Side effects: * None. * *---------------------------------------------------------------------- */ static char * GetTypeFromMode(mode) int mode; { if (S_ISREG(mode)) { return "file"; } else if (S_ISDIR(mode)) { | > > | 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 | if (Tcl_SetVar2(interp, varName, "type", GetTypeFromMode((unsigned short) statPtr->st_mode), TCL_LEAVE_ERR_MSG) == NULL) { return TCL_ERROR; } return TCL_OK; } #endif /* *---------------------------------------------------------------------- * * GetTypeFromMode -- * * Given a mode word, returns a string identifying the type of a * file. * * Results: * A static text string giving the file type from mode. * * Side effects: * None. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM static char * GetTypeFromMode(mode) int mode; { if (S_ISREG(mode)) { return "file"; } else if (S_ISDIR(mode)) { |
︙ | ︙ | |||
1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 | #ifdef S_ISSOCK } else if (S_ISSOCK(mode)) { return "socket"; #endif } return "unknown"; } /* *---------------------------------------------------------------------- * * Tcl_ForObjCmd -- * * This procedure is invoked to process the "for" Tcl command. | > | 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 | #ifdef S_ISSOCK } else if (S_ISSOCK(mode)) { return "socket"; #endif } return "unknown"; } #endif /* *---------------------------------------------------------------------- * * Tcl_ForObjCmd -- * * This procedure is invoked to process the "for" Tcl command. |
︙ | ︙ | |||
2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 | * Side effects: * Memory allocated. The caller must eventually free this memory * by calling ckfree() on the return value. * *--------------------------------------------------------------------------- */ static char ** StringifyObjects(objc, objv) int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ { int i; char **argv; argv = (char **) ckalloc((objc + 1) * sizeof(char *)); for (i = 0; i < objc; i++) { argv[i] = Tcl_GetString(objv[i]); } argv[i] = NULL; return argv; } | > > | 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 | * Side effects: * Memory allocated. The caller must eventually free this memory * by calling ckfree() on the return value. * *--------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM static char ** StringifyObjects(objc, objv) int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ { int i; char **argv; argv = (char **) ckalloc((objc + 1) * sizeof(char *)); for (i = 0; i < objc; i++) { argv[i] = Tcl_GetString(objv[i]); } argv[i] = NULL; return argv; } #endif |
Changes to generic/tclCmdMZ.c.
︙ | ︙ | |||
9 10 11 12 13 14 15 | * Copyright (c) 1987-1993 The Regents of the University of California. * Copyright (c) 1994-1997 Sun Microsystems, Inc. * Copyright (c) 1998-2000 Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | * Copyright (c) 1987-1993 The Regents of the University of California. * Copyright (c) 1994-1997 Sun Microsystems, Inc. * Copyright (c) 1998-2000 Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclCmdMZ.c,v 1.26.2.5.2.1 2001/11/28 17:58:35 andreas_kupries Exp $ */ #include "tclInt.h" #include "tclPort.h" #include "tclRegexp.h" /* |
︙ | ︙ | |||
58 59 60 61 62 63 64 65 66 67 68 69 70 71 | * * Side effects: * See the user documentation. * *---------------------------------------------------------------------- */ /* ARGSUSED */ int Tcl_PwdObjCmd(dummy, interp, objc, objv) ClientData dummy; /* Not used. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ | > | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | * * Side effects: * See the user documentation. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM /* ARGSUSED */ int Tcl_PwdObjCmd(dummy, interp, objc, objv) ClientData dummy; /* Not used. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ |
︙ | ︙ | |||
79 80 81 82 83 84 85 86 87 88 89 90 91 92 | if (Tcl_GetCwd(interp, &ds) == NULL) { return TCL_ERROR; } Tcl_DStringResult(interp, &ds); return TCL_OK; } /* *---------------------------------------------------------------------- * * Tcl_RegexpObjCmd -- * * This procedure is invoked to process the "regexp" Tcl command. | > | 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | if (Tcl_GetCwd(interp, &ds) == NULL) { return TCL_ERROR; } Tcl_DStringResult(interp, &ds); return TCL_OK; } #endif /* *---------------------------------------------------------------------- * * Tcl_RegexpObjCmd -- * * This procedure is invoked to process the "regexp" Tcl command. |
︙ | ︙ | |||
827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 | * * Side effects: * See the user documentation. * *---------------------------------------------------------------------- */ /* ARGSUSED */ int Tcl_SourceObjCmd(dummy, interp, objc, objv) ClientData dummy; /* Not used. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ { char *bytes; int result; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "fileName"); return TCL_ERROR; } bytes = Tcl_GetString(objv[1]); result = Tcl_EvalFile(interp, bytes); return result; } /* *---------------------------------------------------------------------- * * Tcl_SplitObjCmd -- * * This procedure is invoked to process the "split" Tcl command. | > > > > > > > > > > | 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 | * * Side effects: * See the user documentation. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM #ifndef TCL_NO_NONSTDCHAN /* IOS FIXME : in the generic case this functionality can be made * available, it just has to read the file directly instead of using * the channel system. This makes the code platform dependent. * * => See Tcl_EvalFile */ /* ARGSUSED */ int Tcl_SourceObjCmd(dummy, interp, objc, objv) ClientData dummy; /* Not used. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ { char *bytes; int result; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "fileName"); return TCL_ERROR; } bytes = Tcl_GetString(objv[1]); result = Tcl_EvalFile(interp, bytes); return result; } #endif #endif /* TCL_NO_FILESYSTEM */ /* *---------------------------------------------------------------------- * * Tcl_SplitObjCmd -- * * This procedure is invoked to process the "split" Tcl command. |
︙ | ︙ |
Changes to generic/tclEncoding.c.
1 2 3 4 5 6 7 8 9 10 | /* * tclEncoding.c -- * * Contains the implementation of the encoding conversion package. * * Copyright (c) 1996-1998 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /* * tclEncoding.c -- * * Contains the implementation of the encoding conversion package. * * Copyright (c) 1996-1998 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: tclEncoding.c,v 1.5.2.1.2.1 2001/11/28 17:58:35 andreas_kupries Exp $ */ #include "tclInt.h" #include "tclPort.h" typedef size_t (LengthProc)_ANSI_ARGS_((CONST char *src)); |
︙ | ︙ | |||
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | * If NULL is passed to one of the conversion routines, the current setting * of the system encoding will be used to perform the conversion. */ static Tcl_Encoding defaultEncoding; static Tcl_Encoding systemEncoding; /* * The following variable is used in the sparse matrix code for a * TableEncoding to represent a page in the table that has no entries. */ static unsigned short emptyPage[256]; /* * Procedures used only in this module. */ static int BinaryProc _ANSI_ARGS_((ClientData clientData, CONST char *src, int srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr)); static void EscapeFreeProc _ANSI_ARGS_((ClientData clientData)); static int EscapeFromUtfProc _ANSI_ARGS_((ClientData clientData, CONST char *src, int srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr)); static int EscapeToUtfProc _ANSI_ARGS_((ClientData clientData, CONST char *src, int srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr)); static void FreeEncoding _ANSI_ARGS_((Tcl_Encoding encoding)); static Encoding * GetTableEncoding _ANSI_ARGS_(( EscapeEncodingData *dataPtr, int state)); static Tcl_Encoding LoadEncodingFile _ANSI_ARGS_((Tcl_Interp *interp, CONST char *name)); static Tcl_Encoding LoadTableEncoding _ANSI_ARGS_((Tcl_Interp *interp, CONST char *name, int type, Tcl_Channel chan)); static Tcl_Encoding LoadEscapeEncoding _ANSI_ARGS_((CONST char *name, Tcl_Channel chan)); static Tcl_Channel OpenEncodingFile _ANSI_ARGS_((CONST char *dir, CONST char *name)); static void TableFreeProc _ANSI_ARGS_((ClientData clientData)); static int TableFromUtfProc _ANSI_ARGS_((ClientData clientData, CONST char *src, int srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr)); static int TableToUtfProc _ANSI_ARGS_((ClientData clientData, CONST char *src, int srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr)); static size_t unilen _ANSI_ARGS_((CONST char *src)); static int UnicodeToUtfProc _ANSI_ARGS_((ClientData clientData, CONST char *src, int srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr)); static int UtfToUnicodeProc _ANSI_ARGS_((ClientData clientData, | > > > > > > > > > > > > > > > > > > | 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | * If NULL is passed to one of the conversion routines, the current setting * of the system encoding will be used to perform the conversion. */ static Tcl_Encoding defaultEncoding; static Tcl_Encoding systemEncoding; #ifndef TCL_NO_FILESYSTEM #ifndef TCL_NO_NONSTDCHAN /* * The following variable is used in the sparse matrix code for a * TableEncoding to represent a page in the table that has no entries. */ static unsigned short emptyPage[256]; #endif #endif /* TCL_NO_FILESYSTEM */ /* * Procedures used only in this module. */ static int BinaryProc _ANSI_ARGS_((ClientData clientData, CONST char *src, int srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr)); #ifndef TCL_NO_FILESYSTEM #ifndef TCL_NO_NONSTDCHAN static void EscapeFreeProc _ANSI_ARGS_((ClientData clientData)); static int EscapeFromUtfProc _ANSI_ARGS_((ClientData clientData, CONST char *src, int srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr)); static int EscapeToUtfProc _ANSI_ARGS_((ClientData clientData, CONST char *src, int srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr)); #endif #endif /* TCL_NO_FILESYSTEM */ static void FreeEncoding _ANSI_ARGS_((Tcl_Encoding encoding)); #ifndef TCL_NO_FILESYSTEM #ifndef TCL_NO_NONSTDCHAN static Encoding * GetTableEncoding _ANSI_ARGS_(( EscapeEncodingData *dataPtr, int state)); static Tcl_Encoding LoadEncodingFile _ANSI_ARGS_((Tcl_Interp *interp, CONST char *name)); /* IOS FIXME : in the generic case this functionality can be made * available, it just has to read the file directly instead of using * the channel system. This makes the code platform dependent. * See also LoadEncodingFile. */ static Tcl_Encoding LoadTableEncoding _ANSI_ARGS_((Tcl_Interp *interp, CONST char *name, int type, Tcl_Channel chan)); static Tcl_Encoding LoadEscapeEncoding _ANSI_ARGS_((CONST char *name, Tcl_Channel chan)); static Tcl_Channel OpenEncodingFile _ANSI_ARGS_((CONST char *dir, CONST char *name)); static void TableFreeProc _ANSI_ARGS_((ClientData clientData)); static int TableFromUtfProc _ANSI_ARGS_((ClientData clientData, CONST char *src, int srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr)); static int TableToUtfProc _ANSI_ARGS_((ClientData clientData, CONST char *src, int srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr)); #endif /* TCL_NO_NONSTDCHAN */ #endif /* TCL_NO_FILESYSTEM */ static size_t unilen _ANSI_ARGS_((CONST char *src)); static int UnicodeToUtfProc _ANSI_ARGS_((ClientData clientData, CONST char *src, int srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr)); static int UtfToUnicodeProc _ANSI_ARGS_((ClientData clientData, |
︙ | ︙ | |||
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 | * Results: * * Side effects: * *------------------------------------------------------------------------- */ char * Tcl_GetDefaultEncodingDir() { return tclDefaultEncodingDir; } /* *------------------------------------------------------------------------- * * Tcl_SetDefaultEncodingDir -- * * * Results: * * Side effects: * *------------------------------------------------------------------------- */ void Tcl_SetDefaultEncodingDir(path) char *path; { tclDefaultEncodingDir = (char *)ckalloc((unsigned) strlen(path) + 1); strcpy(tclDefaultEncodingDir, path); } /* *------------------------------------------------------------------------- * * Tcl_GetEncoding -- * * Given the name of a encoding, find the corresponding Tcl_Encoding | > > > > | 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 | * Results: * * Side effects: * *------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM char * Tcl_GetDefaultEncodingDir() { return tclDefaultEncodingDir; } #endif /* *------------------------------------------------------------------------- * * Tcl_SetDefaultEncodingDir -- * * * Results: * * Side effects: * *------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM void Tcl_SetDefaultEncodingDir(path) char *path; { tclDefaultEncodingDir = (char *)ckalloc((unsigned) strlen(path) + 1); strcpy(tclDefaultEncodingDir, path); } #endif /* *------------------------------------------------------------------------- * * Tcl_GetEncoding -- * * Given the name of a encoding, find the corresponding Tcl_Encoding |
︙ | ︙ | |||
413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 | if (hPtr != NULL) { encodingPtr = (Encoding *) Tcl_GetHashValue(hPtr); encodingPtr->refCount++; Tcl_MutexUnlock(&encodingMutex); return (Tcl_Encoding) encodingPtr; } Tcl_MutexUnlock(&encodingMutex); return LoadEncodingFile(interp, name); } /* *--------------------------------------------------------------------------- * * Tcl_FreeEncoding -- * | > > > > | 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 | if (hPtr != NULL) { encodingPtr = (Encoding *) Tcl_GetHashValue(hPtr); encodingPtr->refCount++; Tcl_MutexUnlock(&encodingMutex); return (Tcl_Encoding) encodingPtr; } Tcl_MutexUnlock(&encodingMutex); #if defined(TCL_NO_FILESYSTEM) || defined(TCL_NO_NONSTDCHAN) return NULL; #else return LoadEncodingFile(interp, name); #endif } /* *--------------------------------------------------------------------------- * * Tcl_FreeEncoding -- * |
︙ | ︙ | |||
538 539 540 541 542 543 544 | void Tcl_GetEncodingNames(interp) Tcl_Interp *interp; /* Interp to hold result. */ { Tcl_HashSearch search; Tcl_HashEntry *hPtr; | > | > > > | 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 | void Tcl_GetEncodingNames(interp) Tcl_Interp *interp; /* Interp to hold result. */ { Tcl_HashSearch search; Tcl_HashEntry *hPtr; #ifndef TCL_NO_FILESYSTEM Tcl_Obj *pathPtr; #endif Tcl_Obj *resultPtr; int dummy; Tcl_HashTable table; Tcl_MutexLock(&encodingMutex); Tcl_InitHashTable(&table, TCL_STRING_KEYS); hPtr = Tcl_FirstHashEntry(&encodingTable, &search); while (hPtr != NULL) { Encoding *encodingPtr; encodingPtr = (Encoding *) Tcl_GetHashValue(hPtr); Tcl_CreateHashEntry(&table, encodingPtr->name, &dummy); hPtr = Tcl_NextHashEntry(&search); } Tcl_MutexUnlock(&encodingMutex); #ifndef TCL_NO_FILESYSTEM pathPtr = TclGetLibraryPath(); if (pathPtr != NULL) { int i, objc; Tcl_Obj **objv; Tcl_DString pwdString; char globArgString[10]; |
︙ | ︙ | |||
604 605 606 607 608 609 610 611 612 613 614 615 616 617 | } } } Tcl_Chdir(Tcl_DStringValue(&pwdString)); } Tcl_DStringFree(&pwdString); } /* * Clear any values placed in the result by globbing. */ Tcl_ResetResult(interp); resultPtr = Tcl_GetObjResult(interp); | > | 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 | } } } Tcl_Chdir(Tcl_DStringValue(&pwdString)); } Tcl_DStringFree(&pwdString); } #endif /* * Clear any values placed in the result by globbing. */ Tcl_ResetResult(interp); resultPtr = Tcl_GetObjResult(interp); |
︙ | ︙ | |||
1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 | */ void Tcl_FindExecutable(argv0) CONST char *argv0; /* The value of the application's argv[0] * (native). */ { CONST char *name; Tcl_DString buffer, nameString; TclInitSubsystems(argv0); if (argv0 == NULL) { goto done; } if (tclExecutableName != NULL) { ckfree(tclExecutableName); tclExecutableName = NULL; } if ((name = TclpFindExecutable(argv0)) == NULL) { goto done; } /* * The value returned from TclpNameOfExecutable is a UTF string that * is possibly dirty depending on when it was initialized. To assure | > > > | 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 | */ void Tcl_FindExecutable(argv0) CONST char *argv0; /* The value of the application's argv[0] * (native). */ { #ifndef TCL_NO_FILESYSTEM CONST char *name; Tcl_DString buffer, nameString; #endif TclInitSubsystems(argv0); if (argv0 == NULL) { goto done; } if (tclExecutableName != NULL) { ckfree(tclExecutableName); tclExecutableName = NULL; } #ifndef TCL_NO_FILESYSTEM if ((name = TclpFindExecutable(argv0)) == NULL) { goto done; } /* * The value returned from TclpNameOfExecutable is a UTF string that * is possibly dirty depending on when it was initialized. To assure |
︙ | ︙ | |||
1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 | ckalloc((unsigned) (Tcl_DStringLength(&nameString) + 1)); strcpy(tclExecutableName, Tcl_DStringValue(&nameString)); Tcl_DStringFree(&buffer); Tcl_DStringFree(&nameString); return; done: TclFindEncodings(argv0); } /* *--------------------------------------------------------------------------- * | > | 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 | ckalloc((unsigned) (Tcl_DStringLength(&nameString) + 1)); strcpy(tclExecutableName, Tcl_DStringValue(&nameString)); Tcl_DStringFree(&buffer); Tcl_DStringFree(&nameString); return; #endif done: TclFindEncodings(argv0); } /* *--------------------------------------------------------------------------- * |
︙ | ︙ | |||
1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 | * * Side effects: * File read from disk. * *--------------------------------------------------------------------------- */ static Tcl_Encoding LoadEncodingFile(interp, name) Tcl_Interp *interp; /* Interp for error reporting, if not NULL. */ CONST char *name; /* The name of the encoding file on disk * and also the name for new encoding. */ { int objc, i, ch; | > > > > > | 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 | * * Side effects: * File read from disk. * *--------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM #ifndef TCL_NO_NONSTDCHAN /* IOS FIXME: Add error message * Also see OpenEncodingFile below. */ static Tcl_Encoding LoadEncodingFile(interp, name) Tcl_Interp *interp; /* Interp for error reporting, if not NULL. */ CONST char *name; /* The name of the encoding file on disk * and also the name for new encoding. */ { int objc, i, ch; |
︙ | ︙ | |||
1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 | unknown: if (interp != NULL) { Tcl_AppendResult(interp, "unknown encoding \"", name, "\"", NULL); } return NULL; } /* *---------------------------------------------------------------------- * * OpenEncodingFile -- * * Look for the file encoding/<name>.enc in the specified * directory. * * Results: * Returns an open file channel if the file exists. * * Side effects: * None. * *---------------------------------------------------------------------- */ static Tcl_Channel OpenEncodingFile(dir, name) CONST char *dir; CONST char *name; { | > > > > > > > > > > > | 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 | unknown: if (interp != NULL) { Tcl_AppendResult(interp, "unknown encoding \"", name, "\"", NULL); } return NULL; } #endif #endif /* TCL_NO_FILESYSTEM */ /* *---------------------------------------------------------------------- * * OpenEncodingFile -- * * Look for the file encoding/<name>.enc in the specified * directory. * * Results: * Returns an open file channel if the file exists. * * Side effects: * None. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM #ifndef TCL_NO_NONSTDCHAN /* IOS FIXME : in the generic case this functionality can be made * available, it just has to read the file directly instead of using * the channel system. This makes the code platform dependent. * See also LoadEncodingFile. */ static Tcl_Channel OpenEncodingFile(dir, name) CONST char *dir; CONST char *name; { |
︙ | ︙ | |||
1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 | type.fromUtfProc = EscapeFromUtfProc; type.freeProc = EscapeFreeProc; type.nullSize = 1; type.clientData = (ClientData) dataPtr; return Tcl_CreateEncoding(&type); } /* *------------------------------------------------------------------------- * * BinaryProc -- * * The default conversion when no other conversion is specified. | > > | 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 | type.fromUtfProc = EscapeFromUtfProc; type.freeProc = EscapeFreeProc; type.nullSize = 1; type.clientData = (ClientData) dataPtr; return Tcl_CreateEncoding(&type); } #endif /* TCL_NO_NONSTDCHAN */ #endif /* TCL_NO_FILESYSTEM */ /* *------------------------------------------------------------------------- * * BinaryProc -- * * The default conversion when no other conversion is specified. |
︙ | ︙ | |||
1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 | * * Side effects: * None. * *------------------------------------------------------------------------- */ static int TableToUtfProc(clientData, src, srcLen, flags, statePtr, dst, dstLen, srcReadPtr, dstWrotePtr, dstCharsPtr) ClientData clientData; /* TableEncodingData that specifies * encoding. */ CONST char *src; /* Source string in specified encoding. */ int srcLen; /* Source string length in bytes. */ | > > | 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 | * * Side effects: * None. * *------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM #ifndef TCL_NO_NONSTDCHAN static int TableToUtfProc(clientData, src, srcLen, flags, statePtr, dst, dstLen, srcReadPtr, dstWrotePtr, dstCharsPtr) ClientData clientData; /* TableEncodingData that specifies * encoding. */ CONST char *src; /* Source string in specified encoding. */ int srcLen; /* Source string length in bytes. */ |
︙ | ︙ | |||
2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 | src++; } *srcReadPtr = src - srcStart; *dstWrotePtr = dst - dstStart; *dstCharsPtr = numChars; return result; } /* *------------------------------------------------------------------------- * * TableFromUtfProc -- * * Convert from UTF-8 into the encoding specified by the * TableEncodingData. * * Results: * Returns TCL_OK if conversion was successful. * * Side effects: * None. * *------------------------------------------------------------------------- */ static int TableFromUtfProc(clientData, src, srcLen, flags, statePtr, dst, dstLen, srcReadPtr, dstWrotePtr, dstCharsPtr) ClientData clientData; /* TableEncodingData that specifies * encoding. */ CONST char *src; /* Source string in UTF-8. */ int srcLen; /* Source string length in bytes. */ | > > > > | 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 | src++; } *srcReadPtr = src - srcStart; *dstWrotePtr = dst - dstStart; *dstCharsPtr = numChars; return result; } #endif #endif /* *------------------------------------------------------------------------- * * TableFromUtfProc -- * * Convert from UTF-8 into the encoding specified by the * TableEncodingData. * * Results: * Returns TCL_OK if conversion was successful. * * Side effects: * None. * *------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM #ifndef TCL_NO_NONSTDCHAN static int TableFromUtfProc(clientData, src, srcLen, flags, statePtr, dst, dstLen, srcReadPtr, dstWrotePtr, dstCharsPtr) ClientData clientData; /* TableEncodingData that specifies * encoding. */ CONST char *src; /* Source string in UTF-8. */ int srcLen; /* Source string length in bytes. */ |
︙ | ︙ | |||
2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 | src += len; } *srcReadPtr = src - srcStart; *dstWrotePtr = dst - dstStart; *dstCharsPtr = numChars; return result; } /* *--------------------------------------------------------------------------- * * TableFreeProc -- * * This procedure is invoked when an encoding is deleted. It deletes * the memory used by the TableEncodingData. * * Results: * None. * * Side effects: * Memory freed. * *--------------------------------------------------------------------------- */ static void TableFreeProc(clientData) ClientData clientData; /* TableEncodingData that specifies * encoding. */ { TableEncodingData *dataPtr; dataPtr = (TableEncodingData *) clientData; ckfree((char *) dataPtr->toUnicode); ckfree((char *) dataPtr->fromUnicode); ckfree((char *) dataPtr); } /* *------------------------------------------------------------------------- * * EscapeToUtfProc -- * * Convert from the encoding specified by the EscapeEncodingData into * UTF-8. * * Results: * Returns TCL_OK if conversion was successful. * * Side effects: * None. * *------------------------------------------------------------------------- */ static int EscapeToUtfProc(clientData, src, srcLen, flags, statePtr, dst, dstLen, srcReadPtr, dstWrotePtr, dstCharsPtr) ClientData clientData; /* EscapeEncodingData that specifies * encoding. */ CONST char *src; /* Source string in specified encoding. */ int srcLen; /* Source string length in bytes. */ | > > > > > > > > | 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 | src += len; } *srcReadPtr = src - srcStart; *dstWrotePtr = dst - dstStart; *dstCharsPtr = numChars; return result; } #endif #endif /* *--------------------------------------------------------------------------- * * TableFreeProc -- * * This procedure is invoked when an encoding is deleted. It deletes * the memory used by the TableEncodingData. * * Results: * None. * * Side effects: * Memory freed. * *--------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM #ifndef TCL_NO_NONSTDCHAN static void TableFreeProc(clientData) ClientData clientData; /* TableEncodingData that specifies * encoding. */ { TableEncodingData *dataPtr; dataPtr = (TableEncodingData *) clientData; ckfree((char *) dataPtr->toUnicode); ckfree((char *) dataPtr->fromUnicode); ckfree((char *) dataPtr); } #endif #endif /* *------------------------------------------------------------------------- * * EscapeToUtfProc -- * * Convert from the encoding specified by the EscapeEncodingData into * UTF-8. * * Results: * Returns TCL_OK if conversion was successful. * * Side effects: * None. * *------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM #ifndef TCL_NO_NONSTDCHAN static int EscapeToUtfProc(clientData, src, srcLen, flags, statePtr, dst, dstLen, srcReadPtr, dstWrotePtr, dstCharsPtr) ClientData clientData; /* EscapeEncodingData that specifies * encoding. */ CONST char *src; /* Source string in specified encoding. */ int srcLen; /* Source string length in bytes. */ |
︙ | ︙ | |||
2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 | *statePtr = (Tcl_EncodingState) state; *srcReadPtr = src - srcStart; *dstWrotePtr = dst - dstStart; *dstCharsPtr = numChars; return result; } /* *------------------------------------------------------------------------- * * EscapeFromUtfProc -- * * Convert from UTF-8 into the encoding specified by the * EscapeEncodingData. * * Results: * Returns TCL_OK if conversion was successful. * * Side effects: * None. * *------------------------------------------------------------------------- */ static int EscapeFromUtfProc(clientData, src, srcLen, flags, statePtr, dst, dstLen, srcReadPtr, dstWrotePtr, dstCharsPtr) ClientData clientData; /* EscapeEncodingData that specifies * encoding. */ CONST char *src; /* Source string in UTF-8. */ int srcLen; /* Source string length in bytes. */ | > > > > | 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 | *statePtr = (Tcl_EncodingState) state; *srcReadPtr = src - srcStart; *dstWrotePtr = dst - dstStart; *dstCharsPtr = numChars; return result; } #endif #endif /* *------------------------------------------------------------------------- * * EscapeFromUtfProc -- * * Convert from UTF-8 into the encoding specified by the * EscapeEncodingData. * * Results: * Returns TCL_OK if conversion was successful. * * Side effects: * None. * *------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM #ifndef TCL_NO_NONSTDCHAN static int EscapeFromUtfProc(clientData, src, srcLen, flags, statePtr, dst, dstLen, srcReadPtr, dstWrotePtr, dstCharsPtr) ClientData clientData; /* EscapeEncodingData that specifies * encoding. */ CONST char *src; /* Source string in UTF-8. */ int srcLen; /* Source string length in bytes. */ |
︙ | ︙ | |||
2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 | *statePtr = (Tcl_EncodingState) state; *srcReadPtr = src - srcStart; *dstWrotePtr = dst - dstStart; *dstCharsPtr = numChars; return result; } /* *--------------------------------------------------------------------------- * * EscapeFreeProc -- * * This procedure is invoked when an EscapeEncodingData encoding is * deleted. It deletes the memory used by the encoding. * * Results: * None. * * Side effects: * Memory freed. * *--------------------------------------------------------------------------- */ static void EscapeFreeProc(clientData) ClientData clientData; /* EscapeEncodingData that specifies encoding. */ { EscapeEncodingData *dataPtr; EscapeSubTable *subTablePtr; int i; dataPtr = (EscapeEncodingData *) clientData; if (dataPtr == NULL) { return; } subTablePtr = dataPtr->subTables; for (i = 0; i < dataPtr->numSubTables; i++) { FreeEncoding((Tcl_Encoding) subTablePtr->encodingPtr); subTablePtr++; } ckfree((char *) dataPtr); } /* *--------------------------------------------------------------------------- * * GetTableEncoding -- * * Helper function for the EscapeEncodingData conversions. Gets the | > > > > > > | 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 | *statePtr = (Tcl_EncodingState) state; *srcReadPtr = src - srcStart; *dstWrotePtr = dst - dstStart; *dstCharsPtr = numChars; return result; } #endif #endif /* *--------------------------------------------------------------------------- * * EscapeFreeProc -- * * This procedure is invoked when an EscapeEncodingData encoding is * deleted. It deletes the memory used by the encoding. * * Results: * None. * * Side effects: * Memory freed. * *--------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM #ifndef TCL_NO_NONSTDCHAN static void EscapeFreeProc(clientData) ClientData clientData; /* EscapeEncodingData that specifies encoding. */ { EscapeEncodingData *dataPtr; EscapeSubTable *subTablePtr; int i; dataPtr = (EscapeEncodingData *) clientData; if (dataPtr == NULL) { return; } subTablePtr = dataPtr->subTables; for (i = 0; i < dataPtr->numSubTables; i++) { FreeEncoding((Tcl_Encoding) subTablePtr->encodingPtr); subTablePtr++; } ckfree((char *) dataPtr); } #endif #endif /* TCL_NO_FILESYSTEM */ /* *--------------------------------------------------------------------------- * * GetTableEncoding -- * * Helper function for the EscapeEncodingData conversions. Gets the |
︙ | ︙ | |||
2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 | * If the encoding that represents the specified state has not * already been used by this EscapeEncoding, it will be loaded * and cached in the dataPtr. * *--------------------------------------------------------------------------- */ static Encoding * GetTableEncoding(dataPtr, state) EscapeEncodingData *dataPtr;/* Contains names of encodings. */ int state; /* Index in dataPtr of desired Encoding. */ { EscapeSubTable *subTablePtr; Encoding *encodingPtr; subTablePtr = &dataPtr->subTables[state]; encodingPtr = subTablePtr->encodingPtr; if (encodingPtr == NULL) { encodingPtr = (Encoding *) Tcl_GetEncoding(NULL, subTablePtr->name); if ((encodingPtr == NULL) || (encodingPtr->toUtfProc != TableToUtfProc)) { panic("EscapeToUtfProc: invalid sub table"); } subTablePtr->encodingPtr = encodingPtr; } return encodingPtr; } /* *--------------------------------------------------------------------------- * * unilen -- * * A helper function for the Tcl_ExternalToUtf functions. This | > > > > | 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 | * If the encoding that represents the specified state has not * already been used by this EscapeEncoding, it will be loaded * and cached in the dataPtr. * *--------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM #ifndef TCL_NO_NONSTDCHAN static Encoding * GetTableEncoding(dataPtr, state) EscapeEncodingData *dataPtr;/* Contains names of encodings. */ int state; /* Index in dataPtr of desired Encoding. */ { EscapeSubTable *subTablePtr; Encoding *encodingPtr; subTablePtr = &dataPtr->subTables[state]; encodingPtr = subTablePtr->encodingPtr; if (encodingPtr == NULL) { encodingPtr = (Encoding *) Tcl_GetEncoding(NULL, subTablePtr->name); if ((encodingPtr == NULL) || (encodingPtr->toUtfProc != TableToUtfProc)) { panic("EscapeToUtfProc: invalid sub table"); } subTablePtr->encodingPtr = encodingPtr; } return encodingPtr; } #endif #endif /* TCL_NO_FILESYSTEM */ /* *--------------------------------------------------------------------------- * * unilen -- * * A helper function for the Tcl_ExternalToUtf functions. This |
︙ | ︙ | |||
2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 | */ void TclFindEncodings(argv0) CONST char *argv0; /* Name of executable from argv[0] to main() * in native multi-byte encoding. */ { char *native; Tcl_Obj *pathPtr; Tcl_DString libPath, buffer; if (encodingsInitialized == 0) { /* * Double check inside the mutex. There may be calls * back into this routine from some of the procedures below. */ TclpInitLock(); if (encodingsInitialized == 0) { /* * Have to set this bit here to avoid deadlock with the * routines below us that call into TclInitSubsystems. */ encodingsInitialized = 1; native = TclpFindExecutable(argv0); TclpInitLibraryPath(native); /* * The library path was set in the TclpInitLibraryPath routine. * The string set is a dirty UTF string. To preserve the value * convert the UTF string back to native before setting the new * default encoding. */ pathPtr = TclGetLibraryPath(); if (pathPtr != NULL) { Tcl_UtfToExternalDString(NULL, Tcl_GetString(pathPtr), -1, &libPath); } TclpSetInitialEncodings(); /* * Now convert the native string back to UTF. */ if (pathPtr != NULL) { Tcl_ExternalToUtfDString(NULL, Tcl_DStringValue(&libPath), -1, &buffer); pathPtr = Tcl_NewStringObj(Tcl_DStringValue(&buffer), -1); TclSetLibraryPath(pathPtr); Tcl_DStringFree(&libPath); Tcl_DStringFree(&buffer); } } TclpInitUnlock(); } } | > > > > > > | 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 | */ void TclFindEncodings(argv0) CONST char *argv0; /* Name of executable from argv[0] to main() * in native multi-byte encoding. */ { #ifndef TCL_NO_FILESYSTEM char *native; Tcl_Obj *pathPtr; Tcl_DString libPath, buffer; #endif if (encodingsInitialized == 0) { /* * Double check inside the mutex. There may be calls * back into this routine from some of the procedures below. */ TclpInitLock(); if (encodingsInitialized == 0) { /* * Have to set this bit here to avoid deadlock with the * routines below us that call into TclInitSubsystems. */ encodingsInitialized = 1; #ifndef TCL_NO_FILESYSTEM native = TclpFindExecutable(argv0); TclpInitLibraryPath(native); /* * The library path was set in the TclpInitLibraryPath routine. * The string set is a dirty UTF string. To preserve the value * convert the UTF string back to native before setting the new * default encoding. */ pathPtr = TclGetLibraryPath(); if (pathPtr != NULL) { Tcl_UtfToExternalDString(NULL, Tcl_GetString(pathPtr), -1, &libPath); } #endif TclpSetInitialEncodings(); #ifndef TCL_NO_FILESYSTEM /* * Now convert the native string back to UTF. */ if (pathPtr != NULL) { Tcl_ExternalToUtfDString(NULL, Tcl_DStringValue(&libPath), -1, &buffer); pathPtr = Tcl_NewStringObj(Tcl_DStringValue(&buffer), -1); TclSetLibraryPath(pathPtr); Tcl_DStringFree(&libPath); Tcl_DStringFree(&buffer); } #endif } TclpInitUnlock(); } } |
Changes to generic/tclEvent.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tclEvent.c -- * * This file implements some general event related interfaces including * background errors, exit handlers, and the "vwait" and "update" * command procedures. * * Copyright (c) 1990-1994 The Regents of the University of California. * Copyright (c) 1994-1998 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | /* * tclEvent.c -- * * This file implements some general event related interfaces including * background errors, exit handlers, and the "vwait" and "update" * command procedures. * * Copyright (c) 1990-1994 The Regents of the University of California. * Copyright (c) 1994-1998 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: tclEvent.c,v 1.8.2.5.2.1 2001/11/28 17:58:35 andreas_kupries Exp $ */ #include "tclInt.h" #include "tclPort.h" /* * The data structure below is used to report background errors. One |
︙ | ︙ | |||
583 584 585 586 587 588 589 590 591 592 593 594 595 596 | * * The refcount of the new library path is incremented and the * refcount of the old path is decremented. * *------------------------------------------------------------------------- */ void TclSetLibraryPath(pathPtr) Tcl_Obj *pathPtr; /* A Tcl list object whose elements are * the new library path. */ { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); | > | 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 | * * The refcount of the new library path is incremented and the * refcount of the old path is decremented. * *------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM void TclSetLibraryPath(pathPtr) Tcl_Obj *pathPtr; /* A Tcl list object whose elements are * the new library path. */ { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); |
︙ | ︙ | |||
604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 | /* * No mutex locking is needed here as up the stack we're within * TclpInitLock(). */ tclLibraryPathStr = Tcl_GetStringFromObj(pathPtr, NULL); } /* *------------------------------------------------------------------------- * * TclGetLibraryPath -- * * Return a Tcl list object whose elements are the library path. * The caller should not modify the contents of the returned object. * * Results: * As above. * * Side effects: * None. * *------------------------------------------------------------------------- */ Tcl_Obj * TclGetLibraryPath() { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); if (tsdPtr->tclLibraryPath == NULL) { /* * Grab the shared string and place it into a new thread specific * Tcl_Obj. */ tsdPtr->tclLibraryPath = Tcl_NewStringObj(tclLibraryPathStr, -1); /* take ownership */ Tcl_IncrRefCount(tsdPtr->tclLibraryPath); } return tsdPtr->tclLibraryPath; } /* *------------------------------------------------------------------------- * * TclInitSubsystems -- * * Initialize various subsytems in Tcl. This should be called the | > > > | 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 | /* * No mutex locking is needed here as up the stack we're within * TclpInitLock(). */ tclLibraryPathStr = Tcl_GetStringFromObj(pathPtr, NULL); } #endif /* *------------------------------------------------------------------------- * * TclGetLibraryPath -- * * Return a Tcl list object whose elements are the library path. * The caller should not modify the contents of the returned object. * * Results: * As above. * * Side effects: * None. * *------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM Tcl_Obj * TclGetLibraryPath() { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); if (tsdPtr->tclLibraryPath == NULL) { /* * Grab the shared string and place it into a new thread specific * Tcl_Obj. */ tsdPtr->tclLibraryPath = Tcl_NewStringObj(tclLibraryPathStr, -1); /* take ownership */ Tcl_IncrRefCount(tsdPtr->tclLibraryPath); } return tsdPtr->tclLibraryPath; } #endif /* *------------------------------------------------------------------------- * * TclInitSubsystems -- * * Initialize various subsytems in Tcl. This should be called the |
︙ | ︙ |
Changes to generic/tclFCmd.c.
1 2 3 4 5 6 7 8 9 10 11 | /* * tclFCmd.c * * This file implements the generic portion of file manipulation * subcommands of the "file" command. * * Copyright (c) 1996-1998 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | /* * tclFCmd.c * * This file implements the generic portion of file manipulation * subcommands of the "file" command. * * Copyright (c) 1996-1998 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: tclFCmd.c,v 1.6.20.1 2001/11/28 17:58:36 andreas_kupries Exp $ */ #include "tclInt.h" #include "tclPort.h" /* * Declarations for local procedures defined in this file: */ #ifndef TCL_NO_FILESYSTEM static int CopyRenameOneFile _ANSI_ARGS_((Tcl_Interp *interp, char *source, char *dest, int copyFlag, int force)); static char * FileBasename _ANSI_ARGS_((Tcl_Interp *interp, char *path, Tcl_DString *bufferPtr)); static int FileCopyRename _ANSI_ARGS_((Tcl_Interp *interp, int argc, char **argv, int copyFlag)); static int FileForceOption _ANSI_ARGS_((Tcl_Interp *interp, int argc, char **argv, int *forcePtr)); #endif /* *--------------------------------------------------------------------------- * * TclFileRenameCmd * * This procedure implements the "rename" subcommand of the "file" * command. Filename arguments need to be translated to native * format before being passed to platform-specific code that * implements rename functionality. * * Results: * A standard Tcl result. * * Side effects: * See the user documentation. * *--------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM int TclFileRenameCmd(interp, argc, argv) Tcl_Interp *interp; /* Interp for error reporting. */ int argc; /* Number of arguments. */ char **argv; /* Argument strings passed to Tcl_FileCmd. */ { return FileCopyRename(interp, argc, argv, 0); } #endif /* *--------------------------------------------------------------------------- * * TclFileCopyCmd * * This procedure implements the "copy" subcommand of the "file" * command. Filename arguments need to be translated to native * format before being passed to platform-specific code that * implements copy functionality. * * Results: * A standard Tcl result. * * Side effects: * See the user documentation. * *--------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM int TclFileCopyCmd(interp, argc, argv) Tcl_Interp *interp; /* Used for error reporting */ int argc; /* Number of arguments. */ char **argv; /* Argument strings passed to Tcl_FileCmd. */ { return FileCopyRename(interp, argc, argv, 1); } #endif /* *--------------------------------------------------------------------------- * * FileCopyRename -- * * Performs the work of TclFileRenameCmd and TclFileCopyCmd. * See comments for those procedures. * * Results: * See above. * * Side effects: * See above. * *--------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM static int FileCopyRename(interp, argc, argv, copyFlag) Tcl_Interp *interp; /* Used for error reporting. */ int argc; /* Number of arguments. */ char **argv; /* Argument strings passed to Tcl_FileCmd. */ int copyFlag; /* If non-zero, copy source(s). Otherwise, * rename them. */ |
︙ | ︙ | |||
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | if (result == TCL_ERROR) { break; } } Tcl_DStringFree(&targetBuffer); return result; } /* *--------------------------------------------------------------------------- * * TclFileMakeDirsCmd * * This procedure implements the "mkdir" subcommand of the "file" * command. Filename arguments need to be translated to native * format before being passed to platform-specific code that * implements mkdir functionality. * * Results: * A standard Tcl result. * * Side effects: * See the user documentation. * *---------------------------------------------------------------------- */ int TclFileMakeDirsCmd(interp, argc, argv) Tcl_Interp *interp; /* Used for error reporting. */ int argc; /* Number of arguments */ char **argv; /* Argument strings passed to Tcl_FileCmd. */ { Tcl_DString nameBuffer, targetBuffer; | > > > | 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | if (result == TCL_ERROR) { break; } } Tcl_DStringFree(&targetBuffer); return result; } #endif /* *--------------------------------------------------------------------------- * * TclFileMakeDirsCmd * * This procedure implements the "mkdir" subcommand of the "file" * command. Filename arguments need to be translated to native * format before being passed to platform-specific code that * implements mkdir functionality. * * Results: * A standard Tcl result. * * Side effects: * See the user documentation. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM int TclFileMakeDirsCmd(interp, argc, argv) Tcl_Interp *interp; /* Used for error reporting. */ int argc; /* Number of arguments */ char **argv; /* Argument strings passed to Tcl_FileCmd. */ { Tcl_DString nameBuffer, targetBuffer; |
︙ | ︙ | |||
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | Tcl_DStringFree(&nameBuffer); Tcl_DStringFree(&targetBuffer); if (pargv != NULL) { ckfree((char *) pargv); } return result; } /* *---------------------------------------------------------------------- * * TclFileDeleteCmd * * This procedure implements the "delete" subcommand of the "file" * command. * * Results: * A standard Tcl result. * * Side effects: * See the user documentation. * *---------------------------------------------------------------------- */ int TclFileDeleteCmd(interp, argc, argv) Tcl_Interp *interp; /* Used for error reporting */ int argc; /* Number of arguments */ char **argv; /* Argument strings passed to Tcl_FileCmd. */ { Tcl_DString nameBuffer, errorBuffer; | > > | 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | Tcl_DStringFree(&nameBuffer); Tcl_DStringFree(&targetBuffer); if (pargv != NULL) { ckfree((char *) pargv); } return result; } #endif /* *---------------------------------------------------------------------- * * TclFileDeleteCmd * * This procedure implements the "delete" subcommand of the "file" * command. * * Results: * A standard Tcl result. * * Side effects: * See the user documentation. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM int TclFileDeleteCmd(interp, argc, argv) Tcl_Interp *interp; /* Used for error reporting */ int argc; /* Number of arguments */ char **argv; /* Argument strings passed to Tcl_FileCmd. */ { Tcl_DString nameBuffer, errorBuffer; |
︙ | ︙ | |||
391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 | "\": ", Tcl_PosixError(interp), (char *) NULL); } done: Tcl_DStringFree(&errorBuffer); Tcl_DStringFree(&nameBuffer); return result; } /* *--------------------------------------------------------------------------- * * CopyRenameOneFile * * Copies or renames specified source file or directory hierarchy * to the specified target. * * Results: * A standard Tcl result. * * Side effects: * Target is overwritten if the force flag is set. Attempting to * copy/rename a file onto a directory or a directory onto a file * will always result in an error. * *---------------------------------------------------------------------- */ static int CopyRenameOneFile(interp, source, target, copyFlag, force) Tcl_Interp *interp; /* Used for error reporting. */ char *source; /* Pathname of file to copy. May need to * be translated. */ char *target; /* Pathname of file to create/overwrite. * May need to be translated. */ | > > | 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 | "\": ", Tcl_PosixError(interp), (char *) NULL); } done: Tcl_DStringFree(&errorBuffer); Tcl_DStringFree(&nameBuffer); return result; } #endif /* *--------------------------------------------------------------------------- * * CopyRenameOneFile * * Copies or renames specified source file or directory hierarchy * to the specified target. * * Results: * A standard Tcl result. * * Side effects: * Target is overwritten if the force flag is set. Attempting to * copy/rename a file onto a directory or a directory onto a file * will always result in an error. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM static int CopyRenameOneFile(interp, source, target, copyFlag, force) Tcl_Interp *interp; /* Used for error reporting. */ char *source; /* Pathname of file to copy. May need to * be translated. */ char *target; /* Pathname of file to create/overwrite. * May need to be translated. */ |
︙ | ︙ | |||
590 591 592 593 594 595 596 597 598 599 600 601 602 603 | (char *) NULL); } Tcl_DStringFree(&errorBuffer); Tcl_DStringFree(&sourcePath); Tcl_DStringFree(&targetPath); return result; } /* *--------------------------------------------------------------------------- * * FileForceOption -- * * Helps parse command line options for file commands that take | > | 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 | (char *) NULL); } Tcl_DStringFree(&errorBuffer); Tcl_DStringFree(&sourcePath); Tcl_DStringFree(&targetPath); return result; } #endif /* *--------------------------------------------------------------------------- * * FileForceOption -- * * Helps parse command line options for file commands that take |
︙ | ︙ | |||
611 612 613 614 615 616 617 618 619 620 621 622 623 624 | * * Side effects: * None. * *--------------------------------------------------------------------------- */ static int FileForceOption(interp, argc, argv, forcePtr) Tcl_Interp *interp; /* Interp, for error return. */ int argc; /* Number of arguments. */ char **argv; /* Argument strings. First command line * option, if it exists, begins at 0. */ int *forcePtr; /* If the "-force" was specified, *forcePtr | > | 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 | * * Side effects: * None. * *--------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM static int FileForceOption(interp, argc, argv, forcePtr) Tcl_Interp *interp; /* Interp, for error return. */ int argc; /* Number of arguments. */ char **argv; /* Argument strings. First command line * option, if it exists, begins at 0. */ int *forcePtr; /* If the "-force" was specified, *forcePtr |
︙ | ︙ | |||
641 642 643 644 645 646 647 648 649 650 651 652 653 654 | "\": should be -force or --", (char *)NULL); return -1; } } *forcePtr = force; return i; } /* *--------------------------------------------------------------------------- * * FileBasename -- * * Given a path in either tcl format (with / separators), or in the * platform-specific format for the current platform, return all the | > | 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 | "\": should be -force or --", (char *)NULL); return -1; } } *forcePtr = force; return i; } #endif /* *--------------------------------------------------------------------------- * * FileBasename -- * * Given a path in either tcl format (with / separators), or in the * platform-specific format for the current platform, return all the |
︙ | ︙ | |||
663 664 665 666 667 668 669 670 671 672 673 674 675 676 | * * Side effects: * None. * *--------------------------------------------------------------------------- */ static char * FileBasename(interp, path, bufferPtr) Tcl_Interp *interp; /* Interp, for error return. */ char *path; /* Path whose basename to extract. */ Tcl_DString *bufferPtr; /* Initialized DString that receives * basename. */ { | > | 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 | * * Side effects: * None. * *--------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM static char * FileBasename(interp, path, bufferPtr) Tcl_Interp *interp; /* Interp, for error return. */ char *path; /* Path whose basename to extract. */ Tcl_DString *bufferPtr; /* Initialized DString that receives * basename. */ { |
︙ | ︙ | |||
705 706 707 708 709 710 711 712 713 714 715 716 717 718 | Tcl_DStringAppend(bufferPtr, argv[argc - 1], -1); } } } ckfree((char *) argv); return Tcl_DStringValue(bufferPtr); } /* *---------------------------------------------------------------------- * * TclFileAttrsCmd -- * * Sets or gets the platform-specific attributes of a file. The objc-objv | > | 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 | Tcl_DStringAppend(bufferPtr, argv[argc - 1], -1); } } } ckfree((char *) argv); return Tcl_DStringValue(bufferPtr); } #endif /* *---------------------------------------------------------------------- * * TclFileAttrsCmd -- * * Sets or gets the platform-specific attributes of a file. The objc-objv |
︙ | ︙ | |||
741 742 743 744 745 746 747 748 749 750 751 752 753 754 | * * Side effects: * May set file attributes for the file name. * *---------------------------------------------------------------------- */ int TclFileAttrsCmd(interp, objc, objv) Tcl_Interp *interp; /* The interpreter for error reporting. */ int objc; /* Number of command line arguments. */ Tcl_Obj *CONST objv[]; /* The command line objects. */ { char *fileName; | > | 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 | * * Side effects: * May set file attributes for the file name. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM int TclFileAttrsCmd(interp, objc, objv) Tcl_Interp *interp; /* The interpreter for error reporting. */ int objc; /* Number of command line arguments. */ Tcl_Obj *CONST objv[]; /* The command line objects. */ { char *fileName; |
︙ | ︙ | |||
835 836 837 838 839 840 841 | } result = TCL_OK; end: Tcl_DStringFree(&buffer); return result; } | > | 855 856 857 858 859 860 861 862 | } result = TCL_OK; end: Tcl_DStringFree(&buffer); return result; } #endif |
Changes to generic/tclFileName.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * tclFileName.c -- * * This file contains routines for converting file names betwen * native and network form. * * Copyright (c) 1995-1998 Sun Microsystems, Inc. * Copyright (c) 1998-1999 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | /* * tclFileName.c -- * * This file contains routines for converting file names betwen * native and network form. * * Copyright (c) 1995-1998 Sun Microsystems, Inc. * Copyright (c) 1998-1999 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclFileName.c,v 1.13.2.2.2.1 2001/11/28 17:58:36 andreas_kupries Exp $ */ #include "tclInt.h" #include "tclPort.h" #include "tclRegexp.h" #ifndef TCL_NO_FILESYSTEM /* * The following regular expression matches the root portion of a Macintosh * absolute path. It will match degenerate Unix-style paths, tilde paths, * Unix-style paths, and Mac paths. */ #define MAC_ROOT_PATTERN "^((/+([.][.]?/+)*([.][.]?)?)|(~[^:/]*)(/[^:]*)?|(~[^:]*)(:.*)?|/+([.][.]?/+)*([^:/]+)(/[^:]*)?|([^:]+):.*)$" |
︙ | ︙ | |||
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | char *match)); static char * SplitMacPath _ANSI_ARGS_((CONST char *path, Tcl_DString *bufPtr)); static char * SplitWinPath _ANSI_ARGS_((CONST char *path, Tcl_DString *bufPtr)); static char * SplitUnixPath _ANSI_ARGS_((CONST char *path, Tcl_DString *bufPtr)); /* *---------------------------------------------------------------------- * * FileNameInit -- * * This procedure initializes the patterns used by this module. * * Results: * None. * * Side effects: * Compiles the regular expressions. * *---------------------------------------------------------------------- */ static void FileNameInit() { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); if (!tsdPtr->initialized) { tsdPtr->initialized = 1; tsdPtr->macRootPatternPtr = Tcl_NewStringObj(MAC_ROOT_PATTERN, -1); Tcl_CreateThreadExitHandler(FileNameCleanup, NULL); } } /* *---------------------------------------------------------------------- * * FileNameCleanup -- * * This procedure is a Tcl_ExitProc used to clean up the static * data structures used in this file. * * Results: * None. * * Side effects: * Deallocates storage used by the procedures in this file. * *---------------------------------------------------------------------- */ static void FileNameCleanup(clientData) ClientData clientData; /* Not used. */ { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); Tcl_DecrRefCount(tsdPtr->macRootPatternPtr); tsdPtr->initialized = 0; } /* *---------------------------------------------------------------------- * * ExtractWinRoot -- * * Matches the root portion of a Windows path and appends it | > > > > > | 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | char *match)); static char * SplitMacPath _ANSI_ARGS_((CONST char *path, Tcl_DString *bufPtr)); static char * SplitWinPath _ANSI_ARGS_((CONST char *path, Tcl_DString *bufPtr)); static char * SplitUnixPath _ANSI_ARGS_((CONST char *path, Tcl_DString *bufPtr)); #endif /* *---------------------------------------------------------------------- * * FileNameInit -- * * This procedure initializes the patterns used by this module. * * Results: * None. * * Side effects: * Compiles the regular expressions. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM static void FileNameInit() { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); if (!tsdPtr->initialized) { tsdPtr->initialized = 1; tsdPtr->macRootPatternPtr = Tcl_NewStringObj(MAC_ROOT_PATTERN, -1); Tcl_CreateThreadExitHandler(FileNameCleanup, NULL); } } #endif /* *---------------------------------------------------------------------- * * FileNameCleanup -- * * This procedure is a Tcl_ExitProc used to clean up the static * data structures used in this file. * * Results: * None. * * Side effects: * Deallocates storage used by the procedures in this file. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM static void FileNameCleanup(clientData) ClientData clientData; /* Not used. */ { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); Tcl_DecrRefCount(tsdPtr->macRootPatternPtr); tsdPtr->initialized = 0; } #endif /* *---------------------------------------------------------------------- * * ExtractWinRoot -- * * Matches the root portion of a Windows path and appends it |
︙ | ︙ | |||
141 142 143 144 145 146 147 148 149 150 151 152 153 154 | * * Side effects: * Modifies the specified Tcl_DString. * *---------------------------------------------------------------------- */ static CONST char * ExtractWinRoot(path, resultPtr, offset, typePtr) CONST char *path; /* Path to parse. */ Tcl_DString *resultPtr; /* Buffer to hold result. */ int offset; /* Offset in buffer where result should be * stored. */ Tcl_PathType *typePtr; /* Where to store pathType result */ | > | 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | * * Side effects: * Modifies the specified Tcl_DString. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM static CONST char * ExtractWinRoot(path, resultPtr, offset, typePtr) CONST char *path; /* Path to parse. */ Tcl_DString *resultPtr; /* Buffer to hold result. */ int offset; /* Offset in buffer where result should be * stored. */ Tcl_PathType *typePtr; /* Where to store pathType result */ |
︙ | ︙ | |||
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | return tail; } } else { *typePtr = TCL_PATH_RELATIVE; return path; } } /* *---------------------------------------------------------------------- * * Tcl_GetPathType -- * * Determines whether a given path is relative to the current * directory, relative to the current volume, or absolute. * * Results: * Returns one of TCL_PATH_ABSOLUTE, TCL_PATH_RELATIVE, or * TCL_PATH_VOLUME_RELATIVE. * * Side effects: * None. * *---------------------------------------------------------------------- */ Tcl_PathType Tcl_GetPathType(path) char *path; { ThreadSpecificData *tsdPtr; Tcl_PathType type = TCL_PATH_ABSOLUTE; Tcl_RegExp re; | > > | 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | return tail; } } else { *typePtr = TCL_PATH_RELATIVE; return path; } } #endif /* *---------------------------------------------------------------------- * * Tcl_GetPathType -- * * Determines whether a given path is relative to the current * directory, relative to the current volume, or absolute. * * Results: * Returns one of TCL_PATH_ABSOLUTE, TCL_PATH_RELATIVE, or * TCL_PATH_VOLUME_RELATIVE. * * Side effects: * None. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM Tcl_PathType Tcl_GetPathType(path) char *path; { ThreadSpecificData *tsdPtr; Tcl_PathType type = TCL_PATH_ABSOLUTE; Tcl_RegExp re; |
︙ | ︙ | |||
310 311 312 313 314 315 316 317 318 319 320 321 322 323 | (VOID)ExtractWinRoot(path, &ds, 0, &type); Tcl_DStringFree(&ds); } break; } return type; } /* *---------------------------------------------------------------------- * * Tcl_SplitPath -- * * Split a path into a list of path components. The first element | > | 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | (VOID)ExtractWinRoot(path, &ds, 0, &type); Tcl_DStringFree(&ds); } break; } return type; } #endif /* *---------------------------------------------------------------------- * * Tcl_SplitPath -- * * Split a path into a list of path components. The first element |
︙ | ︙ | |||
337 338 339 340 341 342 343 344 345 346 347 348 349 350 | * * Side effects: * Allocates memory. * *---------------------------------------------------------------------- */ void Tcl_SplitPath(path, argcPtr, argvPtr) CONST char *path; /* Pointer to string containing a path. */ int *argcPtr; /* Pointer to location to fill in with * the number of elements in the path. */ char ***argvPtr; /* Pointer to place to store pointer to array * of pointers to path elements. */ | > | 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 | * * Side effects: * Allocates memory. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM void Tcl_SplitPath(path, argcPtr, argvPtr) CONST char *path; /* Pointer to string containing a path. */ int *argcPtr; /* Pointer to location to fill in with * the number of elements in the path. */ char ***argvPtr; /* Pointer to place to store pointer to array * of pointers to path elements. */ |
︙ | ︙ | |||
412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 | (*argvPtr)[i] = p; while ((*p++) != '\0') {} } (*argvPtr)[i] = NULL; Tcl_DStringFree(&buffer); } /* *---------------------------------------------------------------------- * * SplitUnixPath -- * * This routine is used by Tcl_SplitPath to handle splitting * Unix paths. * * Results: * Stores a null separated array of strings in the specified * Tcl_DString. * * Side effects: * None. * *---------------------------------------------------------------------- */ static char * SplitUnixPath(path, bufPtr) CONST char *path; /* Pointer to string containing a path. */ Tcl_DString *bufPtr; /* Pointer to DString to use for the result. */ { int length; CONST char *p, *elementStart; | > > | 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 | (*argvPtr)[i] = p; while ((*p++) != '\0') {} } (*argvPtr)[i] = NULL; Tcl_DStringFree(&buffer); } #endif /* *---------------------------------------------------------------------- * * SplitUnixPath -- * * This routine is used by Tcl_SplitPath to handle splitting * Unix paths. * * Results: * Stores a null separated array of strings in the specified * Tcl_DString. * * Side effects: * None. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM static char * SplitUnixPath(path, bufPtr) CONST char *path; /* Pointer to string containing a path. */ Tcl_DString *bufPtr; /* Pointer to DString to use for the result. */ { int length; CONST char *p, *elementStart; |
︙ | ︙ | |||
487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 | } if (*p++ == '\0') { break; } } return Tcl_DStringValue(bufPtr); } /* *---------------------------------------------------------------------- * * SplitWinPath -- * * This routine is used by Tcl_SplitPath to handle splitting * Windows paths. * * Results: * Stores a null separated array of strings in the specified * Tcl_DString. * * Side effects: * None. * *---------------------------------------------------------------------- */ static char * SplitWinPath(path, bufPtr) CONST char *path; /* Pointer to string containing a path. */ Tcl_DString *bufPtr; /* Pointer to DString to use for the result. */ { int length; CONST char *p, *elementStart; | > > | 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 | } if (*p++ == '\0') { break; } } return Tcl_DStringValue(bufPtr); } #endif /* *---------------------------------------------------------------------- * * SplitWinPath -- * * This routine is used by Tcl_SplitPath to handle splitting * Windows paths. * * Results: * Stores a null separated array of strings in the specified * Tcl_DString. * * Side effects: * None. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM static char * SplitWinPath(path, bufPtr) CONST char *path; /* Pointer to string containing a path. */ Tcl_DString *bufPtr; /* Pointer to DString to use for the result. */ { int length; CONST char *p, *elementStart; |
︙ | ︙ | |||
547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 | Tcl_DStringAppend(bufPtr, elementStart, length); Tcl_DStringAppend(bufPtr, "", 1); } } while (*p++ != '\0'); return Tcl_DStringValue(bufPtr); } /* *---------------------------------------------------------------------- * * SplitMacPath -- * * This routine is used by Tcl_SplitPath to handle splitting * Macintosh paths. * * Results: * Returns a newly allocated argv array. * * Side effects: * None. * *---------------------------------------------------------------------- */ static char * SplitMacPath(path, bufPtr) CONST char *path; /* Pointer to string containing a path. */ Tcl_DString *bufPtr; /* Pointer to DString to use for the result. */ { int isMac = 0; /* 1 if is Mac-style, 0 if Unix-style path. */ int i, length; | > > | 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 | Tcl_DStringAppend(bufPtr, elementStart, length); Tcl_DStringAppend(bufPtr, "", 1); } } while (*p++ != '\0'); return Tcl_DStringValue(bufPtr); } #endif /* *---------------------------------------------------------------------- * * SplitMacPath -- * * This routine is used by Tcl_SplitPath to handle splitting * Macintosh paths. * * Results: * Returns a newly allocated argv array. * * Side effects: * None. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM static char * SplitMacPath(path, bufPtr) CONST char *path; /* Pointer to string containing a path. */ Tcl_DString *bufPtr; /* Pointer to DString to use for the result. */ { int isMac = 0; /* 1 if is Mac-style, 0 if Unix-style path. */ int i, length; |
︙ | ︙ | |||
735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 | if (*p++ == '\0') { break; } } } return Tcl_DStringValue(bufPtr); } /* *---------------------------------------------------------------------- * * Tcl_JoinPath -- * * Combine a list of paths in a platform specific manner. * * Results: * Appends the joined path to the end of the specified * returning a pointer to the resulting string. Note that * the Tcl_DString must already be initialized. * * Side effects: * Modifies the Tcl_DString. * *---------------------------------------------------------------------- */ char * Tcl_JoinPath(argc, argv, resultPtr) int argc; char **argv; Tcl_DString *resultPtr; /* Pointer to previously initialized DString. */ { int oldLength, length, i, needsSep; | > > | 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 | if (*p++ == '\0') { break; } } } return Tcl_DStringValue(bufPtr); } #endif /* *---------------------------------------------------------------------- * * Tcl_JoinPath -- * * Combine a list of paths in a platform specific manner. * * Results: * Appends the joined path to the end of the specified * returning a pointer to the resulting string. Note that * the Tcl_DString must already be initialized. * * Side effects: * Modifies the Tcl_DString. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM char * Tcl_JoinPath(argc, argv, resultPtr) int argc; char **argv; Tcl_DString *resultPtr; /* Pointer to previously initialized DString. */ { int oldLength, length, i, needsSep; |
︙ | ︙ | |||
968 969 970 971 972 973 974 975 976 977 978 979 980 981 | } break; } Tcl_DStringFree(&buffer); return Tcl_DStringValue(resultPtr); } /* *--------------------------------------------------------------------------- * * Tcl_TranslateFileName -- * * Converts a file name into a form usable by the native system | > | 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 | } break; } Tcl_DStringFree(&buffer); return Tcl_DStringValue(resultPtr); } #endif /* *--------------------------------------------------------------------------- * * Tcl_TranslateFileName -- * * Converts a file name into a form usable by the native system |
︙ | ︙ | |||
995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 | * * Side effects: * None. * *---------------------------------------------------------------------- */ char * Tcl_TranslateFileName(interp, name, bufferPtr) Tcl_Interp *interp; /* Interpreter in which to store error * message (if necessary). */ char *name; /* File name, which may begin with "~" (to * indicate current user's home directory) or * "~<user>" (to indicate any user's home | > | 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 | * * Side effects: * None. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM char * Tcl_TranslateFileName(interp, name, bufferPtr) Tcl_Interp *interp; /* Interpreter in which to store error * message (if necessary). */ char *name; /* File name, which may begin with "~" (to * indicate current user's home directory) or * "~<user>" (to indicate any user's home |
︙ | ︙ | |||
1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 | if (*p == '/') { *p = '\\'; } } } return Tcl_DStringValue(bufferPtr); } /* *---------------------------------------------------------------------- * * TclGetExtension -- * * This function returns a pointer to the beginning of the * extension part of a file name. * * Results: * Returns a pointer into name which indicates where the extension * starts. If there is no extension, returns NULL. * * Side effects: * None. * *---------------------------------------------------------------------- */ char * TclGetExtension(name) char *name; /* File name to parse. */ { char *p, *lastSep; /* | > > | 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 | if (*p == '/') { *p = '\\'; } } } return Tcl_DStringValue(bufferPtr); } #endif /* *---------------------------------------------------------------------- * * TclGetExtension -- * * This function returns a pointer to the beginning of the * extension part of a file name. * * Results: * Returns a pointer into name which indicates where the extension * starts. If there is no extension, returns NULL. * * Side effects: * None. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM char * TclGetExtension(name) char *name; /* File name to parse. */ { char *p, *lastSep; /* |
︙ | ︙ | |||
1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 | * so that "foo..o" would be split into "foo" and "..o". This is a * confusing and usually incorrect behavior, so now we split at the last * period in the name. */ return p; } /* *---------------------------------------------------------------------- * * DoTildeSubst -- * * Given a string following a tilde, this routine returns the | > | 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 | * so that "foo..o" would be split into "foo" and "..o". This is a * confusing and usually incorrect behavior, so now we split at the last * period in the name. */ return p; } #endif /* *---------------------------------------------------------------------- * * DoTildeSubst -- * * Given a string following a tilde, this routine returns the |
︙ | ︙ | |||
1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 | * * Side effects: * Information may be left in resultPtr. * *---------------------------------------------------------------------- */ static char * DoTildeSubst(interp, user, resultPtr) Tcl_Interp *interp; /* Interpreter in which to store error * message (if necessary). */ CONST char *user; /* Name of user whose home directory should be * substituted, or "" for current user. */ Tcl_DString *resultPtr; /* Initialized DString filled with name | > | 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 | * * Side effects: * Information may be left in resultPtr. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM static char * DoTildeSubst(interp, user, resultPtr) Tcl_Interp *interp; /* Interpreter in which to store error * message (if necessary). */ CONST char *user; /* Name of user whose home directory should be * substituted, or "" for current user. */ Tcl_DString *resultPtr; /* Initialized DString filled with name |
︙ | ︙ | |||
1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 | (char *) NULL); } return NULL; } } return resultPtr->string; } /* *---------------------------------------------------------------------- * * Tcl_GlobObjCmd -- * * This procedure is invoked to process the "glob" Tcl command. * See the user documentation for details on what it does. * * Results: * A standard Tcl result. * * Side effects: * See the user documentation. * *---------------------------------------------------------------------- */ /* ARGSUSED */ int Tcl_GlobObjCmd(dummy, interp, objc, objv) ClientData dummy; /* Not used. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ | > > | 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 | (char *) NULL); } return NULL; } } return resultPtr->string; } #endif /* *---------------------------------------------------------------------- * * Tcl_GlobObjCmd -- * * This procedure is invoked to process the "glob" Tcl command. * See the user documentation for details on what it does. * * Results: * A standard Tcl result. * * Side effects: * See the user documentation. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM /* ARGSUSED */ int Tcl_GlobObjCmd(dummy, interp, objc, objv) ClientData dummy; /* Not used. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ |
︙ | ︙ | |||
1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 | if (globTypes->macCreator != NULL) { Tcl_DecrRefCount(globTypes->macCreator); } ckfree((char *) globTypes); } return result; } /* *---------------------------------------------------------------------- * * TclGlob -- * * This procedure prepares arguments for the TclDoGlob call. | > | 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 | if (globTypes->macCreator != NULL) { Tcl_DecrRefCount(globTypes->macCreator); } ckfree((char *) globTypes); } return result; } #endif /* *---------------------------------------------------------------------- * * TclGlob -- * * This procedure prepares arguments for the TclDoGlob call. |
︙ | ︙ | |||
1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 | * * Side effects: * The currentArgString is written to. * *---------------------------------------------------------------------- */ /* ARGSUSED */ int TclGlob(interp, pattern, unquotedPrefix, globFlags, types) Tcl_Interp *interp; /* Interpreter for returning error message * or appending list of matching file names. */ char *pattern; /* Glob pattern to match. Must not refer * to a static string. */ | > | 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 | * * Side effects: * The currentArgString is written to. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM /* ARGSUSED */ int TclGlob(interp, pattern, unquotedPrefix, globFlags, types) Tcl_Interp *interp; /* Interpreter for returning error message * or appending list of matching file names. */ char *pattern; /* Glob pattern to match. Must not refer * to a static string. */ |
︙ | ︙ | |||
1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 | if (globFlags & GLOBMODE_NO_COMPLAIN) { Tcl_ResetResult(interp); return TCL_OK; } } return result; } /* *---------------------------------------------------------------------- * * SkipToChar -- * * This function traverses a glob pattern looking for the next | > | 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 | if (globFlags & GLOBMODE_NO_COMPLAIN) { Tcl_ResetResult(interp); return TCL_OK; } } return result; } #endif /* *---------------------------------------------------------------------- * * SkipToChar -- * * This function traverses a glob pattern looking for the next |
︙ | ︙ | |||
1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 | * * Side effects: * None. * *---------------------------------------------------------------------- */ static int SkipToChar(stringPtr, match) char **stringPtr; /* Pointer string to check. */ char *match; /* Pointer to character to find. */ { int quoted, level; register char *p; | > | 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 | * * Side effects: * None. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM static int SkipToChar(stringPtr, match) char **stringPtr; /* Pointer string to check. */ char *match; /* Pointer to character to find. */ { int quoted, level; register char *p; |
︙ | ︙ | |||
1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 | } else if (*p == '\\') { quoted = 1; } } *stringPtr = p; return 0; } /* *---------------------------------------------------------------------- * * TclDoGlob -- * * This recursive procedure forms the heart of the globbing | > | 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 | } else if (*p == '\\') { quoted = 1; } } *stringPtr = p; return 0; } #endif /* *---------------------------------------------------------------------- * * TclDoGlob -- * * This recursive procedure forms the heart of the globbing |
︙ | ︙ | |||
1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 | * * Side effects: * None. * *---------------------------------------------------------------------- */ int TclDoGlob(interp, separators, headPtr, tail, types) Tcl_Interp *interp; /* Interpreter to use for error reporting * (e.g. unmatched brace). */ char *separators; /* String containing separator characters * that should be used to identify globbing * boundaries. */ | > | 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 | * * Side effects: * None. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM int TclDoGlob(interp, separators, headPtr, tail, types) Tcl_Interp *interp; /* Interpreter to use for error reporting * (e.g. unmatched brace). */ char *separators; /* String containing separator characters * that should be used to identify globbing * boundaries. */ |
︙ | ︙ | |||
2126 2127 2128 2129 2130 2131 2132 | } break; } } return TCL_OK; } | > | 2159 2160 2161 2162 2163 2164 2165 2166 | } break; } } return TCL_OK; } #endif |
Changes to generic/tclIO.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * tclIO.c -- * * This file provides the generic portions (those that are the same on * all platforms and for all channel types) of Tcl's IO facilities. * * Copyright (c) 1998-2000 Ajuba Solutions * Copyright (c) 1995-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. * | | > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | /* * tclIO.c -- * * This file provides the generic portions (those that are the same on * all platforms and for all channel types) of Tcl's IO facilities. * * Copyright (c) 1998-2000 Ajuba Solutions * Copyright (c) 1995-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: tclIO.c,v 1.20.2.12.2.1 2001/11/28 17:58:36 andreas_kupries Exp $ */ #include "tclInt.h" #include "tclPort.h" #include "tclIO.h" #include <assert.h> #ifdef TCL_NO_NONSTDCHAN static void Tcl_RegisterChannelInternal _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Channel chan)); #define Tcl_RegisterChannel Tcl_RegisterChannelInternal #endif /* * All static variables used in this file are collected into a single * instance of the following structure. For multi-threaded implementations, * there is one instance of this structure for each thread. * |
︙ | ︙ | |||
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | static Tcl_ThreadDataKey dataKey; /* * Static functions in this file: */ static ChannelBuffer * AllocChannelBuffer _ANSI_ARGS_((int length)); static void ChannelTimerProc _ANSI_ARGS_(( ClientData clientData)); static int CheckChannelErrors _ANSI_ARGS_((ChannelState *statePtr, int direction)); static int CheckFlush _ANSI_ARGS_((Channel *chanPtr, ChannelBuffer *bufPtr, int newlineFlag)); static int CheckForDeadChannel _ANSI_ARGS_((Tcl_Interp *interp, ChannelState *statePtr)); static void CheckForStdChannelsBeingClosed _ANSI_ARGS_(( Tcl_Channel chan)); static void CleanupChannelHandlers _ANSI_ARGS_(( Tcl_Interp *interp, Channel *chanPtr)); static int CloseChannel _ANSI_ARGS_((Tcl_Interp *interp, Channel *chanPtr, int errorCode)); static void CommonGetsCleanup _ANSI_ARGS_((Channel *chanPtr, Tcl_Encoding encoding)); static int CopyAndTranslateBuffer _ANSI_ARGS_(( ChannelState *statePtr, char *result, int space)); static int CopyBuffer _ANSI_ARGS_(( Channel *chanPtr, char *result, int space)); static int CopyData _ANSI_ARGS_((CopyState *csPtr, int mask)); static void CopyEventProc _ANSI_ARGS_((ClientData clientData, int mask)); static void CreateScriptRecord _ANSI_ARGS_(( Tcl_Interp *interp, Channel *chanPtr, int mask, Tcl_Obj *scriptPtr)); static void DeleteChannelTable _ANSI_ARGS_(( ClientData clientData, Tcl_Interp *interp)); static void DeleteScriptRecord _ANSI_ARGS_((Tcl_Interp *interp, Channel *chanPtr, int mask)); static void DiscardInputQueued _ANSI_ARGS_((ChannelState *statePtr, int discardSavedBuffers)); static void DiscardOutputQueued _ANSI_ARGS_(( ChannelState *chanPtr)); static int DoRead _ANSI_ARGS_((Channel *chanPtr, char *srcPtr, int slen)); static int DoWrite _ANSI_ARGS_((Channel *chanPtr, char *src, int srcLen)); static int FilterInputBytes _ANSI_ARGS_((Channel *chanPtr, GetsState *statePtr)); static int FlushChannel _ANSI_ARGS_((Tcl_Interp *interp, Channel *chanPtr, int calledFromAsyncFlush)); static Tcl_HashTable * GetChannelTable _ANSI_ARGS_((Tcl_Interp *interp)); static int GetInput _ANSI_ARGS_((Channel *chanPtr)); static void PeekAhead _ANSI_ARGS_((Channel *chanPtr, char **dstEndPtr, GetsState *gsPtr)); static int ReadBytes _ANSI_ARGS_((ChannelState *statePtr, Tcl_Obj *objPtr, int charsLeft, int *offsetPtr)); static int ReadChars _ANSI_ARGS_((ChannelState *statePtr, Tcl_Obj *objPtr, int charsLeft, int *offsetPtr, int *factorPtr)); static void RecycleBuffer _ANSI_ARGS_((ChannelState *statePtr, ChannelBuffer *bufPtr, int mustDiscard)); static int StackSetBlockMode _ANSI_ARGS_((Channel *chanPtr, int mode)); static int SetBlockMode _ANSI_ARGS_((Tcl_Interp *interp, Channel *chanPtr, int mode)); static void StopCopy _ANSI_ARGS_((CopyState *csPtr)); static int TranslateInputEOL _ANSI_ARGS_((ChannelState *statePtr, char *dst, CONST char *src, int *dstLenPtr, int *srcLenPtr)); static int TranslateOutputEOL _ANSI_ARGS_((ChannelState *statePtr, char *dst, CONST char *src, int *dstLenPtr, int *srcLenPtr)); static void UpdateInterest _ANSI_ARGS_((Channel *chanPtr)); static int WriteBytes _ANSI_ARGS_((Channel *chanPtr, CONST char *src, int srcLen)); static int WriteChars _ANSI_ARGS_((Channel *chanPtr, | > > > > > > > > > > > > > > > > > > | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | static Tcl_ThreadDataKey dataKey; /* * Static functions in this file: */ static ChannelBuffer * AllocChannelBuffer _ANSI_ARGS_((int length)); #ifndef TCL_NO_FILEEVENTS static void ChannelTimerProc _ANSI_ARGS_(( ClientData clientData)); #endif static int CheckChannelErrors _ANSI_ARGS_((ChannelState *statePtr, int direction)); static int CheckFlush _ANSI_ARGS_((Channel *chanPtr, ChannelBuffer *bufPtr, int newlineFlag)); static int CheckForDeadChannel _ANSI_ARGS_((Tcl_Interp *interp, ChannelState *statePtr)); static void CheckForStdChannelsBeingClosed _ANSI_ARGS_(( Tcl_Channel chan)); #ifndef TCL_NO_FILEEVENTS static void CleanupChannelHandlers _ANSI_ARGS_(( Tcl_Interp *interp, Channel *chanPtr)); #endif static int CloseChannel _ANSI_ARGS_((Tcl_Interp *interp, Channel *chanPtr, int errorCode)); static void CommonGetsCleanup _ANSI_ARGS_((Channel *chanPtr, Tcl_Encoding encoding)); static int CopyAndTranslateBuffer _ANSI_ARGS_(( ChannelState *statePtr, char *result, int space)); static int CopyBuffer _ANSI_ARGS_(( Channel *chanPtr, char *result, int space)); #ifndef TCL_NO_CHANNELCOPY static int CopyData _ANSI_ARGS_((CopyState *csPtr, int mask)); #ifndef TCL_NO_FILEEVENTS static void CopyEventProc _ANSI_ARGS_((ClientData clientData, int mask)); #endif #endif #ifndef TCL_NO_FILEEVENTS static void CreateScriptRecord _ANSI_ARGS_(( Tcl_Interp *interp, Channel *chanPtr, int mask, Tcl_Obj *scriptPtr)); #endif static void DeleteChannelTable _ANSI_ARGS_(( ClientData clientData, Tcl_Interp *interp)); #ifndef TCL_NO_FILEEVENTS static void DeleteScriptRecord _ANSI_ARGS_((Tcl_Interp *interp, Channel *chanPtr, int mask)); #endif static void DiscardInputQueued _ANSI_ARGS_((ChannelState *statePtr, int discardSavedBuffers)); static void DiscardOutputQueued _ANSI_ARGS_(( ChannelState *chanPtr)); static int DoRead _ANSI_ARGS_((Channel *chanPtr, char *srcPtr, int slen)); static int DoWrite _ANSI_ARGS_((Channel *chanPtr, char *src, int srcLen)); static int FilterInputBytes _ANSI_ARGS_((Channel *chanPtr, GetsState *statePtr)); static int FlushChannel _ANSI_ARGS_((Tcl_Interp *interp, Channel *chanPtr, int calledFromAsyncFlush)); static Tcl_HashTable * GetChannelTable _ANSI_ARGS_((Tcl_Interp *interp)); static int GetInput _ANSI_ARGS_((Channel *chanPtr)); static void PeekAhead _ANSI_ARGS_((Channel *chanPtr, char **dstEndPtr, GetsState *gsPtr)); #if !defined(TCL_NO_CHANNEL_READ) || !defined(TCL_NO_PIPES) static int ReadBytes _ANSI_ARGS_((ChannelState *statePtr, Tcl_Obj *objPtr, int charsLeft, int *offsetPtr)); static int ReadChars _ANSI_ARGS_((ChannelState *statePtr, Tcl_Obj *objPtr, int charsLeft, int *offsetPtr, int *factorPtr)); #endif static void RecycleBuffer _ANSI_ARGS_((ChannelState *statePtr, ChannelBuffer *bufPtr, int mustDiscard)); static int StackSetBlockMode _ANSI_ARGS_((Channel *chanPtr, int mode)); static int SetBlockMode _ANSI_ARGS_((Tcl_Interp *interp, Channel *chanPtr, int mode)); #ifndef TCL_NO_CHANNELCOPY static void StopCopy _ANSI_ARGS_((CopyState *csPtr)); #endif #if !defined(TCL_NO_CHANNEL_READ) || !defined(TCL_NO_PIPES) static int TranslateInputEOL _ANSI_ARGS_((ChannelState *statePtr, char *dst, CONST char *src, int *dstLenPtr, int *srcLenPtr)); #endif static int TranslateOutputEOL _ANSI_ARGS_((ChannelState *statePtr, char *dst, CONST char *src, int *dstLenPtr, int *srcLenPtr)); static void UpdateInterest _ANSI_ARGS_((Channel *chanPtr)); static int WriteBytes _ANSI_ARGS_((Channel *chanPtr, CONST char *src, int srcLen)); static int WriteChars _ANSI_ARGS_((Channel *chanPtr, |
︙ | ︙ | |||
549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 | Tcl_Interp *interp; /* The interpreter being deleted. */ { Tcl_HashTable *hTblPtr; /* The hash table. */ Tcl_HashSearch hSearch; /* Search variable. */ Tcl_HashEntry *hPtr; /* Search variable. */ Channel *chanPtr; /* Channel being deleted. */ ChannelState *statePtr; /* State of Channel being deleted. */ EventScriptRecord *sPtr, *prevPtr, *nextPtr; /* Variables to loop over all channel events * registered, to delete the ones that refer * to the interpreter being deleted. */ /* * Delete all the registered channels - this will close channels whose * refcount reaches zero. */ hTblPtr = (Tcl_HashTable *) clientData; for (hPtr = Tcl_FirstHashEntry(hTblPtr, &hSearch); hPtr != (Tcl_HashEntry *) NULL; hPtr = Tcl_FirstHashEntry(hTblPtr, &hSearch)) { chanPtr = (Channel *) Tcl_GetHashValue(hPtr); statePtr = chanPtr->state; /* * Remove any fileevents registered in this interpreter. */ for (sPtr = statePtr->scriptRecordPtr, prevPtr = (EventScriptRecord *) NULL; sPtr != (EventScriptRecord *) NULL; | > > > | 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 | Tcl_Interp *interp; /* The interpreter being deleted. */ { Tcl_HashTable *hTblPtr; /* The hash table. */ Tcl_HashSearch hSearch; /* Search variable. */ Tcl_HashEntry *hPtr; /* Search variable. */ Channel *chanPtr; /* Channel being deleted. */ ChannelState *statePtr; /* State of Channel being deleted. */ #ifndef TCL_NO_FILEEVENTS EventScriptRecord *sPtr, *prevPtr, *nextPtr; /* Variables to loop over all channel events * registered, to delete the ones that refer * to the interpreter being deleted. */ #endif /* * Delete all the registered channels - this will close channels whose * refcount reaches zero. */ hTblPtr = (Tcl_HashTable *) clientData; for (hPtr = Tcl_FirstHashEntry(hTblPtr, &hSearch); hPtr != (Tcl_HashEntry *) NULL; hPtr = Tcl_FirstHashEntry(hTblPtr, &hSearch)) { chanPtr = (Channel *) Tcl_GetHashValue(hPtr); statePtr = chanPtr->state; #ifndef TCL_NO_FILEEVENTS /* * Remove any fileevents registered in this interpreter. */ for (sPtr = statePtr->scriptRecordPtr, prevPtr = (EventScriptRecord *) NULL; sPtr != (EventScriptRecord *) NULL; |
︙ | ︙ | |||
592 593 594 595 596 597 598 599 600 601 602 603 604 605 | Tcl_DecrRefCount(sPtr->scriptPtr); ckfree((char *) sPtr); } else { prevPtr = sPtr; } } /* * Cannot call Tcl_UnregisterChannel because that procedure calls * Tcl_GetAssocData to get the channel table, which might already * be inaccessible from the interpreter structure. Instead, we * emulate the behavior of Tcl_UnregisterChannel directly here. */ | > | 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 | Tcl_DecrRefCount(sPtr->scriptPtr); ckfree((char *) sPtr); } else { prevPtr = sPtr; } } #endif /* * Cannot call Tcl_UnregisterChannel because that procedure calls * Tcl_GetAssocData to get the channel table, which might already * be inaccessible from the interpreter structure. Instead, we * emulate the behavior of Tcl_UnregisterChannel directly here. */ |
︙ | ︙ | |||
738 739 740 741 742 743 744 745 746 747 748 749 750 751 | * * Side effects: * Deletes the hash entry for a channel associated with an interpreter. * *---------------------------------------------------------------------- */ int Tcl_UnregisterChannel(interp, chan) Tcl_Interp *interp; /* Interpreter in which channel is defined. */ Tcl_Channel chan; /* Channel to delete. */ { Tcl_HashTable *hTblPtr; /* Hash table of channels. */ Tcl_HashEntry *hPtr; /* Search variable. */ | > > > > > > > | 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 | * * Side effects: * Deletes the hash entry for a channel associated with an interpreter. * *---------------------------------------------------------------------- */ #ifdef TCL_NO_NONSTDCHAN /* IOS FIXME: Unregister is still required to make sub interpreters safe by * removing the std* channels from them. * This means that removal of sub interp functionality allows the removal of this * functionality too. */ #endif int Tcl_UnregisterChannel(interp, chan) Tcl_Interp *interp; /* Interpreter in which channel is defined. */ Tcl_Channel chan; /* Channel to delete. */ { Tcl_HashTable *hTblPtr; /* Hash table of channels. */ Tcl_HashEntry *hPtr; /* Search variable. */ |
︙ | ︙ | |||
770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 | return TCL_OK; } if ((Channel *) Tcl_GetHashValue(hPtr) != chanPtr) { return TCL_OK; } Tcl_DeleteHashEntry(hPtr); /* * Remove channel handlers that refer to this interpreter, so that they * will not be present if the actual close is delayed and more events * happen on the channel. This may occur if the channel is shared * between several interpreters, or if the channel has async * flushing active. */ CleanupChannelHandlers(interp, chanPtr); } statePtr->refCount--; /* * Perform special handling for standard channels being closed. If the * refCount is now 1 it means that the last reference to the standard | > > | 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 | return TCL_OK; } if ((Channel *) Tcl_GetHashValue(hPtr) != chanPtr) { return TCL_OK; } Tcl_DeleteHashEntry(hPtr); #ifndef TCL_NO_FILEEVENTS /* * Remove channel handlers that refer to this interpreter, so that they * will not be present if the actual close is delayed and more events * happen on the channel. This may occur if the channel is shared * between several interpreters, or if the channel has async * flushing active. */ CleanupChannelHandlers(interp, chanPtr); #endif } statePtr->refCount--; /* * Perform special handling for standard channels being closed. If the * refCount is now 1 it means that the last reference to the standard |
︙ | ︙ | |||
2175 2176 2177 2178 2179 2180 2181 | * Tcl_Close removes the channel as far as the user is concerned. * However, it may continue to exist for a while longer if it has * a background flush scheduled. The device itself is eventually * closed and the channel record removed, in CloseChannel, above. * *---------------------------------------------------------------------- */ | < | 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 | * Tcl_Close removes the channel as far as the user is concerned. * However, it may continue to exist for a while longer if it has * a background flush scheduled. The device itself is eventually * closed and the channel record removed, in CloseChannel, above. * *---------------------------------------------------------------------- */ /* ARGSUSED */ int Tcl_Close(interp, chan) Tcl_Interp *interp; /* Interpreter for errors. */ Tcl_Channel chan; /* The channel being closed. Must * not be referenced in any * interpreter. */ |
︙ | ︙ | |||
2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 | } statePtr->chPtr = (ChannelHandler *) NULL; /* * Cancel any pending copy operation. */ StopCopy(statePtr->csPtr); /* * Must set the interest mask now to 0, otherwise infinite loops * will occur if Tcl_DoOneEvent is called before the channel is * finally deleted in FlushChannel. This can happen if the channel * has a background flush active. */ | > > | 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 | } statePtr->chPtr = (ChannelHandler *) NULL; /* * Cancel any pending copy operation. */ #ifndef TCL_NO_CHANNELCOPY StopCopy(statePtr->csPtr); #endif /* * Must set the interest mask now to 0, otherwise infinite loops * will occur if Tcl_DoOneEvent is called before the channel is * finally deleted in FlushChannel. This can happen if the channel * has a background flush active. */ |
︙ | ︙ | |||
3849 3850 3851 3852 3853 3854 3855 | * to retrieve the error code for the error that occurred. * * Side effects: * May cause input to be buffered. * *--------------------------------------------------------------------------- */ | | > | 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 | * to retrieve the error code for the error that occurred. * * Side effects: * May cause input to be buffered. * *--------------------------------------------------------------------------- */ #if !defined(TCL_NO_CHANNEL_READ) || !defined(TCL_NO_PIPES) int Tcl_ReadChars(chan, objPtr, toRead, appendFlag) Tcl_Channel chan; /* The channel to read. */ Tcl_Obj *objPtr; /* Input data is stored in this object. */ int toRead; /* Maximum number of characters to store, * or -1 to read all available data (up to EOF * or when channel blocks). */ |
︙ | ︙ | |||
3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 | * Update the notifier state so we don't block while there is still * data in the buffers. */ UpdateInterest(chanPtr); return copied; } /* *--------------------------------------------------------------------------- * * ReadBytes -- * * Reads from the channel until the requested number of bytes have * been seen, EOF is seen, or the channel would block. Bytes from | > | 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 | * Update the notifier state so we don't block while there is still * data in the buffers. */ UpdateInterest(chanPtr); return copied; } #endif /* *--------------------------------------------------------------------------- * * ReadBytes -- * * Reads from the channel until the requested number of bytes have * been seen, EOF is seen, or the channel would block. Bytes from |
︙ | ︙ | |||
3989 3990 3991 3992 3993 3994 3995 | * in the object). * * Side effects: * None. * *--------------------------------------------------------------------------- */ | | | 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 | * in the object). * * Side effects: * None. * *--------------------------------------------------------------------------- */ #if !defined(TCL_NO_CHANNEL_READ) || !defined(TCL_NO_PIPES) static int ReadBytes(statePtr, objPtr, bytesToRead, offsetPtr) ChannelState *statePtr; /* State of the channel to read. */ int bytesToRead; /* Maximum number of characters to store, * or < 0 to get all available characters. * Characters are obtained from the first * buffer in the queue -- even if this number |
︙ | ︙ | |||
4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 | statePtr->flags &= ~(INPUT_SAW_CR | INPUT_NEED_NL); return 1; } *srcLenPtr = srcLen; return 0; } /* *---------------------------------------------------------------------- * * Tcl_Ungets -- * * Causes the supplied string to be added to the input queue of | > | 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 | statePtr->flags &= ~(INPUT_SAW_CR | INPUT_NEED_NL); return 1; } *srcLenPtr = srcLen; return 0; } #endif /* *---------------------------------------------------------------------- * * Tcl_Ungets -- * * Causes the supplied string to be added to the input queue of |
︙ | ︙ | |||
4836 4837 4838 4839 4840 4841 4842 | * to retrieve the POSIX error code for the error that occurred. * * Side effects: * May flush output on the channel. May discard queued input. * *---------------------------------------------------------------------- */ | | | 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 | * to retrieve the POSIX error code for the error that occurred. * * Side effects: * May flush output on the channel. May discard queued input. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_NONSTDCHAN int Tcl_Seek(chan, offset, mode) Tcl_Channel chan; /* The channel on which to seek. */ int offset; /* Offset to seek to. */ int mode; /* Relative to which location to seek? */ { Channel *chanPtr = (Channel *) chan; /* The real IO channel. */ |
︙ | ︙ | |||
5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 | if (result != 0) { return -1; } } return curPos; } /* *---------------------------------------------------------------------- * * Tcl_Tell -- * * Returns the position of the next character to be read/written on | > | 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 | if (result != 0) { return -1; } } return curPos; } #endif /* *---------------------------------------------------------------------- * * Tcl_Tell -- * * Returns the position of the next character to be read/written on |
︙ | ︙ | |||
5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 | * * Side effects: * None. * *---------------------------------------------------------------------- */ int Tcl_GetChannelOption(interp, chan, optionName, dsPtr) Tcl_Interp *interp; /* For error reporting - can be NULL. */ Tcl_Channel chan; /* Channel on which to get option. */ char *optionName; /* Option to get. */ Tcl_DString *dsPtr; /* Where to store value(s). */ { | > | 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 | * * Side effects: * None. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_CHANNEL_CONFIG int Tcl_GetChannelOption(interp, chan, optionName, dsPtr) Tcl_Interp *interp; /* For error reporting - can be NULL. */ Tcl_Channel chan; /* Channel on which to get option. */ char *optionName; /* Option to get. */ Tcl_DString *dsPtr; /* Where to store value(s). */ { |
︙ | ︙ | |||
5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 | if (len == 0) { return TCL_OK; } return Tcl_BadChannelOption(interp, optionName, NULL); } } /* *--------------------------------------------------------------------------- * * Tcl_SetChannelOption -- * * Sets an option on a channel. | > | 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 | if (len == 0) { return TCL_OK; } return Tcl_BadChannelOption(interp, optionName, NULL); } } #endif /* *--------------------------------------------------------------------------- * * Tcl_SetChannelOption -- * * Sets an option on a channel. |
︙ | ︙ | |||
6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 | * * Side effects: * Removes channel handlers. * *---------------------------------------------------------------------- */ static void CleanupChannelHandlers(interp, chanPtr) Tcl_Interp *interp; Channel *chanPtr; { ChannelState *statePtr = chanPtr->state; /* state info for channel */ EventScriptRecord *sPtr, *prevPtr, *nextPtr; | > | 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 | * * Side effects: * Removes channel handlers. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILEEVENTS static void CleanupChannelHandlers(interp, chanPtr) Tcl_Interp *interp; Channel *chanPtr; { ChannelState *statePtr = chanPtr->state; /* state info for channel */ EventScriptRecord *sPtr, *prevPtr, *nextPtr; |
︙ | ︙ | |||
6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 | Tcl_DecrRefCount(sPtr->scriptPtr); ckfree((char *) sPtr); } else { prevPtr = sPtr; } } } /* *---------------------------------------------------------------------- * * Tcl_NotifyChannel -- * * This procedure is called by a channel driver when a driver * detects an event on a channel. This procedure is responsible * for actually handling the event by invoking any channel * handler callbacks. * * Results: * None. * * Side effects: * Whatever the channel handler callback procedure does. * *---------------------------------------------------------------------- */ void Tcl_NotifyChannel(channel, mask) Tcl_Channel channel; /* Channel that detected an event. */ int mask; /* OR'ed combination of TCL_READABLE, * TCL_WRITABLE, or TCL_EXCEPTION: indicates * which events were detected. */ { | > > | 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 | Tcl_DecrRefCount(sPtr->scriptPtr); ckfree((char *) sPtr); } else { prevPtr = sPtr; } } } #endif /* *---------------------------------------------------------------------- * * Tcl_NotifyChannel -- * * This procedure is called by a channel driver when a driver * detects an event on a channel. This procedure is responsible * for actually handling the event by invoking any channel * handler callbacks. * * Results: * None. * * Side effects: * Whatever the channel handler callback procedure does. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILEEVENTS void Tcl_NotifyChannel(channel, mask) Tcl_Channel channel; /* Channel that detected an event. */ int mask; /* OR'ed combination of TCL_READABLE, * TCL_WRITABLE, or TCL_EXCEPTION: indicates * which events were detected. */ { |
︙ | ︙ | |||
6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 | } Tcl_Release((ClientData) statePtr); Tcl_Release((ClientData) channel); tsdPtr->nestedHandlerPtr = nh.nestedHandlerPtr; } /* *---------------------------------------------------------------------- * * UpdateInterest -- * * Arrange for the notifier to call us back at appropriate times | > | 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 | } Tcl_Release((ClientData) statePtr); Tcl_Release((ClientData) channel); tsdPtr->nestedHandlerPtr = nh.nestedHandlerPtr; } #endif /* *---------------------------------------------------------------------- * * UpdateInterest -- * * Arrange for the notifier to call us back at appropriate times |
︙ | ︙ | |||
6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 | *---------------------------------------------------------------------- */ static void UpdateInterest(chanPtr) Channel *chanPtr; /* Channel to update. */ { ChannelState *statePtr = chanPtr->state; /* state info for channel */ int mask = statePtr->interestMask; /* * If there are flushed buffers waiting to be written, then * we need to watch for the channel to become writable. */ | > | 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 | *---------------------------------------------------------------------- */ static void UpdateInterest(chanPtr) Channel *chanPtr; /* Channel to update. */ { #ifndef TCL_NO_FILEEVENTS ChannelState *statePtr = chanPtr->state; /* state info for channel */ int mask = statePtr->interestMask; /* * If there are flushed buffers waiting to be written, then * we need to watch for the channel to become writable. */ |
︙ | ︙ | |||
6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 | if (!statePtr->timer) { statePtr->timer = Tcl_CreateTimerHandler(0, ChannelTimerProc, (ClientData) chanPtr); } } } (chanPtr->typePtr->watchProc)(chanPtr->instanceData, mask); } /* *---------------------------------------------------------------------- * * ChannelTimerProc -- * * Timer handler scheduled by UpdateInterest to monitor the * channel buffers until they are empty. * * Results: * None. * * Side effects: * May invoke channel handlers. * *---------------------------------------------------------------------- */ static void ChannelTimerProc(clientData) ClientData clientData; { Channel *chanPtr = (Channel *) clientData; ChannelState *statePtr = chanPtr->state; /* state info for channel */ | > > | 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 | if (!statePtr->timer) { statePtr->timer = Tcl_CreateTimerHandler(0, ChannelTimerProc, (ClientData) chanPtr); } } } (chanPtr->typePtr->watchProc)(chanPtr->instanceData, mask); #endif } /* *---------------------------------------------------------------------- * * ChannelTimerProc -- * * Timer handler scheduled by UpdateInterest to monitor the * channel buffers until they are empty. * * Results: * None. * * Side effects: * May invoke channel handlers. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILEEVENTS static void ChannelTimerProc(clientData) ClientData clientData; { Channel *chanPtr = (Channel *) clientData; ChannelState *statePtr = chanPtr->state; /* state info for channel */ |
︙ | ︙ | |||
6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 | statePtr->flags &= ~CHANNEL_TIMER_FEV; Tcl_Release((ClientData) statePtr); } else { statePtr->timer = NULL; UpdateInterest(chanPtr); } } /* *---------------------------------------------------------------------- * * Tcl_CreateChannelHandler -- * * Arrange for a given procedure to be invoked whenever the | > | 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 | statePtr->flags &= ~CHANNEL_TIMER_FEV; Tcl_Release((ClientData) statePtr); } else { statePtr->timer = NULL; UpdateInterest(chanPtr); } } #endif /* *---------------------------------------------------------------------- * * Tcl_CreateChannelHandler -- * * Arrange for a given procedure to be invoked whenever the |
︙ | ︙ | |||
6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 | * See the manual entry for details on the calling sequence * to proc. If there is already an event handler for chan, proc * and clientData, then the mask will be updated. * *---------------------------------------------------------------------- */ void Tcl_CreateChannelHandler(chan, mask, proc, clientData) Tcl_Channel chan; /* The channel to create the handler for. */ int mask; /* OR'ed combination of TCL_READABLE, * TCL_WRITABLE, and TCL_EXCEPTION: * indicates conditions under which * proc should be called. Use 0 to | > | 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 | * See the manual entry for details on the calling sequence * to proc. If there is already an event handler for chan, proc * and clientData, then the mask will be updated. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILEEVENTS void Tcl_CreateChannelHandler(chan, mask, proc, clientData) Tcl_Channel chan; /* The channel to create the handler for. */ int mask; /* OR'ed combination of TCL_READABLE, * TCL_WRITABLE, and TCL_EXCEPTION: * indicates conditions under which * proc should be called. Use 0 to |
︙ | ︙ | |||
6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 | chPtr != (ChannelHandler *) NULL; chPtr = chPtr->nextPtr) { statePtr->interestMask |= chPtr->mask; } UpdateInterest(statePtr->topChanPtr); } /* *---------------------------------------------------------------------- * * Tcl_DeleteChannelHandler -- * * Cancel a previously arranged callback arrangement for an IO * channel. * * Results: * None. * * Side effects: * If a callback was previously registered for this chan, proc and * clientData , it is removed and the callback will no longer be called * when the channel becomes ready for IO. * *---------------------------------------------------------------------- */ void Tcl_DeleteChannelHandler(chan, proc, clientData) Tcl_Channel chan; /* The channel for which to remove the * callback. */ Tcl_ChannelProc *proc; /* The procedure in the callback to delete. */ ClientData clientData; /* The client data in the callback * to delete. */ | > > | 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 | chPtr != (ChannelHandler *) NULL; chPtr = chPtr->nextPtr) { statePtr->interestMask |= chPtr->mask; } UpdateInterest(statePtr->topChanPtr); } #endif /* *---------------------------------------------------------------------- * * Tcl_DeleteChannelHandler -- * * Cancel a previously arranged callback arrangement for an IO * channel. * * Results: * None. * * Side effects: * If a callback was previously registered for this chan, proc and * clientData , it is removed and the callback will no longer be called * when the channel becomes ready for IO. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILEEVENTS void Tcl_DeleteChannelHandler(chan, proc, clientData) Tcl_Channel chan; /* The channel for which to remove the * callback. */ Tcl_ChannelProc *proc; /* The procedure in the callback to delete. */ ClientData clientData; /* The client data in the callback * to delete. */ |
︙ | ︙ | |||
6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 | chPtr != (ChannelHandler *) NULL; chPtr = chPtr->nextPtr) { statePtr->interestMask |= chPtr->mask; } UpdateInterest(statePtr->topChanPtr); } /* *---------------------------------------------------------------------- * * DeleteScriptRecord -- * * Delete a script record for this combination of channel, interp * and mask. * * Results: * None. * * Side effects: * Deletes a script record and cancels a channel event handler. * *---------------------------------------------------------------------- */ static void DeleteScriptRecord(interp, chanPtr, mask) Tcl_Interp *interp; /* Interpreter in which script was to be * executed. */ Channel *chanPtr; /* The channel for which to delete the * script record (if any). */ int mask; /* Events in mask must exactly match mask | > > | 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 | chPtr != (ChannelHandler *) NULL; chPtr = chPtr->nextPtr) { statePtr->interestMask |= chPtr->mask; } UpdateInterest(statePtr->topChanPtr); } #endif /* *---------------------------------------------------------------------- * * DeleteScriptRecord -- * * Delete a script record for this combination of channel, interp * and mask. * * Results: * None. * * Side effects: * Deletes a script record and cancels a channel event handler. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILEEVENTS static void DeleteScriptRecord(interp, chanPtr, mask) Tcl_Interp *interp; /* Interpreter in which script was to be * executed. */ Channel *chanPtr; /* The channel for which to delete the * script record (if any). */ int mask; /* Events in mask must exactly match mask |
︙ | ︙ | |||
6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 | Tcl_DecrRefCount(esPtr->scriptPtr); ckfree((char *) esPtr); break; } } } /* *---------------------------------------------------------------------- * * CreateScriptRecord -- * * Creates a record to store a script to be executed when a specific * event fires on a specific channel. * * Results: * None. * * Side effects: * Causes the script to be stored for later execution. * *---------------------------------------------------------------------- */ static void CreateScriptRecord(interp, chanPtr, mask, scriptPtr) Tcl_Interp *interp; /* Interpreter in which to execute * the stored script. */ Channel *chanPtr; /* Channel for which script is to * be stored. */ int mask; /* Set of events for which script | > > | 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 | Tcl_DecrRefCount(esPtr->scriptPtr); ckfree((char *) esPtr); break; } } } #endif /* *---------------------------------------------------------------------- * * CreateScriptRecord -- * * Creates a record to store a script to be executed when a specific * event fires on a specific channel. * * Results: * None. * * Side effects: * Causes the script to be stored for later execution. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILEEVENTS static void CreateScriptRecord(interp, chanPtr, mask, scriptPtr) Tcl_Interp *interp; /* Interpreter in which to execute * the stored script. */ Channel *chanPtr; /* Channel for which script is to * be stored. */ int mask; /* Set of events for which script |
︙ | ︙ | |||
6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 | } esPtr->chanPtr = chanPtr; esPtr->interp = interp; esPtr->mask = mask; Tcl_IncrRefCount(scriptPtr); esPtr->scriptPtr = scriptPtr; } /* *---------------------------------------------------------------------- * * TclChannelEventScriptInvoker -- * * Invokes a script scheduled by "fileevent" for when the channel * becomes ready for IO. This function is invoked by the channel * handler which was created by the Tcl "fileevent" command. * * Results: * None. * * Side effects: * Whatever the script does. * *---------------------------------------------------------------------- */ void TclChannelEventScriptInvoker(clientData, mask) ClientData clientData; /* The script+interp record. */ int mask; /* Not used. */ { Tcl_Interp *interp; /* Interpreter in which to eval the script. */ Channel *chanPtr; /* The channel for which this handler is | > > | 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 | } esPtr->chanPtr = chanPtr; esPtr->interp = interp; esPtr->mask = mask; Tcl_IncrRefCount(scriptPtr); esPtr->scriptPtr = scriptPtr; } #endif /* *---------------------------------------------------------------------- * * TclChannelEventScriptInvoker -- * * Invokes a script scheduled by "fileevent" for when the channel * becomes ready for IO. This function is invoked by the channel * handler which was created by the Tcl "fileevent" command. * * Results: * None. * * Side effects: * Whatever the script does. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILEEVENTS void TclChannelEventScriptInvoker(clientData, mask) ClientData clientData; /* The script+interp record. */ int mask; /* Not used. */ { Tcl_Interp *interp; /* Interpreter in which to eval the script. */ Channel *chanPtr; /* The channel for which this handler is |
︙ | ︙ | |||
6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 | if (chanPtr->typePtr != NULL) { DeleteScriptRecord(interp, chanPtr, mask); } Tcl_BackgroundError(interp); } Tcl_Release((ClientData) interp); } /* *---------------------------------------------------------------------- * * Tcl_FileEventObjCmd -- * * This procedure implements the "fileevent" Tcl command. See the * user documentation for details on what it does. This command is * based on the Tk command "fileevent" which in turn is based on work * contributed by Mark Diekhans. * * Results: * A standard Tcl result. * * Side effects: * May create a channel handler for the specified channel. * *---------------------------------------------------------------------- */ /* ARGSUSED */ int Tcl_FileEventObjCmd(clientData, interp, objc, objv) ClientData clientData; /* Not used. */ Tcl_Interp *interp; /* Interpreter in which the channel * for which to create the handler * is found. */ | > > | 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 | if (chanPtr->typePtr != NULL) { DeleteScriptRecord(interp, chanPtr, mask); } Tcl_BackgroundError(interp); } Tcl_Release((ClientData) interp); } #endif /* *---------------------------------------------------------------------- * * Tcl_FileEventObjCmd -- * * This procedure implements the "fileevent" Tcl command. See the * user documentation for details on what it does. This command is * based on the Tk command "fileevent" which in turn is based on work * contributed by Mark Diekhans. * * Results: * A standard Tcl result. * * Side effects: * May create a channel handler for the specified channel. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILEEVENTS /* ARGSUSED */ int Tcl_FileEventObjCmd(clientData, interp, objc, objv) ClientData clientData; /* Not used. */ Tcl_Interp *interp; /* Interpreter in which the channel * for which to create the handler * is found. */ |
︙ | ︙ | |||
6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 | * will evaluate the script in the supplied interpreter. */ CreateScriptRecord(interp, chanPtr, mask, objv[3]); return TCL_OK; } /* *---------------------------------------------------------------------- * * TclCopyChannel -- * * This routine copies data from one channel to another, either | > | 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 | * will evaluate the script in the supplied interpreter. */ CreateScriptRecord(interp, chanPtr, mask, objv[3]); return TCL_OK; } #endif /* *---------------------------------------------------------------------- * * TclCopyChannel -- * * This routine copies data from one channel to another, either |
︙ | ︙ | |||
6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 | * Side effects: * May schedule a background copy operation that causes both * channels to be marked busy. * *---------------------------------------------------------------------- */ int TclCopyChannel(interp, inChan, outChan, toRead, cmdPtr) Tcl_Interp *interp; /* Current interpreter. */ Tcl_Channel inChan; /* Channel to read from. */ Tcl_Channel outChan; /* Channel to write to. */ int toRead; /* Amount of data to copy, or -1 for all. */ Tcl_Obj *cmdPtr; /* Pointer to script to execute or NULL. */ | > | 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 | * Side effects: * May schedule a background copy operation that causes both * channels to be marked busy. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_CHANNELCOPY int TclCopyChannel(interp, inChan, outChan, toRead, cmdPtr) Tcl_Interp *interp; /* Current interpreter. */ Tcl_Channel inChan; /* Channel to read from. */ Tcl_Channel outChan; /* Channel to write to. */ int toRead; /* Amount of data to copy, or -1 for all. */ Tcl_Obj *cmdPtr; /* Pointer to script to execute or NULL. */ |
︙ | ︙ | |||
6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 | * then the copying is done, otherwise set up a channel * handler to detect when the channel becomes readable again. */ if (Tcl_Eof(inChan)) { break; } else if (!(mask & TCL_READABLE)) { if (mask & TCL_WRITABLE) { Tcl_DeleteChannelHandler(outChan, CopyEventProc, (ClientData) csPtr); } Tcl_CreateChannelHandler(inChan, TCL_READABLE, CopyEventProc, (ClientData) csPtr); } return TCL_OK; } /* * Now write the buffer out. */ | > > | 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 | * then the copying is done, otherwise set up a channel * handler to detect when the channel becomes readable again. */ if (Tcl_Eof(inChan)) { break; } else if (!(mask & TCL_READABLE)) { #ifndef TCL_NO_FILEEVENTS if (mask & TCL_WRITABLE) { Tcl_DeleteChannelHandler(outChan, CopyEventProc, (ClientData) csPtr); } Tcl_CreateChannelHandler(inChan, TCL_READABLE, CopyEventProc, (ClientData) csPtr); #endif } return TCL_OK; } /* * Now write the buffer out. */ |
︙ | ︙ | |||
7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 | /* * Check to see if the write is happening in the background. If so, * stop copying and wait for the channel to become writable again. */ if (outStatePtr->flags & BG_FLUSH_SCHEDULED) { if (!(mask & TCL_WRITABLE)) { if (mask & TCL_READABLE) { Tcl_DeleteChannelHandler(inChan, CopyEventProc, (ClientData) csPtr); } Tcl_CreateChannelHandler(outChan, TCL_WRITABLE, CopyEventProc, (ClientData) csPtr); } return TCL_OK; } /* * For background copies, we only do one buffer per invocation so * we don't starve the rest of the system. */ if (cmdPtr) { /* * The first time we enter this code, there won't be a * channel handler established yet, so do it here. */ if (mask == 0) { Tcl_CreateChannelHandler(outChan, TCL_WRITABLE, CopyEventProc, (ClientData) csPtr); } return TCL_OK; } } /* * Make the callback or return the number of bytes transferred. * The local total is used because StopCopy frees csPtr. */ total = csPtr->total; if (cmdPtr) { /* * Get a private copy of the command so we can mutate it * by adding arguments. Note that StopCopy frees our saved * reference to the original command obj. */ | > > > > > | 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 | /* * Check to see if the write is happening in the background. If so, * stop copying and wait for the channel to become writable again. */ if (outStatePtr->flags & BG_FLUSH_SCHEDULED) { #ifndef TCL_NO_FILEEVENTS if (!(mask & TCL_WRITABLE)) { if (mask & TCL_READABLE) { Tcl_DeleteChannelHandler(inChan, CopyEventProc, (ClientData) csPtr); } Tcl_CreateChannelHandler(outChan, TCL_WRITABLE, CopyEventProc, (ClientData) csPtr); } #endif return TCL_OK; } #ifndef TCL_NO_FILEEVENTS /* * For background copies, we only do one buffer per invocation so * we don't starve the rest of the system. */ if (cmdPtr) { /* * The first time we enter this code, there won't be a * channel handler established yet, so do it here. */ if (mask == 0) { Tcl_CreateChannelHandler(outChan, TCL_WRITABLE, CopyEventProc, (ClientData) csPtr); } return TCL_OK; } #endif } /* * Make the callback or return the number of bytes transferred. * The local total is used because StopCopy frees csPtr. */ total = csPtr->total; #ifndef TCL_NO_FILEEVENTS if (cmdPtr) { /* * Get a private copy of the command so we can mutate it * by adding arguments. Note that StopCopy frees our saved * reference to the original command obj. */ |
︙ | ︙ | |||
7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 | if (Tcl_EvalObjEx(interp, cmdPtr, TCL_EVAL_GLOBAL) != TCL_OK) { Tcl_BackgroundError(interp); result = TCL_ERROR; } Tcl_DecrRefCount(cmdPtr); Tcl_Release((ClientData) interp); } else { StopCopy(csPtr); if (errObj) { Tcl_SetObjResult(interp, errObj); result = TCL_ERROR; } else { Tcl_ResetResult(interp); Tcl_SetIntObj(Tcl_GetObjResult(interp), total); } } return result; } /* *---------------------------------------------------------------------- * * DoRead -- * * Reads a given number of bytes from a channel. | > > > > | 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 | if (Tcl_EvalObjEx(interp, cmdPtr, TCL_EVAL_GLOBAL) != TCL_OK) { Tcl_BackgroundError(interp); result = TCL_ERROR; } Tcl_DecrRefCount(cmdPtr); Tcl_Release((ClientData) interp); } else { #endif StopCopy(csPtr); if (errObj) { Tcl_SetObjResult(interp, errObj); result = TCL_ERROR; } else { Tcl_ResetResult(interp); Tcl_SetIntObj(Tcl_GetObjResult(interp), total); } #ifndef TCL_NO_FILEEVENTS } #endif return result; } #endif /* *---------------------------------------------------------------------- * * DoRead -- * * Reads a given number of bytes from a channel. |
︙ | ︙ | |||
7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 | * * Side effects: * None. * *---------------------------------------------------------------------- */ static void CopyEventProc(clientData, mask) ClientData clientData; int mask; { (void) CopyData((CopyState *)clientData, mask); } /* *---------------------------------------------------------------------- * * StopCopy -- * * This routine halts a copy that is in progress. | > > > | 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 | * * Side effects: * None. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_CHANNELCOPY #ifndef TCL_NO_FILEEVENTS static void CopyEventProc(clientData, mask) ClientData clientData; int mask; { (void) CopyData((CopyState *)clientData, mask); } #endif /* *---------------------------------------------------------------------- * * StopCopy -- * * This routine halts a copy that is in progress. |
︙ | ︙ | |||
7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 | nonBlocking ? TCL_MODE_NONBLOCKING : TCL_MODE_BLOCKING); } } outStatePtr->flags &= ~(CHANNEL_LINEBUFFERED | CHANNEL_UNBUFFERED); outStatePtr->flags |= csPtr->writeFlags & (CHANNEL_LINEBUFFERED | CHANNEL_UNBUFFERED); if (csPtr->cmdPtr) { Tcl_DeleteChannelHandler((Tcl_Channel)csPtr->readPtr, CopyEventProc, (ClientData)csPtr); if (csPtr->readPtr != csPtr->writePtr) { Tcl_DeleteChannelHandler((Tcl_Channel)csPtr->writePtr, CopyEventProc, (ClientData)csPtr); } Tcl_DecrRefCount(csPtr->cmdPtr); } inStatePtr->csPtr = NULL; outStatePtr->csPtr = NULL; ckfree((char*) csPtr); } /* *---------------------------------------------------------------------- * * StackSetBlockMode -- * * This function sets the blocking mode for a channel, iterating | > > > | 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 | nonBlocking ? TCL_MODE_NONBLOCKING : TCL_MODE_BLOCKING); } } outStatePtr->flags &= ~(CHANNEL_LINEBUFFERED | CHANNEL_UNBUFFERED); outStatePtr->flags |= csPtr->writeFlags & (CHANNEL_LINEBUFFERED | CHANNEL_UNBUFFERED); #ifndef TCL_NO_FILEEVENTS if (csPtr->cmdPtr) { Tcl_DeleteChannelHandler((Tcl_Channel)csPtr->readPtr, CopyEventProc, (ClientData)csPtr); if (csPtr->readPtr != csPtr->writePtr) { Tcl_DeleteChannelHandler((Tcl_Channel)csPtr->writePtr, CopyEventProc, (ClientData)csPtr); } Tcl_DecrRefCount(csPtr->cmdPtr); } #endif inStatePtr->csPtr = NULL; outStatePtr->csPtr = NULL; ckfree((char*) csPtr); } #endif /* *---------------------------------------------------------------------- * * StackSetBlockMode -- * * This function sets the blocking mode for a channel, iterating |
︙ | ︙ |
Changes to generic/tclIOCmd.c.
1 2 3 4 5 6 7 8 9 10 | /* * tclIOCmd.c -- * * Contains the definitions of most of the Tcl commands relating to IO. * * Copyright (c) 1995-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. * | | > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | /* * tclIOCmd.c -- * * Contains the definitions of most of the Tcl commands relating to IO. * * Copyright (c) 1995-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: tclIOCmd.c,v 1.7.2.1.2.1 2001/11/28 17:58:36 andreas_kupries Exp $ */ #include "tclInt.h" #include "tclPort.h" #ifndef TCL_NO_SOCKETS /* * Callback structure for accept callback in a TCP server. */ typedef struct AcceptCallback { char *script; /* Script to invoke. */ Tcl_Interp *interp; /* Interpreter in which to run it. */ } AcceptCallback; /* * Static functions for this file: */ #ifndef TCL_NO_FILEEVENTS static void AcceptCallbackProc _ANSI_ARGS_((ClientData callbackData, Tcl_Channel chan, char *address, int port)); static void RegisterTcpServerInterpCleanup _ANSI_ARGS_((Tcl_Interp *interp, AcceptCallback *acceptCallbackPtr)); static void TcpAcceptCallbacksDeleteProc _ANSI_ARGS_(( ClientData clientData, Tcl_Interp *interp)); static void TcpServerCloseProc _ANSI_ARGS_((ClientData callbackData)); static void UnregisterTcpServerInterpCleanupProc _ANSI_ARGS_(( Tcl_Interp *interp, AcceptCallback *acceptCallbackPtr)); #endif /* TCL_NO_FILEEVENTS */ #endif /* TCL_NO_SOCKETS */ /* *---------------------------------------------------------------------- * * Tcl_PutsObjCmd -- * * This procedure is invoked to process the "puts" Tcl command. |
︙ | ︙ | |||
278 279 280 281 282 283 284 285 286 287 288 289 290 291 | * * Side effects: * May consume input from channel. * *---------------------------------------------------------------------- */ /* ARGSUSED */ int Tcl_ReadObjCmd(dummy, interp, objc, objv) ClientData dummy; /* Not used. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ | > | 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | * * Side effects: * May consume input from channel. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_CHANNEL_READ /* ARGSUSED */ int Tcl_ReadObjCmd(dummy, interp, objc, objv) ClientData dummy; /* Not used. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ |
︙ | ︙ | |||
376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 | Tcl_SetObjLength(resultPtr, length - 1); } } Tcl_SetObjResult(interp, resultPtr); Tcl_DecrRefCount(resultPtr); return TCL_OK; } /* *---------------------------------------------------------------------- * * Tcl_SeekObjCmd -- * * This procedure is invoked to process the Tcl "seek" command. See * the user documentation for details on what it does. * * Results: * A standard Tcl result. * * Side effects: * Moves the position of the access point on the specified channel. * May flush queued output. * *---------------------------------------------------------------------- */ | > | | 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 | Tcl_SetObjLength(resultPtr, length - 1); } } Tcl_SetObjResult(interp, resultPtr); Tcl_DecrRefCount(resultPtr); return TCL_OK; } #endif /* *---------------------------------------------------------------------- * * Tcl_SeekObjCmd -- * * This procedure is invoked to process the Tcl "seek" command. See * the user documentation for details on what it does. * * Results: * A standard Tcl result. * * Side effects: * Moves the position of the access point on the specified channel. * May flush queued output. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_NONSTDCHAN /* ARGSUSED */ int Tcl_SeekObjCmd(clientData, interp, objc, objv) ClientData clientData; /* Not used. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ |
︙ | ︙ | |||
440 441 442 443 444 445 446 447 448 449 450 451 452 453 | if (result == -1) { Tcl_AppendResult(interp, "error during seek on \"", chanName, "\": ", Tcl_PosixError(interp), (char *) NULL); return TCL_ERROR; } return TCL_OK; } /* *---------------------------------------------------------------------- * * Tcl_TellObjCmd -- * * This procedure is invoked to process the Tcl "tell" command. | > | 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 | if (result == -1) { Tcl_AppendResult(interp, "error during seek on \"", chanName, "\": ", Tcl_PosixError(interp), (char *) NULL); return TCL_ERROR; } return TCL_OK; } #endif /* *---------------------------------------------------------------------- * * Tcl_TellObjCmd -- * * This procedure is invoked to process the Tcl "tell" command. |
︙ | ︙ | |||
503 504 505 506 507 508 509 | * A standard Tcl result. * * Side effects: * May discard queued input; may flush queued output. * *---------------------------------------------------------------------- */ | | | 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 | * A standard Tcl result. * * Side effects: * May discard queued input; may flush queued output. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_NONSTDCHAN /* ARGSUSED */ int Tcl_CloseObjCmd(clientData, interp, objc, objv) ClientData clientData; /* Not used. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ |
︙ | ︙ | |||
552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 | Tcl_SetObjLength(resultPtr, len - 1); } return TCL_ERROR; } return TCL_OK; } /* *---------------------------------------------------------------------- * * Tcl_FconfigureObjCmd -- * * This procedure is invoked to process the Tcl "fconfigure" command. * See the user documentation for details on what it does. * * Results: * A standard Tcl result. * * Side effects: * May modify the behavior of an IO channel. * *---------------------------------------------------------------------- */ /* ARGSUSED */ int Tcl_FconfigureObjCmd(clientData, interp, objc, objv) ClientData clientData; /* Not used. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ | > > | 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 | Tcl_SetObjLength(resultPtr, len - 1); } return TCL_ERROR; } return TCL_OK; } #endif /* *---------------------------------------------------------------------- * * Tcl_FconfigureObjCmd -- * * This procedure is invoked to process the Tcl "fconfigure" command. * See the user documentation for details on what it does. * * Results: * A standard Tcl result. * * Side effects: * May modify the behavior of an IO channel. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_CHANNEL_CONFIG /* ARGSUSED */ int Tcl_FconfigureObjCmd(clientData, interp, objc, objv) ClientData clientData; /* Not used. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ |
︙ | ︙ | |||
623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 | if (Tcl_SetChannelOption(interp, chan, optionName, valueName) != TCL_OK) { return TCL_ERROR; } } return TCL_OK; } /* *--------------------------------------------------------------------------- * * Tcl_EofObjCmd -- * * This procedure is invoked to process the Tcl "eof" command. * See the user documentation for details on what it does. * * Results: * A standard Tcl result. * * Side effects: * Sets interp's result to boolean true or false depending on whether * the specified channel has an EOF condition. * *--------------------------------------------------------------------------- */ /* ARGSUSED */ int Tcl_EofObjCmd(unused, interp, objc, objv) ClientData unused; /* Not used. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ | > > | 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 | if (Tcl_SetChannelOption(interp, chan, optionName, valueName) != TCL_OK) { return TCL_ERROR; } } return TCL_OK; } #endif /* *--------------------------------------------------------------------------- * * Tcl_EofObjCmd -- * * This procedure is invoked to process the Tcl "eof" command. * See the user documentation for details on what it does. * * Results: * A standard Tcl result. * * Side effects: * Sets interp's result to boolean true or false depending on whether * the specified channel has an EOF condition. * *--------------------------------------------------------------------------- */ #ifndef TCL_NO_CHANNEL_EOF /* ARGSUSED */ int Tcl_EofObjCmd(unused, interp, objc, objv) ClientData unused; /* Not used. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ |
︙ | ︙ | |||
668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 | if (chan == NULL) { return TCL_ERROR; } Tcl_SetBooleanObj(Tcl_GetObjResult(interp), Tcl_Eof(chan)); return TCL_OK; } /* *---------------------------------------------------------------------- * * Tcl_ExecObjCmd -- * * This procedure is invoked to process the "exec" Tcl command. * See the user documentation for details on what it does. * * Results: * A standard Tcl result. * * Side effects: * See the user documentation. * *---------------------------------------------------------------------- */ /* ARGSUSED */ int Tcl_ExecObjCmd(dummy, interp, objc, objv) ClientData dummy; /* Not used. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ | > > > | 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 | if (chan == NULL) { return TCL_ERROR; } Tcl_SetBooleanObj(Tcl_GetObjResult(interp), Tcl_Eof(chan)); return TCL_OK; } #endif /* *---------------------------------------------------------------------- * * Tcl_ExecObjCmd -- * * This procedure is invoked to process the "exec" Tcl command. * See the user documentation for details on what it does. * * Results: * A standard Tcl result. * * Side effects: * See the user documentation. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM #ifndef TCL_NO_PIPES /* ARGSUSED */ int Tcl_ExecObjCmd(dummy, interp, objc, objv) ClientData dummy; /* Not used. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ |
︙ | ︙ | |||
844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 | } } Tcl_SetObjResult(interp, resultPtr); return result; #endif /* !MAC_TCL */ } /* *--------------------------------------------------------------------------- * * Tcl_FblockedObjCmd -- * * This procedure is invoked to process the Tcl "fblocked" command. * See the user documentation for details on what it does. * * Results: * A standard Tcl result. * * Side effects: * Sets interp's result to boolean true or false depending on whether * the preceeding input operation on the channel would have blocked. * *--------------------------------------------------------------------------- */ /* ARGSUSED */ int Tcl_FblockedObjCmd(unused, interp, objc, objv) ClientData unused; /* Not used. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ | > > > | 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 | } } Tcl_SetObjResult(interp, resultPtr); return result; #endif /* !MAC_TCL */ } #endif /* TCL_NO_PIPES */ #endif /* TCL_NO_FILESYSTEM */ /* *--------------------------------------------------------------------------- * * Tcl_FblockedObjCmd -- * * This procedure is invoked to process the Tcl "fblocked" command. * See the user documentation for details on what it does. * * Results: * A standard Tcl result. * * Side effects: * Sets interp's result to boolean true or false depending on whether * the preceeding input operation on the channel would have blocked. * *--------------------------------------------------------------------------- */ #ifndef TCL_NO_CHANNEL_BLOCKED /* ARGSUSED */ int Tcl_FblockedObjCmd(unused, interp, objc, objv) ClientData unused; /* Not used. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ |
︙ | ︙ | |||
894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 | arg, "\" wasn't opened for reading", (char *) NULL); return TCL_ERROR; } Tcl_SetBooleanObj(Tcl_GetObjResult(interp), Tcl_InputBlocked(chan)); return TCL_OK; } /* *---------------------------------------------------------------------- * * Tcl_OpenObjCmd -- * * This procedure is invoked to process the "open" Tcl command. * See the user documentation for details on what it does. * * Results: * A standard Tcl result. * * Side effects: * See the user documentation. * *---------------------------------------------------------------------- */ /* ARGSUSED */ int Tcl_OpenObjCmd(notUsed, interp, objc, objv) ClientData notUsed; /* Not used. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ | > > > | 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 | arg, "\" wasn't opened for reading", (char *) NULL); return TCL_ERROR; } Tcl_SetBooleanObj(Tcl_GetObjResult(interp), Tcl_InputBlocked(chan)); return TCL_OK; } #endif /* *---------------------------------------------------------------------- * * Tcl_OpenObjCmd -- * * This procedure is invoked to process the "open" Tcl command. * See the user documentation for details on what it does. * * Results: * A standard Tcl result. * * Side effects: * See the user documentation. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM #ifndef TCL_NO_NONSTDCHAN /* ARGSUSED */ int Tcl_OpenObjCmd(notUsed, interp, objc, objv) ClientData notUsed; /* Not used. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ |
︙ | ︙ | |||
958 959 960 961 962 963 964 965 966 967 968 969 970 971 | chan = Tcl_OpenFileChannel(interp, what, modeString, prot); } else { #ifdef MAC_TCL Tcl_AppendResult(interp, "command pipelines not supported on Macintosh OS", (char *)NULL); return TCL_ERROR; #else int mode, seekFlag, cmdObjc; char **cmdArgv; if (Tcl_SplitList(interp, what+1, &cmdObjc, &cmdArgv) != TCL_OK) { return TCL_ERROR; } | > > > > > > | 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 | chan = Tcl_OpenFileChannel(interp, what, modeString, prot); } else { #ifdef MAC_TCL Tcl_AppendResult(interp, "command pipelines not supported on Macintosh OS", (char *)NULL); return TCL_ERROR; #else #ifdef TCL_NO_PIPES Tcl_AppendResult(interp, "command pipelines not supported (TCL_NO_PIPES)", (char *)NULL); return TCL_ERROR; #else int mode, seekFlag, cmdObjc; char **cmdArgv; if (Tcl_SplitList(interp, what+1, &cmdObjc, &cmdArgv) != TCL_OK) { return TCL_ERROR; } |
︙ | ︙ | |||
988 989 990 991 992 993 994 | default: panic("Tcl_OpenCmd: invalid mode value"); break; } chan = Tcl_OpenCommandChannel(interp, cmdObjc, cmdArgv, flags); } ckfree((char *) cmdArgv); | > | > > > | 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 | default: panic("Tcl_OpenCmd: invalid mode value"); break; } chan = Tcl_OpenCommandChannel(interp, cmdObjc, cmdArgv, flags); } ckfree((char *) cmdArgv); #endif /* TCL_NO_PIPES */ #endif /* MAC_TCL */ } if (chan == (Tcl_Channel) NULL) { return TCL_ERROR; } Tcl_RegisterChannel(interp, chan); Tcl_AppendResult(interp, Tcl_GetChannelName(chan), (char *) NULL); return TCL_OK; } #endif /* TCL_NO_NONSTDCHAN */ #endif /* TCL_NO_FILESYSTEM */ #ifndef TCL_NO_SOCKETS /* *---------------------------------------------------------------------- * * TcpAcceptCallbacksDeleteProc -- * * Assocdata cleanup routine called when an interpreter is being * deleted to set the interp field of all the accept callback records |
︙ | ︙ | |||
1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 | * Deallocates memory and sets the interp field of all the accept * callback records to NULL to prevent this interpreter from being * used subsequently to eval accept scripts. * *---------------------------------------------------------------------- */ /* ARGSUSED */ static void TcpAcceptCallbacksDeleteProc(clientData, interp) ClientData clientData; /* Data which was passed when the assocdata * was registered. */ Tcl_Interp *interp; /* Interpreter being deleted - not used. */ { | > | 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 | * Deallocates memory and sets the interp field of all the accept * callback records to NULL to prevent this interpreter from being * used subsequently to eval accept scripts. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILEEVENTS /* ARGSUSED */ static void TcpAcceptCallbacksDeleteProc(clientData, interp) ClientData clientData; /* Data which was passed when the assocdata * was registered. */ Tcl_Interp *interp; /* Interpreter being deleted - not used. */ { |
︙ | ︙ | |||
1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 | hPtr = Tcl_NextHashEntry(&hSearch)) { acceptCallbackPtr = (AcceptCallback *) Tcl_GetHashValue(hPtr); acceptCallbackPtr->interp = (Tcl_Interp *) NULL; } Tcl_DeleteHashTable(hTblPtr); ckfree((char *) hTblPtr); } /* *---------------------------------------------------------------------- * * RegisterTcpServerInterpCleanup -- * * Registers an accept callback record to have its interp | > | 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 | hPtr = Tcl_NextHashEntry(&hSearch)) { acceptCallbackPtr = (AcceptCallback *) Tcl_GetHashValue(hPtr); acceptCallbackPtr->interp = (Tcl_Interp *) NULL; } Tcl_DeleteHashTable(hTblPtr); ckfree((char *) hTblPtr); } #endif /* *---------------------------------------------------------------------- * * RegisterTcpServerInterpCleanup -- * * Registers an accept callback record to have its interp |
︙ | ︙ | |||
1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 | * field of the accept callback data structure will be set to * NULL. This will prevent attempts to eval the accept script * in a deleted interpreter. * *---------------------------------------------------------------------- */ static void RegisterTcpServerInterpCleanup(interp, acceptCallbackPtr) Tcl_Interp *interp; /* Interpreter for which we want to be * informed of deletion. */ AcceptCallback *acceptCallbackPtr; /* The accept callback record whose * interp field we want set to NULL when | > | 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 | * field of the accept callback data structure will be set to * NULL. This will prevent attempts to eval the accept script * in a deleted interpreter. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILEEVENTS static void RegisterTcpServerInterpCleanup(interp, acceptCallbackPtr) Tcl_Interp *interp; /* Interpreter for which we want to be * informed of deletion. */ AcceptCallback *acceptCallbackPtr; /* The accept callback record whose * interp field we want set to NULL when |
︙ | ︙ | |||
1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 | } hPtr = Tcl_CreateHashEntry(hTblPtr, (char *) acceptCallbackPtr, &new); if (!new) { panic("RegisterTcpServerCleanup: damaged accept record table"); } Tcl_SetHashValue(hPtr, (ClientData) acceptCallbackPtr); } /* *---------------------------------------------------------------------- * * UnregisterTcpServerInterpCleanupProc -- * * Unregister a previously registered accept callback record. The * interp field of this record will no longer be set to NULL in * the future when the interpreter is deleted. * * Results: * None. * * Side effects: * Prevents the interp field of the accept callback record from * being set to NULL in the future when the interpreter is deleted. * *---------------------------------------------------------------------- */ static void UnregisterTcpServerInterpCleanupProc(interp, acceptCallbackPtr) Tcl_Interp *interp; /* Interpreter in which the accept callback * record was registered. */ AcceptCallback *acceptCallbackPtr; /* The record for which to delete the * registration. */ | > > | 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 | } hPtr = Tcl_CreateHashEntry(hTblPtr, (char *) acceptCallbackPtr, &new); if (!new) { panic("RegisterTcpServerCleanup: damaged accept record table"); } Tcl_SetHashValue(hPtr, (ClientData) acceptCallbackPtr); } #endif /* *---------------------------------------------------------------------- * * UnregisterTcpServerInterpCleanupProc -- * * Unregister a previously registered accept callback record. The * interp field of this record will no longer be set to NULL in * the future when the interpreter is deleted. * * Results: * None. * * Side effects: * Prevents the interp field of the accept callback record from * being set to NULL in the future when the interpreter is deleted. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILEEVENTS static void UnregisterTcpServerInterpCleanupProc(interp, acceptCallbackPtr) Tcl_Interp *interp; /* Interpreter in which the accept callback * record was registered. */ AcceptCallback *acceptCallbackPtr; /* The record for which to delete the * registration. */ |
︙ | ︙ | |||
1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 | } hPtr = Tcl_FindHashEntry(hTblPtr, (char *) acceptCallbackPtr); if (hPtr == (Tcl_HashEntry *) NULL) { return; } Tcl_DeleteHashEntry(hPtr); } /* *---------------------------------------------------------------------- * * AcceptCallbackProc -- * * This callback is invoked by the TCP channel driver when it * accepts a new connection from a client on a server socket. * * Results: * None. * * Side effects: * Whatever the script does. * *---------------------------------------------------------------------- */ static void AcceptCallbackProc(callbackData, chan, address, port) ClientData callbackData; /* The data stored when the callback * was created in the call to * Tcl_OpenTcpServer. */ Tcl_Channel chan; /* Channel for the newly accepted * connection. */ | > > | 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 | } hPtr = Tcl_FindHashEntry(hTblPtr, (char *) acceptCallbackPtr); if (hPtr == (Tcl_HashEntry *) NULL) { return; } Tcl_DeleteHashEntry(hPtr); } #endif /* *---------------------------------------------------------------------- * * AcceptCallbackProc -- * * This callback is invoked by the TCP channel driver when it * accepts a new connection from a client on a server socket. * * Results: * None. * * Side effects: * Whatever the script does. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILEEVENTS static void AcceptCallbackProc(callbackData, chan, address, port) ClientData callbackData; /* The data stored when the callback * was created in the call to * Tcl_OpenTcpServer. */ Tcl_Channel chan; /* Channel for the newly accepted * connection. */ |
︙ | ︙ | |||
1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 | * The interpreter has been deleted, so there is no useful * way to utilize the client socket - just close it. */ Tcl_Close((Tcl_Interp *) NULL, chan); } } /* *---------------------------------------------------------------------- * * TcpServerCloseProc -- * * This callback is called when the TCP server channel for which it | > | 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 | * The interpreter has been deleted, so there is no useful * way to utilize the client socket - just close it. */ Tcl_Close((Tcl_Interp *) NULL, chan); } } #endif /* *---------------------------------------------------------------------- * * TcpServerCloseProc -- * * This callback is called when the TCP server channel for which it |
︙ | ︙ | |||
1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 | * Side effects: * In the future, if the interpreter is deleted this channel will * no longer be informed. * *---------------------------------------------------------------------- */ static void TcpServerCloseProc(callbackData) ClientData callbackData; /* The data passed in the call to * Tcl_CreateCloseHandler. */ { AcceptCallback *acceptCallbackPtr; /* The actual data. */ acceptCallbackPtr = (AcceptCallback *) callbackData; if (acceptCallbackPtr->interp != (Tcl_Interp *) NULL) { UnregisterTcpServerInterpCleanupProc(acceptCallbackPtr->interp, acceptCallbackPtr); } Tcl_EventuallyFree((ClientData) acceptCallbackPtr->script, TCL_DYNAMIC); ckfree((char *) acceptCallbackPtr); } /* *---------------------------------------------------------------------- * * Tcl_SocketObjCmd -- * * This procedure is invoked to process the "socket" Tcl command. | > > | 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 | * Side effects: * In the future, if the interpreter is deleted this channel will * no longer be informed. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILEEVENTS static void TcpServerCloseProc(callbackData) ClientData callbackData; /* The data passed in the call to * Tcl_CreateCloseHandler. */ { AcceptCallback *acceptCallbackPtr; /* The actual data. */ acceptCallbackPtr = (AcceptCallback *) callbackData; if (acceptCallbackPtr->interp != (Tcl_Interp *) NULL) { UnregisterTcpServerInterpCleanupProc(acceptCallbackPtr->interp, acceptCallbackPtr); } Tcl_EventuallyFree((ClientData) acceptCallbackPtr->script, TCL_DYNAMIC); ckfree((char *) acceptCallbackPtr); } #endif /* *---------------------------------------------------------------------- * * Tcl_SocketObjCmd -- * * This procedure is invoked to process the "socket" Tcl command. |
︙ | ︙ | |||
1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 | static char *socketOptions[] = { "-async", "-myaddr", "-myport","-server", (char *) NULL }; enum socketOptions { SKT_ASYNC, SKT_MYADDR, SKT_MYPORT, SKT_SERVER }; int optionIndex, a, server, port; char *arg, *copyScript, *host, *script; char *myaddr = NULL; int myport = 0; int async = 0; Tcl_Channel chan; AcceptCallback *acceptCallbackPtr; server = 0; script = NULL; if (TclpHasSockets(interp) != TCL_OK) { return TCL_ERROR; } | > > > > > > | 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 | static char *socketOptions[] = { "-async", "-myaddr", "-myport","-server", (char *) NULL }; enum socketOptions { SKT_ASYNC, SKT_MYADDR, SKT_MYPORT, SKT_SERVER }; int optionIndex, a, server, port; #ifndef TCL_NO_FILEEVENTS char *arg, *copyScript, *host, *script; #else char *arg, *host, *script; #endif char *myaddr = NULL; int myport = 0; int async = 0; Tcl_Channel chan; #ifndef TCL_NO_FILEEVENTS AcceptCallback *acceptCallbackPtr; #endif server = 0; script = NULL; if (TclpHasSockets(interp) != TCL_OK) { return TCL_ERROR; } |
︙ | ︙ | |||
1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 | return TCL_ERROR; } } else { goto wrongNumArgs; } if (server) { acceptCallbackPtr = (AcceptCallback *) ckalloc((unsigned) sizeof(AcceptCallback)); copyScript = ckalloc((unsigned) strlen(script) + 1); strcpy(copyScript, script); acceptCallbackPtr->script = copyScript; acceptCallbackPtr->interp = interp; chan = Tcl_OpenTcpServer(interp, port, host, AcceptCallbackProc, | > | 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 | return TCL_ERROR; } } else { goto wrongNumArgs; } if (server) { #ifndef TCL_NO_FILEEVENTS acceptCallbackPtr = (AcceptCallback *) ckalloc((unsigned) sizeof(AcceptCallback)); copyScript = ckalloc((unsigned) strlen(script) + 1); strcpy(copyScript, script); acceptCallbackPtr->script = copyScript; acceptCallbackPtr->interp = interp; chan = Tcl_OpenTcpServer(interp, port, host, AcceptCallbackProc, |
︙ | ︙ | |||
1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 | * Register a close callback. This callback will inform the * interpreter (if it still exists) that this channel does not * need to be informed when the interpreter is deleted. */ Tcl_CreateCloseHandler(chan, TcpServerCloseProc, (ClientData) acceptCallbackPtr); } else { chan = Tcl_OpenTcpClient(interp, port, host, myaddr, myport, async); if (chan == (Tcl_Channel) NULL) { return TCL_ERROR; } } Tcl_RegisterChannel(interp, chan); Tcl_AppendResult(interp, Tcl_GetChannelName(chan), (char *) NULL); return TCL_OK; } /* *---------------------------------------------------------------------- * * Tcl_FcopyObjCmd -- * * This procedure is invoked to process the "fcopy" Tcl command. * See the user documentation for details on what it does. * * Results: * A standard Tcl result. * * Side effects: * Moves data between two channels and possibly sets up a * background copy handler. * *---------------------------------------------------------------------- */ int Tcl_FcopyObjCmd(dummy, interp, objc, objv) ClientData dummy; /* Not used. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ { | > > > > > > | 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 | * Register a close callback. This callback will inform the * interpreter (if it still exists) that this channel does not * need to be informed when the interpreter is deleted. */ Tcl_CreateCloseHandler(chan, TcpServerCloseProc, (ClientData) acceptCallbackPtr); #else /* IOS FIXME: error message */ return TCL_ERROR; #endif } else { chan = Tcl_OpenTcpClient(interp, port, host, myaddr, myport, async); if (chan == (Tcl_Channel) NULL) { return TCL_ERROR; } } Tcl_RegisterChannel(interp, chan); Tcl_AppendResult(interp, Tcl_GetChannelName(chan), (char *) NULL); return TCL_OK; } #endif /* *---------------------------------------------------------------------- * * Tcl_FcopyObjCmd -- * * This procedure is invoked to process the "fcopy" Tcl command. * See the user documentation for details on what it does. * * Results: * A standard Tcl result. * * Side effects: * Moves data between two channels and possibly sets up a * background copy handler. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_CHANNELCOPY int Tcl_FcopyObjCmd(dummy, interp, objc, objv) ClientData dummy; /* Not used. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ { |
︙ | ︙ | |||
1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 | switch (index) { case FcopySize: if (Tcl_GetIntFromObj(interp, objv[i+1], &toRead) != TCL_OK) { return TCL_ERROR; } break; case FcopyCommand: cmdPtr = objv[i+1]; break; } } return TclCopyChannel(interp, inChan, outChan, toRead, cmdPtr); } | > > > > > | 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 | switch (index) { case FcopySize: if (Tcl_GetIntFromObj(interp, objv[i+1], &toRead) != TCL_OK) { return TCL_ERROR; } break; case FcopyCommand: #ifndef TCL_NO_FILEEVENTS cmdPtr = objv[i+1]; #else return TCL_ERROR; /* IOS FIXME: need error message */ #endif break; } } return TclCopyChannel(interp, inChan, outChan, toRead, cmdPtr); } #endif |
Changes to generic/tclIOGT.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * tclIOGT.c -- * * Implements a generic transformation exposing the underlying API * at the script level. Contributed by Andreas Kupries. * * Copyright (c) 2000 Ajuba Solutions * Copyright (c) 1999-2000 Andreas Kupries ([email protected]) * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | /* * tclIOGT.c -- * * Implements a generic transformation exposing the underlying API * at the script level. Contributed by Andreas Kupries. * * Copyright (c) 2000 Ajuba Solutions * Copyright (c) 1999-2000 Andreas Kupries ([email protected]) * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * CVS: $Id: tclIOGT.c,v 1.1.4.3.2.1 2001/11/28 17:58:36 andreas_kupries Exp $ */ #include "tclInt.h" #include "tclPort.h" #include "tclIO.h" #ifndef TCL_NO_CHANNEL_CONFIG /* * Forward declarations of internal procedures. * First the driver procedures of the transformation. */ static int TransformBlockModeProc _ANSI_ARGS_ (( |
︙ | ︙ | |||
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | ClientData instanceData, int mask)); /* * Forward declarations of internal procedures. * Secondly the procedures for handling and generating fileeevents. */ static void TransformChannelHandlerTimer _ANSI_ARGS_ (( ClientData clientData)); /* * Forward declarations of internal procedures. * Third, helper procedures encapsulating essential tasks. */ typedef struct TransformChannelData TransformChannelData; | > > | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | ClientData instanceData, int mask)); /* * Forward declarations of internal procedures. * Secondly the procedures for handling and generating fileeevents. */ #ifndef TCL_NO_FILEEVENTS static void TransformChannelHandlerTimer _ANSI_ARGS_ (( ClientData clientData)); #endif /* * Forward declarations of internal procedures. * Third, helper procedures encapsulating essential tasks. */ typedef struct TransformChannelData TransformChannelData; |
︙ | ︙ | |||
995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 | */ /* ARGSUSED */ static void TransformWatchProc (instanceData, mask) ClientData instanceData; /* Channel to watch */ int mask; /* Events of interest */ { /* The caller expressed interest in events occuring for this * channel. We are forwarding the call to the underlying * channel now. */ TransformChannelData* dataPtr = (TransformChannelData*) instanceData; Tcl_Channel downChan; | > | 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 | */ /* ARGSUSED */ static void TransformWatchProc (instanceData, mask) ClientData instanceData; /* Channel to watch */ int mask; /* Events of interest */ { #ifndef TCL_NO_FILEEVENTS /* The caller expressed interest in events occuring for this * channel. We are forwarding the call to the underlying * channel now. */ TransformChannelData* dataPtr = (TransformChannelData*) instanceData; Tcl_Channel downChan; |
︙ | ︙ | |||
1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 | * events and we actually have data waiting, so generate a timer * to flush that. */ dataPtr->timer = Tcl_CreateTimerHandler (FLUSH_DELAY, TransformChannelHandlerTimer, (ClientData) dataPtr); } } /* *------------------------------------------------------* * * TransformGetFileHandleProc -- * | > | 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 | * events and we actually have data waiting, so generate a timer * to flush that. */ dataPtr->timer = Tcl_CreateTimerHandler (FLUSH_DELAY, TransformChannelHandlerTimer, (ClientData) dataPtr); } #endif } /* *------------------------------------------------------* * * TransformGetFileHandleProc -- * |
︙ | ︙ | |||
1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 | * * Result: * None. * *------------------------------------------------------* */ static void TransformChannelHandlerTimer (clientData) ClientData clientData; /* Transformation to query */ { TransformChannelData* dataPtr = (TransformChannelData*) clientData; dataPtr->timer = (Tcl_TimerToken) NULL; if (!(dataPtr->watchMask & TCL_READABLE) || (ResultLength (&dataPtr->result) == 0)) { /* The timer fired, but either is there no (more) * interest in the events it generates or nothing is available * for reading, so ignore it and don't recreate it. */ return; } Tcl_NotifyChannel(dataPtr->self, TCL_READABLE); } /* *------------------------------------------------------* * * ResultClear -- * * Deallocates any memory allocated by 'ResultAdd'. | > > | 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 | * * Result: * None. * *------------------------------------------------------* */ #ifndef TCL_NO_FILEEVENTS static void TransformChannelHandlerTimer (clientData) ClientData clientData; /* Transformation to query */ { TransformChannelData* dataPtr = (TransformChannelData*) clientData; dataPtr->timer = (Tcl_TimerToken) NULL; if (!(dataPtr->watchMask & TCL_READABLE) || (ResultLength (&dataPtr->result) == 0)) { /* The timer fired, but either is there no (more) * interest in the events it generates or nothing is available * for reading, so ignore it and don't recreate it. */ return; } Tcl_NotifyChannel(dataPtr->self, TCL_READABLE); } #endif /* *------------------------------------------------------* * * ResultClear -- * * Deallocates any memory allocated by 'ResultAdd'. |
︙ | ︙ | |||
1353 1354 1355 1356 1357 1358 1359 | } } /* now copy data */ memcpy(r->buf + r->used, buf, (size_t) toWrite); r->used += toWrite; } | > > > > > > > > > > > > > | 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 | } } /* now copy data */ memcpy(r->buf + r->used, buf, (size_t) toWrite); r->used += toWrite; } #else int TclChannelTransform(interp, chan, cmdObjPtr) Tcl_Interp *interp; /* Interpreter for result. */ Tcl_Channel chan; /* Channel to transform. */ Tcl_Obj *cmdObjPtr; /* Script to use for transform. */ { return TCL_ERROR; } #endif |
Changes to generic/tclIOUtil.c.
︙ | ︙ | |||
9 10 11 12 13 14 15 | * * Copyright (c) 1991-1994 The Regents of the University of California. * Copyright (c) 1994-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. * | | > | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | * * Copyright (c) 1991-1994 The Regents of the University of California. * Copyright (c) 1994-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: tclIOUtil.c,v 1.9.6.1 2001/11/28 17:58:37 andreas_kupries Exp $ */ #include "tclInt.h" #include "tclPort.h" /* * The following typedef declarations allow for hooking into the chain * of functions maintained for 'Tcl_Stat(...)', 'Tcl_Access(...)' & * 'Tcl_OpenFileChannel(...)'. Basically for each hookable function * a linked list is defined. */ #ifndef TCL_NO_FILESYSTEM typedef struct StatProc { TclStatProc_ *proc; /* Function to process a 'stat()' call */ struct StatProc *nextPtr; /* The next 'stat()' function to call */ } StatProc; typedef struct AccessProc { TclAccessProc_ *proc; /* Function to process a 'access()' call */ |
︙ | ︙ | |||
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | static AccessProc defaultAccessProc = { &TclpAccess, NULL }; static AccessProc *accessProcList = &defaultAccessProc; static OpenFileChannelProc defaultOpenFileChannelProc = { &TclpOpenFileChannel, NULL }; static OpenFileChannelProc *openFileChannelProcList = &defaultOpenFileChannelProc; TCL_DECLARE_MUTEX(hookMutex) /* *--------------------------------------------------------------------------- * * TclGetOpenMode -- * * Description: | > > > > > | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | static AccessProc defaultAccessProc = { &TclpAccess, NULL }; static AccessProc *accessProcList = &defaultAccessProc; static OpenFileChannelProc defaultOpenFileChannelProc = { #ifndef TCL_NO_NONSTDCHAN &TclpOpenFileChannel, NULL #else NULL #endif }; static OpenFileChannelProc *openFileChannelProcList = &defaultOpenFileChannelProc; TCL_DECLARE_MUTEX(hookMutex) #endif /* *--------------------------------------------------------------------------- * * TclGetOpenMode -- * * Description: |
︙ | ︙ | |||
266 267 268 269 270 271 272 273 274 275 276 277 278 279 | * * Side effects: * Depends on the commands in the file. * *---------------------------------------------------------------------- */ int Tcl_EvalFile(interp, fileName) Tcl_Interp *interp; /* Interpreter in which to process file. */ char *fileName; /* Name of file to process. Tilde-substitution * will be performed on this name. */ { int result, length; | > > > > > > | 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | * * Side effects: * Depends on the commands in the file. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM #ifndef TCL_NO_NONSTDCHAN /* IOS FIXME : in the generic case this functionality can be made * available, it just has to read the file directly instead of using * the channel system. This makes the code platform dependent. */ int Tcl_EvalFile(interp, fileName) Tcl_Interp *interp; /* Interpreter in which to process file. */ char *fileName; /* Name of file to process. Tilde-substitution * will be performed on this name. */ { int result, length; |
︙ | ︙ | |||
338 339 340 341 342 343 344 345 346 347 348 349 350 351 | } end: Tcl_DecrRefCount(objPtr); Tcl_DStringFree(&nameString); return result; } /* *---------------------------------------------------------------------- * * Tcl_GetErrno -- * * Gets the current value of the Tcl error code variable. This is | > > | 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | } end: Tcl_DecrRefCount(objPtr); Tcl_DStringFree(&nameString); return result; } #endif /* TCL_NO_NONSTDCHAN */ #endif /* TCL_NO_FILESYSTEM */ /* *---------------------------------------------------------------------- * * Tcl_GetErrno -- * * Gets the current value of the Tcl error code variable. This is |
︙ | ︙ | |||
439 440 441 442 443 444 445 446 447 448 449 450 451 452 | * * Side effects: * See stat documentation. * *---------------------------------------------------------------------- */ int TclStat(path, buf) CONST char *path; /* Path of file to stat (in current CP). */ struct stat *buf; /* Filled with results of stat call. */ { StatProc *statProcPtr; int retVal = -1; | > | 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | * * Side effects: * See stat documentation. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM int TclStat(path, buf) CONST char *path; /* Path of file to stat (in current CP). */ struct stat *buf; /* Filled with results of stat call. */ { StatProc *statProcPtr; int retVal = -1; |
︙ | ︙ | |||
462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 | retVal = (*statProcPtr->proc)(path, buf); statProcPtr = statProcPtr->nextPtr; } Tcl_MutexUnlock(&hookMutex); return (retVal); } /* *---------------------------------------------------------------------- * * TclAccess -- * * This procedure replaces the library version of access. * The chain of functions that have been "inserted" into the * 'accessProcList' will be called in succession until either * a value of zero is returned, or the entire list is visited. * * Results: * See access documentation. * * Side effects: * See access documentation. * *---------------------------------------------------------------------- */ int TclAccess(path, mode) CONST char *path; /* Path of file to access (in current CP). */ int mode; /* Permission setting. */ { AccessProc *accessProcPtr; int retVal = -1; | > > | 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 | retVal = (*statProcPtr->proc)(path, buf); statProcPtr = statProcPtr->nextPtr; } Tcl_MutexUnlock(&hookMutex); return (retVal); } #endif /* *---------------------------------------------------------------------- * * TclAccess -- * * This procedure replaces the library version of access. * The chain of functions that have been "inserted" into the * 'accessProcList' will be called in succession until either * a value of zero is returned, or the entire list is visited. * * Results: * See access documentation. * * Side effects: * See access documentation. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM int TclAccess(path, mode) CONST char *path; /* Path of file to access (in current CP). */ int mode; /* Permission setting. */ { AccessProc *accessProcPtr; int retVal = -1; |
︙ | ︙ | |||
505 506 507 508 509 510 511 512 513 514 515 516 517 518 | retVal = (*accessProcPtr->proc)(path, mode); accessProcPtr = accessProcPtr->nextPtr; } Tcl_MutexUnlock(&hookMutex); return (retVal); } /* *---------------------------------------------------------------------- * * Tcl_OpenFileChannel -- * * The chain of functions that have been "inserted" into the | > | 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 | retVal = (*accessProcPtr->proc)(path, mode); accessProcPtr = accessProcPtr->nextPtr; } Tcl_MutexUnlock(&hookMutex); return (retVal); } #endif /* *---------------------------------------------------------------------- * * Tcl_OpenFileChannel -- * * The chain of functions that have been "inserted" into the |
︙ | ︙ | |||
526 527 528 529 530 531 532 533 534 535 536 537 538 539 | * Side effects: * May open the channel and may cause creation of a file on the * file system. * *---------------------------------------------------------------------- */ Tcl_Channel Tcl_OpenFileChannel(interp, fileName, modeString, permissions) Tcl_Interp *interp; /* Interpreter for error reporting; * can be NULL. */ char *fileName; /* Name of file to open. */ char *modeString; /* A list of POSIX open modes or * a string such as "rw". */ | > | 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 | * Side effects: * May open the channel and may cause creation of a file on the * file system. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM Tcl_Channel Tcl_OpenFileChannel(interp, fileName, modeString, permissions) Tcl_Interp *interp; /* Interpreter for error reporting; * can be NULL. */ char *fileName; /* Name of file to open. */ char *modeString; /* A list of POSIX open modes or * a string such as "rw". */ |
︙ | ︙ | |||
557 558 559 560 561 562 563 564 565 566 567 568 569 570 | modeString, permissions); openFileChannelProcPtr = openFileChannelProcPtr->nextPtr; } Tcl_MutexUnlock(&hookMutex); return (retVal); } /* *---------------------------------------------------------------------- * * TclStatInsertProc -- * * Insert the passed procedure pointer at the head of the list of | > | 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 | modeString, permissions); openFileChannelProcPtr = openFileChannelProcPtr->nextPtr; } Tcl_MutexUnlock(&hookMutex); return (retVal); } #endif /* TCL_NO_FILESYSTEM */ /* *---------------------------------------------------------------------- * * TclStatInsertProc -- * * Insert the passed procedure pointer at the head of the list of |
︙ | ︙ | |||
580 581 582 583 584 585 586 587 588 589 590 591 592 593 | * Side effects: * Memory allocataed and modifies the link list for 'TclStat' * functions. * *---------------------------------------------------------------------- */ int TclStatInsertProc (proc) TclStatProc_ *proc; { int retVal = TCL_ERROR; if (proc != NULL) { | > | 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 | * Side effects: * Memory allocataed and modifies the link list for 'TclStat' * functions. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM int TclStatInsertProc (proc) TclStatProc_ *proc; { int retVal = TCL_ERROR; if (proc != NULL) { |
︙ | ︙ | |||
604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 | retVal = TCL_OK; } } return (retVal); } /* *---------------------------------------------------------------------- * * TclStatDeleteProc -- * * Removed the passed function pointer from the list of 'TclStat' * functions. Ensures that the built-in stat function is not * removvable. * * Results: * TCL_OK if the procedure pointer was successfully removed, * TCL_ERROR otherwise. * * Side effects: * Memory is deallocated and the respective list updated. * *---------------------------------------------------------------------- */ int TclStatDeleteProc (proc) TclStatProc_ *proc; { int retVal = TCL_ERROR; StatProc *tmpStatProcPtr; StatProc *prevStatProcPtr = NULL; | > > | 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 | retVal = TCL_OK; } } return (retVal); } #endif /* *---------------------------------------------------------------------- * * TclStatDeleteProc -- * * Removed the passed function pointer from the list of 'TclStat' * functions. Ensures that the built-in stat function is not * removvable. * * Results: * TCL_OK if the procedure pointer was successfully removed, * TCL_ERROR otherwise. * * Side effects: * Memory is deallocated and the respective list updated. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM int TclStatDeleteProc (proc) TclStatProc_ *proc; { int retVal = TCL_ERROR; StatProc *tmpStatProcPtr; StatProc *prevStatProcPtr = NULL; |
︙ | ︙ | |||
660 661 662 663 664 665 666 667 668 669 670 671 672 673 | tmpStatProcPtr = tmpStatProcPtr->nextPtr; } } Tcl_MutexUnlock(&hookMutex); return (retVal); } /* *---------------------------------------------------------------------- * * TclAccessInsertProc -- * * Insert the passed procedure pointer at the head of the list of | > | 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 | tmpStatProcPtr = tmpStatProcPtr->nextPtr; } } Tcl_MutexUnlock(&hookMutex); return (retVal); } #endif /* *---------------------------------------------------------------------- * * TclAccessInsertProc -- * * Insert the passed procedure pointer at the head of the list of |
︙ | ︙ | |||
683 684 685 686 687 688 689 690 691 692 693 694 695 696 | * Side effects: * Memory allocataed and modifies the link list for 'TclAccess' * functions. * *---------------------------------------------------------------------- */ int TclAccessInsertProc(proc) TclAccessProc_ *proc; { int retVal = TCL_ERROR; if (proc != NULL) { | > | 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 | * Side effects: * Memory allocataed and modifies the link list for 'TclAccess' * functions. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM int TclAccessInsertProc(proc) TclAccessProc_ *proc; { int retVal = TCL_ERROR; if (proc != NULL) { |
︙ | ︙ | |||
707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 | retVal = TCL_OK; } } return (retVal); } /* *---------------------------------------------------------------------- * * TclAccessDeleteProc -- * * Removed the passed function pointer from the list of 'TclAccess' * functions. Ensures that the built-in access function is not * removvable. * * Results: * TCL_OK if the procedure pointer was successfully removed, * TCL_ERROR otherwise. * * Side effects: * Memory is deallocated and the respective list updated. * *---------------------------------------------------------------------- */ int TclAccessDeleteProc(proc) TclAccessProc_ *proc; { int retVal = TCL_ERROR; AccessProc *tmpAccessProcPtr; AccessProc *prevAccessProcPtr = NULL; | > > | 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 | retVal = TCL_OK; } } return (retVal); } #endif /* *---------------------------------------------------------------------- * * TclAccessDeleteProc -- * * Removed the passed function pointer from the list of 'TclAccess' * functions. Ensures that the built-in access function is not * removvable. * * Results: * TCL_OK if the procedure pointer was successfully removed, * TCL_ERROR otherwise. * * Side effects: * Memory is deallocated and the respective list updated. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM int TclAccessDeleteProc(proc) TclAccessProc_ *proc; { int retVal = TCL_ERROR; AccessProc *tmpAccessProcPtr; AccessProc *prevAccessProcPtr = NULL; |
︙ | ︙ | |||
763 764 765 766 767 768 769 770 771 772 773 774 775 776 | tmpAccessProcPtr = tmpAccessProcPtr->nextPtr; } } Tcl_MutexUnlock(&hookMutex); return (retVal); } /* *---------------------------------------------------------------------- * * TclOpenFileChannelInsertProc -- * * Insert the passed procedure pointer at the head of the list of | > | 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 | tmpAccessProcPtr = tmpAccessProcPtr->nextPtr; } } Tcl_MutexUnlock(&hookMutex); return (retVal); } #endif /* *---------------------------------------------------------------------- * * TclOpenFileChannelInsertProc -- * * Insert the passed procedure pointer at the head of the list of |
︙ | ︙ | |||
787 788 789 790 791 792 793 794 795 796 797 798 799 800 | * Side effects: * Memory allocataed and modifies the link list for * 'Tcl_OpenFileChannel' functions. * *---------------------------------------------------------------------- */ int TclOpenFileChannelInsertProc(proc) TclOpenFileChannelProc_ *proc; { int retVal = TCL_ERROR; if (proc != NULL) { | > | 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 | * Side effects: * Memory allocataed and modifies the link list for * 'Tcl_OpenFileChannel' functions. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM int TclOpenFileChannelInsertProc(proc) TclOpenFileChannelProc_ *proc; { int retVal = TCL_ERROR; if (proc != NULL) { |
︙ | ︙ | |||
812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 | retVal = TCL_OK; } } return (retVal); } /* *---------------------------------------------------------------------- * * TclOpenFileChannelDeleteProc -- * * Removed the passed function pointer from the list of * 'Tcl_OpenFileChannel' functions. Ensures that the built-in * open file channel function is not removvable. * * Results: * TCL_OK if the procedure pointer was successfully removed, * TCL_ERROR otherwise. * * Side effects: * Memory is deallocated and the respective list updated. * *---------------------------------------------------------------------- */ int TclOpenFileChannelDeleteProc(proc) TclOpenFileChannelProc_ *proc; { int retVal = TCL_ERROR; OpenFileChannelProc *tmpOpenFileChannelProcPtr = openFileChannelProcList; OpenFileChannelProc *prevOpenFileChannelProcPtr = NULL; | > > | 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 | retVal = TCL_OK; } } return (retVal); } #endif /* *---------------------------------------------------------------------- * * TclOpenFileChannelDeleteProc -- * * Removed the passed function pointer from the list of * 'Tcl_OpenFileChannel' functions. Ensures that the built-in * open file channel function is not removvable. * * Results: * TCL_OK if the procedure pointer was successfully removed, * TCL_ERROR otherwise. * * Side effects: * Memory is deallocated and the respective list updated. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM int TclOpenFileChannelDeleteProc(proc) TclOpenFileChannelProc_ *proc; { int retVal = TCL_ERROR; OpenFileChannelProc *tmpOpenFileChannelProcPtr = openFileChannelProcList; OpenFileChannelProc *prevOpenFileChannelProcPtr = NULL; |
︙ | ︙ | |||
870 871 872 873 874 875 876 | tmpOpenFileChannelProcPtr = tmpOpenFileChannelProcPtr->nextPtr; } } Tcl_MutexUnlock(&hookMutex); return (retVal); } | > | 901 902 903 904 905 906 907 908 | tmpOpenFileChannelProcPtr = tmpOpenFileChannelProcPtr->nextPtr; } } Tcl_MutexUnlock(&hookMutex); return (retVal); } #endif |
Changes to generic/tclInt.decls.
1 2 3 4 5 6 7 8 9 10 11 12 | # tclInt.decls -- # # This file contains the declarations for all unsupported # functions that are exported by the Tcl library. This file # is used to generate the tclIntDecls.h, tclIntPlatDecls.h, # tclIntStub.c, tclPlatStub.c, tclCompileDecls.h and tclCompileStub.c # files # # Copyright (c) 1998-1999 by Scriptics Corporation. # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | | | | | | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | # tclInt.decls -- # # This file contains the declarations for all unsupported # functions that are exported by the Tcl library. This file # is used to generate the tclIntDecls.h, tclIntPlatDecls.h, # tclIntStub.c, tclPlatStub.c, tclCompileDecls.h and tclCompileStub.c # files # # Copyright (c) 1998-1999 by Scriptics Corporation. # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # RCS: @(#) $Id: tclInt.decls,v 1.20.2.6.2.1 2001/11/28 17:58:37 andreas_kupries Exp $ library tcl # Define the unsupported generic interfaces. interface tclInt # Declare each of the functions in the unsupported internal Tcl # interface. These interfaces are allowed to changed between versions. # Use at your own risk. Note that the position of functions should not # be changed between versions to avoid gratuitous incompatibilities. declare 0 generic {TCL_NO_FILESYSTEM} { int TclAccess(CONST char *path, int mode) } declare 1 generic {TCL_NO_FILESYSTEM} { int TclAccessDeleteProc(TclAccessProc_ *proc) } declare 2 generic {TCL_NO_FILESYSTEM} { int TclAccessInsertProc(TclAccessProc_ *proc) } declare 3 generic { void TclAllocateFreeObjects(void) } # Replaced by TclpChdir in 8.1: # declare 4 generic { # int TclChdir(Tcl_Interp *interp, char *dirName) # } declare 5 {unix win} {TCL_NO_PIPES} { int TclCleanupChildren(Tcl_Interp *interp, int numPids, Tcl_Pid *pidPtr, \ Tcl_Channel errorChan) } declare 6 generic { void TclCleanupCommand(Command *cmdPtr) } declare 7 generic { int TclCopyAndCollapse(int count, CONST char *src, char *dst) } declare 8 generic {TCL_NO_CHANNELCOPY} { int TclCopyChannel(Tcl_Interp *interp, Tcl_Channel inChan, \ Tcl_Channel outChan, int toRead, Tcl_Obj *cmdPtr) } # TclCreatePipeline unofficially exported for use by BLT. declare 9 {unix win} {TCL_NO_FILESYSTEM TCL_NO_PIPES} { int TclCreatePipeline(Tcl_Interp *interp, int argc, char **argv, \ Tcl_Pid **pidArrayPtr, TclFile *inPipePtr, TclFile *outPipePtr, \ TclFile *errFilePtr) } declare 10 generic { int TclCreateProc(Tcl_Interp *interp, Namespace *nsPtr, char *procName, \ Tcl_Obj *argsPtr, Tcl_Obj *bodyPtr, Proc **procPtrPtr) } declare 11 generic { void TclDeleteCompiledLocalVars(Interp *iPtr, CallFrame *framePtr) } declare 12 generic { void TclDeleteVars(Interp *iPtr, Tcl_HashTable *tablePtr) } declare 13 generic {TCL_NO_FILESYSTEM} { int TclDoGlob(Tcl_Interp *interp, char *separators, \ Tcl_DString *headPtr, char *tail, GlobTypeData *types) } declare 14 generic { void TclDumpMemoryInfo(FILE *outFile) } # Removed in 8.1: # declare 15 generic { # void TclExpandParseValue(ParseValue *pvPtr, int needed) # } declare 16 generic { void TclExprFloatError(Tcl_Interp *interp, double value) } declare 17 generic {TCL_NO_FILESYSTEM} { int TclFileAttrsCmd(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) } declare 18 generic {TCL_NO_FILESYSTEM} { int TclFileCopyCmd(Tcl_Interp *interp, int argc, char **argv) } declare 19 generic {TCL_NO_FILESYSTEM} { int TclFileDeleteCmd(Tcl_Interp *interp, int argc, char **argv) } declare 20 generic {TCL_NO_FILESYSTEM} { int TclFileMakeDirsCmd(Tcl_Interp *interp, int argc, char **argv) } declare 21 generic {TCL_NO_FILESYSTEM} { int TclFileRenameCmd(Tcl_Interp *interp, int argc, char **argv) } declare 22 generic { int TclFindElement(Tcl_Interp *interp, CONST char *listStr, \ int listLength, CONST char **elementPtr, CONST char **nextPtr, \ int *sizePtr, int *bracePtr) } |
︙ | ︙ | |||
129 130 131 132 133 134 135 | Tcl_Obj * TclGetElementOfIndexedArray(Tcl_Interp *interp, \ int localIndex, Tcl_Obj *elemPtr, int leaveErrorMsg) } # Replaced by char * TclGetEnv(CONST char *name, Tcl_DString *valuePtr) in 8.1: # declare 30 generic { # char * TclGetEnv(CONST char *name) # } | | | 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | Tcl_Obj * TclGetElementOfIndexedArray(Tcl_Interp *interp, \ int localIndex, Tcl_Obj *elemPtr, int leaveErrorMsg) } # Replaced by char * TclGetEnv(CONST char *name, Tcl_DString *valuePtr) in 8.1: # declare 30 generic { # char * TclGetEnv(CONST char *name) # } declare 31 generic {TCL_NO_FILESYSTEM} { char * TclGetExtension(char *name) } declare 32 generic { int TclGetFrame(Tcl_Interp *interp, char *str, CallFrame **framePtrPtr) } declare 33 generic { TclCmdProcType TclGetInterpProc(void) |
︙ | ︙ | |||
167 168 169 170 171 172 173 | } declare 40 generic { int TclGetOpenMode(Tcl_Interp *interp, char *str, int *seekFlagPtr) } declare 41 generic { Tcl_Command TclGetOriginalCommand(Tcl_Command command) } | | | 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | } declare 40 generic { int TclGetOpenMode(Tcl_Interp *interp, char *str, int *seekFlagPtr) } declare 41 generic { Tcl_Command TclGetOriginalCommand(Tcl_Command command) } declare 42 generic {TCL_NO_FILESYSTEM} { char * TclpGetUserHome(CONST char *name, Tcl_DString *bufferPtr) } declare 43 generic { int TclGlobalInvoke(Tcl_Interp *interp, int argc, char **argv, int flags) } declare 44 generic { int TclGuessPackageName(char *fileName, Tcl_DString *bufPtr) |
︙ | ︙ | |||
198 199 200 201 202 203 204 | Tcl_Obj * TclIncrVar2(Tcl_Interp *interp, Tcl_Obj *part1Ptr, \ Tcl_Obj *part2Ptr, long incrAmount, int part1NotParsed) } declare 50 generic { void TclInitCompiledLocals(Tcl_Interp *interp, CallFrame *framePtr, \ Namespace *nsPtr) } | | | 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | Tcl_Obj * TclIncrVar2(Tcl_Interp *interp, Tcl_Obj *part1Ptr, \ Tcl_Obj *part2Ptr, long incrAmount, int part1NotParsed) } declare 50 generic { void TclInitCompiledLocals(Tcl_Interp *interp, CallFrame *framePtr, \ Namespace *nsPtr) } declare 51 generic {{TCL_NO_SLAVEINTERP TCL_NO_CMDALIASES}} { int TclInterpInit(Tcl_Interp *interp) } declare 52 generic { int TclInvoke(Tcl_Interp *interp, int argc, char **argv, int flags) } declare 53 generic { int TclInvokeObjectCommand(ClientData clientData, Tcl_Interp *interp, \ |
︙ | ︙ | |||
230 231 232 233 234 235 236 | # int TclLooksLikeInt(char *p) # } declare 58 generic { Var * TclLookupVar(Tcl_Interp *interp, char *part1, char *part2, \ int flags, char *msg, int createPart1, int createPart2, \ Var **arrayPtrPtr) } | | | 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | # int TclLooksLikeInt(char *p) # } declare 58 generic { Var * TclLookupVar(Tcl_Interp *interp, char *part1, char *part2, \ int flags, char *msg, int createPart1, int createPart2, \ Var **arrayPtrPtr) } declare 59 generic {TCL_NO_FILESYSTEM} { int TclpMatchFiles(Tcl_Interp *interp, char *separators, \ Tcl_DString *dirPtr, char *pattern, char *tail) } declare 60 generic { int TclNeedSpace(char *start, char *end) } declare 61 generic { |
︙ | ︙ | |||
255 256 257 258 259 260 261 | int TclObjInvoke(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], \ int flags) } declare 65 generic { int TclObjInvokeGlobal(Tcl_Interp *interp, int objc, \ Tcl_Obj *CONST objv[], int flags) } | | | | | | | | | | | | | 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | int TclObjInvoke(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], \ int flags) } declare 65 generic { int TclObjInvokeGlobal(Tcl_Interp *interp, int objc, \ Tcl_Obj *CONST objv[], int flags) } declare 66 generic {TCL_NO_FILESYSTEM} { int TclOpenFileChannelDeleteProc(TclOpenFileChannelProc_ *proc) } declare 67 generic {TCL_NO_FILESYSTEM} { int TclOpenFileChannelInsertProc(TclOpenFileChannelProc_ *proc) } declare 68 generic {TCL_NO_FILESYSTEM} { int TclpAccess(CONST char *path, int mode) } declare 69 generic { char * TclpAlloc(unsigned int size) } declare 70 generic {TCL_NO_FILESYSTEM} { int TclpCopyFile(CONST char *source, CONST char *dest) } declare 71 generic {TCL_NO_FILESYSTEM} { int TclpCopyDirectory(CONST char *source, CONST char *dest, \ Tcl_DString *errorPtr) } declare 72 generic {TCL_NO_FILESYSTEM} { int TclpCreateDirectory(CONST char *path) } declare 73 generic {TCL_NO_FILESYSTEM} { int TclpDeleteFile(CONST char *path) } declare 74 generic { void TclpFree(char *ptr) } declare 75 generic { unsigned long TclpGetClicks(void) } declare 76 generic { unsigned long TclpGetSeconds(void) } declare 77 generic { void TclpGetTime(Tcl_Time *time) } declare 78 generic { int TclpGetTimeZone(unsigned long time) } declare 79 generic {TCL_NO_FILESYSTEM} { int TclpListVolumes(Tcl_Interp *interp) } declare 80 generic {TCL_NO_FILESYSTEM TCL_NO_NONSTDCHAN} { Tcl_Channel TclpOpenFileChannel(Tcl_Interp *interp, char *fileName, \ char *modeString, int permissions) } declare 81 generic { char * TclpRealloc(char *ptr, unsigned int size) } declare 82 generic {TCL_NO_FILESYSTEM} { int TclpRemoveDirectory(CONST char *path, int recursive, \ Tcl_DString *errorPtr) } declare 83 generic {TCL_NO_FILESYSTEM} { int TclpRenameFile(CONST char *source, CONST char *dest) } # Removed in 8.1: # declare 84 generic { # int TclParseBraces(Tcl_Interp *interp, char *str, char **termPtr, \ # ParseValue *pvPtr) # } |
︙ | ︙ | |||
332 333 334 335 336 337 338 | # declare 87 generic { # void TclPlatformInit(Tcl_Interp *interp) # } declare 88 generic { char * TclPrecTraceProc(ClientData clientData, Tcl_Interp *interp, \ char *name1, char *name2, int flags) } | | | 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | # declare 87 generic { # void TclPlatformInit(Tcl_Interp *interp) # } declare 88 generic { char * TclPrecTraceProc(ClientData clientData, Tcl_Interp *interp, \ char *name1, char *name2, int flags) } declare 89 generic {TCL_NO_CMDALIASES} { int TclPreventAliasLoop(Tcl_Interp *interp, Tcl_Interp *cmdInterp, \ Tcl_Command cmd) } # Removed in 8.1 (only available if compiled with TCL_COMPILE_DEBUG): # declare 90 generic { # void TclPrintByteCodeObj(Tcl_Interp *interp, Tcl_Obj *objPtr) # } |
︙ | ︙ | |||
355 356 357 358 359 360 361 | declare 93 generic { void TclProcDeleteProc(ClientData clientData) } declare 94 generic { int TclProcInterpProc(ClientData clientData, Tcl_Interp *interp, \ int argc, char **argv) } | | | 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | declare 93 generic { void TclProcDeleteProc(ClientData clientData) } declare 94 generic { int TclProcInterpProc(ClientData clientData, Tcl_Interp *interp, \ int argc, char **argv) } declare 95 generic {TCL_NO_FILESYSTEM} { int TclpStat(CONST char *path, struct stat *buf) } declare 96 generic { int TclRenameCommand(Tcl_Interp *interp, char *oldName, char *newName) } declare 97 generic { void TclResetShadowedCmdRefs(Tcl_Interp *interp, Command *newCmdPtr) |
︙ | ︙ | |||
388 389 390 391 392 393 394 | declare 103 generic { int TclSockGetPort(Tcl_Interp *interp, char *str, char *proto, \ int *portPtr) } declare 104 {unix win} { int TclSockMinimumBuffers(int sock, int size) } | | | | | 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 | declare 103 generic { int TclSockGetPort(Tcl_Interp *interp, char *str, char *proto, \ int *portPtr) } declare 104 {unix win} { int TclSockMinimumBuffers(int sock, int size) } declare 105 generic {TCL_NO_FILESYSTEM} { int TclStat(CONST char *path, struct stat *buf) } declare 106 generic {TCL_NO_FILESYSTEM} { int TclStatDeleteProc(TclStatProc_ *proc) } declare 107 generic {TCL_NO_FILESYSTEM} { int TclStatInsertProc(TclStatProc_ *proc) } declare 108 generic { void TclTeardownNamespace(Namespace *nsPtr) } declare 109 generic { int TclUpdateReturnInfo(Interp *iPtr) |
︙ | ︙ | |||
507 508 509 510 511 512 513 | } declare 135 generic { int TclpCheckStackSpace(void) } # Added in 8.1: | | | | | 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 | } declare 135 generic { int TclpCheckStackSpace(void) } # Added in 8.1: declare 137 generic {TCL_NO_FILESYSTEM} { int TclpChdir(CONST char *dirName) } declare 138 generic { char * TclGetEnv(CONST char *name, Tcl_DString *valuePtr) } declare 139 generic {TCL_NO_FILESYSTEM TCL_NO_LOADCMD} { int TclpLoadFile(Tcl_Interp *interp, char *fileName, char *sym1, \ char *sym2, Tcl_PackageInitProc **proc1Ptr, \ Tcl_PackageInitProc **proc2Ptr, ClientData *clientDataPtr) } declare 140 generic { int TclLooksLikeInt(char *bytes, int length) } declare 141 generic {TCL_NO_FILESYSTEM} { char *TclpGetCwd(Tcl_Interp *interp, Tcl_DString *cwdPtr) } declare 142 generic { int TclSetByteCodeFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr, \ CompileHookProc *hookProc, ClientData clientData) } declare 143 generic { |
︙ | ︙ | |||
566 567 568 569 570 571 572 | int TclRegAbout(Tcl_Interp *interp, Tcl_RegExp re) } declare 151 generic { void TclRegExpRangeUniChar(Tcl_RegExp re, int index, int *startPtr, \ int *endPtr) } | | | | 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 | int TclRegAbout(Tcl_Interp *interp, Tcl_RegExp re) } declare 151 generic { void TclRegExpRangeUniChar(Tcl_RegExp re, int index, int *startPtr, \ int *endPtr) } declare 152 generic {TCL_NO_FILESYSTEM} { void TclSetLibraryPath(Tcl_Obj *pathPtr) } declare 153 generic {TCL_NO_FILESYSTEM} { Tcl_Obj *TclGetLibraryPath(void) } # moved to tclTest.c in 8.3.2/8.4a2 #declare 154 generic { # int TclTestChannelCmd(ClientData clientData, # Tcl_Interp *interp, int argc, char **argv) |
︙ | ︙ | |||
596 597 598 599 600 601 602 | } declare 158 generic { void TclSetStartupScriptFileName(char *filename) } declare 159 generic { char *TclGetStartupScriptFileName(void) } | | | | 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 | } declare 158 generic { void TclSetStartupScriptFileName(char *filename) } declare 159 generic { char *TclGetStartupScriptFileName(void) } declare 160 generic {TCL_NO_FILESYSTEM} { int TclpMatchFilesTypes(Tcl_Interp *interp, char *separators, \ Tcl_DString *dirPtr, char *pattern, char *tail, GlobTypeData *types) } # new in 8.3.2/8.4a2 declare 161 generic { int TclChannelTransform(Tcl_Interp *interp, Tcl_Channel chan, \ Tcl_Obj *cmdObjPtr) } declare 162 generic {TCL_NO_FILEEVENTS} { void TclChannelEventScriptInvoker(ClientData clientData, int flags) } # New in 8.3.4, support for shared library version of tclcompiler. # ALERT: The result of 'TclGetInstructionTable' is actually an # InstructionDesc*" but we do not want to describe this structure in |
︙ | ︙ | |||
787 788 789 790 791 792 793 | # Removed in 8.3.1 (for Win32s only) #declare 10 win { # int TclWinSynchSpawn(void *args, int type, void **trans, Tcl_Pid *pidPtr) #} # Pipe channel functions | | | 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 | # Removed in 8.3.1 (for Win32s only) #declare 10 win { # int TclWinSynchSpawn(void *args, int type, void **trans, Tcl_Pid *pidPtr) #} # Pipe channel functions declare 11 win {TCL_NO_PIPES} { void TclGetAndDetachPids(Tcl_Interp *interp, Tcl_Channel chan) } declare 12 win { int TclpCloseFile(TclFile file) } declare 13 win { Tcl_Channel TclpCreateCommandChannel(TclFile readFile, \ |
︙ | ︙ | |||
855 856 857 858 859 860 861 | } ######################### # Unix specific internals # Pipe channel functions | | | | | | | | | | 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 | } ######################### # Unix specific internals # Pipe channel functions declare 0 unix {TCL_NO_PIPES} { void TclGetAndDetachPids(Tcl_Interp *interp, Tcl_Channel chan) } declare 1 unix {TCL_NO_PIPES} { int TclpCloseFile(TclFile file) } declare 2 unix {TCL_NO_PIPES} { Tcl_Channel TclpCreateCommandChannel(TclFile readFile, \ TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr) } declare 3 unix {TCL_NO_PIPES} { int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe) } declare 4 unix {TCL_NO_PIPES} { int TclpCreateProcess(Tcl_Interp *interp, int argc, char **argv, \ TclFile inputFile, TclFile outputFile, TclFile errorFile, \ Tcl_Pid *pidPtr) } # Signature changed in 8.1: # declare 5 unix { # TclFile TclpCreateTempFile(char *contents, # Tcl_DString *namePtr) # } declare 6 unix {TCL_NO_PIPES} { TclFile TclpMakeFile(Tcl_Channel channel, int direction) } declare 7 unix {TCL_NO_PIPES} { TclFile TclpOpenFile(CONST char *fname, int mode) } declare 8 unix { int TclUnixWaitForFile(int fd, int mask, int timeout) } # Added in 8.1: declare 9 unix {TCL_NO_PIPES} { TclFile TclpCreateTempFile(CONST char *contents) } |
Changes to generic/tclInterp.c.
1 2 3 4 5 6 7 8 9 10 11 | /* * tclInterp.c -- * * This file implements the "interp" command which allows creation * and manipulation of Tcl interpreters from within Tcl scripts. * * Copyright (c) 1995-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. * | | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | /* * tclInterp.c -- * * This file implements the "interp" command which allows creation * and manipulation of Tcl interpreters from within Tcl scripts. * * Copyright (c) 1995-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: tclInterp.c,v 1.5.12.2.2.1 2001/11/28 17:58:37 andreas_kupries Exp $ */ #include <stdio.h> #include "tclInt.h" #include "tclPort.h" #ifndef TCL_NO_CMDALIASES /* * Counter for how many aliases were created (global) */ static int aliasCounter = 0; TCL_DECLARE_MUTEX(cntMutex) |
︙ | ︙ | |||
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | /* Entry for target command in master. * This is used in the master interpreter to * map back from the target command to aliases * redirecting to it. Random access to this * hash table is never required - we are using * a hash table only for convenience. */ } Alias; /* * * struct Slave: * * Used by the "interp" command to record and find information about slave * interpreters. Maps from a command name in the master to information about * a slave interpreter, e.g. what aliases are defined in it. | > > | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | /* Entry for target command in master. * This is used in the master interpreter to * map back from the target command to aliases * redirecting to it. Random access to this * hash table is never required - we are using * a hash table only for convenience. */ } Alias; #endif #if !(defined(TCL_NO_SLAVEINTERP) && defined(TCL_NO_CMDALIASES)) /* * * struct Slave: * * Used by the "interp" command to record and find information about slave * interpreters. Maps from a command name in the master to information about * a slave interpreter, e.g. what aliases are defined in it. |
︙ | ︙ | |||
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | * master's table. */ Tcl_Interp *slaveInterp; /* The slave interpreter. */ Tcl_Command interpCmd; /* Interpreter object command. */ Tcl_HashTable aliasTable; /* Table which maps from names of commands * in slave interpreter to struct Alias * defined below. */ } Slave; /* * struct Target: * * Maps from master interpreter commands back to the source commands in slave * interpreters. This is needed because aliases can be created between sibling * interpreters and must be deleted when the target interpreter is deleted. In * case they would not be deleted the source interpreter would be left with a * "dangling pointer". One such record is stored in the Master record of the * master interpreter (in the targetTable hashtable, see below) with the * master for each alias which directs to a command in the master. These * records are used to remove the source command for an from a slave if/when * the master is deleted. */ typedef struct Target { Tcl_Command slaveCmd; /* Command for alias in slave interp. */ Tcl_Interp *slaveInterp; /* Slave Interpreter. */ } Target; /* * struct Master: * * This record is used for two purposes: First, slaveTable (a hashtable) * maps from names of commands to slave interpreters. This hashtable is * used to store information about slave interpreters of this interpreter, * to map over all slaves, etc. The second purpose is to store information * about all aliases in slaves (or siblings) which direct to target commands * in this interpreter (using the targetTable hashtable). * * NB: the flags field in the interp structure, used with SAFE_INTERP * mask denotes whether the interpreter is safe or not. Safe * interpreters have restricted functionality, can only create safe slave * interpreters and can only load safe extensions. */ typedef struct Master { Tcl_HashTable slaveTable; /* Hash table for slave interpreters. * Maps from command names to Slave records. */ Tcl_HashTable targetTable; /* Hash table for Target Records. Contains * all Target records which denote aliases * from slaves or sibling interpreters that * direct to commands in this interpreter. This * table is used to remove dangling pointers * from the slave (or sibling) interpreters * when this interpreter is deleted. */ } Master; /* * The following structure keeps track of all the Master and Slave information * on a per-interp basis. */ typedef struct InterpInfo { Master master; /* Keeps track of all interps for which this * interp is the Master. */ Slave slave; /* Information necessary for this interp to * function as a slave. */ } InterpInfo; /* * Prototypes for local static procedures: */ static int AliasCreate _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Interp *slaveInterp, Tcl_Interp *masterInterp, Tcl_Obj *namePtr, Tcl_Obj *targetPtr, int objc, Tcl_Obj *CONST objv[])); static int AliasDelete _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Interp *slaveInterp, Tcl_Obj *namePtr)); static int AliasDescribe _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Interp *slaveInterp, Tcl_Obj *objPtr)); static int AliasList _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Interp *slaveInterp)); static int AliasObjCmd _ANSI_ARGS_((ClientData dummy, Tcl_Interp *currentInterp, int objc, Tcl_Obj *CONST objv[])); static void AliasObjCmdDeleteProc _ANSI_ARGS_(( ClientData clientData)); static Tcl_Interp * GetInterp _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *pathPtr)); static Tcl_Interp * GetInterp2 _ANSI_ARGS_((Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); static void InterpInfoDeleteProc _ANSI_ARGS_(( ClientData clientData, Tcl_Interp *interp)); static Tcl_Interp * SlaveCreate _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *pathPtr, int safe)); static int SlaveEval _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Interp *slaveInterp, int objc, Tcl_Obj *CONST objv[])); static int SlaveExpose _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Interp *slaveInterp, int objc, | > > > > > > > > > > > > | 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | * master's table. */ Tcl_Interp *slaveInterp; /* The slave interpreter. */ Tcl_Command interpCmd; /* Interpreter object command. */ Tcl_HashTable aliasTable; /* Table which maps from names of commands * in slave interpreter to struct Alias * defined below. */ } Slave; #endif /* !(defined(TCL_NO_SLAVEINTERP) && defined(TCL_NO_CMDALIASES)) */ #ifndef TCL_NO_CMDALIASES /* * struct Target: * * Maps from master interpreter commands back to the source commands in slave * interpreters. This is needed because aliases can be created between sibling * interpreters and must be deleted when the target interpreter is deleted. In * case they would not be deleted the source interpreter would be left with a * "dangling pointer". One such record is stored in the Master record of the * master interpreter (in the targetTable hashtable, see below) with the * master for each alias which directs to a command in the master. These * records are used to remove the source command for an from a slave if/when * the master is deleted. */ typedef struct Target { Tcl_Command slaveCmd; /* Command for alias in slave interp. */ Tcl_Interp *slaveInterp; /* Slave Interpreter. */ } Target; #endif #if !(defined(TCL_NO_SLAVEINTERP) && defined(TCL_NO_CMDALIASES)) /* * struct Master: * * This record is used for two purposes: First, slaveTable (a hashtable) * maps from names of commands to slave interpreters. This hashtable is * used to store information about slave interpreters of this interpreter, * to map over all slaves, etc. The second purpose is to store information * about all aliases in slaves (or siblings) which direct to target commands * in this interpreter (using the targetTable hashtable). * * NB: the flags field in the interp structure, used with SAFE_INTERP * mask denotes whether the interpreter is safe or not. Safe * interpreters have restricted functionality, can only create safe slave * interpreters and can only load safe extensions. */ typedef struct Master { Tcl_HashTable slaveTable; /* Hash table for slave interpreters. * Maps from command names to Slave records. */ #ifndef TCL_NO_CMDALIASES Tcl_HashTable targetTable; /* Hash table for Target Records. Contains * all Target records which denote aliases * from slaves or sibling interpreters that * direct to commands in this interpreter. This * table is used to remove dangling pointers * from the slave (or sibling) interpreters * when this interpreter is deleted. */ #endif } Master; /* * The following structure keeps track of all the Master and Slave information * on a per-interp basis. */ typedef struct InterpInfo { Master master; /* Keeps track of all interps for which this * interp is the Master. */ Slave slave; /* Information necessary for this interp to * function as a slave. */ } InterpInfo; #endif /* !(defined(TCL_NO_SLAVEINTERP) && defined(TCL_NO_CMDALIASES)) */ /* * Prototypes for local static procedures: */ #ifndef TCL_NO_CMDALIASES static int AliasCreate _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Interp *slaveInterp, Tcl_Interp *masterInterp, Tcl_Obj *namePtr, Tcl_Obj *targetPtr, int objc, Tcl_Obj *CONST objv[])); static int AliasDelete _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Interp *slaveInterp, Tcl_Obj *namePtr)); static int AliasDescribe _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Interp *slaveInterp, Tcl_Obj *objPtr)); static int AliasList _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Interp *slaveInterp)); static int AliasObjCmd _ANSI_ARGS_((ClientData dummy, Tcl_Interp *currentInterp, int objc, Tcl_Obj *CONST objv[])); static void AliasObjCmdDeleteProc _ANSI_ARGS_(( ClientData clientData)); #endif #if !(defined(TCL_NO_SLAVEINTERP) && defined(TCL_NO_CMDALIASES)) static Tcl_Interp * GetInterp _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *pathPtr)); static Tcl_Interp * GetInterp2 _ANSI_ARGS_((Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); static void InterpInfoDeleteProc _ANSI_ARGS_(( ClientData clientData, Tcl_Interp *interp)); #endif /* !(defined(TCL_NO_SLAVEINTERP) && defined(TCL_NO_CMDALIASES)) */ #ifndef TCL_NO_SLAVEINTERP static Tcl_Interp * SlaveCreate _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *pathPtr, int safe)); static int SlaveEval _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Interp *slaveInterp, int objc, Tcl_Obj *CONST objv[])); static int SlaveExpose _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Interp *slaveInterp, int objc, |
︙ | ︙ | |||
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | static int SlaveMarkTrusted _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Interp *slaveInterp)); static int SlaveObjCmd _ANSI_ARGS_((ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); static void SlaveObjCmdDeleteProc _ANSI_ARGS_(( ClientData clientData)); /* *--------------------------------------------------------------------------- * * TclInterpInit -- * * Initializes the invoking interpreter for using the master, slave * and safe interp facilities. This is called from inside * Tcl_CreateInterp(). * * Results: * Always returns TCL_OK for backwards compatibility. * * Side effects: * Adds the "interp" command to an interpreter and initializes the * interpInfoPtr field of the invoking interpreter. * *--------------------------------------------------------------------------- */ int TclInterpInit(interp) Tcl_Interp *interp; /* Interpreter to initialize. */ { InterpInfo *interpInfoPtr; Master *masterPtr; Slave *slavePtr; interpInfoPtr = (InterpInfo *) ckalloc(sizeof(InterpInfo)); ((Interp *) interp)->interpInfo = (ClientData) interpInfoPtr; masterPtr = &interpInfoPtr->master; Tcl_InitHashTable(&masterPtr->slaveTable, TCL_STRING_KEYS); Tcl_InitHashTable(&masterPtr->targetTable, TCL_ONE_WORD_KEYS); slavePtr = &interpInfoPtr->slave; slavePtr->masterInterp = NULL; slavePtr->slaveEntryPtr = NULL; slavePtr->slaveInterp = interp; slavePtr->interpCmd = NULL; Tcl_InitHashTable(&slavePtr->aliasTable, TCL_STRING_KEYS); Tcl_CreateObjCommand(interp, "interp", Tcl_InterpObjCmd, NULL, NULL); Tcl_CallWhenDeleted(interp, InterpInfoDeleteProc, NULL); return TCL_OK; } /* *--------------------------------------------------------------------------- * * InterpInfoDeleteProc -- * * Invoked when an interpreter is being deleted. It releases all * storage used by the master/slave/safe interpreter facilities. * * Results: * None. * * Side effects: * Cleans up storage. Sets the interpInfoPtr field of the interp * to NULL. * *--------------------------------------------------------------------------- */ static void InterpInfoDeleteProc(clientData, interp) ClientData clientData; /* Ignored. */ Tcl_Interp *interp; /* Interp being deleted. All commands for * slave interps should already be deleted. */ { InterpInfo *interpInfoPtr; Slave *slavePtr; Master *masterPtr; Tcl_HashSearch hSearch; Tcl_HashEntry *hPtr; Target *targetPtr; interpInfoPtr = (InterpInfo *) ((Interp *) interp)->interpInfo; /* * There shouldn't be any commands left. */ masterPtr = &interpInfoPtr->master; if (masterPtr->slaveTable.numEntries != 0) { panic("InterpInfoDeleteProc: still exist commands"); } Tcl_DeleteHashTable(&masterPtr->slaveTable); /* * Tell any interps that have aliases to this interp that they should * delete those aliases. If the other interp was already dead, it * would have removed the target record already. */ hPtr = Tcl_FirstHashEntry(&masterPtr->targetTable, &hSearch); while (hPtr != NULL) { targetPtr = (Target *) Tcl_GetHashValue(hPtr); Tcl_DeleteCommandFromToken(targetPtr->slaveInterp, targetPtr->slaveCmd); hPtr = Tcl_NextHashEntry(&hSearch); } Tcl_DeleteHashTable(&masterPtr->targetTable); slavePtr = &interpInfoPtr->slave; if (slavePtr->interpCmd != NULL) { /* * Tcl_DeleteInterp() was called on this interpreter, rather * "interp delete" or the equivalent deletion of the command in the * master. First ensure that the cleanup callback doesn't try to | > > > > > > > > > > | 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | static int SlaveMarkTrusted _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Interp *slaveInterp)); static int SlaveObjCmd _ANSI_ARGS_((ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); static void SlaveObjCmdDeleteProc _ANSI_ARGS_(( ClientData clientData)); #endif /* *--------------------------------------------------------------------------- * * TclInterpInit -- * * Initializes the invoking interpreter for using the master, slave * and safe interp facilities. This is called from inside * Tcl_CreateInterp(). * * Results: * Always returns TCL_OK for backwards compatibility. * * Side effects: * Adds the "interp" command to an interpreter and initializes the * interpInfoPtr field of the invoking interpreter. * *--------------------------------------------------------------------------- */ #if !(defined(TCL_NO_SLAVEINTERP) && defined(TCL_NO_CMDALIASES)) int TclInterpInit(interp) Tcl_Interp *interp; /* Interpreter to initialize. */ { InterpInfo *interpInfoPtr; Master *masterPtr; Slave *slavePtr; interpInfoPtr = (InterpInfo *) ckalloc(sizeof(InterpInfo)); ((Interp *) interp)->interpInfo = (ClientData) interpInfoPtr; masterPtr = &interpInfoPtr->master; Tcl_InitHashTable(&masterPtr->slaveTable, TCL_STRING_KEYS); #ifndef TCL_NO_CMDALIASES Tcl_InitHashTable(&masterPtr->targetTable, TCL_ONE_WORD_KEYS); #endif slavePtr = &interpInfoPtr->slave; slavePtr->masterInterp = NULL; slavePtr->slaveEntryPtr = NULL; slavePtr->slaveInterp = interp; slavePtr->interpCmd = NULL; Tcl_InitHashTable(&slavePtr->aliasTable, TCL_STRING_KEYS); Tcl_CreateObjCommand(interp, "interp", Tcl_InterpObjCmd, NULL, NULL); Tcl_CallWhenDeleted(interp, InterpInfoDeleteProc, NULL); return TCL_OK; } #endif /* !(defined(TCL_NO_SLAVEINTERP) && defined(TCL_NO_CMDALIASES)) */ /* *--------------------------------------------------------------------------- * * InterpInfoDeleteProc -- * * Invoked when an interpreter is being deleted. It releases all * storage used by the master/slave/safe interpreter facilities. * * Results: * None. * * Side effects: * Cleans up storage. Sets the interpInfoPtr field of the interp * to NULL. * *--------------------------------------------------------------------------- */ #if !(defined(TCL_NO_SLAVEINTERP) && defined(TCL_NO_CMDALIASES)) static void InterpInfoDeleteProc(clientData, interp) ClientData clientData; /* Ignored. */ Tcl_Interp *interp; /* Interp being deleted. All commands for * slave interps should already be deleted. */ { InterpInfo *interpInfoPtr; Slave *slavePtr; Master *masterPtr; #ifndef TCL_NO_CMDALIASES Tcl_HashSearch hSearch; Tcl_HashEntry *hPtr; Target *targetPtr; #endif interpInfoPtr = (InterpInfo *) ((Interp *) interp)->interpInfo; /* * There shouldn't be any commands left. */ masterPtr = &interpInfoPtr->master; if (masterPtr->slaveTable.numEntries != 0) { panic("InterpInfoDeleteProc: still exist commands"); } Tcl_DeleteHashTable(&masterPtr->slaveTable); #ifndef TCL_NO_CMDALIASES /* * Tell any interps that have aliases to this interp that they should * delete those aliases. If the other interp was already dead, it * would have removed the target record already. */ hPtr = Tcl_FirstHashEntry(&masterPtr->targetTable, &hSearch); while (hPtr != NULL) { targetPtr = (Target *) Tcl_GetHashValue(hPtr); Tcl_DeleteCommandFromToken(targetPtr->slaveInterp, targetPtr->slaveCmd); hPtr = Tcl_NextHashEntry(&hSearch); } Tcl_DeleteHashTable(&masterPtr->targetTable); #endif slavePtr = &interpInfoPtr->slave; if (slavePtr->interpCmd != NULL) { /* * Tcl_DeleteInterp() was called on this interpreter, rather * "interp delete" or the equivalent deletion of the command in the * master. First ensure that the cleanup callback doesn't try to |
︙ | ︙ | |||
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 | if (slavePtr->aliasTable.numEntries != 0) { panic("InterpInfoDeleteProc: still exist aliases"); } Tcl_DeleteHashTable(&slavePtr->aliasTable); ckfree((char *) interpInfoPtr); } /* *---------------------------------------------------------------------- * * Tcl_InterpObjCmd -- * * This procedure is invoked to process the "interp" Tcl command. * See the user documentation for details on what it does. * * Results: * A standard Tcl result. * * Side effects: * See the user documentation. * *---------------------------------------------------------------------- */ /* ARGSUSED */ int Tcl_InterpObjCmd(clientData, interp, objc, objv) ClientData clientData; /* Unused. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ { int index; static char *options[] = { | > > > > | > > > | > > > > > > > > > > > > > > > | > > > > > > > > | | > > > > > > > > > > > > | > > > | 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 | if (slavePtr->aliasTable.numEntries != 0) { panic("InterpInfoDeleteProc: still exist aliases"); } Tcl_DeleteHashTable(&slavePtr->aliasTable); ckfree((char *) interpInfoPtr); } #endif /* !(defined(TCL_NO_SLAVEINTERP) && defined(TCL_NO_CMDALIASES)) */ /* *---------------------------------------------------------------------- * * Tcl_InterpObjCmd -- * * This procedure is invoked to process the "interp" Tcl command. * See the user documentation for details on what it does. * * Results: * A standard Tcl result. * * Side effects: * See the user documentation. * *---------------------------------------------------------------------- */ #if !(defined(TCL_NO_SLAVEINTERP) && defined(TCL_NO_CMDALIASES)) /* ARGSUSED */ int Tcl_InterpObjCmd(clientData, interp, objc, objv) ClientData clientData; /* Unused. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ { int index; static char *options[] = { #ifndef TCL_NO_CMDALIASES "alias", "aliases", #endif #ifndef TCL_NO_SLAVEINTERP "create", "delete", "eval", "exists", "expose", "hide", "hidden", "issafe", "invokehidden", "marktrusted", "slaves", #endif #ifndef TCL_NO_SLAVEINTERP #ifndef TCL_NO_NONSTDCHAN "share", #endif #endif #ifndef TCL_NO_CMDALIASES "target", #endif #ifndef TCL_NO_SLAVEINTERP #ifndef TCL_NO_NONSTDCHAN "transfer", #endif #endif NULL }; enum option { #ifndef TCL_NO_CMDALIASES OPT_ALIAS ,OPT_ALIASES #endif #ifndef TCL_NO_SLAVEINTERP #ifndef TCL_NO_CMDALIASES , #endif OPT_CREATE ,OPT_DELETE ,OPT_EVAL, OPT_EXISTS, OPT_EXPOSE, OPT_HIDE ,OPT_HIDDEN, OPT_ISSAFE, OPT_INVOKEHID, OPT_MARKTRUSTED ,OPT_SLAVES #endif #ifndef TCL_NO_SLAVEINTERP #ifndef TCL_NO_NONSTDCHAN ,OPT_SHARE #endif #endif #ifndef TCL_NO_CMDALIASES ,OPT_TARGET #endif #ifndef TCL_NO_SLAVEINTERP #ifndef TCL_NO_NONSTDCHAN ,OPT_TRANSFER #endif #endif }; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "cmd ?arg ...?"); return TCL_ERROR; } if (Tcl_GetIndexFromObj(interp, objv[1], options, "option", 0, &index) != TCL_OK) { return TCL_ERROR; } switch ((enum option) index) { #ifndef TCL_NO_CMDALIASES case OPT_ALIAS: { Tcl_Interp *slaveInterp, *masterInterp; if (objc < 4) { aliasArgs: Tcl_WrongNumArgs(interp, 2, objv, "slavePath slaveCmd ?masterPath masterCmd? ?args ..?"); |
︙ | ︙ | |||
411 412 413 414 415 416 417 418 419 420 421 422 423 424 | slaveInterp = GetInterp2(interp, objc, objv); if (slaveInterp == NULL) { return TCL_ERROR; } return AliasList(interp, slaveInterp); } case OPT_CREATE: { int i, last, safe; Tcl_Obj *slavePtr; char buf[16 + TCL_INTEGER_SPACE]; static char *options[] = { "-safe", "--", NULL }; | > > | 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 | slaveInterp = GetInterp2(interp, objc, objv); if (slaveInterp == NULL) { return TCL_ERROR; } return AliasList(interp, slaveInterp); } #endif #ifndef TCL_NO_SLAVEINTERP case OPT_CREATE: { int i, last, safe; Tcl_Obj *slavePtr; char buf[16 + TCL_INTEGER_SPACE]; static char *options[] = { "-safe", "--", NULL }; |
︙ | ︙ | |||
648 649 650 651 652 653 654 655 656 657 658 659 660 661 | for ( ; hPtr != NULL; hPtr = Tcl_NextHashEntry(&hashSearch)) { string = Tcl_GetHashKey(&iiPtr->master.slaveTable, hPtr); Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj(string, -1)); } return TCL_OK; } case OPT_SHARE: { Tcl_Interp *slaveInterp; /* A slave. */ Tcl_Interp *masterInterp; /* Its master. */ Tcl_Channel chan; if (objc != 5) { Tcl_WrongNumArgs(interp, 2, objv, "srcPath channelId destPath"); | > > > | 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 | for ( ; hPtr != NULL; hPtr = Tcl_NextHashEntry(&hashSearch)) { string = Tcl_GetHashKey(&iiPtr->master.slaveTable, hPtr); Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj(string, -1)); } return TCL_OK; } #endif #ifndef TCL_NO_NONSTDCHAN #ifndef TCL_NO_SLAVEINTERP case OPT_SHARE: { Tcl_Interp *slaveInterp; /* A slave. */ Tcl_Interp *masterInterp; /* Its master. */ Tcl_Channel chan; if (objc != 5) { Tcl_WrongNumArgs(interp, 2, objv, "srcPath channelId destPath"); |
︙ | ︙ | |||
674 675 676 677 678 679 680 681 682 683 684 685 686 687 | slaveInterp = GetInterp(interp, objv[4]); if (slaveInterp == NULL) { return TCL_ERROR; } Tcl_RegisterChannel(slaveInterp, chan); return TCL_OK; } case OPT_TARGET: { Tcl_Interp *slaveInterp; InterpInfo *iiPtr; Tcl_HashEntry *hPtr; Alias *aliasPtr; char *aliasName; | > > > | 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 | slaveInterp = GetInterp(interp, objv[4]); if (slaveInterp == NULL) { return TCL_ERROR; } Tcl_RegisterChannel(slaveInterp, chan); return TCL_OK; } #endif #endif #ifndef TCL_NO_CMDALIASES case OPT_TARGET: { Tcl_Interp *slaveInterp; InterpInfo *iiPtr; Tcl_HashEntry *hPtr; Alias *aliasPtr; char *aliasName; |
︙ | ︙ | |||
713 714 715 716 717 718 719 720 721 722 723 724 725 726 | "target interpreter for alias \"", aliasName, "\" in path \"", Tcl_GetString(objv[2]), "\" is not my descendant", (char *) NULL); return TCL_ERROR; } return TCL_OK; } case OPT_TRANSFER: { Tcl_Interp *slaveInterp; /* A slave. */ Tcl_Interp *masterInterp; /* Its master. */ Tcl_Channel chan; if (objc != 5) { Tcl_WrongNumArgs(interp, 2, objv, | > > > | 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 | "target interpreter for alias \"", aliasName, "\" in path \"", Tcl_GetString(objv[2]), "\" is not my descendant", (char *) NULL); return TCL_ERROR; } return TCL_OK; } #endif #ifndef TCL_NO_NONSTDCHAN #ifndef TCL_NO_SLAVEINTERP case OPT_TRANSFER: { Tcl_Interp *slaveInterp; /* A slave. */ Tcl_Interp *masterInterp; /* Its master. */ Tcl_Channel chan; if (objc != 5) { Tcl_WrongNumArgs(interp, 2, objv, |
︙ | ︙ | |||
743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 | Tcl_RegisterChannel(slaveInterp, chan); if (Tcl_UnregisterChannel(masterInterp, chan) != TCL_OK) { TclTransferResult(masterInterp, TCL_OK, interp); return TCL_ERROR; } return TCL_OK; } } return TCL_OK; } /* *--------------------------------------------------------------------------- * * GetInterp2 -- * * Helper function for Tcl_InterpObjCmd() to convert the interp name | > > > | 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 | Tcl_RegisterChannel(slaveInterp, chan); if (Tcl_UnregisterChannel(masterInterp, chan) != TCL_OK) { TclTransferResult(masterInterp, TCL_OK, interp); return TCL_ERROR; } return TCL_OK; } #endif #endif } return TCL_OK; } #endif /* !(defined(TCL_NO_SLAVEINTERP) && defined(TCL_NO_CMDALIASES)) */ /* *--------------------------------------------------------------------------- * * GetInterp2 -- * * Helper function for Tcl_InterpObjCmd() to convert the interp name |
︙ | ︙ | |||
768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 | * * Side effects: * None. * *--------------------------------------------------------------------------- */ static Tcl_Interp * GetInterp2(interp, objc, objv) Tcl_Interp *interp; /* Default interp if no interp was specified * on the command line. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ { if (objc == 2) { return interp; } else if (objc == 3) { return GetInterp(interp, objv[2]); } else { Tcl_WrongNumArgs(interp, 2, objv, "?path?"); return NULL; } } /* *---------------------------------------------------------------------- * * Tcl_CreateAlias -- * * Creates an alias between two interpreters. * * Results: * A standard Tcl result. * * Side effects: * Creates a new alias, manipulates the result field of slaveInterp. * *---------------------------------------------------------------------- */ int Tcl_CreateAlias(slaveInterp, slaveCmd, targetInterp, targetCmd, argc, argv) Tcl_Interp *slaveInterp; /* Interpreter for source command. */ char *slaveCmd; /* Command to install in slave. */ Tcl_Interp *targetInterp; /* Interpreter for target command. */ char *targetCmd; /* Name of target command. */ int argc; /* How many additional arguments? */ | > > > | 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 | * * Side effects: * None. * *--------------------------------------------------------------------------- */ #if !(defined(TCL_NO_SLAVEINTERP) && defined(TCL_NO_CMDALIASES)) static Tcl_Interp * GetInterp2(interp, objc, objv) Tcl_Interp *interp; /* Default interp if no interp was specified * on the command line. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ { if (objc == 2) { return interp; } else if (objc == 3) { return GetInterp(interp, objv[2]); } else { Tcl_WrongNumArgs(interp, 2, objv, "?path?"); return NULL; } } #endif /* !(defined(TCL_NO_SLAVEINTERP) && defined(TCL_NO_CMDALIASES)) */ /* *---------------------------------------------------------------------- * * Tcl_CreateAlias -- * * Creates an alias between two interpreters. * * Results: * A standard Tcl result. * * Side effects: * Creates a new alias, manipulates the result field of slaveInterp. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_CMDALIASES int Tcl_CreateAlias(slaveInterp, slaveCmd, targetInterp, targetCmd, argc, argv) Tcl_Interp *slaveInterp; /* Interpreter for source command. */ char *slaveCmd; /* Command to install in slave. */ Tcl_Interp *targetInterp; /* Interpreter for target command. */ char *targetCmd; /* Name of target command. */ int argc; /* How many additional arguments? */ |
︙ | ︙ | |||
839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 | } ckfree((char *) objv); Tcl_DecrRefCount(targetObjPtr); Tcl_DecrRefCount(slaveObjPtr); return result; } /* *---------------------------------------------------------------------- * * Tcl_CreateAliasObj -- * * Object version: Creates an alias between two interpreters. * * Results: * A standard Tcl result. * * Side effects: * Creates a new alias. * *---------------------------------------------------------------------- */ int Tcl_CreateAliasObj(slaveInterp, slaveCmd, targetInterp, targetCmd, objc, objv) Tcl_Interp *slaveInterp; /* Interpreter for source command. */ char *slaveCmd; /* Command to install in slave. */ Tcl_Interp *targetInterp; /* Interpreter for target command. */ char *targetCmd; /* Name of target command. */ int objc; /* How many additional arguments? */ | > > | 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 | } ckfree((char *) objv); Tcl_DecrRefCount(targetObjPtr); Tcl_DecrRefCount(slaveObjPtr); return result; } #endif /* *---------------------------------------------------------------------- * * Tcl_CreateAliasObj -- * * Object version: Creates an alias between two interpreters. * * Results: * A standard Tcl result. * * Side effects: * Creates a new alias. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_CMDALIASES int Tcl_CreateAliasObj(slaveInterp, slaveCmd, targetInterp, targetCmd, objc, objv) Tcl_Interp *slaveInterp; /* Interpreter for source command. */ char *slaveCmd; /* Command to install in slave. */ Tcl_Interp *targetInterp; /* Interpreter for target command. */ char *targetCmd; /* Name of target command. */ int objc; /* How many additional arguments? */ |
︙ | ︙ | |||
881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 | result = AliasCreate(slaveInterp, slaveInterp, targetInterp, slaveObjPtr, targetObjPtr, objc, objv); Tcl_DecrRefCount(slaveObjPtr); Tcl_DecrRefCount(targetObjPtr); return result; } /* *---------------------------------------------------------------------- * * Tcl_GetAlias -- * * Gets information about an alias. * * Results: * A standard Tcl result. * * Side effects: * None. * *---------------------------------------------------------------------- */ int Tcl_GetAlias(interp, aliasName, targetInterpPtr, targetNamePtr, argcPtr, argvPtr) Tcl_Interp *interp; /* Interp to start search from. */ char *aliasName; /* Name of alias to find. */ Tcl_Interp **targetInterpPtr; /* (Return) target interpreter. */ char **targetNamePtr; /* (Return) name of target command. */ | > > | 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 | result = AliasCreate(slaveInterp, slaveInterp, targetInterp, slaveObjPtr, targetObjPtr, objc, objv); Tcl_DecrRefCount(slaveObjPtr); Tcl_DecrRefCount(targetObjPtr); return result; } #endif /* *---------------------------------------------------------------------- * * Tcl_GetAlias -- * * Gets information about an alias. * * Results: * A standard Tcl result. * * Side effects: * None. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_CMDALIASES int Tcl_GetAlias(interp, aliasName, targetInterpPtr, targetNamePtr, argcPtr, argvPtr) Tcl_Interp *interp; /* Interp to start search from. */ char *aliasName; /* Name of alias to find. */ Tcl_Interp **targetInterpPtr; /* (Return) target interpreter. */ char **targetNamePtr; /* (Return) name of target command. */ |
︙ | ︙ | |||
941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 | *argvPtr = (char **) ckalloc((unsigned) sizeof(char *) * (objc - 1)); for (i = 1; i < objc; i++) { *argvPtr[i - 1] = Tcl_GetString(objv[i]); } } return TCL_OK; } /* *---------------------------------------------------------------------- * * Tcl_GetAliasObj -- * * Object version: Gets information about an alias. * * Results: * A standard Tcl result. * * Side effects: * None. * *---------------------------------------------------------------------- */ int Tcl_GetAliasObj(interp, aliasName, targetInterpPtr, targetNamePtr, objcPtr, objvPtr) Tcl_Interp *interp; /* Interp to start search from. */ char *aliasName; /* Name of alias to find. */ Tcl_Interp **targetInterpPtr; /* (Return) target interpreter. */ char **targetNamePtr; /* (Return) name of target command. */ | > > | 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 | *argvPtr = (char **) ckalloc((unsigned) sizeof(char *) * (objc - 1)); for (i = 1; i < objc; i++) { *argvPtr[i - 1] = Tcl_GetString(objv[i]); } } return TCL_OK; } #endif /* *---------------------------------------------------------------------- * * Tcl_GetAliasObj -- * * Object version: Gets information about an alias. * * Results: * A standard Tcl result. * * Side effects: * None. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_CMDALIASES int Tcl_GetAliasObj(interp, aliasName, targetInterpPtr, targetNamePtr, objcPtr, objvPtr) Tcl_Interp *interp; /* Interp to start search from. */ char *aliasName; /* Name of alias to find. */ Tcl_Interp **targetInterpPtr; /* (Return) target interpreter. */ char **targetNamePtr; /* (Return) name of target command. */ |
︙ | ︙ | |||
998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 | *objcPtr = objc - 1; } if (objvPtr != (Tcl_Obj ***) NULL) { *objvPtr = objv + 1; } return TCL_OK; } /* *---------------------------------------------------------------------- * * TclPreventAliasLoop -- * * When defining an alias or renaming a command, prevent an alias | > | 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 | *objcPtr = objc - 1; } if (objvPtr != (Tcl_Obj ***) NULL) { *objvPtr = objv + 1; } return TCL_OK; } #endif /* *---------------------------------------------------------------------- * * TclPreventAliasLoop -- * * When defining an alias or renaming a command, prevent an alias |
︙ | ︙ | |||
1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 | * NOTE: * This function is public internal (instead of being static to * this file) because it is also used from TclRenameCommand. * *---------------------------------------------------------------------- */ int TclPreventAliasLoop(interp, cmdInterp, cmd) Tcl_Interp *interp; /* Interp in which to report errors. */ Tcl_Interp *cmdInterp; /* Interp in which the command is * being defined. */ Tcl_Command cmd; /* Tcl command we are attempting * to define. */ | > | 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 | * NOTE: * This function is public internal (instead of being static to * this file) because it is also used from TclRenameCommand. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_CMDALIASES int TclPreventAliasLoop(interp, cmdInterp, cmd) Tcl_Interp *interp; /* Interp in which to report errors. */ Tcl_Interp *cmdInterp; /* Interp in which the command is * being defined. */ Tcl_Command cmd; /* Tcl command we are attempting * to define. */ |
︙ | ︙ | |||
1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 | return TCL_OK; } nextAliasPtr = (Alias *) aliasCmdPtr->objClientData; } /* NOTREACHED */ } /* *---------------------------------------------------------------------- * * AliasCreate -- * * Helper function to do the work to actually create an alias. * * Results: * A standard Tcl result. * * Side effects: * An alias command is created and entered into the alias table * for the slave interpreter. * *---------------------------------------------------------------------- */ static int AliasCreate(interp, slaveInterp, masterInterp, namePtr, targetNamePtr, objc, objv) Tcl_Interp *interp; /* Interp for error reporting. */ Tcl_Interp *slaveInterp; /* Interp where alias cmd will live or from * which alias will be deleted. */ Tcl_Interp *masterInterp; /* Interp in which target command will be | > > | 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 | return TCL_OK; } nextAliasPtr = (Alias *) aliasCmdPtr->objClientData; } /* NOTREACHED */ } #endif /* *---------------------------------------------------------------------- * * AliasCreate -- * * Helper function to do the work to actually create an alias. * * Results: * A standard Tcl result. * * Side effects: * An alias command is created and entered into the alias table * for the slave interpreter. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_CMDALIASES static int AliasCreate(interp, slaveInterp, masterInterp, namePtr, targetNamePtr, objc, objv) Tcl_Interp *interp; /* Interp for error reporting. */ Tcl_Interp *slaveInterp; /* Interp where alias cmd will live or from * which alias will be deleted. */ Tcl_Interp *masterInterp; /* Interp in which target command will be |
︙ | ︙ | |||
1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 | Tcl_SetHashValue(hPtr, (ClientData) targetPtr); aliasPtr->targetEntryPtr = hPtr; Tcl_SetObjResult(interp, namePtr); return TCL_OK; } /* *---------------------------------------------------------------------- * * AliasDelete -- * * Deletes the given alias from the slave interpreter given. * * Results: * A standard Tcl result. * * Side effects: * Deletes the alias from the slave interpreter. * *---------------------------------------------------------------------- */ static int AliasDelete(interp, slaveInterp, namePtr) Tcl_Interp *interp; /* Interpreter for result & errors. */ Tcl_Interp *slaveInterp; /* Interpreter containing alias. */ Tcl_Obj *namePtr; /* Name of alias to describe. */ { Slave *slavePtr; | > > | 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 | Tcl_SetHashValue(hPtr, (ClientData) targetPtr); aliasPtr->targetEntryPtr = hPtr; Tcl_SetObjResult(interp, namePtr); return TCL_OK; } #endif /* *---------------------------------------------------------------------- * * AliasDelete -- * * Deletes the given alias from the slave interpreter given. * * Results: * A standard Tcl result. * * Side effects: * Deletes the alias from the slave interpreter. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_CMDALIASES static int AliasDelete(interp, slaveInterp, namePtr) Tcl_Interp *interp; /* Interpreter for result & errors. */ Tcl_Interp *slaveInterp; /* Interpreter containing alias. */ Tcl_Obj *namePtr; /* Name of alias to describe. */ { Slave *slavePtr; |
︙ | ︙ | |||
1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 | Tcl_GetString(namePtr), "\" not found", NULL); return TCL_ERROR; } aliasPtr = (Alias *) Tcl_GetHashValue(hPtr); Tcl_DeleteCommandFromToken(slaveInterp, aliasPtr->slaveCmd); return TCL_OK; } /* *---------------------------------------------------------------------- * * AliasDescribe -- * * Sets the interpreter's result object to a Tcl list describing * the given alias in the given interpreter: its target command * and the additional arguments to prepend to any invocation * of the alias. * * Results: * A standard Tcl result. * * Side effects: * None. * *---------------------------------------------------------------------- */ static int AliasDescribe(interp, slaveInterp, namePtr) Tcl_Interp *interp; /* Interpreter for result & errors. */ Tcl_Interp *slaveInterp; /* Interpreter containing alias. */ Tcl_Obj *namePtr; /* Name of alias to describe. */ { Slave *slavePtr; | > > | 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 | Tcl_GetString(namePtr), "\" not found", NULL); return TCL_ERROR; } aliasPtr = (Alias *) Tcl_GetHashValue(hPtr); Tcl_DeleteCommandFromToken(slaveInterp, aliasPtr->slaveCmd); return TCL_OK; } #endif /* *---------------------------------------------------------------------- * * AliasDescribe -- * * Sets the interpreter's result object to a Tcl list describing * the given alias in the given interpreter: its target command * and the additional arguments to prepend to any invocation * of the alias. * * Results: * A standard Tcl result. * * Side effects: * None. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_CMDALIASES static int AliasDescribe(interp, slaveInterp, namePtr) Tcl_Interp *interp; /* Interpreter for result & errors. */ Tcl_Interp *slaveInterp; /* Interpreter containing alias. */ Tcl_Obj *namePtr; /* Name of alias to describe. */ { Slave *slavePtr; |
︙ | ︙ | |||
1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 | if (hPtr == NULL) { return TCL_OK; } aliasPtr = (Alias *) Tcl_GetHashValue(hPtr); Tcl_SetObjResult(interp, aliasPtr->prefixPtr); return TCL_OK; } /* *---------------------------------------------------------------------- * * AliasList -- * * Computes a list of aliases defined in a slave interpreter. * * Results: * A standard Tcl result. * * Side effects: * None. * *---------------------------------------------------------------------- */ static int AliasList(interp, slaveInterp) Tcl_Interp *interp; /* Interp for data return. */ Tcl_Interp *slaveInterp; /* Interp whose aliases to compute. */ { Tcl_HashEntry *entryPtr; Tcl_HashSearch hashSearch; | > > | 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 | if (hPtr == NULL) { return TCL_OK; } aliasPtr = (Alias *) Tcl_GetHashValue(hPtr); Tcl_SetObjResult(interp, aliasPtr->prefixPtr); return TCL_OK; } #endif /* *---------------------------------------------------------------------- * * AliasList -- * * Computes a list of aliases defined in a slave interpreter. * * Results: * A standard Tcl result. * * Side effects: * None. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_CMDALIASES static int AliasList(interp, slaveInterp) Tcl_Interp *interp; /* Interp for data return. */ Tcl_Interp *slaveInterp; /* Interp whose aliases to compute. */ { Tcl_HashEntry *entryPtr; Tcl_HashSearch hashSearch; |
︙ | ︙ | |||
1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 | entryPtr = Tcl_FirstHashEntry(&slavePtr->aliasTable, &hashSearch); for ( ; entryPtr != NULL; entryPtr = Tcl_NextHashEntry(&hashSearch)) { aliasPtr = (Alias *) Tcl_GetHashValue(entryPtr); Tcl_ListObjAppendElement(NULL, resultPtr, aliasPtr->namePtr); } return TCL_OK; } /* *---------------------------------------------------------------------- * * AliasObjCmd -- * * This is the procedure that services invocations of aliases in a | > | 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 | entryPtr = Tcl_FirstHashEntry(&slavePtr->aliasTable, &hashSearch); for ( ; entryPtr != NULL; entryPtr = Tcl_NextHashEntry(&hashSearch)) { aliasPtr = (Alias *) Tcl_GetHashValue(entryPtr); Tcl_ListObjAppendElement(NULL, resultPtr, aliasPtr->namePtr); } return TCL_OK; } #endif /* *---------------------------------------------------------------------- * * AliasObjCmd -- * * This is the procedure that services invocations of aliases in a |
︙ | ︙ | |||
1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 | * Causes forwarding of the invocation; all possible side effects * may occur as a result of invoking the command to which the * invocation is forwarded. * *---------------------------------------------------------------------- */ static int AliasObjCmd(clientData, interp, objc, objv) ClientData clientData; /* Alias record. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument vector. */ { | > | 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 | * Causes forwarding of the invocation; all possible side effects * may occur as a result of invoking the command to which the * invocation is forwarded. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_CMDALIASES static int AliasObjCmd(clientData, interp, objc, objv) ClientData clientData; /* Alias record. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument vector. */ { |
︙ | ︙ | |||
1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 | ((Interp *) targetInterp)->numLevels--; TclTransferResult(targetInterp, result, interp); Tcl_Release((ClientData) targetInterp); return result; } /* *---------------------------------------------------------------------- * * AliasObjCmdDeleteProc -- * * Is invoked when an alias command is deleted in a slave. Cleans up * all storage associated with this alias. * * Results: * None. * * Side effects: * Deletes the alias record and its entry in the alias table for * the interpreter. * *---------------------------------------------------------------------- */ static void AliasObjCmdDeleteProc(clientData) ClientData clientData; /* The alias record for this alias. */ { Alias *aliasPtr; Target *targetPtr; aliasPtr = (Alias *) clientData; Tcl_DecrRefCount(aliasPtr->namePtr); Tcl_DecrRefCount(aliasPtr->prefixPtr); Tcl_DeleteHashEntry(aliasPtr->aliasEntryPtr); targetPtr = (Target *) Tcl_GetHashValue(aliasPtr->targetEntryPtr); ckfree((char *) targetPtr); Tcl_DeleteHashEntry(aliasPtr->targetEntryPtr); ckfree((char *) aliasPtr); } /* *---------------------------------------------------------------------- * * Tcl_CreateSlave -- * * Creates a slave interpreter. The slavePath argument denotes the | > > > | 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 | ((Interp *) targetInterp)->numLevels--; TclTransferResult(targetInterp, result, interp); Tcl_Release((ClientData) targetInterp); return result; } #endif /* *---------------------------------------------------------------------- * * AliasObjCmdDeleteProc -- * * Is invoked when an alias command is deleted in a slave. Cleans up * all storage associated with this alias. * * Results: * None. * * Side effects: * Deletes the alias record and its entry in the alias table for * the interpreter. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_CMDALIASES static void AliasObjCmdDeleteProc(clientData) ClientData clientData; /* The alias record for this alias. */ { Alias *aliasPtr; Target *targetPtr; aliasPtr = (Alias *) clientData; Tcl_DecrRefCount(aliasPtr->namePtr); Tcl_DecrRefCount(aliasPtr->prefixPtr); Tcl_DeleteHashEntry(aliasPtr->aliasEntryPtr); targetPtr = (Target *) Tcl_GetHashValue(aliasPtr->targetEntryPtr); ckfree((char *) targetPtr); Tcl_DeleteHashEntry(aliasPtr->targetEntryPtr); ckfree((char *) aliasPtr); } #endif /* *---------------------------------------------------------------------- * * Tcl_CreateSlave -- * * Creates a slave interpreter. The slavePath argument denotes the |
︙ | ︙ | |||
1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 | * Side effects: * Creates a new interpreter and a new interpreter object command in * the interpreter indicated by the slavePath argument. * *---------------------------------------------------------------------- */ Tcl_Interp * Tcl_CreateSlave(interp, slavePath, isSafe) Tcl_Interp *interp; /* Interpreter to start search at. */ char *slavePath; /* Name of slave to create. */ int isSafe; /* Should new slave be "safe" ? */ { Tcl_Obj *pathPtr; Tcl_Interp *slaveInterp; pathPtr = Tcl_NewStringObj(slavePath, -1); slaveInterp = SlaveCreate(interp, pathPtr, isSafe); Tcl_DecrRefCount(pathPtr); return slaveInterp; } /* *---------------------------------------------------------------------- * * Tcl_GetSlave -- * * Finds a slave interpreter by its path name. * * Results: * Returns a Tcl_Interp * for the named interpreter or NULL if not * found. * * Side effects: * None. * *---------------------------------------------------------------------- */ Tcl_Interp * Tcl_GetSlave(interp, slavePath) Tcl_Interp *interp; /* Interpreter to start search from. */ char *slavePath; /* Path of slave to find. */ { Tcl_Obj *pathPtr; Tcl_Interp *slaveInterp; pathPtr = Tcl_NewStringObj(slavePath, -1); slaveInterp = GetInterp(interp, pathPtr); Tcl_DecrRefCount(pathPtr); return slaveInterp; } /* *---------------------------------------------------------------------- * * Tcl_GetMaster -- * * Finds the master interpreter of a slave interpreter. * * Results: * Returns a Tcl_Interp * for the master interpreter or NULL if none. * * Side effects: * None. * *---------------------------------------------------------------------- */ Tcl_Interp * Tcl_GetMaster(interp) Tcl_Interp *interp; /* Get the master of this interpreter. */ { Slave *slavePtr; /* Slave record of this interpreter. */ if (interp == (Tcl_Interp *) NULL) { return NULL; } slavePtr = &((InterpInfo *) ((Interp *) interp)->interpInfo)->slave; return slavePtr->masterInterp; } /* *---------------------------------------------------------------------- * * Tcl_GetInterpPath -- * * Sets the result of the asking interpreter to a proper Tcl list | > > > > > > | 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 | * Side effects: * Creates a new interpreter and a new interpreter object command in * the interpreter indicated by the slavePath argument. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_SLAVEINTERP Tcl_Interp * Tcl_CreateSlave(interp, slavePath, isSafe) Tcl_Interp *interp; /* Interpreter to start search at. */ char *slavePath; /* Name of slave to create. */ int isSafe; /* Should new slave be "safe" ? */ { Tcl_Obj *pathPtr; Tcl_Interp *slaveInterp; pathPtr = Tcl_NewStringObj(slavePath, -1); slaveInterp = SlaveCreate(interp, pathPtr, isSafe); Tcl_DecrRefCount(pathPtr); return slaveInterp; } #endif /* *---------------------------------------------------------------------- * * Tcl_GetSlave -- * * Finds a slave interpreter by its path name. * * Results: * Returns a Tcl_Interp * for the named interpreter or NULL if not * found. * * Side effects: * None. * *---------------------------------------------------------------------- */ #if !(defined(TCL_NO_SLAVEINTERP) && defined(TCL_NO_CMDALIASES)) Tcl_Interp * Tcl_GetSlave(interp, slavePath) Tcl_Interp *interp; /* Interpreter to start search from. */ char *slavePath; /* Path of slave to find. */ { Tcl_Obj *pathPtr; Tcl_Interp *slaveInterp; pathPtr = Tcl_NewStringObj(slavePath, -1); slaveInterp = GetInterp(interp, pathPtr); Tcl_DecrRefCount(pathPtr); return slaveInterp; } #endif /* !(defined(TCL_NO_SLAVEINTERP) && defined(TCL_NO_CMDALIASES)) */ /* *---------------------------------------------------------------------- * * Tcl_GetMaster -- * * Finds the master interpreter of a slave interpreter. * * Results: * Returns a Tcl_Interp * for the master interpreter or NULL if none. * * Side effects: * None. * *---------------------------------------------------------------------- */ #if !(defined(TCL_NO_SLAVEINTERP) && defined(TCL_NO_CMDALIASES)) Tcl_Interp * Tcl_GetMaster(interp) Tcl_Interp *interp; /* Get the master of this interpreter. */ { Slave *slavePtr; /* Slave record of this interpreter. */ if (interp == (Tcl_Interp *) NULL) { return NULL; } slavePtr = &((InterpInfo *) ((Interp *) interp)->interpInfo)->slave; return slavePtr->masterInterp; } #endif /* !(defined(TCL_NO_SLAVEINTERP) && defined(TCL_NO_CMDALIASES)) */ /* *---------------------------------------------------------------------- * * Tcl_GetInterpPath -- * * Sets the result of the asking interpreter to a proper Tcl list |
︙ | ︙ | |||
1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 | * * Side effects: * None. * *---------------------------------------------------------------------- */ int Tcl_GetInterpPath(askingInterp, targetInterp) Tcl_Interp *askingInterp; /* Interpreter to start search from. */ Tcl_Interp *targetInterp; /* Interpreter to find. */ { InterpInfo *iiPtr; | > | 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 | * * Side effects: * None. * *---------------------------------------------------------------------- */ #if !(defined(TCL_NO_SLAVEINTERP) && defined(TCL_NO_CMDALIASES)) int Tcl_GetInterpPath(askingInterp, targetInterp) Tcl_Interp *askingInterp; /* Interpreter to start search from. */ Tcl_Interp *targetInterp; /* Interpreter to find. */ { InterpInfo *iiPtr; |
︙ | ︙ | |||
1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 | return TCL_ERROR; } Tcl_AppendElement(askingInterp, Tcl_GetHashKey(&iiPtr->master.slaveTable, iiPtr->slave.slaveEntryPtr)); return TCL_OK; } /* *---------------------------------------------------------------------- * * GetInterp -- * * Helper function to find a slave interpreter given a pathname. * * Results: * Returns the slave interpreter known by that name in the calling * interpreter, or NULL if no interpreter known by that name exists. * * Side effects: * Assigns to the pointer variable passed in, if not NULL. * *---------------------------------------------------------------------- */ static Tcl_Interp * GetInterp(interp, pathPtr) Tcl_Interp *interp; /* Interp. to start search from. */ Tcl_Obj *pathPtr; /* List object containing name of interp. to * be found. */ { Tcl_HashEntry *hPtr; /* Search element. */ | > > | 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 | return TCL_ERROR; } Tcl_AppendElement(askingInterp, Tcl_GetHashKey(&iiPtr->master.slaveTable, iiPtr->slave.slaveEntryPtr)); return TCL_OK; } #endif /* !(defined(TCL_NO_SLAVEINTERP) && defined(TCL_NO_CMDALIASES)) */ /* *---------------------------------------------------------------------- * * GetInterp -- * * Helper function to find a slave interpreter given a pathname. * * Results: * Returns the slave interpreter known by that name in the calling * interpreter, or NULL if no interpreter known by that name exists. * * Side effects: * Assigns to the pointer variable passed in, if not NULL. * *---------------------------------------------------------------------- */ #if !(defined(TCL_NO_SLAVEINTERP) && defined(TCL_NO_CMDALIASES)) static Tcl_Interp * GetInterp(interp, pathPtr) Tcl_Interp *interp; /* Interp. to start search from. */ Tcl_Obj *pathPtr; /* List object containing name of interp. to * be found. */ { Tcl_HashEntry *hPtr; /* Search element. */ |
︙ | ︙ | |||
1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 | if (searchInterp == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "could not find interpreter \"", Tcl_GetString(pathPtr), "\"", (char *) NULL); } return searchInterp; } /* *---------------------------------------------------------------------- * * SlaveCreate -- * * Helper function to do the actual work of creating a slave interp * and new object command. Also optionally makes the new slave * interpreter "safe". * * Results: * Returns the new Tcl_Interp * if successful or NULL if not. If failed, * the result of the invoking interpreter contains an error message. * * Side effects: * Creates a new slave interpreter and a new object command. * *---------------------------------------------------------------------- */ static Tcl_Interp * SlaveCreate(interp, pathPtr, safe) Tcl_Interp *interp; /* Interp. to start search from. */ Tcl_Obj *pathPtr; /* Path (name) of slave to create. */ int safe; /* Should we make it "safe"? */ { Tcl_Interp *masterInterp, *slaveInterp; | > > | 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 | if (searchInterp == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "could not find interpreter \"", Tcl_GetString(pathPtr), "\"", (char *) NULL); } return searchInterp; } #endif /* !(defined(TCL_NO_SLAVEINTERP) && defined(TCL_NO_CMDALIASES)) */ /* *---------------------------------------------------------------------- * * SlaveCreate -- * * Helper function to do the actual work of creating a slave interp * and new object command. Also optionally makes the new slave * interpreter "safe". * * Results: * Returns the new Tcl_Interp * if successful or NULL if not. If failed, * the result of the invoking interpreter contains an error message. * * Side effects: * Creates a new slave interpreter and a new object command. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_SLAVEINTERP static Tcl_Interp * SlaveCreate(interp, pathPtr, safe) Tcl_Interp *interp; /* Interp. to start search from. */ Tcl_Obj *pathPtr; /* Path (name) of slave to create. */ int safe; /* Should we make it "safe"? */ { Tcl_Interp *masterInterp, *slaveInterp; |
︙ | ︙ | |||
1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 | error: TclTransferResult(slaveInterp, TCL_ERROR, interp); Tcl_DeleteInterp(slaveInterp); return NULL; } /* *---------------------------------------------------------------------- * * SlaveObjCmd -- * * Command to manipulate an interpreter, e.g. to send commands to it * to be evaluated. One such command exists for each slave interpreter. * * Results: * A standard Tcl result. * * Side effects: * See user documentation for details. * *---------------------------------------------------------------------- */ static int SlaveObjCmd(clientData, interp, objc, objv) ClientData clientData; /* Slave interpreter. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ { Tcl_Interp *slaveInterp; int index; static char *options[] = { | > > > | > > > | > > > > | 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 | error: TclTransferResult(slaveInterp, TCL_ERROR, interp); Tcl_DeleteInterp(slaveInterp); return NULL; } #endif /* *---------------------------------------------------------------------- * * SlaveObjCmd -- * * Command to manipulate an interpreter, e.g. to send commands to it * to be evaluated. One such command exists for each slave interpreter. * * Results: * A standard Tcl result. * * Side effects: * See user documentation for details. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_SLAVEINTERP static int SlaveObjCmd(clientData, interp, objc, objv) ClientData clientData; /* Slave interpreter. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ { Tcl_Interp *slaveInterp; int index; static char *options[] = { #ifndef TCL_NO_CMDALIASES "alias", "aliases", #endif "eval", "expose", "hide", "hidden", "issafe", "invokehidden", "marktrusted", NULL }; enum options { #ifndef TCL_NO_CMDALIASES OPT_ALIAS, OPT_ALIASES, #endif OPT_EVAL, OPT_EXPOSE, OPT_HIDE, OPT_HIDDEN, OPT_ISSAFE, OPT_INVOKEHIDDEN, OPT_MARKTRUSTED }; slaveInterp = (Tcl_Interp *) clientData; if (slaveInterp == NULL) { panic("SlaveObjCmd: interpreter has been deleted"); } if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "cmd ?arg ...?"); return TCL_ERROR; } if (Tcl_GetIndexFromObj(interp, objv[1], options, "option", 0, &index) != TCL_OK) { return TCL_ERROR; } switch ((enum options) index) { #ifndef TCL_NO_CMDALIASES case OPT_ALIAS: { if (objc == 3) { return AliasDescribe(interp, slaveInterp, objv[2]); } if (Tcl_GetString(objv[3])[0] == '\0') { if (objc == 4) { return AliasDelete(interp, slaveInterp, objv[2]); } } else { return AliasCreate(interp, slaveInterp, interp, objv[2], objv[3], objc - 4, objv + 4); } Tcl_WrongNumArgs(interp, 2, objv, "aliasName ?targetName? ?args..?"); return TCL_ERROR; } case OPT_ALIASES: { return AliasList(interp, slaveInterp); } #endif case OPT_EVAL: { if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "arg ?arg ...?"); return TCL_ERROR; } return SlaveEval(interp, slaveInterp, objc - 2, objv + 2); } |
︙ | ︙ | |||
1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 | } return SlaveMarkTrusted(interp, slaveInterp); } } return TCL_ERROR; } /* *---------------------------------------------------------------------- * * SlaveObjCmdDeleteProc -- * * Invoked when an object command for a slave interpreter is deleted; * cleans up all state associated with the slave interpreter and destroys * the slave interpreter. * * Results: * None. * * Side effects: * Cleans up all state associated with the slave interpreter and * destroys the slave interpreter. * *---------------------------------------------------------------------- */ static void SlaveObjCmdDeleteProc(clientData) ClientData clientData; /* The SlaveRecord for the command. */ { Slave *slavePtr; /* Interim storage for Slave record. */ Tcl_Interp *slaveInterp; /* And for a slave interp. */ | > > | 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 | } return SlaveMarkTrusted(interp, slaveInterp); } } return TCL_ERROR; } #endif /* *---------------------------------------------------------------------- * * SlaveObjCmdDeleteProc -- * * Invoked when an object command for a slave interpreter is deleted; * cleans up all state associated with the slave interpreter and destroys * the slave interpreter. * * Results: * None. * * Side effects: * Cleans up all state associated with the slave interpreter and * destroys the slave interpreter. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_SLAVEINTERP static void SlaveObjCmdDeleteProc(clientData) ClientData clientData; /* The SlaveRecord for the command. */ { Slave *slavePtr; /* Interim storage for Slave record. */ Tcl_Interp *slaveInterp; /* And for a slave interp. */ |
︙ | ︙ | |||
1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 | slavePtr->interpCmd = NULL; if (slavePtr->slaveInterp != NULL) { Tcl_DeleteInterp(slavePtr->slaveInterp); } } /* *---------------------------------------------------------------------- * * SlaveEval -- * * Helper function to evaluate a command in a slave interpreter. * * Results: * A standard Tcl result. * * Side effects: * Whatever the command does. * *---------------------------------------------------------------------- */ static int SlaveEval(interp, slaveInterp, objc, objv) Tcl_Interp *interp; /* Interp for error return. */ Tcl_Interp *slaveInterp; /* The slave interpreter in which command * will be evaluated. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ | > > | 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 | slavePtr->interpCmd = NULL; if (slavePtr->slaveInterp != NULL) { Tcl_DeleteInterp(slavePtr->slaveInterp); } } #endif /* *---------------------------------------------------------------------- * * SlaveEval -- * * Helper function to evaluate a command in a slave interpreter. * * Results: * A standard Tcl result. * * Side effects: * Whatever the command does. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_SLAVEINTERP static int SlaveEval(interp, slaveInterp, objc, objv) Tcl_Interp *interp; /* Interp for error return. */ Tcl_Interp *slaveInterp; /* The slave interpreter in which command * will be evaluated. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ |
︙ | ︙ | |||
2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 | Tcl_DecrRefCount(objPtr); } TclTransferResult(slaveInterp, result, interp); Tcl_Release((ClientData) slaveInterp); return result; } /* *---------------------------------------------------------------------- * * SlaveExpose -- * * Helper function to expose a command in a slave interpreter. * * Results: * A standard Tcl result. * * Side effects: * After this call scripts in the slave will be able to invoke * the newly exposed command. * *---------------------------------------------------------------------- */ static int SlaveExpose(interp, slaveInterp, objc, objv) Tcl_Interp *interp; /* Interp for error return. */ Tcl_Interp *slaveInterp; /* Interp in which command will be exposed. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument strings. */ { | > > | 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 | Tcl_DecrRefCount(objPtr); } TclTransferResult(slaveInterp, result, interp); Tcl_Release((ClientData) slaveInterp); return result; } #endif /* *---------------------------------------------------------------------- * * SlaveExpose -- * * Helper function to expose a command in a slave interpreter. * * Results: * A standard Tcl result. * * Side effects: * After this call scripts in the slave will be able to invoke * the newly exposed command. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_SLAVEINTERP static int SlaveExpose(interp, slaveInterp, objc, objv) Tcl_Interp *interp; /* Interp for error return. */ Tcl_Interp *slaveInterp; /* Interp in which command will be exposed. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument strings. */ { |
︙ | ︙ | |||
2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 | if (Tcl_ExposeCommand(slaveInterp, Tcl_GetString(objv[0]), name) != TCL_OK) { TclTransferResult(slaveInterp, TCL_ERROR, interp); return TCL_ERROR; } return TCL_OK; } /* *---------------------------------------------------------------------- * * SlaveHide -- * * Helper function to hide a command in a slave interpreter. * * Results: * A standard Tcl result. * * Side effects: * After this call scripts in the slave will no longer be able * to invoke the named command. * *---------------------------------------------------------------------- */ static int SlaveHide(interp, slaveInterp, objc, objv) Tcl_Interp *interp; /* Interp for error return. */ Tcl_Interp *slaveInterp; /* Interp in which command will be exposed. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument strings. */ { | > > | 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 | if (Tcl_ExposeCommand(slaveInterp, Tcl_GetString(objv[0]), name) != TCL_OK) { TclTransferResult(slaveInterp, TCL_ERROR, interp); return TCL_ERROR; } return TCL_OK; } #endif /* *---------------------------------------------------------------------- * * SlaveHide -- * * Helper function to hide a command in a slave interpreter. * * Results: * A standard Tcl result. * * Side effects: * After this call scripts in the slave will no longer be able * to invoke the named command. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_SLAVEINTERP static int SlaveHide(interp, slaveInterp, objc, objv) Tcl_Interp *interp; /* Interp for error return. */ Tcl_Interp *slaveInterp; /* Interp in which command will be exposed. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument strings. */ { |
︙ | ︙ | |||
2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 | if (Tcl_HideCommand(slaveInterp, Tcl_GetString(objv[0]), name) != TCL_OK) { TclTransferResult(slaveInterp, TCL_ERROR, interp); return TCL_ERROR; } return TCL_OK; } /* *---------------------------------------------------------------------- * * SlaveHidden -- * * Helper function to compute list of hidden commands in a slave * interpreter. * * Results: * A standard Tcl result. * * Side effects: * None. * *---------------------------------------------------------------------- */ static int SlaveHidden(interp, slaveInterp) Tcl_Interp *interp; /* Interp for data return. */ Tcl_Interp *slaveInterp; /* Interp whose hidden commands to query. */ { Tcl_Obj *listObjPtr; /* Local object pointer. */ Tcl_HashTable *hTblPtr; /* For local searches. */ | > > | 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 | if (Tcl_HideCommand(slaveInterp, Tcl_GetString(objv[0]), name) != TCL_OK) { TclTransferResult(slaveInterp, TCL_ERROR, interp); return TCL_ERROR; } return TCL_OK; } #endif /* *---------------------------------------------------------------------- * * SlaveHidden -- * * Helper function to compute list of hidden commands in a slave * interpreter. * * Results: * A standard Tcl result. * * Side effects: * None. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_SLAVEINTERP static int SlaveHidden(interp, slaveInterp) Tcl_Interp *interp; /* Interp for data return. */ Tcl_Interp *slaveInterp; /* Interp whose hidden commands to query. */ { Tcl_Obj *listObjPtr; /* Local object pointer. */ Tcl_HashTable *hTblPtr; /* For local searches. */ |
︙ | ︙ | |||
2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 | Tcl_ListObjAppendElement(NULL, listObjPtr, Tcl_NewStringObj(Tcl_GetHashKey(hTblPtr, hPtr), -1)); } } return TCL_OK; } /* *---------------------------------------------------------------------- * * SlaveInvokeHidden -- * * Helper function to invoke a hidden command in a slave interpreter. * * Results: * A standard Tcl result. * * Side effects: * Whatever the hidden command does. * *---------------------------------------------------------------------- */ static int SlaveInvokeHidden(interp, slaveInterp, global, objc, objv) Tcl_Interp *interp; /* Interp for error return. */ Tcl_Interp *slaveInterp; /* The slave interpreter in which command * will be invoked. */ int global; /* Non-zero to invoke in global namespace. */ int objc; /* Number of arguments. */ | > > | 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 | Tcl_ListObjAppendElement(NULL, listObjPtr, Tcl_NewStringObj(Tcl_GetHashKey(hTblPtr, hPtr), -1)); } } return TCL_OK; } #endif /* *---------------------------------------------------------------------- * * SlaveInvokeHidden -- * * Helper function to invoke a hidden command in a slave interpreter. * * Results: * A standard Tcl result. * * Side effects: * Whatever the hidden command does. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_SLAVEINTERP static int SlaveInvokeHidden(interp, slaveInterp, global, objc, objv) Tcl_Interp *interp; /* Interp for error return. */ Tcl_Interp *slaveInterp; /* The slave interpreter in which command * will be invoked. */ int global; /* Non-zero to invoke in global namespace. */ int objc; /* Number of arguments. */ |
︙ | ︙ | |||
2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 | } TclTransferResult(slaveInterp, result, interp); Tcl_Release((ClientData) slaveInterp); return result; } /* *---------------------------------------------------------------------- * * SlaveMarkTrusted -- * * Helper function to mark a slave interpreter as trusted (unsafe). * * Results: * A standard Tcl result. * * Side effects: * After this call the hard-wired security checks in the core no * longer prevent the slave from performing certain operations. * *---------------------------------------------------------------------- */ static int SlaveMarkTrusted(interp, slaveInterp) Tcl_Interp *interp; /* Interp for error return. */ Tcl_Interp *slaveInterp; /* The slave interpreter which will be * marked trusted. */ { if (Tcl_IsSafe(interp)) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "permission denied: safe interpreter cannot mark trusted", (char *) NULL); return TCL_ERROR; } ((Interp *) slaveInterp)->flags &= ~SAFE_INTERP; return TCL_OK; } /* *---------------------------------------------------------------------- * * Tcl_IsSafe -- * * Determines whether an interpreter is safe | > > > | 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 | } TclTransferResult(slaveInterp, result, interp); Tcl_Release((ClientData) slaveInterp); return result; } #endif /* *---------------------------------------------------------------------- * * SlaveMarkTrusted -- * * Helper function to mark a slave interpreter as trusted (unsafe). * * Results: * A standard Tcl result. * * Side effects: * After this call the hard-wired security checks in the core no * longer prevent the slave from performing certain operations. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_SLAVEINTERP static int SlaveMarkTrusted(interp, slaveInterp) Tcl_Interp *interp; /* Interp for error return. */ Tcl_Interp *slaveInterp; /* The slave interpreter which will be * marked trusted. */ { if (Tcl_IsSafe(interp)) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "permission denied: safe interpreter cannot mark trusted", (char *) NULL); return TCL_ERROR; } ((Interp *) slaveInterp)->flags &= ~SAFE_INTERP; return TCL_OK; } #endif /* *---------------------------------------------------------------------- * * Tcl_IsSafe -- * * Determines whether an interpreter is safe |
︙ | ︙ | |||
2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 | * (the only one remaining is [info nameofexecutable]) */ Tcl_UnsetVar(interp, "tclDefaultLibrary", TCL_GLOBAL_ONLY); Tcl_UnsetVar(interp, "tcl_library", TCL_GLOBAL_ONLY); Tcl_UnsetVar(interp, "tcl_pkgPath", TCL_GLOBAL_ONLY); /* * Remove the standard channels from the interpreter; safe interpreters * do not ordinarily have access to stdin, stdout and stderr. * * NOTE: These channels are not added to the interpreter by the * Tcl_CreateInterp call, but may be added later, by another I/O * operation. We want to ensure that the interpreter does not have | > > > > > > > | 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 | * (the only one remaining is [info nameofexecutable]) */ Tcl_UnsetVar(interp, "tclDefaultLibrary", TCL_GLOBAL_ONLY); Tcl_UnsetVar(interp, "tcl_library", TCL_GLOBAL_ONLY); Tcl_UnsetVar(interp, "tcl_pkgPath", TCL_GLOBAL_ONLY); #ifdef TCL_NO_NONSTDCHAN /* IOS FIXME: Unregister is still required to make sub interpreters safe by * removing the std* channels from them. * This means that removal of sub interp fucntionality allows the removal of this * functionality too. */ #endif /* * Remove the standard channels from the interpreter; safe interpreters * do not ordinarily have access to stdin, stdout and stderr. * * NOTE: These channels are not added to the interpreter by the * Tcl_CreateInterp call, but may be added later, by another I/O * operation. We want to ensure that the interpreter does not have |
︙ | ︙ |
Changes to generic/tclLoad.c.
1 2 3 4 5 6 7 8 9 10 11 | /* * tclLoad.c -- * * This file provides the generic portion (those that are the same * on all platforms) of Tcl's dynamic loading facilities. * * Copyright (c) 1995-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. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* * tclLoad.c -- * * This file provides the generic portion (those that are the same * on all platforms) of Tcl's dynamic loading facilities. * * Copyright (c) 1995-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: tclLoad.c,v 1.4.12.1 2001/11/28 17:58:37 andreas_kupries Exp $ */ #include "tclInt.h" /* * The following structure describes a package that has been loaded * either dynamically (with the "load" command) or statically (as |
︙ | ︙ | |||
100 101 102 103 104 105 106 107 108 109 110 111 112 113 | * * Side effects: * See the user documentation. * *---------------------------------------------------------------------- */ int Tcl_LoadObjCmd(dummy, interp, objc, objv) ClientData dummy; /* Not used. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ { | > > | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | * * Side effects: * See the user documentation. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM #ifndef TCL_NO_LOADCMD int Tcl_LoadObjCmd(dummy, interp, objc, objv) ClientData dummy; /* Not used. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ { |
︙ | ︙ | |||
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | } /* * Figure out which interpreter we're going to load the package into. */ target = interp; if (objc == 4) { char *slaveIntName; slaveIntName = Tcl_GetString(objv[3]); target = Tcl_GetSlave(interp, slaveIntName); if (target == NULL) { return TCL_ERROR; } } /* * Scan through the packages that are currently loaded to see if the * package we want is already loaded. We'll use a loaded package if * it meets any of the following conditions: * - Its name and file match the once we're looking for. * - Its file matches, and we weren't given a name. | > > | 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | } /* * Figure out which interpreter we're going to load the package into. */ target = interp; #ifndef TCL_NO_SLAVEINTERP if (objc == 4) { char *slaveIntName; slaveIntName = Tcl_GetString(objv[3]); target = Tcl_GetSlave(interp, slaveIntName); if (target == NULL) { return TCL_ERROR; } } #endif /* * Scan through the packages that are currently loaded to see if the * package we want is already loaded. We'll use a loaded package if * it meets any of the following conditions: * - Its name and file match the once we're looking for. * - Its file matches, and we weren't given a name. |
︙ | ︙ | |||
410 411 412 413 414 415 416 417 418 419 420 421 422 423 | Tcl_DStringFree(&pkgName); Tcl_DStringFree(&initName); Tcl_DStringFree(&safeInitName); Tcl_DStringFree(&fileName); Tcl_DStringFree(&tmp); return code; } /* *---------------------------------------------------------------------- * * Tcl_StaticPackage -- * * This procedure is invoked to indicate that a particular | > > | 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 | Tcl_DStringFree(&pkgName); Tcl_DStringFree(&initName); Tcl_DStringFree(&safeInitName); Tcl_DStringFree(&fileName); Tcl_DStringFree(&tmp); return code; } #endif #endif /* *---------------------------------------------------------------------- * * Tcl_StaticPackage -- * * This procedure is invoked to indicate that a particular |
︙ | ︙ | |||
525 526 527 528 529 530 531 | Tcl_Interp *interp; /* Interpreter in which to return * information or error message. */ char *targetName; /* Name of target interpreter or NULL. * If NULL, return info about all interps; * otherwise, just return info about this * interpreter. */ { | < > > > | 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 | Tcl_Interp *interp; /* Interpreter in which to return * information or error message. */ char *targetName; /* Name of target interpreter or NULL. * If NULL, return info about all interps; * otherwise, just return info about this * interpreter. */ { LoadedPackage *pkgPtr; #ifndef TCL_NO_SLAVEINTERP Tcl_Interp *target; InterpPackage *ipPtr; #endif char *prefix; if (targetName == NULL) { /* * Return information about all of the available packages. */ |
︙ | ︙ | |||
549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 | Tcl_AppendResult(interp, "}", (char *) NULL); prefix = " {"; } Tcl_MutexUnlock(&packageMutex); return TCL_OK; } /* * Return information about only the packages that are loaded in * a given interpreter. */ target = Tcl_GetSlave(interp, targetName); if (target == NULL) { return TCL_ERROR; } ipPtr = (InterpPackage *) Tcl_GetAssocData(target, "tclLoad", (Tcl_InterpDeleteProc **) NULL); prefix = "{"; for ( ; ipPtr != NULL; ipPtr = ipPtr->nextPtr) { pkgPtr = ipPtr->pkgPtr; Tcl_AppendResult(interp, prefix, (char *) NULL); Tcl_AppendElement(interp, pkgPtr->fileName); Tcl_AppendElement(interp, pkgPtr->packageName); Tcl_AppendResult(interp, "}", (char *) NULL); prefix = " {"; } return TCL_OK; } /* *---------------------------------------------------------------------- * * LoadCleanupProc -- * | > > > > | 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 | Tcl_AppendResult(interp, "}", (char *) NULL); prefix = " {"; } Tcl_MutexUnlock(&packageMutex); return TCL_OK; } #ifndef TCL_NO_SLAVEINTERP /* * Return information about only the packages that are loaded in * a given interpreter. */ target = Tcl_GetSlave(interp, targetName); if (target == NULL) { #endif return TCL_ERROR; #ifndef TCL_NO_SLAVEINTERP } ipPtr = (InterpPackage *) Tcl_GetAssocData(target, "tclLoad", (Tcl_InterpDeleteProc **) NULL); prefix = "{"; for ( ; ipPtr != NULL; ipPtr = ipPtr->nextPtr) { pkgPtr = ipPtr->pkgPtr; Tcl_AppendResult(interp, prefix, (char *) NULL); Tcl_AppendElement(interp, pkgPtr->fileName); Tcl_AppendElement(interp, pkgPtr->packageName); Tcl_AppendResult(interp, "}", (char *) NULL); prefix = " {"; } return TCL_OK; #endif } /* *---------------------------------------------------------------------- * * LoadCleanupProc -- * |
︙ | ︙ |
Changes to generic/tclLoadNone.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * tclLoadNone.c -- * * This procedure provides a version of the TclLoadFile for use * in systems that don't support dynamic loading; it just returns * an error. * * Copyright (c) 1995-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. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /* * tclLoadNone.c -- * * This procedure provides a version of the TclLoadFile for use * in systems that don't support dynamic loading; it just returns * an error. * * Copyright (c) 1995-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: tclLoadNone.c,v 1.4.22.1 2001/11/28 17:58:37 andreas_kupries Exp $ */ #include "tclInt.h" /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | * * Side effects: * None. * *---------------------------------------------------------------------- */ int TclpLoadFile(interp, fileName, sym1, sym2, proc1Ptr, proc2Ptr, clientDataPtr) Tcl_Interp *interp; /* Used for error reporting. */ char *fileName; /* Name of the file containing the desired * code. */ char *sym1, *sym2; /* Names of two procedures to look up in * the file's symbol table. */ Tcl_PackageInitProc **proc1Ptr, **proc2Ptr; /* Where to return the addresses corresponding * to sym1 and sym2. */ ClientData *clientDataPtr; /* Filled with token for dynamically loaded * file which will be passed back to * TclpUnloadFile() to unload the file. */ { Tcl_SetResult(interp, "dynamic loading is not currently available on this system", TCL_STATIC); return TCL_ERROR; } /* *---------------------------------------------------------------------- * * TclGuessPackageName -- * * If the "load" command is invoked without providing a package | > > | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | * * Side effects: * None. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_LOADCMD int TclpLoadFile(interp, fileName, sym1, sym2, proc1Ptr, proc2Ptr, clientDataPtr) Tcl_Interp *interp; /* Used for error reporting. */ char *fileName; /* Name of the file containing the desired * code. */ char *sym1, *sym2; /* Names of two procedures to look up in * the file's symbol table. */ Tcl_PackageInitProc **proc1Ptr, **proc2Ptr; /* Where to return the addresses corresponding * to sym1 and sym2. */ ClientData *clientDataPtr; /* Filled with token for dynamically loaded * file which will be passed back to * TclpUnloadFile() to unload the file. */ { Tcl_SetResult(interp, "dynamic loading is not currently available on this system", TCL_STATIC); return TCL_ERROR; } #endif /* *---------------------------------------------------------------------- * * TclGuessPackageName -- * * If the "load" command is invoked without providing a package |
︙ | ︙ | |||
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | * * Side effects: * None. * *---------------------------------------------------------------------- */ void TclpUnloadFile(clientData) ClientData clientData; /* ClientData returned by a previous call * to TclpLoadFile(). The clientData is * a token that represents the loaded * file. */ { } | > > | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | * * Side effects: * None. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_LOADCMD void TclpUnloadFile(clientData) ClientData clientData; /* ClientData returned by a previous call * to TclpLoadFile(). The clientData is * a token that represents the loaded * file. */ { } #endif |
Changes to generic/tclMain.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * tclMain.c -- * * Main program for Tcl shells and other Tcl-based applications. * * Copyright (c) 1988-1994 The Regents of the University of California. * Copyright (c) 1994-1997 Sun Microsystems, Inc. * Copyright (c) 2000 Ajuba Solutions. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /* * tclMain.c -- * * Main program for Tcl shells and other Tcl-based applications. * * Copyright (c) 1988-1994 The Regents of the University of California. * Copyright (c) 1994-1997 Sun Microsystems, Inc. * Copyright (c) 2000 Ajuba Solutions. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclMain.c,v 1.7.2.2.2.1 2001/11/28 17:58:37 andreas_kupries Exp $ */ #include "tcl.h" #include "tclInt.h" # undef TCL_STORAGE_CLASS # define TCL_STORAGE_CLASS DLLEXPORT |
︙ | ︙ | |||
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | Tcl_ThreadDataKey dataKey; /* * Forward declarations for procedures defined later in this file. */ static void Prompt _ANSI_ARGS_((Tcl_Interp *interp, int partial)); static void StdinProc _ANSI_ARGS_((ClientData clientData, int mask)); /* *---------------------------------------------------------------------- * * TclSetStartupScriptFileName -- * | > > | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | Tcl_ThreadDataKey dataKey; /* * Forward declarations for procedures defined later in this file. */ static void Prompt _ANSI_ARGS_((Tcl_Interp *interp, int partial)); #ifndef TCL_NO_FILEEVENTS static void StdinProc _ANSI_ARGS_((ClientData clientData, int mask)); #endif /* *---------------------------------------------------------------------- * * TclSetStartupScriptFileName -- * |
︙ | ︙ | |||
214 215 216 217 218 219 220 221 222 223 224 225 226 227 | Tcl_WriteChars(errChannel, "application-specific initialization failed: ", -1); Tcl_WriteObj(errChannel, Tcl_GetObjResult(interp)); Tcl_WriteChars(errChannel, "\n", 1); } } /* * If a script file was specified then just source that file * and quit. */ if (tclStartupScriptFileName != NULL) { code = Tcl_EvalFile(interp, tclStartupScriptFileName); | > > > | 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | Tcl_WriteChars(errChannel, "application-specific initialization failed: ", -1); Tcl_WriteObj(errChannel, Tcl_GetObjResult(interp)); Tcl_WriteChars(errChannel, "\n", 1); } } #ifndef TCL_NO_FILESYSTEM #ifndef TCL_NO_NONSTDCHAN /* IOS FIXME : See Tcl_EvalFile */ /* * If a script file was specified then just source that file * and quit. */ if (tclStartupScriptFileName != NULL) { code = Tcl_EvalFile(interp, tclStartupScriptFileName); |
︙ | ︙ | |||
238 239 240 241 242 243 244 245 246 247 248 249 250 251 | NULL, TCL_GLOBAL_ONLY)); Tcl_WriteChars(errChannel, "\n", 1); } exitCode = 1; } goto done; } Tcl_DStringFree(&argString); /* * We're running interactively. Source a user-specific startup * file if the application specified one and if the file exists. */ | > > | 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | NULL, TCL_GLOBAL_ONLY)); Tcl_WriteChars(errChannel, "\n", 1); } exitCode = 1; } goto done; } #endif #endif Tcl_DStringFree(&argString); /* * We're running interactively. Source a user-specific startup * file if the application specified one and if the file exists. */ |
︙ | ︙ | |||
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 | if (mainLoopProc != NULL) { /* * If a main loop has been defined while running interactively, * we want to start a fileevent based prompt by establishing a * channel handler for stdin. */ if (inChannel) { Tcl_CreateChannelHandler(inChannel, TCL_READABLE, StdinProc, (ClientData) inChannel); } if (tsdPtr->tty) { Prompt(interp, 0); } Tcl_DStringInit(&tsdPtr->command); Tcl_DStringInit(&tsdPtr->line); (*mainLoopProc)(); | > > | 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | if (mainLoopProc != NULL) { /* * If a main loop has been defined while running interactively, * we want to start a fileevent based prompt by establishing a * channel handler for stdin. */ #ifndef TCL_NO_FILEEVENTS if (inChannel) { Tcl_CreateChannelHandler(inChannel, TCL_READABLE, StdinProc, (ClientData) inChannel); } #endif if (tsdPtr->tty) { Prompt(interp, 0); } Tcl_DStringInit(&tsdPtr->command); Tcl_DStringInit(&tsdPtr->line); (*mainLoopProc)(); |
︙ | ︙ | |||
430 431 432 433 434 435 436 437 438 439 440 441 442 443 | * Side effects: * Could be almost arbitrary, depending on the command that's * typed. * *---------------------------------------------------------------------- */ /* ARGSUSED */ static void StdinProc(clientData, mask) ClientData clientData; /* Not used. */ int mask; /* Not used. */ { static int gotPartial = 0; | > | 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 | * Side effects: * Could be almost arbitrary, depending on the command that's * typed. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILEEVENTS /* ARGSUSED */ static void StdinProc(clientData, mask) ClientData clientData; /* Not used. */ int mask; /* Not used. */ { static int gotPartial = 0; |
︙ | ︙ | |||
504 505 506 507 508 509 510 511 512 513 514 515 516 517 | prompt: if (tsdPtr->tty) { Prompt(interp, gotPartial); } Tcl_ResetResult(interp); } /* *---------------------------------------------------------------------- * * Prompt -- * * Issue a prompt on standard output, or invoke a script | > | 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 | prompt: if (tsdPtr->tty) { Prompt(interp, gotPartial); } Tcl_ResetResult(interp); } #endif /* *---------------------------------------------------------------------- * * Prompt -- * * Issue a prompt on standard output, or invoke a script |
︙ | ︙ |
Changes to generic/tclPipe.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * tclPipe.c -- * * This file contains the generic portion of the command channel * driver as well as various utility routines used in managing * subprocesses. * * Copyright (c) 1997 by Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | /* * tclPipe.c -- * * This file contains the generic portion of the command channel * driver as well as various utility routines used in managing * subprocesses. * * Copyright (c) 1997 by 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: tclPipe.c,v 1.3.30.1 2001/11/28 17:58:37 andreas_kupries Exp $ */ #include "tclInt.h" #include "tclPort.h" #ifndef TCL_NO_PIPES /* * A linked list of the following structures is used to keep track * of child processes that have been detached but haven't exited * yet, so we can make sure that they're properly "reaped" (officially * waited for) and don't lie around as zombies cluttering the * system. */ |
︙ | ︙ | |||
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | static Detached *detList = NULL; /* List of all detached proceses. */ TCL_DECLARE_MUTEX(pipeMutex) /* Guard access to detList. */ /* * Declarations for local procedures defined in this file: */ static TclFile FileForRedirect _ANSI_ARGS_((Tcl_Interp *interp, char *spec, int atOk, char *arg, char *nextArg, int flags, int *skipPtr, int *closePtr, int *releasePtr)); /* *---------------------------------------------------------------------- * * FileForRedirect -- * * This procedure does much of the work of parsing redirection | > > | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | static Detached *detList = NULL; /* List of all detached proceses. */ TCL_DECLARE_MUTEX(pipeMutex) /* Guard access to detList. */ /* * Declarations for local procedures defined in this file: */ #ifndef TCL_NO_FILESYSTEM static TclFile FileForRedirect _ANSI_ARGS_((Tcl_Interp *interp, char *spec, int atOk, char *arg, char *nextArg, int flags, int *skipPtr, int *closePtr, int *releasePtr)); #endif /* *---------------------------------------------------------------------- * * FileForRedirect -- * * This procedure does much of the work of parsing redirection |
︙ | ︙ | |||
59 60 61 62 63 64 65 66 67 68 69 70 71 72 | * * Side effects: * None. * *---------------------------------------------------------------------- */ static TclFile FileForRedirect(interp, spec, atOK, arg, nextArg, flags, skipPtr, closePtr, releasePtr) Tcl_Interp *interp; /* Intepreter to use for error reporting. */ char *spec; /* Points to character just after * redirection character. */ char *arg; /* Pointer to entire argument containing | > | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | * * Side effects: * None. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM static TclFile FileForRedirect(interp, spec, atOK, arg, nextArg, flags, skipPtr, closePtr, releasePtr) Tcl_Interp *interp; /* Intepreter to use for error reporting. */ char *spec; /* Points to character just after * redirection character. */ char *arg; /* Pointer to entire argument containing |
︙ | ︙ | |||
151 152 153 154 155 156 157 158 159 160 161 162 163 164 | return file; badLastArg: Tcl_AppendResult(interp, "can't specify \"", arg, "\" as last word in command", (char *) NULL); return NULL; } /* *---------------------------------------------------------------------- * * Tcl_DetachPids -- * * This procedure is called to indicate that one or more child | > | 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | return file; badLastArg: Tcl_AppendResult(interp, "can't specify \"", arg, "\" as last word in command", (char *) NULL); return NULL; } #endif /* *---------------------------------------------------------------------- * * Tcl_DetachPids -- * * This procedure is called to indicate that one or more child |
︙ | ︙ | |||
188 189 190 191 192 193 194 | for (i = 0; i < numPids; i++) { detPtr = (Detached *) ckalloc(sizeof(Detached)); detPtr->pid = pidPtr[i]; detPtr->nextPtr = detList; detList = detPtr; } Tcl_MutexUnlock(&pipeMutex); | < | 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | for (i = 0; i < numPids; i++) { detPtr = (Detached *) ckalloc(sizeof(Detached)); detPtr->pid = pidPtr[i]; detPtr->nextPtr = detList; detList = detPtr; } Tcl_MutexUnlock(&pipeMutex); } /* *---------------------------------------------------------------------- * * Tcl_ReapDetachedProcs -- * |
︙ | ︙ | |||
430 431 432 433 434 435 436 437 438 439 440 441 442 443 | * * Side effects: * Processes and pipes are created. * *---------------------------------------------------------------------- */ int TclCreatePipeline(interp, argc, argv, pidArrayPtr, inPipePtr, outPipePtr, errFilePtr) Tcl_Interp *interp; /* Interpreter to use for error reporting. */ int argc; /* Number of entries in argv. */ char **argv; /* Array of strings describing commands in * pipeline plus I/O redirection with <, | > | 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 | * * Side effects: * Processes and pipes are created. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM int TclCreatePipeline(interp, argc, argv, pidArrayPtr, inPipePtr, outPipePtr, errFilePtr) Tcl_Interp *interp; /* Interpreter to use for error reporting. */ int argc; /* Number of entries in argv. */ char **argv; /* Array of strings describing commands in * pipeline plus I/O redirection with <, |
︙ | ︙ | |||
948 949 950 951 952 953 954 955 956 957 958 959 960 961 | } } ckfree((char *) pidPtr); } numPids = -1; goto cleanup; } /* *---------------------------------------------------------------------- * * Tcl_OpenCommandChannel -- * * Opens an I/O channel to one or more subprocesses specified | > | 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 | } } ckfree((char *) pidPtr); } numPids = -1; goto cleanup; } #endif /* *---------------------------------------------------------------------- * * Tcl_OpenCommandChannel -- * * Opens an I/O channel to one or more subprocesses specified |
︙ | ︙ | |||
983 984 985 986 987 988 989 990 991 992 993 994 995 996 | * * Side effects: * Creates processes, opens pipes. * *---------------------------------------------------------------------- */ Tcl_Channel Tcl_OpenCommandChannel(interp, argc, argv, flags) Tcl_Interp *interp; /* Interpreter for error reporting. Can * NOT be NULL. */ int argc; /* How many arguments. */ char **argv; /* Array of arguments for command pipe. */ int flags; /* Or'ed combination of TCL_STDIN, TCL_STDOUT, | > | 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 | * * Side effects: * Creates processes, opens pipes. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM Tcl_Channel Tcl_OpenCommandChannel(interp, argc, argv, flags) Tcl_Interp *interp; /* Interpreter for error reporting. Can * NOT be NULL. */ int argc; /* How many arguments. */ char **argv; /* Array of arguments for command pipe. */ int flags; /* Or'ed combination of TCL_STDIN, TCL_STDOUT, |
︙ | ︙ | |||
1055 1056 1057 1058 1059 1060 1061 | TclpCloseFile(outPipe); } if (errFile != NULL) { TclpCloseFile(errFile); } return NULL; } | > > | 1062 1063 1064 1065 1066 1067 1068 1069 1070 | TclpCloseFile(outPipe); } if (errFile != NULL) { TclpCloseFile(errFile); } return NULL; } #endif /* TCL_NO_FILESYSTEM */ #endif /* TCL_NO_PIPES */ |
Changes to generic/tclStubInit.c.
1 2 3 4 5 6 7 8 9 10 | /* * tclStubInit.c -- * * This file contains the initializers for the Tcl stub vectors. * * Copyright (c) 1998-1999 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /* * tclStubInit.c -- * * This file contains the initializers for the Tcl stub vectors. * * Copyright (c) 1998-1999 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclStubInit.c,v 1.35.2.7.2.1 2001/11/28 17:58:37 andreas_kupries Exp $ */ #include "tclInt.h" #include "tclPort.h" /* * Remove macros that will interfere with the definitions below. |
︙ | ︙ | |||
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | */ /* !BEGIN!: Do not edit below this line. */ TclIntStubs tclIntStubs = { TCL_STUB_MAGIC, NULL, TclAccess, /* 0 */ TclAccessDeleteProc, /* 1 */ TclAccessInsertProc, /* 2 */ TclAllocateFreeObjects, /* 3 */ NULL, /* 4 */ #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ TclCleanupChildren, /* 5 */ #endif /* UNIX */ #ifdef __WIN32__ TclCleanupChildren, /* 5 */ #endif /* __WIN32__ */ #ifdef MAC_TCL NULL, /* 5 */ #endif /* MAC_TCL */ TclCleanupCommand, /* 6 */ TclCopyAndCollapse, /* 7 */ TclCopyChannel, /* 8 */ #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ TclCreatePipeline, /* 9 */ #endif /* UNIX */ #ifdef __WIN32__ TclCreatePipeline, /* 9 */ #endif /* __WIN32__ */ #ifdef MAC_TCL NULL, /* 9 */ #endif /* MAC_TCL */ TclCreateProc, /* 10 */ TclDeleteCompiledLocalVars, /* 11 */ TclDeleteVars, /* 12 */ TclDoGlob, /* 13 */ TclDumpMemoryInfo, /* 14 */ NULL, /* 15 */ TclExprFloatError, /* 16 */ TclFileAttrsCmd, /* 17 */ TclFileCopyCmd, /* 18 */ TclFileDeleteCmd, /* 19 */ TclFileMakeDirsCmd, /* 20 */ TclFileRenameCmd, /* 21 */ TclFindElement, /* 22 */ TclFindProc, /* 23 */ TclFormatInt, /* 24 */ TclFreePackageInfo, /* 25 */ NULL, /* 26 */ TclGetDate, /* 27 */ TclpGetDefaultStdChannel, /* 28 */ TclGetElementOfIndexedArray, /* 29 */ NULL, /* 30 */ TclGetExtension, /* 31 */ TclGetFrame, /* 32 */ TclGetInterpProc, /* 33 */ TclGetIntForIndex, /* 34 */ TclGetIndexedScalar, /* 35 */ TclGetLong, /* 36 */ TclGetLoadedPackages, /* 37 */ TclGetNamespaceForQualName, /* 38 */ TclGetObjInterpProc, /* 39 */ TclGetOpenMode, /* 40 */ TclGetOriginalCommand, /* 41 */ TclpGetUserHome, /* 42 */ TclGlobalInvoke, /* 43 */ TclGuessPackageName, /* 44 */ TclHideUnsafeCommands, /* 45 */ TclInExit, /* 46 */ TclIncrElementOfIndexedArray, /* 47 */ TclIncrIndexedScalar, /* 48 */ TclIncrVar2, /* 49 */ TclInitCompiledLocals, /* 50 */ TclInterpInit, /* 51 */ TclInvoke, /* 52 */ TclInvokeObjectCommand, /* 53 */ TclInvokeStringCommand, /* 54 */ TclIsProc, /* 55 */ NULL, /* 56 */ NULL, /* 57 */ TclLookupVar, /* 58 */ TclpMatchFiles, /* 59 */ TclNeedSpace, /* 60 */ TclNewProcBodyObj, /* 61 */ TclObjCommandComplete, /* 62 */ TclObjInterpProc, /* 63 */ TclObjInvoke, /* 64 */ TclObjInvokeGlobal, /* 65 */ TclOpenFileChannelDeleteProc, /* 66 */ TclOpenFileChannelInsertProc, /* 67 */ TclpAccess, /* 68 */ TclpAlloc, /* 69 */ TclpCopyFile, /* 70 */ TclpCopyDirectory, /* 71 */ TclpCreateDirectory, /* 72 */ TclpDeleteFile, /* 73 */ TclpFree, /* 74 */ TclpGetClicks, /* 75 */ TclpGetSeconds, /* 76 */ TclpGetTime, /* 77 */ TclpGetTimeZone, /* 78 */ TclpListVolumes, /* 79 */ TclpOpenFileChannel, /* 80 */ TclpRealloc, /* 81 */ TclpRemoveDirectory, /* 82 */ TclpRenameFile, /* 83 */ NULL, /* 84 */ NULL, /* 85 */ NULL, /* 86 */ NULL, /* 87 */ TclPrecTraceProc, /* 88 */ TclPreventAliasLoop, /* 89 */ NULL, /* 90 */ TclProcCleanupProc, /* 91 */ TclProcCompileProc, /* 92 */ TclProcDeleteProc, /* 93 */ TclProcInterpProc, /* 94 */ TclpStat, /* 95 */ TclRenameCommand, /* 96 */ TclResetShadowedCmdRefs, /* 97 */ TclServiceIdle, /* 98 */ TclSetElementOfIndexedArray, /* 99 */ TclSetIndexedScalar, /* 100 */ #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ TclSetPreInitScript, /* 101 */ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | */ /* !BEGIN!: Do not edit below this line. */ TclIntStubs tclIntStubs = { TCL_STUB_MAGIC, NULL, #if defined(TCL_NO_FILESYSTEM) NULL, /* 0*/ #else /* TCL_NO_FILESYSTEM */ TclAccess, /* 0 */ #endif /* TCL_NO_FILESYSTEM */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 1*/ #else /* TCL_NO_FILESYSTEM */ TclAccessDeleteProc, /* 1 */ #endif /* TCL_NO_FILESYSTEM */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 2*/ #else /* TCL_NO_FILESYSTEM */ TclAccessInsertProc, /* 2 */ #endif /* TCL_NO_FILESYSTEM */ TclAllocateFreeObjects, /* 3 */ NULL, /* 4 */ #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ #if defined(TCL_NO_PIPES) NULL, /* 5*/ #else /* TCL_NO_PIPES */ TclCleanupChildren, /* 5 */ #endif /* TCL_NO_PIPES */ #endif /* UNIX */ #ifdef __WIN32__ #if defined(TCL_NO_PIPES) NULL, /* 5*/ #else /* TCL_NO_PIPES */ TclCleanupChildren, /* 5 */ #endif /* TCL_NO_PIPES */ #endif /* __WIN32__ */ #ifdef MAC_TCL NULL, /* 5 */ #endif /* MAC_TCL */ TclCleanupCommand, /* 6 */ TclCopyAndCollapse, /* 7 */ #if defined(TCL_NO_CHANNELCOPY) NULL, /* 8*/ #else /* TCL_NO_CHANNELCOPY */ TclCopyChannel, /* 8 */ #endif /* TCL_NO_CHANNELCOPY */ #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ #if defined(TCL_NO_FILESYSTEM) || defined(TCL_NO_PIPES) NULL, /* 9*/ #else /* TCL_NO_FILESYSTEM TCL_NO_PIPES */ TclCreatePipeline, /* 9 */ #endif /* TCL_NO_FILESYSTEM TCL_NO_PIPES */ #endif /* UNIX */ #ifdef __WIN32__ #if defined(TCL_NO_FILESYSTEM) || defined(TCL_NO_PIPES) NULL, /* 9*/ #else /* TCL_NO_FILESYSTEM TCL_NO_PIPES */ TclCreatePipeline, /* 9 */ #endif /* TCL_NO_FILESYSTEM TCL_NO_PIPES */ #endif /* __WIN32__ */ #ifdef MAC_TCL NULL, /* 9 */ #endif /* MAC_TCL */ TclCreateProc, /* 10 */ TclDeleteCompiledLocalVars, /* 11 */ TclDeleteVars, /* 12 */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 13*/ #else /* TCL_NO_FILESYSTEM */ TclDoGlob, /* 13 */ #endif /* TCL_NO_FILESYSTEM */ TclDumpMemoryInfo, /* 14 */ NULL, /* 15 */ TclExprFloatError, /* 16 */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 17*/ #else /* TCL_NO_FILESYSTEM */ TclFileAttrsCmd, /* 17 */ #endif /* TCL_NO_FILESYSTEM */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 18*/ #else /* TCL_NO_FILESYSTEM */ TclFileCopyCmd, /* 18 */ #endif /* TCL_NO_FILESYSTEM */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 19*/ #else /* TCL_NO_FILESYSTEM */ TclFileDeleteCmd, /* 19 */ #endif /* TCL_NO_FILESYSTEM */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 20*/ #else /* TCL_NO_FILESYSTEM */ TclFileMakeDirsCmd, /* 20 */ #endif /* TCL_NO_FILESYSTEM */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 21*/ #else /* TCL_NO_FILESYSTEM */ TclFileRenameCmd, /* 21 */ #endif /* TCL_NO_FILESYSTEM */ TclFindElement, /* 22 */ TclFindProc, /* 23 */ TclFormatInt, /* 24 */ TclFreePackageInfo, /* 25 */ NULL, /* 26 */ TclGetDate, /* 27 */ TclpGetDefaultStdChannel, /* 28 */ TclGetElementOfIndexedArray, /* 29 */ NULL, /* 30 */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 31*/ #else /* TCL_NO_FILESYSTEM */ TclGetExtension, /* 31 */ #endif /* TCL_NO_FILESYSTEM */ TclGetFrame, /* 32 */ TclGetInterpProc, /* 33 */ TclGetIntForIndex, /* 34 */ TclGetIndexedScalar, /* 35 */ TclGetLong, /* 36 */ TclGetLoadedPackages, /* 37 */ TclGetNamespaceForQualName, /* 38 */ TclGetObjInterpProc, /* 39 */ TclGetOpenMode, /* 40 */ TclGetOriginalCommand, /* 41 */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 42*/ #else /* TCL_NO_FILESYSTEM */ TclpGetUserHome, /* 42 */ #endif /* TCL_NO_FILESYSTEM */ TclGlobalInvoke, /* 43 */ TclGuessPackageName, /* 44 */ TclHideUnsafeCommands, /* 45 */ TclInExit, /* 46 */ TclIncrElementOfIndexedArray, /* 47 */ TclIncrIndexedScalar, /* 48 */ TclIncrVar2, /* 49 */ TclInitCompiledLocals, /* 50 */ #if defined(TCL_NO_SLAVEINTERP) && defined (TCL_NO_CMDALIASES) NULL, /* 51*/ #else /* TCL_NO_SLAVEINTERP TCL_NO_CMDALIASES */ TclInterpInit, /* 51 */ #endif /* TCL_NO_SLAVEINTERP TCL_NO_CMDALIASES */ TclInvoke, /* 52 */ TclInvokeObjectCommand, /* 53 */ TclInvokeStringCommand, /* 54 */ TclIsProc, /* 55 */ NULL, /* 56 */ NULL, /* 57 */ TclLookupVar, /* 58 */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 59*/ #else /* TCL_NO_FILESYSTEM */ TclpMatchFiles, /* 59 */ #endif /* TCL_NO_FILESYSTEM */ TclNeedSpace, /* 60 */ TclNewProcBodyObj, /* 61 */ TclObjCommandComplete, /* 62 */ TclObjInterpProc, /* 63 */ TclObjInvoke, /* 64 */ TclObjInvokeGlobal, /* 65 */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 66*/ #else /* TCL_NO_FILESYSTEM */ TclOpenFileChannelDeleteProc, /* 66 */ #endif /* TCL_NO_FILESYSTEM */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 67*/ #else /* TCL_NO_FILESYSTEM */ TclOpenFileChannelInsertProc, /* 67 */ #endif /* TCL_NO_FILESYSTEM */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 68*/ #else /* TCL_NO_FILESYSTEM */ TclpAccess, /* 68 */ #endif /* TCL_NO_FILESYSTEM */ TclpAlloc, /* 69 */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 70*/ #else /* TCL_NO_FILESYSTEM */ TclpCopyFile, /* 70 */ #endif /* TCL_NO_FILESYSTEM */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 71*/ #else /* TCL_NO_FILESYSTEM */ TclpCopyDirectory, /* 71 */ #endif /* TCL_NO_FILESYSTEM */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 72*/ #else /* TCL_NO_FILESYSTEM */ TclpCreateDirectory, /* 72 */ #endif /* TCL_NO_FILESYSTEM */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 73*/ #else /* TCL_NO_FILESYSTEM */ TclpDeleteFile, /* 73 */ #endif /* TCL_NO_FILESYSTEM */ TclpFree, /* 74 */ TclpGetClicks, /* 75 */ TclpGetSeconds, /* 76 */ TclpGetTime, /* 77 */ TclpGetTimeZone, /* 78 */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 79*/ #else /* TCL_NO_FILESYSTEM */ TclpListVolumes, /* 79 */ #endif /* TCL_NO_FILESYSTEM */ #if defined(TCL_NO_FILESYSTEM) || defined(TCL_NO_NONSTDCHAN) NULL, /* 80*/ #else /* TCL_NO_FILESYSTEM TCL_NO_NONSTDCHAN */ TclpOpenFileChannel, /* 80 */ #endif /* TCL_NO_FILESYSTEM TCL_NO_NONSTDCHAN */ TclpRealloc, /* 81 */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 82*/ #else /* TCL_NO_FILESYSTEM */ TclpRemoveDirectory, /* 82 */ #endif /* TCL_NO_FILESYSTEM */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 83*/ #else /* TCL_NO_FILESYSTEM */ TclpRenameFile, /* 83 */ #endif /* TCL_NO_FILESYSTEM */ NULL, /* 84 */ NULL, /* 85 */ NULL, /* 86 */ NULL, /* 87 */ TclPrecTraceProc, /* 88 */ #if defined(TCL_NO_CMDALIASES) NULL, /* 89*/ #else /* TCL_NO_CMDALIASES */ TclPreventAliasLoop, /* 89 */ #endif /* TCL_NO_CMDALIASES */ NULL, /* 90 */ TclProcCleanupProc, /* 91 */ TclProcCompileProc, /* 92 */ TclProcDeleteProc, /* 93 */ TclProcInterpProc, /* 94 */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 95*/ #else /* TCL_NO_FILESYSTEM */ TclpStat, /* 95 */ #endif /* TCL_NO_FILESYSTEM */ TclRenameCommand, /* 96 */ TclResetShadowedCmdRefs, /* 97 */ TclServiceIdle, /* 98 */ TclSetElementOfIndexedArray, /* 99 */ TclSetIndexedScalar, /* 100 */ #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ TclSetPreInitScript, /* 101 */ |
︙ | ︙ | |||
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | #endif /* UNIX */ #ifdef __WIN32__ TclSockMinimumBuffers, /* 104 */ #endif /* __WIN32__ */ #ifdef MAC_TCL NULL, /* 104 */ #endif /* MAC_TCL */ TclStat, /* 105 */ TclStatDeleteProc, /* 106 */ TclStatInsertProc, /* 107 */ TclTeardownNamespace, /* 108 */ TclUpdateReturnInfo, /* 109 */ NULL, /* 110 */ Tcl_AddInterpResolvers, /* 111 */ Tcl_AppendExportList, /* 112 */ Tcl_CreateNamespace, /* 113 */ Tcl_DeleteNamespace, /* 114 */ | > > > > > > > > > > > > | 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | #endif /* UNIX */ #ifdef __WIN32__ TclSockMinimumBuffers, /* 104 */ #endif /* __WIN32__ */ #ifdef MAC_TCL NULL, /* 104 */ #endif /* MAC_TCL */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 105*/ #else /* TCL_NO_FILESYSTEM */ TclStat, /* 105 */ #endif /* TCL_NO_FILESYSTEM */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 106*/ #else /* TCL_NO_FILESYSTEM */ TclStatDeleteProc, /* 106 */ #endif /* TCL_NO_FILESYSTEM */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 107*/ #else /* TCL_NO_FILESYSTEM */ TclStatInsertProc, /* 107 */ #endif /* TCL_NO_FILESYSTEM */ TclTeardownNamespace, /* 108 */ TclUpdateReturnInfo, /* 109 */ NULL, /* 110 */ Tcl_AddInterpResolvers, /* 111 */ Tcl_AppendExportList, /* 112 */ Tcl_CreateNamespace, /* 113 */ Tcl_DeleteNamespace, /* 114 */ |
︙ | ︙ | |||
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | Tcl_RemoveInterpResolvers, /* 130 */ Tcl_SetNamespaceResolvers, /* 131 */ TclpHasSockets, /* 132 */ TclpGetDate, /* 133 */ TclpStrftime, /* 134 */ TclpCheckStackSpace, /* 135 */ NULL, /* 136 */ TclpChdir, /* 137 */ TclGetEnv, /* 138 */ TclpLoadFile, /* 139 */ TclLooksLikeInt, /* 140 */ TclpGetCwd, /* 141 */ TclSetByteCodeFromAny, /* 142 */ TclAddLiteralObj, /* 143 */ TclHideLiteral, /* 144 */ TclGetAuxDataType, /* 145 */ TclHandleCreate, /* 146 */ TclHandleFree, /* 147 */ TclHandlePreserve, /* 148 */ TclHandleRelease, /* 149 */ TclRegAbout, /* 150 */ TclRegExpRangeUniChar, /* 151 */ TclSetLibraryPath, /* 152 */ TclGetLibraryPath, /* 153 */ NULL, /* 154 */ NULL, /* 155 */ TclRegError, /* 156 */ TclVarTraceExists, /* 157 */ TclSetStartupScriptFileName, /* 158 */ TclGetStartupScriptFileName, /* 159 */ TclpMatchFilesTypes, /* 160 */ TclChannelTransform, /* 161 */ TclChannelEventScriptInvoker, /* 162 */ TclGetInstructionTable, /* 163 */ TclExpandCodeArray, /* 164 */ }; TclIntPlatStubs tclIntPlatStubs = { TCL_STUB_MAGIC, NULL, #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ TclGetAndDetachPids, /* 0 */ TclpCloseFile, /* 1 */ TclpCreateCommandChannel, /* 2 */ TclpCreatePipe, /* 3 */ TclpCreateProcess, /* 4 */ NULL, /* 5 */ TclpMakeFile, /* 6 */ TclpOpenFile, /* 7 */ TclUnixWaitForFile, /* 8 */ TclpCreateTempFile, /* 9 */ #endif /* UNIX */ #ifdef __WIN32__ TclWinConvertError, /* 0 */ TclWinConvertWSAError, /* 1 */ TclWinGetServByName, /* 2 */ TclWinGetSockOpt, /* 3 */ TclWinGetTclInstance, /* 4 */ NULL, /* 5 */ TclWinNToHS, /* 6 */ TclWinSetSockOpt, /* 7 */ TclpGetPid, /* 8 */ TclWinGetPlatformId, /* 9 */ NULL, /* 10 */ TclGetAndDetachPids, /* 11 */ TclpCloseFile, /* 12 */ TclpCreateCommandChannel, /* 13 */ TclpCreatePipe, /* 14 */ TclpCreateProcess, /* 15 */ NULL, /* 16 */ NULL, /* 17 */ TclpMakeFile, /* 18 */ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 | Tcl_RemoveInterpResolvers, /* 130 */ Tcl_SetNamespaceResolvers, /* 131 */ TclpHasSockets, /* 132 */ TclpGetDate, /* 133 */ TclpStrftime, /* 134 */ TclpCheckStackSpace, /* 135 */ NULL, /* 136 */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 137*/ #else /* TCL_NO_FILESYSTEM */ TclpChdir, /* 137 */ #endif /* TCL_NO_FILESYSTEM */ TclGetEnv, /* 138 */ #if defined(TCL_NO_FILESYSTEM) || defined(TCL_NO_LOADCMD) NULL, /* 139*/ #else /* TCL_NO_FILESYSTEM TCL_NO_LOADCMD */ TclpLoadFile, /* 139 */ #endif /* TCL_NO_FILESYSTEM TCL_NO_LOADCMD */ TclLooksLikeInt, /* 140 */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 141*/ #else /* TCL_NO_FILESYSTEM */ TclpGetCwd, /* 141 */ #endif /* TCL_NO_FILESYSTEM */ TclSetByteCodeFromAny, /* 142 */ TclAddLiteralObj, /* 143 */ TclHideLiteral, /* 144 */ TclGetAuxDataType, /* 145 */ TclHandleCreate, /* 146 */ TclHandleFree, /* 147 */ TclHandlePreserve, /* 148 */ TclHandleRelease, /* 149 */ TclRegAbout, /* 150 */ TclRegExpRangeUniChar, /* 151 */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 152*/ #else /* TCL_NO_FILESYSTEM */ TclSetLibraryPath, /* 152 */ #endif /* TCL_NO_FILESYSTEM */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 153*/ #else /* TCL_NO_FILESYSTEM */ TclGetLibraryPath, /* 153 */ #endif /* TCL_NO_FILESYSTEM */ NULL, /* 154 */ NULL, /* 155 */ TclRegError, /* 156 */ TclVarTraceExists, /* 157 */ TclSetStartupScriptFileName, /* 158 */ TclGetStartupScriptFileName, /* 159 */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 160*/ #else /* TCL_NO_FILESYSTEM */ TclpMatchFilesTypes, /* 160 */ #endif /* TCL_NO_FILESYSTEM */ TclChannelTransform, /* 161 */ #if defined(TCL_NO_FILEEVENTS) NULL, /* 162*/ #else /* TCL_NO_FILEEVENTS */ TclChannelEventScriptInvoker, /* 162 */ #endif /* TCL_NO_FILEEVENTS */ TclGetInstructionTable, /* 163 */ TclExpandCodeArray, /* 164 */ }; TclIntPlatStubs tclIntPlatStubs = { TCL_STUB_MAGIC, NULL, #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ #if defined(TCL_NO_PIPES) NULL, /* 0*/ #else /* TCL_NO_PIPES */ TclGetAndDetachPids, /* 0 */ #endif /* TCL_NO_PIPES */ #if defined(TCL_NO_PIPES) NULL, /* 1*/ #else /* TCL_NO_PIPES */ TclpCloseFile, /* 1 */ #endif /* TCL_NO_PIPES */ #if defined(TCL_NO_PIPES) NULL, /* 2*/ #else /* TCL_NO_PIPES */ TclpCreateCommandChannel, /* 2 */ #endif /* TCL_NO_PIPES */ #if defined(TCL_NO_PIPES) NULL, /* 3*/ #else /* TCL_NO_PIPES */ TclpCreatePipe, /* 3 */ #endif /* TCL_NO_PIPES */ #if defined(TCL_NO_PIPES) NULL, /* 4*/ #else /* TCL_NO_PIPES */ TclpCreateProcess, /* 4 */ #endif /* TCL_NO_PIPES */ NULL, /* 5 */ #if defined(TCL_NO_PIPES) NULL, /* 6*/ #else /* TCL_NO_PIPES */ TclpMakeFile, /* 6 */ #endif /* TCL_NO_PIPES */ #if defined(TCL_NO_PIPES) NULL, /* 7*/ #else /* TCL_NO_PIPES */ TclpOpenFile, /* 7 */ #endif /* TCL_NO_PIPES */ TclUnixWaitForFile, /* 8 */ #if defined(TCL_NO_PIPES) NULL, /* 9*/ #else /* TCL_NO_PIPES */ TclpCreateTempFile, /* 9 */ #endif /* TCL_NO_PIPES */ #endif /* UNIX */ #ifdef __WIN32__ TclWinConvertError, /* 0 */ TclWinConvertWSAError, /* 1 */ TclWinGetServByName, /* 2 */ TclWinGetSockOpt, /* 3 */ TclWinGetTclInstance, /* 4 */ NULL, /* 5 */ TclWinNToHS, /* 6 */ TclWinSetSockOpt, /* 7 */ TclpGetPid, /* 8 */ TclWinGetPlatformId, /* 9 */ NULL, /* 10 */ #if defined(TCL_NO_PIPES) NULL, /* 11*/ #else /* TCL_NO_PIPES */ TclGetAndDetachPids, /* 11 */ #endif /* TCL_NO_PIPES */ TclpCloseFile, /* 12 */ TclpCreateCommandChannel, /* 13 */ TclpCreatePipe, /* 14 */ TclpCreateProcess, /* 15 */ NULL, /* 16 */ NULL, /* 17 */ TclpMakeFile, /* 18 */ |
︙ | ︙ | |||
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 | Tcl_Alloc, /* 3 */ Tcl_Free, /* 4 */ Tcl_Realloc, /* 5 */ Tcl_DbCkalloc, /* 6 */ Tcl_DbCkfree, /* 7 */ Tcl_DbCkrealloc, /* 8 */ #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ Tcl_CreateFileHandler, /* 9 */ #endif /* UNIX */ #ifdef __WIN32__ NULL, /* 9 */ #endif /* __WIN32__ */ #ifdef MAC_TCL NULL, /* 9 */ #endif /* MAC_TCL */ #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ Tcl_DeleteFileHandler, /* 10 */ #endif /* UNIX */ #ifdef __WIN32__ NULL, /* 10 */ #endif /* __WIN32__ */ #ifdef MAC_TCL NULL, /* 10 */ #endif /* MAC_TCL */ | > > > > > > > > | 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 | Tcl_Alloc, /* 3 */ Tcl_Free, /* 4 */ Tcl_Realloc, /* 5 */ Tcl_DbCkalloc, /* 6 */ Tcl_DbCkfree, /* 7 */ Tcl_DbCkrealloc, /* 8 */ #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ #if defined(TCL_NO_FILEEVENTS) NULL, /* 9*/ #else /* TCL_NO_FILEEVENTS */ Tcl_CreateFileHandler, /* 9 */ #endif /* TCL_NO_FILEEVENTS */ #endif /* UNIX */ #ifdef __WIN32__ NULL, /* 9 */ #endif /* __WIN32__ */ #ifdef MAC_TCL NULL, /* 9 */ #endif /* MAC_TCL */ #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ #if defined(TCL_NO_FILEEVENTS) NULL, /* 10*/ #else /* TCL_NO_FILEEVENTS */ Tcl_DeleteFileHandler, /* 10 */ #endif /* TCL_NO_FILEEVENTS */ #endif /* UNIX */ #ifdef __WIN32__ NULL, /* 10 */ #endif /* __WIN32__ */ #ifdef MAC_TCL NULL, /* 10 */ #endif /* MAC_TCL */ |
︙ | ︙ | |||
444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 | Tcl_CallWhenDeleted, /* 79 */ Tcl_CancelIdleCall, /* 80 */ Tcl_Close, /* 81 */ Tcl_CommandComplete, /* 82 */ Tcl_Concat, /* 83 */ Tcl_ConvertElement, /* 84 */ Tcl_ConvertCountedElement, /* 85 */ Tcl_CreateAlias, /* 86 */ Tcl_CreateAliasObj, /* 87 */ Tcl_CreateChannel, /* 88 */ Tcl_CreateChannelHandler, /* 89 */ Tcl_CreateCloseHandler, /* 90 */ Tcl_CreateCommand, /* 91 */ Tcl_CreateEventSource, /* 92 */ Tcl_CreateExitHandler, /* 93 */ Tcl_CreateInterp, /* 94 */ Tcl_CreateMathFunc, /* 95 */ Tcl_CreateObjCommand, /* 96 */ Tcl_CreateSlave, /* 97 */ Tcl_CreateTimerHandler, /* 98 */ Tcl_CreateTrace, /* 99 */ Tcl_DeleteAssocData, /* 100 */ Tcl_DeleteChannelHandler, /* 101 */ Tcl_DeleteCloseHandler, /* 102 */ Tcl_DeleteCommand, /* 103 */ Tcl_DeleteCommandFromToken, /* 104 */ Tcl_DeleteEvents, /* 105 */ Tcl_DeleteEventSource, /* 106 */ Tcl_DeleteExitHandler, /* 107 */ Tcl_DeleteHashEntry, /* 108 */ Tcl_DeleteHashTable, /* 109 */ Tcl_DeleteInterp, /* 110 */ #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ Tcl_DetachPids, /* 111 */ #endif /* UNIX */ #ifdef __WIN32__ Tcl_DetachPids, /* 111 */ #endif /* __WIN32__ */ #ifdef MAC_TCL NULL, /* 111 */ #endif /* MAC_TCL */ Tcl_DeleteTimerHandler, /* 112 */ Tcl_DeleteTrace, /* 113 */ Tcl_DontCallWhenDeleted, /* 114 */ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 | Tcl_CallWhenDeleted, /* 79 */ Tcl_CancelIdleCall, /* 80 */ Tcl_Close, /* 81 */ Tcl_CommandComplete, /* 82 */ Tcl_Concat, /* 83 */ Tcl_ConvertElement, /* 84 */ Tcl_ConvertCountedElement, /* 85 */ #if defined(TCL_NO_CMDALIASES) NULL, /* 86*/ #else /* TCL_NO_CMDALIASES */ Tcl_CreateAlias, /* 86 */ #endif /* TCL_NO_CMDALIASES */ #if defined(TCL_NO_CMDALIASES) NULL, /* 87*/ #else /* TCL_NO_CMDALIASES */ Tcl_CreateAliasObj, /* 87 */ #endif /* TCL_NO_CMDALIASES */ Tcl_CreateChannel, /* 88 */ #if defined(TCL_NO_FILEEVENTS) NULL, /* 89*/ #else /* TCL_NO_FILEEVENTS */ Tcl_CreateChannelHandler, /* 89 */ #endif /* TCL_NO_FILEEVENTS */ Tcl_CreateCloseHandler, /* 90 */ Tcl_CreateCommand, /* 91 */ Tcl_CreateEventSource, /* 92 */ Tcl_CreateExitHandler, /* 93 */ Tcl_CreateInterp, /* 94 */ Tcl_CreateMathFunc, /* 95 */ Tcl_CreateObjCommand, /* 96 */ #if defined(TCL_NO_SLAVEINTERP) NULL, /* 97*/ #else /* TCL_NO_SLAVEINTERP */ Tcl_CreateSlave, /* 97 */ #endif /* TCL_NO_SLAVEINTERP */ Tcl_CreateTimerHandler, /* 98 */ Tcl_CreateTrace, /* 99 */ Tcl_DeleteAssocData, /* 100 */ #if defined(TCL_NO_FILEEVENTS) NULL, /* 101*/ #else /* TCL_NO_FILEEVENTS */ Tcl_DeleteChannelHandler, /* 101 */ #endif /* TCL_NO_FILEEVENTS */ Tcl_DeleteCloseHandler, /* 102 */ Tcl_DeleteCommand, /* 103 */ Tcl_DeleteCommandFromToken, /* 104 */ Tcl_DeleteEvents, /* 105 */ Tcl_DeleteEventSource, /* 106 */ Tcl_DeleteExitHandler, /* 107 */ Tcl_DeleteHashEntry, /* 108 */ Tcl_DeleteHashTable, /* 109 */ Tcl_DeleteInterp, /* 110 */ #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ #if defined(TCL_NO_PIPES) NULL, /* 111*/ #else /* TCL_NO_PIPES */ Tcl_DetachPids, /* 111 */ #endif /* TCL_NO_PIPES */ #endif /* UNIX */ #ifdef __WIN32__ #if defined(TCL_NO_PIPES) NULL, /* 111*/ #else /* TCL_NO_PIPES */ Tcl_DetachPids, /* 111 */ #endif /* TCL_NO_PIPES */ #endif /* __WIN32__ */ #ifdef MAC_TCL NULL, /* 111 */ #endif /* MAC_TCL */ Tcl_DeleteTimerHandler, /* 112 */ Tcl_DeleteTrace, /* 113 */ Tcl_DontCallWhenDeleted, /* 114 */ |
︙ | ︙ | |||
496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 | Tcl_DStringResult, /* 123 */ Tcl_DStringSetLength, /* 124 */ Tcl_DStringStartSublist, /* 125 */ Tcl_Eof, /* 126 */ Tcl_ErrnoId, /* 127 */ Tcl_ErrnoMsg, /* 128 */ Tcl_Eval, /* 129 */ Tcl_EvalFile, /* 130 */ Tcl_EvalObj, /* 131 */ Tcl_EventuallyFree, /* 132 */ Tcl_Exit, /* 133 */ Tcl_ExposeCommand, /* 134 */ Tcl_ExprBoolean, /* 135 */ Tcl_ExprBooleanObj, /* 136 */ Tcl_ExprDouble, /* 137 */ Tcl_ExprDoubleObj, /* 138 */ Tcl_ExprLong, /* 139 */ Tcl_ExprLongObj, /* 140 */ Tcl_ExprObj, /* 141 */ Tcl_ExprString, /* 142 */ Tcl_Finalize, /* 143 */ Tcl_FindExecutable, /* 144 */ Tcl_FirstHashEntry, /* 145 */ Tcl_Flush, /* 146 */ Tcl_FreeResult, /* 147 */ Tcl_GetAlias, /* 148 */ Tcl_GetAliasObj, /* 149 */ Tcl_GetAssocData, /* 150 */ Tcl_GetChannel, /* 151 */ Tcl_GetChannelBufferSize, /* 152 */ Tcl_GetChannelHandle, /* 153 */ Tcl_GetChannelInstanceData, /* 154 */ Tcl_GetChannelMode, /* 155 */ Tcl_GetChannelName, /* 156 */ Tcl_GetChannelOption, /* 157 */ Tcl_GetChannelType, /* 158 */ Tcl_GetCommandInfo, /* 159 */ Tcl_GetCommandName, /* 160 */ Tcl_GetErrno, /* 161 */ Tcl_GetHostName, /* 162 */ Tcl_GetInterpPath, /* 163 */ Tcl_GetMaster, /* 164 */ Tcl_GetNameOfExecutable, /* 165 */ Tcl_GetObjResult, /* 166 */ #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ Tcl_GetOpenFile, /* 167 */ #endif /* UNIX */ #ifdef __WIN32__ NULL, /* 167 */ #endif /* __WIN32__ */ #ifdef MAC_TCL NULL, /* 167 */ #endif /* MAC_TCL */ Tcl_GetPathType, /* 168 */ Tcl_Gets, /* 169 */ Tcl_GetsObj, /* 170 */ Tcl_GetServiceMode, /* 171 */ Tcl_GetSlave, /* 172 */ Tcl_GetStdChannel, /* 173 */ Tcl_GetStringResult, /* 174 */ Tcl_GetVar, /* 175 */ Tcl_GetVar2, /* 176 */ Tcl_GlobalEval, /* 177 */ Tcl_GlobalEvalObj, /* 178 */ Tcl_HideCommand, /* 179 */ Tcl_Init, /* 180 */ Tcl_InitHashTable, /* 181 */ Tcl_InputBlocked, /* 182 */ Tcl_InputBuffered, /* 183 */ Tcl_InterpDeleted, /* 184 */ Tcl_IsSafe, /* 185 */ Tcl_JoinPath, /* 186 */ Tcl_LinkVar, /* 187 */ NULL, /* 188 */ Tcl_MakeFileChannel, /* 189 */ Tcl_MakeSafe, /* 190 */ Tcl_MakeTcpClientChannel, /* 191 */ Tcl_Merge, /* 192 */ Tcl_NextHashEntry, /* 193 */ Tcl_NotifyChannel, /* 194 */ Tcl_ObjGetVar2, /* 195 */ Tcl_ObjSetVar2, /* 196 */ #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ Tcl_OpenCommandChannel, /* 197 */ #endif /* UNIX */ #ifdef __WIN32__ Tcl_OpenCommandChannel, /* 197 */ #endif /* __WIN32__ */ #ifdef MAC_TCL NULL, /* 197 */ #endif /* MAC_TCL */ Tcl_OpenFileChannel, /* 198 */ Tcl_OpenTcpClient, /* 199 */ Tcl_OpenTcpServer, /* 200 */ Tcl_Preserve, /* 201 */ Tcl_PrintDouble, /* 202 */ Tcl_PutEnv, /* 203 */ Tcl_PosixError, /* 204 */ Tcl_QueueEvent, /* 205 */ Tcl_Read, /* 206 */ #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ Tcl_ReapDetachedProcs, /* 207 */ #endif /* UNIX */ #ifdef __WIN32__ Tcl_ReapDetachedProcs, /* 207 */ #endif /* __WIN32__ */ #ifdef MAC_TCL NULL, /* 207 */ #endif /* MAC_TCL */ Tcl_RecordAndEval, /* 208 */ Tcl_RecordAndEvalObj, /* 209 */ Tcl_RegisterChannel, /* 210 */ Tcl_RegisterObjType, /* 211 */ Tcl_RegExpCompile, /* 212 */ Tcl_RegExpExec, /* 213 */ Tcl_RegExpMatch, /* 214 */ Tcl_RegExpRange, /* 215 */ Tcl_Release, /* 216 */ Tcl_ResetResult, /* 217 */ Tcl_ScanElement, /* 218 */ Tcl_ScanCountedElement, /* 219 */ Tcl_Seek, /* 220 */ Tcl_ServiceAll, /* 221 */ Tcl_ServiceEvent, /* 222 */ Tcl_SetAssocData, /* 223 */ Tcl_SetChannelBufferSize, /* 224 */ Tcl_SetChannelOption, /* 225 */ Tcl_SetCommandInfo, /* 226 */ Tcl_SetErrno, /* 227 */ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 | Tcl_DStringResult, /* 123 */ Tcl_DStringSetLength, /* 124 */ Tcl_DStringStartSublist, /* 125 */ Tcl_Eof, /* 126 */ Tcl_ErrnoId, /* 127 */ Tcl_ErrnoMsg, /* 128 */ Tcl_Eval, /* 129 */ #if defined(TCL_NO_FILESYSTEM) || defined(TCL_NO_NONSTDCHAN) NULL, /* 130*/ #else /* TCL_NO_FILESYSTEM TCL_NO_NONSTDCHAN */ Tcl_EvalFile, /* 130 */ #endif /* TCL_NO_FILESYSTEM TCL_NO_NONSTDCHAN */ Tcl_EvalObj, /* 131 */ Tcl_EventuallyFree, /* 132 */ Tcl_Exit, /* 133 */ Tcl_ExposeCommand, /* 134 */ Tcl_ExprBoolean, /* 135 */ Tcl_ExprBooleanObj, /* 136 */ Tcl_ExprDouble, /* 137 */ Tcl_ExprDoubleObj, /* 138 */ Tcl_ExprLong, /* 139 */ Tcl_ExprLongObj, /* 140 */ Tcl_ExprObj, /* 141 */ Tcl_ExprString, /* 142 */ Tcl_Finalize, /* 143 */ Tcl_FindExecutable, /* 144 */ Tcl_FirstHashEntry, /* 145 */ Tcl_Flush, /* 146 */ Tcl_FreeResult, /* 147 */ #if defined(TCL_NO_CMDALIASES) NULL, /* 148*/ #else /* TCL_NO_CMDALIASES */ Tcl_GetAlias, /* 148 */ #endif /* TCL_NO_CMDALIASES */ #if defined(TCL_NO_CMDALIASES) NULL, /* 149*/ #else /* TCL_NO_CMDALIASES */ Tcl_GetAliasObj, /* 149 */ #endif /* TCL_NO_CMDALIASES */ Tcl_GetAssocData, /* 150 */ Tcl_GetChannel, /* 151 */ Tcl_GetChannelBufferSize, /* 152 */ Tcl_GetChannelHandle, /* 153 */ Tcl_GetChannelInstanceData, /* 154 */ Tcl_GetChannelMode, /* 155 */ Tcl_GetChannelName, /* 156 */ #if defined(TCL_NO_CHANNEL_CONFIG) NULL, /* 157*/ #else /* TCL_NO_CHANNEL_CONFIG */ Tcl_GetChannelOption, /* 157 */ #endif /* TCL_NO_CHANNEL_CONFIG */ Tcl_GetChannelType, /* 158 */ Tcl_GetCommandInfo, /* 159 */ Tcl_GetCommandName, /* 160 */ Tcl_GetErrno, /* 161 */ Tcl_GetHostName, /* 162 */ #if defined(TCL_NO_SLAVEINTERP) && defined (TCL_NO_CMDALIASES) NULL, /* 163*/ #else /* TCL_NO_SLAVEINTERP TCL_NO_CMDALIASES */ Tcl_GetInterpPath, /* 163 */ #endif /* TCL_NO_SLAVEINTERP TCL_NO_CMDALIASES */ #if defined(TCL_NO_SLAVEINTERP) && defined (TCL_NO_CMDALIASES) NULL, /* 164*/ #else /* TCL_NO_SLAVEINTERP TCL_NO_CMDALIASES */ Tcl_GetMaster, /* 164 */ #endif /* TCL_NO_SLAVEINTERP TCL_NO_CMDALIASES */ Tcl_GetNameOfExecutable, /* 165 */ Tcl_GetObjResult, /* 166 */ #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ Tcl_GetOpenFile, /* 167 */ #endif /* UNIX */ #ifdef __WIN32__ NULL, /* 167 */ #endif /* __WIN32__ */ #ifdef MAC_TCL NULL, /* 167 */ #endif /* MAC_TCL */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 168*/ #else /* TCL_NO_FILESYSTEM */ Tcl_GetPathType, /* 168 */ #endif /* TCL_NO_FILESYSTEM */ Tcl_Gets, /* 169 */ Tcl_GetsObj, /* 170 */ Tcl_GetServiceMode, /* 171 */ #if defined(TCL_NO_SLAVEINTERP) && defined (TCL_NO_CMDALIASES) NULL, /* 172*/ #else /* TCL_NO_SLAVEINTERP TCL_NO_CMDALIASES */ Tcl_GetSlave, /* 172 */ #endif /* TCL_NO_SLAVEINTERP TCL_NO_CMDALIASES */ Tcl_GetStdChannel, /* 173 */ Tcl_GetStringResult, /* 174 */ Tcl_GetVar, /* 175 */ Tcl_GetVar2, /* 176 */ Tcl_GlobalEval, /* 177 */ Tcl_GlobalEvalObj, /* 178 */ Tcl_HideCommand, /* 179 */ Tcl_Init, /* 180 */ Tcl_InitHashTable, /* 181 */ Tcl_InputBlocked, /* 182 */ Tcl_InputBuffered, /* 183 */ Tcl_InterpDeleted, /* 184 */ Tcl_IsSafe, /* 185 */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 186*/ #else /* TCL_NO_FILESYSTEM */ Tcl_JoinPath, /* 186 */ #endif /* TCL_NO_FILESYSTEM */ Tcl_LinkVar, /* 187 */ NULL, /* 188 */ Tcl_MakeFileChannel, /* 189 */ Tcl_MakeSafe, /* 190 */ #if defined(TCL_NO_SOCKETS) NULL, /* 191*/ #else /* TCL_NO_SOCKETS */ Tcl_MakeTcpClientChannel, /* 191 */ #endif /* TCL_NO_SOCKETS */ Tcl_Merge, /* 192 */ Tcl_NextHashEntry, /* 193 */ #if defined(TCL_NO_FILEEVENTS) NULL, /* 194*/ #else /* TCL_NO_FILEEVENTS */ Tcl_NotifyChannel, /* 194 */ #endif /* TCL_NO_FILEEVENTS */ Tcl_ObjGetVar2, /* 195 */ Tcl_ObjSetVar2, /* 196 */ #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ #if defined(TCL_NO_FILESYSTEM) || defined(TCL_NO_PIPES) NULL, /* 197*/ #else /* TCL_NO_FILESYSTEM TCL_NO_PIPES */ Tcl_OpenCommandChannel, /* 197 */ #endif /* TCL_NO_FILESYSTEM TCL_NO_PIPES */ #endif /* UNIX */ #ifdef __WIN32__ #if defined(TCL_NO_FILESYSTEM) || defined(TCL_NO_PIPES) NULL, /* 197*/ #else /* TCL_NO_FILESYSTEM TCL_NO_PIPES */ Tcl_OpenCommandChannel, /* 197 */ #endif /* TCL_NO_FILESYSTEM TCL_NO_PIPES */ #endif /* __WIN32__ */ #ifdef MAC_TCL NULL, /* 197 */ #endif /* MAC_TCL */ #if defined(TCL_NO_FILESYSTEM) || defined(TCL_NO_FILEEVENTS) NULL, /* 198*/ #else /* TCL_NO_FILESYSTEM TCL_NO_FILEEVENTS */ Tcl_OpenFileChannel, /* 198 */ #endif /* TCL_NO_FILESYSTEM TCL_NO_FILEEVENTS */ #if defined(TCL_NO_SOCKETS) NULL, /* 199*/ #else /* TCL_NO_SOCKETS */ Tcl_OpenTcpClient, /* 199 */ #endif /* TCL_NO_SOCKETS */ #if defined(TCL_NO_SOCKETS) || defined(TCL_NO_FILEEVENTS) NULL, /* 200*/ #else /* TCL_NO_SOCKETS TCL_NO_FILEEVENTS */ Tcl_OpenTcpServer, /* 200 */ #endif /* TCL_NO_SOCKETS TCL_NO_FILEEVENTS */ Tcl_Preserve, /* 201 */ Tcl_PrintDouble, /* 202 */ Tcl_PutEnv, /* 203 */ Tcl_PosixError, /* 204 */ Tcl_QueueEvent, /* 205 */ Tcl_Read, /* 206 */ #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ #if defined(TCL_NO_PIPES) NULL, /* 207*/ #else /* TCL_NO_PIPES */ Tcl_ReapDetachedProcs, /* 207 */ #endif /* TCL_NO_PIPES */ #endif /* UNIX */ #ifdef __WIN32__ #if defined(TCL_NO_PIPES) NULL, /* 207*/ #else /* TCL_NO_PIPES */ Tcl_ReapDetachedProcs, /* 207 */ #endif /* TCL_NO_PIPES */ #endif /* __WIN32__ */ #ifdef MAC_TCL NULL, /* 207 */ #endif /* MAC_TCL */ Tcl_RecordAndEval, /* 208 */ Tcl_RecordAndEvalObj, /* 209 */ #if defined(TCL_NO_NONSTDCHAN) NULL, /* 210*/ #else /* TCL_NO_NONSTDCHAN */ Tcl_RegisterChannel, /* 210 */ #endif /* TCL_NO_NONSTDCHAN */ Tcl_RegisterObjType, /* 211 */ Tcl_RegExpCompile, /* 212 */ Tcl_RegExpExec, /* 213 */ Tcl_RegExpMatch, /* 214 */ Tcl_RegExpRange, /* 215 */ Tcl_Release, /* 216 */ Tcl_ResetResult, /* 217 */ Tcl_ScanElement, /* 218 */ Tcl_ScanCountedElement, /* 219 */ #if defined(TCL_NO_NONSTDCHAN) NULL, /* 220*/ #else /* TCL_NO_NONSTDCHAN */ Tcl_Seek, /* 220 */ #endif /* TCL_NO_NONSTDCHAN */ Tcl_ServiceAll, /* 221 */ Tcl_ServiceEvent, /* 222 */ Tcl_SetAssocData, /* 223 */ Tcl_SetChannelBufferSize, /* 224 */ Tcl_SetChannelOption, /* 225 */ Tcl_SetCommandInfo, /* 226 */ Tcl_SetErrno, /* 227 */ |
︙ | ︙ | |||
633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 | Tcl_SetStdChannel, /* 236 */ Tcl_SetVar, /* 237 */ Tcl_SetVar2, /* 238 */ Tcl_SignalId, /* 239 */ Tcl_SignalMsg, /* 240 */ Tcl_SourceRCFile, /* 241 */ Tcl_SplitList, /* 242 */ Tcl_SplitPath, /* 243 */ Tcl_StaticPackage, /* 244 */ Tcl_StringMatch, /* 245 */ Tcl_Tell, /* 246 */ Tcl_TraceVar, /* 247 */ Tcl_TraceVar2, /* 248 */ Tcl_TranslateFileName, /* 249 */ Tcl_Ungets, /* 250 */ Tcl_UnlinkVar, /* 251 */ Tcl_UnregisterChannel, /* 252 */ Tcl_UnsetVar, /* 253 */ Tcl_UnsetVar2, /* 254 */ Tcl_UntraceVar, /* 255 */ Tcl_UntraceVar2, /* 256 */ | > > > > > > > > | 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 | Tcl_SetStdChannel, /* 236 */ Tcl_SetVar, /* 237 */ Tcl_SetVar2, /* 238 */ Tcl_SignalId, /* 239 */ Tcl_SignalMsg, /* 240 */ Tcl_SourceRCFile, /* 241 */ Tcl_SplitList, /* 242 */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 243*/ #else /* TCL_NO_FILESYSTEM */ Tcl_SplitPath, /* 243 */ #endif /* TCL_NO_FILESYSTEM */ Tcl_StaticPackage, /* 244 */ Tcl_StringMatch, /* 245 */ Tcl_Tell, /* 246 */ Tcl_TraceVar, /* 247 */ Tcl_TraceVar2, /* 248 */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 249*/ #else /* TCL_NO_FILESYSTEM */ Tcl_TranslateFileName, /* 249 */ #endif /* TCL_NO_FILESYSTEM */ Tcl_Ungets, /* 250 */ Tcl_UnlinkVar, /* 251 */ Tcl_UnregisterChannel, /* 252 */ Tcl_UnsetVar, /* 253 */ Tcl_UnsetVar2, /* 254 */ Tcl_UntraceVar, /* 255 */ Tcl_UntraceVar2, /* 256 */ |
︙ | ︙ | |||
667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 | Tcl_ParseVar, /* 270 */ Tcl_PkgPresent, /* 271 */ Tcl_PkgPresentEx, /* 272 */ Tcl_PkgProvide, /* 273 */ Tcl_PkgRequire, /* 274 */ Tcl_SetErrorCodeVA, /* 275 */ Tcl_VarEvalVA, /* 276 */ Tcl_WaitPid, /* 277 */ #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ Tcl_PanicVA, /* 278 */ #endif /* UNIX */ #ifdef __WIN32__ Tcl_PanicVA, /* 278 */ #endif /* __WIN32__ */ #ifdef MAC_TCL | > > > > | 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 | Tcl_ParseVar, /* 270 */ Tcl_PkgPresent, /* 271 */ Tcl_PkgPresentEx, /* 272 */ Tcl_PkgProvide, /* 273 */ Tcl_PkgRequire, /* 274 */ Tcl_SetErrorCodeVA, /* 275 */ Tcl_VarEvalVA, /* 276 */ #if defined(TCL_NO_PIPES) NULL, /* 277*/ #else /* TCL_NO_PIPES */ Tcl_WaitPid, /* 277 */ #endif /* TCL_NO_PIPES */ #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ Tcl_PanicVA, /* 278 */ #endif /* UNIX */ #ifdef __WIN32__ Tcl_PanicVA, /* 278 */ #endif /* __WIN32__ */ #ifdef MAC_TCL |
︙ | ︙ | |||
711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 | Tcl_GetVar2Ex, /* 306 */ Tcl_InitNotifier, /* 307 */ Tcl_MutexLock, /* 308 */ Tcl_MutexUnlock, /* 309 */ Tcl_ConditionNotify, /* 310 */ Tcl_ConditionWait, /* 311 */ Tcl_NumUtfChars, /* 312 */ Tcl_ReadChars, /* 313 */ Tcl_RestoreResult, /* 314 */ Tcl_SaveResult, /* 315 */ Tcl_SetSystemEncoding, /* 316 */ Tcl_SetVar2Ex, /* 317 */ Tcl_ThreadAlert, /* 318 */ Tcl_ThreadQueueEvent, /* 319 */ Tcl_UniCharAtIndex, /* 320 */ | > > > > | 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 | Tcl_GetVar2Ex, /* 306 */ Tcl_InitNotifier, /* 307 */ Tcl_MutexLock, /* 308 */ Tcl_MutexUnlock, /* 309 */ Tcl_ConditionNotify, /* 310 */ Tcl_ConditionWait, /* 311 */ Tcl_NumUtfChars, /* 312 */ #if defined(TCL_NO_CHANNEL_READ) && defined (TCL_NO_PIPES) NULL, /* 313*/ #else /* TCL_NO_CHANNEL_READ TCL_NO_PIPES */ Tcl_ReadChars, /* 313 */ #endif /* TCL_NO_CHANNEL_READ TCL_NO_PIPES */ Tcl_RestoreResult, /* 314 */ Tcl_SaveResult, /* 315 */ Tcl_SetSystemEncoding, /* 316 */ Tcl_SetVar2Ex, /* 317 */ Tcl_ThreadAlert, /* 318 */ Tcl_ThreadQueueEvent, /* 319 */ Tcl_UniCharAtIndex, /* 320 */ |
︙ | ︙ | |||
739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 | Tcl_UtfToLower, /* 334 */ Tcl_UtfToTitle, /* 335 */ Tcl_UtfToUniChar, /* 336 */ Tcl_UtfToUpper, /* 337 */ Tcl_WriteChars, /* 338 */ Tcl_WriteObj, /* 339 */ Tcl_GetString, /* 340 */ Tcl_GetDefaultEncodingDir, /* 341 */ Tcl_SetDefaultEncodingDir, /* 342 */ Tcl_AlertNotifier, /* 343 */ Tcl_ServiceModeHook, /* 344 */ Tcl_UniCharIsAlnum, /* 345 */ Tcl_UniCharIsAlpha, /* 346 */ Tcl_UniCharIsDigit, /* 347 */ Tcl_UniCharIsLower, /* 348 */ Tcl_UniCharIsSpace, /* 349 */ | > > > > > > > > | 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 | Tcl_UtfToLower, /* 334 */ Tcl_UtfToTitle, /* 335 */ Tcl_UtfToUniChar, /* 336 */ Tcl_UtfToUpper, /* 337 */ Tcl_WriteChars, /* 338 */ Tcl_WriteObj, /* 339 */ Tcl_GetString, /* 340 */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 341*/ #else /* TCL_NO_FILESYSTEM */ Tcl_GetDefaultEncodingDir, /* 341 */ #endif /* TCL_NO_FILESYSTEM */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 342*/ #else /* TCL_NO_FILESYSTEM */ Tcl_SetDefaultEncodingDir, /* 342 */ #endif /* TCL_NO_FILESYSTEM */ Tcl_AlertNotifier, /* 343 */ Tcl_ServiceModeHook, /* 344 */ Tcl_UniCharIsAlnum, /* 345 */ Tcl_UniCharIsAlpha, /* 346 */ Tcl_UniCharIsDigit, /* 347 */ Tcl_UniCharIsLower, /* 348 */ Tcl_UniCharIsSpace, /* 349 */ |
︙ | ︙ | |||
763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 | Tcl_FreeParse, /* 358 */ Tcl_LogCommandInfo, /* 359 */ Tcl_ParseBraces, /* 360 */ Tcl_ParseCommand, /* 361 */ Tcl_ParseExpr, /* 362 */ Tcl_ParseQuotedString, /* 363 */ Tcl_ParseVarName, /* 364 */ Tcl_GetCwd, /* 365 */ Tcl_Chdir, /* 366 */ Tcl_Access, /* 367 */ Tcl_Stat, /* 368 */ Tcl_UtfNcmp, /* 369 */ Tcl_UtfNcasecmp, /* 370 */ Tcl_StringCaseMatch, /* 371 */ Tcl_UniCharIsControl, /* 372 */ Tcl_UniCharIsGraph, /* 373 */ Tcl_UniCharIsPrint, /* 374 */ Tcl_UniCharIsPunct, /* 375 */ | > > > > > > > > > > > > > > > > | 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 | Tcl_FreeParse, /* 358 */ Tcl_LogCommandInfo, /* 359 */ Tcl_ParseBraces, /* 360 */ Tcl_ParseCommand, /* 361 */ Tcl_ParseExpr, /* 362 */ Tcl_ParseQuotedString, /* 363 */ Tcl_ParseVarName, /* 364 */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 365*/ #else /* TCL_NO_FILESYSTEM */ Tcl_GetCwd, /* 365 */ #endif /* TCL_NO_FILESYSTEM */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 366*/ #else /* TCL_NO_FILESYSTEM */ Tcl_Chdir, /* 366 */ #endif /* TCL_NO_FILESYSTEM */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 367*/ #else /* TCL_NO_FILESYSTEM */ Tcl_Access, /* 367 */ #endif /* TCL_NO_FILESYSTEM */ #if defined(TCL_NO_FILESYSTEM) NULL, /* 368*/ #else /* TCL_NO_FILESYSTEM */ Tcl_Stat, /* 368 */ #endif /* TCL_NO_FILESYSTEM */ Tcl_UtfNcmp, /* 369 */ Tcl_UtfNcasecmp, /* 370 */ Tcl_StringCaseMatch, /* 371 */ Tcl_UniCharIsControl, /* 372 */ Tcl_UniCharIsGraph, /* 373 */ Tcl_UniCharIsPrint, /* 374 */ Tcl_UniCharIsPunct, /* 375 */ |
︙ | ︙ |
Changes to generic/tclUtil.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * tclUtil.c -- * * This file contains utility procedures that are used by many Tcl * commands. * * Copyright (c) 1987-1993 The Regents of the University of California. * Copyright (c) 1994-1998 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /* * tclUtil.c -- * * This file contains utility procedures that are used by many Tcl * commands. * * Copyright (c) 1987-1993 The Regents of the University of California. * Copyright (c) 1994-1998 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: tclUtil.c,v 1.17.2.1.2.1 2001/11/28 17:58:37 andreas_kupries Exp $ */ #include "tclInt.h" #include "tclPort.h" /* * The following variable holds the full path name of the binary |
︙ | ︙ | |||
2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 | * * Side effects: * None. * *---------------------------------------------------------------------- */ char * Tcl_GetCwd(interp, cwdPtr) Tcl_Interp *interp; Tcl_DString *cwdPtr; { return TclpGetCwd(interp, cwdPtr); } /* *---------------------------------------------------------------------- * * Tcl_Chdir -- * * This function replaces the library version of chdir(). * * Results: * See chdir() documentation. * * Side effects: * See chdir() documentation. * *---------------------------------------------------------------------- */ int Tcl_Chdir(dirName) CONST char *dirName; { return TclpChdir(dirName); } /* *---------------------------------------------------------------------- * * Tcl_Access -- * * This function replaces the library version of access(). * * Results: * See access() documentation. * * Side effects: * See access() documentation. * *---------------------------------------------------------------------- */ int Tcl_Access(path, mode) CONST char *path; /* Path of file to access (UTF-8). */ int mode; /* Permission setting. */ { return TclAccess(path, mode); } /* *---------------------------------------------------------------------- * * Tcl_Stat -- * * This function replaces the library version of stat(). * * Results: * See stat() documentation. * * Side effects: * See stat() documentation. * *---------------------------------------------------------------------- */ int Tcl_Stat(path, bufPtr) CONST char *path; /* Path of file to stat (in UTF-8). */ struct stat *bufPtr; /* Filled with results of stat call. */ { return TclStat(path, bufPtr); } | > > > > > > > > > > | 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 | * * Side effects: * None. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM char * Tcl_GetCwd(interp, cwdPtr) Tcl_Interp *interp; Tcl_DString *cwdPtr; { return TclpGetCwd(interp, cwdPtr); } #endif /* *---------------------------------------------------------------------- * * Tcl_Chdir -- * * This function replaces the library version of chdir(). * * Results: * See chdir() documentation. * * Side effects: * See chdir() documentation. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM int Tcl_Chdir(dirName) CONST char *dirName; { return TclpChdir(dirName); } #endif /* *---------------------------------------------------------------------- * * Tcl_Access -- * * This function replaces the library version of access(). * * Results: * See access() documentation. * * Side effects: * See access() documentation. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM int Tcl_Access(path, mode) CONST char *path; /* Path of file to access (UTF-8). */ int mode; /* Permission setting. */ { return TclAccess(path, mode); } #endif /* *---------------------------------------------------------------------- * * Tcl_Stat -- * * This function replaces the library version of stat(). * * Results: * See stat() documentation. * * Side effects: * See stat() documentation. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM int Tcl_Stat(path, bufPtr) CONST char *path; /* Path of file to stat (in UTF-8). */ struct stat *bufPtr; /* Filled with results of stat call. */ { return TclStat(path, bufPtr); } #endif |
Added static.sizes.html.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | <html><head><title>Static sizes</title></head><body> <h1>Library sizes</h1> <p><table border=1> <tr><td> </td> <td>lib/libtcl8.3.a</td> <td>lib/libtcl8.3.a %</td> <td></td> <td>lib/libtcl8.3.a d%</td> <td>ENV_FLAGS </td></tr> <tr><td>baseline </td> <td>490124 </td> <td>100.00 </td> <td></td> <td>0.00 </td> <td> </td></tr> <tr><td>cut_eof </td> <td>489964 </td> <td>99.97 </td> <td></td> <td>0.03 </td> <td>-DTCL_NO_CHANNEL_EOF </td></tr> <tr><td>cut_blocked </td> <td>489940 </td> <td>99.96 </td> <td></td> <td>0.04 </td> <td>-DTCL_NO_CHANNEL_BLOCKED </td></tr> <tr><td>cut_pid </td> <td>489824 </td> <td>99.94 </td> <td></td> <td>0.06 </td> <td>-DTCL_NO_PIDCMD </td></tr> <tr><td>cut_read </td> <td>489420 </td> <td>99.86 </td> <td></td> <td>0.14 </td> <td>-DTCL_NO_CHANNEL_READ </td></tr> <tr><td>cut_tty </td> <td>488268 </td> <td>99.62 </td> <td></td> <td>0.38 </td> <td>-DTCL_NO_TTY </td></tr> <tr><td>cut_copy </td> <td>488032 </td> <td>99.57 </td> <td></td> <td>0.43 </td> <td>-DTCL_NO_CHANNELCOPY </td></tr> <tr><td>cut_load </td> <td>487264 </td> <td>99.42 </td> <td></td> <td>0.58 </td> <td>-DTCL_NO_LOADCMD </td></tr> <tr><td>cut_alias </td> <td>486576 </td> <td>99.28 </td> <td></td> <td>0.72 </td> <td>-DTCL_NO_CMDALIASES </td></tr> <tr><td>cut_slave </td> <td>485080 </td> <td>98.97 </td> <td></td> <td>1.03 </td> <td>-DTCL_NO_SLAVEINTERP </td></tr> <tr><td>cut_config </td> <td>484932 </td> <td>98.94 </td> <td></td> <td>1.06 </td> <td>-DTCL_NO_CHANNEL_CONFIG </td></tr> <tr><td>cut_sock </td> <td>484428 </td> <td>98.84 </td> <td></td> <td>1.16 </td> <td>-DTCL_NO_SOCKETS </td></tr> <tr><td>cut_fev </td> <td>484376 </td> <td>98.83 </td> <td></td> <td>1.17 </td> <td>-DTCL_NO_FILEEVENTS </td></tr> <tr><td>cut_interp </td> <td>480624 </td> <td>98.06 </td> <td></td> <td>1.94 </td> <td>-DTCL_NO_SLAVEINTERP -DTCL_NO_CMDALIASES</td></tr> <tr><td>cut_pipes </td> <td>480136 </td> <td>97.96 </td> <td></td> <td>2.04 </td> <td>-DTCL_NO_PIPES </td></tr> <tr><td>cut_nonstdchan</td> <td>463544 </td> <td>94.58 </td> <td></td> <td>5.42 </td> <td>-DTCL_NO_NONSTDCHAN </td></tr> <tr><td>cut_fs </td> <td>440940 </td> <td>89.96 </td> <td></td> <td>10.04 </td> <td>-DTCL_NO_FILESYSTEM </td></tr> <tr><td>cut </td> <td>403228 </td> <td>82.27 </td> <td></td> <td>17.73 </td> <td>-DMODULAR_TCL </td></tr> </table></p> <h1>Object file sizes</h1> <p><table border=1> <tr><td> </td> <td>baseline</td> <td>cut </td> <td>cut_alias</td> <td>cut_blocked</td> <td>cut_config</td> <td>cut_copy</td> <td>cut_eof</td> <td>cut_fev</td> <td>cut_fs</td> <td>cut_interp</td> <td>cut_load</td> <td>cut_nonstdchan</td> <td>cut_pid</td> <td>cut_pipes</td> <td>cut_read</td> <td>cut_slave</td> <td>cut_sock</td> <td>cut_tty</td></tr> <tr><td>tclBasic.o </td> <td>16656 </td> <td>16144</td> <td>16592 </td> <td>16624 </td> <td>16624 </td> <td>16624 </td> <td>16624 </td> <td>16624 </td> <td>16464 </td> <td>16592 </td> <td>16624 </td> <td>16496 </td> <td>16624 </td> <td>16624 </td> <td>16624 </td> <td>16656 </td> <td>16624 </td> <td>16656 </td></tr> <tr><td>tclCmdAH.o </td> <td>14228 </td> <td>9108 </td> <td>14228 </td> <td>14228 </td> <td>14228 </td> <td>14228 </td> <td>14228 </td> <td>14228 </td> <td>9108 </td> <td>14228 </td> <td>14228 </td> <td>14228 </td> <td>14228 </td> <td>14228 </td> <td>14228 </td> <td>14228 </td> <td>14228 </td> <td>14228 </td></tr> <tr><td>tclCmdMZ.o </td> <td>17160 </td> <td>17000</td> <td>17160 </td> <td>17160 </td> <td>17160 </td> <td>17160 </td> <td>17160 </td> <td>17160 </td> <td>17000 </td> <td>17160 </td> <td>17160 </td> <td>17096 </td> <td>17160 </td> <td>17160 </td> <td>17160 </td> <td>17160 </td> <td>17160 </td> <td>17160 </td></tr> <tr><td>tclEncoding.o </td> <td>10008 </td> <td>3488 </td> <td>10008 </td> <td>10008 </td> <td>10008 </td> <td>10008 </td> <td>10008 </td> <td>10008 </td> <td>3488 </td> <td>10008 </td> <td>10008 </td> <td>4364 </td> <td>10008 </td> <td>10008 </td> <td>10008 </td> <td>10008 </td> <td>10008 </td> <td>10008 </td></tr> <tr><td>tclEvent.o </td> <td>4036 </td> <td>3844 </td> <td>4036 </td> <td>4036 </td> <td>4036 </td> <td>4036 </td> <td>4036 </td> <td>4036 </td> <td>3844 </td> <td>4036 </td> <td>4036 </td> <td>4036 </td> <td>4036 </td> <td>4036 </td> <td>4036 </td> <td>4036 </td> <td>4036 </td> <td>4036 </td></tr> <tr><td>tclFCmd.o </td> <td>5272 </td> <td>472 </td> <td>5272 </td> <td>5272 </td> <td>5272 </td> <td>5272 </td> <td>5272 </td> <td>5272 </td> <td>472 </td> <td>5272 </td> <td>5272 </td> <td>5272 </td> <td>5272 </td> <td>5272 </td> <td>5272 </td> <td>5272 </td> <td>5272 </td> <td>5272 </td></tr> <tr><td>tclFileName.o </td> <td>12020 </td> <td>472 </td> <td>12020 </td> <td>12020 </td> <td>12020 </td> <td>12020 </td> <td>12020 </td> <td>12020 </td> <td>472 </td> <td>12020 </td> <td>12020 </td> <td>12020 </td> <td>12020 </td> <td>12020 </td> <td>12020 </td> <td>12020 </td> <td>12020 </td> <td>12020 </td></tr> <tr><td>tclIO.o </td> <td>25296 </td> <td>17724</td> <td>25296 </td> <td>25296 </td> <td>23824 </td> <td>23728 </td> <td>25296 </td> <td>22748 </td> <td>25296 </td> <td>25296 </td> <td>25296 </td> <td>24848 </td> <td>25296 </td> <td>25296 </td> <td>25296 </td> <td>25296 </td> <td>25296 </td> <td>25296 </td></tr> <tr><td>tclIOCmd.o </td> <td>7860 </td> <td>2020 </td> <td>7860 </td> <td>7668 </td> <td>7412 </td> <td>7368 </td> <td>7732 </td> <td>6996 </td> <td>6588 </td> <td>7860 </td> <td>7860 </td> <td>3932 </td> <td>7860 </td> <td>6940 </td> <td>7188 </td> <td>7860 </td> <td>5716 </td> <td>7860 </td></tr> <tr><td>tclIOGT.o </td> <td>3760 </td> <td>484 </td> <td>3760 </td> <td>3760 </td> <td>484 </td> <td>3760 </td> <td>3760 </td> <td>3536 </td> <td>3760 </td> <td>3760 </td> <td>3760 </td> <td>3760 </td> <td>3760 </td> <td>3760 </td> <td>3760 </td> <td>3760 </td> <td>3760 </td> <td>3760 </td></tr> <tr><td>tclIOUtil.o </td> <td>3300 </td> <td>1976 </td> <td>3300 </td> <td>3300 </td> <td>3300 </td> <td>3300 </td> <td>3300 </td> <td>3300 </td> <td>1976 </td> <td>3300 </td> <td>3300 </td> <td>2764 </td> <td>3300 </td> <td>3300 </td> <td>3300 </td> <td>3300 </td> <td>3300 </td> <td>3300 </td></tr> <tr><td>tclInterp.o </td> <td>10196 </td> <td>948 </td> <td>6676 </td> <td>10196 </td> <td>10196 </td> <td>10196 </td> <td>10196 </td> <td>10196 </td> <td>10196 </td> <td>948 </td> <td>10196 </td> <td>9876 </td> <td>10196 </td> <td>10196 </td> <td>10196 </td> <td>5340 </td> <td>10196 </td> <td>10196 </td></tr> <tr><td>tclLoad.o </td> <td>3556 </td> <td>1140 </td> <td>3556 </td> <td>3556 </td> <td>3556 </td> <td>3556 </td> <td>3556 </td> <td>3556 </td> <td>1292 </td> <td>3332 </td> <td>1292 </td> <td>3556 </td> <td>3556 </td> <td>3556 </td> <td>3556 </td> <td>3332 </td> <td>3556 </td> <td>3556 </td></tr> <tr><td>tclLoadDl.o </td> <td>1044 </td> <td>480 </td> <td>1044 </td> <td>1044 </td> <td>1044 </td> <td>1044 </td> <td>1044 </td> <td>1044 </td> <td>1044 </td> <td>1044 </td> <td>480 </td> <td>1044 </td> <td>1044 </td> <td>1044 </td> <td>1044 </td> <td>1044 </td> <td>1044 </td> <td>1044 </td></tr> <tr><td>tclMain.o </td> <td>3296 </td> <td>2656 </td> <td>3296 </td> <td>3296 </td> <td>3296 </td> <td>3296 </td> <td>3296 </td> <td>2816 </td> <td>3136 </td> <td>3296 </td> <td>3296 </td> <td>3136 </td> <td>3296 </td> <td>3296 </td> <td>3296 </td> <td>3296 </td> <td>3296 </td> <td>3296 </td></tr> <tr><td>tclPipe.o </td> <td>6040 </td> <td>472 </td> <td>6040 </td> <td>6040 </td> <td>6040 </td> <td>6040 </td> <td>6040 </td> <td>6040 </td> <td>1940 </td> <td>6040 </td> <td>6040 </td> <td>472 </td> <td>6040 </td> <td>472 </td> <td>6040 </td> <td>6040 </td> <td>6040 </td> <td>6040 </td></tr> <tr><td>tclUnixChan.o </td> <td>9036 </td> <td>3084 </td> <td>9036 </td> <td>9036 </td> <td>9036 </td> <td>9036 </td> <td>9036 </td> <td>8524 </td> <td>8300 </td> <td>9036 </td> <td>9036 </td> <td>3148 </td> <td>9036 </td> <td>9036 </td> <td>9036 </td> <td>9036 </td> <td>5708 </td> <td>7180 </td></tr> <tr><td>tclUnixFCmd.o </td> <td>6604 </td> <td>472 </td> <td>6604 </td> <td>6604 </td> <td>6604 </td> <td>6604 </td> <td>6604 </td> <td>6604 </td> <td>472 </td> <td>6604 </td> <td>6604 </td> <td>6604 </td> <td>6604 </td> <td>6604 </td> <td>6604 </td> <td>6604 </td> <td>6604 </td> <td>6604 </td></tr> <tr><td>tclUnixFile.o </td> <td>3324 </td> <td>472 </td> <td>3324 </td> <td>3324 </td> <td>3324 </td> <td>3324 </td> <td>3324 </td> <td>3324 </td> <td>472 </td> <td>3324 </td> <td>3324 </td> <td>3324 </td> <td>3324 </td> <td>3324 </td> <td>3324 </td> <td>3324 </td> <td>3324 </td> <td>3324 </td></tr> <tr><td>tclUnixInit.o </td> <td>6000 </td> <td>4312 </td> <td>6036 </td> <td>6040 </td> <td>6036 </td> <td>6000 </td> <td>6000 </td> <td>6000 </td> <td>4316 </td> <td>6036 </td> <td>6000 </td> <td>5832 </td> <td>6000 </td> <td>6036 </td> <td>6000 </td> <td>6036 </td> <td>6000 </td> <td>6000 </td></tr> <tr><td>tclUnixNotfy.o</td> <td>1784 </td> <td>856 </td> <td>1784 </td> <td>1784 </td> <td>1784 </td> <td>1784 </td> <td>1784 </td> <td>856 </td> <td>1784 </td> <td>1784 </td> <td>1784 </td> <td>1784 </td> <td>1784 </td> <td>1784 </td> <td>1784 </td> <td>1784 </td> <td>1784 </td> <td>1784 </td></tr> <tr><td>tclUnixPipe.o </td> <td>4196 </td> <td>472 </td> <td>4196 </td> <td>4196 </td> <td>4196 </td> <td>4196 </td> <td>4196 </td> <td>4036 </td> <td>4196 </td> <td>4196 </td> <td>4196 </td> <td>692 </td> <td>3928 </td> <td>692 </td> <td>4196 </td> <td>4196 </td> <td>4196 </td> <td>4196 </td></tr> <tr><td>tclUnixSock.o </td> <td>760 </td> <td>568 </td> <td>760 </td> <td>760 </td> <td>760 </td> <td>760 </td> <td>760 </td> <td>760 </td> <td>760 </td> <td>760 </td> <td>760 </td> <td>568 </td> <td>760 </td> <td>760 </td> <td>760 </td> <td>760 </td> <td>568 </td> <td>760 </td></tr> <tr><td>tclUtil.o </td> <td>8600 </td> <td>8472 </td> <td>8600 </td> <td>8600 </td> <td>8600 </td> <td>8600 </td> <td>8600 </td> <td>8600 </td> <td>8472 </td> <td>8600 </td> <td>8600 </td> <td>8600 </td> <td>8600 </td> <td>8600 </td> <td>8600 </td> <td>8600 </td> <td>8600 </td> <td>8600 </td></tr> <tr><td>Sigma </td> <td>184032 </td> <td>97136</td> <td>180484 </td> <td>183848 </td> <td>178840 </td> <td>181940 </td> <td>183872 </td> <td>178284 </td> <td>134848</td> <td>174532 </td> <td>181172 </td> <td>157452 </td> <td>183732 </td> <td>174044 </td> <td>183328 </td> <td>178988 </td> <td>178336 </td> <td>182176 </td></tr> <tr><td>% </td> <td>100.00 </td> <td>52.78</td> <td>98.07 </td> <td>99.90 </td> <td>97.18 </td> <td>98.86 </td> <td>99.91 </td> <td>96.88 </td> <td>73.27 </td> <td>94.84 </td> <td>98.45 </td> <td>85.56 </td> <td>99.84 </td> <td>94.57 </td> <td>99.62 </td> <td>97.26 </td> <td>96.90 </td> <td>98.99 </td></tr> </table></p> </body></html> |
Changes to tools/genStubs.tcl.
1 2 3 4 5 6 7 8 9 10 | # genStubs.tcl -- # # This script generates a set of stub files for a given # interface. # # # Copyright (c) 1998-1999 by Scriptics Corporation. # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # genStubs.tcl -- # # This script generates a set of stub files for a given # interface. # # # Copyright (c) 1998-1999 by Scriptics Corporation. # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # RCS: @(#) $Id: genStubs.tcl,v 1.7.10.1.2.1 2001/11/28 17:58:37 andreas_kupries Exp $ package require Tcl 8 namespace eval genStubs { # libraryName -- # # The name of the entire library. This value is used to compute |
︙ | ︙ | |||
129 130 131 132 133 134 135 | # Results: # None. proc genStubs::declare {args} { variable stubs variable curName | | > | > > > > | | 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | # Results: # None. proc genStubs::declare {args} { variable stubs variable curName if {[llength $args] != 3 && [llength $args] != 4} { puts stderr "wrong # args: declare $args" } if {[llength $args] == 3} { lassign $args index platformList decl set supressorList {} } else { lassign $args index platformList supressorList decl } # Check for duplicate declarations, then add the declaration and # bump the lastNum counter if necessary. foreach platform $platformList { if {[info exists stubs($curName,$platform,$index)]} { puts stderr "Duplicate entry: declare $args" } } regsub -all "\[ \t\n\]+" [string trim $decl] " " decl set decl [parseDecl $decl] foreach platform $platformList { if {$decl != ""} { set stubs($curName,$platform,$index) [list $decl $supressorList] if {![info exists stubs($curName,$platform,lastNum)] \ || ($index > $stubs($curName,$platform,lastNum))} { set stubs($curName,$platform,lastNum) $index } } } return |
︙ | ︙ | |||
344 345 346 347 348 349 350 351 352 353 354 355 356 357 | # decl The function declaration. # index The slot index for this function. # # Results: # Returns the formatted declaration string. proc genStubs::makeDecl {name decl index} { lassign $decl rtype fname args append text "/* $index */\n" set line "EXTERN $rtype" set count [expr {2 - ([string length $line] / 8)}] append line [string range "\t\t\t" 0 $count] set pad [expr {24 - [string length $line]}] | > | 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | # decl The function declaration. # index The slot index for this function. # # Results: # Returns the formatted declaration string. proc genStubs::makeDecl {name decl index} { set decl [lindex $decl 0] lassign $decl rtype fname args append text "/* $index */\n" set line "EXTERN $rtype" set count [expr {2 - ([string length $line] / 8)}] append line [string range "\t\t\t" 0 $count] set pad [expr {24 - [string length $line]}] |
︙ | ︙ | |||
404 405 406 407 408 409 410 411 412 413 414 415 416 417 | # decl The function declaration. # index The slot index for this function. # # Results: # Returns the formatted macro definition. proc genStubs::makeMacro {name decl index} { lassign $decl rtype fname args set lfname [string tolower [string index $fname 0]] append lfname [string range $fname 1 end] set text "#ifndef $fname\n#define $fname" set arg1 [lindex $args 0] | > | 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 | # decl The function declaration. # index The slot index for this function. # # Results: # Returns the formatted macro definition. proc genStubs::makeMacro {name decl index} { set decl [lindex $decl 0] lassign $decl rtype fname args set lfname [string tolower [string index $fname 0]] append lfname [string range $fname 1 end] set text "#ifndef $fname\n#define $fname" set arg1 [lindex $args 0] |
︙ | ︙ | |||
445 446 447 448 449 450 451 452 453 454 455 456 457 458 | # decl The function declaration. # index The slot index for this function. # # Results: # Returns the formatted stub function definition. proc genStubs::makeStub {name decl index} { lassign $decl rtype fname args set lfname [string tolower [string index $fname 0]] append lfname [string range $fname 1 end] append text "/* Slot $index */\n" $rtype "\n" $fname | > | 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 | # decl The function declaration. # index The slot index for this function. # # Results: # Returns the formatted stub function definition. proc genStubs::makeStub {name decl index} { set decl [lindex $decl 0] lassign $decl rtype fname args set lfname [string tolower [string index $fname 0]] append lfname [string range $fname 1 end] append text "/* Slot $index */\n" $rtype "\n" $fname |
︙ | ︙ | |||
510 511 512 513 514 515 516 517 518 519 520 521 522 523 | # decl The function declaration. # index The slot index for this function. # # Results: # Returns the formatted table entry. proc genStubs::makeSlot {name decl index} { lassign $decl rtype fname args set lfname [string tolower [string index $fname 0]] append lfname [string range $fname 1 end] set text " " append text $rtype " (*" $lfname ") _ANSI_ARGS_(" | > | 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 | # decl The function declaration. # index The slot index for this function. # # Results: # Returns the formatted table entry. proc genStubs::makeSlot {name decl index} { set decl [lindex $decl 0] ; # ignore supressors here. lassign $decl rtype fname args set lfname [string tolower [string index $fname 0]] append lfname [string range $fname 1 end] set text " " append text $rtype " (*" $lfname ") _ANSI_ARGS_(" |
︙ | ︙ | |||
555 556 557 558 559 560 561 | # decl The function declaration. # index The slot index for this function. # # Results: # Returns the formatted declaration string. proc genStubs::makeInit {name decl index} { | > > > > > > > > > > > > > | > > > > | 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 | # decl The function declaration. # index The slot index for this function. # # Results: # Returns the formatted declaration string. proc genStubs::makeInit {name decl index} { lassign $decl decl suppressors if {[llength $suppressors] > 0} { set sup [list] foreach s $suppressors { if {[llength $s] > 1} { lappend sup "defined([join $s ") && defined ("])" } else { lappend sup "defined($s)" } } append text "#if " [join $sup " || "] "\n" append text " NULL, /* " $index "*/\n" append text "#else /* " [join $suppressors] " */\n" append text " " [lindex $decl 1] ", /* " $index " */\n" append text "#endif /* " [join $suppressors] " */\n" } else { append text " " [lindex $decl 1] ", /* " $index " */\n" } return $text } # genStubs::forAllStubs -- # # This function iterates over all of the platforms and invokes # a callback for each slot. The result of the callback is then |
︙ | ︙ |
Changes to unix/tclLoadAout.c.
︙ | ︙ | |||
10 11 12 13 14 15 16 | * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * This work was supported in part by the ARPA Manufacturing Automation * and Design Engineering (MADE) Initiative through ARPA contract * F33615-94-C-4400. * | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * This work was supported in part by the ARPA Manufacturing Automation * and Design Engineering (MADE) Initiative through ARPA contract * F33615-94-C-4400. * * RCS: @(#) $Id: tclLoadAout.c,v 1.4.2.1.2.1 2001/11/28 17:58:37 andreas_kupries Exp $ */ #include "tclInt.h" #include <fcntl.h> #ifdef HAVE_EXEC_AOUT_H # include <sys/exec_aout.h> #endif |
︙ | ︙ | |||
136 137 138 139 140 141 142 143 144 145 146 147 148 149 | * the break is advanced beyonnd that point, the load will * fail with an `inconsistent memory allocation' error. * It perhaps ought to retry the link, but the failure has * not been observed in two years of daily use of this function. *---------------------------------------------------------------------- */ int TclpLoadFile(interp, fileName, sym1, sym2, proc1Ptr, proc2Ptr, clientDataPtr) Tcl_Interp *interp; /* Used for error reporting. */ char *fileName; /* Name of the file containing the desired * code (UTF-8). */ char *sym1, *sym2; /* Names of two procedures to look up in * the file's symbol table. */ | > | 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | * the break is advanced beyonnd that point, the load will * fail with an `inconsistent memory allocation' error. * It perhaps ought to retry the link, but the failure has * not been observed in two years of daily use of this function. *---------------------------------------------------------------------- */ #ifndef TCL_NO_LOADCMD int TclpLoadFile(interp, fileName, sym1, sym2, proc1Ptr, proc2Ptr, clientDataPtr) Tcl_Interp *interp; /* Used for error reporting. */ char *fileName; /* Name of the file containing the desired * code (UTF-8). */ char *sym1, *sym2; /* Names of two procedures to look up in * the file's symbol table. */ |
︙ | ︙ | |||
309 310 311 312 313 314 315 316 317 318 319 320 321 322 | dictionary = (DictFn) startAddress; *proc1Ptr = dictionary (sym1); *proc2Ptr = dictionary (sym2); return TCL_OK; } /* *------------------------------------------------------------------------ * * FindLibraries -- * * Find the libraries needed to link a load module at run time. | > | 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | dictionary = (DictFn) startAddress; *proc1Ptr = dictionary (sym1); *proc2Ptr = dictionary (sym2); return TCL_OK; } #endif /* *------------------------------------------------------------------------ * * FindLibraries -- * * Find the libraries needed to link a load module at run time. |
︙ | ︙ |
Changes to unix/tclLoadDl.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * tclLoadDl.c -- * * This procedure provides a version of the TclLoadFile that * works with the "dlopen" and "dlsym" library procedures for * dynamic loading. * * Copyright (c) 1995-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. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /* * tclLoadDl.c -- * * This procedure provides a version of the TclLoadFile that * works with the "dlopen" and "dlsym" library procedures for * dynamic loading. * * Copyright (c) 1995-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: tclLoadDl.c,v 1.3.22.1 2001/11/28 17:58:37 andreas_kupries Exp $ */ #include "tclInt.h" #ifdef NO_DLFCN_H # include "../compat/dlfcn.h" #else # include <dlfcn.h> |
︙ | ︙ | |||
52 53 54 55 56 57 58 59 60 61 62 63 64 65 | * * Side effects: * New code suddenly appears in memory. * *--------------------------------------------------------------------------- */ int TclpLoadFile(interp, fileName, sym1, sym2, proc1Ptr, proc2Ptr, clientDataPtr) Tcl_Interp *interp; /* Used for error reporting. */ char *fileName; /* Name of the file containing the desired * code. */ char *sym1, *sym2; /* Names of two procedures to look up in * the file's symbol table. */ | > | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | * * Side effects: * New code suddenly appears in memory. * *--------------------------------------------------------------------------- */ #ifndef TCL_NO_LOADCMD int TclpLoadFile(interp, fileName, sym1, sym2, proc1Ptr, proc2Ptr, clientDataPtr) Tcl_Interp *interp; /* Used for error reporting. */ char *fileName; /* Name of the file containing the desired * code. */ char *sym1, *sym2; /* Names of two procedures to look up in * the file's symbol table. */ |
︙ | ︙ | |||
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | native); Tcl_DStringFree(&newName); } Tcl_DStringFree(&ds); return TCL_OK; } /* *---------------------------------------------------------------------- * * TclpUnloadFile -- * * Unloads a dynamically loaded binary code file from memory. * Code pointers in the formerly loaded file are no longer valid * after calling this function. * * Results: * None. * * Side effects: * Code removed from memory. * *---------------------------------------------------------------------- */ void TclpUnloadFile(clientData) ClientData clientData; /* ClientData returned by a previous call * to TclpLoadFile(). The clientData is * a token that represents the loaded * file. */ { VOID *handle; handle = (VOID *) clientData; dlclose(handle); } /* *---------------------------------------------------------------------- * * TclGuessPackageName -- * * If the "load" command is invoked without providing a package | > > > | 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | native); Tcl_DStringFree(&newName); } Tcl_DStringFree(&ds); return TCL_OK; } #endif /* *---------------------------------------------------------------------- * * TclpUnloadFile -- * * Unloads a dynamically loaded binary code file from memory. * Code pointers in the formerly loaded file are no longer valid * after calling this function. * * Results: * None. * * Side effects: * Code removed from memory. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_LOADCMD void TclpUnloadFile(clientData) ClientData clientData; /* ClientData returned by a previous call * to TclpLoadFile(). The clientData is * a token that represents the loaded * file. */ { VOID *handle; handle = (VOID *) clientData; dlclose(handle); } #endif /* *---------------------------------------------------------------------- * * TclGuessPackageName -- * * If the "load" command is invoked without providing a package |
︙ | ︙ |
Changes to unix/tclLoadDld.c.
︙ | ︙ | |||
8 9 10 11 12 13 14 | * makes more sense to use "dl_open" etc. * * Copyright (c) 1995-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. * | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | * makes more sense to use "dl_open" etc. * * Copyright (c) 1995-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: tclLoadDld.c,v 1.3.22.1 2001/11/28 17:58:37 andreas_kupries Exp $ */ #include "tclInt.h" #include "dld.h" /* * In some systems, like SunOS 4.1.3, the RTLD_NOW flag isn't defined |
︙ | ︙ | |||
44 45 46 47 48 49 50 51 52 53 54 55 56 57 | * * Side effects: * New code suddenly appears in memory. * *---------------------------------------------------------------------- */ int TclpLoadFile(interp, fileName, sym1, sym2, proc1Ptr, proc2Ptr, clientDataPtr) Tcl_Interp *interp; /* Used for error reporting. */ char *fileName; /* Name of the file containing the desired * code. */ char *sym1, *sym2; /* Names of two procedures to look up in * the file's symbol table. */ | > | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | * * Side effects: * New code suddenly appears in memory. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_LOADCMD int TclpLoadFile(interp, fileName, sym1, sym2, proc1Ptr, proc2Ptr, clientDataPtr) Tcl_Interp *interp; /* Used for error reporting. */ char *fileName; /* Name of the file containing the desired * code. */ char *sym1, *sym2; /* Names of two procedures to look up in * the file's symbol table. */ |
︙ | ︙ | |||
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | } *proc1Ptr = (Tcl_PackageInitProc *) dld_get_func(sym1); *proc2Ptr = (Tcl_PackageInitProc *) dld_get_func(sym2); *clientDataPtr = strcpy( (char *) ckalloc((unsigned) (strlen(fileName) + 1)), fileName); return TCL_OK; } /* *---------------------------------------------------------------------- * * TclpUnloadFile -- * * Unloads a dynamically loaded binary code file from memory. * Code pointers in the formerly loaded file are no longer valid * after calling this function. * * Results: * None. * * Side effects: * Code removed from memory. * *---------------------------------------------------------------------- */ void TclpUnloadFile(clientData) ClientData clientData; /* ClientData returned by a previous call * to TclpLoadFile(). The clientData is * a token that represents the loaded * file. */ { char *fileName; handle = (char *) clientData; dld_unlink_by_file(handle, 0); ckfree(handle); } /* *---------------------------------------------------------------------- * * TclGuessPackageName -- * * If the "load" command is invoked without providing a package | > > > | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | } *proc1Ptr = (Tcl_PackageInitProc *) dld_get_func(sym1); *proc2Ptr = (Tcl_PackageInitProc *) dld_get_func(sym2); *clientDataPtr = strcpy( (char *) ckalloc((unsigned) (strlen(fileName) + 1)), fileName); return TCL_OK; } #endif /* *---------------------------------------------------------------------- * * TclpUnloadFile -- * * Unloads a dynamically loaded binary code file from memory. * Code pointers in the formerly loaded file are no longer valid * after calling this function. * * Results: * None. * * Side effects: * Code removed from memory. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_LOADCMD void TclpUnloadFile(clientData) ClientData clientData; /* ClientData returned by a previous call * to TclpLoadFile(). The clientData is * a token that represents the loaded * file. */ { char *fileName; handle = (char *) clientData; dld_unlink_by_file(handle, 0); ckfree(handle); } #endif /* *---------------------------------------------------------------------- * * TclGuessPackageName -- * * If the "load" command is invoked without providing a package |
︙ | ︙ |
Changes to unix/tclLoadDyld.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tclLoadDyld.c -- * * This procedure provides a version of the TclLoadFile that * works with Apple's dyld dynamic loading. This file * provided by Wilfredo Sanchez ([email protected]). * This works on Mac OS X. * * Copyright (c) 1995 Apple Computer, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | /* * tclLoadDyld.c -- * * This procedure provides a version of the TclLoadFile that * works with Apple's dyld dynamic loading. This file * provided by Wilfredo Sanchez ([email protected]). * This works on Mac OS X. * * Copyright (c) 1995 Apple Computer, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclLoadDyld.c,v 1.2.2.2.2.1 2001/11/28 17:58:37 andreas_kupries Exp $ */ #include "tclInt.h" #include <mach-o/dyld.h> /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
34 35 36 37 38 39 40 41 42 43 44 45 46 47 | * * Side effects: * New code suddenly appears in memory. * *---------------------------------------------------------------------- */ int TclpLoadFile(interp, fileName, sym1, sym2, proc1Ptr, proc2Ptr, clientDataPtr) Tcl_Interp *interp; /* Used for error reporting. */ char *fileName; /* Name of the file containing the desired * code. */ char *sym1, *sym2; /* Names of two procedures to look up in * the file's symbol table. */ | > | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | * * Side effects: * New code suddenly appears in memory. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_LOADCMD int TclpLoadFile(interp, fileName, sym1, sym2, proc1Ptr, proc2Ptr, clientDataPtr) Tcl_Interp *interp; /* Used for error reporting. */ char *fileName; /* Name of the file containing the desired * code. */ char *sym1, *sym2; /* Names of two procedures to look up in * the file's symbol table. */ |
︙ | ︙ | |||
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | *proc2Ptr=NULL; } Tcl_DStringFree(&newName); Tcl_DStringFree(&ds); return TCL_OK; } /* *---------------------------------------------------------------------- * * TclpUnloadFile -- * * Unloads a dynamically loaded binary code file from memory. * Code pointers in the formerly loaded file are no longer valid * after calling this function. * * Results: * None. * * Side effects: * Code dissapears from memory. * Note that this is a no-op on older (OpenStep) versions of dyld. * *---------------------------------------------------------------------- */ void TclpUnloadFile(clientData) ClientData clientData; /* ClientData returned by a previous call * to TclpLoadFile(). The clientData is * a token that represents the loaded * file. */ { NSUnLinkModule(clientData, FALSE); } /* *---------------------------------------------------------------------- * * TclGuessPackageName -- * * If the "load" command is invoked without providing a package | > > > | 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | *proc2Ptr=NULL; } Tcl_DStringFree(&newName); Tcl_DStringFree(&ds); return TCL_OK; } #endif /* *---------------------------------------------------------------------- * * TclpUnloadFile -- * * Unloads a dynamically loaded binary code file from memory. * Code pointers in the formerly loaded file are no longer valid * after calling this function. * * Results: * None. * * Side effects: * Code dissapears from memory. * Note that this is a no-op on older (OpenStep) versions of dyld. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_LOADCMD void TclpUnloadFile(clientData) ClientData clientData; /* ClientData returned by a previous call * to TclpLoadFile(). The clientData is * a token that represents the loaded * file. */ { NSUnLinkModule(clientData, FALSE); } #endif /* *---------------------------------------------------------------------- * * TclGuessPackageName -- * * If the "load" command is invoked without providing a package |
︙ | ︙ |
Changes to unix/tclLoadNext.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * tclLoadNext.c -- * * This procedure provides a version of the TclLoadFile that * works with NeXTs rld_* dynamic loading. This file provided * by Pedja Bogdanovich. * * Copyright (c) 1995-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. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /* * tclLoadNext.c -- * * This procedure provides a version of the TclLoadFile that * works with NeXTs rld_* dynamic loading. This file provided * by Pedja Bogdanovich. * * Copyright (c) 1995-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: tclLoadNext.c,v 1.3.22.1 2001/11/28 17:58:37 andreas_kupries Exp $ */ #include "tclInt.h" #include <mach-o/rld.h> #include <streams/streams.h> /* |
︙ | ︙ | |||
34 35 36 37 38 39 40 41 42 43 44 45 46 47 | * * Side effects: * New code suddenly appears in memory. * *---------------------------------------------------------------------- */ int TclpLoadFile(interp, fileName, sym1, sym2, proc1Ptr, proc2Ptr, clientDataPtr) Tcl_Interp *interp; /* Used for error reporting. */ char *fileName; /* Name of the file containing the desired * code. */ char *sym1, *sym2; /* Names of two procedures to look up in * the file's symbol table. */ | > | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | * * Side effects: * New code suddenly appears in memory. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_LOADCMD int TclpLoadFile(interp, fileName, sym1, sym2, proc1Ptr, proc2Ptr, clientDataPtr) Tcl_Interp *interp; /* Used for error reporting. */ char *fileName; /* Name of the file containing the desired * code. */ char *sym1, *sym2; /* Names of two procedures to look up in * the file's symbol table. */ |
︙ | ︙ | |||
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | sym[0]='_'; sym[1]=0; strcat(sym,sym2); rld_lookup(NULL,sym,(unsigned long *)proc2Ptr); } *clientDataPtr = NULL; return TCL_OK; } /* *---------------------------------------------------------------------- * * TclpUnloadFile -- * * Unloads a dynamically loaded binary code file from memory. * Code pointers in the formerly loaded file are no longer valid * after calling this function. * * Results: * None. * * Side effects: * Does nothing. Can anything be done? * *---------------------------------------------------------------------- */ void TclpUnloadFile(clientData) ClientData clientData; /* ClientData returned by a previous call * to TclpLoadFile(). The clientData is * a token that represents the loaded * file. */ { } /* *---------------------------------------------------------------------- * * TclGuessPackageName -- * * If the "load" command is invoked without providing a package | > > > | 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | sym[0]='_'; sym[1]=0; strcat(sym,sym2); rld_lookup(NULL,sym,(unsigned long *)proc2Ptr); } *clientDataPtr = NULL; return TCL_OK; } #endif /* *---------------------------------------------------------------------- * * TclpUnloadFile -- * * Unloads a dynamically loaded binary code file from memory. * Code pointers in the formerly loaded file are no longer valid * after calling this function. * * Results: * None. * * Side effects: * Does nothing. Can anything be done? * *---------------------------------------------------------------------- */ #ifndef TCL_NO_LOADCMD void TclpUnloadFile(clientData) ClientData clientData; /* ClientData returned by a previous call * to TclpLoadFile(). The clientData is * a token that represents the loaded * file. */ { } #endif /* *---------------------------------------------------------------------- * * TclGuessPackageName -- * * If the "load" command is invoked without providing a package |
︙ | ︙ |
Changes to unix/tclLoadOSF.c.
︙ | ︙ | |||
27 28 29 30 31 32 33 | * John Robert LoVerso <[email protected]> * * Copyright (c) 1995-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. * | | | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | * John Robert LoVerso <[email protected]> * * Copyright (c) 1995-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: tclLoadOSF.c,v 1.3.22.1 2001/11/28 17:58:37 andreas_kupries Exp $ */ #include "tclInt.h" #include <sys/types.h> #include <loader.h> /* |
︙ | ︙ | |||
55 56 57 58 59 60 61 62 63 64 65 66 67 68 | * * Side effects: * New code suddenly appears in memory. * *---------------------------------------------------------------------- */ int TclpLoadFile(interp, fileName, sym1, sym2, proc1Ptr, proc2Ptr, clientDataPtr) Tcl_Interp *interp; /* Used for error reporting. */ char *fileName; /* Name of the file containing the desired * code. */ char *sym1, *sym2; /* Names of two procedures to look up in * the file's symbol table. */ | > | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | * * Side effects: * New code suddenly appears in memory. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_LOADCMD int TclpLoadFile(interp, fileName, sym1, sym2, proc1Ptr, proc2Ptr, clientDataPtr) Tcl_Interp *interp; /* Used for error reporting. */ char *fileName; /* Name of the file containing the desired * code. */ char *sym1, *sym2; /* Names of two procedures to look up in * the file's symbol table. */ |
︙ | ︙ | |||
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | pkg = fileName; else pkg++; *proc1Ptr = ldr_lookup_package(pkg, sym1); *proc2Ptr = ldr_lookup_package(pkg, sym2); return TCL_OK; } /* *---------------------------------------------------------------------- * * TclpUnloadFile -- * * Unloads a dynamically loaded binary code file from memory. * Code pointers in the formerly loaded file are no longer valid * after calling this function. * * Results: * None. * * Side effects: * Does nothing. Can anything be done? * *---------------------------------------------------------------------- */ void TclpUnloadFile(clientData) ClientData clientData; /* ClientData returned by a previous call * to TclpLoadFile(). The clientData is * a token that represents the loaded * file. */ { } /* *---------------------------------------------------------------------- * * TclGuessPackageName -- * * If the "load" command is invoked without providing a package | > > > | 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | pkg = fileName; else pkg++; *proc1Ptr = ldr_lookup_package(pkg, sym1); *proc2Ptr = ldr_lookup_package(pkg, sym2); return TCL_OK; } #endif /* *---------------------------------------------------------------------- * * TclpUnloadFile -- * * Unloads a dynamically loaded binary code file from memory. * Code pointers in the formerly loaded file are no longer valid * after calling this function. * * Results: * None. * * Side effects: * Does nothing. Can anything be done? * *---------------------------------------------------------------------- */ #ifndef TCL_NO_LOADCMD void TclpUnloadFile(clientData) ClientData clientData; /* ClientData returned by a previous call * to TclpLoadFile(). The clientData is * a token that represents the loaded * file. */ { } #endif /* *---------------------------------------------------------------------- * * TclGuessPackageName -- * * If the "load" command is invoked without providing a package |
︙ | ︙ |
Changes to unix/tclLoadShl.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * tclLoadShl.c -- * * This procedure provides a version of the TclLoadFile that works * with the "shl_load" and "shl_findsym" library procedures for * dynamic loading (e.g. for HP machines). * * Copyright (c) 1995-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. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /* * tclLoadShl.c -- * * This procedure provides a version of the TclLoadFile that works * with the "shl_load" and "shl_findsym" library procedures for * dynamic loading (e.g. for HP machines). * * Copyright (c) 1995-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: tclLoadShl.c,v 1.3.12.1.2.1 2001/11/28 17:58:37 andreas_kupries Exp $ */ #include <dl.h> /* * On some HP machines, dl.h defines EXTERN; remove that definition. */ |
︙ | ︙ | |||
42 43 44 45 46 47 48 49 50 51 52 53 54 55 | * * Side effects: * New code suddenly appears in memory. * *---------------------------------------------------------------------- */ int TclpLoadFile(interp, fileName, sym1, sym2, proc1Ptr, proc2Ptr, clientDataPtr) Tcl_Interp *interp; /* Used for error reporting. */ char *fileName; /* Name of the file containing the desired * code. */ char *sym1, *sym2; /* Names of two procedures to look up in * the file's symbol table. */ | > | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | * * Side effects: * New code suddenly appears in memory. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_LOADCMD int TclpLoadFile(interp, fileName, sym1, sym2, proc1Ptr, proc2Ptr, clientDataPtr) Tcl_Interp *interp; /* Used for error reporting. */ char *fileName; /* Name of the file containing the desired * code. */ char *sym1, *sym2; /* Names of two procedures to look up in * the file's symbol table. */ |
︙ | ︙ | |||
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | (short) TYPE_PROCEDURE, (void *) proc2Ptr) != 0) { *proc2Ptr = NULL; } Tcl_DStringFree(&newName); } return TCL_OK; } /* *---------------------------------------------------------------------- * * TclpUnloadFile -- * * Unloads a dynamically loaded binary code file from memory. * Code pointers in the formerly loaded file are no longer valid * after calling this function. * * Results: * None. * * Side effects: * Code removed from memory. * *---------------------------------------------------------------------- */ void TclpUnloadFile(clientData) ClientData clientData; /* ClientData returned by a previous call * to TclpLoadFile(). The clientData is * a token that represents the loaded * file. */ { shl_t handle; handle = (shl_t) clientData; shl_unload(handle); } /* *---------------------------------------------------------------------- * * TclGuessPackageName -- * * If the "load" command is invoked without providing a package | > > > | 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | (short) TYPE_PROCEDURE, (void *) proc2Ptr) != 0) { *proc2Ptr = NULL; } Tcl_DStringFree(&newName); } return TCL_OK; } #endif /* *---------------------------------------------------------------------- * * TclpUnloadFile -- * * Unloads a dynamically loaded binary code file from memory. * Code pointers in the formerly loaded file are no longer valid * after calling this function. * * Results: * None. * * Side effects: * Code removed from memory. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_LOADCMD void TclpUnloadFile(clientData) ClientData clientData; /* ClientData returned by a previous call * to TclpLoadFile(). The clientData is * a token that represents the loaded * file. */ { shl_t handle; handle = (shl_t) clientData; shl_unload(handle); } #endif /* *---------------------------------------------------------------------- * * TclGuessPackageName -- * * If the "load" command is invoked without providing a package |
︙ | ︙ |
Changes to unix/tclUnixChan.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * tclUnixChan.c * * Common channel driver for Unix channels based on files, command * pipes and TCP sockets. * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * Copyright (c) 1998-1999 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | /* * tclUnixChan.c * * Common channel driver for Unix channels based on files, command * pipes and TCP sockets. * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * Copyright (c) 1998-1999 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclUnixChan.c,v 1.17.2.1.2.1 2001/11/28 17:58:37 andreas_kupries Exp $ */ #include "tclInt.h" /* Internal definitions for Tcl. */ #include "tclPort.h" /* Portability features for Tcl. */ #ifndef TCL_NO_TTY /* * sys/ioctl.h has already been included by tclPort.h. Including termios.h * or termio.h causes a bunch of warning messages because some duplicate * (but not contradictory) #defines exist in termios.h and/or termio.h */ #undef NL0 #undef NL1 |
︙ | ︙ | |||
61 62 63 64 65 66 67 68 69 70 71 72 73 74 | # define GETIOSTATE(fd, statePtr) ioctl((fd), TIOCGETP, (statePtr)) # define SETIOSTATE(fd, statePtr) ioctl((fd), TIOCSETP, (statePtr)) #else /* !USE_SGTTY */ # undef SUPPORTS_TTY #endif /* !USE_SGTTY */ #endif /* !USE_TERMIO */ #endif /* !USE_TERMIOS */ /* * This structure describes per-instance state of a file based channel. */ typedef struct FileState { Tcl_Channel channel; /* Channel associated with this file. */ | > > > | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | # define GETIOSTATE(fd, statePtr) ioctl((fd), TIOCGETP, (statePtr)) # define SETIOSTATE(fd, statePtr) ioctl((fd), TIOCSETP, (statePtr)) #else /* !USE_SGTTY */ # undef SUPPORTS_TTY #endif /* !USE_SGTTY */ #endif /* !USE_TERMIO */ #endif /* !USE_TERMIOS */ #else #undef SUPPORTS_TTY #endif /* TCL_NO_TTY */ /* * This structure describes per-instance state of a file based channel. */ typedef struct FileState { Tcl_Channel channel; /* Channel associated with this file. */ |
︙ | ︙ | |||
115 116 117 118 119 120 121 122 123 124 125 126 127 128 | */ FileState *firstFilePtr; } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; /* * This structure describes per-instance state of a tcp based channel. */ typedef struct TcpState { Tcl_Channel channel; /* Channel associated with this file. */ int fd; /* The socket itself. */ | > | 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | */ FileState *firstFilePtr; } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; #ifndef TCL_NO_SOCKETS /* * This structure describes per-instance state of a tcp based channel. */ typedef struct TcpState { Tcl_Channel channel; /* Channel associated with this file. */ int fd; /* The socket itself. */ |
︙ | ︙ | |||
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | /* * The following defines how much buffer space the kernel should maintain * for a socket. */ #define SOCKET_BUFSIZE 4096 /* * Static routines for this file: */ static TcpState * CreateSocket _ANSI_ARGS_((Tcl_Interp *interp, int port, char *host, int server, char *myaddr, int myport, int async)); static int CreateSocketAddress _ANSI_ARGS_( (struct sockaddr_in *sockaddrPtr, char *host, int port)); static int FileBlockModeProc _ANSI_ARGS_(( ClientData instanceData, int mode)); static int FileCloseProc _ANSI_ARGS_((ClientData instanceData, Tcl_Interp *interp)); static int FileGetHandleProc _ANSI_ARGS_((ClientData instanceData, int direction, ClientData *handlePtr)); static int FileInputProc _ANSI_ARGS_((ClientData instanceData, char *buf, int toRead, int *errorCode)); static int FileOutputProc _ANSI_ARGS_(( ClientData instanceData, char *buf, int toWrite, int *errorCode)); static int FileSeekProc _ANSI_ARGS_((ClientData instanceData, long offset, int mode, int *errorCode)); static void FileWatchProc _ANSI_ARGS_((ClientData instanceData, int mask)); static void TcpAccept _ANSI_ARGS_((ClientData data, int mask)); static int TcpBlockModeProc _ANSI_ARGS_((ClientData data, int mode)); static int TcpCloseProc _ANSI_ARGS_((ClientData instanceData, Tcl_Interp *interp)); static int TcpGetHandleProc _ANSI_ARGS_((ClientData instanceData, int direction, ClientData *handlePtr)); static int TcpGetOptionProc _ANSI_ARGS_((ClientData instanceData, Tcl_Interp *interp, char *optionName, Tcl_DString *dsPtr)); static int TcpInputProc _ANSI_ARGS_((ClientData instanceData, char *buf, int toRead, int *errorCode)); static int TcpOutputProc _ANSI_ARGS_((ClientData instanceData, char *buf, int toWrite, int *errorCode)); static void TcpWatchProc _ANSI_ARGS_((ClientData instanceData, int mask)); #ifdef SUPPORTS_TTY static int TtyCloseProc _ANSI_ARGS_((ClientData instanceData, Tcl_Interp *interp)); static void TtyGetAttributes _ANSI_ARGS_((int fd, TtyAttrs *ttyPtr)); static int TtyGetOptionProc _ANSI_ARGS_((ClientData instanceData, Tcl_Interp *interp, char *optionName, Tcl_DString *dsPtr)); static FileState * TtyInit _ANSI_ARGS_((int fd)); static int TtyParseMode _ANSI_ARGS_((Tcl_Interp *interp, CONST char *mode, int *speedPtr, int *parityPtr, int *dataPtr, int *stopPtr)); static void TtySetAttributes _ANSI_ARGS_((int fd, TtyAttrs *ttyPtr)); static int TtySetOptionProc _ANSI_ARGS_((ClientData instanceData, Tcl_Interp *interp, char *optionName, char *value)); #endif /* SUPPORTS_TTY */ | > > > > > > > > > < < | 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | /* * The following defines how much buffer space the kernel should maintain * for a socket. */ #define SOCKET_BUFSIZE 4096 #endif /* * Static routines for this file: */ #ifndef TCL_NO_SOCKETS static TcpState * CreateSocket _ANSI_ARGS_((Tcl_Interp *interp, int port, char *host, int server, char *myaddr, int myport, int async)); static int CreateSocketAddress _ANSI_ARGS_( (struct sockaddr_in *sockaddrPtr, char *host, int port)); #endif static int FileBlockModeProc _ANSI_ARGS_(( ClientData instanceData, int mode)); static int FileCloseProc _ANSI_ARGS_((ClientData instanceData, Tcl_Interp *interp)); static int FileGetHandleProc _ANSI_ARGS_((ClientData instanceData, int direction, ClientData *handlePtr)); static int FileInputProc _ANSI_ARGS_((ClientData instanceData, char *buf, int toRead, int *errorCode)); static int FileOutputProc _ANSI_ARGS_(( ClientData instanceData, char *buf, int toWrite, int *errorCode)); static int FileSeekProc _ANSI_ARGS_((ClientData instanceData, long offset, int mode, int *errorCode)); static void FileWatchProc _ANSI_ARGS_((ClientData instanceData, int mask)); #ifndef TCL_NO_SOCKETS #ifndef TCL_NO_FILEEVENTS static void TcpAccept _ANSI_ARGS_((ClientData data, int mask)); #endif static int TcpBlockModeProc _ANSI_ARGS_((ClientData data, int mode)); static int TcpCloseProc _ANSI_ARGS_((ClientData instanceData, Tcl_Interp *interp)); static int TcpGetHandleProc _ANSI_ARGS_((ClientData instanceData, int direction, ClientData *handlePtr)); static int TcpGetOptionProc _ANSI_ARGS_((ClientData instanceData, Tcl_Interp *interp, char *optionName, Tcl_DString *dsPtr)); static int TcpInputProc _ANSI_ARGS_((ClientData instanceData, char *buf, int toRead, int *errorCode)); static int TcpOutputProc _ANSI_ARGS_((ClientData instanceData, char *buf, int toWrite, int *errorCode)); static void TcpWatchProc _ANSI_ARGS_((ClientData instanceData, int mask)); static int WaitForConnect _ANSI_ARGS_((TcpState *statePtr, int *errorCodePtr)); #endif #ifdef SUPPORTS_TTY static int TtyCloseProc _ANSI_ARGS_((ClientData instanceData, Tcl_Interp *interp)); static void TtyGetAttributes _ANSI_ARGS_((int fd, TtyAttrs *ttyPtr)); static int TtyGetOptionProc _ANSI_ARGS_((ClientData instanceData, Tcl_Interp *interp, char *optionName, Tcl_DString *dsPtr)); static FileState * TtyInit _ANSI_ARGS_((int fd)); static int TtyParseMode _ANSI_ARGS_((Tcl_Interp *interp, CONST char *mode, int *speedPtr, int *parityPtr, int *dataPtr, int *stopPtr)); static void TtySetAttributes _ANSI_ARGS_((int fd, TtyAttrs *ttyPtr)); static int TtySetOptionProc _ANSI_ARGS_((ClientData instanceData, Tcl_Interp *interp, char *optionName, char *value)); #endif /* SUPPORTS_TTY */ /* * This structure describes the channel type structure for file based IO: */ static Tcl_ChannelType fileChannelType = { "file", /* Type name. */ |
︙ | ︙ | |||
267 268 269 270 271 272 273 274 275 276 277 278 279 280 | NULL, /* close2proc. */ FileBlockModeProc, /* Set blocking or non-blocking mode.*/ NULL, /* flush proc. */ NULL, /* handler proc. */ }; #endif /* SUPPORTS_TTY */ /* * This structure describes the channel type structure for TCP socket * based IO: */ static Tcl_ChannelType tcpChannelType = { "tcp", /* Type name. */ | > | 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | NULL, /* close2proc. */ FileBlockModeProc, /* Set blocking or non-blocking mode.*/ NULL, /* flush proc. */ NULL, /* handler proc. */ }; #endif /* SUPPORTS_TTY */ #ifndef TCL_NO_SOCKETS /* * This structure describes the channel type structure for TCP socket * based IO: */ static Tcl_ChannelType tcpChannelType = { "tcp", /* Type name. */ |
︙ | ︙ | |||
288 289 290 291 292 293 294 | TcpWatchProc, /* Initialize notifier. */ TcpGetHandleProc, /* Get OS handles out of channel. */ NULL, /* close2proc. */ TcpBlockModeProc, /* Set blocking or non-blocking mode.*/ NULL, /* flush proc. */ NULL, /* handler proc. */ }; | | | 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | TcpWatchProc, /* Initialize notifier. */ TcpGetHandleProc, /* Get OS handles out of channel. */ NULL, /* close2proc. */ TcpBlockModeProc, /* Set blocking or non-blocking mode.*/ NULL, /* flush proc. */ NULL, /* handler proc. */ }; #endif /* *---------------------------------------------------------------------- * * FileBlockModeProc -- * * Helper procedure to set blocking and nonblocking modes on a |
︙ | ︙ | |||
454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | Tcl_Interp *interp; /* For error reporting - unused. */ { FileState *fsPtr = (FileState *) instanceData; FileState **nextPtrPtr; int errorCode = 0; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); Tcl_DeleteFileHandler(fsPtr->fd); /* * Do not close standard channels while in thread-exit. */ if (!TclInExit() || ((fsPtr->fd != 0) && (fsPtr->fd != 1) && (fsPtr->fd != 2))) { | > > | 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | Tcl_Interp *interp; /* For error reporting - unused. */ { FileState *fsPtr = (FileState *) instanceData; FileState **nextPtrPtr; int errorCode = 0; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); #ifndef TCL_NO_FILEEVENTS Tcl_DeleteFileHandler(fsPtr->fd); #endif /* * Do not close standard channels while in thread-exit. */ if (!TclInExit() || ((fsPtr->fd != 0) && (fsPtr->fd != 1) && (fsPtr->fd != 2))) { |
︙ | ︙ | |||
540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 | static void FileWatchProc(instanceData, mask) ClientData instanceData; /* The file state. */ int mask; /* Events of interest; an OR-ed * combination of TCL_READABLE, * TCL_WRITABLE and TCL_EXCEPTION. */ { FileState *fsPtr = (FileState *) instanceData; /* * Make sure we only register for events that are valid on this file. * Note that we are passing Tcl_NotifyChannel directly to * Tcl_CreateFileHandler with the channel pointer as the client data. */ mask &= fsPtr->validMask; if (mask) { Tcl_CreateFileHandler(fsPtr->fd, mask, (Tcl_FileProc *) Tcl_NotifyChannel, (ClientData) fsPtr->channel); } else { Tcl_DeleteFileHandler(fsPtr->fd); } } /* *---------------------------------------------------------------------- * * FileGetHandleProc -- * | > > | 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 | static void FileWatchProc(instanceData, mask) ClientData instanceData; /* The file state. */ int mask; /* Events of interest; an OR-ed * combination of TCL_READABLE, * TCL_WRITABLE and TCL_EXCEPTION. */ { #ifndef TCL_NO_FILEEVENTS FileState *fsPtr = (FileState *) instanceData; /* * Make sure we only register for events that are valid on this file. * Note that we are passing Tcl_NotifyChannel directly to * Tcl_CreateFileHandler with the channel pointer as the client data. */ mask &= fsPtr->validMask; if (mask) { Tcl_CreateFileHandler(fsPtr->fd, mask, (Tcl_FileProc *) Tcl_NotifyChannel, (ClientData) fsPtr->channel); } else { Tcl_DeleteFileHandler(fsPtr->fd); } #endif } /* *---------------------------------------------------------------------- * * FileGetHandleProc -- * |
︙ | ︙ | |||
1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 | * Side effects: * May open the channel and may cause creation of a file on the * file system. * *---------------------------------------------------------------------- */ Tcl_Channel TclpOpenFileChannel(interp, fileName, modeString, permissions) Tcl_Interp *interp; /* Interpreter for error reporting; * can be NULL. */ char *fileName; /* Name of file to open. */ char *modeString; /* A list of POSIX open modes or * a string such as "rw". */ | > > | 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 | * Side effects: * May open the channel and may cause creation of a file on the * file system. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM #ifndef TCL_NO_NONSTDCHAN Tcl_Channel TclpOpenFileChannel(interp, fileName, modeString, permissions) Tcl_Interp *interp; /* Interpreter for error reporting; * can be NULL. */ char *fileName; /* Name of file to open. */ char *modeString; /* A list of POSIX open modes or * a string such as "rw". */ |
︙ | ︙ | |||
1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 | channelName, "\": ", Tcl_PosixError(interp), NULL); } Tcl_Close(NULL, fsPtr->channel); return NULL; } } if (translation != NULL) { /* * Gotcha. Most modems need a "\r" at the end of the command * sequence. If you just send "at\n", the modem will not respond * with "OK" because it never got a "\r" to actually invoke the * command. So, by default, newlines are translated to "\r\n" on * output to avoid "bug" reports that the serial port isn't working. */ if (Tcl_SetChannelOption(interp, fsPtr->channel, "-translation", translation) != TCL_OK) { Tcl_Close(NULL, fsPtr->channel); return NULL; } } return fsPtr->channel; } /* *---------------------------------------------------------------------- * * Tcl_MakeFileChannel -- * * Makes a Tcl_Channel from an existing OS level file handle. | > > > > | 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 | channelName, "\": ", Tcl_PosixError(interp), NULL); } Tcl_Close(NULL, fsPtr->channel); return NULL; } } #ifdef SUPPORTS_TTY if (translation != NULL) { /* * Gotcha. Most modems need a "\r" at the end of the command * sequence. If you just send "at\n", the modem will not respond * with "OK" because it never got a "\r" to actually invoke the * command. So, by default, newlines are translated to "\r\n" on * output to avoid "bug" reports that the serial port isn't working. */ if (Tcl_SetChannelOption(interp, fsPtr->channel, "-translation", translation) != TCL_OK) { Tcl_Close(NULL, fsPtr->channel); return NULL; } } #endif return fsPtr->channel; } #endif #endif /* TCL_NO_FILESYSTEM */ /* *---------------------------------------------------------------------- * * Tcl_MakeFileChannel -- * * Makes a Tcl_Channel from an existing OS level file handle. |
︙ | ︙ | |||
1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 | * * Side effects: * Sets the device into blocking or nonblocking mode. * *---------------------------------------------------------------------- */ /* ARGSUSED */ static int TcpBlockModeProc(instanceData, mode) ClientData instanceData; /* Socket state. */ int mode; /* The mode to set. Can be one of * TCL_MODE_BLOCKING or * TCL_MODE_NONBLOCKING. */ | > | 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 | * * Side effects: * Sets the device into blocking or nonblocking mode. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_SOCKETS /* ARGSUSED */ static int TcpBlockModeProc(instanceData, mode) ClientData instanceData; /* Socket state. */ int mode; /* The mode to set. Can be one of * TCL_MODE_BLOCKING or * TCL_MODE_NONBLOCKING. */ |
︙ | ︙ | |||
1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 | TcpCloseProc(instanceData, interp) ClientData instanceData; /* The socket to close. */ Tcl_Interp *interp; /* For error reporting - unused. */ { TcpState *statePtr = (TcpState *) instanceData; int errorCode = 0; /* * Delete a file handler that may be active for this socket if this * is a server socket - the file handler was created automatically * by Tcl as part of the mechanism to accept new client connections. * Channel handlers are already deleted in the generic IO channel * closing code that called this function, so we do not have to * delete them here. */ Tcl_DeleteFileHandler(statePtr->fd); if (close(statePtr->fd) < 0) { errorCode = errno; } ckfree((char *) statePtr); return errorCode; | > > | 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 | TcpCloseProc(instanceData, interp) ClientData instanceData; /* The socket to close. */ Tcl_Interp *interp; /* For error reporting - unused. */ { TcpState *statePtr = (TcpState *) instanceData; int errorCode = 0; #ifndef TCL_NO_FILEEVENTS /* * Delete a file handler that may be active for this socket if this * is a server socket - the file handler was created automatically * by Tcl as part of the mechanism to accept new client connections. * Channel handlers are already deleted in the generic IO channel * closing code that called this function, so we do not have to * delete them here. */ Tcl_DeleteFileHandler(statePtr->fd); #endif if (close(statePtr->fd) < 0) { errorCode = errno; } ckfree((char *) statePtr); return errorCode; |
︙ | ︙ | |||
1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 | static void TcpWatchProc(instanceData, mask) ClientData instanceData; /* The socket state. */ int mask; /* Events of interest; an OR-ed * combination of TCL_READABLE, * TCL_WRITABLE and TCL_EXCEPTION. */ { TcpState *statePtr = (TcpState *) instanceData; /* * Make sure we don't mess with server sockets since they will never * be readable or writable at the Tcl level. This keeps Tcl scripts * from interfering with the -accept behavior. */ if (!statePtr->acceptProc) { if (mask) { Tcl_CreateFileHandler(statePtr->fd, mask, (Tcl_FileProc *) Tcl_NotifyChannel, (ClientData) statePtr->channel); } else { Tcl_DeleteFileHandler(statePtr->fd); } } } /* *---------------------------------------------------------------------- * * TcpGetHandleProc -- * | > > | 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 | static void TcpWatchProc(instanceData, mask) ClientData instanceData; /* The socket state. */ int mask; /* Events of interest; an OR-ed * combination of TCL_READABLE, * TCL_WRITABLE and TCL_EXCEPTION. */ { #ifndef TCL_NO_FILEEVENTS TcpState *statePtr = (TcpState *) instanceData; /* * Make sure we don't mess with server sockets since they will never * be readable or writable at the Tcl level. This keeps Tcl scripts * from interfering with the -accept behavior. */ if (!statePtr->acceptProc) { if (mask) { Tcl_CreateFileHandler(statePtr->fd, mask, (Tcl_FileProc *) Tcl_NotifyChannel, (ClientData) statePtr->channel); } else { Tcl_DeleteFileHandler(statePtr->fd); } } #endif } /* *---------------------------------------------------------------------- * * TcpGetHandleProc -- * |
︙ | ︙ | |||
2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 | * observe incorrect behavior on 64 bit machines such as DEC Alphas. * Should we modify this code to do an explicit memcpy? */ sockaddrPtr->sin_addr.s_addr = addr.s_addr; return 1; /* Success. */ } /* *---------------------------------------------------------------------- * * Tcl_OpenTcpClient -- * * Opens a TCP client socket and creates a channel around it. * * Results: * The channel or NULL if failed. An error message is returned * in the interpreter on failure. * * Side effects: * Opens a client socket and creates a new channel. * *---------------------------------------------------------------------- */ Tcl_Channel Tcl_OpenTcpClient(interp, port, host, myaddr, myport, async) Tcl_Interp *interp; /* For error reporting; can be NULL. */ int port; /* Port number to open. */ char *host; /* Host on which to open port. */ char *myaddr; /* Client-side address */ int myport; /* Client-side port */ | > > | 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 | * observe incorrect behavior on 64 bit machines such as DEC Alphas. * Should we modify this code to do an explicit memcpy? */ sockaddrPtr->sin_addr.s_addr = addr.s_addr; return 1; /* Success. */ } #endif /* *---------------------------------------------------------------------- * * Tcl_OpenTcpClient -- * * Opens a TCP client socket and creates a channel around it. * * Results: * The channel or NULL if failed. An error message is returned * in the interpreter on failure. * * Side effects: * Opens a client socket and creates a new channel. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_SOCKETS Tcl_Channel Tcl_OpenTcpClient(interp, port, host, myaddr, myport, async) Tcl_Interp *interp; /* For error reporting; can be NULL. */ int port; /* Port number to open. */ char *host; /* Host on which to open port. */ char *myaddr; /* Client-side address */ int myport; /* Client-side port */ |
︙ | ︙ | |||
2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 | if (Tcl_SetChannelOption(interp, statePtr->channel, "-translation", "auto crlf") == TCL_ERROR) { Tcl_Close((Tcl_Interp *) NULL, statePtr->channel); return NULL; } return statePtr->channel; } /* *---------------------------------------------------------------------- * * Tcl_MakeTcpClientChannel -- * * Creates a Tcl_Channel from an existing client TCP socket. * * Results: * The Tcl_Channel wrapped around the preexisting TCP socket. * * Side effects: * None. * *---------------------------------------------------------------------- */ Tcl_Channel Tcl_MakeTcpClientChannel(sock) ClientData sock; /* The socket to wrap up into a channel. */ { TcpState *statePtr; char channelName[16 + TCL_INTEGER_SPACE]; | > > | 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 | if (Tcl_SetChannelOption(interp, statePtr->channel, "-translation", "auto crlf") == TCL_ERROR) { Tcl_Close((Tcl_Interp *) NULL, statePtr->channel); return NULL; } return statePtr->channel; } #endif /* *---------------------------------------------------------------------- * * Tcl_MakeTcpClientChannel -- * * Creates a Tcl_Channel from an existing client TCP socket. * * Results: * The Tcl_Channel wrapped around the preexisting TCP socket. * * Side effects: * None. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_SOCKETS Tcl_Channel Tcl_MakeTcpClientChannel(sock) ClientData sock; /* The socket to wrap up into a channel. */ { TcpState *statePtr; char channelName[16 + TCL_INTEGER_SPACE]; |
︙ | ︙ | |||
2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 | if (Tcl_SetChannelOption((Tcl_Interp *) NULL, statePtr->channel, "-translation", "auto crlf") == TCL_ERROR) { Tcl_Close((Tcl_Interp *) NULL, statePtr->channel); return NULL; } return statePtr->channel; } /* *---------------------------------------------------------------------- * * Tcl_OpenTcpServer -- * * Opens a TCP server socket and creates a channel around it. * * Results: * The channel or NULL if failed. If an error occurred, an * error message is left in the interp's result if interp is * not NULL. * * Side effects: * Opens a server socket and creates a new channel. * *---------------------------------------------------------------------- */ Tcl_Channel Tcl_OpenTcpServer(interp, port, myHost, acceptProc, acceptProcData) Tcl_Interp *interp; /* For error reporting - may be * NULL. */ int port; /* Port number to open. */ char *myHost; /* Name of local host. */ Tcl_TcpAcceptProc *acceptProc; /* Callback for accepting connections | > > > | 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 | if (Tcl_SetChannelOption((Tcl_Interp *) NULL, statePtr->channel, "-translation", "auto crlf") == TCL_ERROR) { Tcl_Close((Tcl_Interp *) NULL, statePtr->channel); return NULL; } return statePtr->channel; } #endif /* *---------------------------------------------------------------------- * * Tcl_OpenTcpServer -- * * Opens a TCP server socket and creates a channel around it. * * Results: * The channel or NULL if failed. If an error occurred, an * error message is left in the interp's result if interp is * not NULL. * * Side effects: * Opens a server socket and creates a new channel. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_SOCKETS #ifndef TCL_NO_FILEEVENTS Tcl_Channel Tcl_OpenTcpServer(interp, port, myHost, acceptProc, acceptProcData) Tcl_Interp *interp; /* For error reporting - may be * NULL. */ int port; /* Port number to open. */ char *myHost; /* Name of local host. */ Tcl_TcpAcceptProc *acceptProc; /* Callback for accepting connections |
︙ | ︙ | |||
2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 | Tcl_CreateFileHandler(statePtr->fd, TCL_READABLE, TcpAccept, (ClientData) statePtr); sprintf(channelName, "sock%d", statePtr->fd); statePtr->channel = Tcl_CreateChannel(&tcpChannelType, channelName, (ClientData) statePtr, 0); return statePtr->channel; } /* *---------------------------------------------------------------------- * * TcpAccept -- * Accept a TCP socket connection. This is called by the event loop. * * Results: * None. * * Side effects: * Creates a new connection socket. Calls the registered callback * for the connection acceptance mechanism. * *---------------------------------------------------------------------- */ /* ARGSUSED */ static void TcpAccept(data, mask) ClientData data; /* Callback token. */ int mask; /* Not used. */ { TcpState *sockState; /* Client data of server socket. */ | > > > > | 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 | Tcl_CreateFileHandler(statePtr->fd, TCL_READABLE, TcpAccept, (ClientData) statePtr); sprintf(channelName, "sock%d", statePtr->fd); statePtr->channel = Tcl_CreateChannel(&tcpChannelType, channelName, (ClientData) statePtr, 0); return statePtr->channel; } #endif /* NO_FILEEVENTS */ #endif /* NO_SOCKETS */ /* *---------------------------------------------------------------------- * * TcpAccept -- * Accept a TCP socket connection. This is called by the event loop. * * Results: * None. * * Side effects: * Creates a new connection socket. Calls the registered callback * for the connection acceptance mechanism. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_SOCKETS #ifndef TCL_NO_FILEEVENTS /* ARGSUSED */ static void TcpAccept(data, mask) ClientData data; /* Callback token. */ int mask; /* Not used. */ { TcpState *sockState; /* Client data of server socket. */ |
︙ | ︙ | |||
2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 | if (sockState->acceptProc != NULL) { (*sockState->acceptProc)(sockState->acceptProcData, newSockState->channel, inet_ntoa(addr.sin_addr), ntohs(addr.sin_port)); } } /* *---------------------------------------------------------------------- * * TclpGetDefaultStdChannel -- * * Creates channels for standard input, standard output or standard | > > | 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 | if (sockState->acceptProc != NULL) { (*sockState->acceptProc)(sockState->acceptProcData, newSockState->channel, inet_ntoa(addr.sin_addr), ntohs(addr.sin_port)); } } #endif /* NO_FILEEVENTS */ #endif /* NO SOCKETS */ /* *---------------------------------------------------------------------- * * TclpGetDefaultStdChannel -- * * Creates channels for standard input, standard output or standard |
︙ | ︙ | |||
2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 | */ chanTypePtr = Tcl_GetChannelType(chan); if ((chanTypePtr == &fileChannelType) #ifdef SUPPORTS_TTY || (chanTypePtr == &ttyChannelType) #endif /* SUPPORTS_TTY */ || (chanTypePtr == &tcpChannelType) || (strcmp(chanTypePtr->typeName, "pipe") == 0)) { if (Tcl_GetChannelHandle(chan, (forWriting ? TCL_WRITABLE : TCL_READABLE), (ClientData*) &data) == TCL_OK) { fd = (int) data; /* | > > | 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 | */ chanTypePtr = Tcl_GetChannelType(chan); if ((chanTypePtr == &fileChannelType) #ifdef SUPPORTS_TTY || (chanTypePtr == &ttyChannelType) #endif /* SUPPORTS_TTY */ #ifndef TCL_NO_SOCKETS || (chanTypePtr == &tcpChannelType) #endif || (strcmp(chanTypePtr->typeName, "pipe") == 0)) { if (Tcl_GetChannelHandle(chan, (forWriting ? TCL_WRITABLE : TCL_READABLE), (ClientData*) &data) == TCL_OK) { fd = (int) data; /* |
︙ | ︙ |
Changes to unix/tclUnixFCmd.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * tclUnixFCmd.c * * This file implements the unix specific portion of file manipulation * subcommands of the "file" command. All filename arguments should * already be translated to native format. * * Copyright (c) 1996-1998 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /* * tclUnixFCmd.c * * This file implements the unix specific portion of file manipulation * subcommands of the "file" command. All filename arguments should * already be translated to native format. * * Copyright (c) 1996-1998 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: tclUnixFCmd.c,v 1.6.2.1.2.1 2001/11/28 17:58:37 andreas_kupries Exp $ * * Portions of this code were derived from NetBSD source code which has * the following copyright notice: * * Copyright (c) 1988, 1993, 1994 * The Regents of the University of California. All rights reserved. * |
︙ | ︙ | |||
53 54 55 56 57 58 59 60 61 62 63 64 65 66 | #include <grp.h> #ifndef HAVE_ST_BLKSIZE #ifndef NO_FSTATFS #include <sys/statfs.h> #endif #endif /* * The following constants specify the type of callback when * TraverseUnixTree() calls the traverseProc() */ #define DOTREE_PRED 1 /* pre-order directory */ #define DOTREE_POSTD 2 /* post-order directory */ | > | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | #include <grp.h> #ifndef HAVE_ST_BLKSIZE #ifndef NO_FSTATFS #include <sys/statfs.h> #endif #endif #ifndef TCL_NO_FILESYSTEM /* * The following constants specify the type of callback when * TraverseUnixTree() calls the traverseProc() */ #define DOTREE_PRED 1 /* pre-order directory */ #define DOTREE_POSTD 2 /* post-order directory */ |
︙ | ︙ | |||
145 146 147 148 149 150 151 152 153 154 155 156 157 158 | static int TraversalDelete _ANSI_ARGS_((Tcl_DString *srcPtr, Tcl_DString *dstPtr, CONST struct stat *statBufPtr, int type, Tcl_DString *errorPtr)); static int TraverseUnixTree _ANSI_ARGS_(( TraversalProc *traversalProc, Tcl_DString *sourcePtr, Tcl_DString *destPtr, Tcl_DString *errorPtr)); /* *--------------------------------------------------------------------------- * * TclpRenameFile, DoRenameFile -- * * Changes the name of an existing file or directory, from src to dst. | > | 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | static int TraversalDelete _ANSI_ARGS_((Tcl_DString *srcPtr, Tcl_DString *dstPtr, CONST struct stat *statBufPtr, int type, Tcl_DString *errorPtr)); static int TraverseUnixTree _ANSI_ARGS_(( TraversalProc *traversalProc, Tcl_DString *sourcePtr, Tcl_DString *destPtr, Tcl_DString *errorPtr)); #endif /* *--------------------------------------------------------------------------- * * TclpRenameFile, DoRenameFile -- * * Changes the name of an existing file or directory, from src to dst. |
︙ | ︙ | |||
181 182 183 184 185 186 187 188 189 190 191 192 193 194 | * The implementation of rename may allow cross-filesystem renames, * but the caller should be prepared to emulate it with copy and * delete if errno is EXDEV. * *--------------------------------------------------------------------------- */ int TclpRenameFile(src, dst) CONST char *src; /* Pathname of file or dir to be renamed * (UTF-8). */ CONST char *dst; /* New pathname of file or directory * (UTF-8). */ { | > | 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | * The implementation of rename may allow cross-filesystem renames, * but the caller should be prepared to emulate it with copy and * delete if errno is EXDEV. * *--------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM int TclpRenameFile(src, dst) CONST char *src; /* Pathname of file or dir to be renamed * (UTF-8). */ CONST char *dst; /* New pathname of file or directory * (UTF-8). */ { |
︙ | ︙ | |||
279 280 281 282 283 284 285 | * file across filesystems and the parent directory of that file is * not writable. Most other systems return EXDEV. Does nothing to * correct this behavior. */ return TCL_ERROR; } | | | 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | * file across filesystems and the parent directory of that file is * not writable. Most other systems return EXDEV. Does nothing to * correct this behavior. */ return TCL_ERROR; } #endif /* *--------------------------------------------------------------------------- * * TclpCopyFile, DoCopyFile -- * * Copy a single file (not a directory). If dst already exists and |
︙ | ︙ | |||
308 309 310 311 312 313 314 315 316 317 318 319 320 321 | * themselves will be copied and not what they point to. For the * other special file types, the directory entry will be copied and * not the contents of the device that it refers to. * *--------------------------------------------------------------------------- */ int TclpCopyFile(src, dst) CONST char *src; /* Pathname of file to be copied (UTF-8). */ CONST char *dst; /* Pathname of file to copy to (UTF-8). */ { int result; Tcl_DString srcString, dstString; | > | 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | * themselves will be copied and not what they point to. For the * other special file types, the directory entry will be copied and * not the contents of the device that it refers to. * *--------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM int TclpCopyFile(src, dst) CONST char *src; /* Pathname of file to be copied (UTF-8). */ CONST char *dst; /* Pathname of file to copy to (UTF-8). */ { int result; Tcl_DString srcString, dstString; |
︙ | ︙ | |||
399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 | } default: { return CopyFile(src, dst, &srcStatBuf); } } return TCL_OK; } /* *---------------------------------------------------------------------- * * CopyFile - * * Helper function for TclpCopyFile. Copies one regular file, * using read() and write(). * * Results: * A standard Tcl result. * * Side effects: * A file is copied. Dst will be overwritten if it exists. * *---------------------------------------------------------------------- */ static int CopyFile(src, dst, statBufPtr) CONST char *src; /* Pathname of file to copy (native). */ CONST char *dst; /* Pathname of file to create/overwrite * (native). */ CONST struct stat *statBufPtr; /* Used to determine mode and blocksize. */ | > > | 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 | } default: { return CopyFile(src, dst, &srcStatBuf); } } return TCL_OK; } #endif /* *---------------------------------------------------------------------- * * CopyFile - * * Helper function for TclpCopyFile. Copies one regular file, * using read() and write(). * * Results: * A standard Tcl result. * * Side effects: * A file is copied. Dst will be overwritten if it exists. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM static int CopyFile(src, dst, statBufPtr) CONST char *src; /* Pathname of file to copy (native). */ CONST char *dst; /* Pathname of file to create/overwrite * (native). */ CONST struct stat *statBufPtr; /* Used to determine mode and blocksize. */ |
︙ | ︙ | |||
489 490 491 492 493 494 495 496 497 498 499 500 501 502 | */ unlink(dst); /* INTL: Native. */ return TCL_ERROR; } return TCL_OK; } /* *--------------------------------------------------------------------------- * * TclpDeleteFile, DoDeleteFile -- * * Removes a single file (not a directory). | > | 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 | */ unlink(dst); /* INTL: Native. */ return TCL_ERROR; } return TCL_OK; } #endif /* *--------------------------------------------------------------------------- * * TclpDeleteFile, DoDeleteFile -- * * Removes a single file (not a directory). |
︙ | ︙ | |||
512 513 514 515 516 517 518 519 520 521 522 523 524 525 | * * Side effects: * The file is deleted, even if it is read-only. * *--------------------------------------------------------------------------- */ int TclpDeleteFile(path) CONST char *path; /* Pathname of file to be removed (UTF-8). */ { int result; Tcl_DString pathString; | > | 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 | * * Side effects: * The file is deleted, even if it is read-only. * *--------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM int TclpDeleteFile(path) CONST char *path; /* Pathname of file to be removed (UTF-8). */ { int result; Tcl_DString pathString; |
︙ | ︙ | |||
537 538 539 540 541 542 543 544 545 546 547 548 549 550 | path = Tcl_DStringValue(pathPtr); if (unlink(path) != 0) { /* INTL: Native. */ return TCL_ERROR; } return TCL_OK; } /* *--------------------------------------------------------------------------- * * TclpCreateDirectory, DoCreateDirectory -- * * Creates the specified directory. All parent directories of the | > | 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 | path = Tcl_DStringValue(pathPtr); if (unlink(path) != 0) { /* INTL: Native. */ return TCL_ERROR; } return TCL_OK; } #endif /* *--------------------------------------------------------------------------- * * TclpCreateDirectory, DoCreateDirectory -- * * Creates the specified directory. All parent directories of the |
︙ | ︙ | |||
564 565 566 567 568 569 570 571 572 573 574 575 576 577 | * Side effects: * A directory is created with the current umask, except that * permission for u+rwx will always be added. * *--------------------------------------------------------------------------- */ int TclpCreateDirectory(path) CONST char *path; /* Pathname of directory to create (UTF-8). */ { int result; Tcl_DString pathString; | > | 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 | * Side effects: * A directory is created with the current umask, except that * permission for u+rwx will always be added. * *--------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM int TclpCreateDirectory(path) CONST char *path; /* Pathname of directory to create (UTF-8). */ { int result; Tcl_DString pathString; |
︙ | ︙ | |||
600 601 602 603 604 605 606 607 608 609 610 611 612 613 | mode = (0777 & ~mode) | S_IRUSR | S_IWUSR | S_IXUSR; if (mkdir(path, mode) != 0) { /* INTL: Native. */ return TCL_ERROR; } return TCL_OK; } /* *--------------------------------------------------------------------------- * * TclpCopyDirectory -- * * Recursively copies a directory. The target directory dst must | > | 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 | mode = (0777 & ~mode) | S_IRUSR | S_IWUSR | S_IXUSR; if (mkdir(path, mode) != 0) { /* INTL: Native. */ return TCL_ERROR; } return TCL_OK; } #endif /* *--------------------------------------------------------------------------- * * TclpCopyDirectory -- * * Recursively copies a directory. The target directory dst must |
︙ | ︙ | |||
627 628 629 630 631 632 633 634 635 636 637 638 639 640 | * with the name dst. If an error occurs, the error will * be returned immediately, and remaining files will not be * processed. * *--------------------------------------------------------------------------- */ int TclpCopyDirectory(src, dst, errorPtr) CONST char *src; /* Pathname of directory to be copied * (UTF-8). */ CONST char *dst; /* Pathname of target directory (UTF-8). */ Tcl_DString *errorPtr; /* If non-NULL, uninitialized or free * DString filled with UTF-8 name of file | > | 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 | * with the name dst. If an error occurs, the error will * be returned immediately, and remaining files will not be * processed. * *--------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM int TclpCopyDirectory(src, dst, errorPtr) CONST char *src; /* Pathname of directory to be copied * (UTF-8). */ CONST char *dst; /* Pathname of target directory (UTF-8). */ Tcl_DString *errorPtr; /* If non-NULL, uninitialized or free * DString filled with UTF-8 name of file |
︙ | ︙ | |||
648 649 650 651 652 653 654 655 656 657 658 659 660 661 | result = TraverseUnixTree(TraversalCopy, &srcString, &dstString, errorPtr); Tcl_DStringFree(&srcString); Tcl_DStringFree(&dstString); return result; } /* *--------------------------------------------------------------------------- * * TclpRemoveDirectory, DoRemoveDirectory -- * * Removes directory (and its contents, if the recursive flag is set). | > | 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 | result = TraverseUnixTree(TraversalCopy, &srcString, &dstString, errorPtr); Tcl_DStringFree(&srcString); Tcl_DStringFree(&dstString); return result; } #endif /* *--------------------------------------------------------------------------- * * TclpRemoveDirectory, DoRemoveDirectory -- * * Removes directory (and its contents, if the recursive flag is set). |
︙ | ︙ | |||
675 676 677 678 679 680 681 682 683 684 685 686 687 688 | * Side effects: * Directory removed. If an error occurs, the error will be returned * immediately, and remaining files will not be deleted. * *--------------------------------------------------------------------------- */ int TclpRemoveDirectory(path, recursive, errorPtr) CONST char *path; /* Pathname of directory to be removed * (UTF-8). */ int recursive; /* If non-zero, removes directories that * are nonempty. Otherwise, will only remove * empty directories. */ | > | 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 | * Side effects: * Directory removed. If an error occurs, the error will be returned * immediately, and remaining files will not be deleted. * *--------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM int TclpRemoveDirectory(path, recursive, errorPtr) CONST char *path; /* Pathname of directory to be removed * (UTF-8). */ int recursive; /* If non-zero, removes directories that * are nonempty. Otherwise, will only remove * empty directories. */ |
︙ | ︙ | |||
730 731 732 733 734 735 736 737 738 739 740 741 742 743 | /* * The directory is nonempty, but the recursive flag has been * specified, so we recursively remove all the files in the directory. */ return TraverseUnixTree(TraversalDelete, pathPtr, NULL, errorPtr); } /* *--------------------------------------------------------------------------- * * TraverseUnixTree -- * * Traverse directory tree specified by sourcePtr, calling the function | > | 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 | /* * The directory is nonempty, but the recursive flag has been * specified, so we recursively remove all the files in the directory. */ return TraverseUnixTree(TraversalDelete, pathPtr, NULL, errorPtr); } #endif /* *--------------------------------------------------------------------------- * * TraverseUnixTree -- * * Traverse directory tree specified by sourcePtr, calling the function |
︙ | ︙ | |||
753 754 755 756 757 758 759 760 761 762 763 764 765 766 | * None caused by TraverseUnixTree, however the user specified * traverseProc() may change state. If an error occurs, the error will * be returned immediately, and remaining files will not be processed. * *--------------------------------------------------------------------------- */ static int TraverseUnixTree(traverseProc, sourcePtr, targetPtr, errorPtr) TraversalProc *traverseProc;/* Function to call for every file and * directory in source hierarchy. */ Tcl_DString *sourcePtr; /* Pathname of source directory to be * traversed (native). */ Tcl_DString *targetPtr; /* Pathname of directory to traverse in | > | 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 | * None caused by TraverseUnixTree, however the user specified * traverseProc() may change state. If an error occurs, the error will * be returned immediately, and remaining files will not be processed. * *--------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM static int TraverseUnixTree(traverseProc, sourcePtr, targetPtr, errorPtr) TraversalProc *traverseProc;/* Function to call for every file and * directory in source hierarchy. */ Tcl_DString *sourcePtr; /* Pathname of source directory to be * traversed (native). */ Tcl_DString *targetPtr; /* Pathname of directory to traverse in |
︙ | ︙ | |||
872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 | Tcl_ExternalToUtfDString(NULL, errfile, -1, errorPtr); } result = TCL_ERROR; } return result; } /* *---------------------------------------------------------------------- * * TraversalCopy * * Called from TraverseUnixTree in order to execute a recursive copy of a * directory. * * Results: * Standard Tcl result. * * Side effects: * The file or directory src may be copied to dst, depending on * the value of type. * *---------------------------------------------------------------------- */ static int TraversalCopy(srcPtr, dstPtr, statBufPtr, type, errorPtr) Tcl_DString *srcPtr; /* Source pathname to copy (native). */ Tcl_DString *dstPtr; /* Destination pathname of copy (native). */ CONST struct stat *statBufPtr; /* Stat info for file specified by srcPtr. */ int type; /* Reason for call - see TraverseUnixTree(). */ | > > | 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 | Tcl_ExternalToUtfDString(NULL, errfile, -1, errorPtr); } result = TCL_ERROR; } return result; } #endif /* *---------------------------------------------------------------------- * * TraversalCopy * * Called from TraverseUnixTree in order to execute a recursive copy of a * directory. * * Results: * Standard Tcl result. * * Side effects: * The file or directory src may be copied to dst, depending on * the value of type. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM static int TraversalCopy(srcPtr, dstPtr, statBufPtr, type, errorPtr) Tcl_DString *srcPtr; /* Source pathname to copy (native). */ Tcl_DString *dstPtr; /* Destination pathname of copy (native). */ CONST struct stat *statBufPtr; /* Stat info for file specified by srcPtr. */ int type; /* Reason for call - see TraverseUnixTree(). */ |
︙ | ︙ | |||
935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 | if (errorPtr != NULL) { Tcl_ExternalToUtfDString(NULL, Tcl_DStringValue(dstPtr), Tcl_DStringLength(dstPtr), errorPtr); } return TCL_ERROR; } /* *--------------------------------------------------------------------------- * * TraversalDelete -- * * Called by procedure TraverseUnixTree for every file and directory * that it encounters in a directory hierarchy. This procedure unlinks * files, and removes directories after all the containing files * have been processed. * * Results: * Standard Tcl result. * * Side effects: * Files or directory specified by src will be deleted. * *---------------------------------------------------------------------- */ static int TraversalDelete(srcPtr, ignore, statBufPtr, type, errorPtr) Tcl_DString *srcPtr; /* Source pathname (native). */ Tcl_DString *ignore; /* Destination pathname (not used). */ CONST struct stat *statBufPtr; /* Stat info for file specified by srcPtr. */ int type; /* Reason for call - see TraverseUnixTree(). */ | > > | 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 | if (errorPtr != NULL) { Tcl_ExternalToUtfDString(NULL, Tcl_DStringValue(dstPtr), Tcl_DStringLength(dstPtr), errorPtr); } return TCL_ERROR; } #endif /* *--------------------------------------------------------------------------- * * TraversalDelete -- * * Called by procedure TraverseUnixTree for every file and directory * that it encounters in a directory hierarchy. This procedure unlinks * files, and removes directories after all the containing files * have been processed. * * Results: * Standard Tcl result. * * Side effects: * Files or directory specified by src will be deleted. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM static int TraversalDelete(srcPtr, ignore, statBufPtr, type, errorPtr) Tcl_DString *srcPtr; /* Source pathname (native). */ Tcl_DString *ignore; /* Destination pathname (not used). */ CONST struct stat *statBufPtr; /* Stat info for file specified by srcPtr. */ int type; /* Reason for call - see TraverseUnixTree(). */ |
︙ | ︙ | |||
989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 | } if (errorPtr != NULL) { Tcl_ExternalToUtfDString(NULL, Tcl_DStringValue(srcPtr), Tcl_DStringLength(srcPtr), errorPtr); } return TCL_ERROR; } /* *--------------------------------------------------------------------------- * * CopyFileAtts -- * * Copy the file attributes such as owner, group, permissions, * and modification date from one file to another. * * Results: * Standard Tcl result. * * Side effects: * user id, group id, permission bits, last modification time, and * last access time are updated in the new file to reflect the * old file. * *--------------------------------------------------------------------------- */ static int CopyFileAtts(src, dst, statBufPtr) CONST char *src; /* Path name of source file (native). */ CONST char *dst; /* Path name of target file (native). */ CONST struct stat *statBufPtr; /* Stat info for source file */ { | > > | 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 | } if (errorPtr != NULL) { Tcl_ExternalToUtfDString(NULL, Tcl_DStringValue(srcPtr), Tcl_DStringLength(srcPtr), errorPtr); } return TCL_ERROR; } #endif /* *--------------------------------------------------------------------------- * * CopyFileAtts -- * * Copy the file attributes such as owner, group, permissions, * and modification date from one file to another. * * Results: * Standard Tcl result. * * Side effects: * user id, group id, permission bits, last modification time, and * last access time are updated in the new file to reflect the * old file. * *--------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM static int CopyFileAtts(src, dst, statBufPtr) CONST char *src; /* Path name of source file (native). */ CONST char *dst; /* Path name of target file (native). */ CONST struct stat *statBufPtr; /* Stat info for source file */ { |
︙ | ︙ | |||
1046 1047 1048 1049 1050 1051 1052 | tval.modtime = statBufPtr->st_mtime; if (utime(dst, &tval)) { /* INTL: Native. */ return TCL_ERROR; } return TCL_OK; } | | > | 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 | tval.modtime = statBufPtr->st_mtime; if (utime(dst, &tval)) { /* INTL: Native. */ return TCL_ERROR; } return TCL_OK; } #endif /* *---------------------------------------------------------------------- * * GetGroupAttribute * * Gets the group attribute of a file. * * Results: * Standard TCL result. Returns a new Tcl_Obj in attributePtrPtr * if there is no error. * * Side effects: * A new object is allocated. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM static int GetGroupAttribute(interp, objIndex, fileName, attributePtrPtr) Tcl_Interp *interp; /* The interp we are using for errors. */ int objIndex; /* The index of the attribute. */ CONST char *fileName; /* The name of the file (UTF-8). */ Tcl_Obj **attributePtrPtr; /* A pointer to return the object with. */ { |
︙ | ︙ | |||
1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 | utf = Tcl_ExternalToUtfDString(NULL, groupPtr->gr_name, -1, &ds); *attributePtrPtr = Tcl_NewStringObj(utf, -1); Tcl_DStringFree(&ds); } endgrent(); return TCL_OK; } /* *---------------------------------------------------------------------- * * GetOwnerAttribute * * Gets the owner attribute of a file. * * Results: * Standard TCL result. Returns a new Tcl_Obj in attributePtrPtr * if there is no error. * * Side effects: * A new object is allocated. * *---------------------------------------------------------------------- */ static int GetOwnerAttribute(interp, objIndex, fileName, attributePtrPtr) Tcl_Interp *interp; /* The interp we are using for errors. */ int objIndex; /* The index of the attribute. */ CONST char *fileName; /* The name of the file (UTF-8). */ Tcl_Obj **attributePtrPtr; /* A pointer to return the object with. */ { | > > | 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 | utf = Tcl_ExternalToUtfDString(NULL, groupPtr->gr_name, -1, &ds); *attributePtrPtr = Tcl_NewStringObj(utf, -1); Tcl_DStringFree(&ds); } endgrent(); return TCL_OK; } #endif /* *---------------------------------------------------------------------- * * GetOwnerAttribute * * Gets the owner attribute of a file. * * Results: * Standard TCL result. Returns a new Tcl_Obj in attributePtrPtr * if there is no error. * * Side effects: * A new object is allocated. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM static int GetOwnerAttribute(interp, objIndex, fileName, attributePtrPtr) Tcl_Interp *interp; /* The interp we are using for errors. */ int objIndex; /* The index of the attribute. */ CONST char *fileName; /* The name of the file (UTF-8). */ Tcl_Obj **attributePtrPtr; /* A pointer to return the object with. */ { |
︙ | ︙ | |||
1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 | utf = Tcl_ExternalToUtfDString(NULL, pwPtr->pw_name, -1, &ds); *attributePtrPtr = Tcl_NewStringObj(utf, Tcl_DStringLength(&ds)); Tcl_DStringFree(&ds); } endpwent(); return TCL_OK; } /* *---------------------------------------------------------------------- * * GetPermissionsAttribute * * Gets the group attribute of a file. * * Results: * Standard TCL result. Returns a new Tcl_Obj in attributePtrPtr * if there is no error. The object will have ref count 0. * * Side effects: * A new object is allocated. * *---------------------------------------------------------------------- */ static int GetPermissionsAttribute(interp, objIndex, fileName, attributePtrPtr) Tcl_Interp *interp; /* The interp we are using for errors. */ int objIndex; /* The index of the attribute. */ CONST char *fileName; /* The name of the file (UTF-8). */ Tcl_Obj **attributePtrPtr; /* A pointer to return the object with. */ { | > > | 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 | utf = Tcl_ExternalToUtfDString(NULL, pwPtr->pw_name, -1, &ds); *attributePtrPtr = Tcl_NewStringObj(utf, Tcl_DStringLength(&ds)); Tcl_DStringFree(&ds); } endpwent(); return TCL_OK; } #endif /* *---------------------------------------------------------------------- * * GetPermissionsAttribute * * Gets the group attribute of a file. * * Results: * Standard TCL result. Returns a new Tcl_Obj in attributePtrPtr * if there is no error. The object will have ref count 0. * * Side effects: * A new object is allocated. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM static int GetPermissionsAttribute(interp, objIndex, fileName, attributePtrPtr) Tcl_Interp *interp; /* The interp we are using for errors. */ int objIndex; /* The index of the attribute. */ CONST char *fileName; /* The name of the file (UTF-8). */ Tcl_Obj **attributePtrPtr; /* A pointer to return the object with. */ { |
︙ | ︙ | |||
1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 | sprintf(returnString, "%0#5lo", (statBuf.st_mode & 0x00007FFF)); *attributePtrPtr = Tcl_NewStringObj(returnString, -1); return TCL_OK; } /* *--------------------------------------------------------------------------- * * SetGroupAttribute -- * * Sets the group of the file to the specified group. * * Results: * Standard TCL result. * * Side effects: * As above. * *--------------------------------------------------------------------------- */ static int SetGroupAttribute(interp, objIndex, fileName, attributePtr) Tcl_Interp *interp; /* The interp for error reporting. */ int objIndex; /* The index of the attribute. */ CONST char *fileName; /* The name of the file (UTF-8). */ Tcl_Obj *attributePtr; /* New group for file. */ { | > > | 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 | sprintf(returnString, "%0#5lo", (statBuf.st_mode & 0x00007FFF)); *attributePtrPtr = Tcl_NewStringObj(returnString, -1); return TCL_OK; } #endif /* *--------------------------------------------------------------------------- * * SetGroupAttribute -- * * Sets the group of the file to the specified group. * * Results: * Standard TCL result. * * Side effects: * As above. * *--------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM static int SetGroupAttribute(interp, objIndex, fileName, attributePtr) Tcl_Interp *interp; /* The interp for error reporting. */ int objIndex; /* The index of the attribute. */ CONST char *fileName; /* The name of the file (UTF-8). */ Tcl_Obj *attributePtr; /* New group for file. */ { |
︙ | ︙ | |||
1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 | if (result != 0) { Tcl_AppendResult(interp, "could not set group for file \"", fileName, "\": ", Tcl_PosixError(interp), (char *) NULL); return TCL_ERROR; } return TCL_OK; } /* *--------------------------------------------------------------------------- * * SetOwnerAttribute -- * * Sets the owner of the file to the specified owner. * * Results: * Standard TCL result. * * Side effects: * As above. * *--------------------------------------------------------------------------- */ static int SetOwnerAttribute(interp, objIndex, fileName, attributePtr) Tcl_Interp *interp; /* The interp for error reporting. */ int objIndex; /* The index of the attribute. */ CONST char *fileName; /* The name of the file (UTF-8). */ Tcl_Obj *attributePtr; /* New owner for file. */ { | > > | 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 | if (result != 0) { Tcl_AppendResult(interp, "could not set group for file \"", fileName, "\": ", Tcl_PosixError(interp), (char *) NULL); return TCL_ERROR; } return TCL_OK; } #endif /* *--------------------------------------------------------------------------- * * SetOwnerAttribute -- * * Sets the owner of the file to the specified owner. * * Results: * Standard TCL result. * * Side effects: * As above. * *--------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM static int SetOwnerAttribute(interp, objIndex, fileName, attributePtr) Tcl_Interp *interp; /* The interp for error reporting. */ int objIndex; /* The index of the attribute. */ CONST char *fileName; /* The name of the file (UTF-8). */ Tcl_Obj *attributePtr; /* New owner for file. */ { |
︙ | ︙ | |||
1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 | if (result != 0) { Tcl_AppendResult(interp, "could not set owner for file \"", fileName, "\": ", Tcl_PosixError(interp), (char *) NULL); return TCL_ERROR; } return TCL_OK; } /* *--------------------------------------------------------------------------- * * SetPermissionsAttribute * * Sets the file to the given permission. * * Results: * Standard TCL result. * * Side effects: * The permission of the file is changed. * *--------------------------------------------------------------------------- */ static int SetPermissionsAttribute(interp, objIndex, fileName, attributePtr) Tcl_Interp *interp; /* The interp we are using for errors. */ int objIndex; /* The index of the attribute. */ CONST char *fileName; /* The name of the file (UTF-8). */ Tcl_Obj *attributePtr; /* The attribute to set. */ { | > > | 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 | if (result != 0) { Tcl_AppendResult(interp, "could not set owner for file \"", fileName, "\": ", Tcl_PosixError(interp), (char *) NULL); return TCL_ERROR; } return TCL_OK; } #endif /* *--------------------------------------------------------------------------- * * SetPermissionsAttribute * * Sets the file to the given permission. * * Results: * Standard TCL result. * * Side effects: * The permission of the file is changed. * *--------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM static int SetPermissionsAttribute(interp, objIndex, fileName, attributePtr) Tcl_Interp *interp; /* The interp we are using for errors. */ int objIndex; /* The index of the attribute. */ CONST char *fileName; /* The name of the file (UTF-8). */ Tcl_Obj *attributePtr; /* The attribute to set. */ { |
︙ | ︙ | |||
1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 | Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "could not set permissions for file \"", fileName, "\": ", Tcl_PosixError(interp), (char *) NULL); return TCL_ERROR; } return TCL_OK; } /* *--------------------------------------------------------------------------- * * TclpListVolumes -- * * Lists the currently mounted volumes, which on UNIX is just /. * * Results: * A standard Tcl result. Will always be TCL_OK, since there is no way * that this command can fail. Also, the interpreter's result is set to * the list of volumes. * * Side effects: * None. * *--------------------------------------------------------------------------- */ int TclpListVolumes(interp) Tcl_Interp *interp; /* Interpreter to which to pass * the volume list. */ { Tcl_Obj *resultPtr; resultPtr = Tcl_GetObjResult(interp); Tcl_SetStringObj(resultPtr, "/", 1); return TCL_OK; } /* *---------------------------------------------------------------------- * * GetModeFromPermString -- * * This procedure is invoked to process the "file permissions" * Tcl command, to check for a "rwxrwxrwx" or "ugoa+-=rwxst" string. * See the user documentation for details on what it does. * * Results: * A standard Tcl result. * * Side effects: * See the user documentation. * *---------------------------------------------------------------------- */ static int GetModeFromPermString(interp, modeStringPtr, modePtr) Tcl_Interp *interp; /* The interp we are using for errors. */ char *modeStringPtr; /* Permissions string */ mode_t *modePtr; /* pointer to the mode value */ { mode_t newMode; | > > > > | 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 | Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "could not set permissions for file \"", fileName, "\": ", Tcl_PosixError(interp), (char *) NULL); return TCL_ERROR; } return TCL_OK; } #endif /* *--------------------------------------------------------------------------- * * TclpListVolumes -- * * Lists the currently mounted volumes, which on UNIX is just /. * * Results: * A standard Tcl result. Will always be TCL_OK, since there is no way * that this command can fail. Also, the interpreter's result is set to * the list of volumes. * * Side effects: * None. * *--------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM int TclpListVolumes(interp) Tcl_Interp *interp; /* Interpreter to which to pass * the volume list. */ { Tcl_Obj *resultPtr; resultPtr = Tcl_GetObjResult(interp); Tcl_SetStringObj(resultPtr, "/", 1); return TCL_OK; } #endif /* *---------------------------------------------------------------------- * * GetModeFromPermString -- * * This procedure is invoked to process the "file permissions" * Tcl command, to check for a "rwxrwxrwx" or "ugoa+-=rwxst" string. * See the user documentation for details on what it does. * * Results: * A standard Tcl result. * * Side effects: * See the user documentation. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM static int GetModeFromPermString(interp, modeStringPtr, modePtr) Tcl_Interp *interp; /* The interp we are using for errors. */ char *modeStringPtr; /* Permissions string */ mode_t *modePtr; /* pointer to the mode value */ { mode_t newMode; |
︙ | ︙ | |||
1605 1606 1607 1608 1609 1610 1611 | case 3 : *modePtr = (oldMode & ~who) | (who & what); continue; } } return TCL_OK; } | > | 1642 1643 1644 1645 1646 1647 1648 1649 | case 3 : *modePtr = (oldMode & ~who) | (who & what); continue; } } return TCL_OK; } #endif |
Changes to unix/tclUnixFile.c.
1 2 3 4 5 6 7 8 9 10 11 | /* * tclUnixFile.c -- * * This file contains wrappers around UNIX file handling functions. * These wrappers mask differences between Windows and UNIX. * * Copyright (c) 1995-1998 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* * tclUnixFile.c -- * * This file contains wrappers around UNIX file handling functions. * These wrappers mask differences between Windows and UNIX. * * Copyright (c) 1995-1998 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: tclUnixFile.c,v 1.9.12.1 2001/11/28 17:58:37 andreas_kupries Exp $ */ #include "tclInt.h" #include "tclPort.h" /* |
︙ | ︙ | |||
36 37 38 39 40 41 42 43 44 45 46 47 48 49 | * The variable tclNativeExecutableName gets filled in with the file * name for the application, if we figured it out. If we couldn't * figure it out, tclNativeExecutableName is set to NULL. * *--------------------------------------------------------------------------- */ char * TclpFindExecutable(argv0) CONST char *argv0; /* The value of the application's argv[0] * (native). */ { CONST char *name, *p; struct stat statBuf; | > | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | * The variable tclNativeExecutableName gets filled in with the file * name for the application, if we figured it out. If we couldn't * figure it out, tclNativeExecutableName is set to NULL. * *--------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM char * TclpFindExecutable(argv0) CONST char *argv0; /* The value of the application's argv[0] * (native). */ { CONST char *name, *p; struct stat statBuf; |
︙ | ︙ | |||
168 169 170 171 172 173 174 175 176 177 178 179 180 181 | Tcl_DStringValue(&nameString)); Tcl_DStringFree(&nameString); done: Tcl_DStringFree(&buffer); return tclNativeExecutableName; } /* *---------------------------------------------------------------------- * * TclpMatchFilesTypes -- * * This routine is used by the globbing code to search a | > | 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | Tcl_DStringValue(&nameString)); Tcl_DStringFree(&nameString); done: Tcl_DStringFree(&buffer); return tclNativeExecutableName; } #endif /* *---------------------------------------------------------------------- * * TclpMatchFilesTypes -- * * This routine is used by the globbing code to search a |
︙ | ︙ | |||
190 191 192 193 194 195 196 197 198 199 200 201 202 203 | * * Side effects: * None. * *---------------------------------------------------------------------- */ int TclpMatchFilesTypes(interp, separators, dirPtr, pattern, tail, types) Tcl_Interp *interp; /* Interpreter to receive results. */ char *separators; /* Directory separators to pass to TclDoGlob */ Tcl_DString *dirPtr; /* Contains path to directory to search. */ char *pattern; /* Pattern to match against. */ char *tail; /* Pointer to end of pattern. Tail must | > | 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | * * Side effects: * None. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM int TclpMatchFilesTypes(interp, separators, dirPtr, pattern, tail, types) Tcl_Interp *interp; /* Interpreter to receive results. */ char *separators; /* Directory separators to pass to TclDoGlob */ Tcl_DString *dirPtr; /* Contains path to directory to search. */ char *pattern; /* Pattern to match against. */ char *tail; /* Pointer to end of pattern. Tail must |
︙ | ︙ | |||
431 432 433 434 435 436 437 438 439 440 441 442 443 444 | char *pattern; /* Pattern to match against. */ char *tail; /* Pointer to end of pattern. Tail must * point to a location in pattern and must * not be static. */ { return TclpMatchFilesTypes(interp,separators,dirPtr,pattern,tail,NULL); } /* *--------------------------------------------------------------------------- * * TclpGetUserHome -- * * This function takes the specified user name and finds their | > | 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 | char *pattern; /* Pattern to match against. */ char *tail; /* Pointer to end of pattern. Tail must * point to a location in pattern and must * not be static. */ { return TclpMatchFilesTypes(interp,separators,dirPtr,pattern,tail,NULL); } #endif /* *--------------------------------------------------------------------------- * * TclpGetUserHome -- * * This function takes the specified user name and finds their |
︙ | ︙ | |||
453 454 455 456 457 458 459 460 461 462 463 464 465 466 | * * Side effects: * None. * *---------------------------------------------------------------------- */ char * TclpGetUserHome(name, bufferPtr) CONST char *name; /* User name for desired home directory. */ Tcl_DString *bufferPtr; /* Uninitialized or free DString filled * with name of user's home directory. */ { struct passwd *pwPtr; | > | 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 | * * Side effects: * None. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM char * TclpGetUserHome(name, bufferPtr) CONST char *name; /* User name for desired home directory. */ Tcl_DString *bufferPtr; /* Uninitialized or free DString filled * with name of user's home directory. */ { struct passwd *pwPtr; |
︙ | ︙ | |||
475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 | endpwent(); return NULL; } Tcl_ExternalToUtfDString(NULL, pwPtr->pw_dir, -1, bufferPtr); endpwent(); return Tcl_DStringValue(bufferPtr); } /* *--------------------------------------------------------------------------- * * TclpAccess -- * * This function replaces the library version of access(). * * Results: * See access() documentation. * * Side effects: * See access() documentation. * *--------------------------------------------------------------------------- */ int TclpAccess(path, mode) CONST char *path; /* Path of file to access (UTF-8). */ int mode; /* Permission setting. */ { int result; Tcl_DString ds; char *native; native = Tcl_UtfToExternalDString(NULL, path, -1, &ds); result = access(native, mode); /* INTL: Native. */ Tcl_DStringFree(&ds); return result; } /* *--------------------------------------------------------------------------- * * TclpChdir -- * * This function replaces the library version of chdir(). * * Results: * See chdir() documentation. * * Side effects: * See chdir() documentation. * *--------------------------------------------------------------------------- */ int TclpChdir(dirName) CONST char *dirName; /* Path to new working directory (UTF-8). */ { int result; Tcl_DString ds; char *native; native = Tcl_UtfToExternalDString(NULL, dirName, -1, &ds); result = chdir(native); /* INTL: Native. */ Tcl_DStringFree(&ds); return result; } /* *---------------------------------------------------------------------- * * TclpLstat -- * * This function replaces the library version of lstat(). * * Results: * See lstat() documentation. * * Side effects: * See lstat() documentation. * *---------------------------------------------------------------------- */ int TclpLstat(path, bufPtr) CONST char *path; /* Path of file to stat (UTF-8). */ struct stat *bufPtr; /* Filled with results of stat call. */ { int result; Tcl_DString ds; char *native; native = Tcl_UtfToExternalDString(NULL, path, -1, &ds); result = lstat(native, bufPtr); /* INTL: Native. */ Tcl_DStringFree(&ds); return result; } /* *--------------------------------------------------------------------------- * * TclpGetCwd -- * * This function replaces the library version of getcwd(). | > > > > > > > | 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 | endpwent(); return NULL; } Tcl_ExternalToUtfDString(NULL, pwPtr->pw_dir, -1, bufferPtr); endpwent(); return Tcl_DStringValue(bufferPtr); } #endif /* *--------------------------------------------------------------------------- * * TclpAccess -- * * This function replaces the library version of access(). * * Results: * See access() documentation. * * Side effects: * See access() documentation. * *--------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM int TclpAccess(path, mode) CONST char *path; /* Path of file to access (UTF-8). */ int mode; /* Permission setting. */ { int result; Tcl_DString ds; char *native; native = Tcl_UtfToExternalDString(NULL, path, -1, &ds); result = access(native, mode); /* INTL: Native. */ Tcl_DStringFree(&ds); return result; } #endif /* *--------------------------------------------------------------------------- * * TclpChdir -- * * This function replaces the library version of chdir(). * * Results: * See chdir() documentation. * * Side effects: * See chdir() documentation. * *--------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM int TclpChdir(dirName) CONST char *dirName; /* Path to new working directory (UTF-8). */ { int result; Tcl_DString ds; char *native; native = Tcl_UtfToExternalDString(NULL, dirName, -1, &ds); result = chdir(native); /* INTL: Native. */ Tcl_DStringFree(&ds); return result; } #endif /* *---------------------------------------------------------------------- * * TclpLstat -- * * This function replaces the library version of lstat(). * * Results: * See lstat() documentation. * * Side effects: * See lstat() documentation. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM int TclpLstat(path, bufPtr) CONST char *path; /* Path of file to stat (UTF-8). */ struct stat *bufPtr; /* Filled with results of stat call. */ { int result; Tcl_DString ds; char *native; native = Tcl_UtfToExternalDString(NULL, path, -1, &ds); result = lstat(native, bufPtr); /* INTL: Native. */ Tcl_DStringFree(&ds); return result; } #endif /* *--------------------------------------------------------------------------- * * TclpGetCwd -- * * This function replaces the library version of getcwd(). |
︙ | ︙ | |||
592 593 594 595 596 597 598 599 600 601 602 603 604 605 | * * Side effects: * None. * *---------------------------------------------------------------------- */ char * TclpGetCwd(interp, bufferPtr) Tcl_Interp *interp; /* If non-NULL, used for error reporting. */ Tcl_DString *bufferPtr; /* Uninitialized or free DString filled * with name of current directory. */ { char buffer[MAXPATHLEN+1]; | > | 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 | * * Side effects: * None. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM char * TclpGetCwd(interp, bufferPtr) Tcl_Interp *interp; /* If non-NULL, used for error reporting. */ Tcl_DString *bufferPtr; /* Uninitialized or free DString filled * with name of current directory. */ { char buffer[MAXPATHLEN+1]; |
︙ | ︙ | |||
614 615 616 617 618 619 620 621 622 623 624 625 626 627 | "error getting working directory name: ", Tcl_PosixError(interp), (char *) NULL); } return NULL; } return Tcl_ExternalToUtfDString(NULL, buffer, -1, bufferPtr); } /* *--------------------------------------------------------------------------- * * TclpReadlink -- * * This function replaces the library version of readlink(). | > | 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 | "error getting working directory name: ", Tcl_PosixError(interp), (char *) NULL); } return NULL; } return Tcl_ExternalToUtfDString(NULL, buffer, -1, bufferPtr); } #endif /* *--------------------------------------------------------------------------- * * TclpReadlink -- * * This function replaces the library version of readlink(). |
︙ | ︙ | |||
635 636 637 638 639 640 641 642 643 644 645 646 647 648 | * * Side effects: * See readlink() documentation. * *--------------------------------------------------------------------------- */ char * TclpReadlink(path, linkPtr) CONST char *path; /* Path of file to readlink (UTF-8). */ Tcl_DString *linkPtr; /* Uninitialized or free DString filled * with contents of link (UTF-8). */ { char link[MAXPATHLEN]; | > | 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 | * * Side effects: * See readlink() documentation. * *--------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM char * TclpReadlink(path, linkPtr) CONST char *path; /* Path of file to readlink (UTF-8). */ Tcl_DString *linkPtr; /* Uninitialized or free DString filled * with contents of link (UTF-8). */ { char link[MAXPATHLEN]; |
︙ | ︙ | |||
657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 | if (length < 0) { return NULL; } Tcl_ExternalToUtfDString(NULL, link, length, linkPtr); return Tcl_DStringValue(linkPtr); } /* *---------------------------------------------------------------------- * * TclpStat -- * * This function replaces the library version of stat(). * * Results: * See stat() documentation. * * Side effects: * See stat() documentation. * *---------------------------------------------------------------------- */ int TclpStat(path, bufPtr) CONST char *path; /* Path of file to stat (in UTF-8). */ struct stat *bufPtr; /* Filled with results of stat call. */ { int result; Tcl_DString ds; char *native; native = Tcl_UtfToExternalDString(NULL, path, -1, &ds); result = stat(native, bufPtr); /* INTL: Native. */ Tcl_DStringFree(&ds); return result; } | > > | | 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 | if (length < 0) { return NULL; } Tcl_ExternalToUtfDString(NULL, link, length, linkPtr); return Tcl_DStringValue(linkPtr); } #endif /* *---------------------------------------------------------------------- * * TclpStat -- * * This function replaces the library version of stat(). * * Results: * See stat() documentation. * * Side effects: * See stat() documentation. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM int TclpStat(path, bufPtr) CONST char *path; /* Path of file to stat (in UTF-8). */ struct stat *bufPtr; /* Filled with results of stat call. */ { int result; Tcl_DString ds; char *native; native = Tcl_UtfToExternalDString(NULL, path, -1, &ds); result = stat(native, bufPtr); /* INTL: Native. */ Tcl_DStringFree(&ds); return result; } #endif |
Changes to unix/tclUnixInit.c.
1 2 3 4 5 6 7 8 9 | /* * tclUnixInit.c -- * * Contains the Unix-specific interpreter initialization functions. * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * Copyright (c) 1999 by Scriptics Corporation. * All rights reserved. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | /* * tclUnixInit.c -- * * Contains the Unix-specific interpreter initialization functions. * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * Copyright (c) 1999 by Scriptics Corporation. * All rights reserved. * * RCS: @(#) $Id: tclUnixInit.c,v 1.18.2.3.2.1 2001/11/28 17:58:37 andreas_kupries Exp $ */ #include "tclInt.h" #include "tclPort.h" #include <locale.h> #if defined(__FreeBSD__) # include <floatingpoint.h> |
︙ | ︙ | |||
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | * *--------------------------------------------------------------------------- */ void TclpInitPlatform() { tclPlatform = TCL_PLATFORM_UNIX; /* * The code below causes SIGPIPE (broken pipe) errors to * be ignored. This is needed so that Tcl processes don't * die if they create child processes (e.g. using "exec" or * "open") that terminate prematurely. The signal handler * is only set up when the first interpreter is created; | > > > | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | * *--------------------------------------------------------------------------- */ void TclpInitPlatform() { #ifndef TCL_NO_FILESYSTEM /* See tclFileName.c for definition and usage */ tclPlatform = TCL_PLATFORM_UNIX; #endif /* * The code below causes SIGPIPE (broken pipe) errors to * be ignored. This is needed so that Tcl processes don't * die if they create child processes (e.g. using "exec" or * "open") that terminate prematurely. The signal handler * is only set up when the first interpreter is created; |
︙ | ︙ | |||
182 183 184 185 186 187 188 189 190 191 192 193 194 195 | * * Side effects: * None. * *--------------------------------------------------------------------------- */ void TclpInitLibraryPath(path) CONST char *path; /* Path to the executable in native * multi-byte encoding. */ { #define LIBRARY_SIZE 32 Tcl_Obj *pathPtr, *objPtr; | > | 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | * * Side effects: * None. * *--------------------------------------------------------------------------- */ #ifndef TCL_NO_FILESYSTEM void TclpInitLibraryPath(path) CONST char *path; /* Path to the executable in native * multi-byte encoding. */ { #define LIBRARY_SIZE 32 Tcl_Obj *pathPtr, *objPtr; |
︙ | ︙ | |||
357 358 359 360 361 362 363 364 365 366 367 368 369 370 | objPtr = Tcl_NewStringObj(str, -1); Tcl_ListObjAppendElement(NULL, pathPtr, objPtr); } TclSetLibraryPath(pathPtr); Tcl_DStringFree(&buffer); } /* *--------------------------------------------------------------------------- * * TclpSetInitialEncodings -- * * Based on the locale, determine the encoding of the operating | > | 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 | objPtr = Tcl_NewStringObj(str, -1); Tcl_ListObjAppendElement(NULL, pathPtr, objPtr); } TclSetLibraryPath(pathPtr); Tcl_DStringFree(&buffer); } #endif /* *--------------------------------------------------------------------------- * * TclpSetInitialEncodings -- * * Based on the locale, determine the encoding of the operating |
︙ | ︙ | |||
382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 | */ void TclpSetInitialEncodings() { CONST char *encoding; int i; Tcl_Obj *pathPtr; char *langEnv; /* * Determine the current encoding from the LC_* or LANG environment * variables. We previously used setlocale() to determine the locale, * but this does not work on some systems (e.g. Linux/i386 RH 5.0). */ | > > | 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | */ void TclpSetInitialEncodings() { CONST char *encoding; int i; #ifndef TCL_NO_FILESYSTEM Tcl_Obj *pathPtr; #endif char *langEnv; /* * Determine the current encoding from the LC_* or LANG environment * variables. We previously used setlocale() to determine the locale, * but this does not work on some systems (e.g. Linux/i386 RH 5.0). */ |
︙ | ︙ | |||
489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 | * Now that the system encoding was actually successfully set, * translate all the names in the library path to UTF-8. That way, * next time we search the library path, we'll translate the names * from UTF-8 to the system encoding which will be the native * encoding. */ pathPtr = TclGetLibraryPath(); if (pathPtr != NULL) { int objc; Tcl_Obj **objv; objc = 0; Tcl_ListObjGetElements(NULL, pathPtr, &objc, &objv); for (i = 0; i < objc; i++) { int length; char *string; Tcl_DString ds; string = Tcl_GetStringFromObj(objv[i], &length); Tcl_ExternalToUtfDString(NULL, string, length, &ds); Tcl_SetStringObj(objv[i], Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); Tcl_DStringFree(&ds); } } /* * Keep the iso8859-1 encoding preloaded. The IO package uses it for * gets on a binary channel. */ Tcl_GetEncoding(NULL, "iso8859-1"); | > > | 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 | * Now that the system encoding was actually successfully set, * translate all the names in the library path to UTF-8. That way, * next time we search the library path, we'll translate the names * from UTF-8 to the system encoding which will be the native * encoding. */ #ifndef TCL_NO_FILESYSTEM pathPtr = TclGetLibraryPath(); if (pathPtr != NULL) { int objc; Tcl_Obj **objv; objc = 0; Tcl_ListObjGetElements(NULL, pathPtr, &objc, &objv); for (i = 0; i < objc; i++) { int length; char *string; Tcl_DString ds; string = Tcl_GetStringFromObj(objv[i], &length); Tcl_ExternalToUtfDString(NULL, string, length, &ds); Tcl_SetStringObj(objv[i], Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); Tcl_DStringFree(&ds); } } #endif /* * Keep the iso8859-1 encoding preloaded. The IO package uses it for * gets on a binary channel. */ Tcl_GetEncoding(NULL, "iso8859-1"); |
︙ | ︙ | |||
689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 | *---------------------------------------------------------------------- */ int Tcl_Init(interp) Tcl_Interp *interp; /* Interpreter to initialize. */ { Tcl_Obj *pathPtr; if (tclPreInitScript != NULL) { if (Tcl_Eval(interp, tclPreInitScript) == TCL_ERROR) { return (TCL_ERROR); }; } pathPtr = TclGetLibraryPath(); if (pathPtr == NULL) { pathPtr = Tcl_NewObj(); } Tcl_SetVar2Ex(interp, "tcl_libPath", NULL, pathPtr, TCL_GLOBAL_ONLY); return Tcl_Eval(interp, initScript); } /* *---------------------------------------------------------------------- * * Tcl_SourceRCFile -- | > > > > | 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 | *---------------------------------------------------------------------- */ int Tcl_Init(interp) Tcl_Interp *interp; /* Interpreter to initialize. */ { #ifndef TCL_NO_FILESYSTEM Tcl_Obj *pathPtr; #endif if (tclPreInitScript != NULL) { if (Tcl_Eval(interp, tclPreInitScript) == TCL_ERROR) { return (TCL_ERROR); }; } #ifndef TCL_NO_FILESYSTEM pathPtr = TclGetLibraryPath(); if (pathPtr == NULL) { pathPtr = Tcl_NewObj(); } Tcl_SetVar2Ex(interp, "tcl_libPath", NULL, pathPtr, TCL_GLOBAL_ONLY); #endif return Tcl_Eval(interp, initScript); } /* *---------------------------------------------------------------------- * * Tcl_SourceRCFile -- |
︙ | ︙ | |||
727 728 729 730 731 732 733 734 735 736 737 738 739 740 | *---------------------------------------------------------------------- */ void Tcl_SourceRCFile(interp) Tcl_Interp *interp; /* Interpreter to source rc file into. */ { Tcl_DString temp; char *fileName; Tcl_Channel errChannel; fileName = Tcl_GetVar(interp, "tcl_rcFileName", TCL_GLOBAL_ONLY); if (fileName != NULL) { | > > > > > > > | 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 | *---------------------------------------------------------------------- */ void Tcl_SourceRCFile(interp) Tcl_Interp *interp; /* Interpreter to source rc file into. */ { #ifndef TCL_NO_FILESYSTEM #ifndef TCL_NO_NONSTDCHAN /* This functionality cannot be made available if the channel * system is restricted to the standard channels, i.e. stdin, * stdout, stderr. */ Tcl_DString temp; char *fileName; Tcl_Channel errChannel; fileName = Tcl_GetVar(interp, "tcl_rcFileName", TCL_GLOBAL_ONLY); if (fileName != NULL) { |
︙ | ︙ | |||
765 766 767 768 769 770 771 772 773 774 775 776 777 778 | Tcl_WriteChars(errChannel, "\n", 1); } } } } Tcl_DStringFree(&temp); } } /* *---------------------------------------------------------------------- * * TclpCheckStackSpace -- * | > > | 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 | Tcl_WriteChars(errChannel, "\n", 1); } } } } Tcl_DStringFree(&temp); } #endif #endif /* TCL_NO_FILESYSTEM */ } /* *---------------------------------------------------------------------- * * TclpCheckStackSpace -- * |
︙ | ︙ |
Changes to unix/tclUnixNotfy.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tclUnixNotify.c -- * * This file contains the implementation of the select-based * Unix-specific notifier, which is the lowest-level part of the * Tcl event loop. This file works together with * ../generic/tclNotify.c. * * Copyright (c) 1995-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. * | | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | /* * tclUnixNotify.c -- * * This file contains the implementation of the select-based * Unix-specific notifier, which is the lowest-level part of the * Tcl event loop. This file works together with * ../generic/tclNotify.c. * * Copyright (c) 1995-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: tclUnixNotfy.c,v 1.10.20.1 2001/11/28 17:58:37 andreas_kupries Exp $ */ #include "tclInt.h" #include "tclPort.h" #include <signal.h> extern TclStubs tclStubs; #ifndef TCL_NO_FILEEVENTS /* * This structure is used to keep track of the notifier info for a * a registered file. */ typedef struct FileHandler { int fd; |
︙ | ︙ | |||
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | * all events. */ int fd; /* File descriptor that is ready. Used * to find the FileHandler structure for * the file (can't point directly to the * FileHandler structure because it could * go away while the event is queued). */ } FileHandlerEvent; /* * The following static structure contains the state information for the * select based implementation of the Tcl notifier. One of these structures * is created for each thread that is using the notifier. */ typedef struct ThreadSpecificData { FileHandler *firstFileHandlerPtr; /* Pointer to head of file handler list. */ fd_mask checkMasks[3*MASK_SIZE]; /* This array is used to build up the masks * to be used in the next call to select. * Bits are set in response to calls to * Tcl_CreateFileHandler. */ fd_mask readyMasks[3*MASK_SIZE]; /* This array reflects the readable/writable | > > > | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | * all events. */ int fd; /* File descriptor that is ready. Used * to find the FileHandler structure for * the file (can't point directly to the * FileHandler structure because it could * go away while the event is queued). */ } FileHandlerEvent; #endif /* * The following static structure contains the state information for the * select based implementation of the Tcl notifier. One of these structures * is created for each thread that is using the notifier. */ typedef struct ThreadSpecificData { #ifndef TCL_NO_FILEEVENTS FileHandler *firstFileHandlerPtr; /* Pointer to head of file handler list. */ #endif fd_mask checkMasks[3*MASK_SIZE]; /* This array is used to build up the masks * to be used in the next call to select. * Bits are set in response to calls to * Tcl_CreateFileHandler. */ fd_mask readyMasks[3*MASK_SIZE]; /* This array reflects the readable/writable |
︙ | ︙ | |||
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | /* * Static routines defined in this file. */ #ifdef TCL_THREADS static void NotifierThreadProc _ANSI_ARGS_((ClientData clientData)); #endif static int FileHandlerEventProc _ANSI_ARGS_((Tcl_Event *evPtr, int flags)); /* *---------------------------------------------------------------------- * * Tcl_InitNotifier -- * * Initializes the platform specific notifier state. | > > | 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | /* * Static routines defined in this file. */ #ifdef TCL_THREADS static void NotifierThreadProc _ANSI_ARGS_((ClientData clientData)); #endif #ifndef TCL_NO_FILEEVENTS static int FileHandlerEventProc _ANSI_ARGS_((Tcl_Event *evPtr, int flags)); #endif /* *---------------------------------------------------------------------- * * Tcl_InitNotifier -- * * Initializes the platform specific notifier state. |
︙ | ︙ | |||
393 394 395 396 397 398 399 400 401 402 403 404 405 406 | * * Side effects: * Creates a new file handler structure. * *---------------------------------------------------------------------- */ void Tcl_CreateFileHandler(fd, mask, proc, clientData) int fd; /* Handle of stream to watch. */ int mask; /* OR'ed combination of TCL_READABLE, * TCL_WRITABLE, and TCL_EXCEPTION: * indicates conditions under which * proc should be called. */ | > | 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 | * * Side effects: * Creates a new file handler structure. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILEEVENTS void Tcl_CreateFileHandler(fd, mask, proc, clientData) int fd; /* Handle of stream to watch. */ int mask; /* OR'ed combination of TCL_READABLE, * TCL_WRITABLE, and TCL_EXCEPTION: * indicates conditions under which * proc should be called. */ |
︙ | ︙ | |||
455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 | } else { (tsdPtr->checkMasks+2*(MASK_SIZE))[index] &= ~bit; } if (tsdPtr->numFdBits <= fd) { tsdPtr->numFdBits = fd+1; } } /* *---------------------------------------------------------------------- * * Tcl_DeleteFileHandler -- * * Cancel a previously-arranged callback arrangement for * a file. * * Results: * None. * * Side effects: * If a callback was previously registered on file, remove it. * *---------------------------------------------------------------------- */ void Tcl_DeleteFileHandler(fd) int fd; /* Stream id for which to remove callback procedure. */ { FileHandler *filePtr, *prevPtr; int index, bit, i; unsigned long flags; | > > | 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 | } else { (tsdPtr->checkMasks+2*(MASK_SIZE))[index] &= ~bit; } if (tsdPtr->numFdBits <= fd) { tsdPtr->numFdBits = fd+1; } } #endif /* *---------------------------------------------------------------------- * * Tcl_DeleteFileHandler -- * * Cancel a previously-arranged callback arrangement for * a file. * * Results: * None. * * Side effects: * If a callback was previously registered on file, remove it. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILEEVENTS void Tcl_DeleteFileHandler(fd) int fd; /* Stream id for which to remove callback procedure. */ { FileHandler *filePtr, *prevPtr; int index, bit, i; unsigned long flags; |
︙ | ︙ | |||
550 551 552 553 554 555 556 557 558 559 560 561 562 563 | if (prevPtr == NULL) { tsdPtr->firstFileHandlerPtr = filePtr->nextPtr; } else { prevPtr->nextPtr = filePtr->nextPtr; } ckfree((char *) filePtr); } /* *---------------------------------------------------------------------- * * FileHandlerEventProc -- * * This procedure is called by Tcl_ServiceEvent when a file event | > | 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 | if (prevPtr == NULL) { tsdPtr->firstFileHandlerPtr = filePtr->nextPtr; } else { prevPtr->nextPtr = filePtr->nextPtr; } ckfree((char *) filePtr); } #endif /* *---------------------------------------------------------------------- * * FileHandlerEventProc -- * * This procedure is called by Tcl_ServiceEvent when a file event |
︙ | ︙ | |||
573 574 575 576 577 578 579 580 581 582 583 584 585 586 | * * Side effects: * Whatever the file handler's callback procedure does. * *---------------------------------------------------------------------- */ static int FileHandlerEventProc(evPtr, flags) Tcl_Event *evPtr; /* Event to service. */ int flags; /* Flags that indicate what events to * handle, such as TCL_FILE_EVENTS. */ { int mask; | > | 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 | * * Side effects: * Whatever the file handler's callback procedure does. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_FILEEVENTS static int FileHandlerEventProc(evPtr, flags) Tcl_Event *evPtr; /* Event to service. */ int flags; /* Flags that indicate what events to * handle, such as TCL_FILE_EVENTS. */ { int mask; |
︙ | ︙ | |||
623 624 625 626 627 628 629 630 631 632 633 634 635 636 | if (mask != 0) { (*filePtr->proc)(filePtr->clientData, mask); } break; } return 1; } /* *---------------------------------------------------------------------- * * Tcl_WaitForEvent -- * * This function is called by Tcl_DoOneEvent to wait for new | > | 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 | if (mask != 0) { (*filePtr->proc)(filePtr->clientData, mask); } break; } return 1; } #endif /* *---------------------------------------------------------------------- * * Tcl_WaitForEvent -- * * This function is called by Tcl_DoOneEvent to wait for new |
︙ | ︙ | |||
647 648 649 650 651 652 653 654 655 | *---------------------------------------------------------------------- */ int Tcl_WaitForEvent(timePtr) Tcl_Time *timePtr; /* Maximum block time, or NULL. */ { FileHandler *filePtr; FileHandlerEvent *fileEvPtr; | > < > > | 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 | *---------------------------------------------------------------------- */ int Tcl_WaitForEvent(timePtr) Tcl_Time *timePtr; /* Maximum block time, or NULL. */ { #ifndef TCL_NO_FILEEVENTS FileHandler *filePtr; FileHandlerEvent *fileEvPtr; int bit, index, mask; #endif struct timeval timeout, *timeoutPtr; #ifdef TCL_THREADS int waitForFiles; #else int numFound; #endif ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); |
︙ | ︙ | |||
779 780 781 782 783 784 785 786 787 788 789 790 791 792 | */ if (numFound == -1) { memset((VOID *) tsdPtr->readyMasks, 0, 3*MASK_SIZE*sizeof(fd_mask)); } #endif /* * Queue all detected file events before returning. */ for (filePtr = tsdPtr->firstFileHandlerPtr; (filePtr != NULL); filePtr = filePtr->nextPtr) { index = filePtr->fd / (NBBY*sizeof(fd_mask)); | > | 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 | */ if (numFound == -1) { memset((VOID *) tsdPtr->readyMasks, 0, 3*MASK_SIZE*sizeof(fd_mask)); } #endif #ifndef TCL_NO_FILEEVENTS /* * Queue all detected file events before returning. */ for (filePtr = tsdPtr->firstFileHandlerPtr; (filePtr != NULL); filePtr = filePtr->nextPtr) { index = filePtr->fd / (NBBY*sizeof(fd_mask)); |
︙ | ︙ | |||
817 818 819 820 821 822 823 824 825 826 827 828 829 830 | sizeof(FileHandlerEvent)); fileEvPtr->header.proc = FileHandlerEventProc; fileEvPtr->fd = filePtr->fd; Tcl_QueueEvent((Tcl_Event *) fileEvPtr, TCL_QUEUE_TAIL); } filePtr->readyMask = mask; } #ifdef TCL_THREADS Tcl_MutexUnlock(¬ifierMutex); #endif return 0; } #ifdef TCL_THREADS | > | 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 | sizeof(FileHandlerEvent)); fileEvPtr->header.proc = FileHandlerEventProc; fileEvPtr->fd = filePtr->fd; Tcl_QueueEvent((Tcl_Event *) fileEvPtr, TCL_QUEUE_TAIL); } filePtr->readyMask = mask; } #endif #ifdef TCL_THREADS Tcl_MutexUnlock(¬ifierMutex); #endif return 0; } #ifdef TCL_THREADS |
︙ | ︙ |
Changes to unix/tclUnixPipe.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * tclUnixPipe.c -- * * This file implements the UNIX-specific exec pipeline functions, * the "pipe" channel driver, and the "pid" Tcl command. * * Copyright (c) 1991-1994 The Regents of the University of California. * Copyright (c) 1994-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. * | | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | /* * tclUnixPipe.c -- * * This file implements the UNIX-specific exec pipeline functions, * the "pipe" channel driver, and the "pid" Tcl command. * * Copyright (c) 1991-1994 The Regents of the University of California. * Copyright (c) 1994-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: tclUnixPipe.c,v 1.9.2.2.2.1 2001/11/28 17:58:37 andreas_kupries Exp $ */ #include "tclInt.h" #include "tclPort.h" #ifndef TCL_NO_PIPES /* * The following macros convert between TclFile's and fd's. The conversion * simple involves shifting fd's up by one to ensure that no valid fd is ever * the same as NULL. */ #define MakeFile(fd) ((TclFile)(((int)fd)+1)) |
︙ | ︙ | |||
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | * Refuse to close the fds for stdin, stdout and stderr. */ if ((fd == 0) || (fd == 1) || (fd == 2)) { return 0; } Tcl_DeleteFileHandler(fd); return close(fd); } /* *--------------------------------------------------------------------------- * * TclpCreateProcess -- | > > | 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | * Refuse to close the fds for stdin, stdout and stderr. */ if ((fd == 0) || (fd == 1) || (fd == 2)) { return 0; } #ifndef TCL_NO_FILEEVENTS Tcl_DeleteFileHandler(fd); #endif return close(fd); } /* *--------------------------------------------------------------------------- * * TclpCreateProcess -- |
︙ | ︙ | |||
1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 | static void PipeWatchProc(instanceData, mask) ClientData instanceData; /* The pipe state. */ int mask; /* Events of interest; an OR-ed * combination of TCL_READABLE, * TCL_WRITABEL and TCL_EXCEPTION. */ { PipeState *psPtr = (PipeState *) instanceData; int newmask; if (psPtr->inFile) { newmask = mask & (TCL_READABLE | TCL_EXCEPTION); if (newmask) { Tcl_CreateFileHandler(GetFd(psPtr->inFile), mask, | > | 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 | static void PipeWatchProc(instanceData, mask) ClientData instanceData; /* The pipe state. */ int mask; /* Events of interest; an OR-ed * combination of TCL_READABLE, * TCL_WRITABEL and TCL_EXCEPTION. */ { #ifndef TCL_NO_FILEEVENTS PipeState *psPtr = (PipeState *) instanceData; int newmask; if (psPtr->inFile) { newmask = mask & (TCL_READABLE | TCL_EXCEPTION); if (newmask) { Tcl_CreateFileHandler(GetFd(psPtr->inFile), mask, |
︙ | ︙ | |||
1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 | Tcl_CreateFileHandler(GetFd(psPtr->outFile), mask, (Tcl_FileProc *) Tcl_NotifyChannel, (ClientData) psPtr->channel); } else { Tcl_DeleteFileHandler(GetFd(psPtr->outFile)); } } } /* *---------------------------------------------------------------------- * * PipeGetHandleProc -- * | > | 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 | Tcl_CreateFileHandler(GetFd(psPtr->outFile), mask, (Tcl_FileProc *) Tcl_NotifyChannel, (ClientData) psPtr->channel); } else { Tcl_DeleteFileHandler(GetFd(psPtr->outFile)); } } #endif } /* *---------------------------------------------------------------------- * * PipeGetHandleProc -- * |
︙ | ︙ | |||
1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 | while (1) { result = (int) waitpid(real_pid, statPtr, options); if ((result != -1) || (errno != EINTR)) { return (Tcl_Pid) result; } } } /* *---------------------------------------------------------------------- * * Tcl_PidObjCmd -- * * This procedure is invoked to process the "pid" Tcl command. * See the user documentation for details on what it does. * * Results: * A standard Tcl result. * * Side effects: * See the user documentation. * *---------------------------------------------------------------------- */ /* ARGSUSED */ int Tcl_PidObjCmd(dummy, interp, objc, objv) ClientData dummy; /* Not used. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST *objv; /* Argument strings. */ { Tcl_Channel chan; Tcl_ChannelType *chanTypePtr; PipeState *pipePtr; int i; Tcl_Obj *resultPtr, *longObjPtr; | > > > | > > > > > > | 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 | while (1) { result = (int) waitpid(real_pid, statPtr, options); if ((result != -1) || (errno != EINTR)) { return (Tcl_Pid) result; } } } #endif /* *---------------------------------------------------------------------- * * Tcl_PidObjCmd -- * * This procedure is invoked to process the "pid" Tcl command. * See the user documentation for details on what it does. * * Results: * A standard Tcl result. * * Side effects: * See the user documentation. * *---------------------------------------------------------------------- */ #ifndef TCL_NO_PIDCMD /* ARGSUSED */ int Tcl_PidObjCmd(dummy, interp, objc, objv) ClientData dummy; /* Not used. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST *objv; /* Argument strings. */ { #ifndef TCL_NO_PIPES Tcl_Channel chan; Tcl_ChannelType *chanTypePtr; PipeState *pipePtr; int i; Tcl_Obj *resultPtr, *longObjPtr; #endif if (objc > 2) { Tcl_WrongNumArgs(interp, 1, objv, "?channelId?"); return TCL_ERROR; } if (objc == 1) { Tcl_SetLongObj(Tcl_GetObjResult(interp), (long) getpid()); } else { #ifndef TCL_NO_PIPES chan = Tcl_GetChannel(interp, Tcl_GetString(objv[1]), NULL); if (chan == (Tcl_Channel) NULL) { return TCL_ERROR; } chanTypePtr = Tcl_GetChannelType(chan); if (chanTypePtr != &pipeChannelType) { return TCL_OK; } pipePtr = (PipeState *) Tcl_GetChannelInstanceData(chan); resultPtr = Tcl_GetObjResult(interp); for (i = 0; i < pipePtr->numPids; i++) { longObjPtr = Tcl_NewLongObj((long) TclpGetPid(pipePtr->pidPtr[i])); Tcl_ListObjAppendElement(NULL, resultPtr, longObjPtr); } #else /* IOS FIXME: Add error message */ return TCL_ERROR; #endif } return TCL_OK; } #endif /* TCL_NO_PIDCMD */ |
Changes to unix/tclUnixSock.c.
1 2 3 4 5 6 7 8 9 10 | /* * tclUnixSock.c -- * * This file contains Unix-specific socket related code. * * Copyright (c) 1995 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /* * tclUnixSock.c -- * * This file contains Unix-specific socket related code. * * Copyright (c) 1995 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: tclUnixSock.c,v 1.4.30.1 2001/11/28 17:58:37 andreas_kupries Exp $ */ #include "tcl.h" #include "tclPort.h" /* * There is no portable macro for the maximum length |
︙ | ︙ | |||
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | #endif /* * The following variable holds the network name of this host. */ static char hostname[TCL_HOSTNAME_LEN + 1]; static int hostnameInited = 0; TCL_DECLARE_MUTEX(hostMutex) /* *---------------------------------------------------------------------- * * Tcl_GetHostName -- * * Returns the name of the local host. | > > > > > > | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | #endif /* * The following variable holds the network name of this host. */ #ifndef TCL_NO_SOCKETS static char hostname[TCL_HOSTNAME_LEN + 1]; static int hostnameInited = 0; TCL_DECLARE_MUTEX(hostMutex) #else /* Without sockets a network hostname makes no sense. */ static char hostname [] = ""; #endif /* *---------------------------------------------------------------------- * * Tcl_GetHostName -- * * Returns the name of the local host. |
︙ | ︙ | |||
61 62 63 64 65 66 67 68 69 70 71 72 73 74 | * *---------------------------------------------------------------------- */ char * Tcl_GetHostName() { #ifndef NO_UNAME struct utsname u; struct hostent *hp; #else char buffer[sizeof(hostname)]; #endif CONST char *native; | > > > > > > | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | * *---------------------------------------------------------------------- */ char * Tcl_GetHostName() { #ifdef TCL_NO_SOCKETS /* Empty string, pre-initialized. */ return hostname; #else #ifndef NO_UNAME struct utsname u; struct hostent *hp; #else char buffer[sizeof(hostname)]; #endif CONST char *native; |
︙ | ︙ | |||
105 106 107 108 109 110 111 112 113 114 115 116 117 118 | } else { Tcl_ExternalToUtf(NULL, NULL, native, -1, 0, NULL, hostname, sizeof(hostname), NULL, NULL, NULL); } hostnameInited = 1; Tcl_MutexUnlock(&hostMutex); return hostname; } /* *---------------------------------------------------------------------- * * TclpHasSockets -- * | > | 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | } else { Tcl_ExternalToUtf(NULL, NULL, native, -1, 0, NULL, hostname, sizeof(hostname), NULL, NULL, NULL); } hostnameInited = 1; Tcl_MutexUnlock(&hostMutex); return hostname; #endif } /* *---------------------------------------------------------------------- * * TclpHasSockets -- * |
︙ | ︙ | |||
127 128 129 130 131 132 133 134 135 | *---------------------------------------------------------------------- */ int TclpHasSockets(interp) Tcl_Interp *interp; /* Not used. */ { return TCL_OK; } | > > > > | 140 141 142 143 144 145 146 147 148 149 150 151 152 | *---------------------------------------------------------------------- */ int TclpHasSockets(interp) Tcl_Interp *interp; /* Not used. */ { #ifndef TCL_NO_SOCKETS return TCL_OK; #else return TCL_ERROR; #endif } |