Compare commits

...
Author SHA1 Message Date
dgp b659fcbde5 merge updates from HEAD 2005-10-08 13:44:37 +00:00
dgp 649f61b98a more WIDE support 2005-10-08 06:43:18 +00:00
dgp 7d23db80ae [kennykb-numerics-branch]
* generic/tclExecute.c: More performance macros and special
        handling of the wide integer type for performance on 32-bit
        systems.
2005-10-08 06:07:58 +00:00
dgp c45a3a5fcd * generic/tclExecute.c: Macro GetNumberFromObj() is version of
TclGetNumberFromObj() that saves a function call for common uses.
2005-10-08 01:07:42 +00:00
dgp 8bf170beb2 [kennykb-numerics-branch]
* generic/tclInt.h:     Made #undef NO_WIDE_TYPE the default on
        32-bit systems.  Being able to use 64-bit values without leaping
        to mp_int should help with performance.
        * generic/tclObj.c:     Bug fixes in the #undef NO_WIDE_TYPE
        * generic/tclExecute.c: configuration.
2005-10-07 20:15:08 +00:00
dgp 46794ab47a [kennykb-numerics-branch]
* generic/tclExecute.c: Improved performance of comparison opcodes
        and bitwise operations and removed yet more dead code.
2005-10-07 18:01:40 +00:00
dgp f511c252c7 [kennykb-numerics-branch]
* generic/tclExecute.c: Improved performance of comparison opcodes
        and removed yet more dead code.
2005-10-07 15:51:26 +00:00
dgp 55aabc9f45 store shift result as long, not int 2005-10-06 22:04:22 +00:00
dgp 8a9bae82d9 [kennykb-numerics-branch]
* generic/tclExecute.c: Improved performance of INST_RSHIFT and
        INST_LSHIFT.
2005-10-06 18:48:51 +00:00
dgp 03eab293a1 [kennykb-numerics-branch]
* generic/tclExecute.c: Improved performance of INST_RSHIFT.
2005-10-06 16:14:45 +00:00
dgp 39ea7ab5cb [kennykb-numerics-branch]
* generic/tclExecute.c: Improved performance of INST_MULT, INST_DIV,
        INST_ADD, and INST_SUB and replaced a "goto... label" with a
        "break from loop" in TclIncrObj() and removed some dead code.
2005-10-06 03:41:27 +00:00
dgp 82f10f44f0 [kennykb-numerics-branch]
* generic/tclExecute.c: Improved performance of INST_MULT and INST_DIV
        and replaced a "goto... label" with a "break from loop" in TclIncrObj()
        and removed some dead code.
2005-10-06 02:51:00 +00:00
dgp 573ba64d02 [kennykb-numerics-branch]
* generic/tclExecute.c: Improved performance INST_MULT and
        replaces a "goto... label" with a "break from loop" in TclIncrObj().
2005-10-05 16:28:39 +00:00
dgp ad48b00d6a [kennykb-numerics-branch]
* generic/tclExecute.c: Updated TclIncrObj() to more efficiently
        add native long integers.  Also updated IllegalExprOperandType
        and the INST_UMINUS, INST_UPLUS, INST_BITNOT, and
        INST_TRY_CVT_TO_NUMERIC sections for performance.
2005-10-04 21:02:29 +00:00
dgp d28cd9eaf5 [kennykb-numerics-branch]
* generic/tclExecute.c: Updated TclIncrObj() to more efficiently
        add native long integers.  Also updated IllegalExprOperandType
        and the INST_UMINUS and INST_BITNOT sections for performance.
2005-10-04 18:33:54 +00:00
dgp c2a029adbf [kennykb-numerics-branch]
* generic/tclExecute.c: Updated TclIncrObj() to more efficiently
        add native long integers.
2005-10-04 16:00:12 +00:00
dgp eb30a5b53f [kennykb-numerics-branch]
* generic/tclBasic.c:   Updated more callers to make use of
        TclGetNumberFromObj.  Removed some dead code.
2005-10-04 13:49:35 +00:00
dgp 89077cc8f5 * generic/tclBasic.c: Re-implemented ExprRoundFunc and ExprEntierFunc
to use TclGetNumberFromObj.
2005-10-03 19:32:41 +00:00
dgp 200f255075 Be more choosy about what doubles get converted to longs. 2005-10-03 18:25:19 +00:00
dgp dc93758c7e [kennykb-numerics-branch]
* generic/tclBasic.c:   Re-implemented ExprRoundFunc to use
        TclGetNumberFromObj.

        * generic/tclInt.h:     Added new routine TclGetNumberFromObj to
        * generic/tclObj.c:     provide efficient access to the actual
        internal rep of a numeric Tcl_Obj without conversions.
2005-10-03 15:50:18 +00:00
dgp 5895b5d277 [kennykb-numerics-branch]
* generic/tclStringObj.c:       Bug fix: Missing cast to large enough
        integral size before << operations led to broken [format %llx] results.
        Thanks to Robert Henry for reporting the bug.
2005-09-30 17:02:03 +00:00
dgp 2c862af601 formatting 2005-09-28 00:23:46 +00:00
dgp dbdbc9aaec [kennykb-numerics-branch]
* generic/tcl.h:        Changed name of the new Tcl_Obj intrep field
        * generic/tclObj.c:     from "bignumValue" to "ptrAndLongRep" as
        * generic/tclProc.c:    described in TIP 237, and more suitable for
        other more general uses.
2005-09-27 18:42:53 +00:00
Kevin B Kenny b14e5692df Merge changes from HEAD, including libtommath 0.36 2005-09-26 20:16:53 +00:00
dgp acaa5db4eb [kennykb-numerics-branch]
* unix/Makefile.in:     Added -DMP_PREC=4 switch to all compiles so
        * win/Makefile.in:      that minimum memory requirements of mp_int's
        * win/makefile.vc:      will not be quite so large.  [Bug 1299153].
2005-09-23 16:47:34 +00:00
dgp 17bcbaed89 [kennykb-numerics-branch]
* generic/tclStrToD.c:  Fixed memory leak.  [Bug 1299803].
        * generic/tclObj.c:
2005-09-23 16:13:14 +00:00
dgp 6b7c5fea97 [kennykb-numerics-branch]
* generic/tclStrToD.c:  Memory leak.  Comment in TclSetBignumIntRep
        * generic/tclObj.c:     indicates that mp_init() is called on the
        bignumValue argument to clear it, while keeping the digits array
        transferred to the interp of the Tcl_Obj.  The implication is that
        callers of TclSetBignumIntRep() (and their callers) need not call
        mp_clear(), but can imagine they've transferred ownership of an
        mp_int value to Tcl.  However, mp_init() doesn't merely re-initialize
        the fields of an mp_int to hold the value zero.  It also allocates
        a fresh dp array of minimum size governed by MP_PREC.  Without a
        corresponding mp_clear() call somewhere, these dp arrays are leaked.
        Added some mp_clear() calls to fix the leak, but better fix strategies
        should still be pursued.  Perhaps the best approach is to just
        invade the mp_int struct and do the necessary surgery ourselves.
2005-09-23 04:03:43 +00:00
dgp 46f5aa9204 [kennykb-numerics-branch]
* generic/tclExecute.c: Revise TclIncrObj() to call
        Tcl_GetBignumAndClearObj.

        * generic/tcl.decls:    Add Tcl_GetBignumAndClearObj.
        * generic/tclObj.c:

        * generic/tclDecls.h:   make genstubs
        * generic/tclStubInit.c:
2005-09-20 14:11:51 +00:00
dgp 73bff3dcd5 [kennykb-numerics-branch]
* generic/tclInt.h:             Added TclBNInitBigNumFromWideInt()
        * generic/tclTomMathInterface.c:        so that every caller isn't
        required to duplicate the sign logic to use the unsigned interface.

        * generic/tclBasic.c:   Reduce the number of places where Tcl
        * generic/tclExecute.c: intrudes into the internal format details
        * generic/tclObj.c:     of the mp_int struct.
        * generic/tclStrToD.c:
        * generic/tcLStringObj.c:

        * generic/tclTomMath.h: Added mp_cmp_d to routines from
        * unix/Makefile.in:     libtommath used by Tcl.
        * win/Makefile.in:
        * win/makefile.vc:
2005-09-16 19:29:02 +00:00
dgp 046a52bed1 * libtommath/bn_mp_add_d.c: Bug fix. For mp_add_d(&a, d, &c),
when &a has the value -d, then the value &c computed should be zero,
        but mp_add_d was producing an inconsistent zero value with a sign
        field of MP_NEG, something like a value of -0, which other routines
        in libtommath can't handle.
2005-09-16 16:13:16 +00:00
dgp 7104976b96 [kennykb-numerics-branch]
* generic/tclTomMath.h: Added mp_cmp_d to routines from
        * unix/Makefile.in:     libtommath used by Tcl.
        * win/Makefile.in:
        * win/makefile.vc:

        * generic/tclExecute.c: Dropped all creation of "bigOne" values
        and just use tommath routines that accept the value "1" directly.
2005-09-16 15:35:52 +00:00
dgp 6032a071b0 merge updates from HEAD 2005-09-15 20:58:38 +00:00
dgp 04924f4785 uninitialized vars are bad, mm'kay? 2005-09-12 19:39:01 +00:00
dgp cb5afbdeec * generic/tclCmdAH.c: Added support for the "ll" width
* generic/tclStringObj.c:       specifier to [format].
2005-09-12 19:12:27 +00:00
dgp 36b9482da2 [kennykb-numerics-branch] Merge updates from HEAD. 2005-09-12 14:47:16 +00:00
dgp 0c52f85436 silence compiler warnings 2005-09-09 19:27:15 +00:00
dgp 8aaaed8419 [kennykb-numerics-branch] Merge updates from HEAD. 2005-09-09 18:48:39 +00:00
dgp 193bb84d57 [kennykb-numerics-branch]
* generic/tclScan.c:    Bug fix: The %o, %x, %i formats of [scan]
        must not accept any 0b or 0o prefixes.  [scan $s %o] must continue
        to work even with KILL_OCTAL enabled.

        * generic/tclInt.h:     Added TCL_PARSE_SCAN_PREFIXES to the flags
        * generic/tclStrToD.c:  accepted by TclParseNumber.
2005-09-02 17:42:23 +00:00
dgp 8e1fe4c19e * generic/tclObj.c: TclParseNumber calls meant to parse an
integer value now pass the TCL_PARSE_INTEGER_ONLY flag.
2005-09-01 16:27:50 +00:00
dgp 503ece395d [kennykb-numerics-branch]
* generic/tclScan.c:    Extended [scan] to accept the %lld,
        %llo, %llx, and %lli formats.  Numeric scanning is now done
        via TclParseNumber calls.

        * generic/tclInt.h:     Extended TclParseNumber to accept new flag
        * generic/tclStrToD.c:  values TCL_PARSE_INTEGER_ONLY,
        TCL_PARSE_OCTAL_ONLY, and TCL_PARSE_HEXIDECIMAL_ONLY, to give caller
        more control over the parsing rules.
2005-09-01 16:09:56 +00:00
dgp 5a74b716cf [kennykb-numerics-branch]
* generic/tclObj.c:     Extended bignum support to include bignums
        so large they will not pack into a Tcl_Obj.  When they outgrow Tcl's
        string rep length limits, a panic will result.
2005-08-30 19:20:41 +00:00
dgp 15d910ce6a [kennykb-numerics-branch]
* generic/tclTomMath.h: Added mp_sqrt to routines from
        * unix/Makefile.in:     libtommath used by Tcl.
        * win/Makefile.in:
        * win/makefile.vc:

        * generic/tclBasic.c:   Extended sqrt(.) so that range covers
        the entire double range, accepting as many bignums in the domain
        as that will allow.
2005-08-30 15:54:28 +00:00
dgp 3468587891 [kennykb-numerics-branch] Merge updates from HEAD. 2005-08-29 18:38:45 +00:00
dgp 5abf15c775 [kennykb-numerics-branch]
* generic/tclBasic.c:   Restored round(.) to the Tcl 8.4 rules.
2005-08-29 17:11:58 +00:00
dgp 21824defc5 [kennykb-numerics-branch]
* generic/tclExecute.c: Bug fix.  INST_RSHIFT: shift of negative
        values produced incorrect results.
2005-08-25 21:21:33 +00:00
dgp 6f2e38d6ae [kennykb-numerics-branch] Merge updates from HEAD
* generic/tclExecute.c: Bug fix.  INST_*SHIFT* opcodes stack
        management. [expr 0<<6] should be 0, not 6.
2005-08-25 15:46:30 +00:00
dgp 4d24d3d224 [kennykb-numerics-branch]
* generic/tclBasic.c:   Extended the domain of round(.) to all
        non-Inf, non-NaN doubles, using bignums for the result as needed.
2005-08-25 14:58:07 +00:00
dgp b9eac2285a [kennykb-numerics-branch]
* generic/tclBasic.c:   Revised implementation of the ceil(.) and
        * generic/tclInt.h:     floor(.) math functions in light of the
        * generic/tclStrToD.c:  revised comparison operators, so that it
        is always true that ($x <= ceil($x)) and ($x >= floor($x)).  The
        simple approach of "convert to double and call ceil() or floor()"
        could not guarantee that.
2005-08-24 21:49:22 +00:00
Kevin B Kenny 678a862136 corrected TRACE bugs, overflowed negative #s, and bad test constraints 2005-08-24 18:56:32 +00:00
dgp b2e164bf36 [kennykb_numerics_branch]
* generic/tclExecute.c: Bug fix: TclBignumToDouble return -Inf when
        appropriate.  Removed declarations of removed routines.
2005-08-24 18:51:36 +00:00
dgp 09a7b1d1ca Corrections in comparisons with +/-Inf. 2005-08-24 18:03:11 +00:00
dgp d34390a17f [kennykb_numerics_branch]
* generic/tclExecute.c: Revised the type promotion rules of the
        comparison operators so that they form proper equivalence classes
        over the set of numeric strings.
2005-08-24 17:25:46 +00:00
dgp 789839b104 [kennykb_numerics_branch]
* generic/tclStrToD.c:  Bug fix: set shift magnitude properly whether
        we're expanding to mp_int type or not.
2005-08-24 02:35:47 +00:00
dgp 592e6ea508 [kennykb_numerics_branch]
* generic/tclExecute.c: Bug fix: ACCEPT_NAN under INST_UMINUS.
2005-08-23 22:14:30 +00:00
Kevin B Kenny 35b5f9c5f1 more test coverage - 0o and entier 2005-08-23 19:51:24 +00:00
dgp 2780e3054b comment fix 2005-08-23 19:22:12 +00:00
Kevin B Kenny 9ce9bf9c44 Removed TclStrToD and friends, and added '0b' test cases. 2005-08-23 19:16:26 +00:00
Kevin B Kenny c53f5159f7 Removed TclStrToD and friends, and added '0b' test cases. 2005-08-23 19:15:40 +00:00
Kevin B Kenny 9bbc2732d7 TclParseNumber enhanced for [scan ... %f], plus better test coverage 2005-08-23 18:28:51 +00:00
dgp cdbbf30476 * generic/tclStrToD.c: New macros TIP_114_FORMATS and KILL_OCTAL to
configure acceptance of 0o and 0b numbers and rejection of "leading
        zero as octal".
2005-08-23 16:51:23 +00:00
dgp 4fa351d0c7 see ChangeLog 2005-08-23 12:52:25 +00:00
dgp c165002007 [kennykb_numerics_branch]
* generic/tclBasic.c:   Re-used the guts of int(.) and wide(.) math        functions to perform conversions in OldMathFuncProc.
        * generic/tclBasic.c:   Support for ACCEPT_NAN.
        * generic/tclExecute.c:

        * generic/tclInt.decls: Restored TclExprFloatError to internal stubs
        * generic/tclBasic.c:   table, and moved definition back to tclExecute.c
        * generic/tclExecute.c: from tclBasic.c to handle #undef ACCEPT_NAN.

        * generic/tclIntDecls.h:        make genstubs
        * generic/tclStubInit.c:

        * generic/tclInt.h:     New internal macros TclIsNaN and TclIsInfinite
        * generic/tclBasic.c:   replace the IS_NAN and IS_INF macros scattered
        * generic/tclExecute.c: here and there.
        * generic/tclObj.c:
        * generic/tclStrToD.c:
        * generic/tclUtil.c:
2005-08-23 06:15:20 +00:00
dgp 2afd1d78ac [kennykb_numerics_branch]
* generic/tclInt.h:     New ACCEPT_NAN macro to mark code that supports
        * generic/tclCmdAH.c:   or disables accepting of the NaN value at
        * generic/tclExecute.c: various points.
        * generic/tclLink.c:

        * generic/tclStrToD.c:  Bug fix.  Parsing of +/- Infinity was reversed.

        * generic/tclBasic:     Added [expr {entier(.)}].  Rewrote int(.)
        and wide(.) to use the same guts, accepting all non-Inf doubles as
        arguments.

        * generic/tclInt.h:     New routine TclInitBignumFromDouble.
        * generic/tclStrToD.c:  Modified to return code and write error message.
2005-08-22 20:50:24 +00:00
dgp 642a1f7b74 [kennykb_numerics_branch]
* generic/tclTestObj.c: Disabled unused [testconvertobj] command.
2005-08-22 16:11:37 +00:00
dgp 9362727887 [kennykb_numerics_branch]
* generic/tclBasic:     Added [expr {entier(.)}].

        * generic/tclInt.h:     New routine TclInitBignumFromDouble.
        * generic/tclStrToD.c:
2005-08-22 15:48:25 +00:00
dgp d7c1ff79bc [kennykb_numerics_branch]
* generic/tclInt.h:     TCL_WIDE_INT_IS_LONG implies NO_WIDE_TYPE.
        * generic/tclObj.c:     Removed now unnecessary tests of the
        * generic/tclStrToD.c:  TCL_WIDE_INT_IS_LONG definition.
2005-08-22 14:21:01 +00:00
dgp 2cabcebd6c [kennykb_numerics_branch]
* generic/tclInt.h:     New internal routine TclSetBignumIntRep
        * generic/tclObj.c:     consolidates packing of bignum value into
        * generic/tclStrToD.c:  a Tcl_Obj within one source code file.
2005-08-22 13:55:35 +00:00
dgp f86594bdbb [kennykb_numerics_branch]
* tests/expr.test:      Corrected the wideIs64bit constraint.
        * tests/format.test:
        * tests/scan.test:
2005-08-22 12:55:09 +00:00
dgp ade664a9be see ChangeLog 2005-08-22 04:25:39 +00:00
dgp 20a29a86cd [kennykb_numerics_branch]
* generic/tclInt.h:             Moved TclParseInteger to tclUtil.c
        * generic/tclParseExpr.c:       and made it static.
        * generic/tclUtil.c:

        * generic/tclInt.decls: Moved TclExprFloatError to tclBasic.c and
        * generic/tclBasic.c:   made it static.
        * generic/tclExecute.c:

        * generitc/tclIntDecls.h:       make genstubs
        * generic/tclStubInit.c:

        * generic/tclExecute.c: errno, IS_NAN, IS_INF, LLD no longer called in
        this file; dropped/disabled support for them.

        * generic/tclCompExpr.c:        errno no longer used in these files;
        * generic/tclParseExpr.c:       dropped support "hack" for it.

        * generic/tclStrToD.c:  Disabled out of date support "hack" for errno.

        * generic/tclBasic.c:   Eliminated VerifyExprObjType.  Initialize
        errno to zero in OldMathFuncProc.
2005-08-22 03:49:38 +00:00
dgp 395cfa8033 [kennykb_numerics_branch]
* generic/tclBasic.c:   Updated OldMathFuncProc and ExprAbsFunc to
        do less invasion into numeric Tcl_Obj internals.  Made ExprDoubleFunc,
        ExprIntFunc, ExprWideFunc, and ExprRoundFunc bignum-aware.  Revised
        ExprSrandFunc error message.

        * generic/tclProc.c:    Wrapped a few tclWideIntType uses in
        * generic/tclCmdMZ.c:   #ifndef NO_WIDE_TYPE.

        * generic/tclInt.h:     #define'd NO_WIDE_TYPE.
2005-08-19 21:55:20 +00:00
dgp 885cb5d3f9 [kennykb_numerics_branch]
* generic/tclVar.c:     Replaced TclPtrIncrVar and TclPtrIncrWideVar
        * generic/tclInt.h:     with TclPtrIncrObjVar and replaced TclIncrVar2
        * generic/tclInt.decls: and TclIncrWideVar2 with TclIncrObjVar2.  New
        routines call on TclIncrObj to do the work.

        * generic/tclIntDecls.h:        make genstubs
        * generic/tclStubInit.c:

        * generic/tclCmdIL.c:   Rework Tcl_IncrObjCmd and the INST_*INCR*
        * generic/tclExecute.c: opcodes to use the new routines.
2005-08-19 05:17:47 +00:00
dgp a0a9d2ad89 [kennykb_numerics_branch]
* generic/tclExecute.c:         Fixed string rep invalidation bug in
        * tests/dict.test (dict-11.17): INST_DICT_INCR_IMM rewrite.
2005-08-18 21:19:16 +00:00
dgp dfbbb842f7 [kennykb_numerics_branch]
* generic/tclDictObj.c: DictIncrCmd rewrite to use TclIncrObj.

        * generic/tclInt.h:     TclIncrObj static -> internal
        * generic/tclExecute.c:
2005-08-18 18:18:45 +00:00
dgp 5b7f8a810a restore interp->result support in legacy routines 2005-08-18 02:36:14 +00:00
dgp d879e6f150 added some constraints to the new tests 2005-08-18 02:09:01 +00:00
Kevin B Kenny 8fa1025832 changed TclParseNumber to leave endPtrPtr on trailing whitespace 2005-08-17 21:39:01 +00:00
Kevin B Kenny f665e098cf change expression parser to use TclParseNumber; fix comments in TclParseNumber; fix ExprUnaryFunc 2005-08-17 20:49:54 +00:00
Kevin B Kenny 33955ae33e revised test conditions to demand IEEE floating point for the tests that require it 2005-08-17 20:12:38 +00:00
Kevin B Kenny 65ef01f5f4 fancier casts in Tcl_ExprLongObj to avoid unwanted sign-extension 2005-08-17 19:34:23 +00:00
Kevin B Kenny 656e192454 corrected error in test numbering 2005-08-17 19:26:48 +00:00
Kevin B Kenny 597f3bca8c fix ChangeLog message 2005-08-17 19:22:34 +00:00
Kevin B Kenny cfafb38834 updated Tcl_Expr* to deal with bignums 2005-08-17 19:12:08 +00:00
dgp 4afc43fecf [kennykb_numerics_branch]
* generic/tclExecute.c: New routine TclIncrObj to centralize the
        increment operation needed in many places.  Updated
        INST_DICT_INCR_IMM to make use of it.
2005-08-17 15:45:12 +00:00
dgp f96a2cfca4 [kennykb_numerics_branch]
* generic/tclExecute.c: Made bit shifting opcodes and INST_MOD
        bignum-aware.

        * tests/scan.test:      Making << bignum-aware means that repeated
        * tests/string.test:    left shifting cannot turn a positive into
        a negative.  Revised [int_range] and [largest_int] utility commands
        in the test suite that relied on that happening.  Without revision
        they became infinite loops.
2005-08-17 04:57:48 +00:00
dgp 681debfae0 [kennykb_numerics_branch]
* generic/tclExecute.c: Made binary bitwise opcodes bignum-aware.

        * generic/tclTomMath.h: Added mp_or and mp_xor to routines from
        * unix/Makefile.in:     libtommath used by Tcl.
        * win/Makefile.in:
        * win/makefile.vc:
2005-08-16 16:55:17 +00:00
dgp ce4c863909 * generic/tclExecute.c: More revisions to IllegalExprOperandType.
Merged INST_BITNOT with INST_UMINUS and make it bignum-aware
        according to the rule: ~a = -a - 1.  Disabled unused code and
        noted more TODOs.
2005-08-16 04:26:39 +00:00
dgp 8ae39289d6 * generic/tclInt.decls: Deleted TclLooksLikeInt() and all callers.
* generic/tclUtil.c:
        * generic/tclCompCmds.c:

        * generic/tclBasic.c:   Rewrite of VerifyExprObjType().

        * generic/tclIntDecls.h:        make genstubs
        * generic/tclStubInit.c:
2005-08-15 20:46:01 +00:00
dgp 010430e809 merge updates from HEAD 2005-08-15 18:13:57 +00:00
dgp c13143a590 [kennykb_numerics_branch]
* generic/tclExecute.c: Updated execution of comparison bytecodes
        to be bignum-aware, routing string compares through INST_STR_CMP.
2005-08-15 16:56:48 +00:00
dgp debbacb3da [kennykb_numerics_branch]
* generic/tclExecute.c: Updated execution of arithmetic bytecodes
        to be bignum-aware, and to allow calculations on NaN to produce
        a NaN result.  INST_UMINUS updated to call mp_neg.

        * generic/tclTomMath.h: Added mp_and, mp_expt_d, and mp_neg to
        * unix/Makefile.in:     routines from libtommath used by Tcl.
        * win/Makefile.in:
        * win/makefile.vc:
2005-08-15 03:16:47 +00:00
dgp 686f0a4cd1 [kennykb_numerics_branch]
* generic/tclObj.c:     Extended Bignum auto-narrowing to auto-narrow
        to tclWideIntType when appropriate; this helps keep things working as
        the bytecode execution code is migrated to supporting bignums.

        * generic/tclExecute.c: Major overhaul of IllegalExprOperandType.
        Changed several TclNewFooObj() calls to more logically appropriate
        ones.  Added several TODO comments marking opportunies for future
        work.  Made more use of the eePtr->constants.  Made INST_UMINUS
        bignum aware.
2005-08-13 20:19:28 +00:00
dgp f43534243d [kennykb_numerics_branch]
* generic/tclExecute.c: Simplify doCondJump.  Use eePtr->constants
        as result of INST_DICT_NEXT, INST_LAND, and INST_LOR.  Separate
        INST_LNOT from INST_UMINUS and simplify.
2005-08-12 18:29:00 +00:00
dgp 47d7c46c33 [kennykb_numerics_branch]
* generic/tclExecute.c: Rewrite of INST_LAND/INST_LOR to take
        advantage of loss of "pure double" issues.  Merged INST_UPLUS
        with INST_TRY_CVT_TO_NUMERIC and updated to use improved rules
        for impure "double"s as well.
2005-08-11 21:48:37 +00:00
dgp 0207f5072a [kennykb_numerics_branch]
* generic/tclStrToD.c:  Restored conditional generation of
        tclWideIntType values by TclParseNumber so that Tcl's not
        completely broken while bignum calculation support is incomplete.
        The NO_WIDE_TYPE macro can be used to disable this.

        * generic/tclBasic.c (ExprAbsFunc):     First pass making [expr abs(.)]
        bignum-aware.

        * generic/tclExecute.c: Made INST_TRY_CVT_TO_NUMERIC bignum aware.
2005-08-11 16:29:23 +00:00
dgp 76a2f57a0d [kennykb_numerics_branch]
* generic/tclTomMath.h: Added mp_shrink, mp_to_unsigned_bin,
        * unix/Makefile.in:     mp_to_unsigned_bin_n, and mp_unsigned_bin_size
        * win/Makefile.in:      to routines from libtommath used by Tcl.
        * win/makefile.vc:

        * generic/tommath.h:    make gentommath_h

        * generic/tclObj.c:     Substantial rewrite to make all number
        parsing flow through TclParseNumber().  Also established the
        NO_WIDE_TYPE and BIGNUM_AUTO_NARROW #ifdef's to help track the
        assumptions of different portions of the code.

        * generic/tclInt.h:     Added NO_WIDE_TYPE #ifdefs
2005-08-10 18:21:53 +00:00
dgp a1dbd78181 * generic/tclObj.c: Replaced some goto's with loops and started
use of BIGNUM_AUTO_NARROW and NO_WIDE_TYPE.
2005-08-08 19:21:41 +00:00
dgp 00a62dd242 Rewrote Tcl_GetDoubleFromObj 2005-08-05 14:04:10 +00:00
dgp 2c6d11aba8 * generic/tclObj.c: Rewrote Tcl_GetBooleanFromObj() and supporting
routines to make use of TclParseNumber.  This reduces the potential
        number of times a string value must be scanned.
2005-08-04 21:27:05 +00:00
dgp bde06f203b merge updates from HEAD 2005-08-04 16:47:47 +00:00
dgp cef5cc10e2 merge updates from HEAD 2005-08-02 18:14:45 +00:00
Kevin B Kenny fedb4a901c merged changes from HEAD 2005-07-12 20:38:11 +00:00
Kevin B Kenny 0c5fc04d40 merged changes from HEAD 2005-07-12 20:35:39 +00:00
Kevin B Kenny e397994550 first round of TIP#249 changes 2005-07-12 20:15:23 +00:00
Kevin B Kenny 32fc1fd89d Resynchronized with HEAD 2005-05-21 15:10:25 +00:00
Kevin B Kenny 6d22250a56 repeat merge with HEAD 2005-05-11 17:18:56 +00:00
Kevin B Kenny a72447b791 Synchronized with HEAD 2005-05-11 15:00:57 +00:00
dgp c1f72924ac Merged special handling of trivial patterns into Tcl_ListMathFuncs. 2005-05-10 16:57:25 +00:00
Kevin B Kenny fffddab9af Merged changes from HEAD 2005-05-10 16:11:22 +00:00
Kevin B Kenny 3a02c9ceca further fixes for structured event handling and frame pointer omission 2005-05-09 22:13:16 +00:00
Kevin B Kenny 745c8cc4cb portability hacks and eliminate bad CPUID code 2005-05-08 20:41:53 +00:00
Kevin B Kenny 295e4ad890 fixed underflow bug in MSVC with -O3 2005-05-07 21:09:34 +00:00
Kevin B Kenny 242393265b Revised initialization of tclStrToD.c 2005-05-07 19:18:11 +00:00
Kevin B Kenny e6f1408358 Merged with HEAD 2005-05-05 17:55:00 +00:00
Kevin B Kenny 7497319940 corrected an EDOM handling input overflow on Solaris 2005-04-26 20:54:00 +00:00
Kevin B Kenny a06a151dcb Corrected NaN handling in [binary format] 2005-04-26 17:09:45 +00:00
Kevin B Kenny da3b874cd9 correct uninit mem ref in Tcl_GetDoubleFromObj 2005-04-26 16:54:37 +00:00
Kevin B Kenny 09d40e9ed8 Restored silent overflow/underflow to input conversions 2005-04-26 16:32:52 +00:00
Kevin B Kenny 9fb9d10d52 Merged with HEAD. 2005-04-25 21:37:17 +00:00
Kevin B Kenny e41ba98a12 Revised documentation for TIP 232 2005-04-25 19:59:36 +00:00
Kevin B Kenny c4c4d2dca7 TIP 232 documentation 2005-04-20 19:47:11 +00:00
Kevin B Kenny 5c51a2bf08 updated to libtommath 0.35 2005-04-11 00:58:04 +00:00
Kevin B Kenny 7cc419e81e Updated to libtommath 0.35 2005-04-11 00:22:47 +00:00
Kevin B Kenny 0aa770c8d5 merged with HEAD and fixed 1180368 2005-04-10 23:14:27 +00:00
Kevin B Kenny f3ff4a32a4 merged with HEAD 2005-03-15 20:23:14 +00:00
Kevin B Kenny 56318f72d3 TIP#232 initial implementation 2005-03-15 19:41:31 +00:00
Kevin B Kenny 6055be3e13 fix typos prior to tagging for TIP132 2005-03-15 19:08:06 +00:00
Kevin B Kenny 5a51f0ce34 documented new behaviour of tcl_precision 2005-03-09 16:34:34 +00:00
Kevin B Kenny 15fa664882 Merged with HEAD 2005-03-09 15:57:12 +00:00
Kevin B Kenny 33ce5a8390 division by zero now legal if machine has Inf 2005-03-09 14:39:17 +00:00
Kevin B Kenny e2dcc3a0c0 fixed bug in formatting #s in range 0.0001-1.0 2005-03-08 17:04:01 +00:00
Kevin B Kenny 470230c7e0 made code permissive about infinities 2005-03-04 20:43:41 +00:00
Kevin B Kenny 8fb9c874d2 added tagged NaN values 2005-03-03 21:54:06 +00:00
Kevin B Kenny 4b6af9a510 changed to allow NaN in binary format 2005-03-03 21:29:28 +00:00
Kevin B Kenny 433ad81e89 updated handling of signed zeroes 2005-03-03 18:59:33 +00:00
Kevin B Kenny 587e86ac92 further fixes for VC6 2005-03-02 23:30:52 +00:00
Kevin B Kenny 6f721a09f2 made build work again on Linux 2005-03-02 23:10:27 +00:00
Kevin B Kenny 0e5935d984 fix two bad test cases in binary.test 2005-03-02 22:36:26 +00:00
Kevin B Kenny 04d1aa8b52 Developer's checkpoint, see ChangeLog for details 2005-03-02 21:25:06 +00:00
dgp 8e8bb524eb deleted surplus ";" 2005-02-22 21:16:11 +00:00
Kevin B Kenny 7c63351663 added fpu controls to workaround bug in gcc+ix86 2005-02-06 03:43:41 +00:00
Kevin B Kenny 63fd4e2d85 Fix for ldexp out of bounds when converting denormals 2005-02-03 23:56:39 +00:00
Kevin B Kenny 6f9e408b9c Fix for ldexp out of bounds when converting denormals 2005-02-03 23:56:10 +00:00
Kevin B Kenny 800a1141c8 updated makefiles, fixed buglets in tclStrToD.c with int overflow in exponents 2005-02-02 16:58:49 +00:00
Kevin B Kenny 2c58583a8c sync with head, add TclStrToD (TIP #132) 2005-02-02 15:53:08 +00:00
dgp ce41a33a4f bugFix 2005-01-21 19:20:17 +00:00
Kevin B Kenny c35ea20e08 Updated unix makefile to add libtommath; silenced warning in tclTestObj.c 2005-01-21 18:38:14 +00:00
Kevin B Kenny 14f72cf465 Updated unix makefile to add libtommath; silenced warning in tclTestObj.c 2005-01-21 18:35:19 +00:00
Kevin B Kenny 32bd701bb0 local patches to make string conversions work 2005-01-20 21:19:30 +00:00
Kevin B Kenny 6d08ca2d1e Development checkpoint, see ChangeLog for details 2005-01-20 19:11:49 +00:00
Kevin B Kenny 3a819829e6 reverting to HEAD in preparation for changing from reworked 'mpexpr' to 'libtommath' 2005-01-20 14:53:39 +00:00
Kevin B Kenny 5b73121950 merge from HEAD 2004-12-29 22:46:32 +00:00
Kevin B Kenny abcd91c7b7 fixed zero-length array in BigInt struct; added conversion torture tests 2004-12-14 18:43:30 +00:00
Kevin B Kenny 725f49c65e merge to kennykb-numerics-branch-20041213 2004-12-13 22:08:13 +00:00
Kevin B Kenny dc5c8068a5 synch with kennykb-numerics-branch-20041213 2004-12-13 22:02:47 +00:00
Kevin B Kenny 24a6a15c7f Added small-integer multiplication, bit shift 2004-12-13 21:23:08 +00:00
Kevin B Kenny 613c25ae18 added compare, copy, add and subtract of bigints 2004-12-10 21:17:41 +00:00
Kevin B Kenny 132897b129 added some of the BigInt functions - may want to revise to caller-allocates? 2004-12-09 22:59:26 +00:00
Kevin B Kenny 88ab775af3 update unix/tcl.m4 to use AC_CHECK_SIZEOF, etc. 2004-12-08 21:46:36 +00:00
Kevin B Kenny d90c598def changed Win configurator to use SIZEOF macros for Tcl_WideInt 2004-12-08 20:24:55 +00:00
Kevin B Kenny 5f164c74ae merged with kennykb-numerics-branch-20041208 2004-12-08 18:24:34 +00:00
Kevin B Kenny c898205731 merge to kennykb-numerics-branch-20041202a 2004-12-02 19:24:12 +00:00
639 changed files with 155356 additions and 61642 deletions
+3597 -354
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -1,11 +1,11 @@
README: Tcl
This is the Tcl 8.5a2 source distribution.
This is the Tcl 8.5a4 source distribution.
Tcl/Tk is also available through NetCVS:
http://tcl.sourceforge.net/
You can get any source release of Tcl from the file distributions
link at the above URL.
RCS: @(#) $Id: README,v 1.53 2004/03/26 19:47:28 dgp Exp $
RCS: @(#) $Id: README,v 1.53.2.2 2005/07/12 20:36:11 kennykb Exp $
Contents
--------
+200 -16
View File
@@ -1,6 +1,6 @@
Recent user-visible changes to Tcl:
RCS: @(#) $Id: changes,v 1.92 2004/11/18 18:34:10 dgp Exp $
RCS: @(#) $Id: changes,v 1.92.2.2 2005/07/12 20:36:11 kennykb Exp $
1. No more [command1] [command2] construct for grouping multiple
commands on a single command line.
@@ -6199,11 +6199,13 @@ tables to avoid system limits (mistachkin)
2004-09-09 (bug fix)[560297] fixed broken [namespace forget] logic (porter)
2004-09-09 (bug fix)[1017299] fixed [namespace import] cycle prevention (porter)
2004-09-09 (bug fix)[1017299] fixed [namespace import] cycle prevention
(porter)
2004-09-10 (performance) $x[set x {}] is now fast [K $x [set x {}]] (sofer)
2004-09-10 (bug fix)[868489] better control over int <-> wideInt (fellows,kenny)
2004-09-10 (bug fix)[868489] better control over int <-> wideInt
(fellows,kenny)
2004-09-10 (bug fix)[1025359] POSIX errorCode from wide seeks (kupries,fellows)
@@ -6217,11 +6219,13 @@ tables to avoid system limits (mistachkin)
2004-09-22 (feature change) syntax errors not reported at compile time;
deferred to runtime. Support [return -errorline]. (porter)
2004-09-23 (bug fix)[1016726] fix `make clean` in static config (leitgeb,dejong)
2004-09-23 (bug fix)[1016726] fix `make clean` in static config
(leitgeb,dejong)
2004-09-22 (feature change) report all compile errors at runtime (porter)
2004-09-29 (bug fix)[1036649] syntax error in [subst] => buffer overflow (sofer)
2004-09-29 (bug fix)[1036649] syntax error in [subst] => buffer overflow
(sofer)
2004-09-30 (bug fix)[1038021] save/restore error state: var traces (porter)
@@ -6234,7 +6238,8 @@ tables to avoid system limits (mistachkin)
2004-10-05 (reform) errorInfo, errorCode management (porter)
*** POTENTIAL INCOMPATIBILITY for traces on those vars ***
2004-10-06 (feature change)[1041072] re-bless and enhance Tcl_AppendResult (dkf)
2004-10-06 (feature change)[1041072] re-bless and enhance Tcl_AppendResult
(dkf)
2004-10-06 (reform) more robust interp result appends (porter)
=> dde 1.3.1
@@ -6248,7 +6253,8 @@ tables to avoid system limits (mistachkin)
2004-10-08 (new feature)[TIP 212] [dict update]; [dict with] (fellows)
2004-10-08 (bug fix)[954263] case insensitive [file exec] for Win (hobbs,darley)
2004-10-08 (bug fix)[954263] case insensitive [file exec] for Win
(hobbs,darley)
2004-10-14 (performance) [info commands/globals/procs/vars $pattern] faster
when $pattern is trivial (fellows)
@@ -6258,16 +6264,18 @@ tables to avoid system limits (mistachkin)
2004-10-24 (reform) replaced bit flag values with macros for Var handling
*** POTENTIAL INCOMPATIBILITY for accesses to Var internals ***
2004-10-26 (new feature)[1054370] install msgcat, http, tcltest as TM's (porter)
2004-10-26 (new feature)[1054370] install msgcat, http, tcltest as TM's
(porter)
2004-10-26 (bug fix)[767676] negative PIDs with pipes (giese,gravereaux)
2004-10-27 (bug fix)[731778] stop critical section leaks (mistachkin,gravereaux)
2004-10-27 (bug fix)[731778] stop critical section leaks
(mistachkin,gravereaux)
2004-10-27 (bug fix)[926088] -load option to find tested packages (gravereaux)
2004-10-28 (bug fix)[1030548] restore the --enable-symbols --enable-threads
build on Win (mistachkin,kenny,kupries)
build on Win (mistachkin,kenny,kupries)
2004-10-29 (bug fix)[1055673] fix command line syntax error message (porter)
=> tcltest 2.2.7
@@ -6283,17 +6291,15 @@ tables to avoid system limits (mistachkin)
2004-11-03 (bug fix)[527164] preserve errorinfo from var traces (porter)
2004-11-08 (bug fix){947693] Made -blocking option of channel during [close]
consistent on Windows with Unix (gravereaux)
consistent on Windows with Unix (gravereaux)
*** POTENTIAL INCOMPATIBILITY ***
2004-11-11 (bug fix)[1034337] recursive file delete, MacOSX (steffen)
2004-11-12 (feature)[TIP 34] make use of a configuration header file (fellows)
*** POTENTIAL INCOMPATIBILITY ***
2004-11-12 (new feature)[TIP 221] [interp bgerror] (porter)
2004-11-12 (new feature)[TIP 226] Tcl_(Save|Restore|Discard)InterpState (porter)
2004-11-12 (new feature)[TIP 226] Tcl_(Save|Restore|Discard)InterpState
(porter)
2004-11-12 (new feature)[TIP 227] Tcl_(Get|Set)ReturnOptions (porter)
@@ -6305,7 +6311,185 @@ tables to avoid system limits (mistachkin)
2004-11-18 (new feature) configure options --enable-man-suffix (max)
2004-11-22 (bug fix)[1030465] Improve HAVE_TYPE_OFF64_T check (dejong)
2004-11-22 (bug fix)[1043129] Fixed the treatment of backslashes in file
join on Windows (darley)
2004-11-22 (bug fix)[976438] Move init.tcl search path construction to
tclInit (porter)
2004-11-24 (bug fix)[1072654] Fixed segfault in info vars trivial
matching branch (new in 8.4.8) (porter)
2004-11-24 (bug fix)[1001325, 1071701] Fixed readdir_r detection and usage
(dejong, kenny, porter)
2004-11-24 (bug fix)[1071807] Fixed all uses of 'select' to use standard
macros rather than older bit-whacking style (kenny)
2004-11-26 (bug fix)[1073524] Simplify the code to check for correctness of
strstr, strtoul and strtod on unix (fellows)
2004-11-26 (bug fix)[1072136] Remove file normalize on tcl_findLibrary
search path uniqification added in 8.4.8 (porter)
2004-11-30 (bug fix)[976520] Rework startup/initialization of the Tcl
library, encoding search initialization, and Tcl_FindExecutable structure.
[tclInit] no longer driven by the value of $::tcl_libPath (TCLLIBPATH).
(porter)
*** POTENTIAL INCOMPATIBILITY : makes encoding names case sensitive
on Windows, where they have been case insensitive ***
2004-12-02 (bug fix)[1074671] Ensure tilde paths are not returned specially
by 'glob' (darley)
Doc improvements [759545,926590,935853,1017072,1018486,1022527,1027849,
1032243,1047928,1048005,1058446,1062647,1065732,etc.]
1032243,1047928,1048005,1058446,1062647,1065732,1073334,etc.]
Test suite expansion [1036649,1001997,etc.]
--- Released 8.5a2, December 7, 2004 --- See ChangeLog for details ---
2004-12-13 (bug fix)[1083082] encoding memory leaks (ade,porter)
2004-12-13 (bug fix)[1082349] restored C++ extension support (porter)
2004-12-14 (bug fix)[1081541] workaround automake-ism "$U" (porter)
2004-12-15 (new feature) CallFrames on execution, not C, stack (sofer)
2004-12-16 (bug fix)[1085023] [interp limit] support in [vwait], etc. (fellows)
2004-12-29 (bug fix)[1090413] make [clock scan 0030] work (morian,kenny)
2004-12-29 (bug fix)[1092789] make [clock scan 10000] work (porter,kenny)
2004-12-29 (platform support)[1092952,1091967] MSVC7, gcc OPT compiles (hobbs)
2005-01-06 (performance)[1020491] [http::mapReply] (fellows)
=> http 2.5.1
2005-01-09 (bug fix)[1095909] stopped use of readdir_r (english)
2005-01-10 (enhancement)[1081595] stopped use of TCL_DBGX (english)
2005-01-17 (bug fix)[1100542] [glob] of Windows shares (schar,darley)
2005-01-19 (new feature)[TIP 235] C API for ensembles (fellows)
2005-01-21 (new feature)[TIP 233] virtual time (kupries)
2005-01-25 (bug fix)[1101670] [auto_reset] update for [namespace] (porter)
***POTENTIAL INCOMPATIBILITY***
May cause re-[source]-ing of files that have not anticipated that before.
2005-01-27 (new feature)[TIP 218] Tcl_Channel API update for threads (kupries)
2005-01-27 (bug fix)[1109484] Tcl_Expr* updates for Tcl_WideInt (hobbs)
2005-01-28 (platform support)[1021871] Solaris gcc 64-bit support (hobbs)
2005-02-10 (bug fix)[1119369] Tcl_EvalObjEx: avoid shimmer loss of List intrep
(sofer,macdonald)
2005-02-11 (platform support) correct gcc builds for AIX-4+, HP-UX-11 (hobbs)
2005-02-24 (bug fix)[1119798] prevent [source $directory] (porter,mpettigr)
=> tcltest 2.2.8
2005-03-10 (bug fix)[1153871] bad ClientData cast (porter,victorovich)
2005-03-15 (platform support) OpenBSD ports patch (thoyts)
2005-03-18 (bug fix)[1115904] restore recursion limit in direct eval (porter)
2005-03-24 (bug fix) stop conflict between Tcltest and Thread packages (porter)
2005-03-29 (platform support) allow msys builds without cygwin (hobbs)
2005-04-01 (internal change)[1158008] internal rep of "list" Tcl_Obj's
now uses a refcounted struct (sofer)
***POTENTIAL INCOMPATIBILITY***
For any code that goes poking into the internals of "list" Tcl_Obj's
2005-04-05 (performance)[1174551] Tcl_DecrRefCount of Tcl_Obj "chains" (sofer)
2005-04-08 (performance)[1077262] better Tcl_Encoding cache lifetimes (porter)
2005-04-10 (bug fix)[1180368] [interp invokehidden] mem leak (kenny,porter)
2005-04-12 (performance)[1177363] startup encoding file scan (porter)
2005-04-12 (performance)[1182459] [clock format] (kenny)
2005-04-13 (bug fix) min buffer size dropped from 10 to 1 byte (gravereaux)
2005-04-16 (bug fix)[1178445] fix memory waste at thread exit (vasiljevic)
2004-04-16 (bug fix)[1084111] [array names] memory leak (ade,sofer)
2005-04-19 (bug fix)[1185933] [clock] init clobbered global vars (ring,kenny)
2005-04-19 (new feature) [::tcl::unsupported::EncodingDirs] - unsupported
command to set search path for encoding files (porter)
2005-04-20 (bug fix)[1090869] Tcl_GetInt accept 0x80000000, 64-bit
(porter,singh)
2005-04-22 (bug fix)[1187123] [string is boolean] respect EIAS (porter)
2005-04-25 (enhancement) update to tzdata2005i (kenny)
2005-04-25 (platform support) builds on Mac OS X 10.1 (steffen)
2005-04-27 (new feature)[TIP 183] [open $f {... BINARY ...}] (porter)
2005-04-29 (new feature)[TIP 176] simple index arithmetic (porter)
2005-05-06 (platform support) x86_64 Solarix cc and Solaris 10 builds (hobbs)
2005-05-10 (bug fix)[1198892] [expr {i**0}] error (kaitschu,markus)
2005-05-10 (new feature)[TIP 132] floating-point conversion to string (kenny)
***POTENTIAL INCOMPATIBILITY***
For scripts that rely on (tcl_precision==12) number formatting
2005-05-10 (new feature)[TIP 232] math functions as commands (kenny)
***POTENTIAL INCOMPATIBILITY***
Tcl_GetMathFuncInfo functioning is reduced; routine is now deprecated
2005-05-13 (feature removed) TCL_NO_MATH compiler directive (porter)
2005-05-14 (platform support) Mac OSX: configurable CoreFoundation API
(steffen)
2005-05-14 (platform support) Mac OSX: use realpath when threadsafe (steffen)
2005-05-17 (feature removed) Tcl_ObjType's "list", "procbody", "index",
"ensembleCommand", "localVarName", "levelReference, "boolean" are no
longer registered (porter)
***POTENTIAL INCOMPATIBILITY***
For any callers of Tcl_GetObjType on those strings
2005-05-20 (bug fix)[1201589] boolean literal prefix in expressions (porter)
2005-05-24 (platform support) Darwin build support merged into unix (steffen)
2005-05-24 (new feature)[1202209] Mac OSX: support [load] of .bundle binaries
Can support [load] from memory as well (steffen)
2005-05-24 (new feature)[1202178] [time] returns non-integer result (steffen)
2005-05-25 (new feature)[TIP 182] [expr {bool(...)}] (mistachkin,porter)
2005-05-30 (new feature)[TIP 229] [namespace path] (fellows)
2005-05-31 (bug fix)[1082283] Unix: notifier thread now joinable (vasiljevic)
2005-06-01 (new feature)[TIP 241] -nocase: lsort, lsearch, switch (mistachkin)
2005-06-01 (bug fix)[1209759] "return TCL_RETURN;" could cause panic (porter)
Documentation improvements [1075433,1085127,1117017,1124160,1149605,etc.]
--- Released 8.5a3, June 4, 2004 --- See ChangeLog for details ---
+5 -1
View File
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: string.h,v 1.5 2004/03/17 18:14:12 das Exp $
* RCS: @(#) $Id: string.h,v 1.5.2.1 2005/05/05 17:55:18 kennykb Exp $
*/
#ifndef _STRING
@@ -26,7 +26,11 @@
#include <sys/types.h>
#ifdef __APPLE__
extern VOID * memchr _ANSI_ARGS_((CONST VOID *s, int c, size_t n));
#else
extern char * memchr _ANSI_ARGS_((CONST VOID *s, int c, size_t n));
#endif
extern int memcmp _ANSI_ARGS_((CONST VOID *s1, CONST VOID *s2,
size_t n));
extern char * memcpy _ANSI_ARGS_((VOID *t, CONST VOID *f, size_t n));
+4 -1
View File
@@ -9,10 +9,13 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: strstr.c,v 1.4 2004/04/06 22:25:48 dgp Exp $
* RCS: @(#) $Id: strstr.c,v 1.4.2.1 2005/04/25 21:37:18 kennykb Exp $
*/
#include "tcl.h"
#ifndef NULL
#define NULL 0
#endif
/*
*----------------------------------------------------------------------
+1 -1
View File
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: strtoll.c,v 1.7 2004/04/06 22:25:48 dgp Exp $
* RCS: @(#) $Id: strtoll.c,v 1.7.2.2 2005/01/20 19:12:26 kennykb Exp $
*/
#include "tclInt.h"
+1 -1
View File
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: strtoull.c,v 1.7 2004/04/06 22:25:48 dgp Exp $
* RCS: @(#) $Id: strtoull.c,v 1.7.2.2 2005/01/20 19:12:27 kennykb Exp $
*/
#include "tclInt.h"
+8 -8
View File
@@ -5,10 +5,10 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: AddErrInfo.3,v 1.13 2004/11/21 23:17:50 dgp Exp $
'\" RCS: @(#) $Id: AddErrInfo.3,v 1.13.2.2 2005/09/15 20:58:38 dgp Exp $
'\"
.so man.macros
.TH Tcl_AddErrorInfo 3 8.0 Tcl "Tcl Library Procedures"
.TH Tcl_AddErrorInfo 3 8.5 Tcl "Tcl Library Procedures"
.BS
.SH NAME
Tcl_GetReturnOptions, Tcl_SetReturnOptions, Tcl_AddErrorInfo, Tcl_AddObjErrorInfo, Tcl_SetObjErrorCode, Tcl_SetErrorCode, Tcl_SetErrorCodeVA, Tcl_PosixError, Tcl_LogCommandInfo \- retrieve or record information about errors and other return options
@@ -66,7 +66,7 @@ String to record as one element of the \fB-errorcode\fR return option.
Last \fIelement\fR argument must be NULL.
.AP va_list argList in
An argument list which must have been initialized using
\fBTCL_VARARGS_START\fR, and cleared using \fBva_end\fR.
\fBva_start\fR, and cleared using \fBva_end\fR.
.AP "const char" *script in
Pointer to first character in script containing command (must be <= command)
.AP "const char" *command in
@@ -82,7 +82,7 @@ The \fBTcl_SetReturnOptions\fR and \fBTcl_GetReturnOptions\fR
routines expose the same capabilities as the \fBreturn\fR and
\fBcatch\fR commands, respectively, in the form of a C interface.
.PP
\fBTcl_GetObjResult\fR retrieves the dictionary of return options
\fBTcl_GetReturnOptions\fR retrieves the dictionary of return options
from an interpreter following a script evaluation.
Routines such as \fBTcl_Eval\fR are called to evaluate a
script in an interpreter. These routines return an integer
@@ -91,7 +91,7 @@ both a result and a dictionary of return options generated
by script evaluation. Just as \fBTcl_GetObjResult\fR retrieves
the result, \fBTcl_GetReturnOptions\fR retrieves the dictionary
of return options. The integer completion code should be
passed as the \fIcode\fR argument to \fBTcl_GetObjResult\fR
passed as the \fIcode\fR argument to \fBTcl_GetReturnOptions\fR
so that all required options will be present in the dictionary.
Specifically, a \fIcode\fR value of \fBTCL_ERROR\fR will
ensure that entries for the keys \fB-errorinfo\fR,
@@ -201,7 +201,7 @@ via a call to \fBTcl_GetReturnOptions\fR) often makes up
a useful part of the \fImessage\fR passed to \fBTcl_AddErrorInfo\fR.
.PP
\fBTcl_AddObjErrorInfo\fR is nearly identical
to \fBTcl_AddObjErrorInfo\fR, except that it has an additional \fIlength\fR
to \fBTcl_AddErrorInfo\fR, except that it has an additional \fIlength\fR
argument. This allows the \fImessage\fR string to contain
embedded null bytes. This is essentially never a good idea.
If the \fImessage\fR needs to contain the null character \fBU+0000\fR,
@@ -267,7 +267,7 @@ setting \fBerrorInfo\fR or \fBerrorCode\fR directly with
\fBTcl_ObjSetVar2\fR.
.PP
If the procedure \fBTcl_ResetResult\fR is called,
it clears all of the state of ther interpreter associated with
it clears all of the state of the interpreter associated with
script evaluation, including the entire return options dictionary.
In particular, the \fB-errorinfo\fR and \fB-errorcode\fR options
are reset.
@@ -277,7 +277,7 @@ occurred after all.
The global variables \fBerrorInfo\fR and
\fBerrorCode\fR are not modified by \fBTcl_ResetResult\fR
so they continue to hold a record of information about the
more recent error seen in an interpreter.
most recent error seen in an interpreter.
.SH "SEE ALSO"
Tcl_DecrRefCount, Tcl_IncrRefCount, Tcl_Interp, Tcl_ResetResult, Tcl_SetErrno
+6 -6
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: Async.3,v 1.7 2004/11/20 00:17:31 dgp Exp $
'\" RCS: @(#) $Id: Async.3,v 1.7.2.1 2004/12/13 22:03:09 kennykb Exp $
'\"
.so man.macros
.TH Tcl_AsyncCreate 3 7.0 Tcl "Tcl Library Procedures"
@@ -62,11 +62,11 @@ to a clean state, such as after the current Tcl command completes.
.PP
\fBTcl_AsyncCreate\fR, \fBTcl_AsyncDelete\fR, and \fBTcl_AsyncReady\fR
are thread sensitive. They access and/or set a thread-specific data
structure in the event of an --enable-thread built core. The token
created by Tcl_AsyncCreate contains the needed thread information it
was called from so that calling Tcl_AsyncMark(token) will only yield
the origin thread into the AsyncProc.
.PP
structure in the event of a core built with \fI\-\-enable\-threads\fR. The token
created by \fBTcl_AsyncCreate\fR contains the needed thread information it
was called from so that calling \fBTcl_AsyncMark\fR(\fItoken\fR) will only yield
the origin thread into the asynchronous handler.
.PP
\fBTcl_AsyncCreate\fR creates an asynchronous handler and returns
a token for it.
The asynchronous handler must be created before
+1 -5
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: Backslash.3,v 1.5 2004/10/07 14:44:31 dkf Exp $
'\" RCS: @(#) $Id: Backslash.3,v 1.5.2.1 2005/04/10 23:14:39 kennykb Exp $
'\"
.so man.macros
.TH Tcl_Backslash 3 "8.1" Tcl "Tcl Library Procedures"
@@ -30,24 +30,20 @@ the backslash character.
.SH DESCRIPTION
.PP
.VS 8.1
The use of \fBTcl_Backslash\fR is deprecated in favor of
\fBTcl_UtfBackslash\fR.
.PP
This is a utility procedure provided for backwards compatibility with
non-internationalized Tcl extensions. It parses a backslash sequence and
returns the low byte of the Unicode character corresponding to the sequence.
.VE
\fBTcl_Backslash\fR modifies \fI*countPtr\fR to contain the number of
characters in the backslash sequence.
.PP
See the Tcl manual entry for information on the valid backslash sequences.
All of the sequences described in the Tcl manual entry are supported by
\fBTcl_Backslash\fR.
.VS 8.1 br
.SH "SEE ALSO"
Tcl(n), Tcl_UtfBackslash(3)
.VE
.SH KEYWORDS
backslash, parse
+55 -49
View File
@@ -1,16 +1,17 @@
'\"
'\" Copyright (c) 1996-1997 Sun Microsystems, Inc.
'\" Contributions from Don Porter, NIST, 2005. (not subject to US copyright)
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: BoolObj.3,v 1.5 2004/10/07 15:37:43 dkf Exp $
'\" RCS: @(#) $Id: BoolObj.3,v 1.5.2.2 2005/05/21 15:10:25 kennykb Exp $
'\"
.so man.macros
.TH Tcl_BooleanObj 3 8.0 Tcl "Tcl Library Procedures"
.TH Tcl_BooleanObj 3 8.5 Tcl "Tcl Library Procedures"
.BS
.SH NAME
Tcl_NewBooleanObj, Tcl_SetBooleanObj, Tcl_GetBooleanFromObj \- manipulate Tcl objects as boolean values
Tcl_NewBooleanObj, Tcl_SetBooleanObj, Tcl_GetBooleanFromObj \- store/retrieve boolean value in a Tcl_Obj
.SH SYNOPSIS
.nf
\fB#include <tcl.h>\fR
@@ -25,18 +26,12 @@ int
.SH ARGUMENTS
.AS Tcl_Interp boolValue in/out
.AP int boolValue in
Integer value used to initialize or set a boolean object.
If the integer is nonzero, the boolean object is set to 1;
otherwise the boolean object is set to 0.
Integer value to be stored as a boolean value in a Tcl_Obj.
.AP Tcl_Obj *objPtr in/out
For \fBTcl_SetBooleanObj\fR, this points to the object to be converted
to boolean type.
For \fBTcl_GetBooleanFromObj\fR, this refers to the object
from which to get a boolean value;
if \fIobjPtr\fR does not already point to a boolean object,
an attempt will be made to convert it to one.
Points to the Tcl_Obj in which to store, or from which to
retrieve a boolean value.
.AP Tcl_Interp *interp in/out
If an error occurs during conversion,
If a boolean value cannot be retrieved,
an error message is left in the interpreter's result object
unless \fIinterp\fR is NULL.
.AP int *boolPtr out
@@ -46,44 +41,55 @@ stores the boolean value (0 or 1) obtained from \fIobjPtr\fR.
.SH DESCRIPTION
.PP
These procedures are used to create, modify, and read
boolean Tcl objects from C code.
\fBTcl_NewBooleanObj\fR and \fBTcl_SetBooleanObj\fR
will create a new object of boolean type
or modify an existing object to have boolean type.
Both of these procedures set the object to have the
boolean value (0 or 1) specified by \fIboolValue\fR;
if \fIboolValue\fR is nonzero, the object is set to 1,
otherwise to 0.
\fBTcl_NewBooleanObj\fR returns a pointer to a newly created object
with reference count zero.
Both procedures set the object's type to be boolean
and assign the boolean value to the object's internal representation
\fIlongValue\fR member.
\fBTcl_SetBooleanObj\fR invalidates any old string representation
and, if the object is not already a boolean object,
frees any old internal representation.
These procedures are used to pass boolean values to and from
Tcl as Tcl_Obj's. When storing a boolean value into a Tcl_Obj,
any non-zero integer value in \fIboolValue\fR is taken to be
the boolean value \fB1\fR, and the integer value \fB0\fR is
taken to be the boolean value \fB0\fR.
.PP
\fBTcl_GetBooleanFromObj\fR attempts to return a boolean value
from the Tcl object \fIobjPtr\fR.
If the object is not already a boolean object,
it will attempt to convert it to one.
If an error occurs during conversion, it returns \fBTCL_ERROR\fR
and leaves an error message in the interpreter's result object
unless \fIinterp\fR is NULL.
Otherwise, \fBTcl_GetBooleanFromObj\fR returns \fBTCL_OK\fR
and stores the boolean value in the address given by \fIboolPtr\fR.
If the object is not already a boolean object,
the conversion will free any old internal representation.
Objects having a string representation equal to any of \fB0\fR,
\fBfalse\fR, \fBno\fR, or \fBoff\fR have a boolean value 0; if the
string representation is any of \fB1\fR, \fBtrue\fR, \fByes\fR, or
\fBon\fR the boolean value is 1.
Any of these string values may be abbreviated, and upper-case spellings
are also acceptable.
\fBTcl_NewBooleanObj\fR creates a new Tcl_Obj, stores the boolean
value \fIboolValue\fR in it, and returns a pointer to the new Tcl_Obj.
The new Tcl_Obj has reference count of zero.
.PP
\fBTcl_SetBooleanObj\fR accepts \fIobjPtr\fR, a pointer to
an existing Tcl_Obj, and stores in the Tcl_Obj \fI*objPtr\fR
the boolean value \fIboolValue\fR. This is a write operation
on \fI*objPtr\fR, so \fIobjPtr\fR must be unshared. Attempts to
write to a shared Tcl_Obj will panic. A successful write
of \fIboolValue\fR into \fI*objPtr\fR implies the freeing of
any former value stored in \fI*objPtr\fR.
.PP
\fBTcl_GetBooleanFromObj\fR attempts to retrive a boolean value
from the value stored in \fI*objPtr\fR.
If \fIobjPtr\fR holds a string value recognized by \fBTcl_GetBoolean\fR,
then the recognized boolean value is written at the address given
by \fIboolPtr\fR.
If \fIobjPtr\fR holds any value recognized as
a number by Tcl, then if that value is zero a 0 is written at
the address given by \fIboolPtr\fR and if that
value is non-zero a 1 is written at the address given by \fIboolPtr\fR.
In all cases where a value is written at the address given
by \fIboolPtr\fR, \fBTcl_GetBooleanFromObj\fR returns \fBTCL_OK\fR.
If the value of \fIobjPtr\fR does not meet any of the conditions
above, then \fBTCL_ERROR\fR is returned and an error message is
left in the interpreter's result unless \fIinterp\fR is NULL.
\fBTcl_GetBooleanFromObj\fR may also make changes to the internal
fields of \fI*objPtr\fR so that future calls to
\fBTcl_GetBooleanFromObj\fR on the same \fIobjPtr\fR can be
performed more efficiently.
.PP
Note that the routines \fBTcl_GetBooleanFromObj\fR and
\fBTcl_GetBoolean\fR are not functional equivalents.
The set of values for which \fBTcl_GetBooleanFromObj\fR
will return \fBTCL_OK\fR is strictly larger than
the set of values for which \fBTcl_GetBoolean\fR will do the same.
For example, the value "5" passed to \fBTcl_GetBooleanFromObj\fR
will lead to a \fBTCL_OK\fR return (and the boolean value 1),
while the same value passed to \fBTcl_GetBoolean\fR will lead to
a \fBTCL_ERROR\fR return.
.SH "SEE ALSO"
Tcl_NewObj, Tcl_DecrRefCount, Tcl_IncrRefCount, Tcl_GetObjResult
Tcl_NewObj, Tcl_IsShared, Tcl_GetBoolean
.SH KEYWORDS
boolean, boolean object, boolean type, internal representation, object, object type, string representation
boolean, object
+1 -4
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: Concat.3,v 1.7 2004/10/07 15:15:35 dkf Exp $
'\" RCS: @(#) $Id: Concat.3,v 1.7.2.1 2005/04/10 23:14:39 kennykb Exp $
'\"
.so man.macros
.TH Tcl_Concat 3 7.5 Tcl "Tcl Library Procedures"
@@ -44,12 +44,9 @@ copies strings from \fBargv\fR to the result. If an element of
is ignored entirely. This white-space removal was added to make
the output of the \fBconcat\fR command cleaner-looking.
.PP
.VS
The result string is dynamically allocated
using \fBTcl_Alloc\fR; the caller must eventually release the space
by calling \fBTcl_Free\fR.
.VE
.VS
.SH "SEE ALSO"
Tcl_ConcatObj
.SH KEYWORDS
+104 -35
View File
@@ -5,13 +5,13 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: CrtChannel.3,v 1.24 2004/11/12 09:01:25 das Exp $
'\" RCS: @(#) $Id: CrtChannel.3,v 1.24.2.5 2005/10/08 13:44:37 dgp Exp $
.so man.macros
.TH Tcl_CreateChannel 3 8.3 Tcl "Tcl Library Procedures"
.TH Tcl_CreateChannel 3 8.4 Tcl "Tcl Library Procedures"
.BS
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
Tcl_CreateChannel, Tcl_GetChannelInstanceData, Tcl_GetChannelType, Tcl_GetChannelName, Tcl_GetChannelHandle, Tcl_GetChannelMode, Tcl_GetChannelBufferSize, Tcl_SetChannelBufferSize, Tcl_NotifyChannel, Tcl_BadChannelOption, Tcl_ChannelName, Tcl_ChannelVersion, Tcl_ChannelBlockModeProc, Tcl_ChannelCloseProc, Tcl_ChannelClose2Proc, Tcl_ChannelInputProc, Tcl_ChannelOutputProc, Tcl_ChannelSeekProc, Tcl_ChannelWideSeekProc, Tcl_ChannelSetOptionProc, Tcl_ChannelGetOptionProc, Tcl_ChannelWatchProc, Tcl_ChannelGetHandleProc, Tcl_ChannelFlushProc, Tcl_ChannelHandlerProc, Tcl_IsChannelShared, Tcl_IsChannelRegistered, Tcl_CutChannel, Tcl_SpliceChannel, Tcl_IsChannelExisting, Tcl_ClearChannelHandlers, Tcl_GetChannelThread, Tcl_ChannelBuffered \- procedures for creating and manipulating channels
Tcl_CreateChannel, Tcl_GetChannelInstanceData, Tcl_GetChannelType, Tcl_GetChannelName, Tcl_GetChannelHandle, Tcl_GetChannelMode, Tcl_GetChannelBufferSize, Tcl_SetChannelBufferSize, Tcl_NotifyChannel, Tcl_BadChannelOption, Tcl_ChannelName, Tcl_ChannelVersion, Tcl_ChannelBlockModeProc, Tcl_ChannelCloseProc, Tcl_ChannelClose2Proc, Tcl_ChannelInputProc, Tcl_ChannelOutputProc, Tcl_ChannelSeekProc, Tcl_ChannelWideSeekProc, Tcl_ChannelTruncateProc, Tcl_ChannelSetOptionProc, Tcl_ChannelGetOptionProc, Tcl_ChannelWatchProc, Tcl_ChannelGetHandleProc, Tcl_ChannelFlushProc, Tcl_ChannelHandlerProc, Tcl_ChannelThreadActionProc, Tcl_IsChannelShared, Tcl_IsChannelRegistered, Tcl_CutChannel, Tcl_SpliceChannel, Tcl_IsChannelExisting, Tcl_ClearChannelHandlers, Tcl_GetChannelThread, Tcl_ChannelBuffered \- procedures for creating and manipulating channels
.SH SYNOPSIS
.nf
\fB#include <tcl.h>\fR
@@ -31,10 +31,8 @@ const char *
int
\fBTcl_GetChannelHandle\fR(\fIchannel, direction, handlePtr\fR)
.sp
.VS 8.4
Tcl_ThreadId
\fBTcl_GetChannelThread\fR(\fIchannel\fR)
.VE 8.4
.sp
int
\fBTcl_GetChannelMode\fR(\fIchannel\fR)
@@ -48,7 +46,6 @@ int
.sp
int
\fBTcl_BadChannelOption\fR(\fIinterp, optionName, optionList\fR)
.VS 8.4
.sp
int
\fBTcl_IsChannelShared\fR(\fIchannel\fR)
@@ -67,7 +64,6 @@ void
.sp
void
\fBTcl_ClearChannelHandlers\fR(\fIchannel\fR)
.VE 8.4
.sp
int
\fBTcl_ChannelBuffered\fR(\fIchannel\fR)
@@ -96,10 +92,16 @@ Tcl_DriverOutputProc *
Tcl_DriverSeekProc *
\fBTcl_ChannelSeekProc\fR(\fItypePtr\fR)
.sp
.VS 8.4
Tcl_DriverWideSeekProc *
\fBTcl_ChannelWideSeekProc\fR(\fItypePtr\fR)
.VE 8.4
.sp
Tcl_DriverThreadActionProc *
\fBTcl_ChannelThreadActionProc\fR(\fItypePtr\fR)
.sp
.VS 8.5
Tcl_DriverTruncateProc *
\fBTcl_ChannelTruncateProc\fR(\fItypePtr\fR)
.VE 8.5
.sp
Tcl_DriverSetOptionProc *
\fBTcl_ChannelSetOptionProc\fR(\fItypePtr\fR)
@@ -235,12 +237,10 @@ the channel does not have a device handle for the specified direction,
then \fBTCL_ERROR\fR is returned instead. Different channel drivers
will return different types of handle. Refer to the manual entries
for each driver to determine what type of handle is returned.
.VS 8.4
.PP
\fBTcl_GetChannelThread\fR returns the id of the thread currently managing
the specified \fIchannel\fR. This allows channel drivers to send their file
events to the correct event queue even for a multi-threaded core.
.VE 8.4
.PP
\fBTcl_GetChannelMode\fR returns an OR-ed combination of \fBTCL_READABLE\fR
and \fBTCL_WRITABLE\fR, indicating whether the channel is open for input
@@ -273,7 +273,6 @@ currently buffered in the internal buffer (push back area) of the
channel itself. It does not report about the data in the overall
buffers for the stack of channels the supplied channel is part of.
.PP
.VS 8.4
\fBTcl_IsChannelShared\fR checks the refcount of the specified
\fIchannel\fR and returns whether the \fIchannel\fR was shared among
multiple interpreters (result == 1) or not (result == 0).
@@ -290,15 +289,24 @@ name is registered in the (thread)-global list of all channels (result
(thread)global list of all channels (of the current thread).
Application to a channel still registered in some interpreter
is not allowed.
.VS 8.5
Also notifies the driver if the \fBTcl_ChannelType\fR version is
\fBTCL_CHANNEL_VERSION_4\fR (or higher), and
\fBTcl_DriverThreadActionProc\fR is defined for it.
.VE 8.5
.PP
\fBTcl_SpliceChannel\fR adds the specified \fIchannel\fR to the
(thread)global list of all channels (of the current thread).
Application to a channel registered in some interpreter is not allowed.
.VS 8.5
Also notifies the driver if the \fBTcl_ChannelType\fR version is
\fBTCL_CHANNEL_VERSION_4\fR (or higher), and
\fBTcl_DriverThreadActionProc\fR is defined for it.
.VE 8.5
.PP
\fBTcl_ClearChannelHandlers\fR removes all channelhandlers and event
scripts associated with the specified \fIchannel\fR, thus shutting
down all event processing for this channel.
.VE 8.4
.SH TCL_CHANNELTYPE
.PP
A channel driver provides a \fBTcl_ChannelType\fR structure that contains
@@ -326,16 +334,22 @@ typedef struct Tcl_ChannelType {
Tcl_DriverFlushProc *\fIflushProc\fR;
Tcl_DriverHandlerProc *\fIhandlerProc\fR;
Tcl_DriverWideSeekProc *\fIwideSeekProc\fR;
Tcl_DriverThreadActionProc *\fIthreadActionProc\fR;
.VS 8.5
Tcl_DriverTruncateProc *\fItruncateProc\fR;
.VE 8.5
} Tcl_ChannelType;
.CE
.PP
The driver must provide implementations for all functions except
\fIblockModeProc\fR, \fIseekProc\fR, \fIsetOptionProc\fR,
\fIgetOptionProc\fR, and \fIclose2Proc\fR, which may be specified as
NULL. Other functions that can not be implemented for this type of
device should return \fBEINVAL\fR when invoked to indicate that they
are not implemented, except in the case of \fIflushProc\fR and
\fIhandlerProc\fR, which should specified as NULL if not otherwise defined.
It is not necessary to provide implementations for all channel
operations. Those which are not necessary may be set to NULL in the
struct: \fIblockModeProc\fR, \fIseekProc\fR, \fIsetOptionProc\fR,
\fIgetOptionProc\fR, and \fIclose2Proc\fR, in addition to
\fIflushProc\fR, \fIhandlerProc\fR, \fIthreadActionProc\fR, and
\fItruncateProc\fR. Other functions that cannot be implemented in a
meaningful way should return \fBEINVAL\fR when called, to indicate
that the operations they represent are not available. Also note that
\fIwideSeekProc\fR can be NULL if \fIseekProc\fR is.
.PP
The user should only use the above structure for \fBTcl_ChannelType\fR
instantiation. When referencing fields in a \fBTcl_ChannelType\fR
@@ -344,9 +358,10 @@ structure, the following functions should be used to obtain the values:
\fBTcl_ChannelBlockModeProc\fR, \fBTcl_ChannelCloseProc\fR,
\fBTcl_ChannelClose2Proc\fR, \fBTcl_ChannelInputProc\fR,
\fBTcl_ChannelOutputProc\fR, \fBTcl_ChannelSeekProc\fR,
.VS 8.4
\fBTcl_ChannelWideSeekProc\fR,
.VE 8.4
\fBTcl_ChannelWideSeekProc\fR, \fBTcl_ChannelThreadActionProc\fR,
.VS 8.5
\fBTcl_ChannelTruncateProc\fR,
.VE 8.5
\fBTcl_ChannelSetOptionProc\fR, \fBTcl_ChannelGetOptionProc\fR,
\fBTcl_ChannelWatchProc\fR, \fBTcl_ChannelGetHandleProc\fR,
\fBTcl_ChannelFlushProc\fR, or \fBTcl_ChannelHandlerProc\fR.
@@ -365,17 +380,27 @@ This value can be retrieved with \fBTcl_ChannelName\fR, which returns
a pointer to the string.
.SS VERSION
.PP
The \fIversion\fR field should be set to \fBTCL_CHANNEL_VERSION_2\fR.
If it is not set to this value \fBTCL_CHANNEL_VERSION_3\fR, then this
\fBTcl_ChannelType\fR is assumed to have the older structure. See
The \fIversion\fR field should be set to the version of the structure
that you require. \fBTCL_CHANNEL_VERSION_2\fR is the minimum recommended.
\fBTCL_CHANNEL_VERSION_3\fR must be set to specifiy the \fIwideSeekProc\fR member.
.VS 8.5
\fBTCL_CHANNEL_VERSION_4\fR must be set to specifiy the
\fIthreadActionProc\fR and \fItruncateProc\fR members (includes
\fIwideSeekProc\fR).
.VE 8.5
If it is not set to any of these, then this
\fBTcl_ChannelType\fR is assumed to have the original structure. See
\fBOLD CHANNEL TYPES\fR for more details. While Tcl will recognize
and function with either structure, stacked channels must be of at
and function with either structures, stacked channels must be of at
least \fBTCL_CHANNEL_VERSION_2\fR to function correctly.
.PP
This value can be retrieved with \fBTcl_ChannelVersion\fR, which returns
.VS 8.4
one of \fBTCL_CHANNEL_VERSION_3\fR,
.VE 8.4
one of
.VS 8.5
\fBTCL_CHANNEL_VERSION_4\fR,
.VE 8.5
\fBTCL_CHANNEL_VERSION_3\fR,
\fBTCL_CHANNEL_VERSION_2\fR or \fBTCL_CHANNEL_VERSION_1\fR.
.SS BLOCKMODEPROC
.PP
@@ -576,7 +601,6 @@ does not implement seeking.
The return value is the new access point or -1 in case of error. If an
error occurred, the function should not move the access point.
.PP
.VS 8.4
If there is a non-NULL \fIseekProc\fR field, the \fIwideSeekProc\fR
field may contain the address of an alternative function to use which
handles wide (i.e. larger than 32-bit) offsets, so allowing seeks
@@ -601,7 +625,6 @@ The \fIseekProc\fR value can be retrieved with
\fBTcl_ChannelSeekProc\fR, which returns a pointer to the function,
and similarly the \fIwideSeekProc\fR can be retrieved with
\fBTcl_ChannelWideSeekProc\fR.
.VE 8.4
.SS SETOPTIONPROC
.PP
The \fIsetOptionProc\fR field contains the address of a function called by
@@ -775,6 +798,53 @@ type of event occurred on this channel.
.PP
This value can be retrieved with \fBTcl_ChannelHandlerProc\fR, which returns
a pointer to the function.
.SS "THREADACTIONPROC"
.PP
The \fIthreadActionProc\fR field contains the address of the function
called by the generic layer when a channel is created, closed, or
going to move to a different thread, i.e. whenever thread-specific
driver state might have to initialized or updated. It can be NULL.
The action \fITCL_CHANNEL_THREAD_REMOVE\fR is used to notify the
driver that it should update or remove any thread-specific data it
might be maintaining for the channel.
.PP
The action \fITCL_CHANNEL_THREAD_INSERT\fR is used to notify the
driver that it should update or initialize any thread-specific data it
might be maintaining using the calling thread as the associate. See
\fBTcl_CutChannel\fR and \fBTcl_SpliceChannel\fR for more detail.
.PP
.CS
typedef void Tcl_DriverThreadActionProc(
ClientData \fIinstanceData\fR,
int \fIaction\fR);
.CE
.PP
\fIInstanceData\fR is the same as the value passed to
\fBTcl_CreateChannel\fR when this channel was created.
.PP
These values can be retrieved with \fBTcl_ChannelThreadActionProc\fR,
which returns a pointer to the function.
.SS "TRUNCATEPROC"
.PP
The \fItruncateProc\fR field contains the address of the function
called by the generic layer when a channel is truncated to some
length. It can be NULL.
.PP
.CS
typedef int Tcl_DriverTruncateProc(
ClientData \fIinstanceData\fR,
Tcl_WideInt \fIlength\fR);
.CE
.PP
\fIInstanceData\fR is the same as the value passed to
\fBTcl_CreateChannel\fR when this channel was created, and
\fIlength\fR is the new length of the underlying file, which should
not be negative. The result should be 0 on success or an errno code
(suitable for use with \fBTcl_SetErrno\fR) on failure.
.PP
These values can be retrieved with \fBTcl_ChannelTruncateProc\fR,
which returns a pointer to the function.
.SH TCL_BADCHANNELOPTION
.PP
This procedure generates a "bad option" error message in an
@@ -783,7 +853,7 @@ an invalid Set/Get option is requested. Its purpose is to concatenate
the generic options list to the specific ones and factorize
the generic options error message string.
.PP
It always return \fBTCL_ERROR\fR
It always returns \fBTCL_ERROR\fR
.PP
An error message is generated in \fIinterp\fR's result object to
indicate that a command was invoked with a bad option.
@@ -830,7 +900,6 @@ the new \fBTcl_ChannelType\fR structure if you are creating a stacked
channel driver, due to problems with the earlier stacked channel
implementation (in 8.2.0 to 8.3.1).
.PP
.VS 8.4
Prior to 8.4.0 (i.e. during the later releases of 8.3 and early part
of the 8.4 development cycle) the \fBTcl_ChannelType\fR structure
contained the following fields:
@@ -851,12 +920,12 @@ typedef struct Tcl_ChannelType {
Tcl_DriverBlockModeProc *\fIblockModeProc\fR;
Tcl_DriverFlushProc *\fIflushProc\fR;
Tcl_DriverHandlerProc *\fIhandlerProc\fR;
Tcl_DriverTruncateProc *\fItruncateProc\fR;
} Tcl_ChannelType;
.CE
.PP
When the above structure is registered as a channel type, the
\fIversion\fR field should always be \fBTCL_CHANNEL_VERSION_2\fR.
.VE 8.4
.SH "SEE ALSO"
Tcl_Close(3), Tcl_OpenFileChannel(3), Tcl_SetErrno(3), Tcl_QueueEvent(3), Tcl_StackChannel(3), Tcl_GetStdChannel(3)
+1 -5
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: CrtCommand.3,v 1.10 2004/10/07 15:15:35 dkf Exp $
'\" RCS: @(#) $Id: CrtCommand.3,v 1.10.2.1 2005/04/10 23:14:40 kennykb Exp $
'\"
.so man.macros
.TH Tcl_CreateCommand 3 "" Tcl "Tcl Library Procedures"
@@ -95,16 +95,12 @@ the command name) and \fIargv\fR giving the values of the arguments
as strings. The \fIargv\fR array will contain \fIargc\fR+1 values;
the first \fIargc\fR values point to the argument strings, and the
last value is NULL.
.VS
Note that the argument strings should not be modified as they may
point to constant strings or may be shared with other parts of the
interpreter.
.VE
.PP
.VS
Note that the argument strings are encoded in normalized UTF-8 since
version 8.1 of Tcl.
.VE
.PP
\fIProc\fR must return an integer code that is expected to be one of
\fBTCL_OK\fR, \fBTCL_ERROR\fR, \fBTCL_RETURN\fR, \fBTCL_BREAK\fR, or
+1 -7
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: CrtFileHdlr.3,v 1.3 2004/10/07 14:44:31 dkf Exp $
'\" RCS: @(#) $Id: CrtFileHdlr.3,v 1.3.2.1 2005/04/10 23:14:41 kennykb Exp $
'\"
.so man.macros
.TH Tcl_CreateFileHandler 3 8.0 Tcl "Tcl Library Procedures"
@@ -15,12 +15,10 @@ Tcl_CreateFileHandler, Tcl_DeleteFileHandler \- associate procedure callbacks wi
.SH SYNOPSIS
.nf
\fB#include <tcl.h>\fR
.VS
.sp
\fBTcl_CreateFileHandler\fR(\fIfd, mask, proc, clientData\fR)
.sp
\fBTcl_DeleteFileHandler\fR(\fIfd\fR)
.VE
.SH ARGUMENTS
.AS Tcl_FileProc clientData
.AP int fd in
@@ -39,12 +37,10 @@ Arbitrary one-word value to pass to \fIproc\fR.
.SH DESCRIPTION
.PP
.VS
\fBTcl_CreateFileHandler\fR arranges for \fIproc\fR to be
invoked in the future whenever I/O becomes possible on a file
or an exceptional condition exists for the file. The file
is indicated by \fIfd\fR, and the conditions of interest
.VE
are indicated by \fImask\fR. For example, if \fImask\fR
is \fBTCL_READABLE\fR, \fIproc\fR will be called when
the file is readable.
@@ -89,10 +85,8 @@ complete the application won't be able to service other events. Use
\fBTcl_SetChannelOption\fR with \fB\-blocking\fR to set the channel into
blocking or nonblocking mode as required.
.PP
.VS
Note that these interfaces are only supported by the Unix
implementation of the Tcl notifier.
.VE
.SH KEYWORDS
callback, file, handler
+21 -21
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: CrtMathFnc.3,v 1.11 2004/10/07 15:15:35 dkf Exp $
'\" RCS: @(#) $Id: CrtMathFnc.3,v 1.11.2.2 2005/04/25 19:59:45 kennykb Exp $
'\"
.so man.macros
.TH Tcl_CreateMathFunc 3 8.4 Tcl "Tcl Library Procedures"
@@ -19,14 +19,12 @@ Tcl_CreateMathFunc, Tcl_GetMathFuncInfo, Tcl_ListMathFuncs \- Define, query and
void
\fBTcl_CreateMathFunc\fR(\fIinterp, name, numArgs, argTypes, proc, clientData\fR)
.sp
.VS 8.4
int
\fBTcl_GetMathFuncInfo\fR(\fIinterp, name, numArgsPtr, argTypesPtr, procPtr,
clientDataPtr\fR)
.sp
Tcl_Obj *
\fBTcl_ListMathFuncs\fR(\fIinterp, pattern\fR)
.VE
.SH ARGUMENTS
.AS Tcl_ValueType *clientDataPtr out
.AP Tcl_Interp *interp in
@@ -66,19 +64,25 @@ passing to \fITcl_StringMatch\fR), or NULL to not apply any filter.
.PP
Tcl allows a number of mathematical functions to be used in
expressions, such as \fBsin\fR, \fBcos\fR, and \fBhypot\fR.
\fBTcl_CreateMathFunc\fR allows applications to add additional functions
These functions are represented by commands in the namespace,
\fBtcl::mathfunc\fR. The \fBTcl_CreateMathFunc\fR function is
an obsolete way for applications to add additional functions
to those already provided by Tcl or to replace existing functions.
It should not be used by new applications, which should create
math functions using \fBTcl_CreateObjCommand\fR to create a command
in the \fBtcl::mathfunc\fR namespace.
.PP
In the \fBTcl_CreateMathFunc\fR interface,
\fIName\fR is the name of the function as it will appear in expressions.
If \fIname\fR doesn't already exist as a function then a new function
is created. If it does exist, then the existing function is replaced.
If \fIname\fR doesn't already exist in the \fB::tcl::mathfunc\fR
namespace, then a new command is created in that namespace.
If \fIname\fR does exist, then the existing function is replaced.
\fINumArgs\fR and \fIargTypes\fR describe the arguments to the function.
Each entry in the \fIargTypes\fR array must be
.VS 8.4
one of \fBTCL_INT\fR, \fBTCL_DOUBLE\fR, \fBTCL_WIDE_INT\fR,
or \fBTCL_EITHER\fR to indicate whether the corresponding argument must be an
integer, a double-precision floating value, a wide (64-bit) integer,
or any, respectively.
.VE 8.4
.PP
Whenever the function is invoked in an expression Tcl will invoke
\fIproc\fR. \fIProc\fR should have arguments and result that match
@@ -95,7 +99,6 @@ When \fIproc\fR is invoked the \fIclientData\fR and \fIinterp\fR
arguments will be the same as those passed to \fBTcl_CreateMathFunc\fR.
\fIArgs\fR will point to an array of \fInumArgs\fR Tcl_Value structures,
which describe the actual arguments to the function:
.VS 8.4
.CS
typedef struct Tcl_Value {
Tcl_ValueType \fItype\fR;
@@ -107,30 +110,24 @@ typedef struct Tcl_Value {
.PP
The \fItype\fR field indicates the type of the argument and is
one of \fBTCL_INT\fR, \fBTCL_DOUBLE\fR or \fBTCL_WIDE_INT\fR.
.VE 8.4
It will match the \fIargTypes\fR value specified for the function unless
the \fIargTypes\fR value was \fBTCL_EITHER\fR. Tcl converts
the argument supplied in the expression to the type requested in
\fIargTypes\fR, if that is necessary.
Depending on the value of the \fItype\fR field, the \fIintValue\fR,
.VS 8.4
\fIdoubleValue\fR or \fIwideValue\fR
.VE 8.4
field will contain the actual value of the argument.
.PP
\fIProc\fR should compute its result and store it either as an integer
in \fIresultPtr->intValue\fR or as a floating value in
\fIresultPtr->doubleValue\fR.
It should set also \fIresultPtr->type\fR to one of
.VS 8.4
\fBTCL_INT\fR, \fBTCL_DOUBLE\fR or \fBTCL_WIDE_INT\fR
.VE 8.4
to indicate which value was set.
Under normal circumstances \fIproc\fR should return \fBTCL_OK\fR.
If an error occurs while executing the function, \fIproc\fR should
return \fBTCL_ERROR\fR and leave an error message in the interpreter's result.
.PP
.VS 8.4
\fBTcl_GetMathFuncInfo\fR retrieves the values associated with
function \fIname\fR that were passed to a preceding
\fBTcl_CreateMathFunc\fR call. Normally, the return code is
@@ -141,20 +138,23 @@ result.
If an error did not occur, the array reference placed in the variable
pointed to by \fIargTypesPtr\fR is newly allocated, and should be
released by passing it to \fBTcl_Free\fR. Some functions (the
standard set implemented in the core) are implemented directly at the
bytecode level; attempting to retrieve values for them causes a NULL
to be stored in the variable pointed to by \fIprocPtr\fR and the
variable pointed to by \fIclientDataPtr\fR will not be modified.
standard set implemented in the core, and those defined by placing
commands in the \fBtcl::mathfunc\fR namespace) do not have
argument type information; attempting to retrieve values for
them causes a NULL to be stored in the variable pointed to by
\fIprocPtr\fR and the variable pointed to by \fIclientDataPtr\fR
will not be modified. The variable pointed to by \fInumArgsPointer\fR
will contain -1, and no argument types will be stored in the variable
pointed to by \fIargTypesPointer\fR.
.PP
\fBTcl_ListMathFuncs\fR returns a Tcl object containing a list of all
the math functions defined in the interpreter whose name matches
\fIpattern\fR. In the case of an error, NULL is returned and an error
message is left in the interpreter result, and otherwise the returned
object will have a reference count of zero.
.VE
.SH KEYWORDS
expression, mathematical function
.SH "SEE ALSO"
expr(n), info(n), Tcl_Free(3), Tcl_NewListObj(3)
expr(n), info(n), Tcl_CreateObjCommand(3), Tcl_Free(3), Tcl_NewListObj(3)
+1 -7
View File
@@ -4,7 +4,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: CrtObjCmd.3,v 1.11 2004/10/07 15:15:36 dkf Exp $
'\" RCS: @(#) $Id: CrtObjCmd.3,v 1.11.2.1 2005/04/10 23:14:41 kennykb Exp $
'\"
.so man.macros
.TH Tcl_CreateObjCommand 3 8.0 Tcl "Tcl Library Procedures"
@@ -30,17 +30,13 @@ int
int
\fBTcl_SetCommandInfo\fR(\fIinterp, cmdName, infoPtr\fR)
.sp
.VS 8.4
int
\fBTcl_GetCommandInfoFromToken\fR(\fItoken, infoPtr\fR)
.sp
int
\fBTcl_SetCommandInfoFromToken\fR(\fItoken, infoPtr\fR)
.VE
.sp
.VS 8.4
const char *
.VE
\fBTcl_GetCommandName\fR(\fIinterp, token\fR)
.sp
void
@@ -99,7 +95,6 @@ typedef int Tcl_ObjCmdProc(
ClientData \fIclientData\fR,
Tcl_Interp *\fIinterp\fR,
int \fIobjc\fR,
.VS
Tcl_Obj *const \fIobjv\fR[]);
.CE
When \fIproc\fR is invoked, the \fIclientData\fR and \fIinterp\fR parameters
@@ -125,7 +120,6 @@ object argument. For instance, the user may call
representation of that object; that call may change the type of the object
that \fIobjv\fR[\fB2\fR] points at, but will not change where
\fIobjv\fR[\fB2\fR] points.
.VE
.PP
\fIproc\fR must return an integer code that is either \fBTCL_OK\fR,
\fBTCL_ERROR\fR, \fBTCL_RETURN\fR, \fBTCL_BREAK\fR, or \fBTCL_CONTINUE\fR.
+2 -2
View File
@@ -4,7 +4,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: CrtSlave.3,v 1.14 2004/10/07 15:37:43 dkf Exp $
'\" RCS: @(#) $Id: CrtSlave.3,v 1.14.2.1 2005/03/09 15:57:15 kennykb Exp $
'\"
.so man.macros
.TH Tcl_CreateSlave 3 7.6 Tcl "Tcl Library Procedures"
@@ -79,7 +79,7 @@ Vector of strings, the additional arguments to pass to the alias command.
This storage is owned by the caller.
.AP int objc in
Count of additional object arguments to pass to the alias object command.
.AP Tcl_Object **objv in
.AP Tcl_Obj **objv in
Vector of Tcl_Obj structures, the additional object arguments to pass to
the alias object command.
This storage is owned by the caller.
+10 -8
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: DString.3,v 1.11 2004/10/07 15:15:36 dkf Exp $
'\" RCS: @(#) $Id: DString.3,v 1.11.2.1 2005/05/05 17:55:20 kennykb Exp $
'\"
.so man.macros
.TH Tcl_DString 3 7.4 Tcl "Tcl Library Procedures"
@@ -19,10 +19,10 @@ Tcl_DStringInit, Tcl_DStringAppend, Tcl_DStringAppendElement, Tcl_DStringStartSu
\fBTcl_DStringInit\fR(\fIdsPtr\fR)
.sp
char *
\fBTcl_DStringAppend\fR(\fIdsPtr, string, length\fR)
\fBTcl_DStringAppend\fR(\fIdsPtr, bytes, length\fR)
.sp
char *
\fBTcl_DStringAppendElement\fR(\fIdsPtr, string\fR)
\fBTcl_DStringAppendElement\fR(\fIdsPtr, element\fR)
.sp
\fBTcl_DStringStartSublist\fR(\fIdsPtr\fR)
.sp
@@ -47,10 +47,12 @@ char *
.AS Tcl_DString newLength in/out
.AP Tcl_DString *dsPtr in/out
Pointer to structure that is used to manage a dynamic string.
.AP "const char" *string in
Pointer to characters to add to dynamic string.
.AP "const char" *bytes in
Pointer to characters to append to dynamic string.
.AP "const char" *element in
Pointer to characters to append as list element to dynamic string.
.AP int length in
Number of characters from string to add to dynamic string. If -1,
Number of bytes from \fIbytes\fR to add to dynamic string. If -1,
add all characters up to null terminating character.
.AP int newLength in
New length for dynamic string, not including null terminating
@@ -77,7 +79,7 @@ string.
.PP
\fBTcl_DStringAppend\fR adds new information to a dynamic string,
allocating more memory for the string if needed.
If \fIlength\fR is less than zero then everything in \fIstring\fR
If \fIlength\fR is less than zero then everything in \fIbytes\fR
is appended to the dynamic string; otherwise \fIlength\fR
specifies the number of bytes to append.
\fBTcl_DStringAppend\fR returns a pointer to the characters of
@@ -86,7 +88,7 @@ the new string. The string can also be retrieved from the
.PP
\fBTcl_DStringAppendElement\fR is similar to \fBTcl_DStringAppend\fR
except that it doesn't take a \fIlength\fR argument (it appends
all of \fIstring\fR) and it converts the string to a proper list element
all of \fIelement\fR) and it converts the string to a proper list element
before appending.
\fBTcl_DStringAppendElement\fR adds a separator space before the
new list element unless the new list element is the first in a
+186
View File
@@ -0,0 +1,186 @@
'\"
'\" Copyright (c) 2005 Donal K. Fellows
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: Ensemble.3,v 1.1.2.1 2005/01/20 19:12:28 kennykb Exp $
'\"
'\" This documents the C API introduced in TIP#235
'\"
.so man.macros
.TH Tcl_Ensemble 3 8.5 Tcl "Tcl Library Procedures"
.BS
.SH NAME
Tcl_CreateEnsemble, Tcl_FindEnsemble, Tcl_GetEnsembleFlags, Tcl_GetEnsembleMappingDict, Tcl_GetEnsembleNamespace, Tcl_GetEnsembleUnknownHandler, Tcl_GetEnsmelbeSubcommandList, Tcl_IsEnsemble, Tcl_SetEnsembleFlags, Tcl_SetEnsembleMappingDict, Tcl_SetEnsembleSubcommandList, Tcl_SetEnsembleUnknownHandler \- manipulate ensemble commands
.SH SYNOPSIS
.nf
\fB#include <tcl.h>\fR
.sp
Tcl_Command
\fBTcl_CreateEnsemble\fR(\fIinterp, name, namespacePtr, ensFlags\fR)
.sp
Tcl_Command
\fBTcl_FindEnsemble\fR(\fIinterp, cmdNameObj, flags\fR)
.sp
int
\fBTcl_IsEnsemble\fR(\fItoken\fR)
.sp
int
\fBTcl_GetEnsembleFlags\fR(\fIinterp, token, ensFlagsPtr\fR)
.sp
int
\fBTcl_SetEnsembleFlags\fR(\fIinterp, token, ensFlags\fR)
.sp
int
\fBTcl_GetEnsembleMappingDict\fR(\fIinterp, token, dictObjPtr\fR)
.sp
int
\fBTcl_SetEnsembleMappingDict\fR(\fIinterp, token, dictObj\fR)
.sp
int
\fBTcl_GetEnsembleSubcommandList\fR(\fIinterp, token, listObjPtr\fR)
.sp
int
\fBTcl_SetEnsembleSubcommandList\fR(\fIinterp, token, listObj\fR)
.sp
int
\fBTcl_GetEnsembleUnknownHandler\fR(\fIinterp, token, listObjPtr\fR)
.sp
int
\fBTcl_SetEnsembleUnknownHandler\fR(\fIinterp, token, listObj\fR)
.sp
int
\fBTcl_GetEnsembleNamespace\fR(\fIinterp, token, namespacePtrPtr\fR)
.SH ARGUMENTS
.AS Tcl_Namespace **namespacePtrPtr in/out
.AP Tcl_Interp *interp in/out
The interpreter in which the ensemble is to be created or found. Also
where error result messages are written.
.AP "const char" *name in
The name of the ensemble command to be created.
.AP Tcl_Namespace *namespacePtr in
The namespace to which the ensemble command is to be bound, or NULL
for the current namespace.
.AP int ensFlags in
An ORed set of flag bits describing the basic configuration of the
ensemble. Currently only one bit has meaning, TCL_ENSEMBLE_PREFIX,
which is present when the ensemble command should also match
unambiguous prefixes of subcommands.
.AP Tcl_Obj *cmdNameObj in
A value holding the name of the ensemble command to look up.
.AP int flags in
An ORed set of flag bits controlling the behavior of
\fBTcl_FindEnsemble\fR. Currently only TCL_LEAVE_ERR_MSG is supported.
.AP Tcl_Command token in
A normal command token that refers to an ensemble command, or which
you wish to use for testing as an ensemble command in \fBTcl_IsEnsemble\fR.
.AP int *ensFlagsPtr out
Pointer to a variable into which to write the current ensemble flag
bits; currently only the bit TCL_ENSEMBLE_PREFIX is defined.
.AP Tcl_Obj *dictObj in
A dictionary value to use for the subcommand to implementation command
prefix mapping dictionary in the ensemble. May be NULL if the mapping
dictionary is to be removed.
.AP Tcl_Obj **dictObjPtr out
Pointer to a variable into which to write the current ensemble mapping
dictionary.
.AP Tcl_Obj *listObj in
A list value to use for the defined list of subcommands in the
dictionary or the unknown subcommmand handler command prefix. May be
NULL if the subcommand list or unknown handler are to be removed.
.AP Tcl_Obj **listObjPtr out
Pointer to a variable into which to write the current defiend list of
subcommands or the current unknown handler prefix.
.AP Tcl_Namespace **namespacePtrPtr out
Pointer to a variable into which to write the handle of the namespace
to which the ensemble is bound.
.BE
.SH DESCRIPTION
An ensemble is a command, bound to some namespace, which consists of a
collection of subcommands implemented by other Tcl commands. The first
argument to the ensemble command is always interpreted as a selector
that states what subcommand to execute.
.PP
Ensembles are created using \fBTcl_CreateEnsemble\fR, which takes four
arguments: the interpreter to work within, the name of the ensemble to
create, the namespace within the interpreter to bind the ensemble to,
and the default set of ensemble flags. The result of the function is
the command token for the ensemble, which may be used to further
configure the ensemble using the API descibed below in \fBENSEMBLE
PROPERTIES\fR.
.PP
Given the name of an ensemble command, the token for that command may
be retrieved using \fBTcl_FindEnsemble\fR. If the given command name
(in \fIcmdNameObj\fR) does not refer to an ensemble command, the
result of the function is NULL and (if the TCL_LEAVE_ERR_MSG bit is
set in \fIflags\fR) an error message is left in the interpreter
result.
.PP
A command token may be checked to see if it refers to an ensemble
using \fBTcl_IsEnsemble\fR. This returns 1 if the token refers to an
ensemble, or 0 otherwise.
.SS "ENSEMBLE PROPERTIES"
Every ensemble has four read-write properties and a read-only
property. The properties are:
.TP
\fBflags\fR (read-write)
The set of flags for the ensemble, expressed as a
bit-field. Currently, the only public flag is TCL_ENSEMBLE_PREFIX
which is set when unambiguous prefixes of subcommands are permitted to
be resolved to implementations as well as exact matches. The flags may
be read and written using \fBTcl_GetEnsembleFlags\fR and
\fBTcl_SetEnsembleFlags\fR respectively. The result of both of those
functions is a Tcl result code (TCL_OK, or TCL_ERROR if the token does
not refer to an ensemble).
.TP
\fBmapping dictionary\fR (read-write)
A dictionary containing a mapping from subcommand names to lists of
words to use as a command prefix (replacing the first two words of the
command which are the ensemble command itself and the subcommand
name), or NULL if every subcommand is to be mapped to the command with
the same unqualified name in the ensemble's bound namespace. Defaults
to NULL. May be read and written using
\fBTcl_GetEnsembleMappingDict\fR and \fBTcl_SetEnsembleMappingDict\fR
respectively. The result of both of those functions is a Tcl result
code (TCL_OK, or TCL_ERROR if the token does not refer to an
ensemble) and the dictionary obtained from
\fBTcl_GetEnsembleMappingDict\fR should always be treated as immutable
even if it is unshared.
.TP
\fBsubcommand list\fR (read-write)
A list of all the subcommand names for the ensemble, or NULL if this
is to be derived from either the keys of the mapping dictionary (see
above) or (if that is also NULL) from the set of commands exported by
the bound namespace. May be read and written using
\fBTcl_GetEnsembleSubcommandList\fR and
\fBTcl_SetEnsembleSubcommandList\fR respectively. The result of both
of those functions is a Tcl result code (TCL_OK, or TCL_ERROR if the
token does not refer to an ensemble) and the list obtained from
\fBTcl_GetEnsembleSubcommandList\fR should alays be treated as
immutable even if it is unshared.
.TP
\fBunknown subcommand handler command prefix\fR (read-write)
A list of words to prepend on the front of any subcommand when the
subcommand is unknown to the ensemble (according to the current prefix
handling rule); see the \fBnamespace ensemble\fR command for more
details. If NULL, the default behavior \- generate a suitable error
message \- will be used when an unknown subcommand is encountered. May
be read and written using \fBTcl_GetEnsembleUnknownHandler\fR and
\fBTcl_SetEnsembleUnknownHandler\fR respectively. The result of both
functions is a Tcl result code (TCL_OK, or TCL_ERROR if the token does
not refer to an ensemble) and the list obtained from
\fBTcl_GetEnsembleUnknownHandler\fR should always be treated as
immutable even if it is unshared.
.TP
\fBbound namespace\fR (read-only)
The namespace to which the ensemble is bound; when the namespace is
deleted, so too will the ensemble, and this namespace is also the
namespace whose list of exported commands is used if both the mapping
dictionary and the subcommand list properties are NULL. May be read
using \fBTcl_GetEnsembleNamespace\fR which returns a Tcl result code
(TCL_OK, or TCL_ERROR if the token does not refer to an ensemble).
.SH "SEE ALSO"
namespace(n), Tcl_DeleteCommandFromToken(3)
+6 -6
View File
@@ -4,7 +4,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: Environment.3,v 1.4 2004/10/07 15:15:37 dkf Exp $
'\" RCS: @(#) $Id: Environment.3,v 1.4.2.1 2005/05/05 17:55:20 kennykb Exp $
'\"
.so man.macros
.TH Tcl_PutEnv 3 "7.5" Tcl "Tcl Library Procedures"
@@ -16,12 +16,12 @@ Tcl_PutEnv \- procedures to manipulate the environment
\fB#include <tcl.h>\fR
.sp
int
\fBTcl_PutEnv\fR(\fIstring\fR)
\fBTcl_PutEnv\fR(\fIassignment\fR)
.SH ARGUMENTS
.AS "const char" *string
.AP "const char" *string in
Info about environment variable in the form NAME=value. The string is
in native format.
.AS "const char" *assignment
.AP "const char" *assignnment in
Info about environment variable in the format NAME=value.
The \fIassignment\fR argument is in the system encoding.
.BE
.SH DESCRIPTION
+4 -6
View File
@@ -6,7 +6,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: Eval.3,v 1.18 2004/10/07 15:15:37 dkf Exp $
'\" RCS: @(#) $Id: Eval.3,v 1.18.2.3 2005/09/15 20:58:38 dgp Exp $
'\"
.so man.macros
.TH Tcl_Eval 3 8.1 Tcl "Tcl Library Procedures"
@@ -39,7 +39,7 @@ int
\fBTcl_GlobalEvalObj\fR(\fIinterp, objPtr\fR)
.sp
int
\fBTcl_VarEval\fR(\fIinterp, string, string, ... \fB(char *) NULL\fR)
\fBTcl_VarEval\fR(\fIinterp, part, part, ... \fB(char *) NULL\fR)
.sp
int
\fBTcl_VarEvalVA\fR(\fIinterp, argList\fR)
@@ -67,11 +67,11 @@ null terminating character. If \-1, then all characters up to the
first null byte are used.
.AP "const char" *script in
Points to first byte of script to execute (null-terminated and UTF-8).
.AP char *string in
.AP char *part in
String forming part of a Tcl script.
.AP va_list argList in
An argument list which must have been initialized using
\fBTCL_VARARGS_START\fR, and cleared using \fBva_end\fR.
\fBva_start\fR, and cleared using \fBva_end\fR.
.BE
.SH DESCRIPTION
@@ -100,12 +100,10 @@ its contents as a Tcl script. It returns the same information as
\fBTcl_EvalObjEx\fR.
If the file couldn't be read then a Tcl error is returned to describe
why the file couldn't be read.
.VS 8.4
The eofchar for files is '\\32' (^Z) for all platforms.
If you require a ``^Z'' in code for string comparison, you can use
``\\032'' or ``\\u001a'', which will be safely substituted by the Tcl
interpreter into ``^Z''.
.VE 8.4
.PP
\fBTcl_EvalObjv\fR executes a single pre-parsed command instead of a
script. The \fIobjc\fR and \fIobjv\fR arguments contain the values
+8 -14
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: ExprLong.3,v 1.9 2004/10/07 16:05:13 dkf Exp $
'\" RCS: @(#) $Id: ExprLong.3,v 1.9.2.1 2005/05/05 17:55:21 kennykb Exp $
'\"
.so man.macros
.TH Tcl_ExprLong 3 7.0 Tcl "Tcl Library Procedures"
@@ -17,21 +17,21 @@ Tcl_ExprLong, Tcl_ExprDouble, Tcl_ExprBoolean, Tcl_ExprString \- evaluate an exp
\fB#include <tcl.h>\fR
.sp
int
\fBTcl_ExprLong\fR(\fIinterp, string, longPtr\fR)
\fBTcl_ExprLong\fR(\fIinterp, expr, longPtr\fR)
.sp
int
\fBTcl_ExprDouble\fR(\fIinterp, string, doublePtr\fR)
\fBTcl_ExprDouble\fR(\fIinterp, expr, doublePtr\fR)
.sp
int
\fBTcl_ExprBoolean\fR(\fIinterp, string, booleanPtr\fR)
\fBTcl_ExprBoolean\fR(\fIinterp, expr, booleanPtr\fR)
.sp
int
\fBTcl_ExprString\fR(\fIinterp, string\fR)
\fBTcl_ExprString\fR(\fIinterp, expr\fR)
.SH ARGUMENTS
.AS Tcl_Interp *booleanPtr out
.AP Tcl_Interp *interp in
Interpreter in whose context to evaluate \fIstring\fR or \fIobjPtr\fR.
.AP "const char" *string in
Interpreter in whose context to evaluate \fIexpr\fR.
.AP "const char" *expr in
Expression to be evaluated.
.AP long *longPtr out
Pointer to location in which to store the integer value of the
@@ -47,7 +47,7 @@ expression.
.SH DESCRIPTION
.PP
These four procedures all evaluate the expression
given by the \fIstring\fR argument
given by the \fIexpr\fR argument
and return the result in one of four different forms.
The expression can have any of the forms accepted by the \fBexpr\fR command.
Note that these procedures have been largely replaced by the
@@ -96,12 +96,6 @@ such as ``yes'' or ``no'', or else an error occurs.
.PP
\fBTcl_ExprString\fR returns the value of the expression as a
string stored in the interpreter's result.
If the expression's actual value is an integer
then \fBTcl_ExprString\fR converts it to a string using \fBsprintf\fR
with a ``%d'' converter.
If the expression's actual value is a floating-point
number, then \fBTcl_ExprString\fR calls \fBTcl_PrintDouble\fR
to convert it to a string.
.SH "SEE ALSO"
Tcl_ExprLongObj, Tcl_ExprDoubleObj, Tcl_ExprBooleanObj, Tcl_ExprObj
+2 -2
View File
@@ -4,7 +4,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: ExprLongObj.3,v 1.3 2001/09/03 09:38:50 dkf Exp $
'\" RCS: @(#) $Id: ExprLongObj.3,v 1.3.16.1 2005/05/05 17:55:21 kennykb Exp $
'\"
.so man.macros
.TH Tcl_ExprLongObj 3 8.0 Tcl "Tcl Library Procedures"
@@ -29,7 +29,7 @@ int
.SH ARGUMENTS
.AS Tcl_Interp **resultPtrPtr out
.AP Tcl_Interp *interp in
Interpreter in whose context to evaluate \fIstring\fR or \fIobjPtr\fR.
Interpreter in whose context to evaluate \fIobjPtr\fR.
.AP Tcl_Obj *objPtr in
Pointer to an object containing the expression to evaluate.
.AP long *longPtr out
+23 -8
View File
@@ -4,7 +4,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: FileSystem.3,v 1.50 2004/10/07 15:15:37 dkf Exp $
'\" RCS: @(#) $Id: FileSystem.3,v 1.50.2.4 2005/09/09 18:48:40 dgp Exp $
'\"
.so man.macros
.TH Filesystem 3 8.4 Tcl "Tcl Library Procedures"
@@ -209,6 +209,8 @@ Filled with the safe-init function for this code.
.AP ClientData *clientDataPtr out
Filled with the clientData value to pass to this code's unload
function when it is called.
.AP Tcl_LoadHandle *handlePtr out
Filled with an abstract token representing the loaded file.
.AP Tcl_FSUnloadFileProc **unloadProcPtr out
Filled with the function to use to unload this piece of code.
.AP utimbuf *tval in
@@ -228,6 +230,17 @@ The base path on to which to join the given elements. May be NULL.
The number of elements in \fIobjv\fR.
.AP "Tcl_Obj *const" objv[] in
The elements to join to the given base path.
.AP Tcl_Obj *linkNamePtr in
The name of the link to be created or read.
.AP Tcl_Obj *toPtr in
What the link called \fIlinkNamePtr\fR should be linked to, or NULL if
the symbolic link specified by \fIlinkNamePtr\fR is to be read.
.AP int linkAction in
OR-ed combination of flags indicating what kind of link should be
created (will be ignored if \fItoPtr\fR is NULL). Valid bits to set
are \fBTCL_CREATE_SYMBOLIC_LINK\fR and \fBTCL_CREATE_HARD_LINK\fR.
When both flags are set and the underlying filesystem can do either,
symbolic links are preferred.
.BE
.SH DESCRIPTION
@@ -363,8 +376,9 @@ directory for all files which match a given pattern. The appropriate
function for the filesystem to which \fIpathPtr\fR belongs will be called.
.PP
The return value is a standard Tcl result indicating whether an error
occurred in globbing. Error messages are placed in interp, but good
results are placed in the resultPtr given.
occurred in globbing. Error messages are placed in interp (unless
interp is NULL, which is allowed), but good results are placed in the
resultPtr given.
.PP
Note that the \fBglob\fR code implements recursive patterns internally, so
this function will only ever be passed simple patterns, which can be
@@ -607,7 +621,7 @@ which must store it or call \fBckfree\fR to ensure it is freed. Again,
\fBTcl_FSGetNormalizedPath\fR or \fBTcl_GetNativePath\fR are usually
better functions to use for most purposes.
.PP
\fBTcl_FSNewNativePath\fR performs something like that reverse of the
\fBTcl_FSNewNativePath\fR performs something like the reverse of the
usual obj->path->nativerep conversions. If some code retrieves a path
in native form (from, e.g. \fBreadlink\fR or a native dialog), and that path
is to be used at the Tcl level, then calling this function is an
@@ -1082,9 +1096,10 @@ not, so code should be flexible to both possibilities.
.PP
The return value is a standard Tcl result indicating whether an error
occurred in the matching process. Error messages are placed in
\fIinterp\fR; on a \fBTCL_OK\fR result, results should be added to the
\fIresultPtr\fR object given (which can be assumed to be a valid
unshared Tcl list). The matches added
\fIinterp\fR, unless \fIinterp\fR in NULL in which case no error
message need be generated; on a \fBTCL_OK\fR result, results should be
added to the \fIresultPtr\fR object given (which can be assumed to be a
valid unshared Tcl list). The matches added
to \fIresultPtr\fR should include any path prefix given in \fIpathPtr\fR
(this usually means they will be absolute path specifications).
Note that if no matches are found, that simply leads to an empty
@@ -1403,7 +1418,7 @@ message is left in the \fIinterp\fR's result. The function dynamically loads a
binary code file into memory. On a successful load, the \fIhandlePtr\fR
should be filled with a token for the dynamically loaded file, and the
\fIunloadProcPtr\fR should be filled in with the address of a procedure.
The unload procedure will be called with the given Tcl_LoadHandle as its
The unload procedure will be called with the given \fBTcl_LoadHandle\fR as its
only parameter when Tcl needs to unload the file. For example, for the
native filesystem, the \fBTcl_LoadHandle\fR returned is currently a token
which can be used in the private \fBTclpFindSymbol\fR to access functions
+1 -5
View File
@@ -4,7 +4,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: GetIndex.3,v 1.16 2004/10/07 16:05:13 dkf Exp $
'\" RCS: @(#) $Id: GetIndex.3,v 1.16.2.1 2005/04/10 23:14:41 kennykb Exp $
'\"
.so man.macros
.TH Tcl_GetIndexFromObj 3 8.1 Tcl "Tcl Library Procedures"
@@ -18,12 +18,10 @@ Tcl_GetIndexFromObj, Tcl_GetIndexFromObjStruct \- lookup string in table of keyw
int
\fBTcl_GetIndexFromObj\fR(\fIinterp, objPtr, tablePtr, msg, flags,
indexPtr\fR)
.VS
.sp
int
\fBTcl_GetIndexFromObjStruct\fR(\fIinterp, objPtr, structTablePtr, offset,
msg, flags, indexPtr\fR)
.VE
.SH ARGUMENTS
.AS "const char" *structTablePtr in/out
.AP Tcl_Interp *interp in
@@ -86,7 +84,6 @@ in \fItablePtr\fR are static: they must not change between
invocations. If the value of \fIobjPtr\fR is the empty string,
\fBTcl_GetIndexFromObj\fR will treat it as a non-matching value
and return \fBTCL_ERROR\fR.
.VS
.PP
\fBTcl_GetIndexFromObjStruct\fR works just like
\fBTcl_GetIndexFromObj\fR, except that instead of treating
@@ -98,7 +95,6 @@ array of characters at \fItablePtr\fR+\fIoffset\fR bytes, etc.)
This is particularly useful when processing things like
\fBTk_ConfigurationSpec\fR, whose string keys are in the same place in
each of several array elements.
.VE
.SH "SEE ALSO"
Tcl_WrongNumArgs
+23 -21
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: GetInt.3,v 1.7 2004/10/07 15:15:38 dkf Exp $
'\" RCS: @(#) $Id: GetInt.3,v 1.7.2.2 2005/05/05 17:55:21 kennykb Exp $
'\"
.so man.macros
.TH Tcl_GetInt 3 "" Tcl "Tcl Library Procedures"
@@ -17,62 +17,64 @@ Tcl_GetInt, Tcl_GetDouble, Tcl_GetBoolean \- convert from string to integer, dou
\fB#include <tcl.h>\fR
.sp
int
\fBTcl_GetInt\fR(\fIinterp, string, intPtr\fR)
\fBTcl_GetInt\fR(\fIinterp, src, intPtr\fR)
.sp
int
\fBTcl_GetDouble\fR(\fIinterp, string, doublePtr\fR)
\fBTcl_GetDouble\fR(\fIinterp, src, doublePtr\fR)
.sp
int
\fBTcl_GetBoolean\fR(\fIinterp, string, boolPtr\fR)
\fBTcl_GetBoolean\fR(\fIinterp, src, boolPtr\fR)
.SH ARGUMENTS
.AS Tcl_Interp *doublePtr out
.AP Tcl_Interp *interp in
Interpreter to use for error reporting.
.AP "const char" *string in
.AP "const char" *src in
Textual value to be converted.
.AP int *intPtr out
Points to place to store integer value converted from \fIstring\fR.
Points to place to store integer value converted from \fIsrc\fR.
.AP double *doublePtr out
Points to place to store double-precision floating-point
value converted from \fIstring\fR.
value converted from \fIsrc\fR.
.AP int *boolPtr out
Points to place to store boolean value (0 or 1) converted from \fIstring\fR.
Points to place to store boolean value (0 or 1) converted from \fIsrc\fR.
.BE
.SH DESCRIPTION
.PP
These procedures convert from strings to integers or double-precision
floating-point values or booleans (represented as 0- or 1-valued
integers). Each of the procedures takes a \fIstring\fR argument,
integers). Each of the procedures takes a \fIsrc\fR argument,
converts it to an internal form of a particular type, and stores
the converted value at the location indicated by the procedure's
third argument. If all goes well, each of the procedures returns
\fBTCL_OK\fR. If \fIstring\fR doesn't have the proper syntax for the
\fBTCL_OK\fR. If \fIsrc\fR doesn't have the proper syntax for the
desired type then \fBTCL_ERROR\fR is returned, an error message is left
in the interpreter's result, and nothing is stored at *\fIintPtr\fR
or *\fIdoublePtr\fR or *\fIboolPtr\fR.
.PP
\fBTcl_GetInt\fR expects \fIstring\fR to consist of a collection
\fBTcl_GetInt\fR expects \fIsrc\fR to consist of a collection
of integer digits, optionally signed and optionally preceded by
white space. If the first two characters of \fIstring\fR are ``0x''
then \fIstring\fR is expected to be in hexadecimal form; otherwise,
if the first character of \fIstring\fR is ``0'' then \fIstring\fR
is expected to be in octal form; otherwise, \fIstring\fR is
white space. If the first two characters of \fIsrc\fR
after the optional white space and sign are ``0x''
then \fIsrc\fR is expected to be in hexadecimal form; otherwise,
if the first such character is ``0'' then \fIsrc\fR
is expected to be in octal form; otherwise, \fIsrc\fR is
expected to be in decimal form.
.PP
\fBTcl_GetDouble\fR expects \fIstring\fR to consist of a floating-point
\fBTcl_GetDouble\fR expects \fIsrc\fR to consist of a floating-point
number, which is: white space; a sign; a sequence of digits; a
decimal point; a sequence of digits; the letter ``e''; and a
signed decimal exponent. Any of the fields may be omitted, except that
decimal point; a sequence of digits; the letter ``e''; a
signed decimal exponent ; and more white space.
Any of the fields may be omitted, except that
the digits either before or after the decimal point must be present
and if the ``e'' is present then it must be followed by the
exponent number.
.PP
\fBTcl_GetBoolean\fR expects \fIstring\fR to specify a boolean
value. If \fIstring\fR is any of \fB0\fR, \fBfalse\fR,
\fBTcl_GetBoolean\fR expects \fIsrc\fR to specify a boolean
value. If \fIsrc\fR is any of \fB0\fR, \fBfalse\fR,
\fBno\fR, or \fBoff\fR, then \fBTcl_GetBoolean\fR stores a zero
value at \fI*boolPtr\fR.
If \fIstring\fR is any of \fB1\fR, \fBtrue\fR, \fByes\fR, or \fBon\fR,
If \fIsrc\fR is any of \fB1\fR, \fBtrue\fR, \fByes\fR, or \fBon\fR,
then 1 is stored at \fI*boolPtr\fR.
Any of these values may be abbreviated, and upper-case spellings
are also acceptable.
+5 -7
View File
@@ -4,7 +4,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: GetOpnFl.3,v 1.8 2004/10/07 15:15:38 dkf Exp $
'\" RCS: @(#) $Id: GetOpnFl.3,v 1.8.2.2 2005/05/05 17:55:22 kennykb Exp $
.so man.macros
.TH Tcl_GetOpenFile 3 8.0 Tcl "Tcl Library Procedures"
.BS
@@ -15,13 +15,13 @@ Tcl_GetOpenFile \- Return a FILE* for a channel registered in the given interpre
\fB#include <tcl.h>\fR
.sp
int
\fBTcl_GetOpenFile\fR(\fIinterp, string, write, checkUsage, filePtr\fR)
\fBTcl_GetOpenFile\fR(\fIinterp, chanID, write, checkUsage, filePtr\fR)
.sp
.SH ARGUMENTS
.AS Tcl_Interp checkUsage out
.AP Tcl_Interp *interp in
Tcl interpreter from which file handle is to be obtained.
.AP "const char" *string in
.AP "const char" *chanID in
String identifying channel, such as \fBstdin\fR or \fBfile4\fR.
.AP int write in
Non-zero means the file will be used for writing, zero means it will
@@ -31,7 +31,7 @@ If non-zero, then an error will be generated if the file wasn't opened
for the access indicated by \fIwrite\fR.
.AP ClientData *filePtr out
Points to word in which to store pointer to FILE structure for
the file given by \fIstring\fR.
the file given by \fIchanID\fR.
.BE
.SH DESCRIPTION
@@ -46,16 +46,14 @@ In some cases, such as a channel that connects to a pipeline of
subprocesses, different FILE pointers will be returned for reading
and writing.
\fBTcl_GetOpenFile\fR normally returns \fBTCL_OK\fR.
If an error occurs in \fBTcl_GetOpenFile\fR (e.g. \fIstring\fR didn't
If an error occurs in \fBTcl_GetOpenFile\fR (e.g. \fIchanID\fR didn't
make any sense or \fIcheckUsage\fR was set and the file wasn't opened
for the access specified by \fIwrite\fR) then \fBTCL_ERROR\fR is returned
and the interpreter's result will contain an error message.
In the current implementation \fIcheckUsage\fR is ignored and consistency
checks are always performed.
.VS
.PP
Note that this interface is only supported on the Unix platform.
.VE
.SH KEYWORDS
channel, file handle, permissions, pipeline, read, write
+49
View File
@@ -16,10 +16,33 @@ Tcl_GetTime \- get date and time
\fB#include <tcl.h>\fR
.sp
\fBTcl_GetTime\fR(\fItimePtr\fR)
.sp
\fBTcl_SetTimeProc\fR(\fIgetProc, scaleProc, clientData\fR)
.sp
\fBTcl_QueryTimeProc\fR(\fIgetProcPtr, scaleProcPtr, clientDataPtr\fR)
.SH ARGUMENTS
.AS "Tcl_Time *" timePtr out
.AP "Tcl_Time *" timePtr out
Points to memory in which to store the date and time information.
.AS "Tcl_GetTimeProc *" getProc in
.AP "Tcl_GetTimeProc *" getProc in
Pointer to handler function replacing Tcl_GetTime's access to the OS.
.AS "Tcl_ScaleTimeProc *" scaleProc in
.AP "Tcl_ScaleTimeProc *" scaleProc in
Pointer to handler function for the conversion of time delays in the
virtual domain to real-time.
.AS "ClientData *" clientData in
.AP "ClientData *" clientData in
Value passed through to the two handler functions.
.AS "Tcl_GetTimeProc **" getProcPtr inout
.AP "Tcl_GetTimeProc **" getProcPtr inout
Pointer to place the currently registered get handler function into.
.AS "Tcl_ScaleTimeProc **" scaleProcPtr inout
.AP "Tcl_ScaleTimeProc **" scaleProcPtr inout
Pointer to place the currently registered scale handler function into.
.AS "ClientData **" clientDataPtr inout
.AP "ClientData **" clientDataPtr inout
Pointer to place the currently registered pass-through value into.
.BE
.SH DESCRIPTION
.PP
@@ -47,6 +70,32 @@ computer system. On multiprocessor variants of Windows, this number
may be limited to the 10- or 20-ms granularity of the system clock.
(On single-processor Windows systems, the \fIusec\fR field is derived
from a performance counter and is highly precise.)
.PP
The \fBTcl_SetTime\fR function registers two related handler functions
with the core. The first handler function is a replacement for
\fBTcl_GetTime\fR, or rather the OS access made by
\fBTcl_GetTime\fR. The other handler function is used by the Tcl
notifier to convert wait/block times from the virtual domain into real
time.
.PP
The \fBTcl_QueryTime\fR function returns the currently registered
handler functions. If no external handlers were set then this will
return the standard handlers accessing and processing the native time
of the OS. The arguments to the function are allowed to be NULL; and
any argument which is NULL is ignored and not set.
.PP
Any handler pair specified has to return data which is consistent
between them. In other words, setting one handler of the pair to
something assuming a 10-times slowdown, and the other handler of the
pair to something assuming a two-times slowdown is wrong and not
allowed.
.PP
The set handler functions are allowed to run the delivered time
backwards, however this should be avoided. We have to allow it as the
native time can run backwards as the user can fiddle with the system
time one way or other. Note that the insertion of the hooks will not
change the behaviour of the Tcl core with regard to this situation,
i.e. the existing behaviour is retained.
.SH "SEE ALSO"
clock
.SH KEYWORDS
+1 -21
View File
@@ -4,7 +4,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: IntObj.3,v 1.6 2004/10/07 15:37:43 dkf Exp $
'\" RCS: @(#) $Id: IntObj.3,v 1.6.2.1 2005/04/10 23:14:41 kennykb Exp $
'\"
.so man.macros
.TH Tcl_IntObj 3 8.0 Tcl "Tcl Library Procedures"
@@ -21,18 +21,14 @@ Tcl_Obj *
Tcl_Obj *
\fBTcl_NewLongObj\fR(\fIlongValue\fR)
.sp
.VS 8.4
Tcl_Obj *
\fBTcl_NewWideIntObj\fR(\fIwideValue\fR)
.VE 8.4
.sp
\fBTcl_SetIntObj\fR(\fIobjPtr, intValue\fR)
.sp
\fBTcl_SetLongObj\fR(\fIobjPtr, longValue\fR)
.sp
.VS 8.4
\fBTcl_SetWideIntObj\fR(\fIobjPtr, wideValue\fR)
.VE 8.4
.sp
int
\fBTcl_GetIntFromObj\fR(\fIinterp, objPtr, intPtr\fR)
@@ -40,10 +36,8 @@ int
int
\fBTcl_GetLongFromObj\fR(\fIinterp, objPtr, longPtr\fR)
.sp
.VS 8.4
int
\fBTcl_GetWideIntFromObj\fR(\fIinterp, objPtr, widePtr\fR)
.VE 8.4
.SH ARGUMENTS
.AS Tcl_WideInt longValue in/out
.AP int intValue in
@@ -51,20 +45,16 @@ Integer value used to initialize or set an integer object.
.AP long longValue in
Long integer value used to initialize or set an integer object.
.AP Tcl_WideInt wideValue in
.VS 8.4
Wide integer value (minimum 64-bits wide where supported by the
compiler) used to initialize or set a wide integer object.
.VE 8.4
.AP Tcl_Obj *objPtr in/out
For \fBTcl_SetIntObj\fR, \fBTcl_SetLongObj\fR, and
.VS 8.4
\fBTcl_SetWideIntObj\fR, this points to the object to be converted to
integer type. For \fBTcl_GetIntFromObj\fR, \fBTcl_GetLongFromObj\fR,
and \fBTcl_GetWideIntFromObj\fR, this refers to the object from which
to get an integer or long integer value; if \fIobjPtr\fR does not
already point to an integer object (or a wide integer object in the
case of \fBTcl_SetWideIntObj\fR and \fBTcl_GetWideIntFromObj\fR), an
.VE 8.4
attempt will be made to convert it to one.
.AP Tcl_Interp *interp in/out
If an error occurs during conversion,
@@ -77,10 +67,8 @@ obtained by \fBTcl_GetIntFromObj\fR from \fIobjPtr\fR.
Points to place to store the long integer value
obtained by \fBTcl_GetLongFromObj\fR from \fIobjPtr\fR.
.AP Tcl_WideInt *widePtr out
.VS 8.4
Points to place to store the wide integer value
obtained by \fBTcl_GetWideIntFromObj\fR from \fIobjPtr\fR.
.VE 8.4
.BE
.SH DESCRIPTION
@@ -91,17 +79,14 @@ integer and wide integer Tcl objects from C code.
\fBTcl_SetIntObj\fR, and \fBTcl_SetLongObj\fR
create a new object of integer type
or modify an existing object to have integer type,
.VS 8.4
and \fBTcl_NewWideIntObj\fR and \fBTcl_SetWideIntObj\fR create a new
object of wide integer type or modify an existing object to have wide
integer type.
.VE 8.4
\fBTcl_NewIntObj\fR and \fBTcl_SetIntObj\fR set the object to have the
integer value given by \fIintValue\fR,
\fBTcl_NewLongObj\fR and \fBTcl_SetLongObj\fR
set the object to have the
long integer value given by \fIlongValue\fR,
.VS 8.4
and \fBTcl_NewWideIntObj\fR and \fBTcl_SetWideIntObj\fR set the object
to have the wide integer value given by \fIwideValue\fR.
\fBTcl_NewIntObj\fR, \fBTcl_NewLongObj\fR and \fBTcl_NewWideIntObj\fR
@@ -111,19 +96,16 @@ and assign the integer value to the object's internal representation
\fIlongValue\fR or \fIwideValue\fR member (as appropriate).
\fBTcl_SetIntObj\fR, \fBTcl_SetLongObj\fR
and \fBTcl_SetWideIntObj\fR
.VE 8.4
invalidate any old string representation and,
if the object is not already an integer object,
free any old internal representation.
.PP
\fBTcl_GetIntFromObj\fR and \fBTcl_GetLongFromObj\fR
attempt to return an integer value from the Tcl object \fIobjPtr\fR,
.VS 8.4
and \fBTcl_GetWideIntFromObj\fR attempts to return a wide integer
value from the Tcl object \fIobjPtr\fR.
If the object is not already an integer object,
or a wide integer object in the case of \fBTcl_GetWideIntFromObj\fR
.VE 8.4
they will attempt to convert it to one.
If an error occurs during conversion, they return \fBTCL_ERROR\fR
and leave an error message in the interpreter's result object
@@ -135,10 +117,8 @@ and leaves an error message in the interpreter's result object
unless \fIinterp\fR is NULL.
Otherwise, all three procedures return \fBTCL_OK\fR and
store the integer, long integer value
.VS 8.4
or wide integer in the address given by \fIintPtr\fR, \fIlongPtr\fR
and \fIwidePtr\fR
.VE 8.4
respectively. If the object is not already an integer or wide integer
object, the conversion will free any old internal representation.
+1 -5
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: Interp.3,v 1.7 2004/11/12 09:01:25 das Exp $
'\" RCS: @(#) $Id: Interp.3,v 1.7.2.1 2005/04/10 23:14:41 kennykb Exp $
'\"
.so man.macros
.TH Tcl_Interp 3 7.5 Tcl "Tcl Library Procedures"
@@ -60,7 +60,6 @@ should point to an empty string.
Normally, results are assumed to be statically allocated,
which means that the contents will not change before the next time
\fBTcl_Eval\fR is called or some other command procedure is invoked.
.VS
In this case, the \fIfreeProc\fR field must be zero.
Alternatively, a command procedure may dynamically
allocate its return value (e.g. using \fBTcl_Alloc\fR)
@@ -69,7 +68,6 @@ In this case, the command procedure must also set \fIinterp->freeProc\fR
to the address of a procedure that can free the value, or \fBTCL_DYNAMIC\fR
if the storage was allocated directly by Tcl or by a call to
\fBTcl_Alloc\fR.
.VE
If \fIinterp->freeProc\fR is non-zero, then Tcl will call \fIfreeProc\fR
to free the space pointed to by \fIinterp->result\fR before it
invokes the next command.
@@ -81,10 +79,8 @@ macro should be used for this purpose).
\fIFreeProc\fR should have arguments and result that match the
\fBTcl_FreeProc\fR declaration above: it receives a single
argument which is a pointer to the result value to free.
.VS
In most applications \fBTCL_DYNAMIC\fR is the only non-zero value ever
used for \fIfreeProc\fR.
.VE
However, an application may store a different procedure address
in \fIfreeProc\fR in order to use an alternate memory allocator
or in order to do other cleanup when the result memory is freed.
+92 -11
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: LinkVar.3,v 1.9 2004/10/07 15:15:38 dkf Exp $
'\" RCS: @(#) $Id: LinkVar.3,v 1.9.2.2 2005/09/09 18:48:40 dgp Exp $
'\"
.so man.macros
.TH Tcl_LinkVar 3 7.5 Tcl "Tcl Library Procedures"
@@ -28,16 +28,23 @@ int
Interpreter that contains \fIvarName\fR.
Also used by \fBTcl_LinkVar\fR to return error messages.
.AP "const char" *varName in
Name of global variable.
Name of global variable.
.AP char *addr in
Address of C variable that is to be linked to \fIvarName\fR.
.AP int type in
Type of C variable. Must be one of \fBTCL_LINK_INT\fR, \fBTCL_LINK_DOUBLE\fR,
.VS 8.4
Type of C variable. Must be one of \fBTCL_LINK_INT\fR,
.VS 8.5
\fBTCL_LINK_UINT\fR, \fBTCL_LINK_CHAR\fR, \fBTCL_LINK_UCHAR\fR,
\fBTCL_LINK_SHORT\fR, \fBTCL_LINK_USHORT\fR, \fBTCL_LINK_LONG\fR,
\fBTCL_LINK_ULONG\fR,
.VE 8.5
\fBTCL_LINK_WIDE_INT\fR,
.VE 8.4
\fBTCL_LINK_BOOLEAN\fR, or \fBTCL_LINK_STRING\fR, optionally OR'ed with
\fBTCL_LINK_READ_ONLY\fR to make Tcl variable read-only.
.VS 8.5
\fBTCL_LINK_WIDE_UINT\fR, \fBTCL_LINK_FLOAT\fR,
.VE 8.5
\fBTCL_LINK_DOUBLE\fR, \fBTCL_LINK_BOOLEAN\fR, or
\fBTCL_LINK_STRING\fR, optionally OR'ed with \fBTCL_LINK_READ_ONLY\fR
to make Tcl variable read-only.
.BE
.SH DESCRIPTION
@@ -63,6 +70,61 @@ Any value written into the Tcl variable must have a proper integer
form acceptable to \fBTcl_GetIntFromObj\fR; attempts to write
non-integer values into \fIvarName\fR will be rejected with
Tcl errors.
.VS 8.5
.TP
\fBTCL_LINK_UINT\fR
The C variable is of type \fBunsigned int\fR.
Any value written into the Tcl variable must have a proper unsigned
integer form acceptable to \fBTcl_GetWideIntFromObj\fR and in the
platform's defined range for the \fBunsigned int\fR type; attempts to
write non-integer values (or values outside the range) into
\fIvarName\fR will be rejected with Tcl errors.
.TP
\fBTCL_LINK_CHAR\fR
The C variable is of type \fBchar\fR.
Any value written into the Tcl variable must have a proper integer
form acceptable to \fBTcl_GetIntFromObj\fR and be in the range of the
\fBchar\fR datatype; attempts to write non-integer or out-of-range
values into \fIvarName\fR will be rejected with Tcl errors.
.TP
\fBTCL_LINK_UCHAR\fR
The C variable is of type \fBunsigned char\fR.
Any value written into the Tcl variable must have a proper unsigned
integer form acceptable to \fBTcl_GetIntFromObj\fR and in the
platform's defined range for the \fBunsigned char\fR type; attempts to
write non-integer values (or values outside the range) into
\fIvarName\fR will be rejected with Tcl errors.
.TP
\fBTCL_LINK_SHORT\fR
The C variable is of type \fBshort\fR.
Any value written into the Tcl variable must have a proper integer
form acceptable to \fBTcl_GetIntFromObj\fR and be in the range of the
\fBshort\fR datatype; attempts to write non-integer or out-of-range
values into \fIvarName\fR will be rejected with Tcl errors.
.TP
\fBTCL_LINK_USHORT\fR
The C variable is of type \fBunsigned short\fR.
Any value written into the Tcl variable must have a proper unsigned
integer form acceptable to \fBTcl_GetIntFromObj\fR and in the
platform's defined range for the \fBunsigned short\fR type; attempts to
write non-integer values (or values outside the range) into
\fIvarName\fR will be rejected with Tcl errors.
.TP
\fBTCL_LINK_LONG\fR
The C variable is of type \fBlong\fR.
Any value written into the Tcl variable must have a proper integer
form acceptable to \fBTcl_GetLongFromObj\fR; attempts to write
non-integer or out-of-range
values into \fIvarName\fR will be rejected with Tcl errors.
.TP
\fBTCL_LINK_ULONG\fR
The C variable is of type \fBunsigned long\fR.
Any value written into the Tcl variable must have a proper unsigned
integer form acceptable to \fBTcl_GetWideIntFromObj\fR and in the
platform's defined range for the \fBunsigned long\fR type; attempts to
write non-integer values (or values outside the range) into
\fIvarName\fR will be rejected with Tcl errors.
.VE 8.5
.TP
\fBTCL_LINK_DOUBLE\fR
The C variable is of type \fBdouble\fR.
@@ -70,16 +132,37 @@ Any value written into the Tcl variable must have a proper real
form acceptable to \fBTcl_GetDoubleFromObj\fR; attempts to write
non-real values into \fIvarName\fR will be rejected with
Tcl errors.
.VS 8.5
.TP
\fBTCL_LINK_FLOAT\fR
The C variable is of type \fBfloat\fR.
Any value written into the Tcl variable must have a proper real
form acceptable to \fBTcl_GetDoubleFromObj\fR and must be within the
range acceptable for a \fBfloat\fR; attempts to
write non-real values (or values outside the range) into
\fIvarName\fR will be rejected with Tcl errors.
.VE 8.5
.TP
\fBTCL_LINK_WIDE_INT\fR
.VS 8.4
The C variable is of type \fBTcl_WideInt\fR (which is an integer type
at least 64-bits wide on all platforms that can support it.)
Any value written into the Tcl variable must have a proper integer
form acceptable to \fBTcl_GetWideIntFromObj\fR; attempts to write
non-integer values into \fIvarName\fR will be rejected with
Tcl errors.
.VE 8.4
.VS 8.5
.TP
\fBTCL_LINK_WIDE_UINT\fR
The C variable is of type \fBTcl_WideUInt\fR (which is an unsigned
integer type at least 64-bits wide on all platforms that can support
it.)
Any value written into the Tcl variable must have a proper unsigned
integer form acceptable to \fBTcl_GetWideIntFromObj\fR (it will be
cast to unsigned);
'\" FIXME! Use bignums instead.
attempts to write non-integer values into \fIvarName\fR will be
rejected with Tcl errors.
.VE 8.5
.TP
\fBTCL_LINK_BOOLEAN\fR
The C variable is of type \fBint\fR.
@@ -94,10 +177,8 @@ Tcl errors.
.TP
\fBTCL_LINK_STRING\fR
The C variable is of type \fBchar *\fR.
.VS
If its value is not NULL then it must be a pointer to a string
allocated with \fBTcl_Alloc\fR or \fBckalloc\fR.
.VE
Whenever the Tcl variable is modified the current C string will be
freed and new memory will be allocated to hold a copy of the variable's
new value.
+4 -3
View File
@@ -4,7 +4,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: ListObj.3,v 1.8 2004/10/07 16:05:14 dkf Exp $
'\" RCS: @(#) $Id: ListObj.3,v 1.8.2.1 2005/04/10 23:14:41 kennykb Exp $
'\"
.so man.macros
.TH Tcl_ListObj 3 8.0 Tcl "Tcl Library Procedures"
@@ -151,8 +151,9 @@ has reference count zero.
the elements in a list object. It returns the count by storing it in the
address \fIobjcPtr\fR. Similarly, it returns the array pointer by storing
it in the address \fIobjvPtr\fR.
The memory pointed to is managed by Tcl and should not be freed by the
caller.
The memory pointed to is managed by Tcl and should not be freed or written
to by the caller. If the list is empty, 0 is stored at \fIobjcPtr\fR
and NULL at \fIobjvPtr\fR.
If \fIlistPtr\fR is not already a list object, \fBTcl_ListObjGetElements\fR
will attempt to convert it to one; if the conversion fails, it returns
\fBTCL_ERROR\fR and leaves an error message in the interpreter's result
+1 -3
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: Notifier.3,v 1.13 2004/11/25 16:01:16 vasiljevic Exp $
'\" RCS: @(#) $Id: Notifier.3,v 1.13.2.1 2005/04/10 23:14:42 kennykb Exp $
'\"
.so man.macros
.TH Notifier 3 8.1 Tcl "Tcl Library Procedures"
@@ -27,7 +27,6 @@ void
.sp
void
\fBTcl_QueueEvent\fR(\fIevPtr, position\fR)
.VS 8.1
.sp
void
\fBTcl_ThreadQueueEvent\fR(\fIthreadId, evPtr, position\fR)
@@ -67,7 +66,6 @@ int
.sp
int
\fBTcl_SetServiceMode\fR(\fImode\fR)
.VE
.SH ARGUMENTS
.AS Tcl_EventDeleteProc *deleteProc
+1 -3
View File
@@ -4,7 +4,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: Object.3,v 1.10 2004/10/07 15:15:38 dkf Exp $
'\" RCS: @(#) $Id: Object.3,v 1.10.2.1 2005/04/10 23:14:42 kennykb Exp $
'\"
.so man.macros
.TH Tcl_Obj 3 8.1 Tcl "Tcl Library Procedures"
@@ -129,7 +129,6 @@ typedef struct Tcl_Obj {
} Tcl_Obj;
.CE
The \fIbytes\fR and the \fIlength\fR members together hold
.VS 8.1
an object's UTF-8 string representation,
which is a \fIcounted string\fR not containing null bytes (UTF-8 null
characters should be encoded as a two byte sequence: 192, 128.)
@@ -139,7 +138,6 @@ The byte array must always have a null byte after the last data byte,
at offset \fIlength\fR;
this allows string representations
to be treated as conventional null-terminated C strings.
.VE 8.1
C programs use \fBTcl_GetStringFromObj\fR and \fBTcl_GetString\fR to get
an object's string representation.
If \fIbytes\fR is NULL,
+17 -6
View File
@@ -4,13 +4,13 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: OpenFileChnl.3,v 1.29 2004/10/07 15:37:44 dkf Exp $
'\" RCS: @(#) $Id: OpenFileChnl.3,v 1.29.2.2 2005/07/12 20:36:15 kennykb Exp $
.so man.macros
.TH Tcl_OpenFileChannel 3 8.3 Tcl "Tcl Library Procedures"
.BS
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
Tcl_OpenFileChannel, Tcl_OpenCommandChannel, Tcl_MakeFileChannel, Tcl_GetChannel, Tcl_GetChannelNames, Tcl_GetChannelNamesEx, Tcl_RegisterChannel, Tcl_UnregisterChannel, Tcl_DetachChannel, Tcl_IsStandardChannel, Tcl_Close, Tcl_ReadChars, Tcl_Read, Tcl_GetsObj, Tcl_Gets, Tcl_WriteObj, Tcl_WriteChars, Tcl_Write, Tcl_Flush, Tcl_Seek, Tcl_Tell, Tcl_GetChannelOption, Tcl_SetChannelOption, Tcl_Eof, Tcl_InputBlocked, Tcl_InputBuffered, Tcl_OutputBuffered, Tcl_Ungets, Tcl_ReadRaw, Tcl_WriteRaw \- buffered I/O facilities using channels
Tcl_OpenFileChannel, Tcl_OpenCommandChannel, Tcl_MakeFileChannel, Tcl_GetChannel, Tcl_GetChannelNames, Tcl_GetChannelNamesEx, Tcl_RegisterChannel, Tcl_UnregisterChannel, Tcl_DetachChannel, Tcl_IsStandardChannel, Tcl_Close, Tcl_ReadChars, Tcl_Read, Tcl_GetsObj, Tcl_Gets, Tcl_WriteObj, Tcl_WriteChars, Tcl_Write, Tcl_Flush, Tcl_Seek, Tcl_Tell, Tcl_TruncateChannel, Tcl_GetChannelOption, Tcl_SetChannelOption, Tcl_Eof, Tcl_InputBlocked, Tcl_InputBuffered, Tcl_OutputBuffered, Tcl_Ungets, Tcl_ReadRaw, Tcl_WriteRaw \- buffered I/O facilities using channels
.SH SYNOPSIS
.nf
\fB#include <tcl.h>\fR
@@ -89,11 +89,9 @@ int
.sp
int
\fBTcl_InputBuffered\fR(\fIchannel\fR)
.VS 8.4
.sp
int
\fBTcl_OutputBuffered\fR(\fIchannel\fR)
.VE
.sp
Tcl_WideInt
\fBTcl_Seek\fR(\fIchannel, offset, seekMode\fR)
@@ -101,6 +99,11 @@ Tcl_WideInt
Tcl_WideInt
\fBTcl_Tell\fR(\fIchannel\fR)
.sp
.VS 8.5
int
\fBTcl_TruncateChannel\fR(\fIchannel, length\fR)
.VE 8.5
.sp
int
\fBTcl_GetChannelOption\fR(\fIinterp, channel, optionName, optionValue\fR)
.sp
@@ -198,6 +201,8 @@ given by \fIseekMode\fR. May be either positive or negative.
Relative to which point to seek; used with \fIoffset\fR to calculate the new
access point for the channel. Legal values are \fBSEEK_SET\fR,
\fBSEEK_CUR\fR, and \fBSEEK_END\fR.
.AP Tcl_WideInt length in
The (non-negative) length to truncate the channel the channel to.
.AP "const char" *optionName in
The name of an option applicable to this channel, such as \fB\-blocking\fR.
May have any of the values accepted by the \fBfconfigure\fR command.
@@ -594,6 +599,14 @@ After an error, the access point may or may not have been moved.
\fBTcl_Tell\fR returns the current access point for a channel. The returned
value is \-1 if the channel does not support seeking.
.SH TCL_TRUNCATECHANNEL
.PP
.VS 8.5
\fBTcl_TruncateChannel\fR truncates the file underlying \fIchannel\fR
to a given \fIlength\fR of bytes. It returns \fBTCL_OK\fR if the
operation succeeded, and \fBTCL_ERROR\fR otherwise.
.VE 8.5
.SH TCL_GETCHANNELOPTION
.PP
\fBTcl_GetChannelOption\fR retrieves, in \fIoptionValue\fR, the value of one of
@@ -643,11 +656,9 @@ buffered in the internal buffers for a channel. If the channel is not open
for reading, this function always returns zero.
.SH TCL_OUTPUTBUFFERED
.VS 8.4
\fBTcl_OutputBuffered\fR returns the number of bytes of output
currently buffered in the internal buffers for a channel. If the
channel is not open for writing, this function always returns zero.
.VE
.SH "PLATFORM ISSUES"
.PP
+1 -3
View File
@@ -4,7 +4,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: OpenTcp.3,v 1.8 2004/10/07 15:15:42 dkf Exp $
'\" RCS: @(#) $Id: OpenTcp.3,v 1.8.2.1 2005/04/10 23:14:42 kennykb Exp $
.so man.macros
.TH Tcl_OpenTcpClient 3 8.0 Tcl "Tcl Library Procedures"
.BS
@@ -163,13 +163,11 @@ If one of the standard channels, \fBstdin, stdout\fR or \fBstderr\fR was
previously closed, the act of creating the new channel also assigns it as a
replacement for the standard channel.
.VS
.SH "PLATFORM ISSUES"
.PP
On Unix platforms, the socket handle is a Unix file descriptor as
returned by the \fBsocket\fR system call. On the Windows platform, the
socket handle is a \fBSOCKET\fR as defined in the WinSock API.
.VE
.SH "SEE ALSO"
Tcl_OpenFileChannel(3), Tcl_RegisterChannel(3), vwait(n)
+2 -2
View File
@@ -2,7 +2,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: Panic.3,v 1.7 2004/10/07 15:15:47 dkf Exp $
'\" RCS: @(#) $Id: Panic.3,v 1.7.2.1 2005/09/15 20:58:38 dgp Exp $
'\"
.so man.macros
.TH Tcl_Panic 3 8.4 Tcl "Tcl Library Procedures"
@@ -31,7 +31,7 @@ A printf-style format string.
Arguments matching the format string.
.AP va_list argList in
An argument list of arguments matching the format string.
Must have been initialized using \fBTCL_VARARGS_START\fR,
Must have been initialized using \fBva_start\fR,
and cleared using \fBva_end\fR.
.AP Tcl_PanicProc *panicProc in
Procedure to report fatal error message and abort.
+22 -22
View File
@@ -4,7 +4,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: ParseCmd.3,v 1.18 2004/10/07 16:05:15 dkf Exp $
'\" RCS: @(#) $Id: ParseCmd.3,v 1.18.2.3 2005/09/26 20:16:53 kennykb Exp $
'\"
.so man.macros
.TH Tcl_ParseCommand 3 8.3 Tcl "Tcl Library Procedures"
@@ -16,22 +16,22 @@ Tcl_ParseCommand, Tcl_ParseExpr, Tcl_ParseBraces, Tcl_ParseQuotedString, Tcl_Par
\fB#include <tcl.h>\fR
.sp
int
\fBTcl_ParseCommand\fR(\fIinterp, string, numBytes, nested, parsePtr\fR)
\fBTcl_ParseCommand\fR(\fIinterp, start, numBytes, nested, parsePtr\fR)
.sp
int
\fBTcl_ParseExpr\fR(\fIinterp, string, numBytes, parsePtr\fR)
\fBTcl_ParseExpr\fR(\fIinterp, start, numBytes, parsePtr\fR)
.sp
int
\fBTcl_ParseBraces\fR(\fIinterp, string, numBytes, parsePtr, append, termPtr\fR)
\fBTcl_ParseBraces\fR(\fIinterp, start, numBytes, parsePtr, append, termPtr\fR)
.sp
int
\fBTcl_ParseQuotedString\fR(\fIinterp, string, numBytes, parsePtr, append, termPtr\fR)
\fBTcl_ParseQuotedString\fR(\fIinterp, start, numBytes, parsePtr, append, termPtr\fR)
.sp
int
\fBTcl_ParseVarName\fR(\fIinterp, string, numBytes, parsePtr, append\fR)
\fBTcl_ParseVarName\fR(\fIinterp, start, numBytes, parsePtr, append\fR)
.sp
const char *
\fBTcl_ParseVar\fR(\fIinterp, string, termPtr\fR)
\fBTcl_ParseVar\fR(\fIinterp, start, termPtr\fR)
.sp
\fBTcl_FreeParse\fR(\fIusedParsePtr\fR)
.sp
@@ -49,12 +49,12 @@ if NULL, then no error messages are left after errors.
For \fBTcl_EvalTokens\fR and \fBTcl_EvalTokensStandard\fR,
determines the context for evaluating the
script and also is used for error reporting; must not be NULL.
.AP "const char" *string in
.AP "const char" *start in
Pointer to first character in string to parse.
.AP int numBytes in
Number of bytes in \fIstring\fR, not including any terminating null
Number of bytes in string to parse, not including any terminating null
character. If less than 0 then the script consists of all characters
in \fIstring\fR up to the first null character.
following \fIstart\fR up to the first null character.
.AP int nested in
Non-zero means that the script is part of a command substitution so an
unquoted close bracket should be treated as a command terminator. If zero,
@@ -108,7 +108,7 @@ result, and no information is left at \fI*parsePtr\fR.
.PP
\fBTcl_ParseExpr\fR parses Tcl expressions.
Given a pointer to a script containing an expression,
\fBTcl_ParseCommand\fR parses the expression.
\fBTcl_ParseExpr\fR parses the expression.
If the expression was parsed successfully,
\fBTcl_ParseExpr\fR returns \fBTCL_OK\fR and fills in the
structure pointed to by \fIparsePtr\fR with information about the
@@ -120,8 +120,8 @@ result, and no information is left at \fI*parsePtr\fR.
\fBTcl_ParseBraces\fR parses a string or command argument
enclosed in braces such as
\fB{hello}\fR or \fB{string \\t with \\t tabs}\fR
from the beginning of its argument \fIstring\fR.
The first character of \fIstring\fR must be \fB{\fR.
from the beginning of its argument \fIstart\fR.
The first character of \fIstart\fR must be \fB{\fR.
If the braced string was parsed successfully,
\fBTcl_ParseBraces\fR returns \fBTCL_OK\fR,
fills in the structure pointed to by \fIparsePtr\fR
@@ -136,8 +136,8 @@ and no information is left at \fI*parsePtr\fR or \fI*termPtr\fR.
.PP
\fBTcl_ParseQuotedString\fR parses a double-quoted string such as
\fB"sum is [expr $a+$b]"\fR
from the beginning of the argument \fIstring\fR.
The first character of \fIstring\fR must be \fB"\fR.
from the beginning of the argument \fIstart\fR.
The first character of \fIstart\fR must be \fB"\fR.
If the double-quoted string was parsed successfully,
\fBTcl_ParseQuotedString\fR returns \fBTCL_OK\fR,
fills in the structure pointed to by \fIparsePtr\fR
@@ -152,8 +152,8 @@ and no information is left at \fI*parsePtr\fR or \fI*termPtr\fR.
.PP
\fBTcl_ParseVarName\fR parses a Tcl variable reference such as
\fB$abc\fR or \fB$x([expr $index + 1])\fR from the beginning of its
\fIstring\fR argument.
The first character of \fIstring\fR must be \fB$\fR.
\fIstart\fR argument.
The first character of \fIstart\fR must be \fB$\fR.
If a variable name was parsed successfully, \fBTcl_ParseVarName\fR
returns \fBTCL_OK\fR and fills in the structure pointed to by
\fIparsePtr\fR with information about the structure of the variable name
@@ -163,8 +163,8 @@ error message is left in \fIinterp\fR's result (if \fIinterp\fR isn't
NULL), and no information is left at \fI*parsePtr\fR.
.PP
\fBTcl_ParseVar\fR parse a Tcl variable reference such as \fB$abc\fR
or \fB$x([expr $index + 1])\fR from the beginning of its \fIstring\fR
argument. The first character of \fIstring\fR must be \fB$\fR. If
or \fB$x([expr $index + 1])\fR from the beginning of its \fIstart\fR
argument. The first character of \fIstart\fR must be \fB$\fR. If
the variable name is parsed successfully, \fBTcl_ParseVar\fR returns a
pointer to the string value of the variable. If an error occurs while
parsing, then NULL is returned and an error message is left in
@@ -295,7 +295,7 @@ prefix \fB{expand}\fR, indicating that after substitution,
the list value of this word should be expanded to form multiple
arguments in command evaluation. This
token type can only be created by Tcl_ParseCommand.
.VE
.VE 8.5
.TP
\fBTCL_TOKEN_TEXT\fR
The token describes a range of literal text that is part of a word.
@@ -431,7 +431,7 @@ Tcl_Parse structure depends on the contents of the quoted string.
It will consist of one or more \fBTCL_TOKEN_TEXT\fR, \fBTCL_TOKEN_BS\fR,
\fBTCL_TOKEN_COMMAND\fR, and \fBTCL_TOKEN_VARIABLE\fR sub-tokens.
The array always contains at least one token;
for example, if the argument \fIstring\fR is empty,
for example, if the argument \fIstart\fR is empty,
the array returned consists of a single \fBTCL_TOKEN_TEXT\fR token
with a zero \fIsize\fR field.
Only the token information in the Tcl_Parse structure
@@ -452,7 +452,7 @@ the \fIcommentStart\fR, \fIcommentSize\fR,
.PP
All of the character pointers in the
Tcl_Parse and Tcl_Token structures refer
to characters in the \fIstring\fR argument passed to
to characters in the \fIstart\fR argument passed to
\fBTcl_ParseCommand\fR, \fBTcl_ParseExpr\fR, \fBTcl_ParseBraces\fR,
\fBTcl_ParseQuotedString\fR, and \fBTcl_ParseVarName\fR.
.PP
+10 -3
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: PrintDbl.3,v 1.5 2004/10/07 14:44:33 dkf Exp $
'\" RCS: @(#) $Id: PrintDbl.3,v 1.5.2.2 2005/04/10 23:14:42 kennykb Exp $
'\"
.so man.macros
.TH Tcl_PrintDouble 3 8.0 Tcl "Tcl Library Procedures"
@@ -20,12 +20,10 @@ Tcl_PrintDouble \- Convert floating value to string
.SH ARGUMENTS
.AS Tcl_Interp *interp out
.AP Tcl_Interp *interp in
.VS
Before Tcl 8.0, the \fBtcl_precision\fR variable in this interpreter
controlled the conversion. As of Tcl 8.0, this argument is ignored and
the conversion is controlled by the \fBtcl_precision\fR variable
that is now shared by all interpreters.
.VE
.AP double value in
Floating-point value to be converted.
.AP char *dst out
@@ -42,6 +40,15 @@ special twist: the string is guaranteed to contain either
a ``.'' or an ``e'' so that it doesn't look like an integer. Where
\fB%g\fR would generate an integer with no decimal point, \fBTcl_PrintDouble\fR
adds ``.0''.
.VS 8.5
.PP
If the \fBtcl_precision\fR value is non-zero, the result will have
precisely that many digits of significance. If the value is zero
(the default), the result will have the fewest digits needed to
represent the number in such a way that \fBTcl_NewDoubleObj\fR
will generate the same number when presented with the given string.
IEEE semantics of rounding to even apply to the conversion.
.VE
.SH KEYWORDS
conversion, double-precision, floating-point, string
+18 -25
View File
@@ -6,7 +6,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: RegExp.3,v 1.20 2004/10/07 16:22:16 dkf Exp $
'\" RCS: @(#) $Id: RegExp.3,v 1.20.2.2 2005/05/05 17:55:22 kennykb Exp $
'\"
.so man.macros
.TH Tcl_RegExpMatch 3 8.1 Tcl "Tcl Library Procedures"
@@ -18,16 +18,16 @@ Tcl_RegExpMatch, Tcl_RegExpCompile, Tcl_RegExpExec, Tcl_RegExpRange, Tcl_GetRegE
\fB#include <tcl.h>\fR
.sp
int
\fBTcl_RegExpMatchObj\fR(\fIinterp\fR, \fIstrObj\fR, \fIpatObj\fR)
\fBTcl_RegExpMatchObj\fR(\fIinterp\fR, \fItextObj\fR, \fIpatObj\fR)
.sp
int
\fBTcl_RegExpMatch\fR(\fIinterp\fR, \fIstring\fR, \fIpattern\fR)
\fBTcl_RegExpMatch\fR(\fIinterp\fR, \fItext\fR, \fIpattern\fR)
.sp
Tcl_RegExp
\fBTcl_RegExpCompile\fR(\fIinterp\fR, \fIpattern\fR)
.sp
int
\fBTcl_RegExpExec\fR(\fIinterp\fR, \fIregexp\fR, \fIstring\fR, \fIstart\fR)
\fBTcl_RegExpExec\fR(\fIinterp\fR, \fIregexp\fR, \fItext\fR, \fIstart\fR)
.sp
void
\fBTcl_RegExpRange\fR(\fIregexp\fR, \fIindex\fR, \fIstartPtr\fR, \fIendPtr\fR)
@@ -36,7 +36,7 @@ Tcl_RegExp
\fBTcl_GetRegExpFromObj\fR(\fIinterp\fR, \fIpatObj\fR, \fIcflags\fR)
.sp
int
\fBTcl_RegExpExecObj\fR(\fIinterp\fR, \fIregexp\fR, \fIobjPtr\fR, \fIoffset\fR, \fInmatches\fR, \fIeflags\fR)
\fBTcl_RegExpExecObj\fR(\fIinterp\fR, \fIregexp\fR, \fItextObj\fR, \fIoffset\fR, \fInmatches\fR, \fIeflags\fR)
.sp
void
\fBTcl_RegExpGetInfo\fR(\fIregexp\fR, \fIinfoPtr\fR)
@@ -46,46 +46,39 @@ void
.AP Tcl_Interp *interp in
Tcl interpreter to use for error reporting. The interpreter may be
NULL if no error reporting is desired.
.AP Tcl_Obj *strObj in/out
Refers to the object from which to get the string to search. The
.AP Tcl_Obj *textObj in/out
Refers to the object from which to get the text to search. The
internal representation of the object may be converted to a form that
can be efficiently searched.
.AP Tcl_Obj *patObj in/out
Refers to the object from which to get a regular expression. The
compiled regular expression is cached in the object.
.AP char *string in
String to check for a match with a regular expression.
.AP char *text in
Text to search for a match with a regular expression.
.AP "const char" *pattern in
String in the form of a regular expression pattern.
.AP Tcl_RegExp regexp in
Compiled regular expression. Must have been returned previously
by \fBTcl_GetRegExpFromObj\fR or \fBTcl_RegExpCompile\fR.
.AP char *start in
If \fIstring\fR is just a portion of some other string, this argument
If \fItext\fR is just a portion of some other string, this argument
identifies the beginning of the larger string.
If it isn't the same as \fIstring\fR, then no \fB^\fR matches
If it isn't the same as \fItext\fR, then no \fB^\fR matches
will be allowed.
.AP int index in
Specifies which range is desired: 0 means the range of the entire
match, 1 or greater means the range that matched a parenthesized
sub-expression.
.AP "const char" **startPtr out
.VS 8.4
The address of the first character in the range is stored here, or
NULL if there is no such range.
.VE 8.4
.AP "const char" **endPtr out
.VS 8.4
The address of the character just after the last one in the range
is stored here, or NULL if there is no such range.
.VE 8.4
.AP int cflags in
OR-ed combination of compilation flags. See below for more information.
.AP Tcl_Obj *objPtr in/out
An object which contains the string to check for a match with a
regular expression.
.AP int offset in
The character offset into the string where matching should begin.
The character offset into the text where matching should begin.
The value of the offset has no impact on \fB^\fR matches. This
behavior is controlled by \fIeflags\fR.
.AP int nmatches in
@@ -115,7 +108,7 @@ If an error occurs in the matching process (e.g. \fIpattern\fR
is not a valid regular expression) then \fBTcl_RegExpMatch\fR
returns \-1 and leaves an error message in the interpreter result.
\fBTcl_RegExpMatchObj\fR is similar to \fBTcl_RegExpMatch\fR except it
operates on the Tcl objects \fIstrObj\fR and \fIpatObj\fR instead of
operates on the Tcl objects \fItextObj\fR and \fIpatObj\fR instead of
UTF strings.
\fBTcl_RegExpMatchObj\fR is generally more efficient than
\fBTcl_RegExpMatch\fR, so it is the preferred interface.
@@ -134,7 +127,7 @@ up to the next call to \fBTcl_RegExpCompile\fR; it is not safe to
retain these values for long periods of time.
.PP
\fBTcl_RegExpExec\fR executes the regular expression pattern matcher.
It returns 1 if \fIstring\fR contains a range of characters that
It returns 1 if \fItext\fR contains a range of characters that
match \fIregexp\fR, 0 if no match is found, and
\-1 if an error occurs.
In the case of an error, \fBTcl_RegExpExec\fR leaves an error
@@ -143,14 +136,14 @@ When searching a string for multiple matches of a pattern,
it is important to distinguish between the start of the original
string and the start of the current search.
For example, when searching for the second occurrence of a
match, the \fIstring\fR argument might point to the character
match, the \fItext\fR argument might point to the character
just after the first match; however, it is important for the
pattern matcher to know that this is not the start of the entire string,
so that it doesn't allow \fB^\fR atoms in the pattern to match.
The \fIstart\fR argument provides this information by pointing
to the start of the overall string containing \fIstring\fR.
\fIStart\fR will be less than or equal to \fIstring\fR; if it
is less than \fIstring\fR then no \fB^\fR matches will be allowed.
to the start of the overall string containing \fItext\fR.
\fIStart\fR will be less than or equal to \fItext\fR; if it
is less than \fItext\fR then no \fB^\fR matches will be allowed.
.PP
\fBTcl_RegExpRange\fR may be invoked after \fBTcl_RegExpExec\fR
returns; it provides detailed information about what ranges of
+11 -11
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: SaveResult.3,v 1.4 2004/11/20 00:17:31 dgp Exp $
'\" RCS: @(#) $Id: SaveResult.3,v 1.4.2.2 2005/04/10 23:14:42 kennykb Exp $
'\"
.so man.macros
.TH Tcl_SaveResult 3 8.1 Tcl "Tcl Library Procedures"
@@ -17,18 +17,18 @@ Tcl_SaveInterpState, Tcl_RestoreInterpState, Tcl_DiscardInterpState, Tcl_SaveRes
\fB#include <tcl.h>\fR
.sp
Tcl_InterpState
\fBTcl_SaveInterpState(\fIinterp, status\fB)\fR
\fBTcl_SaveInterpState\fR(\fIinterp, status\fR)
.sp
int
\fBTcl_RestoreInterpState(\fIinterp, state\fB)\fR
\fBTcl_RestoreInterpState\fR(\fIinterp, state\fR)
.sp
\fBTcl_DiscardInterpState(\fIstate\fB)\fR
\fBTcl_DiscardInterpState\fR(\fIstate\fR)
.sp
\fBTcl_SaveResult(\fIinterp, savedPtr\fB)\fR
\fBTcl_SaveResult\fR(\fIinterp, savedPtr\fR)
.sp
\fBTcl_RestoreResult(\fIinterp, savedPtr\fB)\fR
\fBTcl_RestoreResult\fR(\fIinterp, savedPtr\fR)
.sp
\fBTcl_DiscardResult(\fIsavedPtr\fB)\fR
\fBTcl_DiscardResult\fR(\fIsavedPtr\fR)
.SH ARGUMENTS
.AS Tcl_InterpState savedPtr
.AP Tcl_Interp *interp in
@@ -66,11 +66,11 @@ information in the interpreter (e.g. the \fB-errorcode\fR or
\fB-errorinfo\fR return options, when an error is in progress).
.PP
Because the routines \fBTcl_SaveInterpState\fR,
\fBTcl_RestoreInterpState\fB, and \fBTcl_DiscardInterpState\fR perform
\fBTcl_RestoreInterpState\fR, and \fBTcl_DiscardInterpState\fR perform
a superset of the functions provided by the other routines,
any new code should only make use of the more powerful routines.
The older, weaker routines \fBTcl_SaveResult\fB, \fBTcl_RestoreResult\fB,
and \fBTcl_DiscardResult\fB continue to exist only for the sake
The older, weaker routines \fBTcl_SaveResult\fR, \fBTcl_RestoreResult\fR,
and \fBTcl_DiscardResult\fR continue to exist only for the sake
of existing programs that may already be using them.
.PP
\fBTcl_SaveInterpState\fR takes a snapshot of those portions of
@@ -99,7 +99,7 @@ must eventually be passed to either \fBTcl_RestoreInterpState\fR
or \fBTcl_DiscardInterpState\fR to avoid a memory leak. Once
the \fBTcl_InterpState\fR token is passed to one of them, the
token is no longer valid and should not be used anymore.
.VE
.VE 8.5
.PP
\fBTcl_SaveResult\fR moves the string and object results
of \fIinterp\fR into the location specified by \fIstatePtr\fR.
+155
View File
@@ -0,0 +1,155 @@
'\"
'\" Copyright (c) 2005 Andreas Kupries <andreas_kupries@users.sourceforge.net>
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: SetChanErr.3,v 1.1.2.2 2005/08/25 15:46:30 dgp Exp $
.so man.macros
.TH Tcl_SetChannelError 3 8.5 Tcl "Tcl Library Procedures"
.BS
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
Tcl_SetChannelError, Tcl_SetChannelErrorInterp, Tcl_GetChannelError, Tcl_GetChannelErrorInterp \- functions to create/intercept Tcl errors by channel drivers.
.SH SYNOPSIS
.nf
\fB#include <tcl.h>\fR
.sp
void
\fBTcl_SetChannelError\fR(\fIchan, msg\fR)
.sp
void
\fBTcl_SetChannelErrorInterp\fR(\fIinterp, msg\fR)
.sp
void
\fBTcl_GetChannelError\fR(\fIchan, msgPtr\fR)
.sp
void
\fBTcl_GetChannelErrorInterp\fR(\fIinterp, msgPtr\fR)
.sp
.SH ARGUMENTS
.AS Tcl_Channel chan
.AP Tcl_Channel chan in
Refers to the Tcl channel whose bypass area is accessed.
.AP Tcl_Interp* interp in
Refers to the Tcl interpreter whose bypass area is accessed.
.AP Tcl_Obj* msg in
Error message put into a bypass area. A list of return options and
values, followed by a string message. Both message and the
option/value information are optional.
.AP Tcl_Obj** msgPtr out
Reference to a place where the message stored in the accessed bypass
area can be stored in.
.BE
.SH DESCRIPTION
.PP
The current definition of a Tcl channel driver does not permit the
direct return of arbitrary error messages, except for the setting and
retrieval of channel options. All other functions are restricted to
POSIX error codes.
.PP
The functions described here overcome this limitation. Channel drivers
are allowed to use \fBTcl_SetChannelError\fR and
\fBTcl_SetChannelErrorInterp\fR to place arbitrary error messages in
\fBbypass areas\fI defined for channels and interpreters. And the
generic I/O layer uses \fBTcl_GetChannelError\fR and
\fBTcl_GetChannelErrorInterp\fR to look for messages in the bypass
areas and arrange for their return as errors. The posix error codes
set by a driver are used now if and only if no messages are present.
.PP
\fBTcl_SetChannelError\fR stores error information in the bypass area
of the specified channel. The number of references to the \fBmsg\fI
object goes up by one. Previously stored information will be
discarded, by releasing the reference held by the channel. The channel
reference must not be NULL.
.PP
\fBTcl_SetChannelErrorInterp\fR stores error information in the bypass
area of the specified interpreter. The number of references to the
\fBmsg\fI object goes up by one. Previously stored information will be
discarded, by releasing the reference held by the interpreter. The
interpreter reference must not be NULL.
.PP
\fBTcl_GetChannelError\fR places either the error message held in the
bypass area of the specified channel into \fImsgPtr\fR, or NULL; and
resets the bypass. I.e. after an invokation all following invokations
will return NULL, until an intervening invokation of
\fBTcl_SetChannelError\fR with a non-NULL message. The \fImsgPtr\fR
must not be NULL. The reference count of the message is not touched.
The reference previously held by the channel is now held by the caller
of the function and it is its responsibility to release that reference
when it is done with the object.
.PP
\fBTcl_GetChannelErrorInterp\fR places either the error message held
in the bypass area of the specified interpreter into \fImsgPtr\fR, or
NULL; and resets the bypass. I.e. after an invokation all following
invokations will return NULL, until an intervening invokation of
\fBTcl_SetChannelErrorInterp\fR with a non-NULL message. The
\fImsgPtr\fR must not be NULL. The reference count of the message is
not touched. The reference previously held by the interpreter is now
held by the caller of the function and it is its responsibility to
release that reference when it is done with the object.
.PP
Which functions of a channel driver are allowed to use which bypass
function is listed below, as is which functions of the public channel
API may leave a messages in the bypass areas.
.PP
.IP \fBTcl_DriverCloseProc\fR
May use \fBTcl_SetChannelErrorInterp\fR, and only this function.
.IP \fBTcl_DriverInputProc\fR
May use \fBTcl_SetChannelError\fR, and only this function.
.IP \fBTcl_DriverOutputProc\fR
May use \fBTcl_SetChannelError\fR, and only this function.
.IP \fBTcl_DriverSeekProc\fR
May use \fBTcl_SetChannelError\fR, and only this function.
.IP \fBTcl_DriverWideSeekProc
May use \fBTcl_SetChannelError\fR, and only this function.
.IP \fBTcl_DriverSetOptionProc\fR
Has already the ability to pass arbitrary error messages. Must
\fBnot\fR use any of the new functions.
.IP \fBTcl_DriverGetOptionProc\fR
Has already the ability to pass arbitrary error messages. Must
\fBnot\fR use any of the new functions.
.IP \fBTcl_DriverWatchProc\fR
Must \fBnot\fR use any of the new functions. Is internally called and
has no ability to return any type of error whatsoever.
.IP \fBTcl_DriverBlockModeProc\fR
May use \fBTcl_SetChannelError\fR, and only this function.
.IP \fBTcl_DriverGetHandleProc\fR
Must \fBnot\fR use any of the new functions. It is only a low-level
function, and not used by Tcl commands.
.IP \fBTcl_DriverHandlerProc\fR
Must \fBnot\fR use any of the new functions. Is internally called and
has no ability to return any type of error whatsoever.
.PP
Given the information above the following public functions of the Tcl
C API are affected by these changes. I.e. when these functions are
called the channel may now contain a stored arbitrary error message
requiring processing by the caller.
.PP
.IP \fBTcl_StackChannel\fR
.IP \fBTcl_Seek\fR
.IP \fBTcl_Tell\fR
.IP \fBTcl_ReadRaw\fR
.IP \fBTcl_Read\fR
.IP \fBTcl_ReadChars\fR
.IP \fBTcl_Gets\fR
.IP \fBTcl_GetsObj\fR
.IP \fBTcl_Flush\fR
.IP \fBTcl_WriteRaw\fR
.IP \fBTcl_WriteObj\fR
.IP \fBTcl_Write\fR
.IP \fBTcl_WriteChars\fR
.PP
All other API functions are unchanged. Especially the functions below
leave all their error information in the interpreter result.
.PP
.IP \fBTcl_Close\fR
.IP \fBTcl_UnregisterChannel\fR
.IP \fBTcl_UnstackChannel\fR
.PP
.SH "SEE ALSO"
Tcl_Close(3), Tcl_OpenFileChannel(3), Tcl_SetErrno(3)
.SH KEYWORDS
channel driver, error messages, channel type
+24 -21
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: SetResult.3,v 1.11 2004/10/07 15:15:48 dkf Exp $
'\" RCS: @(#) $Id: SetResult.3,v 1.11.2.2 2005/09/15 20:58:38 dgp Exp $
'\"
.so man.macros
.TH Tcl_SetResult 3 8.0 Tcl "Tcl Library Procedures"
@@ -21,16 +21,16 @@ Tcl_SetObjResult, Tcl_GetObjResult, Tcl_SetResult, Tcl_GetStringResult, Tcl_Appe
Tcl_Obj *
\fBTcl_GetObjResult\fR(\fIinterp\fR)
.sp
\fBTcl_SetResult\fR(\fIinterp, string, freeProc\fR)
\fBTcl_SetResult\fR(\fIinterp, result, freeProc\fR)
.sp
const char *
\fBTcl_GetStringResult\fR(\fIinterp\fR)
.sp
\fBTcl_AppendResult\fR(\fIinterp, string, string, ... , \fB(char *) NULL\fR)
\fBTcl_AppendResult\fR(\fIinterp, result, result, ... , \fB(char *) NULL\fR)
.sp
\fBTcl_AppendResultVA\fR(\fIinterp, argList\fR)
.sp
\fBTcl_AppendElement\fR(\fIinterp, string\fR)
\fBTcl_AppendElement\fR(\fIinterp, element\fR)
.sp
\fBTcl_ResetResult\fR(\fIinterp\fR)
.sp
@@ -41,16 +41,19 @@ const char *
Interpreter whose result is to be modified or read.
.AP Tcl_Obj *objPtr in
Object value to become result for \fIinterp\fR.
.AP char *string in
.AP char *result in
String value to become result for \fIinterp\fR or to be
appended to the existing result.
.AP char *element in
String value to append as a list element
to the existing result of \fIinterp\fR.
.AP Tcl_FreeProc *freeProc in
Address of procedure to call to release storage at
\fIstring\fR, or \fBTCL_STATIC\fR, \fBTCL_DYNAMIC\fR, or
\fIresult\fR, or \fBTCL_STATIC\fR, \fBTCL_DYNAMIC\fR, or
\fBTCL_VOLATILE\fR.
.AP va_list argList in
An argument list which must have been initialized using
\fBTCL_VARARGS_START\fR, and cleared using \fBva_end\fR.
\fBva_start\fR, and cleared using \fBva_end\fR.
.BE
.SH DESCRIPTION
@@ -87,17 +90,17 @@ they should use \fBTcl_IncrRefCount\fR to increment its reference count
in order to keep it from being freed too early or accidentally changed.
.PP
\fBTcl_SetResult\fR
arranges for \fIstring\fR to be the result for the current Tcl
arranges for \fIresult\fR to be the result for the current Tcl
command in \fIinterp\fR, replacing any existing result.
The \fIfreeProc\fR argument specifies how to manage the storage
for the \fIstring\fR argument;
for the \fIresult\fR argument;
it is discussed in the section
\fBTHE TCL_FREEPROC ARGUMENT TO TCL_SETRESULT\fR below.
If \fIstring\fR is \fBNULL\fR, then \fIfreeProc\fR is ignored
If \fIresult\fR is \fBNULL\fR, then \fIfreeProc\fR is ignored
and \fBTcl_SetResult\fR
re-initializes \fIinterp\fR's result to point to an empty string.
.PP
\fBTcl_GetStringResult\fR returns the result for \fIinterp\fR as an string.
\fBTcl_GetStringResult\fR returns the result for \fIinterp\fR as a string.
If the result was set to an object by a \fBTcl_SetObjResult\fR call,
the object form will be converted to a string and returned.
If the object's string representation contains null bytes,
@@ -118,12 +121,12 @@ and the result is left as a empty string.
and \fBTcl_SetErrorCode\fR.
.PP
\fBTcl_AppendResult\fR makes it easy to build up Tcl results in pieces.
It takes each of its \fIstring\fR arguments and appends them in order
It takes each of its \fIresult\fR arguments and appends them in order
to the current result associated with \fIinterp\fR.
If the result is in its initialized empty state (e.g. a command procedure
was just invoked or \fBTcl_ResetResult\fR was just called),
then \fBTcl_AppendResult\fR sets the result to the concatenation of
its \fIstring\fR arguments.
its \fIresult\fR arguments.
\fBTcl_AppendResult\fR may be called repeatedly as additional pieces
of the result are produced.
\fBTcl_AppendResult\fR takes care of all the
@@ -132,7 +135,7 @@ result, such as allocating a larger result area if necessary.
It also manages conversion to and from the \fIresult\fR field of the
\fIinterp\fR so as to handle backward-compatability with old-style
extensions.
Any number of \fIstring\fR arguments may be passed in a single
Any number of \fIresult\fR arguments may be passed in a single
call; the last argument in the list must be a NULL pointer.
.PP
\fBTcl_AppendResultVA\fR is the same as \fBTcl_AppendResult\fR except that
@@ -148,12 +151,12 @@ can be significantly more efficient.
.PP
\fBTcl_AppendElement\fR is similar to \fBTcl_AppendResult\fR in
that it allows results to be built up in pieces.
However, \fBTcl_AppendElement\fR takes only a single \fIstring\fR
However, \fBTcl_AppendElement\fR takes only a single \fIelement\fR
argument and it appends that argument to the current result
as a proper Tcl list element.
\fBTcl_AppendElement\fR adds backslashes or braces if necessary
to ensure that \fIinterp\fR's result can be parsed as a list and that
\fIstring\fR will be extracted as a single element.
\fIelement\fR will be extracted as a single element.
Under normal conditions, \fBTcl_AppendElement\fR will add a space
character to \fIinterp\fR's result just before adding the new
list element, so that the list elements in the result are properly
@@ -185,21 +188,21 @@ and write the result using \fBTcl_SetObjResult\fR or \fBTcl_SetResult\fR.
.SH "THE TCL_FREEPROC ARGUMENT TO TCL_SETRESULT"
.PP
\fBTcl_SetResult\fR's \fIfreeProc\fR argument specifies how
the Tcl system is to manage the storage for the \fIstring\fR argument.
the Tcl system is to manage the storage for the \fIresult\fR argument.
If \fBTcl_SetResult\fR or \fBTcl_SetObjResult\fR are called
at a time when \fIinterp\fR holds a string result,
they do whatever is necessary to dispose of the old string result
(see the \fBTcl_Interp\fR manual entry for details on this).
.PP
If \fIfreeProc\fR is \fBTCL_STATIC\fR it means that \fIstring\fR
If \fIfreeProc\fR is \fBTCL_STATIC\fR it means that \fIresult\fR
refers to an area of static storage that is guaranteed not to be
modified until at least the next call to \fBTcl_Eval\fR.
If \fIfreeProc\fR
is \fBTCL_DYNAMIC\fR it means that \fIstring\fR was allocated with a call
is \fBTCL_DYNAMIC\fR it means that \fIresult\fR was allocated with a call
to \fBTcl_Alloc\fR and is now the property of the Tcl system.
\fBTcl_SetResult\fR will arrange for the string's storage to be
released by calling \fBTcl_Free\fR when it is no longer needed.
If \fIfreeProc\fR is \fBTCL_VOLATILE\fR it means that \fIstring\fR
If \fIfreeProc\fR is \fBTCL_VOLATILE\fR it means that \fIresult\fR
points to an area of memory that is likely to be overwritten when
\fBTcl_SetResult\fR returns (e.g. it points to something in a stack frame).
In this case \fBTcl_SetResult\fR will make a copy of the string in
@@ -217,7 +220,7 @@ result that match the type \fBTcl_FreeProc\fR:
typedef void Tcl_FreeProc(char *\fIblockPtr\fR);
.CE
When \fIfreeProc\fR is called, its \fIblockPtr\fR will be set to
the value of \fIstring\fR passed to \fBTcl_SetResult\fR.
the value of \fIresult\fR passed to \fBTcl_SetResult\fR.
.SH "SEE ALSO"
Tcl_AddErrorInfo, Tcl_CreateObjCommand, Tcl_SetErrorCode, Tcl_Interp
+4 -6
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: StrMatch.3,v 1.6 2004/10/07 15:15:48 dkf Exp $
'\" RCS: @(#) $Id: StrMatch.3,v 1.6.2.2 2005/05/05 17:55:24 kennykb Exp $
'\"
.so man.macros
.TH Tcl_StringMatch 3 8.1 Tcl "Tcl Library Procedures"
@@ -17,13 +17,13 @@ Tcl_StringMatch, Tcl_StringCaseMatch \- test whether a string matches a pattern
\fB#include <tcl.h>\fR
.sp
int
\fBTcl_StringMatch\fR(\fIstring\fR, \fIpattern\fR)
\fBTcl_StringMatch\fR(\fIstr\fR, \fIpattern\fR)
.sp
int
\fBTcl_StringCaseMatch\fR(\fIstring\fR, \fIpattern\fR, \fInocase\fR)
\fBTcl_StringCaseMatch\fR(\fIstr\fR, \fIpattern\fR, \fInocase\fR)
.SH ARGUMENTS
.AS "const char" *pattern
.AP "const char" *string in
.AP "const char" *str in
String to test.
.AP "const char" *pattern in
Pattern to match against string. May contain special
@@ -41,13 +41,11 @@ a given pattern. If it does, then \fBTcl_StringMatch\fR returns
used for matching is the same algorithm used in the ``string match''
Tcl command and is similar to the algorithm used by the C-shell
for file name matching; see the Tcl manual entry for details.
.VS 8.1
.PP
In \fBTcl_StringCaseMatch\fR, the algorithm is the same, but you have
the option to make the matching case-insensitive. If you choose this
(by passing \fBnocase\fR as 1), then the string and pattern are
essentially matched in the lower case.
.VE 8.1
.SH KEYWORDS
match, pattern, string
+2 -4
View File
@@ -4,7 +4,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: StringObj.3,v 1.17 2004/10/07 15:15:48 dkf Exp $
'\" RCS: @(#) $Id: StringObj.3,v 1.17.2.2 2005/09/15 20:58:39 dgp Exp $
'\"
.so man.macros
.TH Tcl_StringObj 3 8.1 Tcl "Tcl Library Procedures"
@@ -74,7 +74,6 @@ Tcl_Obj *
.SH ARGUMENTS
.AS "const Tcl_UniChar" *appendObjPtr in/out
.AP "const char" *bytes in
.VS 8.1
Points to the first byte of an array of UTF-8-encoded bytes
used to set or append to a string object.
This byte array may contain embedded null characters
@@ -82,7 +81,6 @@ unless \fInumChars\fR is negative. (Applications needing null bytes
should represent them as the two-byte sequence \fI\\700\\600\fR, use
\fBTcl_ExternalToUtf\fR to convert, or \fBTcl_NewByteArrayObj\fR if
the string is a collection of uninterpreted bytes.)
.VE 8.1
.AP int length in
The number of bytes to copy from \fIbytes\fR when
initializing, setting, or appending to a string object.
@@ -115,7 +113,7 @@ the length of an object's string representation.
Null-terminated string value to append to \fIobjPtr\fR.
.AP va_list argList in
An argument list which must have been initialised using
\fBTCL_VARARGS_START\fR, and cleared using \fBva_end\fR.
\fBva_start\fR, and cleared using \fBva_end\fR.
.AP int newLength in
New length for the string value of \fIobjPtr\fR, not including the
final null character.
+6 -7
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: Thread.3,v 1.20 2004/11/25 16:01:17 vasiljevic Exp $
'\" RCS: @(#) $Id: Thread.3,v 1.20.2.2 2005/03/02 21:25:19 kennykb Exp $
'\"
.so man.macros
.TH Threads 3 "8.1" Tcl "Tcl Library Procedures"
@@ -96,8 +96,8 @@ caller can determine the size of the stack given to the new thread and
modify the behaviour through the supplied \fIflags\fR. The value
\fBTCL_THREAD_STACK_DEFAULT\fR for the \fIstackSize\fR indicates that
the default size as specified by the operating system is to be used
for the new thread. As for the flags, currently are only the values
\fBTCL_THREAD_NOFLAGS\fR and \fBTCL_THREAD_JOINABLE\fR defined. The
for the new thread. As for the flags, currently only the values
\fBTCL_THREAD_NOFLAGS\fR and \fBTCL_THREAD_JOINABLE\fR are defined. The
first of them invokes the default behaviour with no
specialties. Using the second value marks the new thread as
\fIjoinable\fR. This means that another thread can wait for the such
@@ -109,7 +109,7 @@ specified value for the stack size is ignored on these systems.
Windows currently does not support joinable threads. This
flag value is therefore ignored on this platform.
.PP
Tcl does provide \fBTcl_ExitThread\fR and \fBTcl_FinalizeThread\fR
Tcl provides the \fBTcl_ExitThread\fR and \fBTcl_FinalizeThread\fR functions
for terminating threads and invoking optional per-thread exit
handlers. See the \fBTcl_Exit\fR page for more information on these
procedures.
@@ -191,8 +191,7 @@ the script level. One such package is the \fBThread\fR package.
.VE 8.5
.SH "SEE ALSO"
Tcl_GetCurrentThread(3), Tcl_ThreadQueueEvent(3), Tcl_ThreadAlert(3),
Tcl_ExitThread(3), Tcl_FinalizeThread(3),
Tcl_CreateThreadExitHandler(3), Tcl_DeleteThreadExitHandler(3),
\fBThread\fR package
Tcl_ExitThread(3), Tcl_FinalizeThread(3), Tcl_CreateThreadExitHandler(3),
Tcl_DeleteThreadExitHandler(3), Thread
.SH KEYWORDS
thread, mutex, condition variable, thread local storage
+1 -9
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: TraceVar.3,v 1.13 2004/10/07 16:05:15 dkf Exp $
'\" RCS: @(#) $Id: TraceVar.3,v 1.13.2.1 2005/04/10 23:14:42 kennykb Exp $
'\"
.so man.macros
.TH Tcl_TraceVar 3 7.4 Tcl "Tcl Library Procedures"
@@ -108,21 +108,17 @@ array names or array get is called. Note that this is called
before an array set, but that will trigger write traces.
.TP
\fBTCL_TRACE_RESULT_DYNAMIC\fR
.VS 8.4
The result of invoking the \fIproc\fR is a dynamically allocated
string that will be released by the Tcl library via a call to
\fBckfree\fR. Must not be specified at the same time as
\fBTCL_TRACE_RESULT_OBJECT\fR.
.VE 8.4
.TP
\fBTCL_TRACE_RESULT_OBJECT\fR
.VS 8.4
The result of invoking the \fIproc\fR is a Tcl_Obj* (cast to a char*)
with a reference count of at least one. The ownership of that
reference will be transferred to the Tcl core for release (when the
core has finished with it) via a call to \fBTcl_DecrRefCount\fR. Must
not be specified at the same time as \fBTCL_TRACE_RESULT_DYNAMIC\fR.
.VE 8.4
.PP
Whenever one of the specified operations occurs on the variable,
\fIproc\fR will be invoked.
@@ -209,7 +205,6 @@ The procedures \fBTcl_TraceVar2\fR, \fBTcl_UntraceVar2\fR, and
except that the name of the variable consists of two parts.
\fIName1\fR gives the name of a scalar variable or array,
and \fIname2\fR gives the name of an element within an array.
.VS 8.1
When \fIname2\fR is NULL,
\fIname1\fR may contain both an array and an element name:
if the name contains an open parenthesis and ends with a
@@ -219,7 +214,6 @@ the characters before the first open
parenthesis are treated as the name of an array variable.
If \fIname2\fR is NULL and \fIname1\fR does not refer
to an array element
.VE
it means that either the variable is
a scalar or the trace is to be set on the entire array rather
than an individual element (see WHOLE-ARRAY TRACES below for
@@ -325,13 +319,11 @@ If \fIproc\fR returns a non-NULL value it signifies that an
error occurred.
The return value must be a pointer to a static character string
containing an error message,
.VS 8.4
unless (\fIexactly\fR one of) the \fBTCL_TRACE_RESULT_DYNAMIC\fR and
\fBTCL_TRACE_RESULT_OBJECT\fR flags is set, which specify that the result is
either a dynamic string (to be released with \fBckfree\fR) or a
Tcl_Obj* (cast to char* and to be released with
\fBTcl_DecrRefCount\fR) containing the error message.
.VE 8.4
If a trace procedure returns an error, no further traces are
invoked for the access and the traced access aborts with the
given message.
+29 -32
View File
@@ -4,7 +4,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: Utf.3,v 1.20 2004/10/07 16:05:15 dkf Exp $
'\" RCS: @(#) $Id: Utf.3,v 1.20.2.2 2005/05/05 17:55:24 kennykb Exp $
'\"
.so man.macros
.TH Utf 3 "8.1" Tcl "Tcl Library Procedures"
@@ -22,41 +22,36 @@ int
.sp
int
\fBTcl_UtfToUniChar\fR(\fIsrc, chPtr\fR)
.VS 8.4
.sp
char *
\fBTcl_UniCharToUtfDString\fR(\fIuniStr, numChars, dstPtr\fR)
\fBTcl_UniCharToUtfDString\fR(\fIuniStr, uniLength, dsPtr\fR)
.sp
Tcl_UniChar *
\fBTcl_UtfToUniCharDString\fR(\fIsrc, len, dstPtr\fR)
.VE 8.4
\fBTcl_UtfToUniCharDString\fR(\fIsrc, length, dsPtr\fR)
.sp
int
\fBTcl_UniCharLen\fR(\fIuniStr\fR)
.sp
int
\fBTcl_UniCharNcmp\fR(\fIuniStr, uniStr, num\fR)
.VS 8.4
\fBTcl_UniCharNcmp\fR(\fIucs, uct, numChars\fR)
.sp
int
\fBTcl_UniCharNcasecmp\fR(\fIuniStr, uniStr, num\fR)
\fBTcl_UniCharNcasecmp\fR(\fIucs, uct, numChars\fR)
.sp
int
\fBTcl_UniCharCaseMatch\fR(\fIuniStr, uniPattern, nocase\fR)
.VE 8.4
.sp
int
\fBTcl_UtfNcmp\fR(\fIsrc, src, num\fR)
\fBTcl_UtfNcmp\fR(\fIcs, ct, numChars\fR)
.sp
int
\fBTcl_UtfNcasecmp\fR(\fIsrc, src, num\fR)
\fBTcl_UtfNcasecmp\fR(\fIcs, ct, numChars\fR)
.sp
int
\fBTcl_UtfCharComplete\fR(\fIsrc, len\fR)
\fBTcl_UtfCharComplete\fR(\fIsrc, length\fR)
.sp
int
\fBTcl_NumUtfChars\fR(\fIsrc, len\fR)
.VS 8.4
\fBTcl_NumUtfChars\fR(\fIsrc, length\fR)
.sp
const char *
\fBTcl_UtfFindFirst\fR(\fIsrc, ch\fR)
@@ -69,15 +64,12 @@ const char *
.sp
const char *
\fBTcl_UtfPrev\fR(\fIsrc, start\fR)
.VE 8.4
.sp
Tcl_UniChar
\fBTcl_UniCharAtIndex\fR(\fIsrc, index\fR)
.VS 8.4
.sp
const char *
\fBTcl_UtfAtIndex\fR(\fIsrc, index\fR)
.VE 8.4
.sp
int
\fBTcl_UtfBackslash\fR(\fIsrc, readPtr, dst\fR)
@@ -92,19 +84,27 @@ The Tcl_UniChar to be converted or examined.
Filled with the Tcl_UniChar represented by the head of the UTF-8 string.
.AP "const char" *src in
Pointer to a UTF-8 string.
.AP "const char" *cs in
Pointer to a UTF-8 string.
.AP "const char" *ct in
Pointer to a UTF-8 string.
.AP "const Tcl_UniChar" *uniStr in
A null-terminated Unicode string.
.AP "const Tcl_UniChar" *ucs in
A null-terminated Unicode string.
.AP "const Tcl_UniChar" *uct in
A null-terminated Unicode string.
.AP "const Tcl_UniChar" *uniPattern in
A null-terminated Unicode string.
.AP int len in
.AP int length in
The length of the UTF-8 string in bytes (not UTF-8 characters). If
negative, all bytes up to the first null byte are used.
.AP int numChars in
.AP int uniLength in
The length of the Unicode string in characters. Must be greater than or
equal to 0.
.AP "Tcl_DString" *dstPtr in/out
.AP "Tcl_DString" *dsPtr in/out
A pointer to a previously initialized \fBTcl_DString\fR.
.AP "unsigned long" num in
.AP "unsigned long" numChars in
The number of characters to compare.
.AP "const char" *start in
Pointer to the beginning of a UTF-8 string.
@@ -117,10 +117,8 @@ including the backslash character.
Buffer in which the bytes represented by the backslash sequence are stored.
At most \fBTCL_UTF_MAX\fR bytes are stored in the buffer.
.AP int nocase in
.VS 8.4
Specifies whether the match should be done case-sensitive (0) or
case-insensitive (1).
.VE 8.4
.BE
.SH DESCRIPTION
@@ -150,15 +148,16 @@ byte of \fIsrc\fR in \fI*chPtr\fR as a Tcl_UniChar between 0x0000 and
.PP
\fBTcl_UniCharToUtfDString\fR converts the given Unicode string
to UTF-8, storing the result in a previously initialized \fBTcl_DString\fR.
You must specify the length of the given Unicode string.
You must specify \fIuniLength\fR, the length of the given Unicode string.
The return value is a pointer to the UTF-8 representation of the
Unicode string. Storage for the return value is appended to the
end of the \fBTcl_DString\fR.
.PP
\fBTcl_UtfToUniCharDString\fR converts the given UTF-8 string to Unicode,
storing the result in the previously initialized \fBTcl_DString\fR.
You may either specify the length of the given UTF-8 string or "-1",
in which case \fBTcl_UtfToUniCharDString\fR uses \fBstrlen\fR to
In the argument \fIlength\fR, you may either specify the length of
the given UTF-8 string in bytes or "-1", in which
case \fBTcl_UtfToUniCharDString\fR uses \fBstrlen\fR to
calculate the length. The return value is a pointer to the Unicode
representation of the UTF-8 string. Storage for the return value
is appended to the end of the \fBTcl_DString\fR. The Unicode string
@@ -171,23 +170,21 @@ the number of Unicode characters (not bytes) in that string.
\fBTcl_UniCharNcmp\fR and \fBTcl_UniCharNcasecmp\fR correspond to
\fBstrncmp\fR and \fBstrncasecmp\fR, respectively, for Unicode characters.
They accept two null-terminated Unicode strings and the number of characters
to compare. Both strings are assumed to be at least \fIlen\fR characters
to compare. Both strings are assumed to be at least \fInumChars\fR characters
long. \fBTcl_UniCharNcmp\fR compares the two strings character-by-character
according to the Unicode character ordering. It returns an integer greater
than, equal to, or less than 0 if the first string is greater than, equal
to, or less than the second string respectively. \fBTcl_UniCharNcasecmp\fR
is the Unicode case insensitive version.
.PP
.VS 8.4
\fBTcl_UniCharCaseMatch\fR is the Unicode equivalent to
\fBTcl_StringCaseMatch\fR. It accepts a null-terminated Unicode string,
a Unicode pattern, and a boolean value specifying whether the match should
be case sensitive and returns whether the string matches the pattern.
.VE 8.4
.PP
\fBTcl_UtfNcmp\fR corresponds to \fBstrncmp\fR for UTF-8 strings. It
accepts two null-terminated UTF-8 strings and the number of characters
to compare. (Both strings are assumed to be at least \fIlen\fR
to compare. (Both strings are assumed to be at least \fInumChars\fR
characters long.) \fBTcl_UtfNcmp\fR compares the two strings
character-by-character according to the Unicode character ordering.
It returns an integer greater than, equal to, or less than 0 if the
@@ -200,7 +197,7 @@ differences in case when comparing upper, lower or title case
characters.
.PP
\fBTcl_UtfCharComplete\fR returns 1 if the source UTF-8 string \fIsrc\fR
of length \fIlen\fR bytes is long enough to be decoded by
of \fIlength\fR bytes is long enough to be decoded by
\fBTcl_UtfToUniChar\fR, or 0 otherwise. This function does not guarantee
that the UTF-8 string is properly formed. This routine is used by
procedures that are operating on a byte at a time and need to know if a
@@ -208,7 +205,7 @@ full Tcl_UniChar has been seen.
.PP
\fBTcl_NumUtfChars\fR corresponds to \fBstrlen\fR for UTF-8 strings. It
returns the number of Tcl_UniChars that are represented by the UTF-8 string
\fIsrc\fR. The length of the source string is \fIlen\fR bytes. If the
\fIsrc\fR. The length of the source string is \fIlength\fR bytes. If the
length is negative, all bytes up to the first null byte are used.
.PP
\fBTcl_UtfFindFirst\fR corresponds to \fBstrchr\fR for UTF-8 strings. It
+1 -5
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: array.n,v 1.13 2004/10/27 14:24:37 dkf Exp $
'\" RCS: @(#) $Id: array.n,v 1.13.2.1 2005/04/10 23:14:42 kennykb Exp $
'\"
.so man.macros
.TH array n 8.3 Tcl "Tcl Built-In Commands"
@@ -122,15 +122,12 @@ It is currently more efficient and easier to use either the \fBarray
get\fR or \fBarray names\fR, together with \fBforeach\fR, to iterate
over all but very large arrays. See the examples below for how to do
this.
.VS 8.4
.TP
\fBarray statistics \fIarrayName\fR
Returns statistics about the distribution of data within the hashtable
that represents the array. This information includes the number of
entries in the table, the number of buckets, and the utilization of
the buckets.
.VE 8.4
.VS 8.3
.TP
\fBarray unset \fIarrayName\fR ?\fIpattern\fR?
Unsets all of the elements in the array that match \fIpattern\fR (using the
@@ -139,7 +136,6 @@ of an array variable or there are no matching elements in the array, no
error will be raised. If \fIpattern\fR is omitted and \fIarrayName\fR is
an array variable, then the command unsets the entire array.
The command always returns an empty string.
.VE 8.3
.SH EXAMPLES
.CS
\fBarray set\fR colorcount {
+10 -6
View File
@@ -4,7 +4,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: binary.n,v 1.24 2004/11/12 11:03:16 dkf Exp $
'\" RCS: @(#) $Id: binary.n,v 1.24.2.1 2005/03/02 21:25:20 kennykb Exp $
'\"
.so man.macros
.TH binary n 8.0 Tcl "Tcl Built-In Commands"
@@ -431,7 +431,7 @@ If you want to produce an unsigned value, then you can mask the return
value to the desired size. For example, to produce an unsigned short
value:
.CS
set val [expr {$val & 0xFFFF}]; \fI# val == 0x8000\fR
set val [expr { $val & 0xFFFF }]; \fI# val == 0x8000\fR
.CE
.PP
Each type-count pair moves an imaginary cursor through the binary data,
@@ -529,7 +529,7 @@ stored in \fIvar2\fR. Note that the integers returned are signed, but
they can be converted to unsigned 8-bit quantities using an expression
like:
.CS
expr { ( $num + 0x100 ) % 0x100 }
set num [expr { $num & 0xff }]
.CE
.RE
.IP \fBs\fR 5
@@ -548,7 +548,7 @@ stored in \fIvar2\fR. Note that the integers returned are signed, but
they can be converted to unsigned 16-bit quantities using an expression
like:
.CS
expr { ( $num + 0x10000 ) % 0x10000 }
set num [expr { $num & 0xffff }]
.CE
.RE
.IP \fBS\fR 5
@@ -583,8 +583,12 @@ set str \\x05\\x00\\x00\\x00\\x07\\x00\\x00\\x00\\xf0\\xff\\xff\\xff
\fBbinary scan\fR $str i2i* var1 var2
.CE
will return \fB2\fR with \fB5 7\fR stored in \fIvar1\fR and \fB-16\fR
stored in \fIvar2\fR. Note that the integers returned are signed and
cannot be represented by Tcl as unsigned values.
stored in \fIvar2\fR. Note that the integers returned are signed, but
they can be converted to unsigned 32-bit quantities using an expression
like:
.CS
set num [expr { $num & 0xffffffff }]
.CE
.RE
.IP \fBI\fR 5
This form is the same as \fBI\fR except that the data is interpreted
+588
View File
@@ -0,0 +1,588 @@
'\"
'\" Copyright (c) 2005 Donal K. Fellows
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: chan.n,v 1.2.6.2 2005/07/12 20:36:15 kennykb Exp $
.so man.macros
.TH chan n 8.5 Tcl "Tcl Built-In Commands"
.BS
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
chan \- Read, write and manipulate channels
.SH SYNOPSIS
\fBchan \fIoption\fR ?\fIarg arg ...\fR?
.BE
.SH DESCRIPTION
.PP
This command provides several operations for reading from, writing to
and otherwise manipulating open channels (such as have been created
with the \fBopen\fR and \fBsocket\fR commands, or the default named
channels \fBstdin\fR, \fBstdout\fR or \fBstderr\fR which correspond to
the process's standard input, output and error streams respectively).
\fIOption\fR indicates what to do with the channel; any unique
abbreviation for \fIoption\fR is acceptable. Valid options are:
.TP
\fBchan blocked \fIchannelId\fR
.
This tests whether the last input operation on the channel called
\fIchannelId\fR failed because it would have otherwise caused the
process to block, and returns 1 if that was the case. It returns 0
otherwise. Note that this only ever returns 1 when the channel has
been configured to be non-blocking; all Tcl channels have blocking
turned on by default.
.TP
\fBchan close \fIchannelId\fR
.
Close and destroy the channel called \fIchannelId\fR. Note that this
deletes all existing file-events registered on the channel.
.RS
.PP
As part of closing the channel, all buffered output is flushed to the
channel's outpuot device, any buffered input is discarded, the
underlying operating system resource is closed and \fIchannelId\fR
becomes unavailable for future use.
.PP
If the channel is blocking, the command does not return until all
output is flushed. If the channel is nonblocking and there is
unflushed output, the channel remains open and the command returns
immediately; output will be flushed in the background and the channel
will be closed when all the flushing is complete.
.PP
If \fIchannelId\fR is a blocking channel for a command pipeline then
\fBchan close\fR waits for the child processes to complete.
.PP
If the channel is shared between interpreters, then \fBchan close\fR
makes \fIchannelId\fR unavailable in the invoking interpreter but has
no other effect until all of the sharing interpreters have closed the
channel. When the last interpreter in which the channel is registered
invokes \fBchan close\fR (or \fBclose\fR), the cleanup actions
described above occur. See the \fBinterp\fR command for a description
of channel sharing.
.PP
Channels are automatically closed when an interpreter is destroyed and
when the process exits. Channels are switched to blocking mode, to
ensure that all output is correctly flushed before the process exits.
.PP
The command returns an empty string, and may generate an error if
an error occurs while flushing output. If a command in a command
pipeline created with \fBopen\fR returns an error, \fBchan close\fR
generates an error (similar to the \fBexec\fR command.)
.RE
.TP
\fBchan configure \fIchannelId\fR ?\fIoptionName\fR? ?\fIvalue\fR? ?\fIoptionName value\fR?...
.
Query or set the configuration options of the channel named
\fIchannelId\fR.
.RS
.PP
If no \fIoptionName\fR or \fIvalue\fR arguments are supplied, the
command returns a list containing alternating option names and values
for the channel. If \fIoptionName\fR is supplied but no \fIvalue\fR
then the command returns the current value of the given option. If
one or more pairs of \fIoptionName\fR and \fIvalue\fR are supplied,
the command sets each of the named options to the corresponding
\fIvalue\fR; in this case the return value is an empty string.
.PP
The options described below are supported for all channels. In
addition, each channel type may add options that only it supports. See
the manual entry for the command that creates each type of channels
for the options that that specific type of channel supports. For
example, see the manual entry for the \fBsocket\fR command for its
additional options.
.TP
\fB\-blocking\fR \fIboolean\fR
.
The \fB\-blocking\fR option determines whether I/O operations on the
channel can cause the process to block indefinitely. The value of the
option must be a proper boolean value. Channels are normally in
blocking mode; if a channel is placed into nonblocking mode it will
affect the operation of the \fBchan gets\fR, \fBchan read\fR, \fBchan
puts\fR, \fBchan flush\fR, and \fBchan close\fR commands; see the
documentation for those commands for details. For nonblocking mode to
work correctly, the application must be using the Tcl event loop
(e.g. by calling \fBTcl_DoOneEvent\fR or invoking the \fBvwait\fR
command).
.TP
\fB\-buffering\fR \fInewValue\fR
.
If \fInewValue\fR is \fBfull\fR then the I/O system will buffer output
until its internal buffer is full or until the \fBchan flush\fR
command is invoked. If \fInewValue\fR is \fBline\fR, then the I/O
system will automatically flush output for the channel whenever a
newline character is output. If \fInewValue\fR is \fBnone\fR, the I/O
system will flush automatically after every output operation. The
default is for \fB\-buffering\fR to be set to \fBfull\fR except for
channels that connect to terminal-like devices; for these channels the
initial setting is \fBline\fR. Additionally, \fBstdin\fR and
\fBstdout\fR are initially set to \fBline\fR, and \fBstderr\fR is set
to \fBnone\fR.
.TP
\fB\-buffersize\fR \fInewSize\fR
.
\fINewvalue\fR must be an integer; its value is used to set the size
of buffers, in bytes, subsequently allocated for this channel to store
input or output. \fINewvalue\fR must be a number of no more than one
million, allowing buffers of up to one million bytes in size.
.TP
\fB\-encoding\fR \fIname\fR
.
This option is used to specify the encoding of the channel as one of
the named encodings returned by \fBencoding names\fR or the special
value \fBbinary\fR, so that the data can be converted to and from
Unicode for use in Tcl. For instance, in order for Tcl to read
characters from a Japanese file in \fBshiftjis\fR and properly process
and display the contents, the encoding would be set to \fBshiftjis\fR.
Thereafter, when reading from the channel, the bytes in the Japanese
file would be converted to Unicode as they are read. Writing is also
supported \- as Tcl strings are written to the channel they will
automatically be converted to the specified encoding on output.
.RS
.PP
If a file contains pure binary data (for instance, a JPEG image), the
encoding for the channel should be configured to be \fBbinary\fR. Tcl
will then assign no interpretation to the data in the file and simply
read or write raw bytes. The Tcl \fBbinary\fR command can be used to
manipulate this byte-oriented data. It is usually better to set the
\fB\-translation\fR option to \fBbinary\fR when you want to transfer
binary data, as this turns off the other automatic interpretations of
the bytes in the stream as well.
.PP
The default encoding for newly opened channels is the same platform-
and locale-dependent system encoding used for interfacing with the
operating system, as returned by \fBencoding system\fR.
.RE
.TP
\fB\-eofchar\fR \fIchar\fR
.TP
\fB\-eofchar\fR \fB{\fIinChar outChar\fB}\fR
.
This option supports DOS file systems that use Control-z (\ex1a) as an
end of file marker. If \fIchar\fR is not an empty string, then this
character signals end-of-file when it is encountered during input.
For output, the end-of-file character is output when the channel is
closed. If \fIchar\fR is the empty string, then there is no special
end of file character marker. For read-write channels, a two-element
list specifies the end of file marker for input and output,
respectively. As a convenience, when setting the end-of-file
character for a read-write channel you can specify a single value that
will apply to both reading and writing. When querying the end-of-file
character of a read-write channel, a two-element list will always be
returned. The default value for \fB\-eofchar\fR is the empty string
in all cases except for files under Windows. In that case the
\fB\-eofchar\fR is Control-z (\ex1a) for reading and the empty string
for writing.
.TP
\fB\-translation\fR \fImode\fR
.TP
\fB\-translation\fR \fB{\fIinMode outMode\fB}\fR
.
In Tcl scripts the end of a line is always represented using a single
newline character (\en). However, in actual files and devices the end
of a line may be represented differently on different platforms, or
even for different devices on the same platform. For example, under
UNIX newlines are used in files, whereas carriage-return-linefeed
sequences are normally used in network connections. On input (i.e.,
with \fBchan gets\fP and \fBchan read\fP) the Tcl I/O system
automatically translates the external end-of-line representation into
newline characters. Upon output (i.e., with \fBchan puts\fP), the I/O
system translates newlines to the external end-of-line representation.
The default translation mode, \fBauto\fP, handles all the common cases
automatically, but the \fB\-translation\fR option provides explicit
control over the end of line translations.
.RS
.PP
The value associated with \fB\-translation\fR is a single item for
read-only and write-only channels. The value is a two-element list for
read-write channels; the read translation mode is the first element of
the list, and the write translation mode is the second element. As a
convenience, when setting the translation mode for a read-write channel
you can specify a single value that will apply to both reading and
writing. When querying the translation mode of a read-write channel, a
two-element list will always be returned. The following values are
currently supported:
.TP
\fBauto\fR
.
As the input translation mode, \fBauto\fR treats any of newline
(\fBlf\fP), carriage return (\fBcr\fP), or carriage return followed by
a newline (\fBcrlf\fP) as the end of line representation. The end of
line representation can even change from line-to-line, and all cases
are translated to a newline. As the output translation mode,
\fBauto\fR chooses a platform specific representation; for sockets on
all platforms Tcl chooses \fBcrlf\fR, for all Unix flavors, it chooses
\fBlf\fR, and for the various flavors of Windows it chooses
\fBcrlf\fR. The default setting for \fB\-translation\fR is \fBauto\fR
for both input and output.
.TP
\fBbinary\fR
.
No end-of-line translations are performed. This is nearly identical
to \fBlf\fP mode, except that in addition \fBbinary\fP mode also sets
the end-of-file character to the empty string (which disables it) and
sets the encoding to \fBbinary\fR (which disables encoding filtering).
See the description of \fB\-eofchar\fR and \fB\-encoding\fR for more
information.
.TP
\fBcr\fR
.
The end of a line in the underlying file or device is represented by a
single carriage return character. As the input translation mode,
\fBcr\fP mode converts carriage returns to newline characters. As the
output translation mode, \fBcr\fP mode translates newline characters
to carriage returns.
.TP
\fBcrlf\fR
.
The end of a line in the underlying file or device is represented by a
carriage return character followed by a linefeed character. As the
input translation mode, \fBcrlf\fP mode converts
carriage-return-linefeed sequences to newline characters. As the
output translation mode, \fBcrlf\fP mode translates newline characters
to carriage-return-linefeed sequences. This mode is typically used on
Windows platforms and for network connections.
.TP
\fBlf\fR
.
The end of a line in the underlying file or device is represented by a
single newline (linefeed) character. In this mode no translations
occur during either input or output. This mode is typically used on
UNIX platforms.
.RE
.RE
.TP
\fBchan copy \fIinputChan outputChan\fR ?\fB\-size \fIsize\fR? ?\fB\-command \fIcallback\fR?
.
Copy data from the channel \fIinputChan\fR, which must have been
opened for reading, to the channel \fIoutputChan\fR, which must have
been opened for writing. The \fBchan copy\fR command leverages the
buffering in the Tcl I/O system to avoid extra copies and to avoid
buffering too much data in main memory when copying large files to
slow destinations like network sockets.
.RS
.PP
The \fBchan copy\fP command transfers data from \fIinputChan\fR until
end of file or \fIsize\fP bytes have been transferred. If no
\fB\-size\fP argument is given, then the copy goes until end of file.
All the data read from \fIinputChan\fR is copied to \fIoutputChan\fR.
Without the \fB\-command\fP option, \fBchan copy\fP blocks until the
copy is complete and returns the number of bytes written to
\fIoutputChan\fR.
.PP
The \fB\-command\fP argument makes \fBchan copy\fP work in the
background. In this case it returns immediately and the
\fIcallback\fP is invoked later when the copy completes. The
\fIcallback\fP is called with one or two additional arguments that
indicates how many bytes were written to \fIoutputChan\fR. If an
error occurred during the background copy, the second argument is the
error string associated with the error. With a background copy, it is
not necessary to put \fIinputChan\fR or \fIoutputChan\fR into
non-blocking mode; the \fBchan copy\fP command takes care of that
automatically. However, it is necessary to enter the event loop by
using the \fBvwait\fP command or by using Tk.
.PP
You are not allowed to do other I/O operations with \fIinputChan\fR or
\fIoutputChan\fR during a background \fBchan copy\fR. If either
\fIinputChan\fR or \fIoutputChan\fR get closed while the copy is in
progress, the current copy is stopped and the command callback is
\fInot\fP made. If \fIinputChan\fR is closed, then all data already
queued for \fIoutputChan\fR is written out.
.PP
Note that \fIinputChan\fR can become readable during a background
copy. You should turn off any \fBchan event\fP or \fBfileevent\fR
handlers during a background copy so those handlers do not interfere
with the copy. Any I/O attempted by a \fBchan event\fR or
\fBfileevent\fP handler will get a "channel busy" error.
.PP
\fBChan copy\fR translates end-of-line sequences in \fIinputChan\fR
and \fIoutputChan\fR according to the \fB\-translation\fR option for
these channels (see \fBchan configure\fR above). The translations
mean that the number of bytes read from \fIinputChan\fR can be
different than the number of bytes written to \fIoutputChan\fR. Only
the number of bytes written to \fIoutputChan\fR is reported, either as
the return value of a synchronous \fBchan copy\fP or as the argument
to the callback for an asynchronous \fBchan copy\fP.
.PP
\fBChan copy\fR obeys the encodings and character translations
configured for the channels. This means that the incoming characters
are converted internally first UTF-8 and then into the encoding of the
channel \fBchan copy\fR writes to (see \fBchan configure\fR above for
details on the \fB\-encoding\fR and \fB\-translation\fR options). No
conversion is done if both channels are set to encoding \fBbinary\fR
and have matching translations. If only the output channel is set to
encoding \fBbinary\fR the system will write the internal UTF-8
representation of the incoming characters. If only the input channel
is set to encoding \fBbinary\fR the system will assume that the
incoming bytes are valid UTF-8 characters and convert them according
to the output encoding. The behaviour of the system for bytes which
are not valid UTF-8 characters is undefined in this case.
.RE
.TP
\fBchan eof \fIchannelId\fR
.
Test whether the last input operation on the channel called
\fIchannelId\fR failed because the end of the data stream was reached,
returning 1 if end-fo-file was reached, and 0 otherwise.
.TP
\fBchan event \fIchannelId event\fR ?\fIscript\fR?
.
Arrange for the Tcl script \fIscript\fR to be installed as a \fIfile
event handler\fR to be called whenever the channel called
\fIchannelId\fR enters the state described by \fIevent\fR (which must
be either \fBreadable\fR or \fBwritable\fR); only one such handler may
be installed per event per channel at a time. If \fIscript\fR is the
empty string, the current handler is deleted (this also happens if the
channel is closed or the interpreter deleted). If \fIscript\fR is
omitted, the currently installed script is returned (or an empty
string if no such handler is installed). The callback is only
performed if the event loop is being serviced (e.g. via \fBvwait\fR or
\fBupdate\fR).
.RS
.PP
A file event handler is a binding between a channel and a script, such
that the script is evaluated whenever the channel becomes readable or
writable. File event handlers are most commonly used to allow data to
be received from another process on an event-driven basis, so that the
receiver can continue to interact with the user or with other channels
while waiting for the data to arrive. If an application invokes
\fBchan gets\fR or \fBchan read\fR on a blocking channel when there is
no input data available, the process will block; until the input data
arrives, it will not be able to service other events, so it will
appear to the user to ``freeze up''. With \fBchan event\fR, the
process can tell when data is present and only invoke \fBchan gets\fR
or \fBchan read\fR when they won't block.
.PP
A channel is considered to be readable if there is unread data
available on the underlying device. A channel is also considered to
be readable if there is unread data in an input buffer, except in the
special case where the most recent attempt to read from the channel
was a \fBchan gets\fR call that could not find a complete line in the
input buffer. This feature allows a file to be read a line at a time
in nonblocking mode using events. A channel is also considered to be
readable if an end of file or error condition is present on the
underlying file or device. It is important for \fIscript\fR to check
for these conditions and handle them appropriately; for example, if
there is no special check for end of file, an infinite loop may occur
where \fIscript\fR reads no data, returns, and is immediately invoked
again.
.PP
A channel is considered to be writable if at least one byte of data
can be written to the underlying file or device without blocking, or
if an error condition is present on the underlying file or device.
Note that client sockets opened in asynchronous mode become writable
when they become connected or if the connection fails.
.PP
Event-driven I/O works best for channels that have been placed into
nonblocking mode with the \fBchan configure\fR command. In blocking
mode, a \fBchan puts\fR command may block if you give it more data
than the underlying file or device can accept, and a \fBchan gets\fR
or \fBchan read\fR command will block if you attempt to read more data
than is ready; no events will be processed while the commands block.
In nonblocking mode \fBchan puts\fR, \fBchan read\fR, and \fBchan
gets\fR never block.
.PP
The script for a file event is executed at global level (outside the
context of any Tcl procedure) in the interpreter in which the \fBchan
event\fR command was invoked. If an error occurs while executing the
script then the command registered with \fBinterp bgerror\fR is used
to report the error. In addition, the file event handler is deleted
if it ever returns an error; this is done in order to prevent infinite
loops due to buggy handlers.
.RE
.TP
\fBchan flush \fIchannelId\fR
.
Ensures that all pending output for the channel called \fIchannelId\fR
is written.
.RS
.PP
If the channel is in blocking mode the command does not return until
all the buffered output has been flushed to the channel. If the
channel is in nonblocking mode, the command may return before all
buffered output has been flushed; the remainder will be flushed in the
background as fast as the underlying file or device is able to absorb
it.
.RE
.TP
\fBchan gets \fIchannelId\fR ?\fIvarName\fR?
.
Reads the next line from the channel called \fIchannelId\fR. If
\fIvarName\fR is not specified, the result of the command will be the
line that has been read (without a trailing newline character) or an
empty string upon end-of-file or, in non-blocking mode, if the data
available is exhausted. If \fIvarName\fR is specified, the line that
has been read will be written to the variable called \fIvarName\fR and
result will be the number of characters that have been read or -1 if
end-of-file was reached or, in non-blocking mode, if the data
available is exhausted.
.RS
.PP
If an end-of-file occurs while part way through reading a line, the
partial line will be returned (or written into \fIvarName\fR). When
\fIvarName\fR is not specified, the end-of-file case can be
distinguished from an empty line using the \fBchan eof\fR command, and
the partial-line-but-nonblocking case can be distinguished with the
\fBchan blocked\fR command.
.RE
.TP
\fBchan names\fR ?\fIpattern\fR?
.
Produces a list of all channel names. If \fIpattern\fR is specified,
only those channel names that match it (according to the rules of
\fBstring match\fR) will be returned.
.TP
\fBchan puts\fR ?\fB\-nonewline\fR? ?\fIchannelId\fR? \fIstring\fR
.
Writes \fIstring\fR to the channel named \fIchannelId\fR followed by a
newline character. A trailing newline character is written unless the
optional flag \fB\-nonewline\fR is given. If \fIchannelId\fR is
omitted, the string is written to the standard output channel,
\fBstdout\fR.
.RS
.PP
Newline characters in the output are translated by \fBchan puts\fR to
platform-specific end-of-line sequences according to the currently
configured value of the \fB\-translation\fR option for the channel
(for example, on PCs newlines are normally replaced with
carriage-return-linefeed sequences; see \fBchan configure\fR above for
details).
.PP
Tcl buffers output internally, so characters written with \fBchan
puts\fR may not appear immediately on the output file or device; Tcl
will normally delay output until the buffer is full or the channel is
closed. You can force output to appear immediately with the \fBchan
flush\fR command.
.PP
When the output buffer fills up, the \fBchan puts\fR command will
normally block until all the buffered data has been accepted for
output by the operating system. If \fIchannelId\fR is in nonblocking
mode then the \fBchan puts\fR command will not block even if the
operating system cannot accept the data. Instead, Tcl continues to
buffer the data and writes it in the background as fast as the
underlying file or device can accept it. The application must use the
Tcl event loop for nonblocking output to work; otherwise Tcl never
finds out that the file or device is ready for more output data. It
is possible for an arbitrarily large amount of data to be buffered for
a channel in nonblocking mode, which could consume a large amount of
memory. To avoid wasting memory, nonblocking I/O should normally be
used in an event-driven fashion with the \fBchan event\fR command
(don't invoke \fBchan puts\fR unless you have recently been notified
via a file event that the channel is ready for more output data).
.RE
.TP
\fBchan read \fIchannelId\fR ?\fInumChars\fR?
.TP
\fBchan read \fR?\fB\-nonewline\fR? \fIchannelId\fR
.
In the first form, the result will be the next \fInumChars\fR
characters read from the channel named \fIchannelId\fR; if
\fInumChars\fR is omitted, all characters up to the point when the
channel would signal a failure (whether an end-of-file, blocked or
other error condition) are read. In the second form (i.e. when
\fInumChars\fR has been omitted) the flag \fB\-nonewline\fR may be
given to indicate that any trailing newline in the string that has
been read should be trimmed.
.RS
.PP
If \fIchannelId\fR is in nonblocking mode, \fBchan read\fR may not
read as many characters as requested: once all available input has
been read, the command will return the data that is available rather
than blocking for more input. If the channel is configured to use a
multi-byte encoding, then there may actually be some bytes remaining
in the internal buffers that do not form a complete character. These
bytes will not be returned until a complete character is available or
end-of-file is reached. The \fB\-nonewline\fR switch is ignored if
the command returns before reaching the end of the file.
.PP
\fBChan read\fR translates end-of-line sequences in the input into
newline characters according to the \fB\-translation\fR option for the
channel (see \fBchan configure\fR above for a discussion on the ways
in which \fBchan configure\fR will alter input).
.PP
When reading from a serial port, most applications should configure
the serial port channel to be nonblocking, like this:
.CS
\fBchan configure \fIchannelId \fB\-blocking \fI0\fR.
.CE
Then \fBchan read\fR behaves much like described above. Note that
most serial ports are comparatively slow; it is entirely possible to
get a \fBreadable\fR event for each character read from them. Care
must be taken when using \fBchan read\fR on blocking serial ports:
.TP
\fBchan read \fIchannelId numChars\fR
.
In this form \fBchan read\fR blocks until \fInumChars\fR have been
received from the serial port.
.TP
\fBchan read \fIchannelId\fR
.
In this form \fBchan read\fR blocks until the reception of the
end-of-file character, see \fBchan configure -eofchar\fR. If there no
end-of-file character has been configured for the channel, then
\fBchan read\fR will block forever.
.RE
.TP
\fBchan seek \fIchannelId offset\fR ?\fIorigin\fR?
.
Sets the current access position within the underlying data stream for
the channel named \fIchannelId\fR to be \fIoffset\fR bytes relative to
\fIorigin\fR. \fIOffset\fR must be an integer (which may be negative)
and \fIorigin\fR must be one of the following:
.RS
.TP 10
\fBstart\fR
.
The new access position will be \fIoffset\fR bytes from the start
of the underlying file or device.
.TP 10
\fBcurrent\fR
.
The new access position will be \fIoffset\fR bytes from the current
access position; a negative \fIoffset\fR moves the access position
backwards in the underlying file or device.
.TP 10
\fBend\fR
.
The new access position will be \fIoffset\fR bytes from the end of the
file or device. A negative \fIoffset\fR places the access position
before the end of file, and a positive \fIoffset\fR places the access
position after the end of file.
.PP
The \fIorigin\fR argument defaults to \fBstart\fR.
.PP
\fBChan seek\fR flushes all buffered output for the channel before the
command returns, even if the channel is in nonblocking mode. It also
discards any buffered and unread input. This command returns an empty
string. An error occurs if this command is applied to channels whose
underlying file or device does not support seeking.
.PP
Note that \fIoffset\fR values are byte offsets, not character offsets.
Both \fBchan seek\fR and \fBchan tell\fR operate in terms of bytes,
not characters, unlike \fBchan read\fR.
.RE
.TP
\fBchan tell \fIchannelId\fR
.
Returns a number giving the current access position within the
underlying data stream for the channel named \fIchannelId\fR. This
value returned is a byte offset that can be passed to \fBchan seek\fR
in order to set the channel to a particular position. Note that this
value is in terms of bytes, not characters like \fBchan read\fR. The
value returned is -1 for channels that do not support seeking.
.TP
\fBchan truncate \fIchannelId\fR ?\fIlength\fR?
.
Sets the byte length of the underlying data stream for the channel
named \fIchannelId\fR to be \fIlength\fR (or to the current byte
offset within the underlying data stream if \fIlength\fR is
omitted). The channel is flushed before truncation.
.SH "SEE ALSO"
close(n), eof(n), fblocked(n), fconfigure(n), fcopy(n), file(n),
fileevent(n), flush(n), gets(n), open(n), puts(n), read(n), seek(n),
socket(n), tell(n)
.SH KEYWORDS
channel, input, output, events, offset
+6 -2
View File
@@ -819,11 +819,15 @@ an error may result if these years are used.
\fIISO 8601 point-in-time\fR
An ISO 8601 point-in-time specification, such as \fBCCyymmddThhmmss\fR,
where \fBT\fR is the literal T, "\fBCCyymmdd hhmmss\fR", or
\fBCCyymmddThh:mm:ss\fR.
\fBCCyymmddThh:mm:ss\fR. Note that only these three formats are accepted.
The command does \fInot\fR accept the full range of point-in-time
specifications specified in ISO8601. Other formats can be recognized by
giving an explicit \fI-format\fR option to the \fBclock scan\fR command.
.TP
\fIrelative time\fR
A specification relative to the current time. The format is \fBnumber
unit\fR. Acceptable units are \fByear\fR, \fBfortnight\fR, \fBmonth\fR, \fBweek\fR, \fBday\fR,
unit\fR. Acceptable units are \fByear\fR, \fBfortnight\fR,
\fBmonth\fR, \fBweek\fR, \fBday\fR,
\fBhour\fR, \fBminute\fR (or \fBmin\fR), and \fBsecond\fR (or \fBsec\fR). The
unit can be specified as a singular or plural, as in \fB3 weeks\fR.
These modifiers may also be specified:
+1 -7
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: close.n,v 1.8 2004/10/27 09:36:58 dkf Exp $
'\" RCS: @(#) $Id: close.n,v 1.8.2.1 2005/04/10 23:14:42 kennykb Exp $
'\"
.so man.macros
.TH close n 7.5 Tcl "Tcl Built-In Commands"
@@ -21,17 +21,14 @@ close \- Close an open channel
.PP
Closes the channel given by \fIchannelId\fR.
.PP
.VS
\fIChannelId\fR must be an identifier for an open channel such as a
Tcl standard channel (\fBstdin\fR, \fBstdout\fR, or \fBstderr\fR),
the return value from an invocation of \fBopen\fR or \fBsocket\fR, or
the result of a channel creation command provided by a Tcl extension.
.VE
.PP
All buffered output is flushed to the channel's output device,
any buffered input is discarded, the underlying file or device is closed,
and \fIchannelId\fR becomes unavailable for use.
.VS "" br
.PP
If the channel is blocking, the command does not return until all output
is flushed.
@@ -39,11 +36,9 @@ If the channel is nonblocking and there is unflushed output, the
channel remains open and the command
returns immediately; output will be flushed in the background and the
channel will be closed when all the flushing is complete.
.VE
.PP
If \fIchannelId\fR is a blocking channel for a command pipeline then
\fBclose\fR waits for the child processes to complete.
.VS "" br
.PP
If the channel is shared between interpreters, then \fBclose\fR
makes \fIchannelId\fR unavailable in the invoking interpreter but has no
@@ -56,7 +51,6 @@ When the last interpreter in which the channel is registered invokes
Channels are automatically closed when an interpreter is destroyed and
when the process exits. Channels are switched to blocking mode, to ensure
that all output is correctly flushed before the process exits.
.VE
.PP
The command returns an empty string, and may generate an error if
an error occurs while flushing output. If a command in a command
+2 -2
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: error.n,v 1.7 2004/11/20 00:17:31 dgp Exp $
'\" RCS: @(#) $Id: error.n,v 1.7.2.1 2004/12/08 18:24:35 kennykb Exp $
'\"
.so man.macros
.TH error n "" Tcl "Tcl Built-In Commands"
@@ -23,7 +23,7 @@ Returns a \fBTCL_ERROR\fR code, which causes command interpretation to be
unwound. \fIMessage\fR is a string that is returned to the application
to indicate what went wrong.
.PP
The \fB-errorinfo\fB return option of an interpreter is used
The \fB-errorinfo\fR return option of an interpreter is used
to accumulate a stack trace of what was in progress when an
error occurred; as nested commands unwind,
the Tcl interpreter adds information to the \fB-errorinfo\fR
+33 -129
View File
@@ -1,11 +1,12 @@
'\"
'\" Copyright (c) 1993 The Regents of the University of California.
'\" Copyright (c) 1994-2000 Sun Microsystems, Inc.
'\" Copyright (c) 2005 by Kevin B. Kenny <kennykb@acm.org>. All rights reserved
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: expr.n,v 1.18 2004/10/27 09:36:58 dkf Exp $
'\" RCS: @(#) $Id: expr.n,v 1.18.2.2 2005/07/12 20:36:15 kennykb Exp $
'\"
.so man.macros
.TH expr n 8.5 Tcl "Tcl Built-In Commands"
@@ -84,8 +85,8 @@ The command will be executed and its result will be used as
the operand.
.IP [7]
As a mathematical function whose arguments have any of the above
forms for operands, such as \fBsin($x)\fR. See below for a list of defined
functions.
forms for operands, such as \fBsin($x)\fR. See MATH FUNCTIONS below for
a discussion of how mathematical functions are handled.
.LP
Where the above substitutions occur (e.g. inside quoted strings), they
are performed by the expression's instructions.
@@ -211,131 +212,27 @@ the Tcl parser will evaluate both \fB[a]\fR and \fB[b]\fR before
invoking the \fBexpr\fR command.
.SS "MATH FUNCTIONS"
.PP
Tcl supports the following mathematical functions in expressions, all
of which work solely with floating-point numbers unless otherwise noted:
.DS
.ta 3c 6c 9c
\fBabs\fR \fBcosh\fR \fBlog\fR \fBsqrt\fR
\fBacos\fR \fBdouble\fR \fBlog10\fR \fBsrand\fR
\fBasin\fR \fBexp\fR \fBpow\fR \fBtan\fR
\fBatan\fR \fBfloor\fR \fBrand\fR \fBtanh\fR
\fBatan2\fR \fBfmod\fR \fBround\fR \fBwide\fR
\fBceil\fR \fBhypot\fR \fBsin\fR
\fBcos\fR \fBint\fR \fBsinh\fR
.DE
.VS 8.5
When the expression parser encounters a mathematical function
such as \fBsin($x)\fR, it replaces it with a call to an ordinary
Tcl function in the \fBtcl::mathfunc\fR namespace. The processing
of an expression such as:
.CS
\fBexpr {sin($x+$y)}\fR
.CE
is the same in every way as the processing of:
.CS
\fBexpr {[tcl::mathfunc::sin [expr {$x+$y}]]}\fR
.CE
The executor will search for \fBtcl::mathfunc::sin\fR using the usual
rules for resolving functions in namespaces. Either
\fB::tcl::mathfunc::sin\fR or \fB[namespace
current]::tcl::mathfunc::sin\fR will satisfy the request, and others
may as well (depending on the current \fBnamespace path\fR setting).
.PP
.TP
\fBabs(\fIarg\fB)\fR
Returns the absolute value of \fIarg\fR. \fIArg\fR may be either
integer or floating-point, and the result is returned in the same form.
.TP
\fBacos(\fIarg\fB)\fR
Returns the arc cosine of \fIarg\fR, in the range [\fI0\fR,\fIpi\fR]
radians. \fIArg\fR should be in the range [\fI-1\fR,\fI1\fR].
.TP
\fBasin(\fIarg\fB)\fR
Returns the arc sine of \fIarg\fR, in the range [\fI-pi/2\fR,\fIpi/2\fR]
radians. \fIArg\fR should be in the range [\fI-1\fR,\fI1\fR].
.TP
\fBatan(\fIarg\fB)\fR
Returns the arc tangent of \fIarg\fR, in the range [\fI-pi/2\fR,\fIpi/2\fR]
radians.
.TP
\fBatan2(\fIy, x\fB)\fR
Returns the arc tangent of \fIy\fR/\fIx\fR, in the range [\fI-pi\fR,\fIpi\fR]
radians. \fIx\fR and \fIy\fR cannot both be 0. If \fIx\fR is greater
than \fI0\fR, this is equivalent to \fBatan(\fIy/x\fB)\fR.
.TP
\fBceil(\fIarg\fB)\fR
Returns the smallest integral floating-point value (i.e. with a zero
fractional part) not less than \fIarg\fR.
.TP
\fBcos(\fIarg\fB)\fR
Returns the cosine of \fIarg\fR, measured in radians.
.TP
\fBcosh(\fIarg\fB)\fR
Returns the hyperbolic cosine of \fIarg\fR. If the result would cause
an overflow, an error is returned.
.TP
\fBdouble(\fIarg\fB)\fR
If \fIarg\fR is a floating-point value, returns \fIarg\fR, otherwise converts
\fIarg\fR to floating-point and returns the converted value.
.TP
\fBexp(\fIarg\fB)\fR
Returns the exponential of \fIarg\fR, defined as \fIe\fR**\fIarg\fR.
If the result would cause an overflow, an error is returned.
.TP
\fBfloor(\fIarg\fB)\fR
Returns the largest integral floating-point value (i.e. with a zero
fractional part) not greater than \fIarg\fR.
.TP
\fBfmod(\fIx, y\fB)\fR
Returns the floating-point remainder of the division of \fIx\fR by
\fIy\fR. If \fIy\fR is 0, an error is returned.
.TP
\fBhypot(\fIx, y\fB)\fR
Computes the length of the hypotenuse of a right-angled triangle
\fBsqrt(\fIx\fR*\fIx\fR+\fIy\fR*\fIy\fB)\fR.
.TP
\fBint(\fIarg\fB)\fR
If \fIarg\fR is an integer value of the same width as the machine
word, returns \fIarg\fR, otherwise
converts \fIarg\fR to an integer (of the same size as a machine word,
i.e. 32-bits on 32-bit systems, and 64-bits on 64-bit systems) by
truncation and returns the converted value.
.TP
\fBlog(\fIarg\fB)\fR
Returns the natural logarithm of \fIarg\fR. \fIArg\fR must be a
positive value.
.TP
\fBlog10(\fIarg\fB)\fR
Returns the base 10 logarithm of \fIarg\fR. \fIArg\fR must be a
positive value.
.TP
\fBpow(\fIx, y\fB)\fR
Computes the value of \fIx\fR raised to the power \fIy\fR. If \fIx\fR
is negative, \fIy\fR must be an integer value.
.TP
\fBrand()\fR
Returns a pseudo-random floating-point value in the range (\fI0\fR,\fI1\fR).
The generator algorithm is a simple linear congruential generator that
is not cryptographically secure. Each result from \fBrand\fR completely
determines all future results from subsequent calls to \fBrand\fR, so
\fBrand\fR should not be used to generate a sequence of secrets, such as
one-time passwords. The seed of the generator is initialized from the
internal clock of the machine or may be set with the \fBsrand\fR function.
.TP
\fBround(\fIarg\fB)\fR
If \fIarg\fR is an integer value, returns \fIarg\fR, otherwise converts
\fIarg\fR to integer by rounding and returns the converted value.
.TP
\fBsin(\fIarg\fB)\fR
Returns the sine of \fIarg\fR, measured in radians.
.TP
\fBsinh(\fIarg\fB)\fR
Returns the hyperbolic sine of \fIarg\fR. If the result would cause
an overflow, an error is returned.
.TP
\fBsqrt(\fIarg\fB)\fR
Returns the square root of \fIarg\fR. \fIArg\fR must be non-negative.
.TP
\fBsrand(\fIarg\fB)\fR
The \fIarg\fR, which must be an integer, is used to reset the seed for
the random number generator of \fBrand\fR. Returns the first random
number (see \fBrand()\fR) from that seed. Each interpreter has its own seed.
.TP
\fBtan(\fIarg\fB)\fR
Returns the tangent of \fIarg\fR, measured in radians.
.TP
\fBtanh(\fIarg\fB)\fR
Returns the hyperbolic tangent of \fIarg\fR.
.TP
\fBwide(\fIarg\fB)\fR
Converts \fIarg\fR to an integer value at least 64-bits wide (by sign-extension
if \fIarg\fR is a 32-bit number) if it is not one already.
.PP
In addition to these predefined functions, applications may
define additional functions using \fBTcl_CreateMathFunc\fR().
See the \fBmathfunc\fR(n) manual page for the math functions that are
available by default.
.VE 8.5
.SS "TYPES, OVERFLOW, AND PRECISION"
.PP
All internal computations involving integers are done with the C type
@@ -430,7 +327,7 @@ each time the expression is executed.
Define a procedure that computes an "interesting" mathematical
function:
.CS
proc calc {x y} {
proc tcl::mathfunc::calc {x y} {
\fBexpr\fR { ($x**2 - $y**2) / exp($x**2 + $y**2) }
}
.CE
@@ -470,7 +367,14 @@ set randNum [\fBexpr\fR { int(100 * rand()) }]
.CE
.SH "SEE ALSO"
array(n), for(n), if(n), string(n), Tcl(n), while(n)
array(n), for(n), if(n), mathfunc(n), namespace(n), proc(n), string(n), Tcl(n), while(n)
.SH KEYWORDS
arithmetic, boolean, compare, expression, fuzzy comparison
.SH COPYRIGHT
Copyright (c) 1993 The Regents of the University of California.
.br
Copyright (c) 1994-2000 Sun Microsystems Incorporated.
.br
Copyright (c) 2005 by Kevin B. Kenny <kennykb@acm.org>. All rights reserved.
+1 -3
View File
@@ -4,7 +4,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: fblocked.n,v 1.6 2004/10/27 12:53:22 dkf Exp $
'\" RCS: @(#) $Id: fblocked.n,v 1.6.2.1 2005/04/10 23:14:43 kennykb Exp $
.so man.macros
.TH fblocked n 7.5 Tcl "Tcl Built-In Commands"
.BS
@@ -25,12 +25,10 @@ characters available for input and no end-of-line sequence, \fBgets\fR
returns an empty string and a subsequent call to \fBfblocked\fR will
return 1.
.PP
.VS
\fIChannelId\fR must be an identifier for an open channel such as a
Tcl standard channel (\fBstdin\fR, \fBstdout\fR, or \fBstderr\fR),
the return value from an invocation of \fBopen\fR or \fBsocket\fR, or
the result of a channel creation command provided by a Tcl extension.
.VE
.SH EXAMPLE
The \fBfblocked\fR command is particularly useful when writing network
servers, as it allows you to write your code in a line-by-line style
+6 -3
View File
@@ -4,7 +4,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: fconfigure.n,v 1.11 2004/10/27 12:53:22 dkf Exp $
'\" RCS: @(#) $Id: fconfigure.n,v 1.11.2.1 2005/04/25 21:37:18 kennykb Exp $
'\"
.so man.macros
.TH fconfigure n 8.3 Tcl "Tcl Built-In Commands"
@@ -91,11 +91,14 @@ If a file contains pure binary data (for instance, a JPEG image), the
encoding for the channel should be configured to be \fBbinary\fR. Tcl
will then assign no interpretation to the data in the file and simply read or
write raw bytes. The Tcl \fBbinary\fR command can be used to manipulate this
byte-oriented data.
byte-oriented data. It is usually better to set the
\fB\-translation\fR option to \fBbinary\fR when you want to transfer
binary data, as this turns off the other automatic interpretations of
the bytes in the stream as well.
.PP
The default encoding for newly opened channels is the same platform- and
locale-dependent system encoding used for interfacing with the operating
system.
system, as returned by \fBencoding system\fR.
.RE
.TP
\fB\-eofchar\fR \fIchar\fR
+24 -13
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: fcopy.n,v 1.4 2004/09/06 09:44:56 dkf Exp $
'\" RCS: @(#) $Id: fcopy.n,v 1.4.2.1 2005/04/25 21:37:19 kennykb Exp $
'\"
.so man.macros
.TH fcopy n 8.0 Tcl "Tcl Built-In Commands"
@@ -72,12 +72,15 @@ Only the number of bytes written to \fIoutchan\fR is reported,
either as the return value of a synchronous \fBfcopy\fP or
as the argument to the callback for an asynchronous \fBfcopy\fP.
.PP
\fBFcopy\fR obeys the encodings configured for the channels. This
\fBFcopy\fR obeys the encodings and character translations configured
for the channels. This
means that the incoming characters are converted internally first
UTF-8 and then into the encoding of the channel \fBfcopy\fR writes
to. See the manual entry for \fBfconfigure\fR for details on the
\fB\-encoding\fR option. No conversion is done if both channels are
set to encoding "binary". If only the output channel is set to
\fB\-encoding\fR and \fB\-translation\fR options. No conversion is
done if both channels are
set to encoding "binary" and have matching translations. If only the
output channel is set to
encoding "binary" the system will write the internal UTF-8
representation of the incoming characters. If only the input channel
is set to encoding "binary" the system will assume that the incoming
@@ -85,9 +88,19 @@ bytes are valid UTF-8 characters and convert them according to the
output encoding. The behaviour of the system for bytes which are not
valid UTF-8 characters is undefined in this case.
.SH EXAMPLE
.SH EXAMPLES
.PP
This first example shows how the callback gets
The first example transfers the contents of one channel exactly to
another. Note that when copying one file to another, it is better to
use \fBfile copy\fR which also copies file metadata (e.g. the file
access permissions) where possible.
.DS
fconfigure $in -translation binary
fconfigure $out -translation binary
\fBfcopy\fR $in $out
.DE
.PP
This second example shows how the callback gets
passed the number of bytes transferred.
It also uses vwait to put the application into the event loop.
Of course, this simplified example could be done without the command
@@ -104,12 +117,11 @@ proc Cleanup {in out bytes {error {}}} {
}
set in [open $file1]
set out [socket $server $port]
fcopy $in $out -command [list Cleanup $in $out]
\fBfcopy\fR $in $out -command [list Cleanup $in $out]
vwait total
.DE
.PP
The second example copies in chunks and tests for end of file
The third example copies in chunks and tests for end of file
in the command callback
.DS
proc CopyMore {in out chunk bytes {error {}}} {
@@ -120,7 +132,7 @@ proc CopyMore {in out chunk bytes {error {}}} {
close $in
close $out
} else {
fcopy $in $out -command [list CopyMore $in $out $chunk] \\
\fBfcopy\fR $in $out -command [list CopyMore $in $out $chunk] \\
-size $chunk
}
}
@@ -128,13 +140,12 @@ set in [open $file1]
set out [socket $server $port]
set chunk 1024
set total 0
fcopy $in $out -command [list CopyMore $in $out $chunk] -size $chunk
\fBfcopy\fR $in $out -command [list CopyMore $in $out $chunk] -size $chunk
vwait done
.DE
.SH "SEE ALSO"
eof(n), fblocked(n), fconfigure(n)
eof(n), fblocked(n), fconfigure(n), file(n)
.SH KEYWORDS
blocking, channel, end of line, end of file, nonblocking, read, translation
+1 -3
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: file.n,v 1.38 2004/10/27 14:24:37 dkf Exp $
'\" RCS: @(#) $Id: file.n,v 1.38.2.1 2005/04/10 23:14:43 kennykb Exp $
'\"
.so man.macros
.TH file n 8.3 Tcl "Tcl Built-In Commands"
@@ -81,7 +81,6 @@ the length of the resource fork of the file, this attribute can only be
set to the value 0, which results in the resource fork being stripped
off the file.
.RE
.VS
.TP
\fBfile channels ?\fIpattern\fR?
.
@@ -89,7 +88,6 @@ If \fIpattern\fR isn't specified, returns a list of names of all
registered open channels in this interpreter. If \fIpattern\fR is
specified, only those names matching \fIpattern\fR are returned. Matching
is determined using the same rules as for \fBstring match\fR.
.VE
.TP
\fBfile copy \fR?\fB\-force\fR? ?\fB\-\|\-\fR? \fIsource\fR \fItarget\fR
.TP
+1 -3
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: fileevent.n,v 1.7 2004/11/20 00:17:32 dgp Exp $
'\" RCS: @(#) $Id: fileevent.n,v 1.7.2.1 2005/04/10 23:14:43 kennykb Exp $
'\"
.so man.macros
.TH fileevent n 7.5 Tcl "Tcl Built-In Commands"
@@ -34,13 +34,11 @@ appear to the user to ``freeze up''. With \fBfileevent\fR, the process can
tell when data is present and only invoke \fBgets\fR or \fBread\fR when
they won't block.
.PP
.VS
The \fIchannelId\fR argument to \fBfileevent\fR refers to an open
channel such as a Tcl standard channel (\fBstdin\fR, \fBstdout\fR,
or \fBstderr\fR), the return value from an invocation of \fBopen\fR
or \fBsocket\fR, or the result of a channel creation command provided
by a Tcl extension.
.VE
.PP
If the \fIscript\fR argument is specified, then \fBfileevent\fR
creates a new event handler: \fIscript\fR will be evaluated
+1 -3
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: flush.n,v 1.6 2004/10/27 12:53:22 dkf Exp $
'\" RCS: @(#) $Id: flush.n,v 1.6.2.1 2005/04/10 23:14:43 kennykb Exp $
'\"
.so man.macros
.TH flush n 7.5 Tcl "Tcl Built-In Commands"
@@ -21,13 +21,11 @@ flush \- Flush buffered output for a channel
.PP
Flushes any output that has been buffered for \fIchannelId\fR.
.PP
.VS
\fIChannelId\fR must be an identifier for an open channel such as a
Tcl standard channel (\fBstdout\fR or \fBstderr\fR), the return
value from an invocation of \fBopen\fR or \fBsocket\fR, or the result
of a channel creation command provided by a Tcl extension. The
channel must have been opened for writing.
.VE
.PP
If the channel is in blocking mode the command does not return until all the
buffered output has been flushed to the channel. If the channel is in
+2 -2
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: foreach.n,v 1.5 2004/11/26 10:02:23 dkf Exp $
'\" RCS: @(#) $Id: foreach.n,v 1.5.2.1 2004/12/08 18:24:35 kennykb Exp $
'\"
.so man.macros
.TH foreach n "" Tcl "Tcl Built-In Commands"
@@ -55,7 +55,7 @@ This loop prints every value in a list together with the square and
cube of the value:
.CS
'\" Maintainers: notice the tab hacking below!
.ta 32
.ta 3i
set values {1 3 5 7 2 4 6 8} ;# Odd numbers first, for fun!
puts "Value\\tSquare\\tCube" ;# Neat-looking header
\fBforeach\fR x $values { ;# Now loop and print...
+1 -7
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: format.n,v 1.10 2004/10/27 12:53:22 dkf Exp $
'\" RCS: @(#) $Id: format.n,v 1.10.2.1 2005/04/10 23:14:43 kennykb Exp $
'\"
.so man.macros
.TH format n 8.1 Tcl "Tcl Built-In Commands"
@@ -130,12 +130,10 @@ which must be \fBh\fR or \fBl\fR.
If it is \fBh\fR it specifies that the numeric value should be
truncated to a 16-bit value before converting.
This option is rarely useful.
.VS 8.4
If it is \fBl\fR it specifies that the numeric value should be (at
least) a 64-bit value. If neither \fBh\fR nor \fBl\fR are present,
numeric values are interpreted as being values of the width of the
native machine word, as described by \fBtcl_platform(wordSize)\fR.
.VE
.PP
The last thing in a conversion specifier is an alphabetic character
that determines what kind of conversion to perform.
@@ -158,11 +156,9 @@ Convert integer to unsigned octal string.
\fBx\fR or \fBX\fR
Convert integer to unsigned hexadecimal string, using digits
``0123456789abcdef'' for \fBx\fR and ``0123456789ABCDEF'' for \fBX\fR).
.VS
.TP 10
\fBc\fR
Convert integer to the Unicode character it represents.
.VE
.TP 10
\fBs\fR
No conversion; just insert string.
@@ -207,12 +203,10 @@ For \fB%c\fR conversions the argument must be a decimal string,
which will then be converted to the corresponding character value.
.IP [3]
The \fBl\fR modifier
.VS 8.4
is ignored for real values and on 64-bit platforms, which are always
converted as if the \fBl\fR modifier were present (i.e. the types
\fBdouble\fR and \fBlong\fR are used for the internal representation
of real and integer values, respectively).
.VE 8.4
If the \fBh\fR modifier is specified then integer values are truncated
to \fBshort\fR before conversion. Both \fBh\fR and \fBl\fR modifiers
are ignored on all other conversions.
+1 -3
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: gets.n,v 1.6 2004/10/27 12:53:22 dkf Exp $
'\" RCS: @(#) $Id: gets.n,v 1.6.2.1 2005/04/10 23:14:43 kennykb Exp $
'\"
.so man.macros
.TH gets n 7.5 Tcl "Tcl Built-In Commands"
@@ -23,13 +23,11 @@ This command reads the next line from \fIchannelId\fR, returns everything
in the line up to (but not including) the end-of-line character(s), and
discards the end-of-line character(s).
.PP
.VS
\fIChannelId\fR must be an identifier for an open channel such as the
Tcl standard input channel (\fBstdin\fR), the return value from an
invocation of \fBopen\fR or \fBsocket\fR, or the result of a channel
creation command provided by a Tcl extension. The channel must have
been opened for input.
.VE
.PP
If \fIvarName\fR is omitted the line is returned as the result of the
command.
+4 -7
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: glob.n,v 1.17 2004/10/27 12:53:22 dkf Exp $
'\" RCS: @(#) $Id: glob.n,v 1.17.2.1 2005/07/12 20:36:15 kennykb Exp $
'\"
.so man.macros
.TH glob n 8.3 Tcl "Tcl Built-In Commands"
@@ -21,7 +21,9 @@ glob \- Return names of files that match patterns
.PP
This command performs file name ``globbing'' in a fashion similar to
the csh shell. It returns a list of the files whose names match any
of the \fIpattern\fR arguments.
of the \fIpattern\fR arguments. No particular order is guaranteed
in the list, so if a sorted list is required the caller should use
\fBlsort\fR.
.LP
If the initial arguments to \fBglob\fR start with \fB\-\fR then
they are treated as switches. The following switches are
@@ -157,11 +159,6 @@ be used with \fBfile join\fR, to avoid them being interpreted as
absolute paths pointing to a given user's home directory.
.SH "PORTABILITY ISSUES"
.PP
Unlike other Tcl commands that will accept both network and native
style names (see the \fBfilename\fR manual entry for details on how
native and network names are specified), the \fBglob\fR command only
accepts native names.
.TP
\fBWindows\fR
.
For Windows UNC names, the servername and sharename components of the path
+10 -7
View File
@@ -7,7 +7,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: info.n,v 1.14 2004/10/27 14:24:37 dkf Exp $
'\" RCS: @(#) $Id: info.n,v 1.14.2.2 2005/07/12 20:36:15 kennykb Exp $
'\"
.so man.macros
.TH info n 8.4 Tcl "Tcl Built-In Commands"
@@ -40,7 +40,10 @@ in this interpreter.
.TP
\fBinfo commands \fR?\fIpattern\fR?
If \fIpattern\fR isn't specified,
returns a list of names of all the Tcl commands in the current namespace,
'\" Do not move this .VS above the .TP
.VS 8.5
returns a list of names of all the Tcl commands visible
(i.e. executable without using a qualified name) to the current namespace,
including both the built-in commands written in C and
the command procedures defined using the \fBproc\fR command.
If \fIpattern\fR is specified,
@@ -53,7 +56,11 @@ and may have pattern matching special characters
at the end to specify a set of commands in that namespace.
If \fIpattern\fR is a qualified name,
the resulting list of command names has each one qualified with the name
of the specified namespace.
of the specified namespace, and only the commands defined in the named
namespace are returned.
'\" Technically, most of this hasn't changed; that's mostly just the
'\" way it always worked. Hardly anyone knew that though.
.VE 8.5
.TP
\fBinfo complete \fIcommand\fR
Returns 1 if \fIcommand\fR is a complete Tcl command in the sense of
@@ -75,7 +82,6 @@ into variable \fIvarname\fR.
Returns \fB1\fR if the variable named \fIvarName\fR exists in the
current context (either as a global or local variable) and has been
defined by being given a value, returns \fB0\fR otherwise.
.VS 8.4
.TP
\fBinfo functions \fR?\fIpattern\fR?
If \fIpattern\fR isn't specified, returns a list of all the math
@@ -83,7 +89,6 @@ functions currently defined.
If \fIpattern\fR is specified, only those functions whose name matches
\fIpattern\fR are returned. Matching is determined using the same
rules as for \fBstring match\fR.
.VE
.TP
\fBinfo globals \fR?\fIpattern\fR?
If \fIpattern\fR isn't specified, returns a list of all the names
@@ -96,13 +101,11 @@ are returned. Matching is determined using the same rules as for
\fBinfo hostname\fR
Returns the name of the computer on which this invocation is being
executed.
.VS
Note that this name is not guaranteed to be the fully qualified domain
name of the host. Where machines have several different names (as is
common on systems with both TCP/IP (DNS) and NetBIOS-based networking
installed,) it is the name that is suitable for TCP/IP networking that
is returned.
.VE
.TP
\fBinfo level\fR ?\fInumber\fR?
If \fInumber\fR is not specified, this command returns a number
+2 -2
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: interp.n,v 1.22 2004/11/21 23:17:50 dgp Exp $
'\" RCS: @(#) $Id: interp.n,v 1.22.2.1 2005/04/10 23:14:43 kennykb Exp $
'\"
.so man.macros
.TH interp n 7.6 Tcl "Tcl Built-In Commands"
@@ -38,7 +38,7 @@ through environment variables (the \fBenv\fR variable), which are
normally shared among all interpreters in the application,
.VS 8.5
and by resource limit exceeded callbacks.
.VE
.VE 8.5
Note that the
name space for files (such as the names returned by the \fBopen\fR command)
is no longer shared between interpreters. Explicit commands are provided to
+2 -5
View File
@@ -6,7 +6,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: lappend.n,v 1.9 2004/10/27 12:53:22 dkf Exp $
'\" RCS: @(#) $Id: lappend.n,v 1.9.2.1 2005/04/10 23:14:43 kennykb Exp $
'\"
.so man.macros
.TH lappend n "" Tcl "Tcl Built-In Commands"
@@ -43,10 +43,7 @@ Using \fBlappend\fR to build up a list of numbers.
.CE
.SH "SEE ALSO"
list(n), lindex(n), linsert(n), llength(n),
.VS 8.4
lset(n)
.VE
list(n), lindex(n), linsert(n), llength(n), lset(n),
lsort(n), lrange(n)
.SH KEYWORDS
+9 -12
View File
@@ -6,7 +6,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: lindex.n,v 1.8 2004/10/27 12:53:22 dkf Exp $
'\" RCS: @(#) $Id: lindex.n,v 1.8.2.2 2005/05/05 17:55:24 kennykb Exp $
'\"
.so man.macros
.TH lindex n 8.4 Tcl "Tcl Built-In Commands"
@@ -19,7 +19,6 @@ lindex \- Retrieve an element from a list
.BE
.SH DESCRIPTION
.PP
.VS 8.4
The \fBlindex\fP command accepts a parameter, \fIlist\fP, which
it treats as a Tcl list. It also accepts zero or more \fIindices\fP into
the list. The indices may be presented either consecutively on the
@@ -39,7 +38,6 @@ In this case, the return value of \fBlindex\fR is simply the value of the
.PP
When presented with a single index, the \fBlindex\fR command
treats \fIlist\fR as a Tcl list and returns the
.VE
\fIindex\fR'th element from it (0 refers to the first element of the list).
In extracting the element, \fBlindex\fR observes the same rules
concerning braces and quotes and backslashes as the Tcl command
@@ -48,11 +46,12 @@ substitution and command substitution do not occur.
If \fIindex\fR is negative or greater than or equal to the number
of elements in \fIvalue\fR, then an empty
string is returned.
If \fIindex\fR has the value \fBend\fR, it refers to the last element
in the list, and \fBend\-\fIinteger\fR refers to the last element in
the list minus the specified integer offset.
.VS 8.5
The interpretation of each simple \fIindex\fR value is the same as
for the command \fBstring index\fR, supporting simple index
arithmetic and indices relative to the end of the list.
.VE 8.5
.PP
.VS 8.4
If additional \fIindex\fR arguments are supplied, then each argument is
used in turn to select an element from the previous indexing operation,
allowing the script to select elements from sublists. The command,
@@ -80,14 +79,12 @@ lindex [lindex [lindex $a 1] 2] 3
\fBlindex\fR {{{a b} {c d}} {{e f} {g h}}} 1 1 0 \fI=> g\fR
\fBlindex\fR {{{a b} {c d}} {{e f} {g h}}} {1 1 0} \fI=> g\fR
.CE
.VE
.SH "SEE ALSO"
list(n), lappend(n), linsert(n), llength(n), lsearch(n),
.VS 8.4
lset(n),
lset(n), lsort(n), lrange(n), lreplace(n),
.VS 8.5
string(n)
.VE
lsort(n),
lrange(n), lreplace(n)
.SH KEYWORDS
element, index, list
+10 -8
View File
@@ -6,7 +6,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: linsert.n,v 1.10 2004/10/27 12:53:22 dkf Exp $
'\" RCS: @(#) $Id: linsert.n,v 1.10.2.2 2005/05/05 17:55:24 kennykb Exp $
'\"
.so man.macros
.TH linsert n 8.2 Tcl "Tcl Built-In Commands"
@@ -24,11 +24,12 @@ This command produces a new list from \fIlist\fR by inserting all of the
\fIelement\fR arguments just before the \fIindex\fR'th element of
\fIlist\fR. Each \fIelement\fR argument will become a separate element of
the new list. If \fIindex\fR is less than or equal to zero, then the new
elements are inserted at the beginning of the list. If \fIindex\fR has the
value \fBend\fR, or if it is greater than or equal to the number of
elements in the list, then the new elements are appended to the list.
\fBend\-\fIinteger\fR refers to the last element in the list minus the
specified integer offset.
elements are inserted at the beginning of the list.
.VS 8.5
The interpretation of the \fIindex\fR value is the same as
for the command \fBstring index\fR, supporting simple index
arithmetic and indices relative to the end of the list.
.VE
.SH EXAMPLE
Putting some values into a list, first indexing from the start and
then indexing from the end, and then chaining them together:
@@ -41,9 +42,10 @@ set newerList [\fBlinsert\fR [\fBlinsert\fR $oldList end-1 quick] 1 lazy]
.CE
.SH "SEE ALSO"
.VS 8.4
list(n), lappend(n), lindex(n), llength(n), lsearch(n),
lset(n), lsort(n), lrange(n), lreplace(n)
lset(n), lsort(n), lrange(n), lreplace(n),
.VS 8.5
string(n)
.VE
.SH KEYWORDS
+1 -3
View File
@@ -6,7 +6,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: llength.n,v 1.8 2004/10/27 12:53:22 dkf Exp $
'\" RCS: @(#) $Id: llength.n,v 1.8.2.1 2005/04/10 23:14:43 kennykb Exp $
'\"
.so man.macros
.TH llength n "" Tcl "Tcl Built-In Commands"
@@ -50,10 +50,8 @@ An empty list is not necessarily an empty string:
.CE
.SH "SEE ALSO"
.VS 8.4
list(n), lappend(n), lindex(n), linsert(n), lsearch(n),
lset(n), lsort(n), lrange(n), lreplace(n)
.VE
.SH KEYWORDS
element, list, length
+3 -7
View File
@@ -4,7 +4,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: load.n,v 1.12 2004/10/27 12:53:22 dkf Exp $
'\" RCS: @(#) $Id: load.n,v 1.12.2.2 2005/05/21 15:10:25 kennykb Exp $
'\"
.so man.macros
.TH load n 7.5 Tcl "Tcl Built-In Commands"
@@ -92,13 +92,10 @@ This may be done differently on different platforms.
The default guess, which is used on most UNIX platforms, is to
take the last element of \fIfileName\fR, strip off the first
three characters if they are \fBlib\fR, and use any following
.VS
alphabetic and underline characters as the module name.
.VE
For example, the command \fBload libxyz4.2.so\fR uses the module
name \fBxyz\fR and the command \fBload bin/last.so {}\fR uses the
module name \fBlast\fR.
.VS "" br
.PP
If \fIfileName\fR is an empty string, then \fIpackageName\fR must
be specified.
@@ -109,7 +106,6 @@ Otherwise, the \fBload\fR command searches for a dynamically loaded
package by that name, and uses it if it is found. If several
different files have been \fBload\fRed with different versions of
the package, Tcl picks the file that was loaded first.
.VE
.SH "PORTABILITY ISSUES"
.TP
\fBWindows\fR\0\0\0\0\0
@@ -137,7 +133,7 @@ The following is a minimal extension:
#include <tcl.h>
#include <stdio.h>
static int fooCmd(ClientData clientData,
Tcl_Interp *interp, int objc, char * CONST objv[]) {
Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) {
printf("called with %d arguments\\n", objc);
return TCL_OK;
}
@@ -159,7 +155,7 @@ it can then be loaded into Tcl with the following:
# Load the extension
switch $tcl_platform(platform) {
windows {
\fBload\fR ./foo.dll
\fBload\fR [file join [pwd] foo.dll]
}
unix {
\fBload\fR ./libfoo[info sharedlibextension]
+10 -6
View File
@@ -6,7 +6,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: lrange.n,v 1.9 2004/10/27 12:53:22 dkf Exp $
'\" RCS: @(#) $Id: lrange.n,v 1.9.2.2 2005/05/05 17:55:25 kennykb Exp $
'\"
.so man.macros
.TH lrange n 7.4 Tcl "Tcl Built-In Commands"
@@ -23,9 +23,12 @@ lrange \- Return one or more adjacent elements from a list
\fIList\fR must be a valid Tcl list. This command will
return a new list consisting of elements
\fIfirst\fR through \fIlast\fR, inclusive.
\fIFirst\fR or \fIlast\fR
may be \fBend\fR (or any abbreviation of it) to refer to the last
element of the list.
.VS 8.5
The index values \fIfirst\fR and \fIlast\fR are interpreted
the same as index values for the command \fBstring index\fR,
supporting simple index arithmetic and indices relative to the
end of the list.
.VE
If \fIfirst\fR is less than zero, it is treated as if it were zero.
If \fIlast\fR is greater than or equal to the number of elements
in the list, then it is treated as if it were \fBend\fR.
@@ -66,9 +69,10 @@ elements to
.CE
.SH "SEE ALSO"
.VS 8.4
list(n), lappend(n), lindex(n), linsert(n), llength(n), lsearch(n),
lset(n), lreplace(n), lsort(n)
lset(n), lreplace(n), lsort(n),
.VS 8.5
string(n)
.VE
.SH KEYWORDS
+16 -8
View File
@@ -6,7 +6,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: lreplace.n,v 1.10 2004/10/27 12:53:22 dkf Exp $
'\" RCS: @(#) $Id: lreplace.n,v 1.10.2.2 2005/05/05 17:55:25 kennykb Exp $
'\"
.so man.macros
.TH lreplace n 7.4 Tcl "Tcl Built-In Commands"
@@ -22,11 +22,17 @@ lreplace \- Replace elements in a list with new elements
.PP
\fBlreplace\fR returns a new list formed by replacing one or more elements of
\fIlist\fR with the \fIelement\fR arguments.
\fIfirst\fR and \fIlast\fR specify the first and last index of the
range of elements to replace. 0 refers to the first element of the
list, and \fBend\fR (or any abbreviation of it) may be used to refer
to the last element of the list. If \fIlist\fR is empty, then
\fIfirst\fR and \fIlast\fR are ignored.
.VS 8.5
\fIfirst\fR and \fIlast\fR are index values specifying the first and
last elements of the range to replace.
The index values \fIfirst\fR and \fIlast\fR are interpreted
the same as index values for the command \fBstring index\fR,
supporting simple index arithmetic and indices relative to the
end of the list.
0 refers to the first element of the
list, and \fBend\fR refers to the last element of the list.
If \fIlist\fR is empty, then \fIfirst\fR and \fIlast\fR are ignored.
.VE
If \fIfirst\fR is less than zero, it is considered to refer to the
first element of the list. For non-empty lists, the element indicated
@@ -65,10 +71,12 @@ a b c d
.CE
.SH "SEE ALSO"
.VS 8.4
list(n), lappend(n), lindex(n), linsert(n), llength(n), lsearch(n),
lset(n), lrange(n), lsort(n)
lset(n), lrange(n), lsort(n),
.VS 8.5
string(n)
.VE
.SH KEYWORDS
element, list, replace
+25 -8
View File
@@ -1,4 +1,3 @@
'\" -*- nroff -*-
'\"
'\" Copyright (c) 1993 The Regents of the University of California.
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
@@ -8,7 +7,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: lsearch.n,v 1.21 2004/09/02 13:55:55 dkf Exp $
'\" RCS: @(#) $Id: lsearch.n,v 1.21.2.3 2005/07/12 20:36:15 kennykb Exp $
'\"
.so man.macros
.TH lsearch n 8.5 Tcl "Tcl Built-In Commands"
@@ -35,7 +34,8 @@ is \fB\-glob\fR. If more than one matching style is specified, the
last matching style given takes precedence.
.TP
\fB\-exact\fR
The list element must contain exactly the same string as \fIpattern\fR.
\fIPattern\fR is a literal string that is compared for exact equality
against each list element.
.TP
\fB\-glob\fR
\fIPattern\fR is a glob-style pattern which is matched against each list
@@ -71,10 +71,12 @@ This negates the sense of the match, returning the index of the first
non-matching value in the list.
.TP
\fB\-start\fR\0\fIindex\fR
The list is searched starting at position \fIindex\fR. If \fIindex\fR
has the value \fBend\fR, it refers to the last element in the list,
and \fBend\-\fIinteger\fR refers to the last element in the list minus
the specified integer offset.
The list is searched starting at position \fIindex\fR.
.VS 8.5
The interpretation of the \fIindex\fR value is the same as
for the command \fBstring index\fR, supporting simple index
arithmetic and indices relative to the end of the list.
.VE 8.5
.SS "CONTENTS DESCRIPTION OPTIONS"
These options describe how to interpret the items in the list being
searched. They are only meaningful when used with the \fB\-exact\fR
@@ -94,6 +96,13 @@ dictionary-equal when exactly equal.
.TP
\fB\-integer\fR
The list elements are to be compared as integers.
.VS 8.5
.TP
\fB\-nocase\fR
Causes comparisons to be handled in a case-insensitive manner. Has no
effect if combined with the \fB\-dictionary\fR, \fB\-integer\fR, or
\fB\-real\fR options.
.VE 8.5
.TP
\fB\-real\fR
The list elements are to be compared as floating-point values.
@@ -167,7 +176,15 @@ It is also possible to search inside elements:
.SH "SEE ALSO"
foreach(n), list(n), lappend(n), lindex(n), linsert(n), llength(n),
lset(n), lsort(n), lrange(n), lreplace(n)
lset(n), lsort(n), lrange(n), lreplace(n),
.VS 8.5
string(n)
.VE
.SH KEYWORDS
list, match, pattern, regular expression, search, string
'\" Local Variables:
'\" mode: nroff
'\" End:
+11 -5
View File
@@ -4,7 +4,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: lset.n,v 1.7 2003/12/01 21:27:14 msofer Exp $
'\" RCS: @(#) $Id: lset.n,v 1.7.2.1 2005/05/05 17:55:26 kennykb Exp $
'\"
.so man.macros
.TH lset n 8.4 Tcl "Tcl Built-In Commands"
@@ -52,9 +52,11 @@ command.
If \fIindex\fR is negative or greater than or equal to the number
of elements in \fI$varName\fR, then an error occurs.
.PP
If \fIindex\fR has the value \fBend\fR, it refers to the last element
in the list, and \fBend\-\fIinteger\fR refers to the last element in
the list minus the specified integer offset.
.VS 8.5
The interpretation of each simple \fIindex\fR value is the same as
for the command \fBstring index\fR, supporting simple index
arithmetic and indices relative to the end of the list.
.VE 8.5
.PP
If additional \fIindex\fR arguments are supplied, then each argument is
used in turn to address an element within a sublist designated
@@ -107,7 +109,11 @@ lset x {1 1 0} j => {{a b} {c d}} {{e f} {j h}}
.CE
.SH "SEE ALSO"
list(n), lappend(n), lindex(n), linsert(n), llength(n), lsearch(n),
lsort(n), lrange(n), lreplace(n)
lsort(n), lrange(n), lreplace(n),
.VS 8.5
string(n)
.VE
.SH KEYWORDS
element, index, list, replace, set
+10 -6
View File
@@ -7,10 +7,10 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: lsort.n,v 1.18 2004/10/27 12:53:22 dkf Exp $
'\" RCS: @(#) $Id: lsort.n,v 1.18.2.2 2005/07/12 20:36:16 kennykb Exp $
'\"
.so man.macros
.TH lsort n 8.3 Tcl "Tcl Built-In Commands"
.TH lsort n 8.5 Tcl "Tcl Built-In Commands"
.BS
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
@@ -78,10 +78,7 @@ sublists, \fBlsort\fR will extract the \fIindexList\fR'th element from
each sublist
.VS 8.5
(as if the overall element and the \fIindexList\fR were passed to
\fBlindex\fR) and sort based on the given element. The keyword
\fBend\fP is allowed for each element of the \fIindexList\fR to sort
on the last sublist element, and \fBend-\fIindex\fR sorts on a sublist
element offset from the end.
\fBlindex\fR) and sort based on the given element.
.VE 8.5
For example,
.RS
@@ -107,6 +104,13 @@ returns \fB{{d e m o} 34512} {{b i g} 12345} {{c o d e} 54321}\fR
This option is much more efficient than using \fB\-command\fR
to achieve the same effect.
.RE
.VS 8.5
.TP 20
\fB\-nocase\fR
Causes comparisons to be handled in a case-insensitive manner. Has no
effect if combined with the \fB\-dictionary\fR, \fB\-integer\fR, or
\fB\-real\fR options.
.VE 8.5
.TP 20
\fB\-unique\fR
If this option is specified, then only the last set of duplicate
+241
View File
@@ -0,0 +1,241 @@
'\"
'\" Copyright (c) 1993 The Regents of the University of California.
'\" Copyright (c) 1994-2000 Sun Microsystems, Inc.
'\" Copyright (c) 2005 by Kevin B. Kenny <kennykb@acm.org>. All rights reserved
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: mathfunc.n,v 1.1.2.4 2005/10/08 13:44:37 dgp Exp $
'\"
.so man.macros
.TH mathfunc n 8.5 Tcl "Tcl Mathematical Functions"
.BS
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
mathfunc \- Mathematical functions for Tcl expressions
.SH SYNOPSIS
package require \fBTcl 8.5\fR
.sp
\fB::tcl::mathfunc::abs\fR \fIarg\fR
.br
\fB::tcl::mathfunc::acos\fR \fIarg\fR
.br
\fB::tcl::mathfunc::asin\fR \fIarg\fR
.br
\fB::tcl::mathfunc::atan\fR \fIarg\fR
.br
\fB::tcl::mathfunc::atan2\fR \fIy\fR \fIx\fR
.br
\fB::tcl::mathfunc::bool\fR \fIarg\fR
.br
\fB::tcl::mathfunc::ceil\fR \fIarg\fR
.br
\fB::tcl::mathfunc::cos\fR \fIarg\fR
.br
\fB::tcl::mathfunc::cosh\fR \fIarg\fR
.br
\fB::tcl::mathfunc::double\fR \fIarg\fR
.br
\fB::tcl::mathfunc::exp\fR \fIarg\fR
.br
\fB::tcl::mathfunc::floor\fR \fIarg\fR
.br
\fB::tcl::mathfunc::fmod\fR \fIx\fR \fIy\fR
.br
\fB::tcl::mathfunc::hypot\fR \fIx\fR \fIy\fR
.br
\fB::tcl::mathfunc::int\fR \fIarg\fR
.br
\fB::tcl::mathfunc::log\fR \fIarg\fR
.br
\fB::tcl::mathfunc::log10\fR \fIarg\fR
.br
\fB::tcl::mathfunc::max\fR \fIarg\fR ?\fIarg\fR ...?
.br
\fB::tcl::mathfunc::min\fR \fIarg\fR ?\fIarg\fR ...?
.br
\fB::tcl::mathfunc::pow\fR \fIx\fR \fIy\fR
.br
\fB::tcl::mathfunc::rand\fR
.br
\fB::tcl::mathfunc::round\fR \fIarg\fR
.br
\fB::tcl::mathfunc::sin\fR \fIarg\fR
.br
\fB::tcl::mathfunc::sinh\fR \fIarg\fR
.br
\fB::tcl::mathfunc::sqrt\fR \fIarg\fR
.br
\fB::tcl::mathfunc::srand\fR \fIarg\fR
.br
\fB::tcl::mathfunc::tan\fR \fIarg\fR
.br
\fB::tcl::mathfunc::tanh\fR \fIarg\fR
.br
\fB::tcl::mathfunc::wide\fR \fIarg\fR
.sp
.BE
.SH "DESCRIPTION"
.PP
The \fBexpr\fR command handles mathematical functions of the form
\fBsin($x)\fR or \fBatan2($y,$x)\fR by converting them to calls of the
form \fB[tcl::math::sin [expr {$x}]]\fR or
\fB[tcl::math::atan2 [expr {$y}] [expr {$x}]]\fR.
A number of math functions are available by default within the
namespace \fB::tcl::mathfunc\fR; these functions are also available
for code apart from \fBexpr\fR, by invoking the given commands
directly.
.PP
Tcl supports the following mathematical functions in expressions, all
of which work solely with floating-point numbers unless otherwise noted:
.DS
.ta 3c 6c 9c
\fBabs\fR \fBacos\fR \fBasin\fR \fBatan\fR
\fBatan2\fR \fBbool\fR \fBceil\fR \fBcos\fR
\fBcosh\fR \fBdouble\fR \fBexp\fR \fBfloor\fR
\fBfmod\fR \fBhypot\fR \fBint\fR \fBlog\fR
\fBlog10\fR \fBmax\fR \fBmin\fR \fBpow\fR
\fBrand\fR \fBround\fR \fBsin\fR \fBsinh\fR
\fBsqrt\fR \fBsrand\fR \fBtan\fR \fBtanh\fR
\fBwide\fR
.DE
.PP
.TP
\fBabs(\fIarg\fB)\fR
Returns the absolute value of \fIarg\fR. \fIArg\fR may be either
integer or floating-point, and the result is returned in the same form.
.TP
\fBacos(\fIarg\fB)\fR
Returns the arc cosine of \fIarg\fR, in the range [\fI0\fR,\fIpi\fR]
radians. \fIArg\fR should be in the range [\fI-1\fR,\fI1\fR].
.TP
\fBasin(\fIarg\fB)\fR
Returns the arc sine of \fIarg\fR, in the range [\fI-pi/2\fR,\fIpi/2\fR]
radians. \fIArg\fR should be in the range [\fI-1\fR,\fI1\fR].
.TP
\fBatan(\fIarg\fB)\fR
Returns the arc tangent of \fIarg\fR, in the range [\fI-pi/2\fR,\fIpi/2\fR]
radians.
.TP
\fBatan2(\fIy, x\fB)\fR
Returns the arc tangent of \fIy\fR/\fIx\fR, in the range [\fI-pi\fR,\fIpi\fR]
radians. \fIx\fR and \fIy\fR cannot both be 0. If \fIx\fR is greater
than \fI0\fR, this is equivalent to \fBatan(\fIy/x\fB)\fR.
.TP
\fBbool(\fIarg\fB)\fR
Accepts any numerical value, or any string acceptable to
\fBstring is boolean\fR, and returns the corresponding
boolean value \fB0\fR or \fB1\fR. Non-zero numbers are true.
Other numbers are false. Non-numeric strings produce boolean value in
agreement with \fBstring is true\fR and \fBstring is false\fR.
.TP
\fBceil(\fIarg\fB)\fR
Returns the smallest integral floating-point value (i.e. with a zero
fractional part) not less than \fIarg\fR.
.TP
\fBcos(\fIarg\fB)\fR
Returns the cosine of \fIarg\fR, measured in radians.
.TP
\fBcosh(\fIarg\fB)\fR
Returns the hyperbolic cosine of \fIarg\fR. If the result would cause
an overflow, an error is returned.
.TP
\fBdouble(\fIarg\fB)\fR
If \fIarg\fR is a floating-point value, returns \fIarg\fR, otherwise converts
\fIarg\fR to floating-point and returns the converted value.
.TP
\fBexp(\fIarg\fB)\fR
Returns the exponential of \fIarg\fR, defined as \fIe\fR**\fIarg\fR.
If the result would cause an overflow, an error is returned.
.TP
\fBfloor(\fIarg\fB)\fR
Returns the largest integral floating-point value (i.e. with a zero
fractional part) not greater than \fIarg\fR.
.TP
\fBfmod(\fIx, y\fB)\fR
Returns the floating-point remainder of the division of \fIx\fR by
\fIy\fR. If \fIy\fR is 0, an error is returned.
.TP
\fBhypot(\fIx, y\fB)\fR
Computes the length of the hypotenuse of a right-angled triangle
\fBsqrt(\fIx\fR*\fIx\fR+\fIy\fR*\fIy\fB)\fR.
.TP
\fBint(\fIarg\fB)\fR
If \fIarg\fR is an integer value of the same width as the machine
word, returns \fIarg\fR, otherwise
converts \fIarg\fR to an integer (of the same size as a machine word,
i.e. 32-bits on 32-bit systems, and 64-bits on 64-bit systems) by
truncation and returns the converted value.
.TP
\fBlog(\fIarg\fB)\fR
Returns the natural logarithm of \fIarg\fR. \fIArg\fR must be a
positive value.
.TP
\fBlog10(\fIarg\fB)\fR
Returns the base 10 logarithm of \fIarg\fR. \fIArg\fR must be a
positive value.
.TP
\fBmax(\fIarg\fB, \fI...\fB)\fR
Returns the maximum value of all given numeric arguments.
.TP
\fBmin(\fIarg\fB, \fI...\fB)\fR
Returns the minimum value of all given numeric arguments.
.TP
\fBpow(\fIx, y\fB)\fR
Computes the value of \fIx\fR raised to the power \fIy\fR. If \fIx\fR
is negative, \fIy\fR must be an integer value.
.TP
\fBrand()\fR
Returns a pseudo-random floating-point value in the range (\fI0\fR,\fI1\fR).
The generator algorithm is a simple linear congruential generator that
is not cryptographically secure. Each result from \fBrand\fR completely
determines all future results from subsequent calls to \fBrand\fR, so
\fBrand\fR should not be used to generate a sequence of secrets, such as
one-time passwords. The seed of the generator is initialized from the
internal clock of the machine or may be set with the \fBsrand\fR function.
.TP
\fBround(\fIarg\fB)\fR
If \fIarg\fR is an integer value, returns \fIarg\fR, otherwise converts
\fIarg\fR to integer by rounding and returns the converted value.
.TP
\fBsin(\fIarg\fB)\fR
Returns the sine of \fIarg\fR, measured in radians.
.TP
\fBsinh(\fIarg\fB)\fR
Returns the hyperbolic sine of \fIarg\fR. If the result would cause
an overflow, an error is returned.
.TP
\fBsqrt(\fIarg\fB)\fR
Returns the square root of \fIarg\fR. \fIArg\fR must be non-negative.
.TP
\fBsrand(\fIarg\fB)\fR
The \fIarg\fR, which must be an integer, is used to reset the seed for
the random number generator of \fBrand\fR. Returns the first random
number (see \fBrand()\fR) from that seed. Each interpreter has its own seed.
.TP
\fBtan(\fIarg\fB)\fR
Returns the tangent of \fIarg\fR, measured in radians.
.TP
\fBtanh(\fIarg\fB)\fR
Returns the hyperbolic tangent of \fIarg\fR.
.TP
\fBwide(\fIarg\fB)\fR
Converts \fIarg\fR to an integer value at least 64-bits wide (by sign-extension
if \fIarg\fR is a 32-bit number) if it is not one already.
.PP
In addition to these predefined functions, applications may
define additional functions by using \fBproc\fR (or any other method,
such as \fBinterp alias\fR or \fBTcl_CreateObjCommand\fR) to define
new commands in the \fBtcl::mathfunc\fR namespace. In addition, an
obsolete interface named \fBTcl_CreateMathFunc\fR() is available to
extensions that are written in C. The latter interface is not recommended
for new implementations..
.SH "SEE ALSO"
expr(n), namespace(n)
.SH "COPYRIGHT"
Copyright (c) 1993 The Regents of the University of California.
.br
Copyright (c) 1994-2000 Sun Microsystems Incorporated.
.br
Copyright (c) 2005 by Kevin B. Kenny <kennykb@acm.org>. All rights reserved.
+4 -4
View File
@@ -95,7 +95,7 @@ cannot be set independently. For example, if the
current locale is en_US_funky, then \fB::msgcat::mcpreferences\fR
.VS 1.4
returns \fB{en_US_funky en_US en {}}\fR.
.VE
.VE 1.4
.TP
\fB::msgcat::mcload \fIdirname\fR
Searches the specified directory for files that match
@@ -170,7 +170,7 @@ performed during string translation. For example, if a user specifies
.VS 1.4
en_GB_Funky, the locales ``en_GB_Funky'', ``en_GB'', ``en'' and ``''
(the empty string)
.VE
.VE 1.4
are searched in order until a matching translation
string is found. If no translation string is available, then
\fB::msgcat::unknown\fR is called.
@@ -240,12 +240,12 @@ followed by ``.msg''. For example:
es.msg -- spanish
en_gb.msg -- United Kingdom English
.CE
.VS
.VS 1.4
\fIException:\fR The message file for the root locale ``'' is
called \fBROOT.msg\fR. This exception is made so as not to
cause peculiar behavior, such as marking the message file as
``hidden'' on Unix file systems.
.VE
.VE 1.4
.IP [3]
The file contains a series of calls to \fBmcset\fR and
\fBmcmset\fR, setting the necessary translation strings
+32 -6
View File
@@ -2,11 +2,12 @@
'\" Copyright (c) 1993-1997 Bell Labs Innovations for Lucent Technologies
'\" Copyright (c) 1997 Sun Microsystems, Inc.
'\" Copyright (c) 2000 Scriptics Corporation.
'\" Copyright (c) 2004-2005 Donal K. Fellows.
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: namespace.n,v 1.16 2004/10/27 14:24:37 dkf Exp $
'\" RCS: @(#) $Id: namespace.n,v 1.16.2.2 2005/07/12 20:36:16 kennykb Exp $
'\"
.so man.macros
.TH namespace n 8.5 Tcl "Tcl Built-In Commands"
@@ -216,6 +217,17 @@ for namespace \fInamespace\fR.
If \fInamespace\fR is not specified,
the fully-qualified name of the current namespace's parent is returned.
.TP
\fBnamespace path\fR ?\fInamespaceList\fR?
'\" Should really have the .TP inside the .VS, but that triggers a groff bug
.VS 8.5
Returns the command resolution path of the current namespace. If
\fInamespaceList\fR is specified as a list of named namespaces, the
current namespace's command resolution path is set to those namespaces
and returns the empty list. The default command resolution path is
always empty. See the section \fBNAME RESOLUTION\fR below for an
explanation of the rules regarding name resolution.
.VE 8.5
.TP
\fBnamespace qualifiers\fR \fIstring\fR
Returns any leading namespace qualifiers for \fIstring\fR.
Qualifiers are namespace names separated by double colons (\fB::\fR).
@@ -387,10 +399,18 @@ there is no question about what command, variable, or namespace
you mean.
However, if the name does not start with a \fB::\fR
(i.e., is \fIrelative\fR),
Tcl follows a fixed rule for looking it up:
Command and variable names are always resolved
Tcl follows basic rules for looking it up:
Variable names are always resolved
by looking first in the current namespace,
and then in the global namespace.
.VS 8.5
Command names are also always resolved by looking in the current
namespace first. If not found there, they are searched for in every
namespace on the current namespace's command path (which is empty by
default). If not found there, command names are looked up in the
global namespace (or, failing that, are processed by the \fBunknown\fR
command.)
.VE 8.5
Namespace names, on the other hand, are always resolved
by looking in only the current namespace.
.PP
@@ -764,10 +784,16 @@ Create a namespace containing a variable and an exported command:
Call the command defined in the previous example in various ways.
.CS
# Direct call
foo::grill
::foo::grill
# Use the command resolution path to find the name
\fBnamespace eval\fR boo {
\fBnamespace path\fR ::foo
grill
}
# Import into current namespace, then call local alias
namespace import foo::grill
\fBnamespace import\fR foo::grill
grill
# Create two ensembles, one with the default name and one with a
@@ -782,7 +808,7 @@ foobar grill
.PP
Look up where the command imported in the previous example came from:
.CS
puts "grill came from [\fBnamespace which\fR grill]"
puts "grill came from [\fBnamespace origin\fR grill]"
.CE
.SH "SEE ALSO"
+14 -13
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: open.n,v 1.22 2004/11/09 04:51:31 davygrvy Exp $
'\" RCS: @(#) $Id: open.n,v 1.22.2.2 2005/05/05 17:55:27 kennykb Exp $
'\"
.so man.macros
.TH open n 8.3 Tcl "Tcl Built-In Commands"
@@ -61,6 +61,14 @@ Set the initial access position to the end of the file.
Open the file for reading and writing. If the file doesn't exist,
create a new empty file.
Set the initial access position to the end of the file.
.VS 8.5
.PP
All of the legal \fIaccess\fR values above may have the character
\fBb\fR added as the second or third character in the value to
indicate that the opened channel should be configured with the
\fB-translation binary\fR option, making the channel suitable for
reading or writing of binary data.
.VE 8.5
.PP
In the second form, \fIaccess\fR consists of a list of any of the
following flags, all of which have the standard POSIX meanings.
@@ -78,6 +86,11 @@ Open the file for both reading and writing.
\fBAPPEND\fR
Set the file pointer to the end of the file prior to each write.
.TP 15
.VS 8.5
\fBBINARY\fR
Configure the opened channed with the \fB-translation binary\fR option.
.VE 8.5
.TP 15
\fBCREAT\fR
Create the file if it doesn't already exist (without this flag it
is an error for the file not to exist).
@@ -106,14 +119,6 @@ If a new file is created as part of opening it, \fIpermissions\fR
(an integer) is used to set the permissions for the new file in
conjunction with the process's file mode creation mask.
\fIPermissions\fR defaults to 0666.
.PP
Note that if you are going to be reading or writing binary data from
the channel created by this command, you should use the
\fBfconfigure\fR command to change the \fB-translation\fR option of
the channel to \fBbinary\fR before transferring any binary data. This
is in contrast to the ``b'' character passed as part of the equivalent
of the \fIaccess\fR parameter to some versions of the C library
\fIfopen()\fR function.
.SH "COMMAND PIPELINES"
.PP
@@ -142,7 +147,6 @@ returned (a silent \fBclose\fR with -blocking 0).
It is often useful to use the \fBfileevent\fR command with pipelines
so other processing may happen at the same time as running the command
in the background.
.VS 8.4
.SH "SERIAL COMMUNICATIONS"
.PP
If \fIfileName\fR refers to a serial port, then the specified serial port
@@ -322,7 +326,6 @@ may cause this error.
.TP 10
\fBBREAK\fR
A BREAK condition has been detected by your UART (see above).
.VE
.SH "PORTABILITY ISSUES"
.TP
@@ -384,10 +387,8 @@ applications are run synchronously, as described above.
Valid values for \fIfileName\fR to open a serial port are generally of the
form \fB/dev/tty\fIX\fR, where \fIX\fR is \fBa\fR or \fBb\fR, but the name
of any pseudo-file that maps to a serial port may be used.
.VS 8.4
Advanced configuration options are only supported for serial ports
when Tcl is built to use the POSIX serial interface.
.VE 8.4
.sp
When running Tcl interactively, there may be some strange interactions
between the console, if one is present, and a command pipeline that uses
+3 -10
View File
@@ -4,7 +4,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: pkgMkIndex.n,v 1.14 2003/02/25 23:58:09 dgp Exp $
'\" RCS: @(#) $Id: pkgMkIndex.n,v 1.14.6.2 2005/04/10 23:14:43 kennykb Exp $
'\"
.so man.macros
.TH pkg_mkIndex n 8.3 Tcl "Tcl Built-In Commands"
@@ -14,9 +14,7 @@
pkg_mkIndex \- Build an index for automatic loading of packages
.SH SYNOPSIS
.nf
.VS 8.3.0
\fBpkg_mkIndex ?\fI\-direct\fR? ?\fI\-lazy\fR? ?\fI\-load pkgPat\fR? ?\fI\-verbose\fR? \fIdir\fR ?\fIpattern pattern ...\fR?
.VE
.fi
.BE
@@ -41,9 +39,7 @@ Create the index by invoking \fBpkg_mkIndex\fR.
The \fIdir\fR argument gives the name of a directory and each
\fIpattern\fR argument is a \fBglob\fR-style pattern that selects
script or binary files in \fIdir\fR.
.VS 8.0.3
The default pattern is \fB*.tcl\fR and \fB*.[info sharedlibextension]\fR.
.VE
.br
\fBPkg_mkIndex\fR will create a file \fBpkgIndex.tcl\fR in \fIdir\fR
with package information about all the files given by the \fIpattern\fR
@@ -109,7 +105,8 @@ upon \fBpackage require\fR. This is the default.
\fB\-lazy\fR
The generated index will manage to delay loading the package until the
use of one of the commands provided by the package, instead of loading
it immediately upon \fBpackage require\fR.
it immediately upon \fBpackage require\fR. This is not compatible with
the use of \fIauto_reset\fR, and therefore its use is discouraged.
.TP 15
\fB\-load \fIpkgPat\fR
The index process will pre-load any packages that exist in the
@@ -159,10 +156,8 @@ commands for each version of each available package; these commands
invoke \fBpackage provide\fR commands to announce the
availability of the package, and they setup auto-loader
information to load the files of the package.
.VS 8.3
If the \fI\-lazy\fR flag was provided when the \fBpkgIndex.tcl\fR
was generated,
.VE
a given file of a given version of a given package isn't
actually loaded until the first time one of its commands
is invoked.
@@ -170,7 +165,6 @@ Thus, after invoking \fBpackage require\fR you may
not see the package's commands in the interpreter, but you will be able
to invoke the commands and they will be auto-loaded.
.VS 8.3
.SH "DIRECT LOADING"
.PP
Some packages, for instance packages which use namespaces and export
@@ -179,7 +173,6 @@ that their package files be loaded immediately upon \fBpackage require\fR
instead of delaying the actual loading to the first use of one of the
package's command. This is the default mode when generating the package
index. It can be overridden by specifying the \fI\-lazy\fR argument.
.VE
.SH "COMPLEX CASES"
Most complex cases of dependencies among scripts
+1 -3
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: puts.n,v 1.8 2004/10/27 14:24:37 dkf Exp $
'\" RCS: @(#) $Id: puts.n,v 1.8.2.1 2005/04/10 23:14:43 kennykb Exp $
'\"
.so man.macros
.TH puts n 7.5 Tcl "Tcl Built-In Commands"
@@ -22,13 +22,11 @@ puts \- Write to a channel
Writes the characters given by \fIstring\fR to the channel given
by \fIchannelId\fR.
.PP
.VS
\fIChannelId\fR must be an identifier for an open channel such as a
Tcl standard channel (\fBstdout\fR or \fBstderr\fR), the return
value from an invocation of \fBopen\fR or \fBsocket\fR, or the result
of a channel creation command provided by a Tcl extension. The channel
must have been opened for output.
.VE
.PP
If no \fIchannelId\fR is specified then it defaults to
\fBstdout\fR. \fBPuts\fR normally outputs a newline character after
+20 -27
View File
@@ -1,4 +1,3 @@
'\" -*- nroff -*-
'\"
'\" Copyright (c) 1998 Sun Microsystems, Inc.
'\" Copyright (c) 1999 Scriptics Corporation
@@ -6,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: re_syntax.n,v 1.5 2004/10/31 16:01:54 dkf Exp $
'\" RCS: @(#) $Id: re_syntax.n,v 1.5.2.2 2005/04/10 23:14:43 kennykb Exp $
'\"
.so man.macros
.TH re_syntax n "8.1" Tcl "Tcl Built-In Commands"
@@ -49,7 +48,7 @@ an empty branch matches the empty string.
.PP
A quantified atom is an \fIatom\fR possibly followed
by a single \fIquantifier\fR.
Without a quantifier, it matches a match for the atom.
Without a quantifier, it matches a single match for the atom.
The quantifiers,
and what a so-quantified atom matches, are:
.RS 2
@@ -86,43 +85,33 @@ permissible values from 0 to 255 inclusive.
.PP
An atom is one of:
.RS 2
.TP 6
\fB(\fIre\fB)\fR
(where \fIre\fR is any regular expression) matches a match for
\fIre\fR, with the match noted for possible reporting
.TP
\fB(?:\fIre\fB)\fR
.IP \fB(\fIre\fB)\fR 6
matches a match for \fIre\fR (\fIre\fR is any regular expression) with
the match noted for possible reporting
.IP \fB(?:\fIre\fB)\fR
as previous, but does no reporting (a ``non-capturing'' set of
parentheses)
.TP
\fB()\fR
.IP \fB()\fR
matches an empty string, noted for possible reporting
.TP
\fB(?:)\fR
.IP \fB(?:)\fR
matches an empty string, without reporting
.TP
\fB[\fIchars\fB]\fR
.IP \fB[\fIchars\fB]\fR
a \fIbracket expression\fR, matching any one of the \fIchars\fR (see
\fBBRACKET EXPRESSIONS\fR for more detail)
.TP
\fB.\fR
.IP \fB.\fR
matches any single character
.TP
\fB\e\fIk\fR
(where \fIk\fR is a non-alphanumeric character) matches that character
taken as an ordinary character, e.g. \e\e matches a backslash
.IP \fB\e\fIk\fR
matches the non-alphanumeric character \fIk\fR
taken as an ordinary character, e.g. \fB\e\e\fR matches a backslash
character
.TP
\fB\e\fIc\fR
.IP \fB\e\fIc\fR
where \fIc\fR is alphanumeric (possibly followed by other characters),
an \fIescape\fR (AREs only), see \fBESCAPES\fR below
.TP
\fB{\fR
.IP \fB{\fR
when followed by a character other than a digit, matches the
left-brace character `\fB{\fR'; when followed by a digit, it is the
beginning of a \fIbound\fR (see above)
.TP
\fIx\fR
.IP \fIx\fR
where \fIx\fR is a single character with no other significance,
matches that character.
.RE
@@ -654,3 +643,7 @@ RegExp(3), regexp(n), regsub(n), lsearch(n), switch(n), text(n)
.SH KEYWORDS
match, regular expression, string
'\" Local Variables:
'\" mode: nroff
'\" End:
+1 -3
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: read.n,v 1.9 2004/10/27 14:24:37 dkf Exp $
'\" RCS: @(#) $Id: read.n,v 1.9.2.1 2005/04/10 23:14:44 kennykb Exp $
'\"
.so man.macros
.TH read n 8.1 Tcl "Tcl Built-In Commands"
@@ -32,13 +32,11 @@ the channel is configured to use a multi-byte encoding, then the
number of characters read may not be the same as the number of bytes
read.
.PP
.VS
\fIChannelId\fR must be an identifier for an open channel such as the
Tcl standard input channel (\fBstdin\fR), the return value from an
invocation of \fBopen\fR or \fBsocket\fR, or the result of a channel
creation command provided by a Tcl extension. The channel must have
been opened for input.
.VE
.PP
If \fIchannelId\fR is in nonblocking mode, the command may not read as
many characters as requested: once all available input has been read,
+12 -5
View File
@@ -4,7 +4,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: regexp.n,v 1.16 2004/10/27 14:24:37 dkf Exp $
'\" RCS: @(#) $Id: regexp.n,v 1.16.2.2 2005/05/05 17:55:27 kennykb Exp $
'\"
.so man.macros
.TH regexp n 8.3 Tcl "Tcl Built-In Commands"
@@ -83,7 +83,6 @@ manual page).
\fB\-nocase\fR
Causes upper-case characters in \fIstring\fR to be treated as
lower case during the matching process.
.VS 8.3
.TP 15
\fB\-all\fR
Causes the regular expression to be matched as many times as possible
@@ -108,13 +107,17 @@ regular expression. Examples are:
.TP 15
\fB\-start\fR \fIindex\fR
Specifies a character index offset into the string to start
matching the regular expression at. When using this switch, `^'
matching the regular expression at.
.VS 8.5
The \fIindex\fR value is interpreted in the same manner
as the \fIindex\fR argument to \fBstring index\fR.
.VE 8.5
When using this switch, `^'
will not match the beginning of the line, and \\A will still
match the start of the string at \fIindex\fR. If \fB\-indices\fR
is specified, the indices will be indexed starting from the
absolute beginning of the input string.
\fIindex\fR will be constrained to the bounds of the input string.
.VE 8.3
.TP 15
\fB\-\|\-\fR
Marks the end of switches. The argument following this one will
@@ -155,7 +158,11 @@ characters) in a string:
.CE
.SH "SEE ALSO"
re_syntax(n), regsub(n)
re_syntax(n), regsub(n),
.VS 8.5
string(n)
.VE
.SH KEYWORDS
match, regular expression, string
+1 -5
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: registry.n,v 1.12 2004/10/27 14:24:37 dkf Exp $
'\" RCS: @(#) $Id: registry.n,v 1.12.2.1 2005/04/10 23:14:44 kennykb Exp $
'\"
.so man.macros
.TH registry n 1.1 registry "Tcl Bundled Packages"
@@ -40,17 +40,14 @@ one of the following forms:
\fIHostname\fR specifies the name of any valid Windows
host that exports its registry. The \fIrootname\fR component must be
one of \fBHKEY_LOCAL_MACHINE\fR, \fBHKEY_USERS\fR,
.VS
\fBHKEY_CLASSES_ROOT\fR, \fBHKEY_CURRENT_USER\fR,
\fBHKEY_CURRENT_CONFIG\fR, \fBHKEY_PERFORMANCE_DATA\fR, or
\fBHKEY_DYN_DATA\fR. The \fIkeypath\fR can be one or more
.VE
registry key names separated by backslash (\fB\e\fR) characters.
.PP
\fIOption\fR indicates what to do with the registry key name. Any
unique abbreviation for \fIoption\fR is acceptable. The valid options
are:
.VS 8.4
.TP
\fBregistry broadcast \fIkeyName\fR ?\fI-timeout milliseconds\fR?
.
@@ -67,7 +64,6 @@ set curPath [registry get $regPath "Path"]
registry set $regPath "Path" "$curPath;$addPath"
registry broadcast "Environment"
.CE
.VE 8.4
.TP
\fBregistry delete \fIkeyName\fR ?\fIvalueName\fR?
.
+12 -11
View File
@@ -6,7 +6,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: regsub.n,v 1.12 2004/10/27 14:24:37 dkf Exp $
'\" RCS: @(#) $Id: regsub.n,v 1.12.2.2 2005/05/05 17:55:28 kennykb Exp $
'\"
.so man.macros
.TH regsub n 8.3 Tcl "Tcl Built-In Commands"
@@ -15,26 +15,20 @@
.SH NAME
regsub \- Perform substitutions based on regular expression pattern matching
.SH SYNOPSIS
.VS 8.4
\fBregsub \fR?\fIswitches\fR? \fIexp string subSpec \fR?\fIvarName\fR?
.VE 8.4
.BE
.SH DESCRIPTION
.PP
This command matches the regular expression \fIexp\fR against
\fIstring\fR,
.VS 8.4
and either copies \fIstring\fR to the variable whose name is
given by \fIvarName\fR or returns \fIstring\fR if \fIvarName\fR is not
present.
.VE 8.4
(Regular expression matching is described in the \fBre_syntax\fR
reference page.)
If there is a match, then while copying \fIstring\fR to \fIvarName\fR
.VS 8.4
(or to the result of this command if \fIvarName\fR is not present)
.VE 8.4
the portion of \fIstring\fR that
matched \fIexp\fR is replaced with \fIsubSpec\fR.
If \fIsubSpec\fR contains a ``&'' or ``\e0'', then it is replaced
@@ -98,7 +92,12 @@ by \fIsubSpec\fR use the original unconverted form of \fIstring\fR.
.TP 10
\fB\-start\fR \fIindex\fR
Specifies a character index offset into the string to start
matching the regular expression at. When using this switch, `^'
matching the regular expression at.
.VS 8.5
The \fIindex\fR value is interpreted in the same manner
as the \fIindex\fR argument to \fBstring index\fR.
.VE 8.5
When using this switch, `^'
will not match the beginning of the line, and \\A will still
match the start of the string at \fIindex\fR.
\fIindex\fR will be constrained to the bounds of the input string.
@@ -107,11 +106,9 @@ match the start of the string at \fIindex\fR.
Marks the end of switches. The argument following this one will
be treated as \fIexp\fR even if it starts with a \fB\-\fR.
.PP
.VS 8.4
If \fIvarName\fR is supplied, the command returns a count of the
number of matching ranges that were found and replaced, otherwise the
string after replacement is returned.
.VE 8.4
See the manual entry for \fBregexp\fR for details on the interpretation
of regular expressions.
.SH EXAMPLES
@@ -142,7 +139,11 @@ set quoted [subst [\fBregsub\fR -all $RE $string $substitution]]
.CE
.SH "SEE ALSO"
regexp(n), re_syntax(n), subst(n)
regexp(n), re_syntax(n), subst(n),
.VS 8.5
string(n)
.VE
.SH KEYWORDS
match, pattern, regular expression, substitute
+3 -19
View File
@@ -6,7 +6,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: scan.n,v 1.12 2004/10/27 14:24:37 dkf Exp $
'\" RCS: @(#) $Id: scan.n,v 1.12.2.2 2005/10/08 13:44:37 dgp Exp $
'\"
.so man.macros
.TH scan n 8.4 Tcl "Tcl Built-In Commands"
@@ -43,13 +43,11 @@ Otherwise, if it isn't a \fB%\fR character then it
must match the next character of \fIstring\fR.
When a \fB%\fR is encountered in \fIformat\fR, it indicates
the start of a conversion specifier.
.VS 8.4
A conversion specifier contains up to four fields after the \fB%\fR:
a \fB*\fR, which indicates that the converted value is to be discarded
instead of assigned to a variable; a XPG3 position specifier; a number
indicating a maximum field width; a field size modifier; and a
conversion character.
.VE 8.4
All of these fields are optional except for the conversion character.
The fields that are present must appear in the order given above.
.PP
@@ -75,16 +73,13 @@ The following conversion characters are supported:
\fBd\fR
The input field must be a decimal integer.
It is read in and the value is stored in the variable as a decimal string.
.VS 8.4
If the \fBl\fR or \fBL\fR field size modifier is given, the scanned
value will have an internal representation that is at least 64-bits in
size.
.VE 8.4
.TP 10
\fBo\fR
The input field must be an octal integer. It is read in and the
value is stored in the variable as a decimal string.
.VS 8.4
If the \fBl\fR or \fBL\fR field size modifier is given, the scanned
value will have an internal representation that is at least 64-bits in
size.
@@ -92,12 +87,10 @@ If the value exceeds MAX_INT (017777777777 on platforms using 32-bit
integers when the \fBl\fR and \fBL\fR modifiers are not given), it
will be truncated to a signed integer. Hence, 037777777777 will
appear as -1 on a 32-bit machine by default.
.VE 8.4
.TP 10
\fBx\fR
The input field must be a hexadecimal integer. It is read in
and the value is stored in the variable as a decimal string.
.VS 8.4
If the \fBl\fR or \fBL\fR field size modifier is given, the scanned
value will have an internal representation that is at least 64-bits in
size.
@@ -105,26 +98,21 @@ If the value exceeds MAX_INT (0x7FFFFFFF on platforms using 32-bit
integers when the \fBl\fR and \fBL\fR modifiers are not given), it
will be truncated to a signed integer. Hence, 0xFFFFFFFF will appear
as -1 on a 32-bit machine.
.VE 8.4
.TP 10
\fBu\fR
The input field must be a decimal integer. The value is stored in the
variable as an unsigned decimal integer string.
.VS 8.4
If the \fBl\fR or \fBL\fR field size modifier is given, the scanned
value will have an internal representation that is at least 64-bits in
size.
.VE 8.4
.TP 10
\fBi\fR
The input field must be an integer. The base (i.e. decimal, octal, or
hexadecimal) is determined in the same fashion as described in
\fBexpr\fR. The value is stored in the variable as a decimal string.
.VS 8.4
If the \fBl\fR or \fBL\fR field size modifier is given, the scanned
value will have an internal representation that is at least 64-bits in
size.
.VE 8.4
.TP 10
\fBc\fR
A single character is read in and its binary value is stored in
@@ -148,8 +136,7 @@ decimal digits.
It is read in and stored in the variable as a floating-point string.
.TP 10
\fB[\fIchars\fB]\fR
The input field consists of any number of characters in
\fIchars\fR.
The input field consists of one or more characters in \fIchars\fR.
The matching string is stored in the variable.
If the first character between the brackets is a \fB]\fR then
it is treated as part of \fIchars\fR rather than the closing
@@ -161,8 +148,7 @@ If the first or last character between the brackets is a \fB\-\fR, then
it is treated as part of \fIchars\fR rather than indicating a range.
.TP 10
\fB[^\fIchars\fB]\fR
The input field consists of any number of characters not in
\fIchars\fR.
The input field consists of one or more characters not in \fIchars\fR.
The matching string is stored in the variable.
If the character immediately following the \fB^\fR is a \fB]\fR then it is
treated as part of the set rather than the closing bracket for
@@ -199,11 +185,9 @@ converted to a decimal string, which is then assigned to the
corresponding \fIvarName\fR;
no field width may be specified for this conversion.
.IP [3]
.VS 8.4
The \fBh\fR modifier is always ignored and the \fBl\fR and \fBL\fR
modifiers are ignored when converting real values (i.e. type
\fBdouble\fR is used for the internal representation).
.VE 8.4
.IP [4]
If the end of the input string is reached before any conversions have been
performed and no variables are given, an empty string is returned.
+1 -5
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: seek.n,v 1.7 2004/10/27 14:24:37 dkf Exp $
'\" RCS: @(#) $Id: seek.n,v 1.7.2.1 2005/04/10 23:14:44 kennykb Exp $
'\"
.so man.macros
.TH seek n 8.1 Tcl "Tcl Built-In Commands"
@@ -21,12 +21,10 @@ seek \- Change the access position for an open channel
.PP
Changes the current access position for \fIchannelId\fR.
.PP
.VS
\fIChannelId\fR must be an identifier for an open channel such as a
Tcl standard channel (\fBstdin\fR, \fBstdout\fR, or \fBstderr\fR),
the return value from an invocation of \fBopen\fR or \fBsocket\fR, or
the result of a channel creation command provided by a Tcl extension.
.VE
.PP
The \fIoffset\fR and \fIorigin\fR
arguments specify the position at which the next read or write will occur
@@ -57,11 +55,9 @@ This command returns an empty string.
An error occurs if this command is applied to channels whose underlying
file or device does not support seeking.
.PP
.VS 8.1
Note that \fIoffset\fR values are byte offsets, not character
offsets. Both \fBseek\fR and \fBtell\fR operate in terms of bytes,
not characters, unlike \fBread\fR.
.VE 8.1
.SH EXAMPLES
Read a file twice:
.CS
+35 -11
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: string.n,v 1.24 2004/10/27 14:24:37 dkf Exp $
'\" RCS: @(#) $Id: string.n,v 1.24.2.4 2005/07/12 20:36:16 kennykb Exp $
'\"
.so man.macros
.TH string n 8.1 Tcl "Tcl Built-In Commands"
@@ -72,23 +72,43 @@ will return \fB\-1\fR.
Returns the \fIcharIndex\fR'th character of the \fIstring\fR argument.
A \fIcharIndex\fR of 0 corresponds to the first character of the
string. \fIcharIndex\fR may be specified as follows:
.VS 8.5
.RS
.IP \fIinteger\fR 10
The char specified at this integral index.
For any index value that passes \fBstring is integer -strict\fR,
the char specified at this integral index
(e.g. \fB2\fR would refer to the "c" in "abcd").
.IP \fBend\fR 10
The last char of the string.
.IP \fBend\-\fIinteger\fR 10
The last char of the string minus the specified integer offset
(e.g. \fBend\-1\fR would refer to the "c" in "abcd").
The last char of the string
(e.g. \fBend\fR would refer to the "d" in "abcd").
.IP \fBend\fR\-\fIN\fR 10
The last char of the string minus the specified integer offset \fIN\fR
(e.g. \fBend\fR\-1 would refer to the "c" in "abcd").
.IP \fBend\fR+\fIN\fR 10
The last char of the string plus the specified integer offset \fIN\fR
(e.g. \fBend\fR+\-1 would refer to the "c" in "abcd").
.IP \fIM\fR+\fIN\fR 10
The char specified at the integral index that is the sum of
integer values \fIM\fR and \fIN\fR
(e.g. \fB1+1\fR would refer to the "c" in "abcd").
.IP \fIM\fR\-\fIN\fR 10
The char specified at the integral index that is the difference of
integer values \fIM\fR and \fIN\fR
(e.g. \fB2\-1\fR would refer to the "b" in "abcd").
.PP
In the specifications above, the integer value \fIM\fR contains no
trailing whitespace and the integer value \fIN\fR contains no
leading whitespace.
.PP
If \fIcharIndex\fR is less than 0 or greater than or equal to the
length of the string then an empty string is returned.
length of the string then this command returns an empty string.
.RE
.VE
.TP
\fBstring is \fIclass\fR ?\fB\-strict\fR? ?\fB\-failindex \fIvarname\fR? \fIstring\fR
Returns 1 if \fIstring\fR is a valid member of the specified character
class, otherwise returns 0. If \fB\-strict\fR is specified, then an
empty string returns 0, otherwise and empty string will return 1 on
empty string returns 0, otherwise an empty string will return 1 on
any class. If \fB\-failindex\fR is specified, then if the function
returns 0, the index in the string where the class was no longer valid
will be stored in the variable named \fIvarname\fR. The \fIvarname\fR
@@ -286,19 +306,19 @@ specified as for the \fBindex\fR method.
.TP
\fBstring trim \fIstring\fR ?\fIchars\fR?
Returns a value equal to \fIstring\fR except that any leading or
trailing characters from the set given by \fIchars\fR are removed. If
trailing characters present in the string given by \fIchars\fR are removed. If
\fIchars\fR is not specified then white space is removed (spaces,
tabs, newlines, and carriage returns).
.TP
\fBstring trimleft \fIstring\fR ?\fIchars\fR?
Returns a value equal to \fIstring\fR except that any leading
characters from the set given by \fIchars\fR are removed. If
characters present in the string given by \fIchars\fR are removed. If
\fIchars\fR is not specified then white space is removed (spaces,
tabs, newlines, and carriage returns).
.TP
\fBstring trimright \fIstring\fR ?\fIchars\fR?
Returns a value equal to \fIstring\fR except that any trailing
characters from the set given by \fIchars\fR are removed. If
characters present in the string given by \fIchars\fR are removed. If
\fIchars\fR is not specified then white space is removed (spaces,
tabs, newlines, and carriage returns).
.TP
@@ -334,3 +354,7 @@ expr(n), list(n)
.SH KEYWORDS
case conversion, compare, index, match, pattern, string, word, equal, ctype
'\" Local Variables:
'\" mode: nroff
'\" End:
+1 -5
View File
@@ -6,7 +6,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: subst.n,v 1.6 2004/10/27 14:24:37 dkf Exp $
'\" RCS: @(#) $Id: subst.n,v 1.6.2.1 2005/04/10 23:14:44 kennykb Exp $
'\"
.so man.macros
.TH subst n 7.4 Tcl "Tcl Built-In Commands"
@@ -36,7 +36,6 @@ For example, if \fB\-nocommands\fR is specified, command substitution
is not performed: open and close brackets are treated as ordinary characters
with no special interpretation.
.PP
.VS 8.4
Note that the substitution of one kind can include substitution of
other kinds. For example, even when the \fB-novariables\fR option
is specified, command substitution is performed without restriction.
@@ -59,7 +58,6 @@ substitution, then the returned value is substituted for that
substitution. See the EXAMPLES below. In this way, all exceptional
return codes are ``caught'' by \fBsubst\fR. The \fBsubst\fR command
itself will either return an error, or will complete successfully.
.VE
.SH EXAMPLES
.PP
When it performs its substitutions, \fIsubst\fR does not give any
@@ -70,7 +68,6 @@ set a 44
\fBsubst\fR {xyz {$a}}
.CE
returns ``\fBxyz {44}\fR'', not ``\fBxyz {$a}\fR''
.VS 8.4
and the script
.CS
set a "p\\} q \\{r"
@@ -116,7 +113,6 @@ returns ``\fBabc,foo,def\fR'', not ``\fBabc,3,def\fR'' and
\fBsubst\fR {abc,[return -code 10 foo;expr 1+2],def}
.CE
also returns ``\fBabc,foo,def\fR'', not ``\fBabc,3,def\fR''.
.VE
.SH "SEE ALSO"
Tcl(n), eval(n), break(n), continue(n)
+5 -2
View File
@@ -5,10 +5,10 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: switch.n,v 1.8 2004/10/27 14:24:37 dkf Exp $
'\" RCS: @(#) $Id: switch.n,v 1.8.2.1 2005/07/12 20:36:16 kennykb Exp $
'\"
.so man.macros
.TH switch n 7.0 Tcl "Tcl Built-In Commands"
.TH switch n 8.5 Tcl "Tcl Built-In Commands"
.BS
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
@@ -51,6 +51,9 @@ expression matching
'\" Options defined by TIP#75
.VS 8.5
.TP 10
\fB\-nocase\fR
Causes comparisons to be handled in a case-insensitive manner.
.TP 10
\fB\-matchvar\fR \fIvarName\fR
This option (only legal when \fB\-regexp\fR is also specified)
specifies the name of a variable into which the list of matches
+16 -13
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: tclvars.n,v 1.20 2004/11/20 00:17:32 dgp Exp $
'\" RCS: @(#) $Id: tclvars.n,v 1.20.2.3 2005/10/08 13:44:37 dgp Exp $
'\"
.so man.macros
.TH tclvars n 8.0 Tcl "Tcl Built-In Commands"
@@ -37,7 +37,6 @@ If the entire \fBenv\fR array is unset then Tcl will stop
monitoring \fBenv\fR accesses and will not update environment
variables.
.RS
.VS 8.0
Under Windows, the environment variables PATH and COMSPEC in any
capitalization are converted automatically to upper case. For instance, the
PATH variable could be exported by the operating system as ``path'',
@@ -47,7 +46,6 @@ Tcl are left unmodified. Setting an env array variable to blank is the
same as unsetting it as this is the behavior of the underlying Windows OS.
It should be noted that relying on an existing and empty environment variable
won't work on windows and is discouraged for cross-platform usage.
.VE
.RE
.TP
\fBerrorCode\fR
@@ -163,7 +161,6 @@ hold a string giving the current patch level for Tcl, such as
\fB7.4b4\fR for the fourth beta release of Tcl 7.4.
The value of this variable is returned by the \fBinfo patchlevel\fR
command.
.VS 8.0 br
.TP
\fBtcl_pkgPath\fR
This variable holds a list of directories indicating where packages are
@@ -176,12 +173,11 @@ subdirectory of one of the entries in \fB$tcl_pkgPath\fR. The directories
in \fB$tcl_pkgPath\fR are included by default in the \fBauto_path\fR
variable, so they and their immediate subdirectories are automatically
searched for packages during \fBpackage require\fR commands. Note:
\fBtcl_pkgPath\fR it not intended to be modified by the application. Its
\fBtcl_pkgPath\fR is not intended to be modified by the application. Its
value is added to \fBauto_path\fR at startup; changes to \fBtcl_pkgPath\fR
are not reflected in \fBauto_path\fR. If you want Tcl to search additional
directories for packages you should add the names of those directories to
\fBauto_path\fR, not \fBtcl_pkgPath\fR.
.VE
.TP
\fBtcl_platform\fR
This is an associative array whose elements contain information about
@@ -193,12 +189,10 @@ retrieve any relevant information. In addition, extensions
and applications may add additional values to the array. The
predefined elements are:
.RS
.VS
.TP
\fBbyteOrder\fR
The native byte order of this machine: either \fBlittleEndian\fR or
\fBbigEndian\fR.
.VE
.TP
\fBdebug\fR
If this variable exists, then the interpreter was compiled with and linked
@@ -241,17 +235,27 @@ This comes from the USER or LOGNAME environment variable on Unix,
and the value from GetUserName on Windows.
.TP
\fBwordSize\fR
.VS 8.4
This gives the size of the native-machine word in bytes (strictly, it
is same as the result of evaluating \fIsizeof(long)\fR in C.)
.VE 8.4
.RE
.TP
\fBtcl_precision\fR
.VS
This variable controls the number of digits to generate
when converting floating-point values to strings. It defaults
to 12.
.VS 8.5
to 0. \fIApplications should not change this value;\fR it is
provided for compatibility with legacy code.
.PP
The default value of 0 is special, meaning that Tcl should
convert numbers using as few digits as possible while still
distinguishing any floating point number from its nearest
neighbours. It differs from using an arbitrarily high value
for \fItcl_precision\fR in that an inexact number like \fI1.4\fR
will convert as \fI1.4\fR rather than \fI1.3999999999999999\fR
even though the latter is nearer to the exact value of the
binary number.
.VE 8.5
.PP
17 digits is ``perfect'' for IEEE floating-point in that it allows
double-precision values to be converted to strings and back to
binary with no loss of information. However, using 17 digits prevents
@@ -264,7 +268,6 @@ changing it in one interpreter will affect all other interpreters as
well. However, safe interpreters are not allowed to modify the
variable.
.RE
.VE
.TP
\fBtcl_rcFileName\fR
This variable is used during initialization to indicate the name of a
+1 -5
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: tell.n,v 1.7 2004/10/27 14:43:54 dkf Exp $
'\" RCS: @(#) $Id: tell.n,v 1.7.2.1 2005/04/10 23:14:44 kennykb Exp $
'\"
.so man.macros
.TH tell n 8.1 Tcl "Tcl Built-In Commands"
@@ -19,21 +19,17 @@ tell \- Return current access position for an open channel
.SH DESCRIPTION
.PP
.VS 8.1
Returns an integer string giving the current access position in
\fIchannelId\fR. This value returned is a byte offset that can be passed to
\fBseek\fR in order to set the channel to a particular position. Note
that this value is in terms of bytes, not characters like \fBread\fR.
.VE 8.1
The value returned is -1 for channels that do not support
seeking.
.PP
.VS
\fIChannelId\fR must be an identifier for an open channel such as a
Tcl standard channel (\fBstdin\fR, \fBstdout\fR, or \fBstderr\fR),
the return value from an invocation of \fBopen\fR or \fBsocket\fR, or
the result of a channel creation command provided by a Tcl extension.
.VE
.SH EXAMPLE
Read a line from a file channel only if it starts with \fBfoobar\fR:
.CS
+1 -3
View File
@@ -4,7 +4,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: unload.n,v 1.6 2004/09/18 17:01:06 dkf Exp $
'\" RCS: @(#) $Id: unload.n,v 1.6.2.1 2005/04/10 23:14:44 kennykb Exp $
'\"
.so man.macros
.TH unload n 8.5 Tcl "Tcl Built-In Commands"
@@ -116,9 +116,7 @@ This may be done differently on different platforms.
The default guess, which is used on most UNIX platforms, is to
take the last element of \fIfileName\fR, strip off the first
three characters if they are \fBlib\fR, and use any following
.VS
alphabetic and underline characters as the module name.
.VE
For example, the command \fBunload libxyz4.2.so\fR uses the module
name \fBxyz\fR and the command \fBunload bin/last.so {}\fR uses the
module name \fBlast\fR.
+1 -3
View File
@@ -6,7 +6,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: unset.n,v 1.8 2004/10/27 14:43:54 dkf Exp $
'\" RCS: @(#) $Id: unset.n,v 1.8.2.1 2005/04/10 23:14:44 kennykb Exp $
'\"
.so man.macros
.TH unset n 8.4 Tcl "Tcl Built-In Commands"
@@ -28,13 +28,11 @@ element is removed without affecting the rest of the array.
If a \fIname\fR consists of an array name with no parenthesized
index, then the entire array is deleted.
The \fBunset\fR command returns an empty string as result.
.VS 8.4
If \fI\-nocomplain\fR is specified as the first argument, any possible
errors are suppressed. The option may not be abbreviated, in order to
disambiguate it from possible variable names. The option \fI\-\-\fR
indicates the end of the options, and should be used if you wish to
remove a variable with the same name as any of the options.
.VE 8.4
If an error occurs, any variables after the named one causing the error not
deleted. An error can occur when the named variable doesn't exist, or the
name refers to an array element but the variable is a scalar, or the name
+1 -3
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: upvar.n,v 1.10 2004/11/12 11:03:16 dkf Exp $
'\" RCS: @(#) $Id: upvar.n,v 1.10.2.1 2005/04/10 23:14:44 kennykb Exp $
'\"
.so man.macros
.TH upvar n "" Tcl "Tcl Built-In Commands"
@@ -68,7 +68,6 @@ the outermost procedure call or the outermost \fBnamespace eval\fR command.
Also, \fBuplevel #0\fR evaluates a script
at top-level in the outermost namespace (the global namespace).
.PP
.VS
If an upvar variable is unset (e.g. \fBx\fR in \fBadd2\fR above), the
\fBunset\fR operation affects the variable it is linked to, not the
upvar variable. There is no way to unset an upvar variable except
@@ -101,7 +100,6 @@ traces set for the entire array will not be invoked when \fImyVar\fR
is accessed (but traces on the particular element will still be
invoked). In particular, if the array is \fBenv\fR, then changes
made to \fImyVar\fR will not be passed to subprocesses correctly.
.VE
.SH EXAMPLE
A \fBdecr\fR command that works like \fBincr\fR except it subtracts
the value from the variable instead of adding it:
+2 -2
View File
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: variable.n,v 1.6 2004/10/27 14:43:54 dkf Exp $
'\" RCS: @(#) $Id: variable.n,v 1.6.2.1 2005/03/02 21:25:20 kennykb Exp $
'\"
.so man.macros
.TH variable n 8.0 Tcl "Tcl Built-In Commands"
@@ -43,7 +43,7 @@ command, but not to the \fBinfo exists\fR command.
If the \fBvariable\fR command is executed inside a Tcl procedure,
it creates local variables
linked to the corresponding namespace variables (and therefore these
variables are listed by \fBinfo locals\fR.)
variables are listed by \fBinfo vars\fR.)
In this way the \fBvariable\fR command resembles the \fBglobal\fR command,
although the \fBglobal\fR command
only links to variables in the global namespace.

Some files were not shown because too many files have changed in this diff Show More