Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | merge memopt-perf-branch (conflicts resolved) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | sebres-on-dmnd-resolver-perf-branch |
Files: | files | file ages | folders |
SHA3-256: |
9fed574716cd1d4d96a1aefcaf7b674d |
User & Date: | sebres 2019-09-26 13:52:54.882 |
Context
2019-10-15
| ||
13:02 | merge trunk (and integrated sebres-memopt-perf-branch) check-in: 635fe4b82e user: sebres tags: sebres-on-dmnd-resolver-perf-branch | |
2019-09-26
| ||
13:52 | merge memopt-perf-branch (conflicts resolved) check-in: 9fed574716 user: sebres tags: sebres-on-dmnd-resolver-perf-branch | |
2019-09-24
| ||
16:09 | Adapt ItclMemberFunct struct to new management. check-in: 327e4852c1 user: dgp tags: sebres-memopt-perf-branch | |
2019-07-25
| ||
19:04 | merge trunk check-in: b99e734c77 user: sebres tags: sebres-on-dmnd-resolver-perf-branch | |
Changes
Changes to ChangeLog.
︙ | ︙ | |||
57 58 59 60 61 62 63 | * generic/itclMethod.c: again a fix for SF bug #244 to make it work correctly. 2014-02-18 Arnulf P. Wiedemann <[email protected]> * tests/sfbugs.test: added a test file for bugs reported on SF incrtcl tracker. 2014-02-18 Arnulf P. Wiedemann <[email protected]> * generic/itclResolve.c: | | | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | * generic/itclMethod.c: again a fix for SF bug #244 to make it work correctly. 2014-02-18 Arnulf P. Wiedemann <[email protected]> * tests/sfbugs.test: added a test file for bugs reported on SF incrtcl tracker. 2014-02-18 Arnulf P. Wiedemann <[email protected]> * generic/itclResolve.c: * generic/itclObject.c: fix for upvar problem (SF bug #187) in splitting up the trace handlers for this, win, type, self and selfns. Also doing traces for linked variables to one of these. 2014-02-16 Arnulf P. Wiedemann <[email protected]> * generic/itclMethod.c: * generic/itclMigrate2TclCore.h: * generic/itclMigrate2TclCore.c: 2nd fix for uplevel problem (SF bug #250). 2014-02-13 Arnulf P. Wiedemann <[email protected]> |
︙ | ︙ | |||
287 288 289 290 291 292 293 | * generic/itcl.h: * configure, configure.in, Makefile.in: Bump version to 4.0b6 2010-09-26 Miguel Sofer <[email protected]> * itcl/generic/itcl2TclOO.c (Itcl_NRRunCallbacks): Tcl's [Patch 3072080] (a saner NRE): TclNRRunCallbacks lost one | | | 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | * generic/itcl.h: * configure, configure.in, Makefile.in: Bump version to 4.0b6 2010-09-26 Miguel Sofer <[email protected]> * itcl/generic/itcl2TclOO.c (Itcl_NRRunCallbacks): Tcl's [Patch 3072080] (a saner NRE): TclNRRunCallbacks lost one argument. 2010-08-22 Arnulf P.Wiedemann <[email protected]> * itclInt.h, itclObject.c, itclInfo.c: fix for BiInfoHeritageCmd and BiInfoInheritCmd function, if we have no object context 2010-08-17 Jeff Hobbs <[email protected]> |
︙ | ︙ | |||
313 314 315 316 317 318 319 | * itclClass.c: allow variable namespace to exist 2010-05-02 Arnulf P.Wiedemann <[email protected]> * itclClass.c: fix for SF bug #2993540 * itcl2Tcloo.c: fix for SF bug #2993648 * itcl2Tcloo.h: fix for SF bug #2993648 * itclBuiltin.c: added an empty line for beautifying * itclCmd.c: in Itcl_IsObjectCmd if in constructor use the correct ioPtr | | | | 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 | * itclClass.c: allow variable namespace to exist 2010-05-02 Arnulf P.Wiedemann <[email protected]> * itclClass.c: fix for SF bug #2993540 * itcl2Tcloo.c: fix for SF bug #2993648 * itcl2Tcloo.h: fix for SF bug #2993648 * itclBuiltin.c: added an empty line for beautifying * itclCmd.c: in Itcl_IsObjectCmd if in constructor use the correct ioPtr * itclObject.c: in Itcl_ObjectIsa check for contextIoPtr == NULL to avoid segmentation violation 2010-04-21 Arnulf P.Wiedemann <[email protected]> * itclCmd.c: Add missing Tcl_DStringFree for [itcl Bug 2983809] * itclEnsemble.c: * itclObject.c: * itclParse.c: * itclResolve.c: * itclParse.c: better error message when using: public mthod ... instead of public method ... 2010-04-08 Don Porter <[email protected]> * itclInt.h: Add #ifdef guards to attempt inclusion of a unistd.h header file only where one exists. 2010-04-05 Don Porter <[email protected]> * itclTclIntStubsFcn.c: Remove attempt to return value from Itcl_ResetRewriteEnsemle() which is declared |
︙ | ︙ | |||
389 390 391 392 393 394 395 | * itclClass.c: fixed bug which prevented correct error reporting when there was a problem when creating an object, also fixed to use correct NRE calling 2009-10-23 Arnulf P. Wiedemann <[email protected]> | | | | 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 | * itclClass.c: fixed bug which prevented correct error reporting when there was a problem when creating an object, also fixed to use correct NRE calling 2009-10-23 Arnulf P. Wiedemann <[email protected]> * itclMigrate2TclCore.c: added Itcl_GetUplevelCallFrame and Itcl_ActivateCallFrame functions same as in Itcl3.4. They are needed to call the itk_component command with the suitable call frame as this is needed for access to the proc local vars. This was the fix for SF bug #2840994 * itclStubInit.c: * itcl.decls: * itclDecls.h: * itclIntDecls.h: * itclResolve.c: added special_resolve_vars. Also needed |
︙ | ︙ | |||
474 475 476 477 478 479 480 | 2009-03-19 Jeff Hobbs <[email protected]> * generic/itclBase.c: reduce size of initScript to satisfy MSVC6. 2008-02-21 Arnulf P. Wiedemann <[email protected]> * fix for SF bug 2595708 itclParse.c and itclBuiltin.c | | | 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 | 2009-03-19 Jeff Hobbs <[email protected]> * generic/itclBase.c: reduce size of initScript to satisfy MSVC6. 2008-02-21 Arnulf P. Wiedemann <[email protected]> * fix for SF bug 2595708 itclParse.c and itclBuiltin.c * fix for problem with scope command path reported by * Harald Krummeck on c.l.t ItclCmd.c 2008-02-02 Arnulf P. Wiedemann <[email protected]> * generic/itcl.h configure.in: bumped version to 4.0b3 2008-02-01 Arnulf P. Wiedemann <[email protected]> * tests/widgetadaptor.test and tests/widgetclass.test: removed package require Tk to avoid running the tests |
︙ | ︙ | |||
500 501 502 503 504 505 506 | * generic/itclHelpers.c:here one can find all the *Dict*Info functions * library/ictlHullCmds.tcl: here are similar funtions to itclWidget.tcl for use by ::itcl::extendedclass | | | | | | | | | | | | | 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 | * generic/itclHelpers.c:here one can find all the *Dict*Info functions * library/ictlHullCmds.tcl: here are similar funtions to itclWidget.tcl for use by ::itcl::extendedclass * generic/itclUtil.c: malloc.h include now bracketed with #ifdef ITCL_PRESERVE_DEBUG as it is only used for debugging. I have to look for a solution using memory.h as a portable version, but for that I have to understand that first. With #ifdef ITCL_PRESERVE_DEBUG, the malloc and free calls can be used again, these are necessary, as im am checking stuff done by ckalloc and ckfree, so these cannot be used. 2009-01-15 David Gravereaux <[email protected]> * generic/itcl2TclOO.h: More cleanups changing the last of the * generic/itclClass.c: 'EXTERN' macros to just be 'extern' as we * win/.cvsignore: aren't importing the declaration, just * win/itcl.rc: sharing it internally. This caused warnings * win/makefile.vc: on windows during the link stage as it was * win/nmakehlp.c: getting confused about 'why are you * win/rules.vc: importing an internal function?' 2009-01-15 David Gravereaux <[email protected]> * generic/itclMigrate2TclCore.h: All build errors squashed * generic/itclStubLib.c: * generic/itclTclIntStubFcn.h: * win/makefile.vc: 2009-01-14 David Gravereaux <[email protected]> * generic/itclBase.c: * generic/itclBuiltin.c: * generic/itclClass.c: * generic/itclCmd.c: * generic/itclEnsemble.c: * generic/itclHelpers.c: * generic/itclInfo.c: * generic/itclMethod.c: * generic/itclMigrate2TclCore.c: * generic/itclObject.c: * generic/itclParse.c: * generic/itclResolve.c * generic/itclStubs.c * generic/itclTclIntStubsFcn.c: * win/makefile.vc: Changes to allow compiling on windows with MSVC++. Double declaration of internal functions not yet repaired. DOESN'T BUILD YET with makefile.vc. 2009-01-14 Daniel A. Steffen <[email protected]> * Makefile.in: fix itclConfig.sh install location to match TEA convention * aclocal.m4: match minimum autoconf requirement with TEA * configure: autoconf-2.59 * generic/itclUtil.c: fix Mac OS X build failure (dkf) [Bug 2505545] 2008-12-11 Arnulf P. Wiedemann <[email protected]> * itcl-ng first beta release 4.0b1 2008-12-06 Arnulf P. Wiedemann <[email protected]> * built enhanced functions for chasing memory leaks in adding * functionality to the functions available in Tcl core * and fixed a lot of leaks of that class 2008-11-30 Arnulf P. Wiedemann <[email protected]> * built functions for chasing memory leaks and fixed a lot of those 2008-11-16 Arnulf P. Wiedemann <[email protected]> * second alpha release 4.0a1 2008-11-14 Arnulf P. Wiedemann <[email protected]> * 207 tests for snit like functionality running |
︙ | ︙ |
Changes to Makefile.in.
︙ | ︙ | |||
137 138 139 140 141 142 143 | PATH="$(EXTRA_PATH):$(PATH)" \ ITCL_LIBRARY=`@CYGPATH@ $(srcdir)/library` \ TCLLIBPATH="$(TCLLIBPATH)" TCLSH_PROG = @TCLSH_PROG@ TCLSH = $(TCLSH_ENV) $(PKG_ENV) $(TCLSH_PROG) | | | | 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | PATH="$(EXTRA_PATH):$(PATH)" \ ITCL_LIBRARY=`@CYGPATH@ $(srcdir)/library` \ TCLLIBPATH="$(TCLLIBPATH)" TCLSH_PROG = @TCLSH_PROG@ TCLSH = $(TCLSH_ENV) $(PKG_ENV) $(TCLSH_PROG) TESTLOADARG = if {[catch {package present ${PACKAGE_NAME}}]} {package forget ${PACKAGE_NAME}}; \ package ifneeded ${PACKAGE_NAME} ${PACKAGE_VERSION} \ [list load `@CYGPATH@ $(top_builddir)/$(PKG_LIB_FILE)` $(PACKAGE_NAME)] #WISH_ENV = TK_LIBRARY=`@CYGPATH@ $(TK_SRC_DIR)/library` #WISH_PROG = @WISH_PROG@ #WISH = $(PKG_ENV) $(TCLSH_ENV) $(WISH_ENV) $(WISH_PROG) SHARED_BUILD = @SHARED_BUILD@ STUBS_BUILD = @STUBS_BUILD@ |
︙ | ︙ | |||
254 255 256 257 258 259 260 | shell: binaries libraries @$(TCLSH) $(SCRIPT) gdb: $(TCLSH_ENV) $(PKG_ENV) $(GDB) $(TCLSH_PROG) $(SCRIPT) | | | 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | shell: binaries libraries @$(TCLSH) $(SCRIPT) gdb: $(TCLSH_ENV) $(PKG_ENV) $(GDB) $(TCLSH_PROG) $(SCRIPT) gdb-test: binaries libraries $(TCLSH_ENV) $(PKG_ENV) $(GDB) \ --args $(TCLSH_PROG) `@CYGPATH@ $(srcdir)/tests/all.tcl` \ $(TESTFLAGS) -singleproc 1 -load "$(TESTLOADARG)" valgrind: binaries libraries $(TCLSH_ENV) $(PKG_ENV) $(VALGRIND) $(VALGRINDARGS) $(TCLSH_PROG) \ `@CYGPATH@ $(srcdir)/tests/all.tcl` $(TESTFLAGS) |
︙ | ︙ |
Changes to README.
1 2 3 4 5 6 7 8 9 10 11 12 13 | README: Itcl This is the 4.1.2 source distribution of Itcl, an object oriented extension for Tcl. Itcl releases are available from Sourceforge at: https://sourceforge.net/projects/incrtcl/files/%5Bincr%20Tcl_Tk%5D-4-source/ 1. Introduction This directory contains the source code, documentation, and test scripts for the itcl extension. This version is the next major release to follow Itcl 3.4. This version claims to be script level compatible with Itcl 3.4. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | README: Itcl This is the 4.1.2 source distribution of Itcl, an object oriented extension for Tcl. Itcl releases are available from Sourceforge at: https://sourceforge.net/projects/incrtcl/files/%5Bincr%20Tcl_Tk%5D-4-source/ 1. Introduction This directory contains the source code, documentation, and test scripts for the itcl extension. This version is the next major release to follow Itcl 3.4. This version claims to be script level compatible with Itcl 3.4. Itcl is a freely-available open source package as in the past. You can do virtually anything you like with it, such as modifying it, redistributing it, and selling it either in whole or in part. See the file "license.terms" for complete information. 2. Compiling and Installing. Itcl is built in much the same way that Tcl itself is. Once you have |
︙ | ︙ |
Changes to configure.
︙ | ︙ | |||
2168 2169 2170 2171 2172 2173 2174 | # If the user did not set CFLAGS, set it now to keep macros # like AC_PROG_CC and AC_TRY_COMPILE from adding "-g -O2". if test "${CFLAGS+set}" != "set" ; then CFLAGS="" fi case "`uname -s`" in | | | 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 | # If the user did not set CFLAGS, set it now to keep macros # like AC_PROG_CC and AC_TRY_COMPILE from adding "-g -O2". if test "${CFLAGS+set}" != "set" ; then CFLAGS="" fi case "`uname -s`" in *win32*|*WIN32*|*MINGW32_*|*MINGW64_*|*MSYS_*) # Extract the first word of "cygpath", so it can be a program name with args. set dummy cygpath; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CYGPATH+:} false; then : $as_echo_n "(cached) " >&6 else |
︙ | ︙ | |||
7398 7399 7400 7401 7402 7403 7404 | # standard manufacturer compiler. if test "$GCC" = yes; then : case $system in AIX-*) ;; BSD/OS*) ;; | | | 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 | # standard manufacturer compiler. if test "$GCC" = yes; then : case $system in AIX-*) ;; BSD/OS*) ;; CYGWIN_*|MINGW32_*|MINGW64_*|MSYS_*) ;; IRIX*) ;; NetBSD-*|DragonFly-*|FreeBSD-*|OpenBSD-*) ;; Darwin-*) ;; SCO_SV-3.2*) ;; windows) ;; *) SHLIB_CFLAGS="-fPIC" ;; esac |
︙ | ︙ |
Changes to configure.ac.
︙ | ︙ | |||
219 220 221 222 223 224 225 | AC_CHECK_TYPE([intptr_t], [ AC_DEFINE([HAVE_INTPTR_T], 1, [Do we have the intptr_t type?])], [ AC_CACHE_CHECK([for pointer-size signed integer type], tcl_cv_intptr_t, [ for tcl_cv_intptr_t in "int" "long" "long long" none; do if test "$tcl_cv_intptr_t" != none; then AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT], | | | 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | AC_CHECK_TYPE([intptr_t], [ AC_DEFINE([HAVE_INTPTR_T], 1, [Do we have the intptr_t type?])], [ AC_CACHE_CHECK([for pointer-size signed integer type], tcl_cv_intptr_t, [ for tcl_cv_intptr_t in "int" "long" "long long" none; do if test "$tcl_cv_intptr_t" != none; then AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT], [[sizeof (void *) <= sizeof ($tcl_cv_intptr_t)]])], [tcl_ok=yes], [tcl_ok=no]) test "$tcl_ok" = yes && break; fi done]) if test "$tcl_cv_intptr_t" != none; then AC_DEFINE_UNQUOTED([intptr_t], [$tcl_cv_intptr_t], [Signed integer type wide enough to hold a pointer.]) fi |
︙ | ︙ |
Changes to doc/class.n.
︙ | ︙ | |||
403 404 405 406 407 408 409 | .CS itcl::class Toaster { variable crumbs 0 method toast {nslices} { if {$crumbs > 50} { error "== FIRE! FIRE! ==" } | | | 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 | .CS itcl::class Toaster { variable crumbs 0 method toast {nslices} { if {$crumbs > 50} { error "== FIRE! FIRE! ==" } set crumbs [expr {$crumbs+4*$nslices}] } method clean {} { set crumbs 0 } } .CE .PP |
︙ | ︙ |
Changes to doc/ensemble.n.
1 2 3 4 5 | '\" '\" Copyright (c) 1993-1998 Lucent Technologies, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | '\" '\" Copyright (c) 1993-1998 Lucent Technologies, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH ensemble n 3.0 itcl "[incr\ Tcl]" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME itcl::ensemble \- create or modify a composite command .SH SYNOPSIS |
︙ | ︙ |
Changes to doc/is.n.
︙ | ︙ | |||
29 30 31 32 33 34 35 | \fBis class \fIcommand\fR . Returns 1 if command is a class, and returns 0 otherwise. .RS .PP The fully qualified name of the class needs to be given as the \fIcommand\fR argument. So, if a class resides in a namespace, then the namespace needs to | | | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | \fBis class \fIcommand\fR . Returns 1 if command is a class, and returns 0 otherwise. .RS .PP The fully qualified name of the class needs to be given as the \fIcommand\fR argument. So, if a class resides in a namespace, then the namespace needs to be specified as well. So, if a class \fBC\fR resides in a namespace \fBN\fR, then the command should be called like: .PP .CS \fBis N::C\fR or \fBis ::N::C\fR .CE |
︙ | ︙ |
Changes to doc/itcldelegate.n.
︙ | ︙ | |||
60 61 62 63 64 65 66 | The optional \fBas\fR clause allows you to specify the delegated method name and possibly add some arguments: .PP .CS delegate method wagtail to tail as "wag briskly" .CE .PP | | | | | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | The optional \fBas\fR clause allows you to specify the delegated method name and possibly add some arguments: .PP .CS delegate method wagtail to tail as "wag briskly" .CE .PP A method cannot be both locally defined and delegated. .RE .TP \fBdelegate method \fImethodName\fR ?\fBto \fIcomponentName\fR? \fBusing \fIpattern\fR . In this form of the delegate statement, the \fBusing\fR clause is used to specify the precise form of the command to which method name name is delegated. The \fBto\fR clause is optional, since the chosen command might not involve any particular component. .RS .PP The value of the using clause is a list that may contain any or all of the following substitution codes; these codes are substituted with the described value to build the delegated command prefix. Note that the following two statements are equivalent: .PP .CS delegate method wag to tail delegate method wag to tail using "%c %m" .CE .PP Each element of the list becomes a single element of the delegated command --it is never reparsed as a string. .PP Substitutions: .TP \fB%%\fR . This is replaced with a single "%". Thus, to pass the string "%c" to the command as an argument, you'd write "%%c". .TP \fB%c\fR . This is replaced with the named component's command. .TP \fB%j\fR . This is replaced by the method name; if the name consists of multiple tokens, they are joined by underscores ("_"). .TP \fB%m\fR |
︙ | ︙ | |||
116 117 118 119 120 121 122 | .TP \fB%n\fR . This is replaced with the name of the instance's private namespace. .TP \fB%s\fR . | | | | 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | .TP \fB%n\fR . This is replaced with the name of the instance's private namespace. .TP \fB%s\fR . This is replaced with the name of the instance command. .TP \fB%t\fR . This is replaced with the fully qualified type name. .TP \fB%w\fR . This is replaced with the original name of the instance command; for Itcl widgets and widget adaptors, it will be the Tk window name. It remains constant, even if the instance command is renamed. .RE |
︙ | ︙ | |||
146 147 148 149 150 151 152 | is "*", as in the following example: .PP .CS delegate method {tail *} to tail .CE .PP This implicitly defines the method tail whose subcommands will be | | | 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | is "*", as in the following example: .PP .CS delegate method {tail *} to tail .CE .PP This implicitly defines the method tail whose subcommands will be delegated to the tail component. .PP The definitions for \fBdelegate proc\fR ... are the same as for method, the only difference being, that this is for procs. .RE .TP \fBdelegate option \fInamespec\fB to \fIcomp\fR .TP |
︙ | ︙ |
Changes to doc/itclextendedclass.n.
︙ | ︙ | |||
416 417 418 419 420 421 422 | .CS itcl::extendedclass Toaster { variable crumbs 0 method toast {nslices} { if {$crumbs > 50} { error "== FIRE! FIRE! ==" } | | | 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 | .CS itcl::extendedclass Toaster { variable crumbs 0 method toast {nslices} { if {$crumbs > 50} { error "== FIRE! FIRE! ==" } set crumbs [expr {$crumbs+4*$nslices}] } method clean {} { set crumbs 0 } } .CE .PP |
︙ | ︙ |
Changes to doc/itcloption.n.
︙ | ︙ | |||
63 64 65 66 67 68 69 | subtle errors. .PP The option statement may include the following options: .TP \fB-default\fI defvalue\fR . Defines the option's default value; the option's default value will be "" | | | | | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | subtle errors. .PP The option statement may include the following options: .TP \fB-default\fI defvalue\fR . Defines the option's default value; the option's default value will be "" otherwise. .TP \fB-readonly\fR . The option is handled read-only -- it can only be set using configure at creation time, i.e., in the type's constructor. .TP \fB-cgetmethod\fI methodName\fR . Every locally-defined option may define a -cgetmethod; it is called when the option's value is retrieved using the cget method. Whatever the method's body returns will be the return value of the call to cget. .RS .PP The named method must take one argument, the option name. For example, this code is equivalent to (though slower than) Itcl's default handling of cget: .PP .CS option -font -cgetmethod GetOption method GetOption {option} { return $itcl_options($option) } .CE .PP Note that it's possible for any number of options to share a -cgetmethod. .RE .TP \fB-cgetmethodvar\fI varName\fR . That is very similar to -cgetmethod, the only difference is, one can define a variable, where to find the cgetmethod during runtime. .TP |
︙ | ︙ | |||
115 116 117 118 119 120 121 | .CS option -font -configuremethod SetOption method SetOption {option value} { set itcl_options($option) $value } .CE .PP | | | 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | .CS option -font -configuremethod SetOption method SetOption {option value} { set itcl_options($option) $value } .CE .PP Note that it's possible for any number of options to share a single -configuremethod. .RE .TP \fB-configuremethodvar\fI varName\fR . That is very similar to -configuremethod, the only difference is, one can define a variable, where to find the configuremethod during runtime. .TP |
︙ | ︙ | |||
144 145 146 147 148 149 150 | method CheckBoolean {option value} { if {![string is boolean -strict $value]} { error "option $option must have a boolean value." } } .CE .PP | | | 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | method CheckBoolean {option value} { if {![string is boolean -strict $value]} { error "option $option must have a boolean value." } } .CE .PP Note that it's possible for any number of options to share a single -validatemethod. .RE .TP \fB-validatemethodvar\fI varName\fR . That is very similar to -validatemethod, the only difference is, one can define a variable, where to find the validatemethod during runtime. .SH KEYWORDS option, widget, widgetadaptor, extendedclass |
Changes to doc/itclwidget.n.
︙ | ︙ | |||
418 419 420 421 422 423 424 | .CS itcl::widget Toaster { variable crumbs 0 method toast {nslices} { if {$crumbs > 50} { error "== FIRE! FIRE! ==" } | | | 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 | .CS itcl::widget Toaster { variable crumbs 0 method toast {nslices} { if {$crumbs > 50} { error "== FIRE! FIRE! ==" } set crumbs [expr {$crumbs+4*$nslices}] } method clean {} { set crumbs 0 } } .CE .PP |
︙ | ︙ |
Changes to doc/scope.n.
︙ | ︙ | |||
15 16 17 18 19 20 21 | .BE .SH DESCRIPTION .PP Creates a scoped value for the specified \fIname\fR, which must be a variable name. If the \fIname\fR is an instance variable, then the scope command returns a name which will resolve in any | | | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | .BE .SH DESCRIPTION .PP Creates a scoped value for the specified \fIname\fR, which must be a variable name. If the \fIname\fR is an instance variable, then the scope command returns a name which will resolve in any context as an instance variable belonging to \fIobject\fR. The precise format of this name is an internal detail to Itcl. Use of such a scoped value makes it possible to use instance variables in conjunction with widgets. For example, if you have an object with a private variable \fCx\fR, and you can use \fCx\fR in conjunction with the \fC-textvariable\fR option of an entry widget. Before itcl3.0, only common variables could be used in this manner. |
︙ | ︙ |
Changes to generic/itcl.decls.
︙ | ︙ | |||
272 273 274 275 276 277 278 | ItclMemberFunc **mfuncPtr) } declare 55 { int Itcl_ChangeMemberFunc(Tcl_Interp *interp, ItclMemberFunc *mfunc, const char *arglist, const char *body) } declare 56 { | | | | 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | ItclMemberFunc **mfuncPtr) } declare 55 { int Itcl_ChangeMemberFunc(Tcl_Interp *interp, ItclMemberFunc *mfunc, const char *arglist, const char *body) } declare 56 { void Itcl_DeleteMemberFunc(void *cdata) } declare 57 { int Itcl_CreateMemberCode(Tcl_Interp *interp, ItclClass *iclsPtr, \ const char *arglist, const char *body, ItclMemberCode **mcodePtr) } declare 58 { void Itcl_DeleteMemberCode(void *cdata) } declare 59 { int Itcl_GetMemberCode(Tcl_Interp *interp, ItclMemberFunc *mfunc) } declare 61 { int Itcl_EvalMemberCode(Tcl_Interp *interp, ItclMemberFunc *mfunc, ItclObject *contextObj, int objc, Tcl_Obj *const objv[]) |
︙ | ︙ |
Changes to generic/itcl.h.
︙ | ︙ | |||
177 178 179 180 181 182 183 | /* * Include all the public API, generated from itcl.decls. */ #include "itclDecls.h" | < < < < < < < < < | 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | /* * Include all the public API, generated from itcl.decls. */ #include "itclDecls.h" #endif /* RC_INVOKED */ /* * end block for C++ */ #ifdef __cplusplus |
︙ | ︙ |
Changes to generic/itcl2TclOO.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | /* * itcl2TclOO.c -- * * This file contains code to create and manage methods. * * Copyright (c) 2007 by Arnulf P. Wiedemann * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include <tclInt.h> #include <tclOOInt.h> #include "itclInt.h" void * Itcl_GetCurrentCallbackPtr( Tcl_Interp *interp) { return TOP_CB(interp); } int Itcl_NRRunCallbacks( Tcl_Interp *interp, void *rootPtr) { | > > > | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | /* * itcl2TclOO.c -- * * This file contains code to create and manage methods. * * Copyright (c) 2007 by Arnulf P. Wiedemann * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include <tclInt.h> #include <tclOOInt.h> #undef FOREACH_HASH_DECLS #undef FOREACH_HASH #undef FOREACH_HASH_VALUE #include "itclInt.h" void * Itcl_GetCurrentCallbackPtr( Tcl_Interp *interp) { return TOP_CB(interp); } int Itcl_NRRunCallbacks( Tcl_Interp *interp, void *rootPtr) { return TclNRRunCallbacks(interp, TCL_OK, (NRE_callback*)rootPtr); } static int CallFinalizePMCall( void *data[], Tcl_Interp *interp, int result) { Tcl_Namespace *nsPtr = (Tcl_Namespace *)data[0]; TclOO_PostCallProc *postCallProc = (TclOO_PostCallProc *)data[1]; void *clientData = data[2]; /* * Give the post-call callback a chance to do some cleanup. Note that at * this point the call frame itself is invalid; it's already been popped. */ return postCallProc(clientData, interp, NULL, nsPtr, result); } static int FreeCommand( void *data[], Tcl_Interp *interp, int result) { Command *cmdPtr = (Command *)data[0]; Proc *procPtr = (Proc *)data[1]; ckfree(cmdPtr); procPtr->cmdPtr = NULL; return result; } |
︙ | ︙ | |||
73 74 75 76 77 78 79 | Proc *procPtr = pmPtr->procPtr; CallFrame *framePtr = NULL; CallFrame **framePtrPtr1 = &framePtr; Tcl_CallFrame **framePtrPtr = (Tcl_CallFrame **)framePtrPtr1; int result; if (procPtr->cmdPtr == NULL) { | | | 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | Proc *procPtr = pmPtr->procPtr; CallFrame *framePtr = NULL; CallFrame **framePtrPtr1 = &framePtr; Tcl_CallFrame **framePtrPtr = (Tcl_CallFrame **)framePtrPtr1; int result; if (procPtr->cmdPtr == NULL) { Command *cmdPtr = (Command *)ckalloc(sizeof(Command)); memset(cmdPtr, 0, sizeof(Command)); cmdPtr->nsPtr = (Namespace *) nsPtr; cmdPtr->clientData = NULL; procPtr->cmdPtr = cmdPtr; Tcl_NRAddCallback(interp, FreeCommand, cmdPtr, procPtr, NULL, NULL); } |
︙ | ︙ | |||
128 129 130 131 132 133 134 | * Now invoke the body of the method. Note that we need to take special * action when doing unknown processing to ensure that the missing method * name is passed as an argument. */ if (pmPtr->postCallProc) { Tcl_NRAddCallback(interp, CallFinalizePMCall, nsPtr, | | | | | | | | 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | * Now invoke the body of the method. Note that we need to take special * action when doing unknown processing to ensure that the missing method * name is passed as an argument. */ if (pmPtr->postCallProc) { Tcl_NRAddCallback(interp, CallFinalizePMCall, nsPtr, (void *)pmPtr->postCallProc, pmPtr->clientData, NULL); } return TclNRInterpProcCore(interp, namePtr, 1, pmPtr->errProc); done: return result; } int Itcl_InvokeProcedureMethod( void *clientData, /* Pointer to some per-method context. */ Tcl_Interp *interp, int objc, /* Number of arguments. */ Tcl_Obj *const *objv) /* Arguments as actually seen. */ { Tcl_Namespace *nsPtr; Method *mPtr; mPtr = (Method *)clientData; if (mPtr->declaringClassPtr == NULL) { /* that is the case for typemethods */ nsPtr = mPtr->declaringObjectPtr->namespacePtr; } else { nsPtr = mPtr->declaringClassPtr->thisPtr->namespacePtr; } return Tcl_InvokeClassProcedureMethod(interp, mPtr->namePtr, nsPtr, (ProcedureMethod *)mPtr->clientData, objc, objv); } static int FreeProcedureMethod( void *data[], Tcl_Interp *interp, int result) { ProcedureMethod *pmPtr = (ProcedureMethod *)data[0]; ckfree(pmPtr); return result; } static void EnsembleErrorProc( Tcl_Interp *interp, |
︙ | ︙ | |||
193 194 195 196 197 198 199 | Tcl_Interp *interp, Tcl_Namespace *nsPtr, /* namespace to call the method in */ Tcl_Obj *namePtr, /* name of the method */ Tcl_Proc *procPtr, int objc, /* Number of arguments. */ Tcl_Obj *const *objv) /* Arguments as actually seen. */ { | | | 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | Tcl_Interp *interp, Tcl_Namespace *nsPtr, /* namespace to call the method in */ Tcl_Obj *namePtr, /* name of the method */ Tcl_Proc *procPtr, int objc, /* Number of arguments. */ Tcl_Obj *const *objv) /* Arguments as actually seen. */ { ProcedureMethod *pmPtr = (ProcedureMethod *)ckalloc(sizeof(ProcedureMethod)); memset(pmPtr, 0, sizeof(ProcedureMethod)); pmPtr->version = TCLOO_PROCEDURE_METHOD_VERSION; pmPtr->procPtr = (Proc *)procPtr; pmPtr->flags = USE_DECLARER_NS; pmPtr->errProc = EnsembleErrorProc; |
︙ | ︙ | |||
221 222 223 224 225 226 227 | * function that does call chain creation, management and invokation. * * ---------------------------------------------------------------------- */ int Itcl_PublicObjectCmd( | | | 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | * function that does call chain creation, management and invokation. * * ---------------------------------------------------------------------- */ int Itcl_PublicObjectCmd( void *clientData, Tcl_Interp *interp, Tcl_Class clsPtr, int objc, Tcl_Obj *const *objv) { Tcl_Object oPtr = (Tcl_Object)clientData; int result; |
︙ | ︙ | |||
252 253 254 255 256 257 258 | Tcl_Method Itcl_NewProcClassMethod( Tcl_Interp *interp, /* The interpreter containing the class. */ Tcl_Class clsPtr, /* The class to modify. */ TclOO_PreCallProc *preCallPtr, TclOO_PostCallProc *postCallPtr, ProcErrorProc *errProc, | | | | 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | Tcl_Method Itcl_NewProcClassMethod( Tcl_Interp *interp, /* The interpreter containing the class. */ Tcl_Class clsPtr, /* The class to modify. */ TclOO_PreCallProc *preCallPtr, TclOO_PostCallProc *postCallPtr, ProcErrorProc *errProc, void *clientData, Tcl_Obj *nameObj, /* The name of the method, which may be NULL; * if so, up to caller to manage storage * (e.g., because it is a constructor or * destructor). */ Tcl_Obj *argsObj, /* The formal argument list for the method, * which may be NULL; if so, it is equivalent * to an empty list. */ Tcl_Obj *bodyObj, /* The body of the method, which must not be * NULL. */ void **clientData2) { Tcl_Method result; result = TclOONewProcMethodEx(interp, clsPtr, preCallPtr, postCallPtr, errProc, clientData, nameObj, argsObj, bodyObj, PUBLIC_METHOD | USE_DECLARER_NS, clientData2); return result; |
︙ | ︙ | |||
289 290 291 292 293 294 295 | Tcl_Method Itcl_NewProcMethod( Tcl_Interp *interp, /* The interpreter containing the object. */ Tcl_Object oPtr, /* The object to modify. */ TclOO_PreCallProc *preCallPtr, TclOO_PostCallProc *postCallPtr, ProcErrorProc *errProc, | | | | 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | Tcl_Method Itcl_NewProcMethod( Tcl_Interp *interp, /* The interpreter containing the object. */ Tcl_Object oPtr, /* The object to modify. */ TclOO_PreCallProc *preCallPtr, TclOO_PostCallProc *postCallPtr, ProcErrorProc *errProc, void *clientData, Tcl_Obj *nameObj, /* The name of the method, which must not be * NULL. */ Tcl_Obj *argsObj, /* The formal argument list for the method, * which must not be NULL. */ Tcl_Obj *bodyObj, /* The body of the method, which must not be * NULL. */ void **clientData2) { return TclOONewProcInstanceMethodEx(interp, oPtr, preCallPtr, postCallPtr, errProc, clientData, nameObj, argsObj, bodyObj, PUBLIC_METHOD | USE_DECLARER_NS, clientData2); } /* |
︙ | ︙ | |||
345 346 347 348 349 350 351 | Tcl_IncrRefCount(namePtr); oPtr->cachedNameObj = namePtr; return namePtr; } int Itcl_SelfCmd( | | | | 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | Tcl_IncrRefCount(namePtr); oPtr->cachedNameObj = namePtr; return namePtr; } int Itcl_SelfCmd( void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) { Interp *iPtr = (Interp *) interp; CallFrame *framePtr = iPtr->varFramePtr; CallContext *contextPtr; if (!Itcl_IsMethodCallFrame(interp)) { Tcl_AppendResult(interp, TclGetString(objv[0]), " may only be called from inside a method", NULL); return TCL_ERROR; } contextPtr = (CallContext *)framePtr->clientData; if (objc == 1) { Tcl_SetObjResult(interp, Itcl_TclOOObjectName(interp, contextPtr->oPtr)); return TCL_OK; } return TCL_ERROR; } |
︙ | ︙ |
Changes to generic/itclBase.c.
︙ | ︙ | |||
9 10 11 12 13 14 15 | * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include <stdlib.h> #include "itclInt.h" | | < < < < | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include <stdlib.h> #include "itclInt.h" static Tcl_NamespaceDeleteProc FreeItclObjectInfo; static Tcl_ObjCmdProc ItclSetHullWindowName; static Tcl_ObjCmdProc ItclCheckSetItclHull; MODULE_SCOPE const ItclStubs itclStubs; static int Initialize(Tcl_Interp *interp); static const char initScript[] = "namespace eval ::itcl {\n" " proc _find_init {} {\n" |
︙ | ︙ | |||
95 96 97 98 99 100 101 | " ::tailcall ::itcl::parser::handleClass [::lindex [::info level 0] 0] [self] {*}$args\n" " }\n" " unexport create new unknown\n" "}"; #define ITCL_IS_ENSEMBLE 0x1 | < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | " ::tailcall ::itcl::parser::handleClass [::lindex [::info level 0] 0] [self] {*}$args\n" " }\n" " unexport create new unknown\n" "}"; #define ITCL_IS_ENSEMBLE 0x1 #ifdef ITCL_DEBUG_C_INTERFACE extern void RegisterDebugCFunctions( Tcl_Interp * interp); #endif static Tcl_ObjectMetadataDeleteProc Demolition; static const Tcl_ObjectMetadataType canary = { TCL_OO_METADATA_VERSION_CURRENT, "Itcl Foundations", Demolition, NULL }; void Demolition( void *clientData) { ItclObjectInfo *infoPtr = (ItclObjectInfo *)clientData; infoPtr->clazzObjectPtr = NULL; infoPtr->clazzClassPtr = NULL; } |
︙ | ︙ | |||
165 166 167 168 169 170 171 | RootCallProc, NULL, NULL }; static int RootCallProc( | | | < < < < < < < < < < < < < < < < < < | 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | RootCallProc, NULL, NULL }; static int RootCallProc( void *clientData, Tcl_Interp *interp, Tcl_ObjectContext context, int objc, Tcl_Obj *const *objv) { Tcl_Object oPtr = Tcl_ObjectContextObject(context); ItclObject *ioPtr = (ItclObject *)Tcl_ObjectGetMetadata(oPtr, &objMDT); ItclRootMethodProc *proc = (ItclRootMethodProc *)clientData; return (*proc)(ioPtr, interp, objc, objv); } /* * ------------------------------------------------------------------------ * Initialize() * * that is the starting point when loading the library * it initializes all internal stuff |
︙ | ︙ | |||
240 241 242 243 244 245 246 | clazzObjectPtr = Tcl_GetObjectFromObj(interp, objPtr); if (!clazzObjectPtr || !(tclCls = Tcl_GetObjectAsClass(clazzObjectPtr))) { Tcl_DecrRefCount(objPtr); return TCL_ERROR; } Tcl_DecrRefCount(objPtr); | | | | < < < < < < < < < < < < < | 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | clazzObjectPtr = Tcl_GetObjectFromObj(interp, objPtr); if (!clazzObjectPtr || !(tclCls = Tcl_GetObjectAsClass(clazzObjectPtr))) { Tcl_DecrRefCount(objPtr); return TCL_ERROR; } Tcl_DecrRefCount(objPtr); infoPtr = (ItclObjectInfo*)Itcl_Alloc(sizeof(ItclObjectInfo)); nsPtr = Tcl_CreateNamespace(interp, ITCL_NAMESPACE, infoPtr, FreeItclObjectInfo); if (nsPtr == NULL) { Itcl_Free(infoPtr); Tcl_Panic("Itcl: cannot create namespace: \"%s\" \n", ITCL_NAMESPACE); } nsPtr = Tcl_CreateNamespace(interp, ITCL_INTDICTS_NAMESPACE, NULL, NULL); if (nsPtr == NULL) { Itcl_Free(infoPtr); Tcl_Panic("Itcl: cannot create namespace: \"%s::internal::dicts\" \n", ITCL_NAMESPACE); } /* * Create the top-level data structure for tracking objects. * Store this as "associated data" for easy access, but link * it to the itcl namespace for ownership. */ infoPtr->interp = interp; infoPtr->class_meta_type = (Tcl_ObjectMetadataType *)ckalloc( sizeof(Tcl_ObjectMetadataType)); infoPtr->class_meta_type->version = TCL_OO_METADATA_VERSION_CURRENT; infoPtr->class_meta_type->name = "ItclClass"; infoPtr->class_meta_type->deleteProc = ItclDeleteClassMetadata; infoPtr->class_meta_type->cloneProc = NULL; infoPtr->object_meta_type = &objMDT; Tcl_InitHashTable(&infoPtr->objects, TCL_ONE_WORD_KEYS); Tcl_InitHashTable(&infoPtr->objectCmds, TCL_ONE_WORD_KEYS); Tcl_InitHashTable(&infoPtr->classes, TCL_ONE_WORD_KEYS); Tcl_InitObjHashTable(&infoPtr->nameClasses); Tcl_InitHashTable(&infoPtr->namespaceClasses, TCL_ONE_WORD_KEYS); Tcl_InitHashTable(&infoPtr->procMethods, TCL_ONE_WORD_KEYS); Tcl_InitHashTable(&infoPtr->instances, TCL_STRING_KEYS); Tcl_InitHashTable(&infoPtr->frameContext, TCL_ONE_WORD_KEYS); Tcl_InitObjHashTable(&infoPtr->classTypes); infoPtr->ensembleInfo = (EnsembleInfo *)ckalloc(sizeof(EnsembleInfo)); memset(infoPtr->ensembleInfo, 0, sizeof(EnsembleInfo)); Tcl_InitHashTable(&infoPtr->ensembleInfo->ensembles, TCL_ONE_WORD_KEYS); Tcl_InitHashTable(&infoPtr->ensembleInfo->subEnsembles, TCL_ONE_WORD_KEYS); infoPtr->ensembleInfo->numEnsembles = 0; infoPtr->protection = ITCL_DEFAULT_PROTECT; |
︙ | ︙ | |||
345 346 347 348 349 350 351 | opt = 1; } else { opt = atoi(res_option); } infoPtr->useOldResolvers = opt; Itcl_InitStack(&infoPtr->clsStack); | | | | | | | 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | opt = 1; } else { opt = atoi(res_option); } infoPtr->useOldResolvers = opt; Itcl_InitStack(&infoPtr->clsStack); Tcl_SetAssocData(interp, ITCL_INTERP_DATA, NULL, infoPtr); Itcl_PreserveData(infoPtr); root = Tcl_NewObjectInstance(interp, tclCls, "::itcl::Root", NULL, 0, NULL, 0); Tcl_NewMethod(interp, Tcl_GetObjectAsClass(root), Tcl_NewStringObj("unknown", -1), 0, &itclRootMethodType, (void *)ItclUnknownGuts); Tcl_NewMethod(interp, Tcl_GetObjectAsClass(root), Tcl_NewStringObj("ItclConstructBase", -1), 0, &itclRootMethodType, (void *)ItclConstructGuts); Tcl_NewMethod(interp, Tcl_GetObjectAsClass(root), Tcl_NewStringObj("info", -1), 1, &itclRootMethodType, (void *)ItclInfoGuts); /* first create the Itcl base class as root of itcl classes */ if (Tcl_EvalEx(interp, clazzClassScript, -1, 0) != TCL_OK) { Tcl_Panic("cannot create Itcl root class ::itcl::clazz"); } resPtr = Tcl_GetObjResult(interp); /* |
︙ | ︙ | |||
410 411 412 413 414 415 416 | return TCL_ERROR; } /* * Export all commands in the "itcl" namespace so that they * can be imported with something like "namespace import itcl::*" */ | | | 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 | return TCL_ERROR; } /* * Export all commands in the "itcl" namespace so that they * can be imported with something like "namespace import itcl::*" */ itclNs = Tcl_FindNamespace(interp, "::itcl", NULL, TCL_LEAVE_ERR_MSG); /* * This was changed from a glob export (itcl::*) to explicit * command exports, so that the itcl::is command can *not* be * exported. This is done for concern that the itcl::is command * imported might be confusing ("is"). |
︙ | ︙ | |||
454 455 456 457 458 459 460 | Tcl_SetVar2(interp, "::itcl::version", NULL, ITCL_VERSION, TCL_NAMESPACE_ONLY); Tcl_SetVar2(interp, "::itcl::patchLevel", NULL, ITCL_PATCH_LEVEL, TCL_NAMESPACE_ONLY); #ifdef ITCL_DEBUG_C_INTERFACE RegisterDebugCFunctions(interp); | | | 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 | Tcl_SetVar2(interp, "::itcl::version", NULL, ITCL_VERSION, TCL_NAMESPACE_ONLY); Tcl_SetVar2(interp, "::itcl::patchLevel", NULL, ITCL_PATCH_LEVEL, TCL_NAMESPACE_ONLY); #ifdef ITCL_DEBUG_C_INTERFACE RegisterDebugCFunctions(interp); #endif /* * Package is now loaded. */ Tcl_PkgProvideEx(interp, "Itcl", ITCL_PATCH_LEVEL, &itclStubs); return Tcl_PkgProvideEx(interp, "itcl", ITCL_PATCH_LEVEL, &itclStubs); } |
︙ | ︙ | |||
524 525 526 527 528 529 530 | * ItclSetHullWindowName() * * * ------------------------------------------------------------------------ */ static int ItclSetHullWindowName( | | | 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 | * ItclSetHullWindowName() * * * ------------------------------------------------------------------------ */ static int ItclSetHullWindowName( void *clientData, /* infoPtr */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { ItclObjectInfo *infoPtr; infoPtr = (ItclObjectInfo *)clientData; |
︙ | ︙ | |||
548 549 550 551 552 553 554 | * ItclCheckSetItclHull() * * * ------------------------------------------------------------------------ */ static int ItclCheckSetItclHull( | | | | 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 | * ItclCheckSetItclHull() * * * ------------------------------------------------------------------------ */ static int ItclCheckSetItclHull( void *clientData, /* infoPtr */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { Tcl_HashEntry *hPtr; Tcl_Obj *objPtr; ItclObject *ioPtr; ItclVariable *ivPtr; ItclObjectInfo *infoPtr; const char *valueStr; if (objc < 3) { Tcl_AppendResult(interp, "ItclCheckSetItclHull wrong # args should be ", "<objectName> <value>", NULL); return TCL_ERROR; } /* * This is an internal command, and is never called with an * objectName value other than the empty list. Check that with * an assertion so alternative handling can be removed. */ assert( strlen(Tcl_GetString(objv[1])) == 0); infoPtr = (ItclObjectInfo *)clientData; { |
︙ | ︙ | |||
589 590 591 592 593 594 595 | hPtr = Tcl_FindHashEntry(&ioPtr->iclsPtr->variables, (char *)objPtr); Tcl_DecrRefCount(objPtr); if (hPtr == NULL) { Tcl_AppendResult(interp, "ItclCheckSetItclHull cannot find itcl_hull", " variable for object \"", Tcl_GetString(objv[1]), "\"", NULL); return TCL_ERROR; } | | | | < | < < < < < < < < < < < < < | < < | < | < < < | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < | < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 | hPtr = Tcl_FindHashEntry(&ioPtr->iclsPtr->variables, (char *)objPtr); Tcl_DecrRefCount(objPtr); if (hPtr == NULL) { Tcl_AppendResult(interp, "ItclCheckSetItclHull cannot find itcl_hull", " variable for object \"", Tcl_GetString(objv[1]), "\"", NULL); return TCL_ERROR; } ivPtr = (ItclVariable *)Tcl_GetHashValue(hPtr); valueStr = Tcl_GetString(objv[2]); if (strcmp(valueStr, "2") == 0) { ivPtr->initted = 2; } else { if (strcmp(valueStr, "0") == 0) { ivPtr->initted = 0; } else { Tcl_AppendResult(interp, "ItclCheckSetItclHull bad value \"", valueStr, "\"", NULL); return TCL_ERROR; } } return TCL_OK; } /* * ------------------------------------------------------------------------ * FreeItclObjectInfo() * * called when an interp is deleted to free up memory * * ------------------------------------------------------------------------ */ static void FreeItclObjectInfo( void *clientData) { ItclObjectInfo *infoPtr = (ItclObjectInfo *)clientData; Tcl_DeleteHashTable(&infoPtr->instances); Tcl_DeleteHashTable(&infoPtr->classTypes); Tcl_DeleteHashTable(&infoPtr->procMethods); Tcl_DeleteHashTable(&infoPtr->objectCmds); Tcl_DeleteHashTable(&infoPtr->classes); Tcl_DeleteHashTable(&infoPtr->nameClasses); Tcl_DeleteHashTable(&infoPtr->namespaceClasses); assert (infoPtr->infoVarsPtr == NULL); assert (infoPtr->infoVars4Ptr == NULL); if (infoPtr->typeDestructorArgumentPtr) { Tcl_DecrRefCount(infoPtr->typeDestructorArgumentPtr); infoPtr->typeDestructorArgumentPtr = NULL; } /* cleanup ensemble info */ if (infoPtr->ensembleInfo) { Tcl_DeleteHashTable(&infoPtr->ensembleInfo->ensembles); Tcl_DeleteHashTable(&infoPtr->ensembleInfo->subEnsembles); ItclFinishEnsemble(infoPtr); ckfree((char *)infoPtr->ensembleInfo); infoPtr->ensembleInfo = NULL; } if (infoPtr->class_meta_type) { ckfree((char *)infoPtr->class_meta_type); infoPtr->class_meta_type = NULL; } /* clean up list pool */ Itcl_FinishList(); Itcl_ReleaseData(infoPtr); } |
Changes to generic/itclBuiltin.c.
︙ | ︙ | |||
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | "@itcl-builtin-setupcomponent", Itcl_BiSetupComponentCmd, ITCL_ECLASS }, }; static int BiMethodListLen = sizeof(BiMethodList)/sizeof(BiMethod); /* * ------------------------------------------------------------------------ * Itcl_BiInit() * * Creates a namespace full of built-in methods/procs for [incr Tcl] * classes. This includes things like the "isa" method and "info" * for querying class info. Usually invoked by Itcl_Init() when * [incr Tcl] is first installed into an interpreter. * * Returns TCL_OK/TCL_ERROR to indicate success/failure. * ------------------------------------------------------------------------ */ int Itcl_BiInit( Tcl_Interp *interp, /* current interpreter */ ItclObjectInfo *infoPtr) { Tcl_Namespace *itclBiNs; Tcl_DString buffer; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | "@itcl-builtin-setupcomponent", Itcl_BiSetupComponentCmd, ITCL_ECLASS }, }; static int BiMethodListLen = sizeof(BiMethodList)/sizeof(BiMethod); /* * ------------------------------------------------------------------------ * ItclRestoreInfoVars() * * Delete callback to restore original "info" ensemble (revert inject of Itcl) * * ------------------------------------------------------------------------ */ void ItclRestoreInfoVars( ClientData clientData) { ItclObjectInfo *infoPtr = (ItclObjectInfo *)clientData; Tcl_Interp *interp = infoPtr->interp; Tcl_Command cmd; Tcl_Obj *mapDict; cmd = Tcl_FindCommand(interp, "info", NULL, TCL_GLOBAL_ONLY); if (cmd == NULL || !Tcl_IsEnsemble(cmd)) { goto done; } Tcl_GetEnsembleMappingDict(NULL, cmd, &mapDict); if (mapDict == NULL) { goto done; } if (infoPtr->infoVarsPtr == NULL || infoPtr->infoVars4Ptr == NULL) { /* Safety */ goto done; } Tcl_DictObjPut(NULL, mapDict, infoPtr->infoVars4Ptr, infoPtr->infoVarsPtr); Tcl_SetEnsembleMappingDict(interp, cmd, mapDict); done: if (infoPtr->infoVarsPtr) { Tcl_DecrRefCount(infoPtr->infoVarsPtr); infoPtr->infoVarsPtr = NULL; } if (infoPtr->infoVars4Ptr) { Tcl_DecrRefCount(infoPtr->infoVars4Ptr); infoPtr->infoVars4Ptr = NULL; } } /* * ------------------------------------------------------------------------ * Itcl_BiInit() * * Creates a namespace full of built-in methods/procs for [incr Tcl] * classes. This includes things like the "isa" method and "info" * for querying class info. Usually invoked by Itcl_Init() when * [incr Tcl] is first installed into an interpreter. * * Returns TCL_OK/TCL_ERROR to indicate success/failure. * ------------------------------------------------------------------------ */ int Itcl_BiInit( Tcl_Interp *interp, /* current interpreter */ ItclObjectInfo *infoPtr) { Tcl_Namespace *itclBiNs; Tcl_DString buffer; |
︙ | ︙ | |||
291 292 293 294 295 296 297 | */ Tcl_DStringInit(&buffer); for (i=0; i < BiMethodListLen; i++) { Tcl_DStringSetLength(&buffer, 0); Tcl_DStringAppend(&buffer, "::itcl::builtin::", -1); Tcl_DStringAppend(&buffer, BiMethodList[i].name, -1); Tcl_CreateObjCommand(interp, Tcl_DStringValue(&buffer), | | < | | | | < | | < < | < | | > > > > | > | < | < > | 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 | */ Tcl_DStringInit(&buffer); for (i=0; i < BiMethodListLen; i++) { Tcl_DStringSetLength(&buffer, 0); Tcl_DStringAppend(&buffer, "::itcl::builtin::", -1); Tcl_DStringAppend(&buffer, BiMethodList[i].name, -1); Tcl_CreateObjCommand(interp, Tcl_DStringValue(&buffer), BiMethodList[i].proc, infoPtr, NULL); } Tcl_DStringFree(&buffer); Tcl_CreateObjCommand(interp, "::itcl::builtin::chain", Itcl_BiChainCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "::itcl::builtin::classunknown", ItclBiClassUnknownCmd, infoPtr, NULL); ItclInfoInit(interp, infoPtr); /* * Export all commands in the built-in namespace so we can * import them later on. */ itclBiNs = Tcl_FindNamespace(interp, "::itcl::builtin", NULL, TCL_LEAVE_ERR_MSG); if ((itclBiNs == NULL) || Tcl_Export(interp, itclBiNs, "[a-z]*", /* resetListFirst */ 1) != TCL_OK) { return TCL_ERROR; } /* * Install into the master [info] ensemble. */ infoCmd = Tcl_FindCommand(interp, "info", NULL, TCL_GLOBAL_ONLY); if (infoCmd != NULL && Tcl_IsEnsemble(infoCmd)) { Tcl_GetEnsembleMappingDict(NULL, infoCmd, &mapDict); if (mapDict != NULL) { infoPtr->infoVars4Ptr = Tcl_NewStringObj("vars", -1); Tcl_IncrRefCount(infoPtr->infoVars4Ptr); result = Tcl_DictObjGet(NULL, mapDict, infoPtr->infoVars4Ptr, &infoPtr->infoVarsPtr); if (result == TCL_OK && infoPtr->infoVarsPtr) { Tcl_IncrRefCount(infoPtr->infoVarsPtr); Tcl_DictObjPut(NULL, mapDict, infoPtr->infoVars4Ptr, Tcl_NewStringObj("::itcl::builtin::Info::vars", -1)); Tcl_SetEnsembleMappingDict(interp, infoCmd, mapDict); /* * Note that ItclRestoreInfoVars is called in callback * if built-in Itcl command info::vars or the ensemble get * deleted (see ItclInfoInit registering that). */ } else { Tcl_DecrRefCount(infoPtr->infoVars4Ptr); infoPtr->infoVars4Ptr = NULL; } } } return TCL_OK; } |
︙ | ︙ | |||
441 442 443 444 445 446 447 | * Checks to see if the object has the given <className> anywhere * in its heritage. Returns 1 if so, and 0 otherwise. * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itcl_BiIsaCmd( | | | 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 | * Checks to see if the object has the given <className> anywhere * in its heritage. Returns 1 if so, and 0 otherwise. * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itcl_BiIsaCmd( void *clientData, /* class definition */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { ItclClass *iclsPtr; const char *token; |
︙ | ︙ | |||
464 465 466 467 468 469 470 | if (Itcl_GetContext(interp, &contextIclsPtr, &contextIoPtr) != TCL_OK) { return TCL_ERROR; } if (contextIoPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "improper usage: should be \"object isa className\"", | | | | 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 | if (Itcl_GetContext(interp, &contextIclsPtr, &contextIoPtr) != TCL_OK) { return TCL_ERROR; } if (contextIoPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "improper usage: should be \"object isa className\"", NULL); return TCL_ERROR; } if (objc != 2) { token = Tcl_GetString(objv[0]); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "wrong # args: should be \"object ", token, " className\"", NULL); return TCL_ERROR; } /* * Look for the requested class. If it is not found, then * try to autoload it. If it absolutely cannot be found, * signal an error. |
︙ | ︙ | |||
520 521 522 523 524 525 526 | * option changes, a big of "config" code associated with the option * is executed, to bring the object up to date. * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itcl_BiConfigureCmd( | | | 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 | * option changes, a big of "config" code associated with the option * is executed, to bring the object up to date. * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itcl_BiConfigureCmd( void *clientData, /* class definition */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { ItclClass *contextIclsPtr; ItclObject *contextIoPtr; |
︙ | ︙ | |||
571 572 573 574 575 576 577 | return TCL_ERROR; } if (contextIoPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "improper usage: should be ", "\"object configure ?-option? ?value -option value...?\"", | | | 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 | return TCL_ERROR; } if (contextIoPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "improper usage: should be ", "\"object configure ?-option? ?value -option value...?\"", NULL); return TCL_ERROR; } /* * BE CAREFUL: work in the virtual scope! */ if (contextIoPtr != NULL) { |
︙ | ︙ | |||
604 605 606 607 608 609 610 | unparsedObjc = objc; } } /* * HANDLE: configure */ if (unparsedObjc == 1) { | | | | | | | 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 | unparsedObjc = objc; } } /* * HANDLE: configure */ if (unparsedObjc == 1) { resultPtr = Tcl_NewListObj(0, NULL); Itcl_InitHierIter(&hier, contextIclsPtr); while ((iclsPtr=Itcl_AdvanceHierIter(&hier)) != NULL) { hPtr = Tcl_FirstHashEntry(&iclsPtr->variables, &place); while (hPtr) { ivPtr = (ItclVariable*)Tcl_GetHashValue(hPtr); if (ivPtr->protection == ITCL_PUBLIC) { objPtr = ItclReportPublicOpt(interp, ivPtr, contextIoPtr); Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); } hPtr = Tcl_NextHashEntry(&place); } } Itcl_DeleteHierIter(&hier); Tcl_SetObjResult(interp, resultPtr); return TCL_OK; } else { /* * HANDLE: configure -option */ if (unparsedObjc == 2) { token = Tcl_GetString(unparsedObjv[1]); if (*token != '-') { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "improper usage: should be ", "\"object configure ?-option? ?value -option value...?\"", NULL); return TCL_ERROR; } vlookup = NULL; hPtr = ItclResolveVarEntry(contextIclsPtr, token+1); if (hPtr) { vlookup = (ItclVarLookup*)Tcl_GetHashValue(hPtr); if (vlookup->ivPtr->protection != ITCL_PUBLIC) { vlookup = NULL; } } if (!vlookup) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "unknown option \"", token, "\"", NULL); return TCL_ERROR; } resultPtr = ItclReportPublicOpt(interp, vlookup->ivPtr, contextIoPtr); Tcl_SetObjResult(interp, resultPtr); return TCL_OK; } |
︙ | ︙ | |||
692 693 694 695 696 697 698 | if (hPtr) { vlookup = (ItclVarLookup*)Tcl_GetHashValue(hPtr); } } if (!vlookup || (vlookup->ivPtr->protection != ITCL_PUBLIC)) { Tcl_AppendResult(interp, "unknown option \"", token, "\"", | | | | | | 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 | if (hPtr) { vlookup = (ItclVarLookup*)Tcl_GetHashValue(hPtr); } } if (!vlookup || (vlookup->ivPtr->protection != ITCL_PUBLIC)) { Tcl_AppendResult(interp, "unknown option \"", token, "\"", NULL); result = TCL_ERROR; goto configureDone; } if (i == unparsedObjc-1) { Tcl_AppendResult(interp, "value for \"", token, "\" missing", NULL); result = TCL_ERROR; goto configureDone; } ivPtr = vlookup->ivPtr; Tcl_DStringSetLength(&buffer2, 0); if (!(ivPtr->flags & ITCL_COMMON)) { Tcl_DStringAppend(&buffer2, Tcl_GetString(contextIoPtr->varNsNamePtr), -1); } Tcl_DStringAppend(&buffer2, Tcl_GetString(ivPtr->iclsPtr->fullNamePtr), -1); Tcl_DStringAppend(&buffer2, "::", 2); Tcl_DStringAppend(&buffer2, Tcl_GetString(ivPtr->namePtr), -1); varName = Tcl_DStringValue(&buffer2); lastval = Tcl_GetVar2(interp, varName, NULL, 0); Tcl_DStringSetLength(&buffer, 0); Tcl_DStringAppend(&buffer, (lastval) ? lastval : "", -1); token = Tcl_GetString(unparsedObjv[i+1]); if (Tcl_SetVar2(interp, varName, NULL, token, TCL_LEAVE_ERR_MSG) == NULL) { Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( "\n (error in configuration of public variable \"%s\")", Tcl_GetString(ivPtr->fullNamePtr))); result = TCL_ERROR; goto configureDone; } |
︙ | ︙ | |||
752 753 754 755 756 757 758 | Itcl_SetCallFrameNamespace(interp, saveNsPtr); if (result == TCL_OK) { Tcl_ResetResult(interp); } else { Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( "\n (error in configuration of public variable \"%s\")", Tcl_GetString(ivPtr->fullNamePtr))); | | | 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 | Itcl_SetCallFrameNamespace(interp, saveNsPtr); if (result == TCL_OK) { Tcl_ResetResult(interp); } else { Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( "\n (error in configuration of public variable \"%s\")", Tcl_GetString(ivPtr->fullNamePtr))); Tcl_SetVar2(interp, varName,NULL, Tcl_DStringValue(&buffer), 0); goto configureDone; } } } |
︙ | ︙ | |||
794 795 796 797 798 799 800 | * Tk widgets. Returns the current value of the public variable * with name <option>. * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itcl_BiCgetCmd( | | | 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 | * Tk widgets. Returns the current value of the public variable * with name <option>. * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itcl_BiCgetCmd( void *clientData, /* class definition */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { ItclClass *contextIclsPtr; ItclObject *contextIoPtr; |
︙ | ︙ | |||
820 821 822 823 824 825 826 | contextIclsPtr = NULL; if (Itcl_GetContext(interp, &contextIclsPtr, &contextIoPtr) != TCL_OK) { return TCL_ERROR; } if ((contextIoPtr == NULL) || objc != 2) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "improper usage: should be \"object cget -option\"", | | | 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 | contextIclsPtr = NULL; if (Itcl_GetContext(interp, &contextIclsPtr, &contextIoPtr) != TCL_OK) { return TCL_ERROR; } if ((contextIoPtr == NULL) || objc != 2) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "improper usage: should be \"object cget -option\"", NULL); return TCL_ERROR; } /* * BE CAREFUL: work in the virtual scope! */ if (contextIoPtr != NULL) { |
︙ | ︙ | |||
848 849 850 851 852 853 854 | if (hPtr) { vlookup = (ItclVarLookup*)Tcl_GetHashValue(hPtr); } if ((vlookup == NULL) || (vlookup->ivPtr->protection != ITCL_PUBLIC)) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "unknown option \"", name, "\"", | | | 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 | if (hPtr) { vlookup = (ItclVarLookup*)Tcl_GetHashValue(hPtr); } if ((vlookup == NULL) || (vlookup->ivPtr->protection != ITCL_PUBLIC)) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "unknown option \"", name, "\"", NULL); return TCL_ERROR; } val = Itcl_GetInstanceVar(interp, Tcl_GetString(vlookup->ivPtr->namePtr), contextIoPtr, vlookup->ivPtr->iclsPtr); |
︙ | ︙ | |||
892 893 894 895 896 897 898 | ItclClass *iclsPtr; Tcl_HashEntry *hPtr; ItclVarLookup *vlookup; Tcl_DString optName; Tcl_Obj *listPtr; Tcl_Obj *objPtr; | | | | | | 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 | ItclClass *iclsPtr; Tcl_HashEntry *hPtr; ItclVarLookup *vlookup; Tcl_DString optName; Tcl_Obj *listPtr; Tcl_Obj *objPtr; listPtr = Tcl_NewListObj(0, NULL); /* * Determine how the option name should be reported. * If the simple name can be used to find it in the virtual * data table, then use the simple name. Otherwise, this * is a shadowed variable; use the full name. */ Tcl_DStringInit(&optName); Tcl_DStringAppend(&optName, "-", -1); iclsPtr = (ItclClass*)contextIoPtr->iclsPtr; hPtr = ItclResolveVarEntry(iclsPtr, Tcl_GetString(ivPtr->fullNamePtr)); assert(hPtr != NULL); vlookup = (ItclVarLookup*)Tcl_GetHashValue(hPtr); Tcl_DStringAppend(&optName, vlookup->leastQualName, -1); objPtr = Tcl_NewStringObj(Tcl_DStringValue(&optName), -1); Tcl_ListObjAppendElement(NULL, listPtr, objPtr); Tcl_DStringFree(&optName); if (ivPtr->init) { objPtr = ivPtr->init; } else { objPtr = Tcl_NewStringObj("<undefined>", -1); } Tcl_ListObjAppendElement(NULL, listPtr, objPtr); val = Itcl_GetInstanceVar(interp, Tcl_GetString(ivPtr->namePtr), contextIoPtr, ivPtr->iclsPtr); if (val) { objPtr = Tcl_NewStringObj((const char *)val, -1); } else { objPtr = Tcl_NewStringObj("<undefined>", -1); } Tcl_ListObjAppendElement(NULL, listPtr, objPtr); return listPtr; } /* * ------------------------------------------------------------------------ * ItclReportOption() |
︙ | ︙ | |||
959 960 961 962 963 964 965 | ItclObject *contextIoPtr) /* object containing this variable */ { Tcl_Obj *listPtr; Tcl_Obj *objPtr; ItclDelegatedOption *idoPtr; const char *val; | | | | | | | | | | | | | 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 | ItclObject *contextIoPtr) /* object containing this variable */ { Tcl_Obj *listPtr; Tcl_Obj *objPtr; ItclDelegatedOption *idoPtr; const char *val; listPtr = Tcl_NewListObj(0, NULL); idoPtr = ioptPtr->iclsPtr->infoPtr->currIdoPtr; if (idoPtr != NULL) { Tcl_ListObjAppendElement(NULL, listPtr, idoPtr->namePtr); if (idoPtr->resourceNamePtr == NULL) { Tcl_ListObjAppendElement(NULL, listPtr, Tcl_NewStringObj("", -1)); /* FIXME possible memory leak */ } else { Tcl_ListObjAppendElement(NULL, listPtr, idoPtr->resourceNamePtr); } if (idoPtr->classNamePtr == NULL) { Tcl_ListObjAppendElement(NULL, listPtr, Tcl_NewStringObj("", -1)); /* FIXME possible memory leak */ } else { Tcl_ListObjAppendElement(NULL, listPtr, idoPtr->classNamePtr); } } else { Tcl_ListObjAppendElement(NULL, listPtr, ioptPtr->namePtr); Tcl_ListObjAppendElement(NULL, listPtr, ioptPtr->resourceNamePtr); Tcl_ListObjAppendElement(NULL, listPtr, ioptPtr->classNamePtr); } if (ioptPtr->defaultValuePtr) { objPtr = ioptPtr->defaultValuePtr; } else { objPtr = Tcl_NewStringObj("<undefined>", -1); } Tcl_ListObjAppendElement(NULL, listPtr, objPtr); val = ItclGetInstanceVar(interp, "itcl_options", Tcl_GetString(ioptPtr->namePtr), contextIoPtr, ioptPtr->iclsPtr); if (val) { objPtr = Tcl_NewStringObj((const char *)val, -1); } else { objPtr = Tcl_NewStringObj("<undefined>", -1); } Tcl_ListObjAppendElement(NULL, listPtr, objPtr); return listPtr; } /* * ------------------------------------------------------------------------ |
︙ | ︙ | |||
1027 1028 1029 1030 1031 1032 1033 | * This allows a base class method to be called out in a generic way, * so the code will not have to change if the base class changes. * ------------------------------------------------------------------------ */ /* ARGSUSED */ static int NRBiChainCmd( | | | 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 | * This allows a base class method to be called out in a generic way, * so the code will not have to change if the base class changes. * ------------------------------------------------------------------------ */ /* ARGSUSED */ static int NRBiChainCmd( void *dummy, /* not used */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { int result = TCL_OK; ItclClass *contextIclsPtr; |
︙ | ︙ | |||
1063 1064 1065 1066 1067 1068 1069 | * signal an error. */ contextIclsPtr = NULL; if (Itcl_GetContext(interp, &contextIclsPtr, &contextIoPtr) != TCL_OK) { Tcl_ResetResult(interp); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "cannot chain functions outside of a class context", | | | 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 | * signal an error. */ contextIclsPtr = NULL; if (Itcl_GetContext(interp, &contextIclsPtr, &contextIoPtr) != TCL_OK) { Tcl_ResetResult(interp); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "cannot chain functions outside of a class context", NULL); return TCL_ERROR; } /* * Try to get the command name from the current call frame. * If it cannot be determined, do nothing. Otherwise, trim * off any leading path names. |
︙ | ︙ | |||
1137 1138 1139 1140 1141 1142 1143 | * methods by passing the full name as * the command argument. */ cmdlinePtr = Itcl_CreateArgs(interp, Tcl_GetString(imPtr->fullNamePtr), objc-1, objv+1); | | | 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 | * methods by passing the full name as * the command argument. */ cmdlinePtr = Itcl_CreateArgs(interp, Tcl_GetString(imPtr->fullNamePtr), objc-1, objv+1); (void) Tcl_ListObjGetElements(NULL, cmdlinePtr, &my_objc, &newobjv); if (imPtr->flags & ITCL_CONSTRUCTOR) { contextIoPtr = imPtr->iclsPtr->infoPtr->currIoPtr; } ItclShowArgs(1, "___chain", objc-1, newobjv+1); result = Itcl_EvalMemberCode(interp, imPtr, contextIoPtr, |
︙ | ︙ | |||
1159 1160 1161 1162 1163 1164 1165 | Tcl_DStringFree(&buffer); Itcl_DeleteHierIter(&hier); return result; } /* ARGSUSED */ int Itcl_BiChainCmd( | | | | | | 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 | Tcl_DStringFree(&buffer); Itcl_DeleteHierIter(&hier); return result; } /* ARGSUSED */ int Itcl_BiChainCmd( void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) { return Tcl_NRCallObjProc(interp, NRBiChainCmd, clientData, objc, objv); } static int CallCreateObject( void *data[], Tcl_Interp *interp, int result) { Tcl_CallFrame frame; Tcl_Namespace *nsPtr; ItclClass *iclsPtr = (ItclClass *)data[0]; int objc = PTR2INT(data[1]); Tcl_Obj *const *objv = (Tcl_Obj *const *)data[2]; if (result != TCL_OK) { return result; } nsPtr = Itcl_GetUplevelNamespace(interp, 1); if (Itcl_PushCallFrame(interp, &frame, nsPtr, /*isProcCallFrame*/0) != TCL_OK) { |
︙ | ︙ | |||
1238 1239 1240 1241 1242 1243 1244 | Tcl_IncrRefCount(newObjv[1]); newObjv[2] = Tcl_NewStringObj(iclsPtr->nsPtr->fullName, -1); Tcl_IncrRefCount(newObjv[2]); memcpy(newObjv+3, objv+offset, (objc-offset) * sizeof(Tcl_Obj *)); callbackPtr = Itcl_GetCurrentCallbackPtr(interp); ItclShowArgs(1, "CREATE", objc+3-offset, newObjv); Tcl_NRAddCallback(interp, CallCreateObject, iclsPtr, | | | 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 | Tcl_IncrRefCount(newObjv[1]); newObjv[2] = Tcl_NewStringObj(iclsPtr->nsPtr->fullName, -1); Tcl_IncrRefCount(newObjv[2]); memcpy(newObjv+3, objv+offset, (objc-offset) * sizeof(Tcl_Obj *)); callbackPtr = Itcl_GetCurrentCallbackPtr(interp); ItclShowArgs(1, "CREATE", objc+3-offset, newObjv); Tcl_NRAddCallback(interp, CallCreateObject, iclsPtr, INT2PTR(objc+3-offset), newObjv, NULL); result = Itcl_NRRunCallbacks(interp, callbackPtr); if (result != TCL_OK) { if (iclsPtr->infoPtr->currIoPtr != NULL) { /* we are in a constructor call */ if (iclsPtr->infoPtr->currIoPtr->hadConstructorError == 0) { iclsPtr->infoPtr->currIoPtr->hadConstructorError = 1; } |
︙ | ︙ | |||
1266 1267 1268 1269 1270 1271 1272 | * classunknown <object> <methodname> ?<arg> <arg>...? * * ------------------------------------------------------------------------ */ /* ARGSUSED */ static int ItclBiClassUnknownCmd( | | | 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 | * classunknown <object> <methodname> ?<arg> <arg>...? * * ------------------------------------------------------------------------ */ /* ARGSUSED */ static int ItclBiClassUnknownCmd( void *clientData, /* ItclObjectInfo Ptr */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { FOREACH_HASH_DECLS; Tcl_HashEntry *hPtr2; Tcl_Obj **newObjv; |
︙ | ︙ | |||
1313 1314 1315 1316 1317 1318 1319 | hPtr = Tcl_FindHashEntry(&infoPtr->namespaceClasses, (char *)Tcl_GetCurrentNamespace(interp)); if (hPtr == NULL) { Tcl_AppendResult(interp, "INTERNAL ERROR: ItclBiClassUnknownCmd ", "cannot find class\n", NULL); return TCL_ERROR; } | | | 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 | hPtr = Tcl_FindHashEntry(&infoPtr->namespaceClasses, (char *)Tcl_GetCurrentNamespace(interp)); if (hPtr == NULL) { Tcl_AppendResult(interp, "INTERNAL ERROR: ItclBiClassUnknownCmd ", "cannot find class\n", NULL); return TCL_ERROR; } iclsPtr = (ItclClass *)Tcl_GetHashValue(hPtr); funcName = Tcl_GetString(objv[1]); if (strcmp(funcName, "create") == 0) { /* check if we have a user method create. If not, it is the builtin * create method and we don't need to check for delegation * and components with ITCL_COMPONENT_INHERIT */ hPtr = Tcl_FindHashEntry(&iclsPtr->resolveCmds, (char *)objv[1]); |
︙ | ︙ | |||
1381 1382 1383 1384 1385 1386 1387 | if (hPtr == NULL) { objPtr = Tcl_NewStringObj("*", -1); Tcl_IncrRefCount(objPtr); hPtr = Tcl_FindHashEntry(&iclsPtr->delegatedFunctions, (char *)objPtr); Tcl_DecrRefCount(objPtr); if (hPtr != NULL) { | | | 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 | if (hPtr == NULL) { objPtr = Tcl_NewStringObj("*", -1); Tcl_IncrRefCount(objPtr); hPtr = Tcl_FindHashEntry(&iclsPtr->delegatedFunctions, (char *)objPtr); Tcl_DecrRefCount(objPtr); if (hPtr != NULL) { idmPtr = (ItclDelegatedFunction *)Tcl_GetHashValue(hPtr); isStar = 1; } } if (isStar) { /* check if the function is in the exceptions */ hPtr2 = Tcl_FindHashEntry(&starIdmPtr->exceptions, (char *)objv[1]); if (hPtr2 != NULL) { |
︙ | ︙ | |||
1409 1410 1411 1412 1413 1414 1415 | } } Tcl_SetObjResult(interp, objPtr); return TCL_ERROR; } } if (hPtr != NULL) { | | | 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 | } } Tcl_SetObjResult(interp, objPtr); return TCL_ERROR; } } if (hPtr != NULL) { idmPtr = (ItclDelegatedFunction *)Tcl_GetHashValue(hPtr); val = NULL; if (idmPtr->icPtr != NULL) { if (idmPtr->icPtr->ivPtr->flags & ITCL_COMMON) { val = Tcl_GetVar2(interp, Tcl_GetString(idmPtr->icPtr->namePtr), NULL, 0); } else { ItclClass *contextIclsPtr; |
︙ | ︙ | |||
1575 1576 1577 1578 1579 1580 1581 | int isStar; int isTypeMethod; int isNew; int idx; if (objc < 2) { Tcl_AppendResult(interp, "wrong # args: should be one of...", | | | 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 | int isStar; int isTypeMethod; int isNew; int idx; if (objc < 2) { Tcl_AppendResult(interp, "wrong # args: should be one of...", NULL); ItclReportObjectUsage(interp, ioPtr, NULL, NULL); return TCL_ERROR; } iclsPtr = ioPtr->iclsPtr; lObjc = 0; offset = 1; isStar = 0; |
︙ | ︙ | |||
1644 1645 1646 1647 1648 1649 1650 | if (hPtr == NULL) { objPtr = Tcl_NewStringObj("*", -1); Tcl_IncrRefCount(objPtr); hPtr = Tcl_FindHashEntry(&iclsPtr->delegatedFunctions, (char *)objPtr); Tcl_DecrRefCount(objPtr); if (hPtr != NULL) { | | | | | 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 | if (hPtr == NULL) { objPtr = Tcl_NewStringObj("*", -1); Tcl_IncrRefCount(objPtr); hPtr = Tcl_FindHashEntry(&iclsPtr->delegatedFunctions, (char *)objPtr); Tcl_DecrRefCount(objPtr); if (hPtr != NULL) { idmPtr = (ItclDelegatedFunction *)Tcl_GetHashValue(hPtr); isStar = 1; } } else { found = 1; idmPtr = (ItclDelegatedFunction *)Tcl_GetHashValue(hPtr); } if (isStar) { /* check if the function is in the exceptions */ hPtr2 = Tcl_FindHashEntry(&idmPtr->exceptions, (char *)objv[1]); if (hPtr2 != NULL) { const char *sep = ""; objPtr = Tcl_NewStringObj("unknown subcommand \"", -1); |
︙ | ︙ | |||
1730 1731 1732 1733 1734 1735 1736 | sep = " or "; } } } } if (idmPtr == NULL) { Tcl_AppendResult(interp, "bad option \"", Tcl_GetString(objv[1]), | | | 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 | sep = " or "; } } } } if (idmPtr == NULL) { Tcl_AppendResult(interp, "bad option \"", Tcl_GetString(objv[1]), "\": should be one of...", NULL); ItclReportObjectUsage(interp, ioPtr, NULL, NULL); return TCL_ERROR; } lObjc = 0; if ((idmPtr != NULL) && ((idmPtr->asPtr != NULL) || (idmPtr->usingPtr != NULL))) { offset++; |
︙ | ︙ | |||
1874 1875 1876 1877 1878 1879 1880 | * option changes, a big of "config" code associated with the option * is executed, to bring the object up to date. * ------------------------------------------------------------------------ */ /* ARGSUSED */ static int ItclExtendedConfigure( | | | 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 | * option changes, a big of "config" code associated with the option * is executed, to bring the object up to date. * ------------------------------------------------------------------------ */ /* ARGSUSED */ static int ItclExtendedConfigure( void *clientData, /* class definition */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { FOREACH_HASH_DECLS; Tcl_HashTable unique; Tcl_HashEntry *hPtr2; |
︙ | ︙ | |||
1935 1936 1937 1938 1939 1940 1941 | return TCL_ERROR; } if (contextIoPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "improper usage: should be ", "\"object configure ?-option? ?value -option value...?\"", | | | 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 | return TCL_ERROR; } if (contextIoPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "improper usage: should be ", "\"object configure ?-option? ?value -option value...?\"", NULL); return TCL_ERROR; } /* * BE CAREFUL: work in the virtual scope! */ if (contextIoPtr != NULL) { |
︙ | ︙ | |||
2541 2542 2543 2544 2545 2546 2547 | * Tk widgets. Returns the current value of the public variable * with name <option>. * ------------------------------------------------------------------------ */ /* ARGSUSED */ static int ItclExtendedCget( | | | 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 | * Tk widgets. Returns the current value of the public variable * with name <option>. * ------------------------------------------------------------------------ */ /* ARGSUSED */ static int ItclExtendedCget( void *clientData, /* class definition */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { Tcl_HashEntry *hPtr; Tcl_HashEntry *hPtr2; Tcl_HashEntry *hPtr3; |
︙ | ︙ | |||
2578 2579 2580 2581 2582 2583 2584 | contextIclsPtr = NULL; if (Itcl_GetContext(interp, &contextIclsPtr, &contextIoPtr) != TCL_OK) { return TCL_ERROR; } if ((contextIoPtr == NULL) || objc != 2) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "improper usage: should be \"object cget -option\"", | | | 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 | contextIclsPtr = NULL; if (Itcl_GetContext(interp, &contextIclsPtr, &contextIoPtr) != TCL_OK) { return TCL_ERROR; } if ((contextIoPtr == NULL) || objc != 2) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "improper usage: should be \"object cget -option\"", NULL); return TCL_ERROR; } /* * BE CAREFUL: work in the virtual scope! */ if (contextIoPtr != NULL) { |
︙ | ︙ | |||
2779 2780 2781 2782 2783 2784 2785 | * this sets the variable to the value calling a callback if exists: * * ------------------------------------------------------------------------ */ /* ARGSUSED */ static int ItclExtendedSetGet( | | | 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 | * this sets the variable to the value calling a callback if exists: * * ------------------------------------------------------------------------ */ /* ARGSUSED */ static int ItclExtendedSetGet( void *clientData, /* class definition */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { ItclClass *contextIclsPtr; ItclObject *contextIoPtr; |
︙ | ︙ | |||
2811 2812 2813 2814 2815 2816 2817 | if (Itcl_GetContext(interp, &contextIclsPtr, &contextIoPtr) != TCL_OK) { return TCL_ERROR; } usageStr = "improper usage: should be \"object setget varName ?value?\""; if (contextIoPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), | | | | 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 | if (Itcl_GetContext(interp, &contextIclsPtr, &contextIoPtr) != TCL_OK) { return TCL_ERROR; } usageStr = "improper usage: should be \"object setget varName ?value?\""; if (contextIoPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), usageStr, NULL); return TCL_ERROR; } /* * BE CAREFUL: work in the virtual scope! */ if (contextIoPtr != NULL) { contextIclsPtr = contextIoPtr->iclsPtr; } infoPtr = contextIclsPtr->infoPtr; if (infoPtr->currContextIclsPtr != NULL) { contextIclsPtr = infoPtr->currContextIclsPtr; } hPtr = NULL; if (objc < 2) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), usageStr, NULL); return TCL_ERROR; } /* look if it is an methodvariable at all */ hPtr = Tcl_FindHashEntry(&contextIoPtr->objectMethodVariables, (char *) objv[1]); if (hPtr == NULL) { Tcl_AppendResult(interp, "no such methodvariable \"", |
︙ | ︙ | |||
2897 2898 2899 2900 2901 2902 2903 | * ?-option value -option value ...? * * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itcl_BiInstallComponentCmd( | | | 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 | * ?-option value -option value ...? * * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itcl_BiInstallComponentCmd( void *clientData, /* class definition */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { FOREACH_HASH_DECLS; Tcl_Obj ** newObjv; ItclClass *contextIclsPtr; |
︙ | ︙ | |||
2928 2929 2930 2931 2932 2933 2934 | if (Itcl_GetContext(interp, &contextIclsPtr, &contextIoPtr) != TCL_OK) { return TCL_ERROR; } if (contextIoPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "improper usage: should be \"object installcomponent \"", | | | | 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 | if (Itcl_GetContext(interp, &contextIclsPtr, &contextIoPtr) != TCL_OK) { return TCL_ERROR; } if (contextIoPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "improper usage: should be \"object installcomponent \"", NULL); return TCL_ERROR; } if (objc < 5) { /* FIXME strip off the :: parts here properly*/ token = Tcl_GetString(objv[0])+2; Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "wrong # args: should be \"", token, " <componentName> using", " <widgetClassName> <widgetPathName>", " ?-option value -option value ...?\"", NULL); return TCL_ERROR; } /* get component name and check, if it exists */ token = Tcl_GetString(objv[1]); if (contextIclsPtr == NULL) { Tcl_AppendResult(interp, "cannot find context class for object \"", |
︙ | ︙ | |||
3032 3033 3034 3035 3036 3037 3038 | * destroy * * ------------------------------------------------------------------------ */ /* ARGSUSED */ static int Itcl_BiDestroyCmd( | | | 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 | * destroy * * ------------------------------------------------------------------------ */ /* ARGSUSED */ static int Itcl_BiDestroyCmd( void *clientData, /* class definition */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { Tcl_Obj **newObjv; ItclClass *contextIclsPtr; ItclObject *contextIoPtr; |
︙ | ︙ | |||
3079 3080 3081 3082 3083 3084 3085 | Tcl_DecrRefCount(newObjv[2]); Tcl_DecrRefCount(newObjv[1]); Tcl_DecrRefCount(newObjv[0]); return result; } if (objc != 1) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), | | | 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 | Tcl_DecrRefCount(newObjv[2]); Tcl_DecrRefCount(newObjv[1]); Tcl_DecrRefCount(newObjv[0]); return result; } if (objc != 1) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "wrong # args: should be \"", Tcl_GetString(objv[0]), NULL); return TCL_ERROR; } if (contextIoPtr != NULL) { Tcl_Obj *objPtr = Tcl_NewObj(); Tcl_GetCommandFullName(interp, contextIoPtr->accessCmd, objPtr); Itcl_RenameCommand(interp, Tcl_GetString(objPtr), ""); |
︙ | ︙ | |||
3109 3110 3111 3112 3113 3114 3115 | * callinstance <instanceName> ?arg arg ...? * * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itcl_BiCallInstanceCmd( | | | 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 | * callinstance <instanceName> ?arg arg ...? * * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itcl_BiCallInstanceCmd( void *clientData, /* class definition */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { Tcl_HashEntry *hPtr; Tcl_Obj *objPtr; Tcl_Obj **newObjv; |
︙ | ︙ | |||
3137 3138 3139 3140 3141 3142 3143 | return TCL_ERROR; } if (objc < 2) { token = Tcl_GetString(objv[0]); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "wrong # args: should be \"", token, " <instanceName>", | | | | 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 | return TCL_ERROR; } if (objc < 2) { token = Tcl_GetString(objv[0]); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "wrong # args: should be \"", token, " <instanceName>", NULL); return TCL_ERROR; } hPtr = Tcl_FindHashEntry(&contextIclsPtr->infoPtr->instances, Tcl_GetString(objv[1])); if (hPtr == NULL) { Tcl_AppendResult(interp, "no such instanceName \"", Tcl_GetString(objv[1]), "\"", NULL); return TCL_ERROR; } ioPtr = (ItclObject *)Tcl_GetHashValue(hPtr); objPtr =Tcl_NewObj(); Tcl_GetCommandFullName(interp, ioPtr->accessCmd, objPtr); newObjv = (Tcl_Obj **)ckalloc(sizeof(Tcl_Obj*) * (objc - 1)); newObjv[0] = objPtr; Tcl_IncrRefCount(newObjv[0]); memcpy(newObjv + 1, objv + 2, sizeof(Tcl_Obj *) * (objc - 2)); result = Tcl_EvalObjv(interp, objc - 1, newObjv, 0); |
︙ | ︙ | |||
3176 3177 3178 3179 3180 3181 3182 | * getinstancevar <instanceName> ?arg arg ...? * * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itcl_BiGetInstanceVarCmd( | | | 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 | * getinstancevar <instanceName> ?arg arg ...? * * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itcl_BiGetInstanceVarCmd( void *clientData, /* class definition */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { Tcl_HashEntry *hPtr; Tcl_Obj *objPtr; Tcl_Obj **newObjv; |
︙ | ︙ | |||
3204 3205 3206 3207 3208 3209 3210 | return TCL_ERROR; } if (objc < 2) { token = Tcl_GetString(objv[0]); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "wrong # args: should be \"", token, " <instanceName>", | | | | | 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 | return TCL_ERROR; } if (objc < 2) { token = Tcl_GetString(objv[0]); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "wrong # args: should be \"", token, " <instanceName>", NULL); return TCL_ERROR; } hPtr = Tcl_FindHashEntry(&contextIclsPtr->infoPtr->instances, Tcl_GetString(objv[1])); if (hPtr == NULL) { Tcl_AppendResult(interp, "no such instanceName \"", Tcl_GetString(objv[1]), "\"", NULL); return TCL_ERROR; } ioPtr = (ItclObject *)Tcl_GetHashValue(hPtr); objPtr = Tcl_NewObj(); Tcl_GetCommandFullName(interp, ioPtr->accessCmd, objPtr); newObjv = (Tcl_Obj **)ckalloc(sizeof(Tcl_Obj*) * (objc - 1)); newObjv[0] = objPtr; Tcl_IncrRefCount(newObjv[0]); memcpy(newObjv + 1, objv + 2, sizeof(Tcl_Obj *) * (objc - 2)); result = Tcl_EvalObjv(interp, objc - 1, newObjv, 0); Tcl_DecrRefCount(newObjv[0]); |
︙ | ︙ | |||
3242 3243 3244 3245 3246 3247 3248 | * mytypemethod ?arg arg ...? * * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itcl_BiMyTypeMethodCmd( | | | 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 | * mytypemethod ?arg arg ...? * * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itcl_BiMyTypeMethodCmd( void *clientData, /* class definition */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { Tcl_Obj *objPtr; Tcl_Obj *resultPtr; ItclClass *contextIclsPtr; |
︙ | ︙ | |||
3292 3293 3294 3295 3296 3297 3298 | * mymethod ?arg arg ...? * * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itcl_BiMyMethodCmd( | | | 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 | * mymethod ?arg arg ...? * * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itcl_BiMyMethodCmd( void *clientData, /* class definition */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { Tcl_Obj *resultPtr; int i; ItclClass *contextIclsPtr; |
︙ | ︙ | |||
3341 3342 3343 3344 3345 3346 3347 | * myproc ?arg arg ...? * * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itcl_BiMyProcCmd( | | | 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 | * myproc ?arg arg ...? * * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itcl_BiMyProcCmd( void *clientData, /* class definition */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { Tcl_Obj *objPtr; Tcl_Obj *resultPtr; ItclClass *contextIclsPtr; |
︙ | ︙ | |||
3392 3393 3394 3395 3396 3397 3398 | * mytypevar ?arg arg ...? * * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itcl_BiMyTypeVarCmd( | | | 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 | * mytypevar ?arg arg ...? * * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itcl_BiMyTypeVarCmd( void *clientData, /* class definition */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { Tcl_Obj *objPtr; Tcl_Obj *resultPtr; ItclClass *contextIclsPtr; |
︙ | ︙ | |||
3444 3445 3446 3447 3448 3449 3450 | * myvar ?arg arg ...? * * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itcl_BiMyVarCmd( | | | 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 | * myvar ?arg arg ...? * * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itcl_BiMyVarCmd( void *clientData, /* class definition */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { Tcl_Obj *resultPtr; ItclClass *contextIclsPtr; ItclObject *contextIoPtr; |
︙ | ︙ | |||
3488 3489 3490 3491 3492 3493 3494 | * itcl_hull ?arg arg ...? * * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itcl_BiItclHullCmd( | | | 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 | * itcl_hull ?arg arg ...? * * ------------------------------------------------------------------------ */ /* ARGSUSED */ int Itcl_BiItclHullCmd( void *clientData, /* class definition */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { ItclClass *contextIclsPtr; ItclObject *contextIoPtr; const char *val; |
︙ | ︙ | |||
3530 3531 3532 3533 3534 3535 3536 | * createhull <widget_type> <widget_path> ?-class <widgetClassName>? * ?<optionName> <optionValue> <optionName> <optionValue> ...? * * ------------------------------------------------------------------------ */ static int Itcl_BiCreateHullCmd( | | | 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 | * createhull <widget_type> <widget_path> ?-class <widgetClassName>? * ?<optionName> <optionValue> <optionName> <optionValue> ...? * * ------------------------------------------------------------------------ */ static int Itcl_BiCreateHullCmd( void *clientData, /* info for all known objects */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { int result; ItclObjectInfo *infoPtr = (ItclObjectInfo*)clientData; |
︙ | ︙ | |||
3565 3566 3567 3568 3569 3570 3571 | * setupcomponent <componentName> using <widgetType> <widget_path> * ?<optionName> <optionValue> <optionName> <optionValue> ...? * * ------------------------------------------------------------------------ */ static int Itcl_BiSetupComponentCmd( | | | 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 | * setupcomponent <componentName> using <widgetType> <widget_path> * ?<optionName> <optionValue> <optionName> <optionValue> ...? * * ------------------------------------------------------------------------ */ static int Itcl_BiSetupComponentCmd( void *clientData, /* info for all known objects */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { int result; ItclObjectInfo *infoPtr = (ItclObjectInfo*)clientData; |
︙ | ︙ | |||
3601 3602 3603 3604 3605 3606 3607 | * ?<optionName> <optionValue> <optionName> <optionValue> ...? * FIXME !!!! seems no longer been used !!! * * ------------------------------------------------------------------------ */ static int Itcl_BiInitOptionsCmd( | | | 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 | * ?<optionName> <optionValue> <optionName> <optionValue> ...? * FIXME !!!! seems no longer been used !!! * * ------------------------------------------------------------------------ */ static int Itcl_BiInitOptionsCmd( void *clientData, /* info for all known objects */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { int result; ItclObjectInfo *infoPtr = (ItclObjectInfo*)clientData; ItclClass *iclsPtr; |
︙ | ︙ | |||
3653 3654 3655 3656 3657 3658 3659 | * * keepcomponentoption <componentName> <optionName> ?<optionName> ...? * * ------------------------------------------------------------------------ */ static int Itcl_BiKeepComponentOptionCmd( | | | 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 | * * keepcomponentoption <componentName> <optionName> ?<optionName> ...? * * ------------------------------------------------------------------------ */ static int Itcl_BiKeepComponentOptionCmd( void *clientData, /* info for all known objects */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { int result; ItclObjectInfo *infoPtr = (ItclObjectInfo*)clientData; |
︙ | ︙ | |||
3688 3689 3690 3691 3692 3693 3694 | * * ignorecomponentoption <componentName> <optionName> ?<optionName> ...? * * ------------------------------------------------------------------------ */ static int Itcl_BiIgnoreComponentOptionCmd( | | | 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 | * * ignorecomponentoption <componentName> <optionName> ?<optionName> ...? * * ------------------------------------------------------------------------ */ static int Itcl_BiIgnoreComponentOptionCmd( void *clientData, /* info for all known objects */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { Tcl_HashEntry *hPtr; Tcl_HashEntry *hPtr2; Tcl_Obj *objPtr; |
︙ | ︙ | |||
3731 3732 3733 3734 3735 3736 3737 | hPtr = Tcl_FindHashEntry(&ioPtr->objectComponents, (char *)objv[1]); if (hPtr == NULL) { Tcl_AppendResult(interp, "ignorecomponentoption cannot find component \"", Tcl_GetString(objv[1]), "\"", NULL); return TCL_ERROR; } | | | 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 | hPtr = Tcl_FindHashEntry(&ioPtr->objectComponents, (char *)objv[1]); if (hPtr == NULL) { Tcl_AppendResult(interp, "ignorecomponentoption cannot find component \"", Tcl_GetString(objv[1]), "\"", NULL); return TCL_ERROR; } icPtr = (ItclComponent *)Tcl_GetHashValue(hPtr); icPtr->haveKeptOptions = 1; for (idx = 2; idx < objc; idx++) { hPtr = Tcl_CreateHashEntry(&icPtr->keptOptions, (char *)objv[idx], &isNew); if (isNew) { Tcl_SetHashValue(hPtr, objv[idx]); } |
︙ | ︙ |
Changes to generic/itclClass.c.
︙ | ︙ | |||
66 67 68 69 70 71 72 | * ------------------------------------------------------------------------ * Itcl_DeleteMemberFunc() * * ------------------------------------------------------------------------ */ void Itcl_DeleteMemberFunc ( | | | 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | * ------------------------------------------------------------------------ * Itcl_DeleteMemberFunc() * * ------------------------------------------------------------------------ */ void Itcl_DeleteMemberFunc ( void *cdata) { /* needed for stubs compatibility */ ItclMemberFunc *imPtr; imPtr = (ItclMemberFunc *)cdata; if (imPtr == NULL) { /* FIXME need code here */ |
︙ | ︙ | |||
89 90 91 92 93 94 95 | * ------------------------------------------------------------------------ */ static void ItclDestroyClass2( ClientData clientData) /* The class being deleted. */ { | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | * ------------------------------------------------------------------------ */ static void ItclDestroyClass2( ClientData clientData) /* The class being deleted. */ { ItclClass *iclsPtr = (ItclClass *)clientData; ItclDestroyClassNamesp(iclsPtr); ItclReleaseClass(iclsPtr); } /* * ------------------------------------------------------------------------ * ItclDeleteClassMetadata() * * Delete the metadata data if any *------------------------------------------------------------------------- */ void ItclDeleteClassMetadata( ClientData clientData) { /* * This is how we get alerted from TclOO that the object corresponding * to an Itcl class (or its namespace...) is being torn down. */ ItclClass *iclsPtr = (ItclClass *)clientData; Tcl_Object oPtr = iclsPtr->oPtr; Tcl_Namespace *ooNsPtr = Tcl_GetObjectNamespace(oPtr); if (ooNsPtr != iclsPtr->nsPtr) { /* * Itcl's idea of the class namespace is different from that of TclOO. * Make sure both get torn down and pulled from tables. */ Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&iclsPtr->infoPtr->namespaceClasses, (char *)ooNsPtr); if (hPtr != NULL) { Tcl_DeleteHashEntry(hPtr); |
︙ | ︙ | |||
193 194 195 196 197 198 199 | static int CallNewObjectInstance( ClientData data[], Tcl_Interp *interp, int result) { | | | | | | 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | static int CallNewObjectInstance( ClientData data[], Tcl_Interp *interp, int result) { ItclObjectInfo *infoPtr = (ItclObjectInfo *)data[0]; const char *path = (const char *)data[1]; Tcl_Object *oPtr = (Tcl_Object *)data[2]; Tcl_Obj *nameObjPtr = (Tcl_Obj *)data[3]; *oPtr = NULL; if (infoPtr->clazzClassPtr) { *oPtr = Tcl_NewObjectInstance(interp, infoPtr->clazzClassPtr, path, path, 0, NULL, 0); } if (*oPtr == NULL) { |
︙ | ︙ | |||
245 246 247 248 249 250 251 | ItclClass *iclsPtr; ItclVariable *ivPtr; Tcl_HashEntry *hPtr; void *callbackPtr; int result; int newEntry; ItclResolveInfo *resolveInfoPtr; | < | 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | ItclClass *iclsPtr; ItclVariable *ivPtr; Tcl_HashEntry *hPtr; void *callbackPtr; int result; int newEntry; ItclResolveInfo *resolveInfoPtr; if (infoPtr->clazzObjectPtr == NULL) { Tcl_AppendResult(interp, "oo-subsystem is deleted", NULL); return TCL_ERROR; } /* |
︙ | ︙ | |||
268 269 270 271 272 273 274 | * already exist in the current namespace context. If a * namespace exists, that's okay. It may have been created * to contain stubs during a "namespace import" operation. * We'll just replace the namespace data below with the * proper class data. */ classNs = Tcl_FindNamespace(interp, (const char *)path, | | | | | | | | | | | 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | * already exist in the current namespace context. If a * namespace exists, that's okay. It may have been created * to contain stubs during a "namespace import" operation. * We'll just replace the namespace data below with the * proper class data. */ classNs = Tcl_FindNamespace(interp, (const char *)path, NULL, /* flags */ 0); if (classNs != NULL && Itcl_IsClassNamespace(classNs)) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "class \"", path, "\" already exists", NULL); return TCL_ERROR; } oPtr = NULL; /* * Make sure that a command with the given class name does not * already exist in the current namespace. This prevents the * usual Tcl commands from being clobbered when a programmer * makes a bogus call like "class info". */ cmd = Tcl_FindCommand(interp, (const char *)path, NULL, /* flags */ TCL_NAMESPACE_ONLY); if (cmd != NULL && !Itcl_IsStub(cmd)) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "command \"", path, "\" already exists", NULL); if (strstr(path,"::") == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), " in namespace \"", Tcl_GetCurrentNamespace(interp)->fullName, "\"", NULL); } return TCL_ERROR; } /* * Make sure that the class name does not have any goofy * characters: * * . => reserved for member access like: class.publicVar */ Itcl_ParseNamespPath(path, &buffer, &head, &tail); if (strstr(tail,".")) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "bad class name \"", tail, "\"", NULL); Tcl_DStringFree(&buffer); return TCL_ERROR; } Tcl_DStringFree(&buffer); /* * Allocate class definition data. */ iclsPtr = (ItclClass*)ckalloc(sizeof(ItclClass)); memset(iclsPtr, 0, sizeof(ItclClass)); iclsPtr->interp = interp; iclsPtr->infoPtr = infoPtr; Itcl_PreserveData(infoPtr); Tcl_InitObjHashTable(&iclsPtr->variables); Tcl_InitObjHashTable(&iclsPtr->functions); Tcl_InitObjHashTable(&iclsPtr->options); Tcl_InitObjHashTable(&iclsPtr->components); Tcl_InitObjHashTable(&iclsPtr->delegatedOptions); Tcl_InitObjHashTable(&iclsPtr->delegatedFunctions); Tcl_InitObjHashTable(&iclsPtr->methodVariables); Tcl_InitObjHashTable(&iclsPtr->resolveCmds); iclsPtr->numInstanceVars = 0; Tcl_InitHashTable(&iclsPtr->classCommons, TCL_ONE_WORD_KEYS); Tcl_InitHashTable(&iclsPtr->resolveVars, TCL_STRING_KEYS); Tcl_InitHashTable(&iclsPtr->contextCache, TCL_ONE_WORD_KEYS); Itcl_InitList(&iclsPtr->bases); Itcl_InitList(&iclsPtr->derived); resolveInfoPtr = (ItclResolveInfo *) ckalloc(sizeof(ItclResolveInfo)); memset(resolveInfoPtr, 0, sizeof(ItclResolveInfo)); resolveInfoPtr->flags = ITCL_RESOLVE_CLASS; resolveInfoPtr->iclsPtr = iclsPtr; iclsPtr->resolvePtr = (Tcl_Resolve *)ckalloc(sizeof(Tcl_Resolve)); iclsPtr->resolvePtr->cmdProcPtr = Itcl_CmdAliasProc; iclsPtr->resolvePtr->varProcPtr = Itcl_VarAliasProc; iclsPtr->resolvePtr->clientData = resolveInfoPtr; iclsPtr->flags = infoPtr->currClassFlags; |
︙ | ︙ | |||
402 403 404 405 406 407 408 | callbackPtr = Itcl_GetCurrentCallbackPtr(interp); /* * Create a command in the current namespace to manage the class: * <className> * <className> <objName> ?<constructor-args>? */ Tcl_NRAddCallback(interp, CallNewObjectInstance, infoPtr, | | | | 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | callbackPtr = Itcl_GetCurrentCallbackPtr(interp); /* * Create a command in the current namespace to manage the class: * <className> * <className> <objName> ?<constructor-args>? */ Tcl_NRAddCallback(interp, CallNewObjectInstance, infoPtr, (void *)path, &oPtr, nameObjPtr); result = Itcl_NRRunCallbacks(interp, callbackPtr); if (result == TCL_ERROR) { result = TCL_ERROR; goto errorOut; } iclsPtr->clsPtr = Tcl_GetObjectAsClass(oPtr); iclsPtr->oPtr = oPtr; ItclPreserveClass(iclsPtr); Tcl_ObjectSetMetadata(iclsPtr->oPtr, infoPtr->class_meta_type, iclsPtr); cmd = Tcl_GetObjectCommand(iclsPtr->oPtr); Tcl_GetCommandInfoFromToken(cmd, &cmdInfo); cmdInfo.deleteProc = ItclDestroyClass; cmdInfo.deleteData = iclsPtr; Tcl_SetCommandInfoFromToken(cmd, &cmdInfo); ooNs = Tcl_GetObjectNamespace(oPtr); classNs = Tcl_FindNamespace(interp, Tcl_GetString(nameObjPtr), NULL, /* flags */ 0); if (_TclOONamespaceDeleteProc == NULL) { _TclOONamespaceDeleteProc = ooNs->deleteProc; } if (classNs == NULL) { Tcl_AppendResult(interp, "ITCL: cannot create/get class namespace for class \"", |
︙ | ︙ | |||
455 456 457 458 459 460 461 | Tcl_IncrRefCount(iclsPtr->namePtr); iclsPtr->fullNamePtr = Tcl_NewStringObj(classNs->fullName, -1); Tcl_IncrRefCount(iclsPtr->fullNamePtr); hPtr = Tcl_CreateHashEntry(&infoPtr->nameClasses, (char *)iclsPtr->fullNamePtr, &newEntry); | | | | | | | 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 | Tcl_IncrRefCount(iclsPtr->namePtr); iclsPtr->fullNamePtr = Tcl_NewStringObj(classNs->fullName, -1); Tcl_IncrRefCount(iclsPtr->fullNamePtr); hPtr = Tcl_CreateHashEntry(&infoPtr->nameClasses, (char *)iclsPtr->fullNamePtr, &newEntry); Tcl_SetHashValue(hPtr, iclsPtr); hPtr = Tcl_CreateHashEntry(&infoPtr->namespaceClasses, (char *)classNs, &newEntry); Tcl_SetHashValue(hPtr, iclsPtr); if (classNs != ooNs) { hPtr = Tcl_CreateHashEntry(&infoPtr->namespaceClasses, (char *)ooNs, &newEntry); Tcl_SetHashValue(hPtr, iclsPtr); if (classNs->clientData && classNs->deleteProc) { (*classNs->deleteProc)(classNs->clientData); } classNs->clientData = iclsPtr; classNs->deleteProc = ItclDestroyClass2; } hPtr = Tcl_CreateHashEntry(&infoPtr->classes, (char *)iclsPtr, &newEntry); Tcl_SetHashValue(hPtr, iclsPtr); /* * now build the namespace for the common private and protected variables * public variables go directly to the class namespace */ Tcl_DStringInit(&buffer); Tcl_DStringAppend(&buffer, ITCL_VARIABLES_NAMESPACE, -1); |
︙ | ︙ | |||
508 509 510 511 512 513 514 | Itcl_ThisCmd, iclsPtr, NULL); /* * Add the built-in "type" variable to the list of data members. */ if (iclsPtr->flags & ITCL_TYPE) { namePtr = Tcl_NewStringObj("type", -1); | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < < < < < < < | 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 | Itcl_ThisCmd, iclsPtr, NULL); /* * Add the built-in "type" variable to the list of data members. */ if (iclsPtr->flags & ITCL_TYPE) { namePtr = Tcl_NewStringObj("type", -1); (void) Itcl_CreateVariable(interp, iclsPtr, namePtr, NULL, NULL, &ivPtr); ivPtr->protection = ITCL_PROTECTED; /* always "protected" */ ivPtr->flags |= ITCL_TYPE_VAR; /* mark as "type" variable */ hPtr = Tcl_CreateHashEntry(&iclsPtr->variables, (char *)namePtr, &newEntry); Tcl_SetHashValue(hPtr, ivPtr); } if (iclsPtr->flags & (ITCL_ECLASS)) { namePtr = Tcl_NewStringObj("win", -1); (void) Itcl_CreateVariable(interp, iclsPtr, namePtr, NULL, NULL, &ivPtr); ivPtr->protection = ITCL_PROTECTED; /* always "protected" */ ivPtr->flags |= ITCL_WIN_VAR; /* mark as "win" variable */ hPtr = Tcl_CreateHashEntry(&iclsPtr->variables, (char *)namePtr, &newEntry); Tcl_SetHashValue(hPtr, ivPtr); } if (iclsPtr->flags & (ITCL_TYPE|ITCL_WIDGET|ITCL_WIDGETADAPTOR)) { namePtr = Tcl_NewStringObj("self", -1); (void) Itcl_CreateVariable(interp, iclsPtr, namePtr, NULL, NULL, &ivPtr); ivPtr->protection = ITCL_PROTECTED; /* always "protected" */ ivPtr->flags |= ITCL_SELF_VAR; /* mark as "self" variable */ hPtr = Tcl_CreateHashEntry(&iclsPtr->variables, (char *)namePtr, &newEntry); Tcl_SetHashValue(hPtr, ivPtr); namePtr = Tcl_NewStringObj("selfns", -1); (void) Itcl_CreateVariable(interp, iclsPtr, namePtr, NULL, NULL, &ivPtr); ivPtr->protection = ITCL_PROTECTED; /* always "protected" */ ivPtr->flags |= ITCL_SELFNS_VAR; /* mark as "selfns" variable */ hPtr = Tcl_CreateHashEntry(&iclsPtr->variables, (char *)namePtr, &newEntry); Tcl_SetHashValue(hPtr, ivPtr); namePtr = Tcl_NewStringObj("win", -1); (void) Itcl_CreateVariable(interp, iclsPtr, namePtr, NULL, NULL, &ivPtr); ivPtr->protection = ITCL_PROTECTED; /* always "protected" */ ivPtr->flags |= ITCL_WIN_VAR; /* mark as "win" variable */ hPtr = Tcl_CreateHashEntry(&iclsPtr->variables, (char *)namePtr, &newEntry); Tcl_SetHashValue(hPtr, ivPtr); } namePtr = Tcl_NewStringObj("this", -1); (void) Itcl_CreateVariable(interp, iclsPtr, namePtr, NULL, NULL, &ivPtr); ivPtr->protection = ITCL_PROTECTED; /* always "protected" */ ivPtr->flags |= ITCL_THIS_VAR; /* mark as "this" variable */ hPtr = Tcl_CreateHashEntry(&iclsPtr->variables, (char *)namePtr, &newEntry); Tcl_SetHashValue(hPtr, ivPtr); if (infoPtr->currClassFlags & (ITCL_ECLASS|ITCL_TYPE|ITCL_WIDGETADAPTOR|ITCL_WIDGET)) { /* * Add the built-in "itcl_options" variable to the list of * data members. */ namePtr = Tcl_NewStringObj("itcl_options", -1); (void) Itcl_CreateVariable(interp, iclsPtr, namePtr, NULL, NULL, &ivPtr); ivPtr->protection = ITCL_PROTECTED; /* always "protected" */ ivPtr->flags |= ITCL_OPTIONS_VAR; /* mark as "itcl_options" * variable */ hPtr = Tcl_CreateHashEntry(&iclsPtr->variables, (char *)namePtr, &newEntry); Tcl_SetHashValue(hPtr, ivPtr); } if (infoPtr->currClassFlags & ITCL_ECLASS) { /* * Add the built-in "itcl_option_components" variable to the list of * data members. */ namePtr = Tcl_NewStringObj("itcl_option_components", -1); (void) Itcl_CreateVariable(interp, iclsPtr, namePtr, NULL, NULL, &ivPtr); ivPtr->protection = ITCL_PROTECTED; /* always "protected" */ ivPtr->flags |= ITCL_OPTION_COMP_VAR; /* mark as "itcl_option_components" * variable */ hPtr = Tcl_CreateHashEntry(&iclsPtr->variables, (char *)namePtr, &newEntry); Tcl_SetHashValue(hPtr, ivPtr); } if (infoPtr->currClassFlags & (ITCL_WIDGET|ITCL_WIDGETADAPTOR)) { /* * Add the built-in "thiswin" variable to the list of data members. */ namePtr = Tcl_NewStringObj("thiswin", -1); (void) Itcl_CreateVariable(interp, iclsPtr, namePtr, NULL, NULL, &ivPtr); ivPtr->protection = ITCL_PROTECTED; /* always "protected" */ ivPtr->flags |= ITCL_THIS_VAR; /* mark as "thiswin" variable */ hPtr = Tcl_CreateHashEntry(&iclsPtr->variables, (char *)namePtr, &newEntry); Tcl_SetHashValue(hPtr, ivPtr); } if (infoPtr->currClassFlags & (ITCL_WIDGET|ITCL_WIDGETADAPTOR)) { /* create the itcl_hull component */ ItclComponent *icPtr; namePtr = Tcl_NewStringObj("itcl_hull", 9); /* itcl_hull must not be an ITCL_COMMON!! */ if (ItclCreateComponent(interp, iclsPtr, namePtr, 0, &icPtr) != TCL_OK) { result = TCL_ERROR; goto errorOut; } } ItclPreserveClass(iclsPtr); iclsPtr->accessCmd = Tcl_GetObjectCommand(oPtr); /* FIXME should set the class objects unknown command to Itcl_HandleClass */ *rPtr = iclsPtr; result = TCL_OK; errorOut: Tcl_DecrRefCount(nameObjPtr); return result; |
︙ | ︙ | |||
676 677 678 679 680 681 682 | Tcl_Interp *interp, int result) { Tcl_HashEntry *hPtr; Tcl_HashSearch place; ItclClass *iclsPtr2 = NULL; ItclObject *contextIoPtr; | | | | 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 | Tcl_Interp *interp, int result) { Tcl_HashEntry *hPtr; Tcl_HashSearch place; ItclClass *iclsPtr2 = NULL; ItclObject *contextIoPtr; ItclClass *iclsPtr = (ItclClass *)data[0]; ItclObjectInfo *infoPtr = (ItclObjectInfo *)data[1]; void *callbackPtr; int classIsDeleted; if (result != TCL_OK) { return result; } classIsDeleted = 0; |
︙ | ︙ | |||
743 744 745 746 747 748 749 | static int CallDeleteOneClass( ClientData data[], Tcl_Interp *interp, int result) { Tcl_HashEntry *hPtr; | | | | 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 | static int CallDeleteOneClass( ClientData data[], Tcl_Interp *interp, int result) { Tcl_HashEntry *hPtr; ItclClass *iclsPtr = (ItclClass *)data[0]; ItclObjectInfo *infoPtr = (ItclObjectInfo *)data[1]; int isDerivedReleased; if (result != TCL_OK) { return result; } isDerivedReleased = iclsPtr->flags & ITCL_CLASS_DERIVED_RELEASED; result = Itcl_DeleteClass(interp, iclsPtr); |
︙ | ︙ | |||
795 796 797 798 799 800 801 | Tcl_HashEntry *hPtr; ItclObjectInfo *infoPtr; ItclClass *iclsPtr2 = NULL; Itcl_ListElem *elem; void *callbackPtr; int result; | | | 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 | Tcl_HashEntry *hPtr; ItclObjectInfo *infoPtr; ItclClass *iclsPtr2 = NULL; Itcl_ListElem *elem; void *callbackPtr; int result; infoPtr = (ItclObjectInfo *)Tcl_GetAssocData(interp, ITCL_INTERP_DATA, NULL); hPtr = Tcl_FindHashEntry(&infoPtr->classes, (char *)iclsPtr); if (hPtr == NULL) { /* class has already been deleted */ return TCL_OK; } if (iclsPtr->flags & ITCL_CLASS_IS_DELETED) { return TCL_OK; |
︙ | ︙ | |||
963 964 965 966 967 968 969 | */ hPtr = Tcl_FirstHashEntry(&iclsPtr->infoPtr->objects, &place); while (hPtr) { ioPtr = (ItclObject*)Tcl_GetHashValue(hPtr); if (ioPtr->iclsPtr == iclsPtr) { if ((ioPtr->accessCmd != NULL) && (!(ioPtr->flags & (ITCL_OBJECT_IS_DESTRUCTED)))) { | | | > > > > > > > > > > > > > > > > > > > | 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 | */ hPtr = Tcl_FirstHashEntry(&iclsPtr->infoPtr->objects, &place); while (hPtr) { ioPtr = (ItclObject*)Tcl_GetHashValue(hPtr); if (ioPtr->iclsPtr == iclsPtr) { if ((ioPtr->accessCmd != NULL) && (!(ioPtr->flags & (ITCL_OBJECT_IS_DESTRUCTED)))) { Itcl_PreserveData(ioPtr); Tcl_DeleteCommandFromToken(iclsPtr->interp, ioPtr->accessCmd); ioPtr->accessCmd = NULL; Itcl_ReleaseData(ioPtr); /* * Fix 227804: Whenever an object to delete was found we * have to reset the search to the beginning as the * current entry in the search was deleted and accessing it * is therefore not allowed anymore. */ hPtr = Tcl_FirstHashEntry(&iclsPtr->infoPtr->objects, &place); continue; } } hPtr = Tcl_NextHashEntry(&place); } /* * Now there are no objects and inherited classes anymore, they could access a * private/protected common variables, so delete the internal namespace. */ { Tcl_DString buffer; Tcl_Namespace *nsPtr; Tcl_DStringInit(&buffer); Tcl_DStringAppend(&buffer, ITCL_VARIABLES_NAMESPACE, -1); Tcl_DStringAppend(&buffer, (Tcl_GetObjectNamespace(iclsPtr->oPtr))->fullName, -1); nsPtr = Tcl_FindNamespace(iclsPtr->interp, Tcl_DStringValue(&buffer), NULL, 0); Tcl_DStringFree(&buffer); if (nsPtr != NULL) { Tcl_DeleteNamespace(nsPtr); } } /* * Next, remove this class from the "derived" list in * all base classes. */ belem = Itcl_FirstListElem(&iclsPtr->bases); while (belem) { |
︙ | ︙ | |||
1093 1094 1095 1096 1097 1098 1099 | * Tear down the virtual method table... */ while (1) { hPtr = Tcl_FirstHashEntry(&iclsPtr->resolveCmds, &place); if (hPtr == NULL) { break; } | | | | | 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 | * Tear down the virtual method table... */ while (1) { hPtr = Tcl_FirstHashEntry(&iclsPtr->resolveCmds, &place); if (hPtr == NULL) { break; } clookupPtr = (ItclCmdLookup *)Tcl_GetHashValue(hPtr); ckfree((char *)clookupPtr); Tcl_DeleteHashEntry(hPtr); } Tcl_DeleteHashTable(&iclsPtr->resolveCmds); /* * Delete all option definitions. */ while (1) { hPtr = Tcl_FirstHashEntry(&iclsPtr->options, &place); if (hPtr == NULL) { break; } ioptPtr = (ItclOption *)Tcl_GetHashValue(hPtr); Tcl_DeleteHashEntry(hPtr); Itcl_ReleaseData(ioptPtr); } Tcl_DeleteHashTable(&iclsPtr->options); /* * Delete all function definitions. */ FOREACH_HASH_VALUE(imPtr, &iclsPtr->functions) { imPtr->iclsPtr = NULL; Itcl_ReleaseData(imPtr); } Tcl_DeleteHashTable(&iclsPtr->functions); /* * Delete all delegated options. */ FOREACH_HASH_VALUE(idoPtr, &iclsPtr->delegatedOptions) { |
︙ | ︙ | |||
1145 1146 1147 1148 1149 1150 1151 | } Tcl_DeleteHashTable(&iclsPtr->delegatedFunctions); /* * Delete all components */ while (1) { | | | | | | | | 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 | } Tcl_DeleteHashTable(&iclsPtr->delegatedFunctions); /* * Delete all components */ while (1) { hPtr = Tcl_FirstHashEntry(&iclsPtr->components, &place); if (hPtr == NULL) { break; } icPtr = (ItclComponent *)Tcl_GetHashValue(hPtr); Tcl_DeleteHashEntry(hPtr); if (icPtr != NULL) { ItclDeleteComponent(icPtr); } } Tcl_DeleteHashTable(&iclsPtr->components); /* * Delete all variable definitions. */ while (1) { hPtr = Tcl_FirstHashEntry(&iclsPtr->variables, &place); if (hPtr == NULL) { break; } ivPtr = (ItclVariable *)Tcl_GetHashValue(hPtr); Tcl_DeleteHashEntry(hPtr); if (ivPtr != NULL) { Itcl_ReleaseData(ivPtr); } } Tcl_DeleteHashTable(&iclsPtr->variables); |
︙ | ︙ | |||
1244 1245 1246 1247 1248 1249 1250 | /* * Free up the object initialization code. */ if (iclsPtr->initCode) { Tcl_DecrRefCount(iclsPtr->initCode); } | | | | 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 | /* * Free up the object initialization code. */ if (iclsPtr->initCode) { Tcl_DecrRefCount(iclsPtr->initCode); } Itcl_ReleaseData(iclsPtr->infoPtr); Tcl_DecrRefCount(iclsPtr->namePtr); Tcl_DecrRefCount(iclsPtr->fullNamePtr); if (iclsPtr->resolvePtr != NULL) { ckfree((char *)iclsPtr->resolvePtr->clientData); ckfree((char *)iclsPtr->resolvePtr); } ckfree(iclsPtr); } /* * ------------------------------------------------------------------------ * Itcl_IsClassNamespace() * |
︙ | ︙ | |||
1338 1339 1340 1341 1342 1343 1344 | * Search for a namespace with the specified name, and if * one is found, see if it is a class namespace. */ Tcl_Namespace* classNs = Itcl_FindClassNamespace(interp, path); if (classNs) { | | | | 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 | * Search for a namespace with the specified name, and if * one is found, see if it is a class namespace. */ Tcl_Namespace* classNs = Itcl_FindClassNamespace(interp, path); if (classNs) { ItclObjectInfo *infoPtr = (ItclObjectInfo *) Tcl_GetAssocData(interp, ITCL_INTERP_DATA, NULL); Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&infoPtr->namespaceClasses, (char *) classNs); if (hPtr) { return (ItclClass *) Tcl_GetHashValue(hPtr); } } |
︙ | ︙ | |||
1372 1373 1374 1375 1376 1377 1378 | Tcl_DStringFree(&buf); return Itcl_FindClass(interp, path, 0); } Tcl_AppendResult(interp, "class \"", path, "\" not found in context \"", Tcl_GetCurrentNamespace(interp)->fullName, "\"", | | | 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 | Tcl_DStringFree(&buf); return Itcl_FindClass(interp, path, 0); } Tcl_AppendResult(interp, "class \"", path, "\" not found in context \"", Tcl_GetCurrentNamespace(interp)->fullName, "\"", NULL); return NULL; } /* * ------------------------------------------------------------------------ * Itcl_FindClassNamespace() |
︙ | ︙ | |||
1400 1401 1402 1403 1404 1405 1406 | * context, just like the normal command lookup. * * This procedure returns a pointer to the desired namespace, or * NULL if the namespace was not found. * ------------------------------------------------------------------------ */ Tcl_Namespace* | | | | | 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 | * context, just like the normal command lookup. * * This procedure returns a pointer to the desired namespace, or * NULL if the namespace was not found. * ------------------------------------------------------------------------ */ Tcl_Namespace* Itcl_FindClassNamespace( Tcl_Interp* interp, /* interpreter containing class */ const char* path) /* path name for class */ { Tcl_Namespace* contextNs = Tcl_GetCurrentNamespace(interp); Tcl_Namespace *classNs = Tcl_FindNamespace(interp, path, NULL, 0); if ( !classNs /* We didn't find it... */ && contextNs->parentPtr != NULL /* context is not global */ && (*path != ':' || *(path+1) != ':') /* path not FQ */ |
︙ | ︙ | |||
1428 1429 1430 1431 1432 1433 1434 | static int FinalizeCreateObject( ClientData data[], Tcl_Interp *interp, int result) { | | | | | | | | 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 | static int FinalizeCreateObject( ClientData data[], Tcl_Interp *interp, int result) { Tcl_Obj *objNamePtr = (Tcl_Obj *)data[0]; ItclClass *iclsPtr = (ItclClass *)data[1]; if (result == TCL_OK) { if (!(iclsPtr->flags & (ITCL_TYPE|ITCL_WIDGET|ITCL_WIDGETADAPTOR))) { Tcl_ResetResult(interp); Tcl_AppendResult(interp, Tcl_GetString(objNamePtr), NULL); } } Tcl_DecrRefCount(objNamePtr); return result; } static int CallCreateObject( ClientData data[], Tcl_Interp *interp, int result) { Tcl_Obj *objNamePtr = (Tcl_Obj *)data[0]; ItclClass *iclsPtr = (ItclClass *)data[1]; int objc = PTR2INT(data[2]); Tcl_Obj **objv = (Tcl_Obj **)data[3]; if (result == TCL_OK) { result = ItclCreateObject(interp, Tcl_GetString(objNamePtr), iclsPtr, objc, objv); } return result; } /* * ------------------------------------------------------------------------ * Itcl_HandleClass() * * first argument is ::itcl::parser::handleClass * Invoked by Tcl whenever the user issues the command associated with * a class name. Handles the following syntax: * * <className> * <className> <objName> ?<args>...? * * Without any arguments, the command does nothing. In the olden days, |
︙ | ︙ | |||
1578 1579 1580 1581 1582 1583 1584 | hPtr = Tcl_FindHashEntry(&infoPtr->nameClasses, (char *)objv[2]); if (hPtr == NULL) { Tcl_AppendResult(interp, "no such class: \"", Tcl_GetString(objv[1]), "\"", NULL); return TCL_ERROR; } | | | 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 | hPtr = Tcl_FindHashEntry(&infoPtr->nameClasses, (char *)objv[2]); if (hPtr == NULL) { Tcl_AppendResult(interp, "no such class: \"", Tcl_GetString(objv[1]), "\"", NULL); return TCL_ERROR; } iclsPtr = (ItclClass *)Tcl_GetHashValue(hPtr); /* * If the object name is "::", and if this is an old-style class * definition, then treat the remaining arguments as a command * in the class namespace. This used to be the way of invoking * a class proc, but the new syntax is "class::proc" (without * spaces). |
︙ | ︙ | |||
1600 1601 1602 1603 1604 1605 1606 | Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "syntax \"class :: proc\" is an anachronism\n", "[incr Tcl] no longer supports this syntax.\n", "Instead, remove the spaces from your procedure invocations:\n", " ", Tcl_GetString(objv[1]), "::", Tcl_GetString(objv[4]), " ?args?", | | | 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 | Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "syntax \"class :: proc\" is an anachronism\n", "[incr Tcl] no longer supports this syntax.\n", "Instead, remove the spaces from your procedure invocations:\n", " ", Tcl_GetString(objv[1]), "::", Tcl_GetString(objv[4]), " ?args?", NULL); return TCL_ERROR; } /* * Otherwise, we have a proper object name. Create a new instance * with that name. If the name contains "#auto", replace this with * a uniquely generated string based on the class name. |
︙ | ︙ | |||
1838 1839 1840 1841 1842 1843 1844 | vlookup->varNum = 1; } else { vlookup->varNum = iclsPtr->numInstanceVars++; } } } | | | 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 | vlookup->varNum = 1; } else { vlookup->varNum = iclsPtr->numInstanceVars++; } } } Tcl_SetHashValue(hPtr, vlookup); vlookup->usage++; } /* if we have found it */ if (simpleName == lookupName || strcmp(varName, lookupName) == 0) { if (!reshPtr) { reshPtr = hPtr; |
︙ | ︙ | |||
1979 1980 1981 1982 1983 1984 1985 | hPtr = Tcl_CreateHashEntry(&iclsPtr->resolveCmds, (char *)objPtr, &newEntry); if (newEntry) { clookupPtr = (ItclCmdLookup *)ckalloc(sizeof(ItclCmdLookup)); memset(clookupPtr, 0, sizeof(ItclCmdLookup)); clookupPtr->imPtr = imPtr; | | | 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 | hPtr = Tcl_CreateHashEntry(&iclsPtr->resolveCmds, (char *)objPtr, &newEntry); if (newEntry) { clookupPtr = (ItclCmdLookup *)ckalloc(sizeof(ItclCmdLookup)); memset(clookupPtr, 0, sizeof(ItclCmdLookup)); clookupPtr->imPtr = imPtr; Tcl_SetHashValue(hPtr, clookupPtr); } else { Tcl_DecrRefCount(objPtr); } if (nsPtr == NULL) { break; } |
︙ | ︙ | |||
2070 2071 2072 2073 2074 2075 2076 | */ hPtr = Tcl_CreateHashEntry(&iclsPtr->variables, (char *)namePtr, &newEntry); if (!newEntry) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "variable name \"", Tcl_GetString(namePtr), "\" already defined in class \"", Tcl_GetString(iclsPtr->fullNamePtr), "\"", | | | | | < | | 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 | */ hPtr = Tcl_CreateHashEntry(&iclsPtr->variables, (char *)namePtr, &newEntry); if (!newEntry) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "variable name \"", Tcl_GetString(namePtr), "\" already defined in class \"", Tcl_GetString(iclsPtr->fullNamePtr), "\"", NULL); return TCL_ERROR; } /* * If this variable has some "config" code, try to capture * its implementation. */ if (config) { if (Itcl_CreateMemberCode(interp, iclsPtr, NULL, config, &mCodePtr) != TCL_OK) { Tcl_DeleteHashEntry(hPtr); return TCL_ERROR; } Itcl_PreserveData(mCodePtr); } else { mCodePtr = NULL; } /* * If everything looks good, create the variable definition. */ ivPtr = (ItclVariable*)Itcl_Alloc(sizeof(ItclVariable)); ivPtr->iclsPtr = iclsPtr; ivPtr->infoPtr = iclsPtr->infoPtr; ivPtr->protection = Itcl_Protection(interp, 0); ivPtr->codePtr = mCodePtr; ivPtr->namePtr = namePtr; Tcl_IncrRefCount(ivPtr->namePtr); ivPtr->fullNamePtr = Tcl_NewStringObj( |
︙ | ︙ | |||
2118 2119 2120 2121 2122 2123 2124 | if (init != NULL) { ivPtr->init = Tcl_NewStringObj(init, -1); Tcl_IncrRefCount(ivPtr->init); } else { ivPtr->init = NULL; } | | | | | 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 | if (init != NULL) { ivPtr->init = Tcl_NewStringObj(init, -1); Tcl_IncrRefCount(ivPtr->init); } else { ivPtr->init = NULL; } Tcl_SetHashValue(hPtr, ivPtr); Itcl_PreserveData(ivPtr); Itcl_EventuallyFree(ivPtr, (Tcl_FreeProc *) Itcl_DeleteVariable); *ivPtrPtr = ivPtr; return TCL_OK; } /* * ------------------------------------------------------------------------ |
︙ | ︙ | |||
2160 2161 2162 2163 2164 2165 2166 | hPtr = Tcl_CreateHashEntry(&iclsPtr->options, (char *)ioptPtr->namePtr, &newEntry); if (!newEntry) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "option name \"", Tcl_GetString(ioptPtr->namePtr), "\" already defined in class \"", Tcl_GetString(iclsPtr->fullNamePtr), "\"", | | | | | | | 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 | hPtr = Tcl_CreateHashEntry(&iclsPtr->options, (char *)ioptPtr->namePtr, &newEntry); if (!newEntry) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "option name \"", Tcl_GetString(ioptPtr->namePtr), "\" already defined in class \"", Tcl_GetString(iclsPtr->fullNamePtr), "\"", NULL); return TCL_ERROR; } iclsPtr->numOptions++; ioptPtr->iclsPtr = iclsPtr; ioptPtr->codePtr = NULL; ioptPtr->fullNamePtr = Tcl_NewStringObj( Tcl_GetString(iclsPtr->fullNamePtr), -1); Tcl_AppendToObj(ioptPtr->fullNamePtr, "::", 2); Tcl_AppendToObj(ioptPtr->fullNamePtr, Tcl_GetString(ioptPtr->namePtr), -1); Tcl_IncrRefCount(ioptPtr->fullNamePtr); Tcl_SetHashValue(hPtr, ioptPtr); Itcl_PreserveData(ioptPtr); Itcl_EventuallyFree(ioptPtr, (Tcl_FreeProc *) ItclDeleteOption); return TCL_OK; } /* * ------------------------------------------------------------------------ * Itcl_CreateMethodVariable() * * Creates a new class methdovariable definition. If this is a public * methodvariable, * * Returns TCL_ERROR along with an error message in the specified * interpreter if anything goes wrong. Otherwise, this returns * TCL_OK and a pointer to the new option definition in "imvPtr". * ------------------------------------------------------------------------ */ int |
︙ | ︙ | |||
2215 2216 2217 2218 2219 2220 2221 | hPtr = Tcl_CreateHashEntry(&iclsPtr->methodVariables, (char *)namePtr, &isNew); if (!isNew) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "methdovariable name \"", Tcl_GetString(namePtr), "\" already defined in class \"", Tcl_GetString (iclsPtr->fullNamePtr), "\"", | | | 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 | hPtr = Tcl_CreateHashEntry(&iclsPtr->methodVariables, (char *)namePtr, &isNew); if (!isNew) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "methdovariable name \"", Tcl_GetString(namePtr), "\" already defined in class \"", Tcl_GetString (iclsPtr->fullNamePtr), "\"", NULL); return TCL_ERROR; } Tcl_IncrRefCount(namePtr); /* * If everything looks good, create the option definition. */ |
︙ | ︙ | |||
2247 2248 2249 2250 2251 2252 2253 | Tcl_IncrRefCount(imvPtr->callbackPtr); } if (imvPtr->protection == ITCL_DEFAULT_PROTECT) { imvPtr->protection = ITCL_PROTECTED; } | | | 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 | Tcl_IncrRefCount(imvPtr->callbackPtr); } if (imvPtr->protection == ITCL_DEFAULT_PROTECT) { imvPtr->protection = ITCL_PROTECTED; } Tcl_SetHashValue(hPtr, imvPtr); *imvPtrPtr = imvPtr; return TCL_OK; } |
︙ | ︙ | |||
2300 2301 2302 2303 2304 2305 2306 | namePtr = Tcl_NewStringObj(lastCp, -1); Tcl_IncrRefCount(namePtr); hPtr = Tcl_FindHashEntry(&contextIclsPtr->variables, (char *)namePtr); Tcl_DecrRefCount(namePtr); if (hPtr == NULL) { return NULL; } | | | | 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 | namePtr = Tcl_NewStringObj(lastCp, -1); Tcl_IncrRefCount(namePtr); hPtr = Tcl_FindHashEntry(&contextIclsPtr->variables, (char *)namePtr); Tcl_DecrRefCount(namePtr); if (hPtr == NULL) { return NULL; } ivPtr = (ItclVariable *)Tcl_GetHashValue(hPtr); /* * Activate the namespace for the given class. That installs * the appropriate name resolution rules and by-passes any * security restrictions. */ if (lastCp == name) { /* 'name' is a simple name (this is untested!!!!) */ /* Use the context class passed in */ oPtr = contextIclsPtr->oPtr; } else { int code = TCL_ERROR; Tcl_Obj *classObjPtr = Tcl_NewStringObj(name, lastCp - name - 2); oPtr = Tcl_GetObjectFromObj(interp, classObjPtr); if (oPtr) { ItclClass *iclsPtr = (ItclClass *)Tcl_ObjectGetMetadata(oPtr, contextIclsPtr->infoPtr->class_meta_type); if (iclsPtr) { code = TCL_OK; assert(oPtr == iclsPtr->oPtr); /* |
︙ | ︙ | |||
2355 2356 2357 2358 2359 2360 2361 | Tcl_DStringAppend(&buffer, ITCL_VARIABLES_NAMESPACE, -1); } Tcl_DStringAppend(&buffer, (Tcl_GetObjectNamespace(oPtr))->fullName, -1); Tcl_DStringAppend(&buffer, "::", -1); Tcl_DStringAppend(&buffer, lastCp, -1); val = Tcl_GetVar2(interp, (const char *)Tcl_DStringValue(&buffer), | | | | | | | | | | 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 | Tcl_DStringAppend(&buffer, ITCL_VARIABLES_NAMESPACE, -1); } Tcl_DStringAppend(&buffer, (Tcl_GetObjectNamespace(oPtr))->fullName, -1); Tcl_DStringAppend(&buffer, "::", -1); Tcl_DStringAppend(&buffer, lastCp, -1); val = Tcl_GetVar2(interp, (const char *)Tcl_DStringValue(&buffer), NULL, 0); Tcl_DStringFree(&buffer); return val; } /* * ------------------------------------------------------------------------ * Itcl_InitHierIter() * * Initializes an iterator for traversing the hierarchy of the given * class. Subsequent calls to Itcl_AdvanceHierIter() will return * the base classes in order from most-to-least specific. * ------------------------------------------------------------------------ */ void Itcl_InitHierIter( ItclHierIter *iter, /* iterator used for traversal */ ItclClass *iclsPtr) /* class definition for start of traversal */ { Itcl_InitStack(&iter->stack); Itcl_PushStack(iclsPtr, &iter->stack); iter->current = iclsPtr; } /* * ------------------------------------------------------------------------ * Itcl_DeleteHierIter() * * Destroys an iterator for traversing class hierarchies, freeing * all memory associated with it. * ------------------------------------------------------------------------ */ void Itcl_DeleteHierIter( ItclHierIter *iter) /* iterator used for traversal */ { Itcl_DeleteStack(&iter->stack); iter->current = NULL; } /* * ------------------------------------------------------------------------ * Itcl_AdvanceHierIter() * * Moves a class hierarchy iterator forward to the next base class. * Returns a pointer to the current class definition, or NULL when * the end of the hierarchy has been reached. * ------------------------------------------------------------------------ */ ItclClass* Itcl_AdvanceHierIter( ItclHierIter *iter) /* iterator used for traversal */ { Itcl_ListElem *elem; ItclClass *iclsPtr; iter->current = (ItclClass*)Itcl_PopStack(&iter->stack); /* * Push classes onto the stack in reverse order, so that * they will be popped off in the proper order. |
︙ | ︙ | |||
2445 2446 2447 2448 2449 2450 2451 | Itcl_DeleteVariable( char *cdata) /* variable definition to be destroyed */ { Tcl_HashEntry *hPtr; ItclVariable *ivPtr; ivPtr = (ItclVariable *)cdata; | < < | | | 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 | Itcl_DeleteVariable( char *cdata) /* variable definition to be destroyed */ { Tcl_HashEntry *hPtr; ItclVariable *ivPtr; ivPtr = (ItclVariable *)cdata; hPtr = Tcl_FindHashEntry(&ivPtr->infoPtr->classes, (char *)ivPtr->iclsPtr); if (hPtr != NULL) { /* unlink owerself from list of class variables */ hPtr = Tcl_FindHashEntry(&ivPtr->iclsPtr->variables, (char *)ivPtr->namePtr); if (hPtr != NULL) { Tcl_DeleteHashEntry(hPtr); } } if (ivPtr->codePtr != NULL) { Itcl_ReleaseData(ivPtr->codePtr); } Tcl_DecrRefCount(ivPtr->namePtr); Tcl_DecrRefCount(ivPtr->fullNamePtr); if (ivPtr->init) { Tcl_DecrRefCount(ivPtr->init); } if (ivPtr->arrayInitPtr) { Tcl_DecrRefCount(ivPtr->arrayInitPtr); } Itcl_Free(ivPtr); } /* * ------------------------------------------------------------------------ * ItclDeleteOption() * * Destroys a option definition created by Itcl_CreateOption(), |
︙ | ︙ | |||
2495 2496 2497 2498 2499 2500 2501 | Tcl_DecrRefCount(ioptPtr->resourceNamePtr); } if (ioptPtr->resourceNamePtr != NULL) { Tcl_DecrRefCount(ioptPtr->classNamePtr); } if (ioptPtr->codePtr) { | | | 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 | Tcl_DecrRefCount(ioptPtr->resourceNamePtr); } if (ioptPtr->resourceNamePtr != NULL) { Tcl_DecrRefCount(ioptPtr->classNamePtr); } if (ioptPtr->codePtr) { Itcl_ReleaseData(ioptPtr->codePtr); } if (ioptPtr->defaultValuePtr != NULL) { Tcl_DecrRefCount(ioptPtr->defaultValuePtr); } if (ioptPtr->cgetMethodPtr != NULL) { Tcl_DecrRefCount(ioptPtr->cgetMethodPtr); } |
︙ | ︙ | |||
2519 2520 2521 2522 2523 2524 2525 | if (ioptPtr->validateMethodPtr != NULL) { Tcl_DecrRefCount(ioptPtr->validateMethodPtr); } if (ioptPtr->validateMethodVarPtr != NULL) { Tcl_DecrRefCount(ioptPtr->validateMethodVarPtr); } Itcl_ReleaseData(ioptPtr->idoPtr); | | | 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 | if (ioptPtr->validateMethodPtr != NULL) { Tcl_DecrRefCount(ioptPtr->validateMethodPtr); } if (ioptPtr->validateMethodVarPtr != NULL) { Tcl_DecrRefCount(ioptPtr->validateMethodVarPtr); } Itcl_ReleaseData(ioptPtr->idoPtr); Itcl_Free(ioptPtr); } /* * ------------------------------------------------------------------------ * ItclDeleteFunction() * * fre data associated with a function |
︙ | ︙ | |||
2550 2551 2552 2553 2554 2555 2556 | hPtr = Tcl_FindHashEntry(&imPtr->iclsPtr->functions, (char *)imPtr->namePtr); if (hPtr != NULL) { Tcl_DeleteHashEntry(hPtr); } } if (imPtr->codePtr != NULL) { | | | 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 | hPtr = Tcl_FindHashEntry(&imPtr->iclsPtr->functions, (char *)imPtr->namePtr); if (hPtr != NULL) { Tcl_DeleteHashEntry(hPtr); } } if (imPtr->codePtr != NULL) { Itcl_ReleaseData(imPtr->codePtr); } Tcl_DecrRefCount(imPtr->namePtr); Tcl_DecrRefCount(imPtr->fullNamePtr); if (imPtr->usagePtr != NULL) { Tcl_DecrRefCount(imPtr->usagePtr); } if (imPtr->argumentPtr != NULL) { |
︙ | ︙ | |||
2572 2573 2574 2575 2576 2577 2578 | } if (imPtr->bodyPtr != NULL) { Tcl_DecrRefCount(imPtr->bodyPtr); } if (imPtr->argListPtr != NULL) { ItclDeleteArgList(imPtr->argListPtr); } | | | 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 | } if (imPtr->bodyPtr != NULL) { Tcl_DecrRefCount(imPtr->bodyPtr); } if (imPtr->argListPtr != NULL) { ItclDeleteArgList(imPtr->argListPtr); } Itcl_Free(imPtr); } /* * ------------------------------------------------------------------------ * ItclDeleteComponent() * * free data associated with a component |
︙ | ︙ | |||
2633 2634 2635 2636 2637 2638 2639 | } FOREACH_HASH_VALUE(objPtr, &idoPtr->exceptions) { if (objPtr != NULL) { Tcl_DecrRefCount(objPtr); } } Tcl_DeleteHashTable(&idoPtr->exceptions); | | | 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 | } FOREACH_HASH_VALUE(objPtr, &idoPtr->exceptions) { if (objPtr != NULL) { Tcl_DecrRefCount(objPtr); } } Tcl_DeleteHashTable(&idoPtr->exceptions); Itcl_Free(idoPtr); } /* * ------------------------------------------------------------------------ * ItclDeleteDelegatedFunction() * * free data associated with a delegated function |
︙ | ︙ |
Changes to generic/itclCmd.c.
︙ | ︙ | |||
51 52 53 54 55 56 57 | Tcl_Obj *const objv[]) /* argument objects */ { ClientData clientData2; Tcl_Object oPtr; ItclClass *iclsPtr; ItclShowArgs(1, "NRThisCmd", objc, objv); | | | | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | Tcl_Obj *const objv[]) /* argument objects */ { ClientData clientData2; Tcl_Object oPtr; ItclClass *iclsPtr; ItclShowArgs(1, "NRThisCmd", objc, objv); iclsPtr = (ItclClass *)clientData; clientData2 = Itcl_GetCallFrameClientData(interp); oPtr = Tcl_ObjectContextObject((Tcl_ObjectContext)clientData2); return Itcl_PublicObjectCmd(oPtr, interp, iclsPtr->clsPtr, objc, objv); } /* ARGSUSED */ int Itcl_ThisCmd( ClientData clientData, Tcl_Interp *interp, |
︙ | ︙ | |||
78 79 80 81 82 83 84 | const char *val; int result; if (objc == 1) { return Itcl_SelfCmd(clientData,interp, objc, objv); } ItclShowArgs(1, "Itcl_ThisCmd", objc, objv); | | | | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | const char *val; int result; if (objc == 1) { return Itcl_SelfCmd(clientData,interp, objc, objv); } ItclShowArgs(1, "Itcl_ThisCmd", objc, objv); iclsPtr = (ItclClass *)clientData; clientData2 = Itcl_GetCallFrameClientData(interp); if (clientData2 == NULL) { Tcl_AppendResult(interp, "this cannot be invoked without an object context", NULL); return TCL_ERROR; } oPtr = Tcl_ObjectContextObject((Tcl_ObjectContext)clientData2); if (oPtr == NULL) { Tcl_AppendResult(interp, "this cannot be invoked without an object context", NULL); return TCL_ERROR; } if (objc == 1) { Tcl_Obj *namePtr = Tcl_NewObj(); |
︙ | ︙ | |||
207 208 209 210 211 212 213 | * Search through all commands in the current namespace first, * in the global namespace next, then in all child namespaces * in this interpreter. If we find any commands that * represent classes, report them. */ Itcl_InitStack(&search); | | | | | 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | * Search through all commands in the current namespace first, * in the global namespace next, then in all child namespaces * in this interpreter. If we find any commands that * represent classes, report them. */ Itcl_InitStack(&search); Itcl_PushStack(globalNs, &search); Itcl_PushStack(activeNs, &search); /* last in, first out! */ Tcl_InitHashTable(&unique, TCL_ONE_WORD_KEYS); handledActiveNs = 0; while (Itcl_GetStackSize(&search) > 0) { nsPtr = (Tcl_Namespace *)Itcl_PopStack(&search); if (nsPtr == activeNs && handledActiveNs) { continue; } hPtr = Tcl_FirstHashEntry(Itcl_GetNamespaceCommandTable(nsPtr), &place); while (hPtr) { |
︙ | ︙ | |||
238 239 240 241 242 243 244 | * another namespace. * * Otherwise, report short names. */ if (forceFullNames || nsPtr != activeNs || originalCmd != NULL) { | | | | 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | * another namespace. * * Otherwise, report short names. */ if (forceFullNames || nsPtr != activeNs || originalCmd != NULL) { objPtr = Tcl_NewStringObj(NULL, 0); Tcl_GetCommandFullName(interp, cmd, objPtr); cmdName = Tcl_GetString(objPtr); } else { cmdName = Tcl_GetCommandName(interp, cmd); objPtr = Tcl_NewStringObj((const char *)cmdName, -1); } if (originalCmd) { cmd = originalCmd; } Tcl_CreateHashEntry(&unique, (char*)cmd, &newEntry); if (newEntry && ((pattern == NULL) || Tcl_StringCaseMatch((const char *)cmdName, pattern, 0))) { Tcl_ListObjAppendElement(NULL, Tcl_GetObjResult(interp), objPtr); } else { /* if not appended to the result, free objPtr. */ Tcl_DecrRefCount(objPtr); } } |
︙ | ︙ | |||
389 390 391 392 393 394 395 | * Search through all commands in the current namespace first, * in the global namespace next, then in all child namespaces * in this interpreter. If we find any commands that * represent objects, report them. */ Itcl_InitStack(&search); | | | | | 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 | * Search through all commands in the current namespace first, * in the global namespace next, then in all child namespaces * in this interpreter. If we find any commands that * represent objects, report them. */ Itcl_InitStack(&search); Itcl_PushStack(globalNs, &search); Itcl_PushStack(activeNs, &search); /* last in, first out! */ Tcl_InitHashTable(&unique, TCL_ONE_WORD_KEYS); handledActiveNs = 0; while (Itcl_GetStackSize(&search) > 0) { nsPtr = (Tcl_Namespace *)Itcl_PopStack(&search); if (nsPtr == activeNs && handledActiveNs) { continue; } entry = Tcl_FirstHashEntry(Itcl_GetNamespaceCommandTable(nsPtr), &place); while (entry) { cmd = (Tcl_Command)Tcl_GetHashValue(entry); |
︙ | ︙ | |||
424 425 426 427 428 429 430 | * another namespace. * * Otherwise, report short names. */ if (forceFullNames || nsPtr != activeNs || originalCmd != NULL) { | | | 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 | * another namespace. * * Otherwise, report short names. */ if (forceFullNames || nsPtr != activeNs || originalCmd != NULL) { objPtr = Tcl_NewStringObj(NULL, 0); Tcl_GetCommandFullName(interp, cmd, objPtr); cmdName = Tcl_GetString(objPtr); } else { cmdName = Tcl_GetCommandName(interp, cmd); objPtr = Tcl_NewStringObj((const char *)cmdName, -1); } |
︙ | ︙ | |||
455 456 457 458 459 460 461 | match = 1; } } } } if (match) { | | | 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 | match = 1; } } } } if (match) { Tcl_ListObjAppendElement(NULL, Tcl_GetObjResult(interp), objPtr); } else { Tcl_DecrRefCount(objPtr); /* throw away the name */ } } entry = Tcl_NextHashEntry(&place); } |
︙ | ︙ | |||
568 569 570 571 572 573 574 | */ static int CallDeleteObject( ClientData data[], Tcl_Interp *interp, int result) { | | | 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 | */ static int CallDeleteObject( ClientData data[], Tcl_Interp *interp, int result) { ItclObject *contextIoPtr = (ItclObject *)data[0]; if (contextIoPtr->destructorHasBeenCalled) { Tcl_AppendResult(interp, "can't delete an object while it is being ", "destructed", NULL); return TCL_ERROR; } if (result == TCL_OK) { result = Itcl_DeleteObject(interp, contextIoPtr); |
︙ | ︙ | |||
600 601 602 603 604 605 606 | ItclShowArgs(1, "Itcl_DelObjectCmd", objc, objv); /* * Scan through the list of objects and attempt to delete them. * If anything goes wrong (i.e., destructors fail), then * abort with an error. */ for (i=1; i < objc; i++) { | | | | 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 | ItclShowArgs(1, "Itcl_DelObjectCmd", objc, objv); /* * Scan through the list of objects and attempt to delete them. * If anything goes wrong (i.e., destructors fail), then * abort with an error. */ for (i=1; i < objc; i++) { name = Tcl_GetString(objv[i]); contextIoPtr = NULL; if (Itcl_FindObject(interp, name, &contextIoPtr) != TCL_OK) { return TCL_ERROR; } if (contextIoPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "object \"", name, "\" not found", NULL); return TCL_ERROR; } callbackPtr = Itcl_GetCurrentCallbackPtr(interp); Tcl_NRAddCallback(interp, CallDeleteObject, contextIoPtr, NULL, NULL, NULL); result = Itcl_NRRunCallbacks(interp, callbackPtr); |
︙ | ︙ | |||
680 681 682 683 684 685 686 | Tcl_Var var; Tcl_HashEntry *entry; ItclClass *contextIclsPtr; ItclObject *contextIoPtr; ItclObjectInfo *infoPtr; ItclVarLookup *vlookup; char *openParen; | | | | 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 | Tcl_Var var; Tcl_HashEntry *entry; ItclClass *contextIclsPtr; ItclObject *contextIoPtr; ItclObjectInfo *infoPtr; ItclVarLookup *vlookup; char *openParen; char *p; char *token; int doAppend; int result; ItclShowArgs(1, "Itcl_ScopeCmd", objc, objv); if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "varname"); return TCL_ERROR; } contextNsPtr = Tcl_GetCurrentNamespace(interp); openParen = NULL; result = TCL_OK; /* * If this looks like a fully qualified name already, * then return it as is. */ token = Tcl_GetString(objv[1]); if (*token == ':' && *(token+1) == ':') { Tcl_SetObjResult(interp, objv[1]); return TCL_OK; } /* * If the variable name is an array reference, pick out |
︙ | ︙ | |||
735 736 737 738 739 740 741 | * the array variable as the variable name. We must be * careful to add the index (everything from openParen * onward) as well. */ contextIoPtr = NULL; contextIclsPtr = NULL; oPtr = NULL; | | | | 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 | * the array variable as the variable name. We must be * careful to add the index (everything from openParen * onward) as well. */ contextIoPtr = NULL; contextIclsPtr = NULL; oPtr = NULL; infoPtr = (ItclObjectInfo *)Tcl_GetAssocData(interp, ITCL_INTERP_DATA, NULL); hPtr = Tcl_FindHashEntry(&infoPtr->namespaceClasses, (char *)contextNsPtr); if (hPtr != NULL) { contextIclsPtr = (ItclClass *)Tcl_GetHashValue(hPtr); } if (Itcl_IsClassNamespace(contextNsPtr)) { ClientData clientData; entry = ItclResolveVarEntry(contextIclsPtr, token); if (!entry) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "variable \"", token, "\" not found in class \"", Tcl_GetString(contextIclsPtr->fullNamePtr), "\"", NULL); result = TCL_ERROR; goto scopeCmdDone; } vlookup = (ItclVarLookup*)Tcl_GetHashValue(entry); if (vlookup->ivPtr->flags & ITCL_COMMON) { Tcl_Obj *resultPtr = Tcl_GetObjResult(interp); |
︙ | ︙ | |||
793 794 795 796 797 798 799 | contextIoPtr = infoPtr->currIoPtr; } } if (contextIoPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "can't scope variable \"", token, "\": missing object context", | | | | 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 | contextIoPtr = infoPtr->currIoPtr; } } if (contextIoPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "can't scope variable \"", token, "\": missing object context", NULL); result = TCL_ERROR; goto scopeCmdDone; } doAppend = 1; if (contextIclsPtr->flags & ITCL_ECLASS) { if (strcmp(token, "itcl_options") == 0) { doAppend = 0; } } objPtr2 = Tcl_NewStringObj(NULL, 0); Tcl_IncrRefCount(objPtr2); Tcl_AppendToObj(objPtr2, ITCL_VARIABLES_NAMESPACE, -1); Tcl_AppendToObj(objPtr2, (Tcl_GetObjectNamespace(contextIoPtr->oPtr))->fullName, -1); if (doAppend) { Tcl_AppendToObj(objPtr2, |
︙ | ︙ | |||
848 849 850 851 852 853 854 | var = Itcl_FindNamespaceVar(interp, token, contextNsPtr, TCL_NAMESPACE_ONLY); if (!var) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "variable \"", token, "\" not found in namespace \"", contextNsPtr->fullName, "\"", | | | 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 | var = Itcl_FindNamespaceVar(interp, token, contextNsPtr, TCL_NAMESPACE_ONLY); if (!var) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "variable \"", token, "\" not found in namespace \"", contextNsPtr->fullName, "\"", NULL); result = TCL_ERROR; goto scopeCmdDone; } Itcl_GetVariableFullName(interp, var, resultPtr); if (openParen) { *openParen = '('; |
︙ | ︙ | |||
909 910 911 912 913 914 915 | int pos; ItclShowArgs(1, "Itcl_CodeCmd", objc, objv); /* * Handle flags like "-namespace"... */ for (pos=1; pos < objc; pos++) { | | | | | | 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 | int pos; ItclShowArgs(1, "Itcl_CodeCmd", objc, objv); /* * Handle flags like "-namespace"... */ for (pos=1; pos < objc; pos++) { token = Tcl_GetString(objv[pos]); if (*token != '-') { break; } if (strcmp(token, "-namespace") == 0) { if (objc == 2) { Tcl_WrongNumArgs(interp, 1, objv, "?-namespace name? command ?arg arg...?"); return TCL_ERROR; } else { token = Tcl_GetString(objv[pos+1]); contextNs = Tcl_FindNamespace(interp, token, NULL, TCL_LEAVE_ERR_MSG); if (!contextNs) { return TCL_ERROR; } pos++; } } else { if (strcmp(token, "--") == 0) { pos++; break; } else { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "bad option \"", token, "\": should be -namespace or --", NULL); return TCL_ERROR; } } } if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "?-namespace name? command ?arg arg...?"); return TCL_ERROR; } /* * Now construct a scoped command by integrating the * current namespace context, and appending the remaining * arguments AS A LIST... */ listPtr = Tcl_NewListObj(0, NULL); Tcl_ListObjAppendElement(interp, listPtr, Tcl_NewStringObj("namespace", -1)); Tcl_ListObjAppendElement(interp, listPtr, Tcl_NewStringObj("inscope", -1)); if (contextNs == Tcl_GetGlobalNamespace(interp)) { |
︙ | ︙ | |||
1254 1255 1256 1257 1258 1259 1260 | ItclClass *iclsPtr; ItclShowArgs(1, "Itcl_ForwardAddCmd", objc, objv); if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "<forwardName> <targetName> ?<arg> ...?"); return TCL_ERROR; } | | | | 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 | ItclClass *iclsPtr; ItclShowArgs(1, "Itcl_ForwardAddCmd", objc, objv); if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "<forwardName> <targetName> ?<arg> ...?"); return TCL_ERROR; } infoPtr = (ItclObjectInfo *)Tcl_GetAssocData(interp, ITCL_INTERP_DATA, NULL); iclsPtr = (ItclClass*)Itcl_PeekStack(&infoPtr->clsStack); if (iclsPtr == NULL) { Tcl_HashEntry *hPtr; hPtr = Tcl_FindHashEntry(&infoPtr->nameClasses, (char *)objv[1]); if (hPtr == NULL) { Tcl_AppendResult(interp, "class: \"", Tcl_GetString(objv[1]), "\" not found", NULL); return TCL_ERROR; } iclsPtr = (ItclClass *)Tcl_GetHashValue(hPtr); } prefixObj = Tcl_NewListObj(objc-2, objv+2); mPtr = Itcl_NewForwardClassMethod(interp, iclsPtr->clsPtr, 1, objv[1], prefixObj); if (mPtr == NULL) { return TCL_ERROR; } |
︙ | ︙ | |||
1437 1438 1439 1440 1441 1442 1443 | } hPtr = Tcl_FindHashEntry(&infoPtr->nameClasses, (char *)objv[1]); if (hPtr == NULL) { Tcl_AppendResult(interp, "class \"", Tcl_GetString(objv[1]), "\" not found", NULL); return TCL_ERROR; } | | | | 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 | } hPtr = Tcl_FindHashEntry(&infoPtr->nameClasses, (char *)objv[1]); if (hPtr == NULL) { Tcl_AppendResult(interp, "class \"", Tcl_GetString(objv[1]), "\" not found", NULL); return TCL_ERROR; } iclsPtr = (ItclClass *)Tcl_GetHashValue(hPtr); protectionStr = Tcl_GetString(objv[2]); pLevel = -1; if (strcmp(protectionStr, "public") == 0) { pLevel = ITCL_PUBLIC; } if (strcmp(protectionStr, "protected") == 0) { pLevel = ITCL_PROTECTED; } if (strcmp(protectionStr, "private") == 0) { pLevel = ITCL_PRIVATE; } if (pLevel == -1) { Tcl_AppendResult(interp, "bad protection \"", protectionStr, "\"", NULL); return TCL_ERROR; } Itcl_PushStack(iclsPtr, &infoPtr->clsStack); result = Itcl_ClassOptionCmd(clientData, interp, objc-2, objv+2); Itcl_PopStack(&infoPtr->clsStack); if (result != TCL_OK) { return result; } result = DelegatedOptionsInstall(interp, iclsPtr); return result; |
︙ | ︙ | |||
1522 1523 1524 1525 1526 1527 1528 | } hPtr = Tcl_FindHashEntry(&infoPtr->objectCmds, (char *)cmd); if (hPtr == NULL) { Tcl_AppendResult(interp, "object \"", Tcl_GetString(objv[1]), "\" not found", NULL); return TCL_ERROR; } | | | 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 | } hPtr = Tcl_FindHashEntry(&infoPtr->objectCmds, (char *)cmd); if (hPtr == NULL) { Tcl_AppendResult(interp, "object \"", Tcl_GetString(objv[1]), "\" not found", NULL); return TCL_ERROR; } ioPtr = (ItclObject *)Tcl_GetHashValue(hPtr); protectionStr = Tcl_GetString(objv[2]); pLevel = -1; if (strcmp(protectionStr, "public") == 0) { pLevel = ITCL_PUBLIC; } if (strcmp(protectionStr, "protected") == 0) { pLevel = ITCL_PROTECTED; |
︙ | ︙ | |||
1608 1609 1610 1611 1612 1613 1614 | } hPtr = Tcl_FindHashEntry(&infoPtr->objectCmds, (char *)cmd); if (hPtr == NULL) { Tcl_AppendResult(interp, "object \"", Tcl_GetString(objv[1]), "\" not found", NULL); return TCL_ERROR; } | | | 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 | } hPtr = Tcl_FindHashEntry(&infoPtr->objectCmds, (char *)cmd); if (hPtr == NULL) { Tcl_AppendResult(interp, "object \"", Tcl_GetString(objv[1]), "\" not found", NULL); return TCL_ERROR; } ioPtr = (ItclObject *)Tcl_GetHashValue(hPtr); result = Itcl_HandleDelegateOptionCmd(interp, ioPtr, NULL, &idoPtr, objc-3, objv+3); if (result != TCL_OK) { return result; } hPtr = Tcl_CreateHashEntry(&ioPtr->objectDelegatedOptions, (char *)idoPtr->namePtr, &isNew); |
︙ | ︙ | |||
1672 1673 1674 1675 1676 1677 1678 | } hPtr = Tcl_FindHashEntry(&infoPtr->objectCmds, (char *)cmd); if (hPtr == NULL) { Tcl_AppendResult(interp, "object \"", Tcl_GetString(objv[1]), "\" not found", NULL); return TCL_ERROR; } | | | 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 | } hPtr = Tcl_FindHashEntry(&infoPtr->objectCmds, (char *)cmd); if (hPtr == NULL) { Tcl_AppendResult(interp, "object \"", Tcl_GetString(objv[1]), "\" not found", NULL); return TCL_ERROR; } ioPtr = (ItclObject *)Tcl_GetHashValue(hPtr); result = Itcl_HandleDelegateMethodCmd(interp, ioPtr, NULL, &idmPtr, objc-3, objv+3); if (result != TCL_OK) { return result; } componentNamePtr = idmPtr->icPtr->namePtr; Itcl_InitHierIter(&hier, ioPtr->iclsPtr); |
︙ | ︙ | |||
1779 1780 1781 1782 1783 1784 1785 | NULL, 0); hPtr = Tcl_FindHashEntry(&contextIclsPtr->variables, (char *)objv[2]); if (hPtr == NULL) { Tcl_AppendResult(interp, "Itcl_AddComponentCmd cannot find component", " \"", Tcl_GetString(objv[2]), "\"in class variables", NULL); return TCL_ERROR; } | | | 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 | NULL, 0); hPtr = Tcl_FindHashEntry(&contextIclsPtr->variables, (char *)objv[2]); if (hPtr == NULL) { Tcl_AppendResult(interp, "Itcl_AddComponentCmd cannot find component", " \"", Tcl_GetString(objv[2]), "\"in class variables", NULL); return TCL_ERROR; } ivPtr = (ItclVariable *)Tcl_GetHashValue(hPtr); /* add entry to the virtual tables */ vlookup = (ItclVarLookup *)ckalloc(sizeof(ItclVarLookup)); vlookup->ivPtr = ivPtr; vlookup->usage = 0; vlookup->leastQualName = NULL; /* |
︙ | ︙ | |||
1813 1814 1815 1816 1817 1818 1819 | Tcl_DStringInit(&buffer2); while (1) { hPtr = Tcl_CreateHashEntry(&contextIclsPtr->resolveVars, Tcl_DStringValue(&buffer), &isNew); if (isNew) { | | | | 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 | Tcl_DStringInit(&buffer2); while (1) { hPtr = Tcl_CreateHashEntry(&contextIclsPtr->resolveVars, Tcl_DStringValue(&buffer), &isNew); if (isNew) { Tcl_SetHashValue(hPtr, vlookup); vlookup->usage++; if (!vlookup->leastQualName) { vlookup->leastQualName = (char *) Tcl_GetHashKey(&contextIclsPtr->resolveVars, hPtr); } } if (nsPtr == NULL) { break; } |
︙ | ︙ | |||
1900 1901 1902 1903 1904 1905 1906 | contextIoPtr = NULL; ItclShowArgs(1, "Itcl_SetComponentCmd", objc, objv); if (objc < 4) { Tcl_WrongNumArgs(interp, 1, objv, "objectName componentName value"); return TCL_ERROR; } | | | 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 | contextIoPtr = NULL; ItclShowArgs(1, "Itcl_SetComponentCmd", objc, objv); if (objc < 4) { Tcl_WrongNumArgs(interp, 1, objv, "objectName componentName value"); return TCL_ERROR; } name = Tcl_GetString(objv[1]); if (Itcl_FindObject(interp, name, &contextIoPtr) != TCL_OK) { return TCL_ERROR; } if (contextIoPtr == NULL) { Tcl_AppendResult(interp, "Itcl_SetComponentCmd contextIoPtr " "for \"", Tcl_GetString(objv[1]), "\" == NULL", NULL); return TCL_ERROR; |
︙ | ︙ | |||
1923 1924 1925 1926 1927 1928 1929 | } Itcl_DeleteHierIter(&hier); if (hPtr == NULL) { Tcl_AppendResult(interp, "object \"", Tcl_GetString(objv[1]), "\" has no component \"", Tcl_GetString(objv[2]), "\"", NULL); return TCL_ERROR; } | | | 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 | } Itcl_DeleteHierIter(&hier); if (hPtr == NULL) { Tcl_AppendResult(interp, "object \"", Tcl_GetString(objv[1]), "\" has no component \"", Tcl_GetString(objv[2]), "\"", NULL); return TCL_ERROR; } icPtr = (ItclComponent *)Tcl_GetHashValue(hPtr); val = ItclGetInstanceVar(interp, Tcl_GetString(icPtr->namePtr), NULL, contextIoPtr, contextIclsPtr); if ((val != NULL) && (strlen(val) != 0)) { /* delete delegated options to the old component here !! */ Itcl_InitHierIter(&hier, contextIoPtr->iclsPtr); while ((iclsPtr = Itcl_AdvanceHierIter(&hier)) != NULL) { FOREACH_HASH_VALUE(idoPtr, &iclsPtr->delegatedOptions) { |
︙ | ︙ |
Changes to generic/itclEnsemble.c.
︙ | ︙ | |||
43 44 45 46 47 48 49 | char *name; /* name of this part */ Tcl_Obj *namePtr; Tcl_Command cmdPtr; /* command handling this part */ char *usage; /* usage string describing syntax */ struct Ensemble* ensemble; /* ensemble containing this part */ ItclArgList *arglistPtr; /* the parsed argument list */ Tcl_ObjCmdProc *objProc; /* handling procedure for part */ | | | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | char *name; /* name of this part */ Tcl_Obj *namePtr; Tcl_Command cmdPtr; /* command handling this part */ char *usage; /* usage string describing syntax */ struct Ensemble* ensemble; /* ensemble containing this part */ ItclArgList *arglistPtr; /* the parsed argument list */ Tcl_ObjCmdProc *objProc; /* handling procedure for part */ void *clientData; /* the procPtr for the part */ Tcl_CmdDeleteProc *deleteProc; /* procedure used to destroy client data */ int minChars; /* chars needed to uniquely identify part */ int flags; Tcl_Interp *interp; Tcl_Obj *mapNamePtr; Tcl_Obj *subEnsemblePtr; |
︙ | ︙ | |||
143 144 145 146 147 148 149 | int Itcl_EnsembleInit( Tcl_Interp *interp) /* interpreter being initialized */ { Tcl_DString buffer; ItclObjectInfo *infoPtr; | | | | 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | int Itcl_EnsembleInit( Tcl_Interp *interp) /* interpreter being initialized */ { Tcl_DString buffer; ItclObjectInfo *infoPtr; infoPtr = (ItclObjectInfo *)Tcl_GetAssocData(interp, ITCL_INTERP_DATA, NULL); Tcl_CreateObjCommand(interp, "::itcl::ensemble", Itcl_EnsembleCmd, NULL, NULL); Tcl_DStringInit(&buffer); Tcl_DStringAppend(&buffer, ITCL_COMMANDS_NAMESPACE, -1); Tcl_DStringAppend(&buffer, "::ensembles", -1); infoPtr->ensembleInfo->ensembleNsPtr = Tcl_CreateNamespace(interp, Tcl_DStringValue(&buffer), NULL, NULL); Tcl_DStringFree(&buffer); |
︙ | ︙ | |||
218 219 220 221 222 223 224 | if (Tcl_SplitList(interp, (const char *)ensName, &nameArgc, &nameArgv) != TCL_OK) { goto ensCreateFail; } if (nameArgc < 1) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "invalid ensemble name \"", ensName, "\"", | | | | 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | if (Tcl_SplitList(interp, (const char *)ensName, &nameArgc, &nameArgv) != TCL_OK) { goto ensCreateFail; } if (nameArgc < 1) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "invalid ensemble name \"", ensName, "\"", NULL); goto ensCreateFail; } /* * If there is more than one path component, then follow * the path down to the last component, to find the containing * ensemble. */ parentEnsData = NULL; if (nameArgc > 1) { if (FindEnsemble(interp, nameArgv, nameArgc-1, &parentEnsData) != TCL_OK) { goto ensCreateFail; } if (parentEnsData == NULL) { char *pname = Tcl_Merge(nameArgc-1, nameArgv); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "invalid ensemble name \"", pname, "\"", NULL); ckfree(pname); goto ensCreateFail; } } /* * Create the ensemble. |
︙ | ︙ | |||
325 326 327 328 329 330 331 | goto ensPartFail; } if (ensData == NULL) { char *pname = Tcl_Merge(nameArgc, nameArgv); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "invalid ensemble name \"", pname, "\"", | | | 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 | goto ensPartFail; } if (ensData == NULL) { char *pname = Tcl_Merge(nameArgc, nameArgv); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "invalid ensemble name \"", pname, "\"", NULL); ckfree(pname); goto ensPartFail; } /* * Install the new part into the part list. */ |
︙ | ︙ | |||
679 680 681 682 683 684 685 | /* * Build the trail of ensemble names leading to this part. */ Tcl_DStringInit(&buffer); Itcl_InitList(&trail); for (part=ensPart; part; part=part->ensemble->parent) { | | | 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 | /* * Build the trail of ensemble names leading to this part. */ Tcl_DStringInit(&buffer); Itcl_InitList(&trail); for (part=ensPart; part; part=part->ensemble->parent) { Itcl_InsertList(&trail, part); } while (ensData->parent != NULL) { ensData = ensData->parent->ensemble; } cmdPtr = ensData->cmdPtr; name = Tcl_GetCommandName(interp, cmdPtr); |
︙ | ︙ | |||
766 767 768 769 770 771 772 | int isNew; char buf[20]; Tcl_Obj *unkObjPtr; /* * Create the data associated with the ensemble. */ | | | 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 | int isNew; char buf[20]; Tcl_Obj *unkObjPtr; /* * Create the data associated with the ensemble. */ infoPtr = (ItclObjectInfo *)Tcl_GetAssocData(interp, ITCL_INTERP_DATA, NULL); infoPtr->ensembleInfo->numEnsembles++; ensData = (Ensemble*)ckalloc(sizeof(Ensemble)); memset(ensData, 0, sizeof(Ensemble)); ensData->namePtr = Tcl_NewStringObj(ensName, -1); Tcl_IncrRefCount(ensData->namePtr); ensData->interp = interp; ensData->numParts = 0; |
︙ | ︙ | |||
808 809 810 811 812 813 814 | Tcl_GetCurrentNamespace(interp), TCL_ENSEMBLE_PREFIX); hPtr = Tcl_CreateHashEntry(&infoPtr->ensembleInfo->ensembles, (char *)ensData->cmdPtr, &isNew); if (!isNew) { result = TCL_ERROR; goto finish; } | | | | 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 | Tcl_GetCurrentNamespace(interp), TCL_ENSEMBLE_PREFIX); hPtr = Tcl_CreateHashEntry(&infoPtr->ensembleInfo->ensembles, (char *)ensData->cmdPtr, &isNew); if (!isNew) { result = TCL_ERROR; goto finish; } Tcl_SetHashValue(hPtr, ensData); unkObjPtr = Tcl_NewStringObj(ITCL_COMMANDS_NAMESPACE, -1); Tcl_AppendToObj(unkObjPtr, "::ensembles::unknown", -1); if (Tcl_SetEnsembleUnknownHandler(NULL, ensData->cmdPtr, unkObjPtr) != TCL_OK) { Tcl_DecrRefCount(unkObjPtr); result = TCL_ERROR; goto finish; } Tcl_SetObjResult(interp, Tcl_NewStringObj(Tcl_DStringValue(&buffer), -1)); result = TCL_OK; goto finish; } /* * Otherwise, this ensemble is contained within another parent. * Install the new ensemble as a part within its parent. */ if (CreateEnsemblePart(interp, parentEnsData, ensName, &ensPart) != TCL_OK) { DeleteEnsemble(ensData); result = TCL_ERROR; goto finish; } Tcl_DStringSetLength(&buffer, 0); Tcl_DStringAppend(&buffer, infoPtr->ensembleInfo->ensembleNsPtr->fullName, -1); Tcl_DStringAppend(&buffer, "::subensembles::", -1); sprintf(buf, "%d", parentEnsData->ensembleId); |
︙ | ︙ | |||
857 858 859 860 861 862 863 | Tcl_GetCurrentNamespace(interp), TCL_ENSEMBLE_PREFIX); hPtr = Tcl_CreateHashEntry(&infoPtr->ensembleInfo->ensembles, (char *)ensPart->cmdPtr, &isNew); if (!isNew) { result = TCL_ERROR; goto finish; } | | | 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 | Tcl_GetCurrentNamespace(interp), TCL_ENSEMBLE_PREFIX); hPtr = Tcl_CreateHashEntry(&infoPtr->ensembleInfo->ensembles, (char *)ensPart->cmdPtr, &isNew); if (!isNew) { result = TCL_ERROR; goto finish; } Tcl_SetHashValue(hPtr, ensData); unkObjPtr = Tcl_NewStringObj(ITCL_COMMANDS_NAMESPACE, -1); Tcl_AppendToObj(unkObjPtr, "::ensembles::unknown", -1); if (Tcl_SetEnsembleUnknownHandler(NULL, ensPart->cmdPtr, unkObjPtr) != TCL_OK) { result = TCL_ERROR; goto finish; } |
︙ | ︙ | |||
935 936 937 938 939 940 941 | * Install the new part into the part list. */ if (CreateEnsemblePart(interp, ensData, partName, &ensPart) != TCL_OK) { return TCL_ERROR; } if (usageInfo) { | | | 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 | * Install the new part into the part list. */ if (CreateEnsemblePart(interp, ensData, partName, &ensPart) != TCL_OK) { return TCL_ERROR; } if (usageInfo) { ensPart->usage = (char *)ckalloc(strlen(usageInfo)+1); strcpy(ensPart->usage, usageInfo); } ensPart->objProc = objProc; ensPart->clientData = clientData; ensPart->deleteProc = deleteProc; ensPart->flags = flags; |
︙ | ︙ | |||
1013 1014 1015 1016 1017 1018 1019 | while (ensData->numParts > 0) { DeleteEnsemblePart(ensData->parts[0]); } Tcl_DecrRefCount(ensData->namePtr); ckfree((char*)ensData->parts); ensData->parts = NULL; ensData->numParts = 0; | | | 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 | while (ensData->numParts > 0) { DeleteEnsemblePart(ensData->parts[0]); } Tcl_DecrRefCount(ensData->namePtr); ckfree((char*)ensData->parts); ensData->parts = NULL; ensData->numParts = 0; infoPtr = (ItclObjectInfo *)Tcl_GetAssocData(ensData->interp, ITCL_INTERP_DATA, NULL); FOREACH_HASH_VALUE(ensData2, &infoPtr->ensembleInfo->ensembles) { if (ensData2 == ensData) { Tcl_DeleteHashEntry(hPtr); } } ckfree((char*)ensData); } |
︙ | ︙ | |||
1080 1081 1082 1083 1084 1085 1086 | objPtr = Tcl_NewStringObj(nameArgv[0], -1); cmdPtr = Tcl_FindEnsemble(interp, objPtr, 0); Tcl_DecrRefCount(objPtr); if (cmdPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "command \"", nameArgv[0], "\" is not an ensemble", | | | | | | | | 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 | objPtr = Tcl_NewStringObj(nameArgv[0], -1); cmdPtr = Tcl_FindEnsemble(interp, objPtr, 0); Tcl_DecrRefCount(objPtr); if (cmdPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "command \"", nameArgv[0], "\" is not an ensemble", NULL); return TCL_ERROR; } infoPtr = (ItclObjectInfo *)Tcl_GetAssocData(interp, ITCL_INTERP_DATA, NULL); hPtr = Tcl_FindHashEntry(&infoPtr->ensembleInfo->ensembles, (char *)cmdPtr); if (hPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "command \"", nameArgv[0], "\" is not an ensemble", NULL); return TCL_ERROR; } ensData = (Ensemble *)Tcl_GetHashValue(hPtr); /* * Follow the trail of sub-ensemble names. */ for (i=1; i < nameArgc; i++) { if (FindEnsemblePart(interp, ensData, nameArgv[i], &ensPart) != TCL_OK) { return TCL_ERROR; } if (ensPart == NULL) { char *pname = Tcl_Merge(i, nameArgv); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "invalid ensemble name \"", pname, "\"", NULL); ckfree(pname); return TCL_ERROR; } cmdPtr = ensPart->cmdPtr; if (cmdPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "part \"", nameArgv[i], "\" is not an ensemble", NULL); return TCL_ERROR; } if (!Tcl_IsEnsemble(cmdPtr)) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "part \"", nameArgv[i], "\" is not an ensemble", NULL); return TCL_ERROR; } if (Tcl_GetCommandInfoFromToken(cmdPtr, &cmdInfo) != 1) { return TCL_ERROR; } ensData = (Ensemble*)cmdInfo.objClientData; } |
︙ | ︙ | |||
1171 1172 1173 1174 1175 1176 1177 | /* * If a matching entry was found, then return an error. */ if (FindEnsemblePartIndex(ensData, partName, &pos)) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "part \"", partName, "\" already exists in ensemble", | | | 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 | /* * If a matching entry was found, then return an error. */ if (FindEnsemblePartIndex(ensData, partName, &pos)) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "part \"", partName, "\" already exists in ensemble", NULL); return TCL_ERROR; } /* * Otherwise, make room for a new entry. Keep the parts in * lexicographical order, so we can search them quickly * later. |
︙ | ︙ | |||
1197 1198 1199 1200 1201 1202 1203 | for (i=ensData->numParts; i > pos; i--) { ensData->parts[i] = ensData->parts[i-1]; } ensData->numParts++; ensPart = (EnsemblePart*)ckalloc(sizeof(EnsemblePart)); memset(ensPart, 0, sizeof(EnsemblePart)); | | | 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 | for (i=ensData->numParts; i > pos; i--) { ensData->parts[i] = ensData->parts[i-1]; } ensData->numParts++; ensPart = (EnsemblePart*)ckalloc(sizeof(EnsemblePart)); memset(ensPart, 0, sizeof(EnsemblePart)); ensPart->name = (char*)ckalloc(strlen(partName)+1); strcpy(ensPart->name, partName); ensPart->namePtr = Tcl_NewStringObj(ensPart->name, -1); ensPart->ensemble = ensData; ensPart->interp = interp; ensData->parts[pos] = ensPart; |
︙ | ︙ | |||
1270 1271 1272 1273 1274 1275 1276 | */ if ((ensPart->deleteProc != NULL) && (ensPart->clientData != NULL)) { (*ensPart->deleteProc)(ensPart->clientData); } /* if it is a subensemble remove the command to free the data */ if (ensPart->subEnsemblePtr != NULL) { | | | | | 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 | */ if ((ensPart->deleteProc != NULL) && (ensPart->clientData != NULL)) { (*ensPart->deleteProc)(ensPart->clientData); } /* if it is a subensemble remove the command to free the data */ if (ensPart->subEnsemblePtr != NULL) { infoPtr = (ItclObjectInfo *)Tcl_GetAssocData(ensData->interp, ITCL_INTERP_DATA, NULL); hPtr = Tcl_FindHashEntry(&infoPtr->ensembleInfo->subEnsembles, (char *)ensPart->subEnsemblePtr); if (hPtr != NULL) { ensData2 = (Ensemble *)Tcl_GetHashValue(hPtr); Tcl_DeleteNamespace(ensData2->nsPtr); Tcl_DeleteHashEntry(hPtr); } Tcl_SetEnsembleUnknownHandler(NULL, ensPart->cmdPtr, NULL); hPtr = Tcl_FindHashEntry(&infoPtr->ensembleInfo->ensembles, (char *)ensPart->ensemble->cmdPtr); if (hPtr != NULL) { ensData2 = (Ensemble *)Tcl_GetHashValue(hPtr); Tcl_GetEnsembleMappingDict(NULL, ensData2->cmdPtr, &mapDict); if (mapDict != NULL) { Tcl_DictObjRemove(ensPart->interp, mapDict, ensPart->namePtr); Tcl_SetEnsembleMappingDict(NULL, ensData2->cmdPtr, mapDict); } } |
︙ | ︙ | |||
1425 1426 1427 1428 1429 1430 1431 | if (strncmp(partName, ensData->parts[pos]->name, nlen) != 0) { pos++; break; } } } if (nlen < ensData->parts[pos]->minChars) { | | | | 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 | if (strncmp(partName, ensData->parts[pos]->name, nlen) != 0) { pos++; break; } } } if (nlen < ensData->parts[pos]->minChars) { Tcl_Obj *resultPtr = Tcl_NewStringObj(NULL, 0); Tcl_AppendStringsToObj(resultPtr, "ambiguous option \"", partName, "\": should be one of...", NULL); for (i=pos; i < ensData->numParts; i++) { if (strncmp(partName, ensData->parts[i]->name, nlen) != 0) { break; } Tcl_AppendToObj(resultPtr, "\n ", 3); GetEnsemblePartUsage(interp, ensData, ensData->parts[i], resultPtr); |
︙ | ︙ | |||
1649 1650 1651 1652 1653 1654 1655 | ItclShowArgs(1, "Itcl_EnsembleCmd", objc, objv); /* * Make sure that an ensemble name was specified. */ if (objc < 2) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "wrong # args: should be \"", | | | | 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 | ItclShowArgs(1, "Itcl_EnsembleCmd", objc, objv); /* * Make sure that an ensemble name was specified. */ if (objc < 2) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "wrong # args: should be \"", Tcl_GetString(objv[0]), " name ?command arg arg...?\"", NULL); return TCL_ERROR; } /* * If this is the "ensemble" command in the main interpreter, * then the client data will be null. Otherwise, it is * the "ensemble" command in the ensemble body parser, and |
︙ | ︙ | |||
1692 1693 1694 1695 1696 1697 1698 | if (FindEnsemblePart(ensInfo->master, ensData, ensName, &ensPart) != TCL_OK) { Tcl_Panic("Itcl_EnsembleCmd: can't create ensemble"); } } cmd = ensPart->cmdPtr; | | | | | | | | | | | | | 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 | if (FindEnsemblePart(ensInfo->master, ensData, ensName, &ensPart) != TCL_OK) { Tcl_Panic("Itcl_EnsembleCmd: can't create ensemble"); } } cmd = ensPart->cmdPtr; infoPtr = (ItclObjectInfo *)Tcl_GetAssocData(ensInfo->master, ITCL_INTERP_DATA, NULL); hPtr = Tcl_FindHashEntry(&infoPtr->ensembleInfo->ensembles, (char *)ensPart->cmdPtr); if (hPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "part \"", Tcl_GetString(objv[1]), "\" is not an ensemble", NULL); return TCL_ERROR; } ensData = (Ensemble *)Tcl_GetHashValue(hPtr); } else { /* * Otherwise, the desired ensemble is a top-level ensemble. * Find or create the access command for the ensemble, and * then get its data. */ cmd = Tcl_FindCommand(interp, ensName, NULL, 0); if (cmd == NULL) { if (CreateEnsemble(interp, NULL, ensName) != TCL_OK) { return TCL_ERROR; } cmd = Tcl_FindCommand(interp, ensName, NULL, 0); } if (cmd == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "command \"", Tcl_GetString(objv[1]), "\" is not an ensemble", NULL); return TCL_ERROR; } infoPtr = (ItclObjectInfo *)Tcl_GetAssocData(interp, ITCL_INTERP_DATA, NULL); hPtr = Tcl_FindHashEntry(&infoPtr->ensembleInfo->ensembles, (char *)cmd); if (hPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "command \"", Tcl_GetString(objv[1]), "\" is not an ensemble", NULL); return TCL_ERROR; } ensData = (Ensemble *)Tcl_GetHashValue(hPtr); } /* * At this point, we have the data for the ensemble that is |
︙ | ︙ | |||
1767 1768 1769 1770 1771 1772 1773 | * master interpreter. If an error was encountered, * copy the error info first, and then set the result. * Otherwise, the offending command is reported twice. */ if (status == TCL_ERROR) { /* no longer needed, no extra interpreter !! */ const char *errInfo = Tcl_GetVar2(ensInfo->parser, "::errorInfo", | | | 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 | * master interpreter. If an error was encountered, * copy the error info first, and then set the result. * Otherwise, the offending command is reported twice. */ if (status == TCL_ERROR) { /* no longer needed, no extra interpreter !! */ const char *errInfo = Tcl_GetVar2(ensInfo->parser, "::errorInfo", NULL, TCL_GLOBAL_ONLY); if (errInfo) { Tcl_AppendObjToErrorInfo(interp, Tcl_NewStringObj(errInfo, -1)); } if (objc == 3) { Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( |
︙ | ︙ | |||
1838 1839 1840 1841 1842 1843 1844 | Tcl_DeleteNamespace(Tcl_GetGlobalNamespace(ensInfo->parser)); /* * Add the allowed commands to the parser interpreter: * part, delete, ensemble */ Tcl_CreateObjCommand(ensInfo->parser, "part", Itcl_EnsPartCmd, | | | | | | 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 | Tcl_DeleteNamespace(Tcl_GetGlobalNamespace(ensInfo->parser)); /* * Add the allowed commands to the parser interpreter: * part, delete, ensemble */ Tcl_CreateObjCommand(ensInfo->parser, "part", Itcl_EnsPartCmd, ensInfo, NULL); Tcl_CreateObjCommand(ensInfo->parser, "option", Itcl_EnsPartCmd, ensInfo, NULL); Tcl_CreateObjCommand(ensInfo->parser, "ensemble", Itcl_EnsembleCmd, ensInfo, NULL); /* * Install the parser data, so we'll have it the next time * we call this procedure. */ (void) Tcl_SetAssocData(interp, "itcl_ensembleParser", DeleteEnsParser, ensInfo); return ensInfo; } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
1939 1940 1941 1942 1943 1944 1945 | int maxArgc; Tcl_CmdInfo cmdInfo; ItclShowArgs(1, "Itcl_EnsPartCmd", objc, objv); if (objc != 4) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "wrong # args: should be \"", | | | | | 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 | int maxArgc; Tcl_CmdInfo cmdInfo; ItclShowArgs(1, "Itcl_EnsPartCmd", objc, objv); if (objc != 4) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "wrong # args: should be \"", Tcl_GetString(objv[0]), " name args body\"", NULL); return TCL_ERROR; } /* * Create a Tcl-style proc definition using the specified args * and body. This is not a proc in the usual sense. It belongs * to the namespace that contains the ensemble, but it is * accessed through the ensemble, not through a Tcl command. */ partName = Tcl_GetString(objv[1]); if (ItclCreateArgList(interp, Tcl_GetString(objv[2]), &argc, &maxArgc, &usagePtr, &arglistPtr, NULL, partName) != TCL_OK) { result = TCL_ERROR; goto errorOut; } if (Tcl_GetCommandInfoFromToken(ensData->cmdPtr, &cmdInfo) != 1) { |
︙ | ︙ | |||
1978 1979 1980 1981 1982 1983 1984 | /* * Create a new part within the ensemble. If successful, * plug the command token into the proc; we'll need it later * if we try to compile the Tcl code for the part. If * anything goes wrong, clean up before bailing out. */ result = AddEnsemblePart(ensInfo->master, ensData, partName, usage, | | | 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 | /* * Create a new part within the ensemble. If successful, * plug the command token into the proc; we'll need it later * if we try to compile the Tcl code for the part. If * anything goes wrong, clean up before bailing out. */ result = AddEnsemblePart(ensInfo->master, ensData, partName, usage, (Tcl_ObjCmdProc *)Tcl_GetObjInterpProc(), procPtr, _Tcl_ProcDeleteProc, ITCL_ENSEMBLE_ENSEMBLE, &ensPart); if (result == TCL_ERROR) { _Tcl_ProcDeleteProc(procPtr); } Tcl_TransferResult(ensInfo->master, result, interp); errorOut: |
︙ | ︙ | |||
2030 2031 2032 2033 2034 2035 2036 | Ensemble *ensData = (Ensemble*)clientData; char *cmdName; Tcl_Obj *objPtr; cmdName = Tcl_GetString(objv[0]); | | | | | | | | | 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 | Ensemble *ensData = (Ensemble*)clientData; char *cmdName; Tcl_Obj *objPtr; cmdName = Tcl_GetString(objv[0]); objPtr = Tcl_NewStringObj(NULL, 0); Tcl_AppendStringsToObj(objPtr, "bad option \"", cmdName, "\": should be one of...\n", NULL); GetEnsembleUsage(interp, ensData, objPtr); Tcl_SetObjResult(interp, objPtr); return TCL_ERROR; } /* *---------------------------------------------------------------------- * * EnsembleSubCmd -- * *---------------------------------------------------------------------- */ static int CallInvokeEnsembleMethod( ClientData data[], Tcl_Interp *interp, int result) { Tcl_Namespace *nsPtr = (Tcl_Namespace *)data[0]; EnsemblePart *ensPart = (EnsemblePart *)data[1]; int objc = PTR2INT(data[2]); Tcl_Obj *const *objv = (Tcl_Obj *const *)data[3]; result = Itcl_InvokeEnsembleMethod(interp, nsPtr, ensPart->namePtr, (Tcl_Proc *)ensPart->clientData, objc, objv); return result; } static int CallInvokeEnsembleMethod2( ClientData data[], Tcl_Interp *interp, int result) { EnsemblePart *ensPart = (EnsemblePart *)data[0]; int objc = PTR2INT(data[1]); Tcl_Obj *const*objv = (Tcl_Obj *const*)data[2]; result = (*ensPart->objProc)(ensPart->clientData, interp, objc, objv); return result; } static int EnsembleSubCmd( ClientData clientData, /* ensPart struct pointer */ |
︙ | ︙ | |||
2099 2100 2101 2102 2103 2104 2105 | nsPtr = Tcl_GetCurrentNamespace(interp); callbackPtr = Itcl_GetCurrentCallbackPtr(interp); if (ensPart->flags & ITCL_ENSEMBLE_ENSEMBLE) { /* FIXME !!! */ if (ensPart->clientData == NULL) { return TCL_ERROR; } | | | | 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 | nsPtr = Tcl_GetCurrentNamespace(interp); callbackPtr = Itcl_GetCurrentCallbackPtr(interp); if (ensPart->flags & ITCL_ENSEMBLE_ENSEMBLE) { /* FIXME !!! */ if (ensPart->clientData == NULL) { return TCL_ERROR; } Tcl_NRAddCallback(interp, CallInvokeEnsembleMethod, nsPtr, ensPart, INT2PTR(objc), (void *)objv); } else { Tcl_NRAddCallback(interp, CallInvokeEnsembleMethod2, ensPart, INT2PTR(objc), (void *)objv, NULL); } result = Itcl_NRRunCallbacks(interp, callbackPtr); return result; } /* * ------------------------------------------------------------------------ * EnsembleUnknownCmd() |
︙ | ︙ | |||
2134 2135 2136 2137 2138 2139 2140 | ItclShowArgs(2, "EnsembleUnknownCmd", objc, objv); cmd = Tcl_GetCommandFromObj(interp, objv[1]); if (cmd == NULL) { Tcl_AppendResult(interp, "EnsembleUnknownCmd, ensemble not found!", Tcl_GetString(objv[1]), NULL); return TCL_ERROR; } | | | 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 | ItclShowArgs(2, "EnsembleUnknownCmd", objc, objv); cmd = Tcl_GetCommandFromObj(interp, objv[1]); if (cmd == NULL) { Tcl_AppendResult(interp, "EnsembleUnknownCmd, ensemble not found!", Tcl_GetString(objv[1]), NULL); return TCL_ERROR; } infoPtr = (ItclObjectInfo *)Tcl_GetAssocData(interp, ITCL_INTERP_DATA, NULL); hPtr = Tcl_FindHashEntry(&infoPtr->ensembleInfo->ensembles, (char *)cmd); if (hPtr == NULL) { Tcl_AppendResult(interp, "EnsembleUnknownCmd, ensemble struct not ", "found!", Tcl_GetString(objv[1]), NULL); return TCL_ERROR; } ensData = (Ensemble *)Tcl_GetHashValue(hPtr); |
︙ | ︙ | |||
2157 2158 2159 2160 2161 2162 2163 | if (FindEnsemblePart(interp, ensData, "@error", &ensPart) != TCL_OK) { Tcl_AppendResult(interp, "FindEnsemblePart error", NULL); return TCL_ERROR; } if (ensPart != NULL) { Tcl_Obj *listPtr; | | | 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 | if (FindEnsemblePart(interp, ensData, "@error", &ensPart) != TCL_OK) { Tcl_AppendResult(interp, "FindEnsemblePart error", NULL); return TCL_ERROR; } if (ensPart != NULL) { Tcl_Obj *listPtr; listPtr = Tcl_NewListObj(0, NULL); Tcl_ListObjAppendElement(NULL, listPtr, objv[1]); Tcl_ListObjAppendElement(NULL, listPtr, Tcl_NewStringObj("@error", -1)); Tcl_ListObjAppendElement(NULL, listPtr, objv[2]); Tcl_SetObjResult(interp, listPtr); return TCL_OK; } |
︙ | ︙ | |||
2204 2205 2206 2207 2208 2209 2210 | } hPtr = Tcl_FindHashEntry(&infoPtr->ensembleInfo->ensembles, (char *)cmdPtr); if (hPtr == NULL) { Tcl_AppendResult(interp, "no such ensemble \"", Tcl_GetString(objv[i]), "\"", NULL); return TCL_ERROR; } | | | 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 | } hPtr = Tcl_FindHashEntry(&infoPtr->ensembleInfo->ensembles, (char *)cmdPtr); if (hPtr == NULL) { Tcl_AppendResult(interp, "no such ensemble \"", Tcl_GetString(objv[i]), "\"", NULL); return TCL_ERROR; } ensData = (Ensemble *)Tcl_GetHashValue(hPtr); Itcl_RenameCommand(ensData->interp, Tcl_GetString(ensData->namePtr), ""); if (Tcl_FindNamespace(interp, ensData->nsPtr->fullName, NULL, 0) != NULL) { Tcl_DeleteNamespace(ensData->nsPtr); } } return TCL_OK; |
︙ | ︙ |
Changes to generic/itclHelpers.c.
1 2 3 | /* * itclHelpers.c -- * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 | /* * itclHelpers.c -- * * This file contains the C-implemeted part of * Itcl * * Copyright (c) 2007 by Arnulf P. Wiedemann * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ |
︙ | ︙ | |||
137 138 139 140 141 142 143 | result = TCL_ERROR; break; } if (defaultArgc > 2) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "too many fields in argument specifier \"", argv[i], "\"", | | | | | | 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | result = TCL_ERROR; break; } if (defaultArgc > 2) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "too many fields in argument specifier \"", argv[i], "\"", NULL); ckfree((char *) defaultArgv); result = TCL_ERROR; break; } if (strstr(defaultArgv[0],"::")) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "bad argument name \"", defaultArgv[0], "\"", NULL); ckfree((char *) defaultArgv); result = TCL_ERROR; break; } arglistPtr = (ItclArgList *)ckalloc(sizeof(ItclArgList)); memset(arglistPtr, 0, sizeof(ItclArgList)); if (*arglistPtrPtr == NULL) { *arglistPtrPtr = arglistPtr; } else { lastArglistPtr->nextPtr = arglistPtr; Tcl_AppendToObj(*usagePtr, " ", 1); } arglistPtr->namePtr = Tcl_NewStringObj(defaultArgv[0], -1); Tcl_IncrRefCount(arglistPtr->namePtr); (*maxArgcPtr)++; if (defaultArgc == 1) { (*argcPtr)++; arglistPtr->defaultValuePtr = NULL; if ((strcmp(defaultArgv[0], "args") == 0) && (i == argc-1)) { hadArgsArgument = 1; (*argcPtr)--; Tcl_AppendToObj(*usagePtr, "?arg arg ...?", -1); } else { Tcl_AppendToObj(*usagePtr, defaultArgv[0], -1); } } else { arglistPtr->defaultValuePtr = Tcl_NewStringObj(defaultArgv[1], -1); Tcl_IncrRefCount(arglistPtr->defaultValuePtr); Tcl_AppendToObj(*usagePtr, "?", 1); Tcl_AppendToObj(*usagePtr, defaultArgv[0], -1); Tcl_AppendToObj(*usagePtr, "?", 1); } lastArglistPtr = arglistPtr; |
︙ | ︙ | |||
275 276 277 278 279 280 281 | cmd = Tcl_FindCommand(interp, "unknown", (Tcl_Namespace *) NULL, /*flags*/ TCL_GLOBAL_ONLY); if (cmd == NULL) { Tcl_ResetResult(interp); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "invalid command name \"", | | | 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | cmd = Tcl_FindCommand(interp, "unknown", (Tcl_Namespace *) NULL, /*flags*/ TCL_GLOBAL_ONLY); if (cmd == NULL) { Tcl_ResetResult(interp); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "invalid command name \"", Tcl_GetString(objv[0]), "\"", NULL); return TCL_ERROR; } cmdlinePtr = Itcl_CreateArgs(interp, "unknown", objc, objv); Tcl_ListObjGetElements(NULL, cmdlinePtr, &cmdlinec, &cmdlinev); } |
︙ | ︙ | |||
385 386 387 388 389 390 391 | Tcl_Obj * ItclCapitalize( const char *str) { Tcl_Obj *objPtr; char buf[2]; | | | 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | Tcl_Obj * ItclCapitalize( const char *str) { Tcl_Obj *objPtr; char buf[2]; sprintf(buf, "%c", toupper(UCHAR(*str))); buf[1] = '\0'; objPtr = Tcl_NewStringObj(buf, -1); Tcl_AppendToObj(objPtr, str+1, -1); return objPtr; } /* |
︙ | ︙ |
Changes to generic/itclInfo.c.
︙ | ︙ | |||
322 323 324 325 326 327 328 | ItclCallContext *popped; Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&infoPtr->frameContext, (char *) framePtr); Itcl_Stack *stackPtr = (Itcl_Stack *) Tcl_GetHashValue(hPtr); | | | 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 | ItclCallContext *popped; Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&infoPtr->frameContext, (char *) framePtr); Itcl_Stack *stackPtr = (Itcl_Stack *) Tcl_GetHashValue(hPtr); popped = (ItclCallContext *)Itcl_PopStack(stackPtr); if (Itcl_GetStackSize(stackPtr) == 0) { Itcl_DeleteStack(stackPtr); ckfree((char *)stackPtr); Tcl_DeleteHashEntry(hPtr); } |
︙ | ︙ | |||
400 401 402 403 404 405 406 | NRInfoWrap( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Tcl_CmdInfo info; | > | > > > > > < < < < < < < < < < < | | < < < < | 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | NRInfoWrap( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Tcl_CmdInfo info; ItclObjectInfo *infoPtr = (ItclObjectInfo *)clientData; if (!infoPtr->infoCmd) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "itcl info-subsystem is deleted", -1)); return TCL_ERROR; } if (objc == 1) { /* * No subcommand passed. Give good usage message. NOT the * default message of a Tcl ensemble. */ Tcl_Obj *objPtr = Tcl_NewStringObj( "wrong # args: should be one of...\n", -1); ItclGetInfoUsage(interp, objPtr, infoPtr, NULL); Tcl_SetObjResult(interp, objPtr); return TCL_ERROR; } /* Have a subcommand. Pass on to the ensemble */ Tcl_GetCommandInfoFromToken(infoPtr->infoCmd, &info); return Tcl_NRCallObjProc(interp, info.objProc, info.objClientData, objc, objv); } static int InfoWrap( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { return Tcl_NRCallObjProc(interp, NRInfoWrap, clientData, objc, objv); } static void InfoCmdDelete( ClientData clientData) { ItclObjectInfo *infoPtr = (ItclObjectInfo *)clientData; infoPtr->infoCmd = NULL; } int |
︙ | ︙ | |||
482 483 484 485 486 487 488 | Tcl_Panic("ITCL: error in creating namespace: ::itcl::builtin::Info \n"); } if (infoPtr->infoCmd) { Tcl_Panic("Double init of info ensemble"); } token = Tcl_CreateEnsemble(interp, nsPtr->fullName, nsPtr, TCL_ENSEMBLE_PREFIX); | < < | | > | 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 | Tcl_Panic("ITCL: error in creating namespace: ::itcl::builtin::Info \n"); } if (infoPtr->infoCmd) { Tcl_Panic("Double init of info ensemble"); } token = Tcl_CreateEnsemble(interp, nsPtr->fullName, nsPtr, TCL_ENSEMBLE_PREFIX); infoPtr->infoCmd = token; token = Tcl_NRCreateCommand(interp, "::itcl::builtin::info", InfoWrap, NRInfoWrap, infoPtr, InfoCmdDelete); Tcl_GetCommandInfoFromToken(token, &info); /* * Make the C implementation of the "info" ensemble available as * a method body. This makes all [$object info] become the * equivalent of [::itcl::builtin::Info] without any need for * tailcall to restore the right frame [87a1bc6e82]. */ Itcl_RegisterObjC(interp, "itcl-builtin-info", info.objProc, info.objClientData, NULL); Tcl_Export(interp, nsPtr, "[a-z]*", 1); ensObjPtr = Tcl_NewStringObj("::itcl::builtin::Info", -1); for (i=0 ; InfoMethodList[i].name!=NULL ; i++) { Tcl_Obj *cmdObjPtr = Tcl_DuplicateObj(ensObjPtr); Tcl_AppendToObj(cmdObjPtr, "::", 2); Tcl_AppendToObj(cmdObjPtr, InfoMethodList[i].name, -1); Tcl_CreateObjCommand(interp, Tcl_GetString(cmdObjPtr), InfoMethodList[i].proc, infoPtr, InfoMethodList[i].proc == Itcl_BiInfoVarsCmd ? ItclRestoreInfoVars : NULL); Tcl_DecrRefCount(cmdObjPtr); } unkObjPtr = Tcl_NewStringObj("::itcl::builtin::Info::unknown", -1); Tcl_CreateObjCommand(interp, Tcl_GetString(unkObjPtr), Itcl_BiInfoUnknownCmd, infoPtr, NULL); if (Tcl_SetEnsembleUnknownHandler(NULL, Tcl_FindEnsemble(interp, ensObjPtr, TCL_LEAVE_ERR_MSG), |
︙ | ︙ | |||
697 698 699 700 701 702 703 | ClientData clientData; ItclObjectInfo *infoPtr; Tcl_Object oPtr; clientData = Itcl_GetCallFrameClientData(interp); infoPtr = (ItclObjectInfo *)Tcl_GetAssocData(interp, ITCL_INTERP_DATA, NULL); if (clientData != NULL) { | | | | 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 | ClientData clientData; ItclObjectInfo *infoPtr; Tcl_Object oPtr; clientData = Itcl_GetCallFrameClientData(interp); infoPtr = (ItclObjectInfo *)Tcl_GetAssocData(interp, ITCL_INTERP_DATA, NULL); if (clientData != NULL) { oPtr = Tcl_ObjectContextObject((Tcl_ObjectContext)clientData); contextIoPtr = (ItclObject *)Tcl_ObjectGetMetadata(oPtr, infoPtr->object_meta_type); contextIclsPtr = contextIoPtr->iclsPtr; } if ((contextIoPtr == NULL) || (contextIclsPtr == NULL)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "\nget info like this instead: " \ "\n namespace eval className { info class }", -1)); |
︙ | ︙ | |||
773 774 775 776 777 778 779 | int result; int i; ItclShowArgs(1, "Itcl_BiInfoClassOptionsCmd", objc, objv); iclsPtr = NULL; pattern = NULL; if (Itcl_GetContext(interp, &iclsPtr, &ioPtr) != TCL_OK) { | | | 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 | int result; int i; ItclShowArgs(1, "Itcl_BiInfoClassOptionsCmd", objc, objv); iclsPtr = NULL; pattern = NULL; if (Itcl_GetContext(interp, &iclsPtr, &ioPtr) != TCL_OK) { Tcl_AppendResult(interp, "cannot get context ", NULL); return TCL_ERROR; } if (objc > 2) { Tcl_AppendResult(interp, "wrong # args should be: info options ", "?pattern?", NULL); return TCL_ERROR; } |
︙ | ︙ | |||
873 874 875 876 877 878 879 | ItclShowArgs(1, "Itcl_BiInfoContextCmd", objc, objv); iclsPtr = NULL; if (Itcl_GetContext(interp, &iclsPtr, &ioPtr) != TCL_OK) { return TCL_ERROR; } if (ioPtr == NULL) { | | | 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 | ItclShowArgs(1, "Itcl_BiInfoContextCmd", objc, objv); iclsPtr = NULL; if (Itcl_GetContext(interp, &iclsPtr, &ioPtr) != TCL_OK) { return TCL_ERROR; } if (ioPtr == NULL) { Tcl_AppendResult(interp, "cannot get object context ", NULL); return TCL_ERROR; } listPtr = Tcl_NewListObj(0, NULL); objPtr = Tcl_NewStringObj(Tcl_GetString(iclsPtr->namePtr), -1); Tcl_ListObjAppendElement(interp, listPtr, objPtr); objPtr = Tcl_NewStringObj(Tcl_GetString(ioPtr->namePtr), -1); Tcl_ListObjAppendElement(interp, listPtr, objPtr); |
︙ | ︙ | |||
928 929 930 931 932 933 934 | return TCL_ERROR; } /* * Return the list of base classes. */ | | | | 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 | return TCL_ERROR; } /* * Return the list of base classes. */ listPtr = Tcl_NewListObj(0, NULL); elem = Itcl_FirstListElem(&contextIclsPtr->bases); while (elem) { Tcl_Obj *objPtr; ItclClass *iclsPtr = (ItclClass*)Itcl_GetListValue(elem); objPtr = Tcl_NewStringObj(iclsPtr->nsPtr->fullName, -1); Tcl_ListObjAppendElement(NULL, listPtr, objPtr); elem = Itcl_NextListElem(elem); } Tcl_SetObjResult(interp, listPtr); return TCL_OK; } |
︙ | ︙ | |||
990 991 992 993 994 995 996 | return TCL_ERROR; } /* * Traverse through the derivation hierarchy and return * base class names. */ | | | | 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 | return TCL_ERROR; } /* * Traverse through the derivation hierarchy and return * base class names. */ listPtr = Tcl_NewListObj(0, NULL); Itcl_InitHierIter(&hier, contextIclsPtr); while ((iclsPtr=Itcl_AdvanceHierIter(&hier)) != NULL) { if (iclsPtr->nsPtr == NULL) { Tcl_AppendResult(interp, "ITCL: iclsPtr->nsPtr == NULL", Tcl_GetString(iclsPtr->fullNamePtr), NULL); return TCL_ERROR; } objPtr = Tcl_NewStringObj(iclsPtr->nsPtr->fullName, -1); Tcl_ListObjAppendElement(NULL, listPtr, objPtr); } Itcl_DeleteHierIter(&hier); Tcl_SetObjResult(interp, listPtr); return TCL_OK; } |
︙ | ︙ | |||
1037 1038 1039 1040 1041 1042 1043 | { char *cmdName = NULL; Tcl_Obj *resultPtr = NULL; Tcl_Obj *objPtr = NULL; static const char *options[] = { "-args", "-body", "-name", "-protection", "-type", | | | 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 | { char *cmdName = NULL; Tcl_Obj *resultPtr = NULL; Tcl_Obj *objPtr = NULL; static const char *options[] = { "-args", "-body", "-name", "-protection", "-type", NULL }; enum BIfIdx { BIfArgsIdx, BIfBodyIdx, BIfNameIdx, BIfProtectIdx, BIfTypeIdx } *iflist, iflistStorage[5]; static enum BIfIdx DefInfoFunction[5] = { BIfProtectIdx, |
︙ | ︙ | |||
1105 1106 1107 1108 1109 1110 1111 | entry = Tcl_FindHashEntry(&contextIclsPtr->resolveCmds, (char *)objPtr); Tcl_DecrRefCount(objPtr); objPtr = NULL; if (entry == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "\"", cmdName, "\" isn't a member function in class \"", contextIclsPtr->nsPtr->fullName, "\"", | | | 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 | entry = Tcl_FindHashEntry(&contextIclsPtr->resolveCmds, (char *)objPtr); Tcl_DecrRefCount(objPtr); objPtr = NULL; if (entry == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "\"", cmdName, "\" isn't a member function in class \"", contextIclsPtr->nsPtr->fullName, "\"", NULL); return TCL_ERROR; } clookup = (ItclCmdLookup *)Tcl_GetHashValue(entry); imPtr = clookup->imPtr; mcode = imPtr->codePtr; |
︙ | ︙ | |||
1136 1137 1138 1139 1140 1141 1142 | if (result != TCL_OK) { return TCL_ERROR; } } } if (objc > 1) { | | | 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 | if (result != TCL_OK) { return TCL_ERROR; } } } if (objc > 1) { resultPtr = Tcl_NewListObj(0, NULL); } for (i=0 ; i < objc; i++) { switch (iflist[i]) { case BIfArgsIdx: if (mcode && mcode->argListPtr) { if (imPtr->usagePtr == NULL) { |
︙ | ︙ | |||
1194 1195 1196 1197 1198 1199 1200 | objPtr = Tcl_NewStringObj(val, -1); break; } if (objc == 1) { resultPtr = objPtr; } else { | | | | 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 | objPtr = Tcl_NewStringObj(val, -1); break; } if (objc == 1) { resultPtr = objPtr; } else { Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); } } Tcl_SetObjResult(interp, resultPtr); } else { /* * Return the list of available commands. */ resultPtr = Tcl_NewListObj(0, NULL); Itcl_InitHierIter(&hier, contextIclsPtr); while ((iclsPtr=Itcl_AdvanceHierIter(&hier)) != NULL) { entry = Tcl_FirstHashEntry(&iclsPtr->functions, &place); while (entry) { int useIt = 1; |
︙ | ︙ | |||
1232 1233 1234 1235 1236 1237 1238 | useIt = 0; } } } if (useIt) { objPtr = Tcl_NewStringObj( Tcl_GetString(imPtr->fullNamePtr), -1); | | | 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 | useIt = 0; } } } if (useIt) { objPtr = Tcl_NewStringObj( Tcl_GetString(imPtr->fullNamePtr), -1); Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); } entry = Tcl_NextHashEntry(&place); } } Itcl_DeleteHierIter(&hier); |
︙ | ︙ | |||
1287 1288 1289 1290 1291 1292 1293 | char *varName; const char *val; int i; int result; static const char *options[] = { "-config", "-init", "-name", "-protection", "-type", | | | 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 | char *varName; const char *val; int i; int result; static const char *options[] = { "-config", "-init", "-name", "-protection", "-type", "-value", NULL }; enum BIvIdx { BIvConfigIdx, BIvInitIdx, BIvNameIdx, BIvProtectIdx, BIvTypeIdx, BIvValueIdx } *ivlist, ivlistStorage[6]; static enum BIvIdx DefInfoVariable[5] = { |
︙ | ︙ | |||
1352 1353 1354 1355 1356 1357 1358 | */ if (varName) { entry = ItclResolveVarEntry(contextIclsPtr, varName); if (entry == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "\"", varName, "\" isn't a variable in class \"", contextIclsPtr->nsPtr->fullName, "\"", | | | 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 | */ if (varName) { entry = ItclResolveVarEntry(contextIclsPtr, varName); if (entry == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "\"", varName, "\" isn't a variable in class \"", contextIclsPtr->nsPtr->fullName, "\"", NULL); return TCL_ERROR; } vlookup = (ItclVarLookup*)Tcl_GetHashValue(entry); ivPtr = vlookup->ivPtr; /* |
︙ | ︙ | |||
1388 1389 1390 1391 1392 1393 1394 | if (result != TCL_OK) { return TCL_ERROR; } } } if (objc > 1) { | | | 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 | if (result != TCL_OK) { return TCL_ERROR; } } } if (objc > 1) { resultPtr = Tcl_NewListObj(0, NULL); } for (i=0 ; i < objc; i++) { switch (ivlist[i]) { case BIvConfigIdx: if (ivPtr->codePtr && Itcl_IsMemberCodeImplemented(ivPtr->codePtr)) { |
︙ | ︙ | |||
1411 1412 1413 1414 1415 1416 1417 | /* * If this is the built-in "this" variable, then * report the object name as its initialization string. */ if ((ivPtr->flags & ITCL_THIS_VAR) != 0) { if ((contextIoPtr != NULL) && (contextIoPtr->accessCmd != NULL)) { | | | 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 | /* * If this is the built-in "this" variable, then * report the object name as its initialization string. */ if ((ivPtr->flags & ITCL_THIS_VAR) != 0) { if ((contextIoPtr != NULL) && (contextIoPtr->accessCmd != NULL)) { objPtr = Tcl_NewStringObj(NULL, 0); Tcl_GetCommandFullName( contextIoPtr->iclsPtr->interp, contextIoPtr->accessCmd, objPtr); } else { objPtr = Tcl_NewStringObj("<objectName>", -1); } } else { |
︙ | ︙ | |||
1458 1459 1460 1461 1462 1463 1464 | if (objc > 1) { Tcl_DecrRefCount(resultPtr); } Tcl_ResetResult(interp); Tcl_AppendResult(interp, "cannot access object-specific info ", "without an object context", | | | | | | | 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 | if (objc > 1) { Tcl_DecrRefCount(resultPtr); } Tcl_ResetResult(interp); Tcl_AppendResult(interp, "cannot access object-specific info ", "without an object context", NULL); return TCL_ERROR; } else { val = Itcl_GetInstanceVar(interp, Tcl_GetString(ivPtr->namePtr), contextIoPtr, ivPtr->iclsPtr); } } if (val == NULL) { val = "<undefined>"; } objPtr = Tcl_NewStringObj((const char *)val, -1); break; } if (objc == 1) { resultPtr = objPtr; } else { Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); } } Tcl_ResetResult(interp); Tcl_AppendResult(interp, Tcl_GetString(resultPtr), NULL); Tcl_DecrRefCount(resultPtr); } else { /* * Return the list of available variables. Report the built-in * "this" variable only once, for the most-specific class. */ resultPtr = Tcl_NewListObj(0, NULL); Itcl_InitHierIter(&hier, contextIclsPtr); while ((iclsPtr=Itcl_AdvanceHierIter(&hier)) != NULL) { entry = Tcl_FirstHashEntry(&iclsPtr->variables, &place); while (entry) { ivPtr = (ItclVariable*)Tcl_GetHashValue(entry); if ((ivPtr->flags & ITCL_THIS_VAR) != 0) { if (iclsPtr == contextIclsPtr) { objPtr = Tcl_NewStringObj( Tcl_GetString(ivPtr->fullNamePtr), -1); Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); } } else { objPtr = Tcl_NewStringObj( Tcl_GetString(ivPtr->fullNamePtr), -1); Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); } entry = Tcl_NextHashEntry(&place); } } Itcl_DeleteHierIter(&hier); |
︙ | ︙ | |||
1626 1627 1628 1629 1630 1631 1632 | if (hPtr != NULL) { Itcl_List varList; Tcl_Obj *resultListPtr; Tcl_Obj *namePtr; int numElems; Itcl_InitList(&varList); | | | 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 | if (hPtr != NULL) { Itcl_List varList; Tcl_Obj *resultListPtr; Tcl_Obj *namePtr; int numElems; Itcl_InitList(&varList); iclsPtr = (ItclClass *)Tcl_GetHashValue(hPtr); resultListPtr = Tcl_GetObjResult(interp); numElems = 0; /* FIXME !! should perhaps skip ___DO_NOT_DELETE_THIS_VARIABLE here !! */ FOREACH_HASH_VALUE(ivPtr, &iclsPtr->variables) { if ((ivPtr->flags & ITCL_VARIABLE) != 0) { if (head != NULL) { namePtr = Tcl_NewStringObj( |
︙ | ︙ | |||
1831 1832 1833 1834 1835 1836 1837 | if (contextIclsPtr->flags & (ITCL_TYPE|ITCL_WIDGETADAPTOR|ITCL_WIDGET|ITCL_ECLASS)) { hPtr = Tcl_FindHashEntry(&contextIclsPtr->delegatedFunctions, (char *)objv[1]); } if (hPtr) { | | | 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 | if (contextIclsPtr->flags & (ITCL_TYPE|ITCL_WIDGETADAPTOR|ITCL_WIDGET|ITCL_ECLASS)) { hPtr = Tcl_FindHashEntry(&contextIclsPtr->delegatedFunctions, (char *)objv[1]); } if (hPtr) { ItclDelegatedFunction *idmPtr = (ItclDelegatedFunction *)Tcl_GetHashValue(hPtr); Tcl_Obj *objPtr = Tcl_NewStringObj("delegated ", -1); if (idmPtr->flags & ITCL_TYPE_METHOD) { what = "typemethod"; } Tcl_AppendToObj(objPtr, what, -1); Tcl_AppendToObj(objPtr, " \"", -1); |
︙ | ︙ | |||
1934 1935 1936 1937 1938 1939 1940 | if (contextIclsPtr->flags & (ITCL_TYPE|ITCL_WIDGETADAPTOR|ITCL_WIDGET|ITCL_ECLASS)) { hPtr = Tcl_FindHashEntry(&contextIclsPtr->delegatedFunctions, (char *)objv[1]); } if (hPtr) { | | | 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 | if (contextIclsPtr->flags & (ITCL_TYPE|ITCL_WIDGETADAPTOR|ITCL_WIDGET|ITCL_ECLASS)) { hPtr = Tcl_FindHashEntry(&contextIclsPtr->delegatedFunctions, (char *)objv[1]); } if (hPtr) { ItclDelegatedFunction *idmPtr = (ItclDelegatedFunction *)Tcl_GetHashValue(hPtr); Tcl_Obj *objPtr = Tcl_NewStringObj("delegated ", -1); if (idmPtr->flags & ITCL_TYPE_METHOD) { what = "typemethod"; } Tcl_AppendToObj(objPtr, what, -1); Tcl_AppendToObj(objPtr, " \"", -1); |
︙ | ︙ | |||
1986 1987 1988 1989 1990 1991 1992 | static const char *options[] = { "-cgetmethod", "-cgetmethodvar","-class", "-configuremethod", "-configuremethodvar", "-default", "-name", "-protection", "-resource", "-validatemethod", "-validatemethodvar", | | | 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 | static const char *options[] = { "-cgetmethod", "-cgetmethodvar","-class", "-configuremethod", "-configuremethodvar", "-default", "-name", "-protection", "-resource", "-validatemethod", "-validatemethodvar", "-value", NULL }; enum BOptIdx { BOptCgetMethodIdx, BOptCgetMethodVarIdx, BOptClassIdx, BOptConfigureMethodIdx, BOptConfigureMethodVarIdx, |
︙ | ︙ | |||
2067 2068 2069 2070 2071 2072 2073 | /* * Return info for a specific option. */ if (optionName) { if (contextIoPtr == NULL) { Tcl_ResetResult(interp); Tcl_AppendResult(interp, "cannot access object-specific info ", | | | | 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 | /* * Return info for a specific option. */ if (optionName) { if (contextIoPtr == NULL) { Tcl_ResetResult(interp); Tcl_AppendResult(interp, "cannot access object-specific info ", "without an object context", NULL); return TCL_ERROR; } optionNamePtr = Tcl_NewStringObj(optionName, -1); hPtr = Tcl_FindHashEntry(&contextIoPtr->objectOptions, (char *)optionNamePtr); Tcl_DecrRefCount(optionNamePtr); if (hPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "\"", optionName, "\" isn't a option in object \"", Tcl_GetString(contextIoPtr->namePtr), "\"", NULL); return TCL_ERROR; } ioptPtr = (ItclOption*)Tcl_GetHashValue(hPtr); /* * By default, return everything. */ |
︙ | ︙ | |||
2106 2107 2108 2109 2110 2111 2112 | if (result != TCL_OK) { return TCL_ERROR; } } } if (objc > 1) { | | | 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 | if (result != TCL_OK) { return TCL_ERROR; } } } if (objc > 1) { resultPtr = Tcl_NewListObj(0, NULL); } for (i=0 ; i < objc; i++) { switch (ioptlist[i]) { case BOptCgetMethodIdx: if (ioptPtr->cgetMethodPtr) { objPtr = Tcl_NewStringObj( |
︙ | ︙ | |||
2210 2211 2212 2213 2214 2215 2216 | case BOptValueIdx: if (contextIoPtr == NULL) { Tcl_ResetResult(interp); Tcl_AppendResult(interp, "cannot access object-specific info ", "without an object context", | | | | | | 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 | case BOptValueIdx: if (contextIoPtr == NULL) { Tcl_ResetResult(interp); Tcl_AppendResult(interp, "cannot access object-specific info ", "without an object context", NULL); return TCL_ERROR; } else { val = ItclGetInstanceVar(interp, "itcl_options", Tcl_GetString(ioptPtr->namePtr), contextIoPtr, ioptPtr->iclsPtr); } if (val == NULL) { val = "<undefined>"; } objPtr = Tcl_NewStringObj((const char *)val, -1); break; } if (objc == 1) { resultPtr = objPtr; } else { Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); } } Tcl_SetObjResult(interp, resultPtr); } else { /* * Return the list of available options. */ resultPtr = Tcl_NewListObj(0, NULL); Itcl_InitHierIter(&hier, contextIclsPtr); while ((iclsPtr=Itcl_AdvanceHierIter(&hier)) != NULL) { hPtr = Tcl_FirstHashEntry(&iclsPtr->options, &place); while (hPtr) { ioptPtr = (ItclOption*)Tcl_GetHashValue(hPtr); objPtr = ioptPtr->namePtr; Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); hPtr = Tcl_NextHashEntry(&place); } } Itcl_DeleteHierIter(&hier); Tcl_SetObjResult(interp, resultPtr); } |
︙ | ︙ | |||
2284 2285 2286 2287 2288 2289 2290 | { char *componentName = NULL; Tcl_Obj *resultPtr = NULL; Tcl_Obj *objPtr = NULL; Tcl_Obj *componentNamePtr; static const char *components[] = { | | | 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 | { char *componentName = NULL; Tcl_Obj *resultPtr = NULL; Tcl_Obj *objPtr = NULL; Tcl_Obj *componentNamePtr; static const char *components[] = { "-name", "-inherit", "-value", NULL }; enum BCompIdx { BCompNameIdx, BCompInheritIdx, BCompValueIdx } *icomplist, icomplistStorage[3]; static enum BCompIdx DefInfoComponent[3] = { BCompNameIdx, |
︙ | ︙ | |||
2337 2338 2339 2340 2341 2342 2343 | infoPtr = contextIclsPtr->infoPtr; hPtr = Tcl_FindHashEntry(&infoPtr->namespaceClasses, (char *)nsPtr); if (hPtr == NULL) { Tcl_AppendResult(interp, "cannot find class name for namespace \"", nsPtr->fullName, "\"", NULL); return TCL_ERROR; } | | | 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 | infoPtr = contextIclsPtr->infoPtr; hPtr = Tcl_FindHashEntry(&infoPtr->namespaceClasses, (char *)nsPtr); if (hPtr == NULL) { Tcl_AppendResult(interp, "cannot find class name for namespace \"", nsPtr->fullName, "\"", NULL); return TCL_ERROR; } contextIclsPtr = (ItclClass *)Tcl_GetHashValue(hPtr); /* * Process args: * ?componentName? ?-inherit? ?-name? ?-value? */ objv++; /* skip over command name */ objc--; |
︙ | ︙ | |||
2375 2376 2377 2378 2379 2380 2381 | } Tcl_DecrRefCount(componentNamePtr); Itcl_DeleteHierIter(&hier); if (hPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "\"", componentName, "\" isn't a component in class \"", contextIclsPtr->nsPtr->fullName, "\"", | | | 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 | } Tcl_DecrRefCount(componentNamePtr); Itcl_DeleteHierIter(&hier); if (hPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "\"", componentName, "\" isn't a component in class \"", contextIclsPtr->nsPtr->fullName, "\"", NULL); return TCL_ERROR; } icPtr = (ItclComponent *)Tcl_GetHashValue(hPtr); /* * By default, return everything. */ |
︙ | ︙ | |||
2403 2404 2405 2406 2407 2408 2409 | if (result != TCL_OK) { return TCL_ERROR; } } } if (objc > 1) { | | | 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 | if (result != TCL_OK) { return TCL_ERROR; } } } if (objc > 1) { resultPtr = Tcl_NewListObj(0, NULL); } for (i=0 ; i < objc; i++) { switch (icomplist[i]) { case BCompNameIdx: objPtr = Tcl_NewStringObj( Tcl_GetString(icPtr->ivPtr->fullNamePtr), -1); |
︙ | ︙ | |||
2428 2429 2430 2431 2432 2433 2434 | case BCompValueIdx: if (contextIoPtr == NULL) { Tcl_ResetResult(interp); Tcl_AppendResult(interp, "cannot access object-specific info ", "without an object context", | | | | | | 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 | case BCompValueIdx: if (contextIoPtr == NULL) { Tcl_ResetResult(interp); Tcl_AppendResult(interp, "cannot access object-specific info ", "without an object context", NULL); return TCL_ERROR; } else { val = ItclGetInstanceVar(interp, Tcl_GetString(icPtr->namePtr), NULL, contextIoPtr, icPtr->ivPtr->iclsPtr); } if (val == NULL) { val = "<undefined>"; } objPtr = Tcl_NewStringObj((const char *)val, -1); break; } if (objc == 1) { resultPtr = objPtr; } else { Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); } } Tcl_SetObjResult(interp, resultPtr); } else { /* * Return the list of available components. */ resultPtr = Tcl_NewListObj(0, NULL); Itcl_InitHierIter(&hier, contextIclsPtr); while ((iclsPtr=Itcl_AdvanceHierIter(&hier)) != NULL) { hPtr = Tcl_FirstHashEntry(&iclsPtr->components, &place); while (hPtr) { icPtr = (ItclComponent *)Tcl_GetHashValue(hPtr); objPtr = Tcl_NewStringObj( Tcl_GetString(icPtr->ivPtr->fullNamePtr), -1); Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); hPtr = Tcl_NextHashEntry(&place); } } Itcl_DeleteHierIter(&hier); Tcl_SetObjResult(interp, resultPtr); } |
︙ | ︙ | |||
2507 2508 2509 2510 2511 2512 2513 | ItclObject *contextIoPtr; char *name; ItclShowArgs(1, "Itcl_BiInfoWidgetCmd", objc, objv); if (objc != 1) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "wrong # args: should be \"info widget\"", | | | | | 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 | ItclObject *contextIoPtr; char *name; ItclShowArgs(1, "Itcl_BiInfoWidgetCmd", objc, objv); if (objc != 1) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "wrong # args: should be \"info widget\"", NULL); return TCL_ERROR; } /* * If this command is not invoked within a class namespace, * signal an error. */ contextIclsPtr = NULL; if (Itcl_GetContext(interp, &contextIclsPtr, &contextIoPtr) != TCL_OK) { /* try it the hard way */ ClientData clientData; ItclObjectInfo *infoPtr; Tcl_Object oPtr; clientData = Itcl_GetCallFrameClientData(interp); infoPtr = (ItclObjectInfo *)Tcl_GetAssocData(interp, ITCL_INTERP_DATA, NULL); if (clientData != NULL) { oPtr = Tcl_ObjectContextObject((Tcl_ObjectContext)clientData); contextIoPtr = (ItclObject *)Tcl_ObjectGetMetadata(oPtr, infoPtr->object_meta_type); contextIclsPtr = contextIoPtr->iclsPtr; } if ((contextIoPtr == NULL) || (contextIclsPtr == NULL)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "\nget info like this instead: " "\n namespace eval className { info widget ... }", -1)); |
︙ | ︙ | |||
2591 2592 2593 2594 2595 2596 2597 | ClientData clientData, /* ItclObjectInfo Ptr */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { #ifdef NOTYET static const char *components[] = { | | | 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 | ClientData clientData, /* ItclObjectInfo Ptr */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { #ifdef NOTYET static const char *components[] = { "-name", "-inherit", "-value", NULL }; enum BCompIdx { BCompNameIdx, BCompInheritIdx, BCompValueIdx } *icomplist, icomplistStorage[3]; static enum BCompIdx DefInfoComponent[3] = { BCompNameIdx, |
︙ | ︙ | |||
2674 2675 2676 2677 2678 2679 2680 | ClientData clientData, /* ItclObjectInfo Ptr */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { #ifdef NOTYET static const char *components[] = { | | | 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 | ClientData clientData, /* ItclObjectInfo Ptr */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ { #ifdef NOTYET static const char *components[] = { "-name", "-inherit", "-value", NULL }; enum BCompIdx { BCompNameIdx, BCompInheritIdx, BCompValueIdx } *icomplist, icomplistStorage[3]; static enum BCompIdx DefInfoComponent[3] = { BCompNameIdx, |
︙ | ︙ | |||
2763 2764 2765 2766 2767 2768 2769 | ItclObject *contextIoPtr; char *name; ItclShowArgs(1, "Itcl_BiInfoTypeCmd", objc, objv); if (objc != 1) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "wrong # args: should be \"info type\"", | | | | | 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 | ItclObject *contextIoPtr; char *name; ItclShowArgs(1, "Itcl_BiInfoTypeCmd", objc, objv); if (objc != 1) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "wrong # args: should be \"info type\"", NULL); return TCL_ERROR; } /* * If this command is not invoked within a class namespace, * signal an error. */ contextIclsPtr = NULL; if (Itcl_GetContext(interp, &contextIclsPtr, &contextIoPtr) != TCL_OK) { /* try it the hard way */ ClientData clientData; ItclObjectInfo *infoPtr; Tcl_Object oPtr; clientData = Itcl_GetCallFrameClientData(interp); infoPtr = (ItclObjectInfo *)Tcl_GetAssocData(interp, ITCL_INTERP_DATA, NULL); if (clientData != NULL) { oPtr = Tcl_ObjectContextObject((Tcl_ObjectContext)clientData); contextIoPtr = (ItclObject *)Tcl_ObjectGetMetadata(oPtr, infoPtr->object_meta_type); contextIclsPtr = contextIoPtr->iclsPtr; } if ((contextIoPtr == NULL) || (contextIclsPtr == NULL)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "\nget info like this instead: " "\n namespace eval className { info type ...}", -1)); |
︙ | ︙ | |||
2848 2849 2850 2851 2852 2853 2854 | ItclClass *contextIclsPtr; ItclObject *contextIoPtr; ItclShowArgs(1, "Itcl_BiInfoHullTypeCmd", objc, objv); if (objc != 1) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "wrong # args: should be \"info hulltype\"", | | | | | 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 | ItclClass *contextIclsPtr; ItclObject *contextIoPtr; ItclShowArgs(1, "Itcl_BiInfoHullTypeCmd", objc, objv); if (objc != 1) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "wrong # args: should be \"info hulltype\"", NULL); return TCL_ERROR; } /* * If this command is not invoked within a class namespace, * signal an error. */ contextIclsPtr = NULL; if (Itcl_GetContext(interp, &contextIclsPtr, &contextIoPtr) != TCL_OK) { /* try it the hard way */ ClientData clientData; ItclObjectInfo *infoPtr; Tcl_Object oPtr; clientData = Itcl_GetCallFrameClientData(interp); infoPtr = (ItclObjectInfo *)Tcl_GetAssocData(interp, ITCL_INTERP_DATA, NULL); if (clientData != NULL) { oPtr = Tcl_ObjectContextObject((Tcl_ObjectContext)clientData); contextIoPtr = (ItclObject *)Tcl_ObjectGetMetadata(oPtr, infoPtr->object_meta_type); contextIclsPtr = contextIoPtr->iclsPtr; } if ((contextIoPtr == NULL) || (contextIclsPtr == NULL)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "\nget info like this instead: " "\n namespace eval className { info hulltype ... }", -1)); |
︙ | ︙ | |||
3020 3021 3022 3023 3024 3025 3026 | const char *val; char *cmdName; int i; int result; static const char *options[] = { "-args", "-body", "-name", "-protection", "-type", | | | 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 | const char *val; char *cmdName; int i; int result; static const char *options[] = { "-args", "-body", "-name", "-protection", "-type", NULL }; enum BIfIdx { BIfArgsIdx, BIfBodyIdx, BIfNameIdx, BIfProtectIdx, BIfTypeIdx } *iflist, iflistStorage[5]; static enum BIfIdx DefInfoFunction[5] = { BIfProtectIdx, |
︙ | ︙ | |||
3078 3079 3080 3081 3082 3083 3084 | hPtr = Tcl_FindHashEntry(&contextIclsPtr->resolveCmds, (char *)objPtr); Tcl_DecrRefCount(objPtr); objPtr = NULL; if (hPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "\"", cmdName, "\" isn't a method in class \"", contextIclsPtr->nsPtr->fullName, "\"", | | | | 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 | hPtr = Tcl_FindHashEntry(&contextIclsPtr->resolveCmds, (char *)objPtr); Tcl_DecrRefCount(objPtr); objPtr = NULL; if (hPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "\"", cmdName, "\" isn't a method in class \"", contextIclsPtr->nsPtr->fullName, "\"", NULL); return TCL_ERROR; } clookup = (ItclCmdLookup *)Tcl_GetHashValue(hPtr); imPtr = clookup->imPtr; mcode = imPtr->codePtr; if (imPtr->flags & ITCL_COMMON) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "\"", cmdName, "\" isn't a method in class \"", contextIclsPtr->nsPtr->fullName, "\"", NULL); return TCL_ERROR; } /* * By default, return everything. */ if (objc == 0) { |
︙ | ︙ | |||
3116 3117 3118 3119 3120 3121 3122 | if (result != TCL_OK) { return TCL_ERROR; } } } if (objc > 1) { | | | 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 | if (result != TCL_OK) { return TCL_ERROR; } } } if (objc > 1) { resultPtr = Tcl_NewListObj(0, NULL); } for (i=0 ; i < objc; i++) { switch (iflist[i]) { case BIfArgsIdx: if (mcode && mcode->argListPtr) { if (imPtr->usagePtr == NULL) { |
︙ | ︙ | |||
3173 3174 3175 3176 3177 3178 3179 | objPtr = Tcl_NewStringObj(val, -1); break; } if (objc == 1) { resultPtr = objPtr; } else { | | | | | 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 | objPtr = Tcl_NewStringObj(val, -1); break; } if (objc == 1) { resultPtr = objPtr; } else { Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); } } Tcl_SetObjResult(interp, resultPtr); } else { /* * Return the list of available commands. */ resultPtr = Tcl_NewListObj(0, NULL); Itcl_InitHierIter(&hier, contextIclsPtr); while ((iclsPtr=Itcl_AdvanceHierIter(&hier)) != NULL) { hPtr = Tcl_FirstHashEntry(&iclsPtr->functions, &place); while (hPtr) { int useIt = 1; imPtr = (ItclMemberFunc*)Tcl_GetHashValue(hPtr); if (!(imPtr->flags & ITCL_METHOD)) { useIt = 0; } if (useIt) { objPtr = Tcl_NewStringObj( Tcl_GetString(imPtr->fullNamePtr), -1); Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); } hPtr = Tcl_NextHashEntry(&place); } } Itcl_DeleteHierIter(&hier); |
︙ | ︙ | |||
3243 3244 3245 3246 3247 3248 3249 | const char *name; const char *pattern; ItclShowArgs(1, "Itcl_BiInfoMethodsCmd", objc, objv); iclsPtr = NULL; pattern = NULL; if (Itcl_GetContext(interp, &iclsPtr, &ioPtr) != TCL_OK) { | | | 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 | const char *name; const char *pattern; ItclShowArgs(1, "Itcl_BiInfoMethodsCmd", objc, objv); iclsPtr = NULL; pattern = NULL; if (Itcl_GetContext(interp, &iclsPtr, &ioPtr) != TCL_OK) { Tcl_AppendResult(interp, "cannot get context ", NULL); return TCL_ERROR; } if (ioPtr != NULL) { iclsPtr = ioPtr->iclsPtr; } if (objc == 2) { pattern = Tcl_GetString(objv[1]); |
︙ | ︙ | |||
3350 3351 3352 3353 3354 3355 3356 | int result; int i; ItclShowArgs(1, "Itcl_BiInfoOptionsCmd", objc, objv); iclsPtr = NULL; pattern = NULL; if (Itcl_GetContext(interp, &iclsPtr, &ioPtr) != TCL_OK) { | | | 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 | int result; int i; ItclShowArgs(1, "Itcl_BiInfoOptionsCmd", objc, objv); iclsPtr = NULL; pattern = NULL; if (Itcl_GetContext(interp, &iclsPtr, &ioPtr) != TCL_OK) { Tcl_AppendResult(interp, "cannot get context ", NULL); return TCL_ERROR; } if (ioPtr != NULL) { iclsPtr = ioPtr->iclsPtr; } if (objc > 2) { Tcl_AppendResult(interp, "wrong # args should be: info options ", |
︙ | ︙ | |||
3515 3516 3517 3518 3519 3520 3521 | const char *name; const char *pattern; ItclShowArgs(1, "Itcl_BiInfoComponentsCmd", objc, objv); iclsPtr = NULL; pattern = NULL; if (Itcl_GetContext(interp, &iclsPtr, &ioPtr) != TCL_OK) { | | | 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 | const char *name; const char *pattern; ItclShowArgs(1, "Itcl_BiInfoComponentsCmd", objc, objv); iclsPtr = NULL; pattern = NULL; if (Itcl_GetContext(interp, &iclsPtr, &ioPtr) != TCL_OK) { Tcl_AppendResult(interp, "cannot get context ", NULL); return TCL_ERROR; } if (ioPtr != NULL) { iclsPtr = ioPtr->iclsPtr; } if (iclsPtr == NULL) { Tcl_AppendResult(interp, "INTERNAL ERROR in Itcl_BiInfoComponentsCmd", |
︙ | ︙ | |||
3589 3590 3591 3592 3593 3594 3595 | const char *val; char *cmdName; int i; int result; static const char *options[] = { "-args", "-body", "-name", "-protection", "-type", | | | 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 | const char *val; char *cmdName; int i; int result; static const char *options[] = { "-args", "-body", "-name", "-protection", "-type", NULL }; enum BIfIdx { BIfArgsIdx, BIfBodyIdx, BIfNameIdx, BIfProtectIdx, BIfTypeIdx } *iflist, iflistStorage[5]; static enum BIfIdx DefInfoFunction[5] = { BIfProtectIdx, |
︙ | ︙ | |||
3648 3649 3650 3651 3652 3653 3654 | hPtr = Tcl_FindHashEntry(&contextIclsPtr->resolveCmds, (char *)objPtr); Tcl_DecrRefCount(objPtr); objPtr = NULL; if (hPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "\"", cmdName, "\" isn't a typemethod in class \"", contextIclsPtr->nsPtr->fullName, "\"", | | | | 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 | hPtr = Tcl_FindHashEntry(&contextIclsPtr->resolveCmds, (char *)objPtr); Tcl_DecrRefCount(objPtr); objPtr = NULL; if (hPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "\"", cmdName, "\" isn't a typemethod in class \"", contextIclsPtr->nsPtr->fullName, "\"", NULL); return TCL_ERROR; } clookup = (ItclCmdLookup *)Tcl_GetHashValue(hPtr); imPtr = clookup->imPtr; mcode = imPtr->codePtr; if (!(imPtr->flags & ITCL_TYPE_METHOD)) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "\"", cmdName, "\" isn't a typemethod in class \"", contextIclsPtr->nsPtr->fullName, "\"", NULL); return TCL_ERROR; } /* * By default, return everything. */ if (objc == 0) { |
︙ | ︙ | |||
3686 3687 3688 3689 3690 3691 3692 | if (result != TCL_OK) { return TCL_ERROR; } } } if (objc > 1) { | | | 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 | if (result != TCL_OK) { return TCL_ERROR; } } } if (objc > 1) { resultPtr = Tcl_NewListObj(0, NULL); } for (i=0 ; i < objc; i++) { switch (iflist[i]) { case BIfArgsIdx: if (mcode && mcode->argListPtr) { if (imPtr->usagePtr == NULL) { |
︙ | ︙ | |||
3743 3744 3745 3746 3747 3748 3749 | objPtr = Tcl_NewStringObj(val, -1); break; } if (objc == 1) { resultPtr = objPtr; } else { | | | | | 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 | objPtr = Tcl_NewStringObj(val, -1); break; } if (objc == 1) { resultPtr = objPtr; } else { Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); } } Tcl_SetObjResult(interp, resultPtr); } else { /* * Return the list of available commands. */ resultPtr = Tcl_NewListObj(0, NULL); Itcl_InitHierIter(&hier, contextIclsPtr); while ((iclsPtr=Itcl_AdvanceHierIter(&hier)) != NULL) { hPtr = Tcl_FirstHashEntry(&iclsPtr->functions, &place); while (hPtr) { int useIt = 1; imPtr = (ItclMemberFunc*)Tcl_GetHashValue(hPtr); if (!(imPtr->flags & ITCL_TYPE_METHOD)) { useIt = 0; } if (useIt) { objPtr = Tcl_NewStringObj( Tcl_GetString(imPtr->fullNamePtr), -1); Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); } hPtr = Tcl_NextHashEntry(&place); } } Itcl_DeleteHierIter(&hier); |
︙ | ︙ | |||
3813 3814 3815 3816 3817 3818 3819 | const char *name; const char *pattern; ItclShowArgs(1, "Itcl_BiInfoTypeMethodsCmd", objc, objv); iclsPtr = NULL; pattern = NULL; if (Itcl_GetContext(interp, &iclsPtr, &ioPtr) != TCL_OK) { | | | 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 | const char *name; const char *pattern; ItclShowArgs(1, "Itcl_BiInfoTypeMethodsCmd", objc, objv); iclsPtr = NULL; pattern = NULL; if (Itcl_GetContext(interp, &iclsPtr, &ioPtr) != TCL_OK) { Tcl_AppendResult(interp, "cannot get context ", NULL); return TCL_ERROR; } if (ioPtr != NULL) { iclsPtr = ioPtr->iclsPtr; } if (objc > 1) { pattern = Tcl_GetString(objv[1]); |
︙ | ︙ | |||
3921 3922 3923 3924 3925 3926 3927 | Tcl_AppendResult(interp, "wrong # args should be: info typevars ?pattern?", NULL); return TCL_ERROR; } iclsPtr = NULL; pattern = NULL; if (Itcl_GetContext(interp, &iclsPtr, &ioPtr) != TCL_OK) { | | | 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 | Tcl_AppendResult(interp, "wrong # args should be: info typevars ?pattern?", NULL); return TCL_ERROR; } iclsPtr = NULL; pattern = NULL; if (Itcl_GetContext(interp, &iclsPtr, &ioPtr) != TCL_OK) { Tcl_AppendResult(interp, "cannot get context ", NULL); return TCL_ERROR; } if (ioPtr != NULL) { iclsPtr = ioPtr->iclsPtr; } if (objc == 2) { pattern = Tcl_GetString(objv[1]); |
︙ | ︙ | |||
3979 3980 3981 3982 3983 3984 3985 | char *varName; const char *val; int i; int result; static const char *options[] = { "-init", "-name", "-protection", "-type", | | | 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 | char *varName; const char *val; int i; int result; static const char *options[] = { "-init", "-name", "-protection", "-type", "-value", NULL }; enum BIvIdx { BIvInitIdx, BIvNameIdx, BIvProtectIdx, BIvTypeIdx, BIvValueIdx |
︙ | ︙ | |||
4037 4038 4039 4040 4041 4042 4043 | */ if (varName) { hPtr = ItclResolveVarEntry(contextIclsPtr, varName); if (hPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "\"", varName, "\" isn't a typevariable in class \"", contextIclsPtr->nsPtr->fullName, "\"", | | | | 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 | */ if (varName) { hPtr = ItclResolveVarEntry(contextIclsPtr, varName); if (hPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "\"", varName, "\" isn't a typevariable in class \"", contextIclsPtr->nsPtr->fullName, "\"", NULL); return TCL_ERROR; } vlookup = (ItclVarLookup*)Tcl_GetHashValue(hPtr); ivPtr = vlookup->ivPtr; if (!(ivPtr->flags & ITCL_TYPE_VARIABLE)) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "\"", varName, "\" isn't a typevariable in class \"", contextIclsPtr->nsPtr->fullName, "\"", NULL); return TCL_ERROR; } /* * By default, return everything. */ if (objc == 0) { ivlist = DefInfoVariable; |
︙ | ︙ | |||
4072 4073 4074 4075 4076 4077 4078 | if (result != TCL_OK) { return TCL_ERROR; } } } if (objc > 1) { | | | | 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 | if (result != TCL_OK) { return TCL_ERROR; } } } if (objc > 1) { resultPtr = Tcl_NewListObj(0, NULL); } for (i=0 ; i < objc; i++) { switch (ivlist[i]) { case BIvInitIdx: /* * If this is the built-in "this" variable, then * report the object name as its initialization string. */ if ((ivPtr->flags & ITCL_THIS_VAR) != 0) { if ((contextIoPtr != NULL) && (contextIoPtr->accessCmd != NULL)) { objPtr = Tcl_NewStringObj(NULL, 0); Tcl_GetCommandFullName( contextIoPtr->iclsPtr->interp, contextIoPtr->accessCmd, objPtr); } else { objPtr = Tcl_NewStringObj("<objectName>", -1); } } else { |
︙ | ︙ | |||
4132 4133 4134 4135 4136 4137 4138 | if (objc > 1) { Tcl_DecrRefCount(resultPtr); } Tcl_ResetResult(interp); Tcl_AppendResult(interp, "cannot access object-specific info ", "without an object context", | | | | | | | 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 | if (objc > 1) { Tcl_DecrRefCount(resultPtr); } Tcl_ResetResult(interp); Tcl_AppendResult(interp, "cannot access object-specific info ", "without an object context", NULL); return TCL_ERROR; } else { val = Itcl_GetInstanceVar(interp, Tcl_GetString(ivPtr->namePtr), contextIoPtr, ivPtr->iclsPtr); } } if (val == NULL) { val = "<undefined>"; } objPtr = Tcl_NewStringObj((const char *)val, -1); break; } if (objc == 1) { resultPtr = objPtr; } else { Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); } } Tcl_ResetResult(interp); Tcl_AppendResult(interp, Tcl_GetString(resultPtr), NULL); Tcl_DecrRefCount(resultPtr); } else { /* * Return the list of available variables. Report the built-in * "this" variable only once, for the most-specific class. */ resultPtr = Tcl_NewListObj(0, NULL); Itcl_InitHierIter(&hier, contextIclsPtr); while ((iclsPtr=Itcl_AdvanceHierIter(&hier)) != NULL) { hPtr = Tcl_FirstHashEntry(&iclsPtr->variables, &place); while (hPtr) { ivPtr = (ItclVariable*)Tcl_GetHashValue(hPtr); if (ivPtr->flags & ITCL_TYPE_VAR) { if ((ivPtr->flags & ITCL_THIS_VAR) != 0) { if (iclsPtr == contextIclsPtr) { objPtr = Tcl_NewStringObj( Tcl_GetString(ivPtr->fullNamePtr), -1); Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); } } else { objPtr = Tcl_NewStringObj( Tcl_GetString(ivPtr->fullNamePtr), -1); Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); } } hPtr = Tcl_NextHashEntry(&place); } } Itcl_DeleteHierIter(&hier); |
︙ | ︙ | |||
4247 4248 4249 4250 4251 4252 4253 | ItclObject *contextIoPtr; char *name; ItclShowArgs(1, "Itcl_BiInfoWidgetadaptorCmd", objc, objv); if (objc != 1) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "wrong # args: should be \"info widgetadaptor\"", | | | | | 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 | ItclObject *contextIoPtr; char *name; ItclShowArgs(1, "Itcl_BiInfoWidgetadaptorCmd", objc, objv); if (objc != 1) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "wrong # args: should be \"info widgetadaptor\"", NULL); return TCL_ERROR; } /* * If this command is not invoked within a class namespace, * signal an error. */ contextIclsPtr = NULL; if (Itcl_GetContext(interp, &contextIclsPtr, &contextIoPtr) != TCL_OK) { /* try it the hard way */ ClientData clientData; ItclObjectInfo *infoPtr; Tcl_Object oPtr; clientData = Itcl_GetCallFrameClientData(interp); infoPtr = (ItclObjectInfo *)Tcl_GetAssocData(interp, ITCL_INTERP_DATA, NULL); if (clientData != NULL) { oPtr = Tcl_ObjectContextObject((Tcl_ObjectContext)clientData); contextIoPtr = (ItclObject *)Tcl_ObjectGetMetadata(oPtr, infoPtr->object_meta_type); contextIclsPtr = contextIoPtr->iclsPtr; } if ((contextIoPtr == NULL) || (contextIclsPtr == NULL)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "\nget info like this instead: " "\n namespace eval className { info widgetadaptor ... }", -1)); |
︙ | ︙ | |||
4341 4342 4343 4344 4345 4346 4347 | Tcl_AppendResult(interp, "wrong # args should be: info instances ?pattern?", NULL); return TCL_ERROR; } iclsPtr = NULL; pattern = NULL; if (Itcl_GetContext(interp, &iclsPtr, &ioPtr) != TCL_OK) { | | | 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 | Tcl_AppendResult(interp, "wrong # args should be: info instances ?pattern?", NULL); return TCL_ERROR; } iclsPtr = NULL; pattern = NULL; if (Itcl_GetContext(interp, &iclsPtr, &ioPtr) != TCL_OK) { Tcl_AppendResult(interp, "cannot get context ", NULL); return TCL_ERROR; } if (ioPtr != NULL) { iclsPtr = ioPtr->iclsPtr; } if (objc == 2) { pattern = Tcl_GetString(objv[1]); |
︙ | ︙ | |||
4659 4660 4661 4662 4663 4664 4665 | ItclClass *iclsPtr; char *optionName; int i; int result; static const char *options[] = { "-as", "-class", "-component", "-exceptions", | | | 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 | ItclClass *iclsPtr; char *optionName; int i; int result; static const char *options[] = { "-as", "-class", "-component", "-exceptions", "-name", "-resource", NULL }; enum BOptIdx { BOptAsIdx, BOptClassIdx, BOptComponentIdx, BOptExceptionsIdx, BOptNameIdx, BOptResourceIdx } *ioptlist, ioptlistStorage[6]; static enum BOptIdx DefInfoOption[6] = { |
︙ | ︙ | |||
4701 4702 4703 4704 4705 4706 4707 | infoPtr = contextIclsPtr->infoPtr; hPtr = Tcl_FindHashEntry(&infoPtr->namespaceClasses, (char *)nsPtr); if (hPtr == NULL) { Tcl_AppendResult(interp, "cannot find class name for namespace \"", nsPtr->fullName, "\"", NULL); return TCL_ERROR; } | | | 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 | infoPtr = contextIclsPtr->infoPtr; hPtr = Tcl_FindHashEntry(&infoPtr->namespaceClasses, (char *)nsPtr); if (hPtr == NULL) { Tcl_AppendResult(interp, "cannot find class name for namespace \"", nsPtr->fullName, "\"", NULL); return TCL_ERROR; } contextIclsPtr = (ItclClass *)Tcl_GetHashValue(hPtr); /* * Process args: * ?optionName? ?-name? ?-resource? ?-class? * ?-as? ?-exceptions? */ objv++; /* skip over command name */ |
︙ | ︙ | |||
4724 4725 4726 4727 4728 4729 4730 | /* * Return info for a specific option. */ if (optionName) { if (contextIoPtr == NULL) { Tcl_ResetResult(interp); Tcl_AppendResult(interp, "cannot access object-specific info ", | | | | 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 | /* * Return info for a specific option. */ if (optionName) { if (contextIoPtr == NULL) { Tcl_ResetResult(interp); Tcl_AppendResult(interp, "cannot access object-specific info ", "without an object context", NULL); return TCL_ERROR; } optionNamePtr = Tcl_NewStringObj(optionName, -1); hPtr = Tcl_FindHashEntry(&contextIoPtr->objectDelegatedOptions, (char *)optionNamePtr); Tcl_DecrRefCount(optionNamePtr); if (hPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "\"", optionName, "\" isn't an option in object \"", Tcl_GetString(contextIoPtr->namePtr), "\"", NULL); return TCL_ERROR; } idoptPtr = (ItclDelegatedOption*)Tcl_GetHashValue(hPtr); /* * By default, return everything. */ |
︙ | ︙ | |||
4763 4764 4765 4766 4767 4768 4769 | if (result != TCL_OK) { return TCL_ERROR; } } } if (objc > 1) { | | | 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 | if (result != TCL_OK) { return TCL_ERROR; } } } if (objc > 1) { resultPtr = Tcl_NewListObj(0, NULL); } for (i=0 ; i < objc; i++) { switch (ioptlist[i]) { case BOptAsIdx: if (idoptPtr->asPtr) { objPtr = Tcl_NewStringObj( |
︙ | ︙ | |||
4823 4824 4825 4826 4827 4828 4829 | break; } if (objc == 1) { resultPtr = objPtr; } else { | | | | | 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 | break; } if (objc == 1) { resultPtr = objPtr; } else { Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); } } Tcl_SetObjResult(interp, resultPtr); } else { /* * Return the list of available options. */ resultPtr = Tcl_NewListObj(0, NULL); Itcl_InitHierIter(&hier, contextIclsPtr); while ((iclsPtr=Itcl_AdvanceHierIter(&hier)) != NULL) { hPtr = Tcl_FirstHashEntry(&iclsPtr->delegatedOptions, &place); while (hPtr) { idoptPtr = (ItclDelegatedOption*)Tcl_GetHashValue(hPtr); objPtr = idoptPtr->namePtr; Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); hPtr = Tcl_NextHashEntry(&place); } } Itcl_DeleteHierIter(&hier); Tcl_SetObjResult(interp, resultPtr); } |
︙ | ︙ | |||
4891 4892 4893 4894 4895 4896 4897 | ItclClass *iclsPtr; char *cmdName; int i; int result; static const char *options[] = { "-as", "-component", "-exceptions", | | | 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 | ItclClass *iclsPtr; char *cmdName; int i; int result; static const char *options[] = { "-as", "-component", "-exceptions", "-name", "-using", NULL }; enum BOptIdx { BOptAsIdx, BOptComponentIdx, BOptExceptionsIdx, BOptNameIdx, BOptUsingIdx |
︙ | ︙ | |||
4959 4960 4961 4962 4963 4964 4965 | (char *)cmdNamePtr); } Tcl_DecrRefCount(cmdNamePtr); if (hPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "\"", cmdName, "\" isn't a delegated method in object \"", Tcl_GetString(contextIoPtr->namePtr), "\"", | | | | 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 | (char *)cmdNamePtr); } Tcl_DecrRefCount(cmdNamePtr); if (hPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "\"", cmdName, "\" isn't a delegated method in object \"", Tcl_GetString(contextIoPtr->namePtr), "\"", NULL); return TCL_ERROR; } idmPtr = (ItclDelegatedFunction*)Tcl_GetHashValue(hPtr); if (!(idmPtr->flags & ITCL_METHOD)) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "\"", cmdName, "\" isn't a delegated method in object \"", Tcl_GetString(contextIoPtr->namePtr), "\"", NULL); return TCL_ERROR; } /* * By default, return everything. */ if (objc == 0) { ioptlist = DefInfoOption; |
︙ | ︙ | |||
4993 4994 4995 4996 4997 4998 4999 | if (result != TCL_OK) { return TCL_ERROR; } } } if (objc > 1) { | | | 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 | if (result != TCL_OK) { return TCL_ERROR; } } } if (objc > 1) { resultPtr = Tcl_NewListObj(0, NULL); } for (i=0 ; i < objc; i++) { switch (ioptlist[i]) { case BOptAsIdx: if (idmPtr->asPtr) { objPtr = Tcl_NewStringObj( |
︙ | ︙ | |||
5044 5045 5046 5047 5048 5049 5050 | break; } if (objc == 1) { resultPtr = objPtr; } else { | | | | | 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 | break; } if (objc == 1) { resultPtr = objPtr; } else { Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); } } Tcl_SetObjResult(interp, resultPtr); } else { /* * Return the list of available options. */ resultPtr = Tcl_NewListObj(0, NULL); Itcl_InitHierIter(&hier, contextIclsPtr); while ((iclsPtr=Itcl_AdvanceHierIter(&hier)) != NULL) { hPtr = Tcl_FirstHashEntry(&iclsPtr->delegatedFunctions, &place); while (hPtr) { idmPtr = (ItclDelegatedFunction *)Tcl_GetHashValue(hPtr); if (idmPtr->flags & ITCL_METHOD) { objPtr = idmPtr->namePtr; Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); } hPtr = Tcl_NextHashEntry(&place); } } Itcl_DeleteHierIter(&hier); |
︙ | ︙ | |||
5116 5117 5118 5119 5120 5121 5122 | ItclClass *iclsPtr; char *cmdName; int i; int result; static const char *options[] = { "-as", "-component", "-exceptions", | | | 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 | ItclClass *iclsPtr; char *cmdName; int i; int result; static const char *options[] = { "-as", "-component", "-exceptions", "-name", "-using", NULL }; enum BOptIdx { BOptAsIdx, BOptComponentIdx, BOptExceptionsIdx, BOptNameIdx, BOptUsingIdx |
︙ | ︙ | |||
5185 5186 5187 5188 5189 5190 5191 | } Tcl_DecrRefCount(cmdNamePtr); if (hPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "\"", cmdName, "\" isn't a delegated typemethod in ", contextIoPtr ? "object \"" : "class \"", contextIoPtr ? Tcl_GetString(contextIoPtr->namePtr) | | | | 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 | } Tcl_DecrRefCount(cmdNamePtr); if (hPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "\"", cmdName, "\" isn't a delegated typemethod in ", contextIoPtr ? "object \"" : "class \"", contextIoPtr ? Tcl_GetString(contextIoPtr->namePtr) : Tcl_GetString(contextIclsPtr->namePtr), "\"", NULL); return TCL_ERROR; } idmPtr = (ItclDelegatedFunction*)Tcl_GetHashValue(hPtr); if (!(idmPtr->flags & ITCL_TYPE_METHOD)) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "\"", cmdName, "\" isn't a delegated typemethod in ", contextIoPtr ? "object \"" : "class \"", contextIoPtr ? Tcl_GetString(contextIoPtr->namePtr) : Tcl_GetString(contextIclsPtr->namePtr), "\"", NULL); return TCL_ERROR; } /* * By default, return everything. */ if (objc == 0) { ioptlist = DefInfoOption; |
︙ | ︙ | |||
5220 5221 5222 5223 5224 5225 5226 | if (result != TCL_OK) { return TCL_ERROR; } } } if (objc > 1) { | | | 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 | if (result != TCL_OK) { return TCL_ERROR; } } } if (objc > 1) { resultPtr = Tcl_NewListObj(0, NULL); } for (i=0 ; i < objc; i++) { switch (ioptlist[i]) { case BOptAsIdx: if (idmPtr->asPtr) { objPtr = Tcl_NewStringObj( |
︙ | ︙ | |||
5271 5272 5273 5274 5275 5276 5277 | break; } if (objc == 1) { resultPtr = objPtr; } else { | | | | | 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 | break; } if (objc == 1) { resultPtr = objPtr; } else { Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); } } Tcl_SetObjResult(interp, resultPtr); } else { /* * Return the list of available options. */ resultPtr = Tcl_NewListObj(0, NULL); Itcl_InitHierIter(&hier, contextIclsPtr); while ((iclsPtr=Itcl_AdvanceHierIter(&hier)) != NULL) { hPtr = Tcl_FirstHashEntry(&iclsPtr->delegatedFunctions, &place); while (hPtr) { idmPtr = (ItclDelegatedFunction *)Tcl_GetHashValue(hPtr); if (idmPtr->flags & ITCL_TYPE_METHOD) { objPtr = idmPtr->namePtr; Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); } hPtr = Tcl_NextHashEntry(&place); } } Itcl_DeleteHierIter(&hier); Tcl_SetObjResult(interp, resultPtr); } return TCL_OK; } |
Changes to generic/itclInt.h.
︙ | ︙ | |||
48 49 50 51 52 53 54 | #endif /* * MSVC 8.0 started to mark many standard C library functions depreciated * including the *printf family and others. Tell it to shut up. * (_MSC_VER is 1200 for VC6, 1300 or 1310 for vc7.net, 1400 for 8.0) */ | | > | | > | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | #endif /* * MSVC 8.0 started to mark many standard C library functions depreciated * including the *printf family and others. Tell it to shut up. * (_MSC_VER is 1200 for VC6, 1300 or 1310 for vc7.net, 1400 for 8.0) */ #if defined(_MSC_VER) # pragma warning(disable:4244) # if _MSC_VER >= 1400 # pragma warning(disable:4267) # pragma warning(disable:4996) # endif #endif /* * Since the Tcl/Tk distribution doesn't perform any asserts, * dynamic loading can fail to find the __assert function. * As a workaround, we'll include our own. */ |
︙ | ︙ | |||
81 82 83 84 85 86 87 | * only iterates over values. */ #define FOREACH_HASH_DECLS \ Tcl_HashEntry *hPtr;Tcl_HashSearch search #define FOREACH_HASH(key,val,tablePtr) \ for(hPtr=Tcl_FirstHashEntry((tablePtr),&search); hPtr!=NULL ? \ | | | | < < < < < < < < < < < < < < < < < < < < < < < | 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | * only iterates over values. */ #define FOREACH_HASH_DECLS \ Tcl_HashEntry *hPtr;Tcl_HashSearch search #define FOREACH_HASH(key,val,tablePtr) \ for(hPtr=Tcl_FirstHashEntry((tablePtr),&search); hPtr!=NULL ? \ (*(void **)&(key)=Tcl_GetHashKey((tablePtr),hPtr),\ *(void **)&(val)=Tcl_GetHashValue(hPtr),1):0; hPtr=Tcl_NextHashEntry(&search)) #define FOREACH_HASH_VALUE(val,tablePtr) \ for(hPtr=Tcl_FirstHashEntry((tablePtr),&search); hPtr!=NULL ? \ (*(void **)&(val)=Tcl_GetHashValue(hPtr),1):0;hPtr=Tcl_NextHashEntry(&search)) /* * What sort of size of things we like to allocate. */ #define ALLOC_CHUNK 8 #define ITCL_INT_NAMESPACE ITCL_NAMESPACE"::internal" #define ITCL_INTDICTS_NAMESPACE ITCL_INT_NAMESPACE"::dicts" #define ITCL_VARIABLES_NAMESPACE ITCL_INT_NAMESPACE"::variables" #define ITCL_COMMANDS_NAMESPACE ITCL_INT_NAMESPACE"::commands" typedef struct ItclFoundation { Itcl_Stack methodCallStack; Tcl_Command dispatchCommand; } ItclFoundation; typedef struct ItclArgList { |
︙ | ︙ | |||
190 191 192 193 194 195 196 | int currClassFlags; /* flags for the class just in creation */ int buildingWidget; /* set if in construction of a widget */ int unparsedObjc; /* number options not parsed by ItclExtendedConfigure/-Cget function */ Tcl_Obj **unparsedObjv; /* options not parsed by ItclExtendedConfigure/-Cget function */ int functionFlags; /* used for creating of ItclMemberCode */ | | | | 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | int currClassFlags; /* flags for the class just in creation */ int buildingWidget; /* set if in construction of a widget */ int unparsedObjc; /* number options not parsed by ItclExtendedConfigure/-Cget function */ Tcl_Obj **unparsedObjv; /* options not parsed by ItclExtendedConfigure/-Cget function */ int functionFlags; /* used for creating of ItclMemberCode */ int unused7; struct ItclDelegatedOption *currIdoPtr; /* the current delegated option info */ int inOptionHandling; /* used to indicate for type/widget ... * that there is an option processing * and methods are allowed to be called */ /* these are the Tcl_Obj Ptrs for the clazz unknown procedure */ /* need to store them to be able to free them at the end */ int itclWidgetInitted; /* set to 1 if itclWidget.tcl has already * been called */ int itclHullCmdsInitted; /* set to 1 if itclHullCmds.tcl has already * been called */ Tcl_Obj *unused2; Tcl_Obj *unused3; Tcl_Obj *unused4; Tcl_Obj *infoVarsPtr; Tcl_Obj *unused9; Tcl_Obj *infoVars4Ptr; Tcl_Obj *typeDestructorArgumentPtr; struct ItclObject *lastIoPtr; /* last object constructed */ Tcl_Command infoCmd; } ItclObjectInfo; typedef struct EnsembleInfo { |
︙ | ︙ | |||
239 240 241 242 243 244 245 | #define ITCL_WIDGET_TOPLEVEL 0x100 #define ITCL_WIDGET_TTK_FRAME 0x200 #define ITCL_WIDGET_TTK_LABEL_FRAME 0x400 #define ITCL_WIDGET_TTK_TOPLEVEL 0x800 #define ITCL_CLASS_IS_DELETED 0x1000 #define ITCL_CLASS_IS_DESTROYED 0x2000 #define ITCL_CLASS_NS_IS_DESTROYED 0x4000 | | | 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | #define ITCL_WIDGET_TOPLEVEL 0x100 #define ITCL_WIDGET_TTK_FRAME 0x200 #define ITCL_WIDGET_TTK_LABEL_FRAME 0x400 #define ITCL_WIDGET_TTK_TOPLEVEL 0x800 #define ITCL_CLASS_IS_DELETED 0x1000 #define ITCL_CLASS_IS_DESTROYED 0x2000 #define ITCL_CLASS_NS_IS_DESTROYED 0x4000 #define ITCL_CLASS_IS_RENAMED 0x8000 /* unused */ #define ITCL_CLASS_IS_FREED 0x10000 #define ITCL_CLASS_DERIVED_RELEASED 0x20000 #define ITCL_CLASS_NS_TEARDOWN 0x40000 #define ITCL_CLASS_NO_VARNS_DELETE 0x80000 #define ITCL_CLASS_SHOULD_VARNS_DELETE 0x100000 #define ITCL_CLASS_DESTRUCTOR_CALLED 0x400000 |
︙ | ︙ | |||
392 393 394 395 396 397 398 | Tcl_Obj *hullWindowNamePtr; /* the window path name for the hull * (before renaming in installhull) */ int destructorHasBeenCalled; /* is set when the destructor is called * to avoid callin destructor twice */ int noComponentTrace; /* don't call component traces if * setting components in DelegationInstall */ int hadConstructorError; /* needed for multiple calls of CallItclObjectCmd */ | < | 371 372 373 374 375 376 377 378 379 380 381 382 383 384 | Tcl_Obj *hullWindowNamePtr; /* the window path name for the hull * (before renaming in installhull) */ int destructorHasBeenCalled; /* is set when the destructor is called * to avoid callin destructor twice */ int noComponentTrace; /* don't call component traces if * setting components in DelegationInstall */ int hadConstructorError; /* needed for multiple calls of CallItclObjectCmd */ } ItclObject; #define ITCL_IGNORE_ERRS 0x002 /* useful for construction/destruction */ typedef struct ItclResolveInfo { int flags; ItclClass *iclsPtr; |
︙ | ︙ | |||
422 423 424 425 426 427 428 | Tcl_Obj *bodyPtr; /* the function body */ ItclArgList *argListPtr; /* the parsed arguments */ union { Tcl_CmdProc *argCmd; /* (argc,argv) C implementation */ Tcl_ObjCmdProc *objCmd; /* (objc,objv) C implementation */ } cfunc; ClientData clientData; /* client data for C implementations */ | < | 400 401 402 403 404 405 406 407 408 409 410 411 412 413 | Tcl_Obj *bodyPtr; /* the function body */ ItclArgList *argListPtr; /* the parsed arguments */ union { Tcl_CmdProc *argCmd; /* (argc,argv) C implementation */ Tcl_ObjCmdProc *objCmd; /* (objc,objv) C implementation */ } cfunc; ClientData clientData; /* client data for C implementations */ } ItclMemberCode; /* * Flag bits for ItclMemberCode: */ #define ITCL_IMPLEMENT_NONE 0x001 /* no implementation */ #define ITCL_IMPLEMENT_TCL 0x002 /* Tcl implementation */ |
︙ | ︙ | |||
524 525 526 527 528 529 530 | Tcl_Obj *origArgsPtr; /* the argument string of the original definition */ Tcl_Obj *bodyPtr; /* the function body */ ItclArgList *argListPtr; /* the parsed arguments */ ItclClass *declaringClassPtr; /* the class which declared the method/proc */ ClientData tmPtr; /* TclOO methodPtr */ ItclDelegatedFunction *idmPtr; /* if the function is delegated != NULL */ | < | 501 502 503 504 505 506 507 508 509 510 511 512 513 514 | Tcl_Obj *origArgsPtr; /* the argument string of the original definition */ Tcl_Obj *bodyPtr; /* the function body */ ItclArgList *argListPtr; /* the parsed arguments */ ItclClass *declaringClassPtr; /* the class which declared the method/proc */ ClientData tmPtr; /* TclOO methodPtr */ ItclDelegatedFunction *idmPtr; /* if the function is delegated != NULL */ } ItclMemberFunc; /* * Instance variables. */ typedef struct ItclVariable { Tcl_Obj *namePtr; /* member name */ |
︙ | ︙ | |||
645 646 647 648 649 650 651 | int objectFlags; Tcl_Namespace *nsPtr; ItclObject *ioPtr; ItclMemberFunc *imPtr; int refCount; } ItclCallContext; | < < < < < < < < < < < < < | | | < < < | 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 | int objectFlags; Tcl_Namespace *nsPtr; ItclObject *ioPtr; ItclMemberFunc *imPtr; int refCount; } ItclCallContext; MODULE_SCOPE void * Itcl_Alloc(size_t size); MODULE_SCOPE void Itcl_Free(void *ptr); /* * The macro below is used to modify a "char" value (e.g. by casting * it to an unsigned character) so that it can be used safely with * macros such as isspace. */ #define UCHAR(c) ((unsigned char) (c)) |
︙ | ︙ | |||
700 701 702 703 704 705 706 | #endif MODULE_SCOPE Tcl_ObjCmdProc ItclCallCCommand; MODULE_SCOPE Tcl_ObjCmdProc ItclObjectUnknownCommand; MODULE_SCOPE int ItclCheckCallProc(ClientData clientData, Tcl_Interp *interp, Tcl_ObjectContext contextPtr, Tcl_CallFrame *framePtr, int *isFinished); | < < < < < < < < < | 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 | #endif MODULE_SCOPE Tcl_ObjCmdProc ItclCallCCommand; MODULE_SCOPE Tcl_ObjCmdProc ItclObjectUnknownCommand; MODULE_SCOPE int ItclCheckCallProc(ClientData clientData, Tcl_Interp *interp, Tcl_ObjectContext contextPtr, Tcl_CallFrame *framePtr, int *isFinished); MODULE_SCOPE void ItclPreserveClass(ItclClass *iclsPtr); MODULE_SCOPE void ItclReleaseClass(ClientData iclsPtr); MODULE_SCOPE ItclFoundation *ItclGetFoundation(Tcl_Interp *interp); MODULE_SCOPE Tcl_ObjCmdProc ItclClassCommandDispatcher; MODULE_SCOPE Tcl_Command Itcl_CmdAliasProc(Tcl_Interp *interp, Tcl_Namespace *nsPtr, const char *cmdName, ClientData clientData); MODULE_SCOPE Tcl_Var Itcl_VarAliasProc(Tcl_Interp *interp, Tcl_Namespace *nsPtr, const char *VarName, ClientData clientData); MODULE_SCOPE int ItclIsClass(Tcl_Interp *interp, Tcl_Command cmd); |
︙ | ︙ | |||
839 840 841 842 843 844 845 846 847 848 849 850 851 852 | ItclClass *iclsPtr, ItclVariable *ivPtr); MODULE_SCOPE int ItclAddClassFunctionDictInfo(Tcl_Interp *interp, ItclClass *iclsPtr, ItclMemberFunc *imPtr); MODULE_SCOPE int ItclAddClassDelegatedFunctionDictInfo(Tcl_Interp *interp, ItclClass *iclsPtr, ItclDelegatedFunction *idmPtr); MODULE_SCOPE int ItclClassCreateObject(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); MODULE_SCOPE Tcl_ObjCmdProc Itcl_BiMyProcCmd; MODULE_SCOPE Tcl_ObjCmdProc Itcl_BiInstallComponentCmd; MODULE_SCOPE Tcl_ObjCmdProc Itcl_BiCallInstanceCmd; MODULE_SCOPE Tcl_ObjCmdProc Itcl_BiGetInstanceVarCmd; MODULE_SCOPE Tcl_ObjCmdProc Itcl_BiMyTypeMethodCmd; MODULE_SCOPE Tcl_ObjCmdProc Itcl_BiMyMethodCmd; MODULE_SCOPE Tcl_ObjCmdProc Itcl_BiMyTypeVarCmd; | > > > | 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 | ItclClass *iclsPtr, ItclVariable *ivPtr); MODULE_SCOPE int ItclAddClassFunctionDictInfo(Tcl_Interp *interp, ItclClass *iclsPtr, ItclMemberFunc *imPtr); MODULE_SCOPE int ItclAddClassDelegatedFunctionDictInfo(Tcl_Interp *interp, ItclClass *iclsPtr, ItclDelegatedFunction *idmPtr); MODULE_SCOPE int ItclClassCreateObject(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); MODULE_SCOPE void ItclRestoreInfoVars(ClientData clientData); MODULE_SCOPE Tcl_ObjCmdProc Itcl_BiMyProcCmd; MODULE_SCOPE Tcl_ObjCmdProc Itcl_BiInstallComponentCmd; MODULE_SCOPE Tcl_ObjCmdProc Itcl_BiCallInstanceCmd; MODULE_SCOPE Tcl_ObjCmdProc Itcl_BiGetInstanceVarCmd; MODULE_SCOPE Tcl_ObjCmdProc Itcl_BiMyTypeMethodCmd; MODULE_SCOPE Tcl_ObjCmdProc Itcl_BiMyMethodCmd; MODULE_SCOPE Tcl_ObjCmdProc Itcl_BiMyTypeVarCmd; |
︙ | ︙ |
Changes to generic/itclIntDecls.h.
︙ | ︙ | |||
176 177 178 179 180 181 182 | const char *arglist, const char *body, ItclMemberFunc **mfuncPtr); /* 55 */ ITCLAPI int Itcl_ChangeMemberFunc(Tcl_Interp *interp, ItclMemberFunc *mfunc, const char *arglist, const char *body); /* 56 */ | | | | 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | const char *arglist, const char *body, ItclMemberFunc **mfuncPtr); /* 55 */ ITCLAPI int Itcl_ChangeMemberFunc(Tcl_Interp *interp, ItclMemberFunc *mfunc, const char *arglist, const char *body); /* 56 */ ITCLAPI void Itcl_DeleteMemberFunc(void *cdata); /* 57 */ ITCLAPI int Itcl_CreateMemberCode(Tcl_Interp *interp, ItclClass *iclsPtr, const char *arglist, const char *body, ItclMemberCode **mcodePtr); /* 58 */ ITCLAPI void Itcl_DeleteMemberCode(void *cdata); /* 59 */ ITCLAPI int Itcl_GetMemberCode(Tcl_Interp *interp, ItclMemberFunc *mfunc); /* Slot 60 is reserved */ /* 61 */ ITCLAPI int Itcl_EvalMemberCode(Tcl_Interp *interp, ItclMemberFunc *mfunc, |
︙ | ︙ | |||
580 581 582 583 584 585 586 | void (*reserved49)(void); int (*itcl_BodyCmd) (ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 50 */ int (*itcl_ConfigBodyCmd) (ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 51 */ int (*itcl_CreateMethod) (Tcl_Interp *interp, ItclClass *iclsPtr, Tcl_Obj *namePtr, const char *arglist, const char *body); /* 52 */ int (*itcl_CreateProc) (Tcl_Interp *interp, ItclClass *iclsPtr, Tcl_Obj *namePtr, const char *arglist, const char *body); /* 53 */ int (*itcl_CreateMemberFunc) (Tcl_Interp *interp, ItclClass *iclsPtr, Tcl_Obj *name, const char *arglist, const char *body, ItclMemberFunc **mfuncPtr); /* 54 */ int (*itcl_ChangeMemberFunc) (Tcl_Interp *interp, ItclMemberFunc *mfunc, const char *arglist, const char *body); /* 55 */ | | | | 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 | void (*reserved49)(void); int (*itcl_BodyCmd) (ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 50 */ int (*itcl_ConfigBodyCmd) (ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 51 */ int (*itcl_CreateMethod) (Tcl_Interp *interp, ItclClass *iclsPtr, Tcl_Obj *namePtr, const char *arglist, const char *body); /* 52 */ int (*itcl_CreateProc) (Tcl_Interp *interp, ItclClass *iclsPtr, Tcl_Obj *namePtr, const char *arglist, const char *body); /* 53 */ int (*itcl_CreateMemberFunc) (Tcl_Interp *interp, ItclClass *iclsPtr, Tcl_Obj *name, const char *arglist, const char *body, ItclMemberFunc **mfuncPtr); /* 54 */ int (*itcl_ChangeMemberFunc) (Tcl_Interp *interp, ItclMemberFunc *mfunc, const char *arglist, const char *body); /* 55 */ void (*itcl_DeleteMemberFunc) (void *cdata); /* 56 */ int (*itcl_CreateMemberCode) (Tcl_Interp *interp, ItclClass *iclsPtr, const char *arglist, const char *body, ItclMemberCode **mcodePtr); /* 57 */ void (*itcl_DeleteMemberCode) (void *cdata); /* 58 */ int (*itcl_GetMemberCode) (Tcl_Interp *interp, ItclMemberFunc *mfunc); /* 59 */ void (*reserved60)(void); int (*itcl_EvalMemberCode) (Tcl_Interp *interp, ItclMemberFunc *mfunc, ItclObject *contextObj, int objc, Tcl_Obj *const objv[]); /* 61 */ void (*reserved62)(void); void (*reserved63)(void); void (*reserved64)(void); void (*reserved65)(void); |
︙ | ︙ |
Changes to generic/itclLinkage.c.
︙ | ︙ | |||
70 71 72 73 74 75 76 | * this procedure returns an error. * * Returns TCL_OK on success, or TCL_ERROR (along with an error message * in interp->result) if anything goes wrong. * ------------------------------------------------------------------------ */ int | | | | | | | | | | | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | * this procedure returns an error. * * Returns TCL_OK on success, or TCL_ERROR (along with an error message * in interp->result) if anything goes wrong. * ------------------------------------------------------------------------ */ int Itcl_RegisterC( Tcl_Interp *interp, /* interpreter handling this registration */ const char *name, /* symbolic name for procedure */ Tcl_CmdProc *proc, /* procedure handling Tcl command */ ClientData clientData, /* client data associated with proc */ Tcl_CmdDeleteProc *deleteProc) /* proc called to free up client data */ { int newEntry; Tcl_HashEntry *entry; Tcl_HashTable *procTable; ItclCfunc *cfunc; /* * Make sure that a proc was specified. */ if (!proc) { Tcl_AppendResult(interp, "initialization error: null pointer for ", "C procedure \"", name, "\"", NULL); return TCL_ERROR; } /* * Add a new entry for the given procedure. If an entry with * this name already exists, then make sure that it was defined * with the same proc. */ procTable = ItclGetRegisteredProcs(interp); entry = Tcl_CreateHashEntry(procTable, name, &newEntry); if (!newEntry) { cfunc = (ItclCfunc*)Tcl_GetHashValue(entry); if (cfunc->argCmdProc != NULL && cfunc->argCmdProc != proc) { Tcl_AppendResult(interp, "initialization error: C procedure ", "with name \"", name, "\" already defined", NULL); return TCL_ERROR; } if (cfunc->deleteProc != NULL) { (*cfunc->deleteProc)(cfunc->clientData); } } else { cfunc = (ItclCfunc*)ckalloc(sizeof(ItclCfunc)); cfunc->objCmdProc = NULL; } cfunc->argCmdProc = proc; cfunc->clientData = clientData; cfunc->deleteProc = deleteProc; Tcl_SetHashValue(entry, cfunc); return TCL_OK; } /* * ------------------------------------------------------------------------ * Itcl_RegisterObjC() |
︙ | ︙ | |||
154 155 156 157 158 159 160 | * this procedure returns an error. * * Returns TCL_OK on success, or TCL_ERROR (along with an error message * in interp->result) if anything goes wrong. * ------------------------------------------------------------------------ */ int | | | | | | | | | | | 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | * this procedure returns an error. * * Returns TCL_OK on success, or TCL_ERROR (along with an error message * in interp->result) if anything goes wrong. * ------------------------------------------------------------------------ */ int Itcl_RegisterObjC( Tcl_Interp *interp, /* interpreter handling this registration */ const char *name, /* symbolic name for procedure */ Tcl_ObjCmdProc *proc, /* procedure handling Tcl command */ ClientData clientData, /* client data associated with proc */ Tcl_CmdDeleteProc *deleteProc) /* proc called to free up client data */ { int newEntry; Tcl_HashEntry *entry; Tcl_HashTable *procTable; ItclCfunc *cfunc; /* * Make sure that a proc was specified. */ if (!proc) { Tcl_AppendResult(interp, "initialization error: null pointer for ", "C procedure \"", name, "\"", NULL); return TCL_ERROR; } /* * Add a new entry for the given procedure. If an entry with * this name already exists, then make sure that it was defined * with the same proc. */ procTable = ItclGetRegisteredProcs(interp); entry = Tcl_CreateHashEntry(procTable, name, &newEntry); if (!newEntry) { cfunc = (ItclCfunc*)Tcl_GetHashValue(entry); if (cfunc->objCmdProc != NULL && cfunc->objCmdProc != proc) { Tcl_AppendResult(interp, "initialization error: C procedure ", "with name \"", name, "\" already defined", NULL); return TCL_ERROR; } if (cfunc->deleteProc != NULL) { (*cfunc->deleteProc)(cfunc->clientData); } } else { cfunc = (ItclCfunc*)ckalloc(sizeof(ItclCfunc)); cfunc->argCmdProc = NULL; } cfunc->objCmdProc = proc; cfunc->clientData = clientData; cfunc->deleteProc = deleteProc; Tcl_SetHashValue(entry, cfunc); return TCL_OK; } /* * ------------------------------------------------------------------------ * Itcl_FindC() |
︙ | ︙ | |||
240 241 242 243 244 245 246 | *argProcPtr = NULL; /* assume info won't be found */ *objProcPtr = NULL; *cDataPtr = NULL; if (interp) { procTable = (Tcl_HashTable*)Tcl_GetAssocData(interp, | | | 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | *argProcPtr = NULL; /* assume info won't be found */ *objProcPtr = NULL; *cDataPtr = NULL; if (interp) { procTable = (Tcl_HashTable*)Tcl_GetAssocData(interp, "itcl_RegC", NULL); if (procTable) { entry = Tcl_FindHashEntry(procTable, name); if (entry) { cfunc = (ItclCfunc*)Tcl_GetHashValue(entry); *argProcPtr = cfunc->argCmdProc; *objProcPtr = cfunc->objCmdProc; |
︙ | ︙ | |||
266 267 268 269 270 271 272 | * * Returns a pointer to a hash table containing the list of registered * procs in the specified interpreter. If the hash table does not * already exist, it is created. * ------------------------------------------------------------------------ */ static Tcl_HashTable* | | | | | | | | | 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | * * Returns a pointer to a hash table containing the list of registered * procs in the specified interpreter. If the hash table does not * already exist, it is created. * ------------------------------------------------------------------------ */ static Tcl_HashTable* ItclGetRegisteredProcs( Tcl_Interp *interp) /* interpreter handling this registration */ { Tcl_HashTable* procTable; /* * If the registration table does not yet exist, then create it. */ procTable = (Tcl_HashTable*)Tcl_GetAssocData(interp, "itcl_RegC", NULL); if (!procTable) { procTable = (Tcl_HashTable*)ckalloc(sizeof(Tcl_HashTable)); Tcl_InitHashTable(procTable, TCL_STRING_KEYS); Tcl_SetAssocData(interp, "itcl_RegC", ItclFreeC, procTable); } return procTable; } /* * ------------------------------------------------------------------------ * ItclFreeC() * * When an interpreter is deleted, this procedure is called to * free up the associated data created by Itcl_RegisterC and * Itcl_RegisterObjC. * ------------------------------------------------------------------------ */ static void ItclFreeC( ClientData clientData, /* associated data */ Tcl_Interp *interp) /* intepreter being deleted */ { Tcl_HashTable *tablePtr = (Tcl_HashTable*)clientData; Tcl_HashSearch place; Tcl_HashEntry *entry; ItclCfunc *cfunc; entry = Tcl_FirstHashEntry(tablePtr, &place); |
︙ | ︙ |
Changes to generic/itclMethod.c.
︙ | ︙ | |||
36 37 38 39 40 41 42 | ItclArgList *realArgs); static int ItclCreateMemberCode(Tcl_Interp* interp, ItclClass *iclsPtr, const char* arglist, const char* body, ItclMemberCode** mcodePtr, Tcl_Obj *namePtr, int flags); static int ItclCreateMemberFunc(Tcl_Interp* interp, ItclClass *iclsPtr, Tcl_Obj *namePtr, const char* arglist, const char* body, ItclMemberFunc** imPtrPtr, int flags); | < < < < < < < < < < < < < < < < < < < < < < | | < < < < < < < < < < < < | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | ItclArgList *realArgs); static int ItclCreateMemberCode(Tcl_Interp* interp, ItclClass *iclsPtr, const char* arglist, const char* body, ItclMemberCode** mcodePtr, Tcl_Obj *namePtr, int flags); static int ItclCreateMemberFunc(Tcl_Interp* interp, ItclClass *iclsPtr, Tcl_Obj *namePtr, const char* arglist, const char* body, ItclMemberFunc** imPtrPtr, int flags); static void FreeMemberCode(ItclMemberCode *mcodePtr); /* * ------------------------------------------------------------------------ * Itcl_BodyCmd() * * Invoked by Tcl whenever the user issues an "itcl::body" command to * define or redefine the implementation for a class method/proc. * Handles the following syntax: |
︙ | ︙ | |||
117 118 119 120 121 122 123 | ItclShowArgs(2, "Itcl_BodyCmd", objc, objv); if (objc != 4) { token = Tcl_GetString(objv[0]); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "wrong # args: should be \"", token, " class::func arglist body\"", | | | | 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | ItclShowArgs(2, "Itcl_BodyCmd", objc, objv); if (objc != 4) { token = Tcl_GetString(objv[0]); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "wrong # args: should be \"", token, " class::func arglist body\"", NULL); return TCL_ERROR; } /* * Parse the member name "namesp::namesp::class::func". * Make sure that a class name was specified, and that the * class exists. */ token = Tcl_GetString(objv[1]); Itcl_ParseNamespPath(token, &buffer, &head, &tail); if (!head || *head == '\0') { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "missing class specifier for body declaration \"", token, "\"", NULL); status = TCL_ERROR; goto bodyCmdDone; } iclsPtr = Itcl_FindClass(interp, head, /* autoload */ 1); if (iclsPtr == NULL) { status = TCL_ERROR; |
︙ | ︙ | |||
167 168 169 170 171 172 173 | } } if (imPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "function \"", tail, "\" is not defined in class \"", Tcl_GetString(iclsPtr->fullNamePtr), "\"", | | | 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | } } if (imPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "function \"", tail, "\" is not defined in class \"", Tcl_GetString(iclsPtr->fullNamePtr), "\"", NULL); status = TCL_ERROR; goto bodyCmdDone; } arglist = Tcl_GetString(objv[2]); body = Tcl_GetString(objv[3]); |
︙ | ︙ | |||
253 254 255 256 257 258 259 | */ token = Tcl_GetString(objv[1]); Itcl_ParseNamespPath(token, &buffer, &head, &tail); if ((head == NULL) || (*head == '\0')) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "missing class specifier for body declaration \"", token, "\"", | | | 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | */ token = Tcl_GetString(objv[1]); Itcl_ParseNamespPath(token, &buffer, &head, &tail); if ((head == NULL) || (*head == '\0')) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "missing class specifier for body declaration \"", token, "\"", NULL); status = TCL_ERROR; goto configBodyCmdDone; } iclsPtr = Itcl_FindClass(interp, head, /* autoload */ 1); if (iclsPtr == NULL) { status = TCL_ERROR; |
︙ | ︙ | |||
283 284 285 286 287 288 289 | } } if (vlookup == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "option \"", tail, "\" is not defined in class \"", Tcl_GetString(iclsPtr->fullNamePtr), "\"", | | | | | | | 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | } } if (vlookup == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "option \"", tail, "\" is not defined in class \"", Tcl_GetString(iclsPtr->fullNamePtr), "\"", NULL); status = TCL_ERROR; goto configBodyCmdDone; } ivPtr = vlookup->ivPtr; if (ivPtr->protection != ITCL_PUBLIC) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "option \"", Tcl_GetString(ivPtr->fullNamePtr), "\" is not a public configuration option", NULL); status = TCL_ERROR; goto configBodyCmdDone; } token = Tcl_GetString(objv[2]); if (Itcl_CreateMemberCode(interp, iclsPtr, NULL, token, &mcode) != TCL_OK) { status = TCL_ERROR; goto configBodyCmdDone; } Itcl_PreserveData(mcode); if (ivPtr->codePtr) { Itcl_ReleaseData(ivPtr->codePtr); } ivPtr->codePtr = mcode; configBodyCmdDone: Tcl_DStringFree(&buffer); return status; } |
︙ | ︙ | |||
386 387 388 389 390 391 392 | /* * Make sure that the method name does not contain anything * goofy like a "::" scope qualifier. */ if (strstr(Tcl_GetString(namePtr),"::")) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "bad method name \"", Tcl_GetString(namePtr), "\"", | | | 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | /* * Make sure that the method name does not contain anything * goofy like a "::" scope qualifier. */ if (strstr(Tcl_GetString(namePtr),"::")) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "bad method name \"", Tcl_GetString(namePtr), "\"", NULL); Tcl_DecrRefCount(namePtr); return TCL_ERROR; } /* * Create the method definition. */ |
︙ | ︙ | |||
435 436 437 438 439 440 441 | /* * Make sure that the proc name does not contain anything * goofy like a "::" scope qualifier. */ if (strstr(Tcl_GetString(namePtr),"::")) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "bad proc name \"", Tcl_GetString(namePtr), "\"", | | | 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 | /* * Make sure that the proc name does not contain anything * goofy like a "::" scope qualifier. */ if (strstr(Tcl_GetString(namePtr),"::")) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "bad proc name \"", Tcl_GetString(namePtr), "\"", NULL); return TCL_ERROR; } /* * Create the proc definition. */ if (ItclCreateMemberFunc(interp, iclsPtr, namePtr, arglist, |
︙ | ︙ | |||
496 497 498 499 500 501 502 | * same name doesn't already exist. */ hPtr = Tcl_CreateHashEntry(&iclsPtr->functions, (char *)namePtr, &newEntry); if (!newEntry) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "\"", Tcl_GetString(namePtr), "\" already defined in class \"", Tcl_GetString(iclsPtr->fullNamePtr), "\"", | | | | | | 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 | * same name doesn't already exist. */ hPtr = Tcl_CreateHashEntry(&iclsPtr->functions, (char *)namePtr, &newEntry); if (!newEntry) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "\"", Tcl_GetString(namePtr), "\" already defined in class \"", Tcl_GetString(iclsPtr->fullNamePtr), "\"", NULL); return TCL_ERROR; } /* * Try to create the implementation for this command member. */ if (ItclCreateMemberCode(interp, iclsPtr, arglist, body, &mcode, namePtr, flags) != TCL_OK) { Tcl_DeleteHashEntry(hPtr); return TCL_ERROR; } /* * Allocate a member function definition and return. */ imPtr = (ItclMemberFunc*)Itcl_Alloc(sizeof(ItclMemberFunc)); Itcl_EventuallyFree(imPtr, (Tcl_FreeProc *)Itcl_DeleteMemberFunc); imPtr->iclsPtr = iclsPtr; imPtr->infoPtr = iclsPtr->infoPtr; imPtr->protection = Itcl_Protection(interp, 0); imPtr->namePtr = Tcl_NewStringObj(Tcl_GetString(namePtr), -1); Tcl_IncrRefCount(imPtr->namePtr); imPtr->fullNamePtr = Tcl_NewStringObj( Tcl_GetString(iclsPtr->fullNamePtr), -1); Tcl_AppendToObj(imPtr->fullNamePtr, "::", 2); Tcl_AppendToObj(imPtr->fullNamePtr, Tcl_GetString(namePtr), -1); Tcl_IncrRefCount(imPtr->fullNamePtr); if (arglist != NULL) { imPtr->origArgsPtr = Tcl_NewStringObj(arglist, -1); Tcl_IncrRefCount(imPtr->origArgsPtr); } imPtr->codePtr = mcode; Itcl_PreserveData(mcode); if (imPtr->protection == ITCL_DEFAULT_PROTECT) { imPtr->protection = ITCL_PUBLIC; } imPtr->declaringClassPtr = iclsPtr; |
︙ | ︙ | |||
672 673 674 675 676 677 678 | Tcl_IncrRefCount(mcode->bodyPtr); imPtr->flags |= ITCL_CONSTRUCTOR; } if (strcmp(name, "destructor") == 0) { imPtr->flags |= ITCL_DESTRUCTOR; } | | | | 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 | Tcl_IncrRefCount(mcode->bodyPtr); imPtr->flags |= ITCL_CONSTRUCTOR; } if (strcmp(name, "destructor") == 0) { imPtr->flags |= ITCL_DESTRUCTOR; } Tcl_SetHashValue(hPtr, imPtr); Itcl_PreserveData(imPtr); *imPtrPtr = imPtr; return TCL_OK; } /* * ------------------------------------------------------------------------ |
︙ | ︙ | |||
761 762 763 764 765 766 767 | } else { argsStr = ""; } Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "argument list changed for function \"", Tcl_GetString(imPtr->fullNamePtr), "\": should be \"", argsStr, "\"", | | | > | 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 | } else { argsStr = ""; } Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "argument list changed for function \"", Tcl_GetString(imPtr->fullNamePtr), "\": should be \"", argsStr, "\"", NULL); Itcl_PreserveData(mcode); Itcl_ReleaseData(mcode); return TCL_ERROR; } if (imPtr->flags & ITCL_CONSTRUCTOR) { /* * REVISE mcode->bodyPtr here! * Include a [my ItclConstructBase $iclsPtr] method call. |
︙ | ︙ | |||
789 790 791 792 793 794 795 | mcode->bodyPtr = newBody; Tcl_IncrRefCount(mcode->bodyPtr); } /* * Free up the old implementation and install the new one. */ | | | | | 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 | mcode->bodyPtr = newBody; Tcl_IncrRefCount(mcode->bodyPtr); } /* * Free up the old implementation and install the new one. */ Itcl_PreserveData(mcode); Itcl_ReleaseData(imPtr->codePtr); imPtr->codePtr = mcode; if (mcode->flags & ITCL_IMPLEMENT_TCL) { ClientData pmPtr; imPtr->tmPtr = Itcl_NewProcClassMethod(interp, imPtr->iclsPtr->clsPtr, ItclCheckCallMethod, ItclAfterCallMethod, ItclProcErrorProc, imPtr, imPtr->namePtr, mcode->argumentPtr, mcode->bodyPtr, &pmPtr); hPtr = Tcl_CreateHashEntry(&imPtr->iclsPtr->infoPtr->procMethods, (char *)imPtr->tmPtr, &isNewEntry); if (isNewEntry) { Tcl_SetHashValue(hPtr, imPtr); |
︙ | ︙ | |||
856 857 858 859 860 861 862 | ItclMemberCode *mcode; const char **cPtrPtr; int haveError; /* * Allocate some space to hold the implementation. */ | | | | > | 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 | ItclMemberCode *mcode; const char **cPtrPtr; int haveError; /* * Allocate some space to hold the implementation. */ mcode = (ItclMemberCode*)Itcl_Alloc(sizeof(ItclMemberCode)); Itcl_EventuallyFree(mcode, (Tcl_FreeProc *)FreeMemberCode); if (arglist) { if (ItclCreateArgList(interp, arglist, &argc, &maxArgc, &usagePtr, &argListPtr, NULL, NULL) != TCL_OK) { Itcl_PreserveData(mcode); Itcl_ReleaseData(mcode); return TCL_ERROR; } mcode->argcount = argc; mcode->maxargcount = maxArgc; mcode->argListPtr = argListPtr; mcode->usagePtr = usagePtr; Tcl_IncrRefCount(mcode->usagePtr); |
︙ | ︙ | |||
905 906 907 908 909 910 911 | startStr = ""; } Tcl_AppendResult(interp, startStr, namePtr == NULL ? "??" : Tcl_GetString(namePtr), "'s arglist may not contain \"", *cPtrPtr, "\" explicitly", NULL); | | > | 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 | startStr = ""; } Tcl_AppendResult(interp, startStr, namePtr == NULL ? "??" : Tcl_GetString(namePtr), "'s arglist may not contain \"", *cPtrPtr, "\" explicitly", NULL); Itcl_PreserveData(mcode); Itcl_ReleaseData(mcode); return TCL_ERROR; } cPtrPtr++; } argListPtr = argListPtr->nextPtr; } } |
︙ | ︙ | |||
1021 1022 1023 1024 1025 1026 1027 | isDone = 1; } if (!isDone) { if (!Itcl_FindC(interp, body+1, &argCmdProc, &objCmdProc, &cdata)) { Tcl_AppendResult(interp, "no registered C procedure with name \"", | | | > | 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 | isDone = 1; } if (!isDone) { if (!Itcl_FindC(interp, body+1, &argCmdProc, &objCmdProc, &cdata)) { Tcl_AppendResult(interp, "no registered C procedure with name \"", body+1, "\"", NULL); Itcl_PreserveData(mcode); Itcl_ReleaseData(mcode); return TCL_ERROR; } /* * WARNING! WARNING! WARNING! * This is a pretty dangerous approach. What's done here is * to copy over the proc + clientData implementation that |
︙ | ︙ | |||
1076 1077 1078 1079 1080 1081 1082 | * * Creates the data record representing the implementation behind a * class member function. This includes the argument list and the body * of the function. If the body is of the form "@name", then it is * treated as a label for a C procedure registered by Itcl_RegisterC(). * * A member function definition holds a handle for the implementation, and | | | 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 | * * Creates the data record representing the implementation behind a * class member function. This includes the argument list and the body * of the function. If the body is of the form "@name", then it is * treated as a label for a C procedure registered by Itcl_RegisterC(). * * A member function definition holds a handle for the implementation, and * uses Itcl_PreserveData and Itcl_ReleaseData to manage its interest in it. * * If any errors are encountered, this procedure returns TCL_ERROR * along with an error message in the interpreter. Otherwise, it * returns TCL_OK, and stores a pointer to the new implementation in * "mcodePtr". * ------------------------------------------------------------------------ */ |
︙ | ︙ | |||
1105 1106 1107 1108 1109 1110 1111 | * Itcl_DeleteMemberCode() * * Destroys all data associated with the given command implementation. * Invoked automatically by ItclReleaseData() when the implementation * is no longer being used. * ------------------------------------------------------------------------ */ | | | | | | 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 | * Itcl_DeleteMemberCode() * * Destroys all data associated with the given command implementation. * Invoked automatically by ItclReleaseData() when the implementation * is no longer being used. * ------------------------------------------------------------------------ */ void FreeMemberCode ( ItclMemberCode* mCodePtr) { if (mCodePtr == NULL) { return; } if (mCodePtr->argListPtr != NULL) { ItclDeleteArgList(mCodePtr->argListPtr); } if (mCodePtr->usagePtr != NULL) { Tcl_DecrRefCount(mCodePtr->usagePtr); } if (mCodePtr->argumentPtr != NULL) { Tcl_DecrRefCount(mCodePtr->argumentPtr); } if (mCodePtr->bodyPtr != NULL) { Tcl_DecrRefCount(mCodePtr->bodyPtr); } Itcl_Free(mCodePtr); } void Itcl_DeleteMemberCode( void* cdata) /* pointer to member code definition */ { Itcl_ReleaseData((ItclMemberCode *)cdata); } /* * ------------------------------------------------------------------------ * Itcl_GetMemberCode() * |
︙ | ︙ | |||
1199 1200 1201 1202 1203 1204 1205 | mcode = imPtr->codePtr; assert(mcode != NULL); if (!Itcl_IsMemberCodeImplemented(mcode)) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "member function \"", Tcl_GetString(imPtr->fullNamePtr), "\" is not defined and cannot be autoloaded", | | | | | | 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 | mcode = imPtr->codePtr; assert(mcode != NULL); if (!Itcl_IsMemberCodeImplemented(mcode)) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "member function \"", Tcl_GetString(imPtr->fullNamePtr), "\" is not defined and cannot be autoloaded", NULL); return TCL_ERROR; } return TCL_OK; } static int CallItclObjectCmd( ClientData data[], Tcl_Interp *interp, int result) { Tcl_Object oPtr; ItclMemberFunc *imPtr = (ItclMemberFunc *)data[0]; ItclObject *ioPtr = (ItclObject *)data[1]; int objc = PTR2INT(data[2]); Tcl_Obj **objv = (Tcl_Obj **)data[3]; ItclShowArgs(1, "CallItclObjectCmd", objc, objv); if (ioPtr != NULL) { ioPtr->hadConstructorError = 0; } if (imPtr->flags & (ITCL_CONSTRUCTOR|ITCL_DESTRUCTOR)) { oPtr = ioPtr->oPtr; |
︙ | ︙ | |||
1286 1287 1288 1289 1290 1291 1292 | } mcode = imPtr->codePtr; /* * Bump the reference count on this code, in case it is * redefined or deleted during execution. */ | | | | | 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 | } mcode = imPtr->codePtr; /* * Bump the reference count on this code, in case it is * redefined or deleted during execution. */ Itcl_PreserveData(mcode); if ((imPtr->flags & ITCL_DESTRUCTOR) && (contextIoPtr != NULL)) { contextIoPtr->destructorHasBeenCalled = 1; } /* * Execute the code body... */ if (((mcode->flags & ITCL_IMPLEMENT_OBJCMD) != 0) || ((mcode->flags & ITCL_IMPLEMENT_ARGCMD) != 0)) { if ((mcode->flags & ITCL_IMPLEMENT_OBJCMD) != 0) { result = (*mcode->cfunc.objCmd)(mcode->clientData, interp, objc, objv); } else { if ((mcode->flags & ITCL_IMPLEMENT_ARGCMD) != 0) { char **argv; argv = (char**)ckalloc( (unsigned)(objc*sizeof(char*)) ); for (i=0; i < objc; i++) { argv[i] = Tcl_GetString(objv[i]); } result = (*mcode->cfunc.argCmd)(mcode->clientData, interp, objc, (const char **)argv); ckfree((char*)argv); } } } else { if ((mcode->flags & ITCL_IMPLEMENT_TCL) != 0) { callbackPtr = Itcl_GetCurrentCallbackPtr(interp); Tcl_NRAddCallback(interp, CallItclObjectCmd, imPtr, contextIoPtr, INT2PTR(objc), (void *)objv); result = Itcl_NRRunCallbacks(interp, callbackPtr); } } Itcl_ReleaseData(mcode); return result; } /* * ------------------------------------------------------------------------ * ItclEquivArgLists() * |
︙ | ︙ | |||
1462 1463 1464 1465 1466 1467 1468 | { Tcl_CallFrame *framePtr = Itcl_GetUplevelCallFrame(interp, 0); ItclObjectInfo *infoPtr = (ItclObjectInfo *)Tcl_GetAssocData(interp, ITCL_INTERP_DATA, NULL); Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&infoPtr->frameContext, (char *)framePtr); Itcl_Stack *stackPtr = (Itcl_Stack *) Tcl_GetHashValue(hPtr); | | | 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 | { Tcl_CallFrame *framePtr = Itcl_GetUplevelCallFrame(interp, 0); ItclObjectInfo *infoPtr = (ItclObjectInfo *)Tcl_GetAssocData(interp, ITCL_INTERP_DATA, NULL); Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&infoPtr->frameContext, (char *)framePtr); Itcl_Stack *stackPtr = (Itcl_Stack *) Tcl_GetHashValue(hPtr); ItclCallContext *contextPtr = (ItclCallContext *)Itcl_PopStack(stackPtr); if (Itcl_GetStackSize(stackPtr) > 0) { Tcl_Panic("frame context stack not empty!"); } Itcl_DeleteStack(stackPtr); ckfree((char *) stackPtr); Tcl_DeleteHashEntry(hPtr); |
︙ | ︙ | |||
1495 1496 1497 1498 1499 1500 1501 | ItclObjectInfo *infoPtr = (ItclObjectInfo *)Tcl_GetAssocData(interp, ITCL_INTERP_DATA, NULL); Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&infoPtr->frameContext, (char *)framePtr); if (hPtr) { /* Frame maps to a context stack. */ Itcl_Stack *stackPtr = (Itcl_Stack *)Tcl_GetHashValue(hPtr); | | | 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 | ItclObjectInfo *infoPtr = (ItclObjectInfo *)Tcl_GetAssocData(interp, ITCL_INTERP_DATA, NULL); Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&infoPtr->frameContext, (char *)framePtr); if (hPtr) { /* Frame maps to a context stack. */ Itcl_Stack *stackPtr = (Itcl_Stack *)Tcl_GetHashValue(hPtr); ItclCallContext *contextPtr = (ItclCallContext *)Itcl_PeekStack(stackPtr); assert(contextPtr); if (contextPtr->objectFlags & ITCL_OBJECT_ROOT_METHOD) { ItclObject *ioPtr = contextPtr->ioPtr; *iclsPtrPtr = ioPtr->iclsPtr; |
︙ | ︙ | |||
1608 1609 1610 1611 1612 1613 1614 | Tcl_AppendToObj(objPtr, Tcl_GetString(imPtr->fullNamePtr), -1); } } else { if (contextIoPtr && contextIoPtr->accessCmd) { name = (char *) Tcl_GetCommandName( contextIoPtr->iclsPtr->interp, contextIoPtr->accessCmd); Tcl_AppendStringsToObj(objPtr, name, " ", | | | | 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 | Tcl_AppendToObj(objPtr, Tcl_GetString(imPtr->fullNamePtr), -1); } } else { if (contextIoPtr && contextIoPtr->accessCmd) { name = (char *) Tcl_GetCommandName( contextIoPtr->iclsPtr->interp, contextIoPtr->accessCmd); Tcl_AppendStringsToObj(objPtr, name, " ", Tcl_GetString(imPtr->namePtr), NULL); } else { Tcl_AppendStringsToObj(objPtr, "<object> ", Tcl_GetString(imPtr->namePtr), NULL); } } } else { Tcl_AppendToObj(objPtr, Tcl_GetString(imPtr->fullNamePtr), -1); } /* |
︙ | ︙ | |||
1689 1690 1691 1692 1693 1694 1695 | iclsPtr = imPtr->iclsPtr; if (Itcl_GetContext(interp, &iclsPtr, &ioPtr) != TCL_OK) { return TCL_ERROR; } if (ioPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "cannot access object-specific info without an object context", | | | 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 | iclsPtr = imPtr->iclsPtr; if (Itcl_GetContext(interp, &iclsPtr, &ioPtr) != TCL_OK) { return TCL_ERROR; } if (ioPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "cannot access object-specific info without an object context", NULL); return TCL_ERROR; } /* * Make sure that this command member can be accessed from * the current namespace context. * That is now done in ItclMapMethodNameProc !! |
︙ | ︙ | |||
1725 1726 1727 1728 1729 1730 1731 | } } /* * Execute the code for the method. Be careful to protect * the method in case it gets deleted during execution. */ | | | | 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 | } } /* * Execute the code for the method. Be careful to protect * the method in case it gets deleted during execution. */ Itcl_PreserveData(imPtr); result = Itcl_EvalMemberCode(interp, imPtr, ioPtr, objc, objv); Itcl_ReleaseData(imPtr); return result; } /* ARGSUSED */ int Itcl_ExecMethod( ClientData clientData, |
︙ | ︙ | |||
1778 1779 1780 1781 1782 1783 1784 | * the current namespace context. */ if (imPtr->protection != ITCL_PUBLIC) { if (!Itcl_CanAccessFunc(imPtr, Tcl_GetCurrentNamespace(interp))) { ItclMemberFunc *imPtr2 = NULL; Tcl_HashEntry *hPtr; Tcl_ObjectContext context; | | | | | | | | | | | | 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 | * the current namespace context. */ if (imPtr->protection != ITCL_PUBLIC) { if (!Itcl_CanAccessFunc(imPtr, Tcl_GetCurrentNamespace(interp))) { ItclMemberFunc *imPtr2 = NULL; Tcl_HashEntry *hPtr; Tcl_ObjectContext context; context = (Tcl_ObjectContext)Itcl_GetCallFrameClientData(interp); if (context == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "can't access \"", Tcl_GetString(imPtr->fullNamePtr), "\": ", Itcl_ProtectionStr(imPtr->protection), " function", NULL); return TCL_ERROR; } hPtr = Tcl_FindHashEntry(&imPtr->iclsPtr->infoPtr->procMethods, (char *)Tcl_ObjectContextMethod(context)); if (hPtr != NULL) { imPtr2 = (ItclMemberFunc *)Tcl_GetHashValue(hPtr); } if ((imPtr->protection & ITCL_PRIVATE) && (imPtr2 != NULL) && (imPtr->iclsPtr->nsPtr != imPtr2->iclsPtr->nsPtr)) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "invalid command name \"", Tcl_GetString(objv[0]), "\"", NULL); return TCL_ERROR; } Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "can't access \"", Tcl_GetString(imPtr->fullNamePtr), "\": ", Itcl_ProtectionStr(imPtr->protection), " function", NULL); return TCL_ERROR; } } /* * Execute the code for the proc. Be careful to protect * the proc in case it gets deleted during execution. */ Itcl_PreserveData(imPtr); result = Itcl_EvalMemberCode(interp, imPtr, NULL, objc, objv); Itcl_ReleaseData(imPtr); return result; } /* ARGSUSED */ int Itcl_ExecProc( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) { return Tcl_NRCallObjProc(interp, NRExecProc, clientData, objc, objv); } static int CallInvokeMethodIfExists( ClientData data[], Tcl_Interp *interp, int result) { ItclClass *iclsPtr = (ItclClass *)data[0]; ItclObject *contextObj = (ItclObject *)data[1]; int objc = PTR2INT(data[2]); Tcl_Obj *const *objv = (Tcl_Obj *const *)data[3]; result = Itcl_InvokeMethodIfExists(interp, "constructor", iclsPtr, contextObj, objc, (Tcl_Obj* const*)objv); if (result != TCL_OK) { return TCL_ERROR; } |
︙ | ︙ | |||
2000 2001 2002 2003 2004 2005 2006 | imPtr = (ItclMemberFunc*)Tcl_GetHashValue(hPtr); /* * Prepend the method name to the list of arguments. */ cmdlinePtr = Itcl_CreateArgs(interp, name, objc, objv); | | | | | 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 | imPtr = (ItclMemberFunc*)Tcl_GetHashValue(hPtr); /* * Prepend the method name to the list of arguments. */ cmdlinePtr = Itcl_CreateArgs(interp, name, objc, objv); (void) Tcl_ListObjGetElements(NULL, cmdlinePtr, &cmdlinec, &cmdlinev); ItclShowArgs(1, "EMC", cmdlinec, cmdlinev); /* * Execute the code for the method. Be careful to protect * the method in case it gets deleted during execution. */ Itcl_PreserveData(imPtr); if (contextObjectPtr->oPtr == NULL) { Tcl_DecrRefCount(cmdlinePtr); return TCL_ERROR; } result = Itcl_EvalMemberCode(interp, imPtr, contextObjectPtr, cmdlinec, cmdlinev); Itcl_ReleaseData(imPtr); Tcl_DecrRefCount(cmdlinePtr); } else { if (contextClassPtr->flags & (ITCL_ECLASS|ITCL_TYPE|ITCL_WIDGET|ITCL_WIDGETADAPTOR)) { if (strcmp(name, "constructor") == 0) { if (objc > 0) { if (contextClassPtr->numOptions == 0) { |
︙ | ︙ | |||
2127 2128 2129 2130 2131 2132 2133 | iclsPtr = resolveInfoPtr->iclsPtr; } infoPtr = iclsPtr->infoPtr; hPtr = Tcl_FindHashEntry(&infoPtr->namespaceClasses, (char *)nsPtr); if (hPtr == NULL) { return NULL; } | | | 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 | iclsPtr = resolveInfoPtr->iclsPtr; } infoPtr = iclsPtr->infoPtr; hPtr = Tcl_FindHashEntry(&infoPtr->namespaceClasses, (char *)nsPtr); if (hPtr == NULL) { return NULL; } iclsPtr = (ItclClass *)Tcl_GetHashValue(hPtr); objPtr = Tcl_NewStringObj(cmdName, -1); hPtr = Tcl_FindHashEntry(&iclsPtr->resolveCmds, (char *)objPtr); Tcl_DecrRefCount(objPtr); if (hPtr == NULL) { if (strcmp(cmdName, "@itcl-builtin-cget") == 0) { return Tcl_FindCommand(interp, "::itcl::builtin::cget", NULL, 0); } |
︙ | ︙ | |||
2244 2245 2246 2247 2248 2249 2250 | } else { ioPtr = NULL; iclsPtr = resolveInfoPtr->iclsPtr; } infoPtr = iclsPtr->infoPtr; hPtr = Tcl_FindHashEntry(&infoPtr->namespaceClasses, (char *)nsPtr); if (hPtr != NULL) { | | | | 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 | } else { ioPtr = NULL; iclsPtr = resolveInfoPtr->iclsPtr; } infoPtr = iclsPtr->infoPtr; hPtr = Tcl_FindHashEntry(&infoPtr->namespaceClasses, (char *)nsPtr); if (hPtr != NULL) { iclsPtr = (ItclClass *)Tcl_GetHashValue(hPtr); } hPtr = ItclResolveVarEntry(iclsPtr, varName); if (hPtr == NULL) { /* no class/object variable */ return NULL; } ivlPtr = (ItclVarLookup *)Tcl_GetHashValue(hPtr); if (ivlPtr == NULL) { return NULL; } if (!ivlPtr->accessible) { return NULL; } |
︙ | ︙ | |||
2276 2277 2278 2279 2280 2281 2282 | if (ioPtr != NULL) { hPtr = Tcl_FindHashEntry(&ioPtr->objectVariables, (char *)ivlPtr->ivPtr); } } } if (hPtr != NULL) { | | | 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 | if (ioPtr != NULL) { hPtr = Tcl_FindHashEntry(&ioPtr->objectVariables, (char *)ivlPtr->ivPtr); } } } if (hPtr != NULL) { varPtr = (Tcl_Var)Tcl_GetHashValue(hPtr); } return varPtr; } /* * ------------------------------------------------------------------------ * ItclCheckCallProc() |
︙ | ︙ | |||
2346 2347 2348 2349 2350 2351 2352 | int min_allowed_args; ItclObjectInfo *infoPtr; oPtr = NULL; hPtr = NULL; imPtr = (ItclMemberFunc *)clientData; | | | 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 | int min_allowed_args; ItclObjectInfo *infoPtr; oPtr = NULL; hPtr = NULL; imPtr = (ItclMemberFunc *)clientData; Itcl_PreserveData(imPtr); if (imPtr->flags & ITCL_CONSTRUCTOR) { ioPtr = imPtr->iclsPtr->infoPtr->currIoPtr; } else { if (contextPtr == NULL) { if ((imPtr->flags & ITCL_COMMON) || (imPtr->codePtr->flags & ITCL_BUILTIN)) { if (!imPtr->iclsPtr->infoPtr->useOldResolvers) { |
︙ | ︙ | |||
2369 2370 2371 2372 2373 2374 2375 | Tcl_AppendResult(interp, "ItclCheckCallMethod cannot get context object (NULL)", " for ", Tcl_GetString(imPtr->fullNamePtr), NULL); result = TCL_ERROR; goto finishReturn; } | | | | 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 | Tcl_AppendResult(interp, "ItclCheckCallMethod cannot get context object (NULL)", " for ", Tcl_GetString(imPtr->fullNamePtr), NULL); result = TCL_ERROR; goto finishReturn; } oPtr = Tcl_ObjectContextObject(contextPtr); ioPtr = (ItclObject *)Tcl_ObjectGetMetadata(oPtr, imPtr->iclsPtr->infoPtr->object_meta_type); } if ((imPtr->codePtr != NULL) && (imPtr->codePtr->flags & ITCL_IMPLEMENT_NONE)) { Tcl_AppendResult(interp, "member function \"", Tcl_GetString(imPtr->fullNamePtr), "\" is not defined and cannot be autoloaded", NULL); |
︙ | ︙ | |||
2414 2415 2416 2417 2418 2419 2420 | } isNew = 0; callContextPtr = NULL; currNsPtr = Tcl_GetCurrentNamespace(interp); if (ioPtr != NULL) { hPtr = Tcl_CreateHashEntry(&ioPtr->contextCache, (char *)imPtr, &isNew); if (!isNew) { | | | 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 | } isNew = 0; callContextPtr = NULL; currNsPtr = Tcl_GetCurrentNamespace(interp); if (ioPtr != NULL) { hPtr = Tcl_CreateHashEntry(&ioPtr->contextCache, (char *)imPtr, &isNew); if (!isNew) { callContextPtr2 = (ItclCallContext *)Tcl_GetHashValue(hPtr); if (callContextPtr2->refCount == 0) { callContextPtr = callContextPtr2; callContextPtr->objectFlags = ioPtr->flags; callContextPtr->nsPtr = Tcl_GetCurrentNamespace(interp); callContextPtr->ioPtr = ioPtr; callContextPtr->imPtr = imPtr; callContextPtr->refCount = 1; |
︙ | ︙ | |||
2483 2484 2485 2486 2487 2488 2489 | stackPtr = (Itcl_Stack *)Tcl_GetHashValue(hPtr); } Itcl_PushStack(framePtr, stackPtr); if (ioPtr != NULL) { ioPtr->callRefCount++; | | | | 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 | stackPtr = (Itcl_Stack *)Tcl_GetHashValue(hPtr); } Itcl_PushStack(framePtr, stackPtr); if (ioPtr != NULL) { ioPtr->callRefCount++; Itcl_PreserveData(ioPtr); } imPtr->iclsPtr->callRefCount++; if (!imPtr->iclsPtr->infoPtr->useOldResolvers) { Itcl_SetCallFrameResolver(interp, ioPtr->resolvePtr); } result = TCL_OK; if (isFinished != NULL) { *isFinished = 0; } return result; finishReturn: Itcl_ReleaseData(imPtr); return result; } /* * ------------------------------------------------------------------------ * ItclAfterCallMethod() * |
︙ | ︙ | |||
2532 2533 2534 2535 2536 2537 2538 | ItclObjectInfo *infoPtr = imPtr->infoPtr; Tcl_CallFrame *framePtr; Itcl_Stack *stackPtr; hPtr = Tcl_FindHashEntry(&infoPtr->frameContext, (char *)contextPtr); assert(hPtr); stackPtr = (Itcl_Stack *)Tcl_GetHashValue(hPtr); | | | | 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 | ItclObjectInfo *infoPtr = imPtr->infoPtr; Tcl_CallFrame *framePtr; Itcl_Stack *stackPtr; hPtr = Tcl_FindHashEntry(&infoPtr->frameContext, (char *)contextPtr); assert(hPtr); stackPtr = (Itcl_Stack *)Tcl_GetHashValue(hPtr); framePtr = (Tcl_CallFrame *)Itcl_PopStack(stackPtr); if (Itcl_GetStackSize(stackPtr) == 0) { Itcl_DeleteStack(stackPtr); ckfree((char *) stackPtr); Tcl_DeleteHashEntry(hPtr); } hPtr = Tcl_FindHashEntry(&infoPtr->frameContext, (char *)framePtr); assert(hPtr); stackPtr = (Itcl_Stack *)Tcl_GetHashValue(hPtr); callContextPtr = (ItclCallContext *)Itcl_PopStack(stackPtr); if (Itcl_GetStackSize(stackPtr) == 0) { Itcl_DeleteStack(stackPtr); ckfree((char *) stackPtr); Tcl_DeleteHashEntry(hPtr); } } if (callContextPtr == NULL) { |
︙ | ︙ | |||
2597 2598 2599 2600 2601 2602 2603 | if (callContextPtr->refCount-- <= 1) { if (callContextPtr->ioPtr != NULL) { hPtr = Tcl_FindHashEntry(&callContextPtr->ioPtr->contextCache, (char *)callContextPtr->imPtr); if (hPtr == NULL) { ckfree((char *)callContextPtr); } | | | | 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 | if (callContextPtr->refCount-- <= 1) { if (callContextPtr->ioPtr != NULL) { hPtr = Tcl_FindHashEntry(&callContextPtr->ioPtr->contextCache, (char *)callContextPtr->imPtr); if (hPtr == NULL) { ckfree((char *)callContextPtr); } Itcl_ReleaseData(ioPtr); } else { ckfree((char *)callContextPtr); } } result = call_result; finishReturn: Itcl_ReleaseData(imPtr); return result; } void ItclProcErrorProc( Tcl_Interp *interp, Tcl_Obj *procNameObj) |
︙ | ︙ | |||
2637 2638 2639 2640 2641 2642 2643 | if (hPtr == NULL) { /* Can this happen? */ return; } /* Frame maps to a context stack. */ stackPtr = (Itcl_Stack *)Tcl_GetHashValue(hPtr); | | | 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 | if (hPtr == NULL) { /* Can this happen? */ return; } /* Frame maps to a context stack. */ stackPtr = (Itcl_Stack *)Tcl_GetHashValue(hPtr); callContextPtr = (ItclCallContext *)Itcl_PeekStack(stackPtr); if (callContextPtr == NULL) { return; } currIclsPtr = NULL; objPtr = NULL; |
︙ | ︙ |
Changes to generic/itclMigrate2TclCore.c.
︙ | ︙ | |||
229 230 231 232 233 234 235 | */ if (procPtr) { CompiledLocal *localPtr = procPtr->firstLocalPtr; int nameLen = strlen(name); for (;localPtr != NULL; localPtr = localPtr->nextPtr) { if (TclIsVarArgument(localPtr)) { | | | 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | */ if (procPtr) { CompiledLocal *localPtr = procPtr->firstLocalPtr; int nameLen = strlen(name); for (;localPtr != NULL; localPtr = localPtr->nextPtr) { if (TclIsVarArgument(localPtr)) { char *localName = localPtr->name; if ((name[0] == localName[0]) && (nameLen == localPtr->nameLength) && (strcmp(name, localName) == 0)) { return 1; } } } |
︙ | ︙ |
Changes to generic/itclObject.c.
︙ | ︙ | |||
49 50 51 52 53 54 55 | const char *name1, const char *name2, int flags); static char* ItclTraceComponentVar(ClientData cdata, Tcl_Interp *interp, const char *name1, const char *name2, int flags); static char* ItclTraceItclHullVar(ClientData cdata, Tcl_Interp *interp, const char *name1, const char *name2, int flags); static void ItclDestroyObject(ClientData clientData); | | < < < < < < < < < < < < < < < < < < | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | const char *name1, const char *name2, int flags); static char* ItclTraceComponentVar(ClientData cdata, Tcl_Interp *interp, const char *name1, const char *name2, int flags); static char* ItclTraceItclHullVar(ClientData cdata, Tcl_Interp *interp, const char *name1, const char *name2, int flags); static void ItclDestroyObject(ClientData clientData); static Tcl_FreeProc FreeObject; static int ItclDestructBase(Tcl_Interp *interp, ItclObject *contextObj, ItclClass *contextClass, int flags); static int ItclInitObjectVariables(Tcl_Interp *interp, ItclObject *ioPtr, ItclClass *iclsPtr); static int ItclInitObjectCommands(Tcl_Interp *interp, ItclObject *ioPtr, ItclClass *iclsPtr, const char *name); static int ItclInitExtendedClassOptions(Tcl_Interp *interp, ItclObject *ioPtr); static int ItclInitObjectOptions(Tcl_Interp *interp, ItclObject *ioPtr, ItclClass *iclsPtr); static const char * GetConstructorVar(Tcl_Interp *interp, ItclClass *iclsPtr, const char *varName); static ItclClass * GetClassFromClassName(Tcl_Interp *interp, const char *className, ItclClass *iclsPtr); /* * ------------------------------------------------------------------------ * ItclDeleteObjectMetadata() * * Delete the metadata data if any *------------------------------------------------------------------------- |
︙ | ︙ | |||
128 129 130 131 132 133 134 | ObjectRenamedTrace( ClientData clientData, /* The object being deleted. */ Tcl_Interp *interp, /* The interpreter containing the object. */ const char *oldName, /* What the object was (last) called. */ const char *newName, /* Always NULL ??. not for itk!! */ int flags) /* Why was the object deleted? */ { | | | 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | ObjectRenamedTrace( ClientData clientData, /* The object being deleted. */ Tcl_Interp *interp, /* The interpreter containing the object. */ const char *oldName, /* What the object was (last) called. */ const char *newName, /* Always NULL ??. not for itk!! */ int flags) /* Why was the object deleted? */ { ItclObject *ioPtr = (ItclObject *)clientData; Itcl_InterpState istate; if (newName != NULL) { /* FIXME should enter the new name in the hashtables for objects etc. */ return; } if (ioPtr->flags & ITCL_OBJECT_CLASS_DESTRUCTED) { |
︙ | ︙ | |||
261 262 263 264 265 266 267 | if (infoPtr != NULL) { infoPtr->lastIoPtr = NULL; } /* * Create a new object and initialize it. */ | | | | | | 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | if (infoPtr != NULL) { infoPtr->lastIoPtr = NULL; } /* * Create a new object and initialize it. */ ioPtr = (ItclObject*)Itcl_Alloc(sizeof(ItclObject)); Itcl_EventuallyFree(ioPtr, FreeObject); ioPtr->iclsPtr = iclsPtr; ioPtr->interp = interp; ioPtr->infoPtr = infoPtr; ItclPreserveClass(iclsPtr); ioPtr->constructed = (Tcl_HashTable*)ckalloc(sizeof(Tcl_HashTable)); Tcl_InitObjHashTable(ioPtr->constructed); ioPtr->oPtr = Tcl_NewObjectInstance(interp, iclsPtr->clsPtr, NULL, /* nsName */ NULL, /* objc */ -1, /* objv */ NULL, /* skip */ 0); if (ioPtr->oPtr == NULL) { Itcl_Free(ioPtr); return TCL_ERROR; } /* * Add a command to the current namespace with the object name. * This is done before invoking the constructors so that the * command can be used during construction to query info. */ Itcl_PreserveData(ioPtr); ioPtr->namePtr = Tcl_NewStringObj(name, -1); Tcl_IncrRefCount(ioPtr->namePtr); nsName = Tcl_GetCurrentNamespace(interp)->fullName; ioPtr->origNamePtr = Tcl_NewStringObj("", -1); if ((name[0] != ':') && (name[1] != ':')) { Tcl_AppendToObj(ioPtr->origNamePtr, nsName, -1); |
︙ | ︙ | |||
313 314 315 316 317 318 319 | Tcl_InitObjHashTable(&ioPtr->objectOptions); Tcl_InitObjHashTable(&ioPtr->objectComponents); Tcl_InitObjHashTable(&ioPtr->objectDelegatedOptions); Tcl_InitObjHashTable(&ioPtr->objectDelegatedFunctions); Tcl_InitObjHashTable(&ioPtr->objectMethodVariables); Tcl_InitHashTable(&ioPtr->contextCache, TCL_ONE_WORD_KEYS); | | | 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | Tcl_InitObjHashTable(&ioPtr->objectOptions); Tcl_InitObjHashTable(&ioPtr->objectComponents); Tcl_InitObjHashTable(&ioPtr->objectDelegatedOptions); Tcl_InitObjHashTable(&ioPtr->objectDelegatedFunctions); Tcl_InitObjHashTable(&ioPtr->objectMethodVariables); Tcl_InitHashTable(&ioPtr->contextCache, TCL_ONE_WORD_KEYS); Itcl_PreserveData(ioPtr); /* * Install the class namespace and object context so that * the object's data members can be initialized via simple * "set" commands. */ |
︙ | ︙ | |||
450 451 452 453 454 455 456 | TCL_TRACE_RENAME|TCL_TRACE_DELETE, ObjectRenamedTrace, ioPtr); Tcl_DecrRefCount(tmp); } Tcl_ObjectSetMethodNameMapper(ioPtr->oPtr, ItclMapMethodNameProc); ioPtr->accessCmd = Tcl_GetObjectCommand(ioPtr->oPtr); Tcl_GetCommandInfoFromToken(ioPtr->accessCmd, &cmdInfo); | | | | | | 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 | TCL_TRACE_RENAME|TCL_TRACE_DELETE, ObjectRenamedTrace, ioPtr); Tcl_DecrRefCount(tmp); } Tcl_ObjectSetMethodNameMapper(ioPtr->oPtr, ItclMapMethodNameProc); ioPtr->accessCmd = Tcl_GetObjectCommand(ioPtr->oPtr); Tcl_GetCommandInfoFromToken(ioPtr->accessCmd, &cmdInfo); cmdInfo.deleteProc = ItclDestroyObject; cmdInfo.deleteData = ioPtr; Tcl_SetCommandInfoFromToken(ioPtr->accessCmd, &cmdInfo); ioPtr->resolvePtr = (Tcl_Resolve *)ckalloc(sizeof(Tcl_Resolve)); ioPtr->resolvePtr->cmdProcPtr = Itcl_CmdAliasProc; ioPtr->resolvePtr->varProcPtr = Itcl_VarAliasProc; resolveInfoPtr = (ItclResolveInfo *)ckalloc(sizeof(ItclResolveInfo)); memset (resolveInfoPtr, 0, sizeof(ItclResolveInfo)); resolveInfoPtr->flags = ITCL_RESOLVE_OBJECT; resolveInfoPtr->ioPtr = ioPtr; ioPtr->resolvePtr->clientData = resolveInfoPtr; Tcl_ObjectSetMetadata(ioPtr->oPtr, iclsPtr->infoPtr->object_meta_type, ioPtr); /* make the object known, if it is used in the constructor already! */ hPtr = Tcl_CreateHashEntry(&iclsPtr->infoPtr->objectCmds, (char*)ioPtr->accessCmd, &newEntry); Tcl_SetHashValue(hPtr, ioPtr); hPtr = Tcl_CreateHashEntry(&iclsPtr->infoPtr->objects, (char*)ioPtr, &newEntry); Tcl_SetHashValue(hPtr, ioPtr); /* Use the TclOO object namespaces as a unique key in case the * object is renamed. Used by mytypemethod, etc. */ hPtr = Tcl_CreateHashEntry(&iclsPtr->infoPtr->instances, (Tcl_GetObjectNamespace(ioPtr->oPtr))->fullName, &newEntry); Tcl_SetHashValue(hPtr, ioPtr); /* * Now construct the object. Look for a constructor in the * most-specific class, and if there is one, invoke it. * This will cause a chain reaction, making sure that all * base classes constructors are invoked as well, in order * from least- to most-specific. Any constructors that are |
︙ | ︙ | |||
508 509 510 511 512 513 514 | if (ioPtr->accessCmd != (Tcl_Command) NULL) { Tcl_DeleteCommandFromToken(interp, ioPtr->accessCmd); ioPtr->accessCmd = NULL; } result = Itcl_RestoreInterpState(interp, istate); infoPtr->currIoPtr = saveCurrIoPtr; /* need this for 2 ReleaseData at errorReturn!! */ | | | 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 | if (ioPtr->accessCmd != (Tcl_Command) NULL) { Tcl_DeleteCommandFromToken(interp, ioPtr->accessCmd); ioPtr->accessCmd = NULL; } result = Itcl_RestoreInterpState(interp, istate); infoPtr->currIoPtr = saveCurrIoPtr; /* need this for 2 ReleaseData at errorReturn!! */ Itcl_PreserveData(ioPtr); goto errorReturn; } else { /* a constructor cannot return a result as the object name * is returned as result */ Tcl_ResetResult(interp); } |
︙ | ︙ | |||
557 558 559 560 561 562 563 | */ if (ioPtr->accessCmd != (Tcl_Command) NULL) { Tcl_DeleteCommandFromToken(interp, ioPtr->accessCmd); ioPtr->accessCmd = NULL; } result = Itcl_RestoreInterpState(interp, istate); /* need this for 2 ReleaseData at errorReturn!! */ | | | 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 | */ if (ioPtr->accessCmd != (Tcl_Command) NULL) { Tcl_DeleteCommandFromToken(interp, ioPtr->accessCmd); ioPtr->accessCmd = NULL; } result = Itcl_RestoreInterpState(interp, istate); /* need this for 2 ReleaseData at errorReturn!! */ Itcl_PreserveData(ioPtr); goto errorReturn; } if (iclsPtr->flags & ITCL_WIDGETADAPTOR) { if (saveNsNamePtr) { Tcl_SetVar2Ex(interp, "::itcl::internal::varNsName", name, |
︙ | ︙ | |||
609 610 611 612 613 614 615 | istate = Itcl_SaveInterpState(interp, result); if (ioPtr->accessCmd != (Tcl_Command) NULL) { Tcl_DeleteCommandFromToken(interp, ioPtr->accessCmd); ioPtr->accessCmd = NULL; } result = Itcl_RestoreInterpState(interp, istate); /* need this for 2 ReleaseData at errorReturn!! */ | | | 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 | istate = Itcl_SaveInterpState(interp, result); if (ioPtr->accessCmd != (Tcl_Command) NULL) { Tcl_DeleteCommandFromToken(interp, ioPtr->accessCmd); ioPtr->accessCmd = NULL; } result = Itcl_RestoreInterpState(interp, istate); /* need this for 2 ReleaseData at errorReturn!! */ Itcl_PreserveData(ioPtr); goto errorReturn; } } /* * Add it to the list of all known objects. The only * tricky thing to watch out for is the case where the |
︙ | ︙ | |||
633 634 635 636 637 638 639 | result = DelegationInstall(interp, ioPtr, iclsPtr); if (result != TCL_OK) { goto errorReturn; } } hPtr = Tcl_CreateHashEntry(&iclsPtr->infoPtr->objectCmds, (char*)ioPtr->accessCmd, &newEntry); | | | | | 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 | result = DelegationInstall(interp, ioPtr, iclsPtr); if (result != TCL_OK) { goto errorReturn; } } hPtr = Tcl_CreateHashEntry(&iclsPtr->infoPtr->objectCmds, (char*)ioPtr->accessCmd, &newEntry); Tcl_SetHashValue(hPtr, ioPtr); hPtr = Tcl_CreateHashEntry(&iclsPtr->infoPtr->objects, (char*)ioPtr, &newEntry); Tcl_SetHashValue(hPtr, ioPtr); /* * This is an inelegant hack, left behind until the need for it * can be eliminated by getting the inheritance tree right. */ if (iclsPtr->flags & (ITCL_ECLASS|ITCL_TYPE|ITCL_WIDGET|ITCL_WIDGETADAPTOR)) { Tcl_NewInstanceMethod(interp, ioPtr->oPtr, Tcl_NewStringObj("unknown", -1), 0, &itclRootMethodType, (void *)ItclUnknownGuts); } if (iclsPtr->flags & (ITCL_TYPE|ITCL_WIDGETADAPTOR)) { Tcl_Obj *objPtr = Tcl_NewObj(); Tcl_GetCommandFullName(interp, ioPtr->accessCmd, objPtr); if (iclsPtr->flags & ITCL_WIDGETADAPTOR) { /* skip over the leading :: */ |
︙ | ︙ | |||
701 702 703 704 705 706 707 | infoPtr->currIoPtr = saveCurrIoPtr; } infoPtr->lastIoPtr = ioPtr; Tcl_DeleteHashTable(ioPtr->constructed); ckfree((char*)ioPtr->constructed); ioPtr->constructed = NULL; ItclAddObjectsDictInfo(interp, ioPtr); | | | 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 | infoPtr->currIoPtr = saveCurrIoPtr; } infoPtr->lastIoPtr = ioPtr; Tcl_DeleteHashTable(ioPtr->constructed); ckfree((char*)ioPtr->constructed); ioPtr->constructed = NULL; ItclAddObjectsDictInfo(interp, ioPtr); Itcl_ReleaseData(ioPtr); return result; errorReturn: /* * At this point, the object is not constructed as there was an error. * Destroy the "constructed" table in the object data, since * it is no longer needed. |
︙ | ︙ | |||
726 727 728 729 730 731 732 | } if (ioPtr->constructed != NULL) { Tcl_DeleteHashTable(ioPtr->constructed); ckfree((char*)ioPtr->constructed); ioPtr->constructed = NULL; } ItclDeleteObjectVariablesNamespace(interp, ioPtr); | | | | 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 | } if (ioPtr->constructed != NULL) { Tcl_DeleteHashTable(ioPtr->constructed); ckfree((char*)ioPtr->constructed); ioPtr->constructed = NULL; } ItclDeleteObjectVariablesNamespace(interp, ioPtr); Itcl_ReleaseData(ioPtr); Itcl_ReleaseData(ioPtr); return result; } /* * ------------------------------------------------------------------------ * ItclInitObjectCommands() * |
︙ | ︙ | |||
838 839 840 841 842 843 844 | if (Itcl_PushCallFrame(interp, &frame, varNsPtr2, /*isProcCallFrame*/0) != TCL_OK) { goto errorCleanup2; } Tcl_TraceVar2(interp, "itcl_options", NULL, TCL_TRACE_READS|TCL_TRACE_WRITES, | | | | 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 | if (Itcl_PushCallFrame(interp, &frame, varNsPtr2, /*isProcCallFrame*/0) != TCL_OK) { goto errorCleanup2; } Tcl_TraceVar2(interp, "itcl_options", NULL, TCL_TRACE_READS|TCL_TRACE_WRITES, ItclTraceOptionVar, ioPtr); Itcl_PopCallFrame(interp); if (Itcl_PushCallFrame(interp, &frame, varNsPtr, /*isProcCallFrame*/0) != TCL_OK) { goto errorCleanup2; } hPtr = Tcl_NextHashEntry(&place); continue; } if (ivPtr->flags & ITCL_COMPONENT_VAR) { hPtr2 = Tcl_FindHashEntry(&ivPtr->iclsPtr->components, (char *)ivPtr->namePtr); if (hPtr2 == NULL) { Tcl_AppendResult(interp, "cannot find component \"", Tcl_GetString(ivPtr->namePtr), "\" in class \"", Tcl_GetString(ivPtr->iclsPtr->namePtr), NULL); goto errorCleanup; } icPtr = (ItclComponent *)Tcl_GetHashValue(hPtr2); if (icPtr->flags & ITCL_COMPONENT_INHERIT) { if (inheritComponentName != NULL) { Tcl_AppendResult(interp, "object \"", Tcl_GetString(ioPtr->namePtr), "\" can only have one component with inherit.", " Had already component \"", inheritComponentName, |
︙ | ︙ | |||
914 915 916 917 918 919 920 | " variable \"", varNsPtr->fullName, "::", varName, "\"\n", NULL); goto errorCleanup; } if (ivPtr->flags & ITCL_THIS_VAR) { Tcl_TraceVar2(interp, varName, NULL, TCL_TRACE_READS|TCL_TRACE_WRITES, ItclTraceThisVar, | | | | | | | | 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 | " variable \"", varNsPtr->fullName, "::", varName, "\"\n", NULL); goto errorCleanup; } if (ivPtr->flags & ITCL_THIS_VAR) { Tcl_TraceVar2(interp, varName, NULL, TCL_TRACE_READS|TCL_TRACE_WRITES, ItclTraceThisVar, ioPtr); isDone = 1; } if (!isDone && ivPtr->flags & ITCL_TYPE_VAR) { Tcl_TraceVar2(interp, varName, NULL, TCL_TRACE_READS|TCL_TRACE_WRITES, ItclTraceTypeVar, ioPtr); isDone = 1; } if (!isDone && ivPtr->flags & ITCL_SELF_VAR) { Tcl_TraceVar2(interp, varName, NULL, TCL_TRACE_READS|TCL_TRACE_WRITES, ItclTraceSelfVar, ioPtr); isDone = 1; } if (!isDone && ivPtr->flags & ITCL_SELFNS_VAR) { Tcl_TraceVar2(interp, varName, NULL, TCL_TRACE_READS|TCL_TRACE_WRITES, ItclTraceSelfnsVar, ioPtr); isDone = 1; } if (!isDone && ivPtr->flags & ITCL_WIN_VAR) { Tcl_TraceVar2(interp, varName, NULL, TCL_TRACE_READS|TCL_TRACE_WRITES, ItclTraceWinVar, ioPtr); isDone = 1; } } else { if (ivPtr->flags & ITCL_HULL_VAR) { Tcl_TraceVar2(interp, varName, NULL, TCL_TRACE_READS|TCL_TRACE_WRITES, ItclTraceItclHullVar, ioPtr); } else { if (ivPtr->init != NULL) { if (Tcl_SetVar2(interp, Tcl_GetString(ivPtr->namePtr), NULL, Tcl_GetString(ivPtr->init), TCL_NAMESPACE_ONLY) == NULL) { goto errorCleanup; |
︙ | ︙ | |||
979 980 981 982 983 984 985 | val = Tcl_SetVar2(interp, Tcl_DStringValue(&buffer3), argv[i], argv[i + 1], TCL_NAMESPACE_ONLY); if (!val) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "cannot initialize variable \"", Tcl_GetString(ivPtr->namePtr), "\"", | | | | | | | | 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 | val = Tcl_SetVar2(interp, Tcl_DStringValue(&buffer3), argv[i], argv[i + 1], TCL_NAMESPACE_ONLY); if (!val) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "cannot initialize variable \"", Tcl_GetString(ivPtr->namePtr), "\"", NULL); return TCL_ERROR; } i++; } Tcl_DStringFree(&buffer3); ckfree((char *)argv); } } } } else { if (ivPtr->flags & ITCL_HULL_VAR) { Tcl_TraceVar2(interp, varName, NULL, TCL_TRACE_READS|TCL_TRACE_WRITES, ItclTraceItclHullVar, ioPtr); } hPtr2 = Tcl_FindHashEntry(&iclsPtr2->classCommons, (char *)ivPtr); if (hPtr2 == NULL) { goto errorCleanup; } varPtr = (Tcl_Var)Tcl_GetHashValue(hPtr2); hPtr2 = Tcl_CreateHashEntry(&ioPtr->objectVariables, (char *)ivPtr, &isNew); if (isNew) { Itcl_PreserveVar(varPtr); Tcl_SetHashValue(hPtr2, varPtr); } if (ivPtr->flags & ITCL_COMPONENT_VAR) { if (ivPtr->flags & ITCL_COMMON) { Tcl_Obj *objPtr2; objPtr2 = Tcl_NewStringObj(ITCL_VARIABLES_NAMESPACE, -1); Tcl_AppendToObj(objPtr2, (Tcl_GetObjectNamespace( ivPtr->iclsPtr->oPtr))->fullName, -1); Tcl_AppendToObj(objPtr2, "::", -1); Tcl_AppendToObj(objPtr2, varName, -1); /* itcl_hull is traced in itclParse.c */ if (strcmp(varName, "itcl_hull") == 0) { Tcl_TraceVar2(interp, Tcl_GetString(objPtr2), NULL, TCL_TRACE_WRITES, ItclTraceItclHullVar, ioPtr); } else { Tcl_TraceVar2(interp, Tcl_GetString(objPtr2), NULL, TCL_TRACE_WRITES, ItclTraceComponentVar, ioPtr); } Tcl_DecrRefCount(objPtr2); } else { Tcl_TraceVar2(interp, varName, NULL, TCL_TRACE_WRITES, ItclTraceComponentVar, ioPtr); } } } hPtr = Tcl_NextHashEntry(&place); } Itcl_PopCallFrame(interp); iclsPtr2 = Itcl_AdvanceHierIter(&hier); |
︙ | ︙ | |||
1129 1130 1131 1132 1133 1134 1135 | TCL_NAMESPACE_ONLY) == NULL) { Itcl_PopCallFrame(interp); return TCL_ERROR; } Tcl_TraceVar2(interp, "itcl_options", NULL, TCL_TRACE_READS|TCL_TRACE_WRITES, | | | 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 | TCL_NAMESPACE_ONLY) == NULL) { Itcl_PopCallFrame(interp); return TCL_ERROR; } Tcl_TraceVar2(interp, "itcl_options", NULL, TCL_TRACE_READS|TCL_TRACE_WRITES, ItclTraceOptionVar, ioPtr); } Itcl_PopCallFrame(interp); } hPtr = Tcl_NextHashEntry(&place); } /* now check for options which are delegated */ hPtr = Tcl_FirstHashEntry(&iclsPtr2->delegatedOptions, &place); |
︙ | ︙ | |||
1221 1222 1223 1224 1225 1226 1227 | Tcl_CmdInfo cmdInfo; Tcl_HashEntry *hPtr; Tcl_GetCommandInfoFromToken(contextIoPtr->accessCmd, &cmdInfo); contextIoPtr->flags |= ITCL_OBJECT_IS_DELETED; | | | | 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 | Tcl_CmdInfo cmdInfo; Tcl_HashEntry *hPtr; Tcl_GetCommandInfoFromToken(contextIoPtr->accessCmd, &cmdInfo); contextIoPtr->flags |= ITCL_OBJECT_IS_DELETED; Itcl_PreserveData(contextIoPtr); /* * Invoke the object's destructors. */ if (Itcl_DestructObject(interp, contextIoPtr, 0) != TCL_OK) { Itcl_ReleaseData(contextIoPtr); contextIoPtr->flags |= ITCL_TCLOO_OBJECT_IS_DELETED|ITCL_OBJECT_DESTRUCT_ERROR; return TCL_ERROR; } /* * Remove the object from the global list. */ |
︙ | ︙ | |||
1251 1252 1253 1254 1255 1256 1257 | * safely deleted without attempting to destruct the object * again. Then delete the access command. If this is * the last use of the object data, the object will die here. */ if ((contextIoPtr->accessCmd != NULL) && (!(contextIoPtr->flags & (ITCL_OBJECT_IS_RENAMED)))) { if (Tcl_GetCommandInfoFromToken(contextIoPtr->accessCmd, &cmdInfo) == 1) { | | | | 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 | * safely deleted without attempting to destruct the object * again. Then delete the access command. If this is * the last use of the object data, the object will die here. */ if ((contextIoPtr->accessCmd != NULL) && (!(contextIoPtr->flags & (ITCL_OBJECT_IS_RENAMED)))) { if (Tcl_GetCommandInfoFromToken(contextIoPtr->accessCmd, &cmdInfo) == 1) { cmdInfo.deleteProc = (Tcl_CmdDeleteProc *)Itcl_ReleaseData; Tcl_SetCommandInfoFromToken(contextIoPtr->accessCmd, &cmdInfo); Tcl_DeleteCommandFromToken(interp, contextIoPtr->accessCmd); } } contextIoPtr->oPtr = NULL; contextIoPtr->accessCmd = NULL; Itcl_ReleaseData(contextIoPtr); return TCL_OK; } /* * ------------------------------------------------------------------------ * ItclDeleteObjectVariablesNamespace() |
︙ | ︙ | |||
1297 1298 1299 1300 1301 1302 1303 | static int FinalizeDeleteObject( ClientData data[], Tcl_Interp *interp, int result) { | | | | 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 | static int FinalizeDeleteObject( ClientData data[], Tcl_Interp *interp, int result) { ItclObject *contextIoPtr = (ItclObject *)data[0]; if (result == TCL_OK) { ItclDeleteObjectVariablesNamespace(interp, contextIoPtr); Tcl_ResetResult(interp); } Tcl_DeleteHashTable(contextIoPtr->destructed); ckfree((char*)contextIoPtr->destructed); contextIoPtr->destructed = NULL; return result; } static int CallDestructBase( ClientData data[], Tcl_Interp *interp, int result) { Tcl_Obj *objPtr; ItclObject *contextIoPtr = (ItclObject *)data[0]; int flags = PTR2INT(data[1]); if (result != TCL_OK) { return result; } result = ItclDestructBase(interp, contextIoPtr, contextIoPtr->iclsPtr, flags); |
︙ | ︙ | |||
1371 1372 1373 1374 1375 1376 1377 | * being destructed. Flag an error, unless errors are being * ignored. */ if (contextIoPtr->destructed) { if ((flags & ITCL_IGNORE_ERRS) == 0) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "can't delete an object while it is being destructed", | | | 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 | * being destructed. Flag an error, unless errors are being * ignored. */ if (contextIoPtr->destructed) { if ((flags & ITCL_IGNORE_ERRS) == 0) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "can't delete an object while it is being destructed", NULL); return TCL_ERROR; } return TCL_OK; } result = TCL_OK; if (contextIoPtr->oPtr != NULL) { |
︙ | ︙ | |||
1439 1440 1441 1442 1443 1444 1445 | /* * Look for a destructor in this class, and if found, * invoke it. */ if (Tcl_FindHashEntry(contextIoPtr->destructed, (char *)contextIclsPtr->namePtr) == NULL) { result = Itcl_InvokeMethodIfExists(interp, "destructor", | | | 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 | /* * Look for a destructor in this class, and if found, * invoke it. */ if (Tcl_FindHashEntry(contextIoPtr->destructed, (char *)contextIclsPtr->namePtr) == NULL) { result = Itcl_InvokeMethodIfExists(interp, "destructor", contextIclsPtr, contextIoPtr, 0, NULL); if (result != TCL_OK) { return TCL_ERROR; } } /* * Scan through the list of base classes recursively and destruct |
︙ | ︙ | |||
1513 1514 1515 1516 1517 1518 1519 | * the appropriate command handler. */ cmd = Tcl_FindCommand(interp, cmdName, contextNs, /* flags */ 0); if (cmd != NULL && Itcl_IsObject(cmd)) { if (Tcl_GetCommandInfoFromToken(cmd, &cmdInfo) != 1) { *roPtr = NULL; } | | | 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 | * the appropriate command handler. */ cmd = Tcl_FindCommand(interp, cmdName, contextNs, /* flags */ 0); if (cmd != NULL && Itcl_IsObject(cmd)) { if (Tcl_GetCommandInfoFromToken(cmd, &cmdInfo) != 1) { *roPtr = NULL; } *roPtr = (ItclObject *)cmdInfo.deleteData; } else { *roPtr = NULL; } ckfree(cmdName); return TCL_OK; |
︙ | ︙ | |||
1629 1630 1631 1632 1633 1634 1635 | * Make sure that the current namespace context includes an * object that is being manipulated. */ if (contextIoPtr == NULL) { Tcl_ResetResult(interp); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "cannot access object-specific info without an object context", | | | | | 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 | * Make sure that the current namespace context includes an * object that is being manipulated. */ if (contextIoPtr == NULL) { Tcl_ResetResult(interp); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "cannot access object-specific info without an object context", NULL); return NULL; } /* get the variable definition to check if that is an ITCL_COMMON */ if (contextIclsPtr == NULL) { iclsPtr = contextIoPtr->iclsPtr; } else { iclsPtr = contextIclsPtr; } ivPtr = NULL; hPtr = ItclResolveVarEntry(iclsPtr, (char *)name1); if (hPtr != NULL) { vlookup = (ItclVarLookup *)Tcl_GetHashValue(hPtr); ivPtr = vlookup->ivPtr; /* * Install the object context and access the data member * like any other variable. */ hPtr = Tcl_FindHashEntry(&contextIoPtr->objectVariables, (char *)ivPtr); if (hPtr) { Tcl_Obj *varName = Tcl_NewObj(); Tcl_Var varPtr = (Tcl_Var)Tcl_GetHashValue(hPtr); Tcl_GetVariableFullName(interp, varPtr, varName); val = Tcl_GetVar2(interp, Tcl_GetString(varName), name2, TCL_LEAVE_ERR_MSG | TCL_GLOBAL_ONLY); Tcl_DecrRefCount(varName); if (val) { return val; |
︙ | ︙ | |||
1742 1743 1744 1745 1746 1747 1748 | * Make sure that the current namespace context includes an * object that is being manipulated. */ if (contextIoPtr == NULL) { Tcl_ResetResult(interp); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "cannot access object-specific info without an object context", | | | 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 | * Make sure that the current namespace context includes an * object that is being manipulated. */ if (contextIoPtr == NULL) { Tcl_ResetResult(interp); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "cannot access object-specific info without an object context", NULL); return NULL; } /* * Install the object context and access the data member * like any other variable. */ |
︙ | ︙ | |||
1847 1848 1849 1850 1851 1852 1853 | * Make sure that the current namespace context includes an * object that is being manipulated. */ if (contextIoPtr == NULL) { Tcl_ResetResult(interp); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "cannot access object-specific info without an object context", | | | | | 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 | * Make sure that the current namespace context includes an * object that is being manipulated. */ if (contextIoPtr == NULL) { Tcl_ResetResult(interp); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "cannot access object-specific info without an object context", NULL); return NULL; } /* get the variable definition to check if that is an ITCL_COMMON */ if (contextIclsPtr == NULL) { iclsPtr = contextIoPtr->iclsPtr; } else { iclsPtr = contextIclsPtr; } hPtr = ItclResolveVarEntry(iclsPtr, (char *)name1); if (hPtr != NULL) { vlookup = (ItclVarLookup *)Tcl_GetHashValue(hPtr); ivPtr = vlookup->ivPtr; } else { return NULL; } /* * Install the object context and access the data member * like any other variable. */ hPtr = Tcl_FindHashEntry(&contextIoPtr->objectVariables, (char *)ivPtr); if (hPtr) { Tcl_Obj *varName = Tcl_NewObj(); Tcl_Var varPtr = (Tcl_Var)Tcl_GetHashValue(hPtr); Tcl_GetVariableFullName(interp, varPtr, varName); val = Tcl_SetVar2(interp, Tcl_GetString(varName), name2, value, TCL_LEAVE_ERR_MSG); Tcl_DecrRefCount(varName); return val; } |
︙ | ︙ | |||
1957 1958 1959 1960 1961 1962 1963 | ItclObjectInfo * infoPtr = NULL; char *name; int ignore; int cmp; if (contextIoPtr == NULL) { resultPtr = Tcl_GetObjResult(interp); | | | | 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 | ItclObjectInfo * infoPtr = NULL; char *name; int ignore; int cmp; if (contextIoPtr == NULL) { resultPtr = Tcl_GetObjResult(interp); infoPtr = (ItclObjectInfo *)Tcl_GetAssocData(interp, ITCL_INTERP_DATA, NULL); if (infoPtr == NULL) { Tcl_AppendResult(interp, " PANIC cannot get Itcl AssocData in ItclReportObjectUsage", NULL); return; } if (contextNsPtr == NULL) { Tcl_AppendResult(interp, " PANIC cannot get contextNsPtr in ItclReportObjectUsage", NULL); return; } entry = Tcl_FindHashEntry(&infoPtr->namespaceClasses, (char *)contextNsPtr); if (entry) { iclsPtr = (ItclClass *)Tcl_GetHashValue(entry); } if (iclsPtr == NULL) { Tcl_AppendResult(interp, " PANIC cannot get class from contextNsPtr ItclReportObjectUsage", NULL); return; } } else { |
︙ | ︙ | |||
2035 2036 2037 2038 2039 2040 2041 | if (imPtr) { elem = Itcl_FirstListElem(&cmdList); while (elem) { cmpFunc = (ItclMemberFunc*)Itcl_GetListValue(elem); cmp = strcmp(Tcl_GetString(imPtr->namePtr), Tcl_GetString(cmpFunc->namePtr)); if (cmp < 0) { | | | | 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 | if (imPtr) { elem = Itcl_FirstListElem(&cmdList); while (elem) { cmpFunc = (ItclMemberFunc*)Itcl_GetListValue(elem); cmp = strcmp(Tcl_GetString(imPtr->namePtr), Tcl_GetString(cmpFunc->namePtr)); if (cmp < 0) { Itcl_InsertListElem(elem, imPtr); imPtr = NULL; break; } else { if (cmp == 0) { imPtr = NULL; break; } } elem = Itcl_NextListElem(elem); } if (imPtr) { Itcl_AppendList(&cmdList, imPtr); } } entry = Tcl_NextHashEntry(&place); } /* * Add a series of statements showing usage info. |
︙ | ︙ | |||
2459 2460 2461 2462 2463 2464 2465 | if (ioPtr->noComponentTrace) { return NULL; } /* need to redo the delegation for this component !! */ if (hPtr == NULL) { return (char *)" INTERNAL ERROR cannot get component to write to"; } | | | 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 | if (ioPtr->noComponentTrace) { return NULL; } /* need to redo the delegation for this component !! */ if (hPtr == NULL) { return (char *)" INTERNAL ERROR cannot get component to write to"; } icPtr = (ItclComponent *)Tcl_GetHashValue(hPtr); val = ItclGetInstanceVar(interp, name1, NULL, ioPtr, ioPtr->iclsPtr); if ((val == NULL) || (strlen(val) == 0)) { return (char *)" INTERNAL ERROR cannot get value for component"; } componentValuePtr = Tcl_NewStringObj(val, -1); Tcl_IncrRefCount(componentValuePtr); |
︙ | ︙ | |||
2548 2549 2550 2551 2552 2553 2554 | } objPtr = Tcl_NewStringObj(name1, -1); hPtr = Tcl_FindHashEntry(&ioPtr->iclsPtr->variables, (char *)objPtr); Tcl_DecrRefCount(objPtr); if (hPtr == NULL) { return (char *)"INTERNAL ERROR cannot find itcl_hull variable in class definition!!"; } | | | 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 | } objPtr = Tcl_NewStringObj(name1, -1); hPtr = Tcl_FindHashEntry(&ioPtr->iclsPtr->variables, (char *)objPtr); Tcl_DecrRefCount(objPtr); if (hPtr == NULL) { return (char *)"INTERNAL ERROR cannot find itcl_hull variable in class definition!!"; } ivPtr = (ItclVariable *)Tcl_GetHashValue(hPtr); /* * Handle write traces */ if ((flags & TCL_TRACE_WRITES) != 0) { if (ivPtr->initted == 0) { ivPtr->initted = 1; return NULL; |
︙ | ︙ | |||
2633 2634 2635 2636 2637 2638 2639 | (char*)contextIoPtr); if (hPtr) { Tcl_DeleteHashEntry(hPtr); } contextIoPtr->accessCmd = NULL; } | | | | < | | 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 | (char*)contextIoPtr); if (hPtr) { Tcl_DeleteHashEntry(hPtr); } contextIoPtr->accessCmd = NULL; } Itcl_ReleaseData(contextIoPtr); } /* * ------------------------------------------------------------------------ * FreeObject() * * Deletes all instance variables and frees all memory associated with * the given object instance. Called when releases match preserves. * ------------------------------------------------------------------------ */ static void FreeObject( char * cdata) /* object instance data */ { FOREACH_HASH_DECLS; Tcl_HashSearch place; ItclCallContext *callContextPtr; ItclObject *ioPtr; Tcl_Var var; |
︙ | ︙ | |||
2683 2684 2685 2686 2687 2688 2689 | ckfree((char*)ioPtr->destructed); } ItclDeleteObjectsDictInfo(ioPtr->interp, ioPtr); /* * Delete all context definitions. */ while (1) { | | | | | | | | 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 | ckfree((char*)ioPtr->destructed); } ItclDeleteObjectsDictInfo(ioPtr->interp, ioPtr); /* * Delete all context definitions. */ while (1) { hPtr = Tcl_FirstHashEntry(&ioPtr->contextCache, &place); if (hPtr == NULL) { break; } callContextPtr = (ItclCallContext *)Tcl_GetHashValue(hPtr); Tcl_DeleteHashEntry(hPtr); ckfree((char *)callContextPtr); } FOREACH_HASH_VALUE(var, &ioPtr->objectVariables) { Itcl_ReleaseVar(var); } Tcl_DeleteHashTable(&ioPtr->contextCache); Tcl_DeleteHashTable(&ioPtr->objectVariables); |
︙ | ︙ | |||
2715 2716 2717 2718 2719 2720 2721 | Tcl_DecrRefCount(ioPtr->hullWindowNamePtr); } Tcl_DecrRefCount(ioPtr->varNsNamePtr); if (ioPtr->resolvePtr != NULL) { ckfree((char *)ioPtr->resolvePtr->clientData); ckfree((char*)ioPtr->resolvePtr); } | | | | | | 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 | Tcl_DecrRefCount(ioPtr->hullWindowNamePtr); } Tcl_DecrRefCount(ioPtr->varNsNamePtr); if (ioPtr->resolvePtr != NULL) { ckfree((char *)ioPtr->resolvePtr->clientData); ckfree((char*)ioPtr->resolvePtr); } Itcl_Free(ioPtr); } /* * ------------------------------------------------------------------------ * ItclObjectCmd() * * ------------------------------------------------------------------------ */ static int CallPublicObjectCmd( ClientData data[], Tcl_Interp *interp, int result) { Tcl_Object *oPtr = (Tcl_Object *)data[0]; Tcl_Class clsPtr = (Tcl_Class)data[1]; Tcl_Obj *const *objv = (Tcl_Obj *const *)data[3]; int objc = PTR2INT(data[2]); ItclShowArgs(1, "CallPublicObjectCmd", objc, objv); result = Itcl_PublicObjectCmd(oPtr, interp, clsPtr, objc, objv); ItclShowArgs(1, "CallPublicObjectCmd DONE", objc, objv); return result; } |
︙ | ︙ | |||
2909 2910 2911 2912 2913 2914 2915 | ItclShowArgs(1, "run CallPublicObjectCmd1", objc+incr, newObjv); Tcl_NRAddCallback(interp, CallPublicObjectCmd, oPtr, clsPtr, INT2PTR(objc+incr), newObjv); } else { ItclShowArgs(1, "run CallPublicObjectCmd2", objc, objv); Tcl_NRAddCallback(interp, CallPublicObjectCmd, oPtr, clsPtr, | | | 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 | ItclShowArgs(1, "run CallPublicObjectCmd1", objc+incr, newObjv); Tcl_NRAddCallback(interp, CallPublicObjectCmd, oPtr, clsPtr, INT2PTR(objc+incr), newObjv); } else { ItclShowArgs(1, "run CallPublicObjectCmd2", objc, objv); Tcl_NRAddCallback(interp, CallPublicObjectCmd, oPtr, clsPtr, INT2PTR(objc), (void *)objv); } result = Itcl_NRRunCallbacks(interp, callbackPtr); if (methodNamePtr != NULL) { ckfree((char *)newObjv); Tcl_DecrRefCount(methodNamePtr); } |
︙ | ︙ | |||
2985 2986 2987 2988 2989 2990 2991 | ITCL_INTERP_DATA, NULL); } /* as a last chance try with className in hash table */ objPtr = Tcl_NewStringObj(className, -1); Tcl_IncrRefCount(objPtr); hPtr = Tcl_FindHashEntry(&infoPtr->nameClasses, (char *)objPtr); if (hPtr != NULL) { | | | 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 | ITCL_INTERP_DATA, NULL); } /* as a last chance try with className in hash table */ objPtr = Tcl_NewStringObj(className, -1); Tcl_IncrRefCount(objPtr); hPtr = Tcl_FindHashEntry(&infoPtr->nameClasses, (char *)objPtr); if (hPtr != NULL) { iclsPtr = (ItclClass *)Tcl_GetHashValue(hPtr); } else { iclsPtr = NULL; } Tcl_DecrRefCount(objPtr); return iclsPtr; } |
︙ | ︙ | |||
3106 3107 3108 3109 3110 3111 3112 | if (!Itcl_CanAccessFunc(imPtr, nsPtr)) { char *token = Tcl_GetString(imPtr->namePtr); if ((*token != 'i') || (strcmp(token, "info") != 0)) { /* needed for test protect-2.5 */ ItclMemberFunc *imPtr2 = NULL; Tcl_HashEntry *hPtr; Tcl_ObjectContext context; | | | | 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 | if (!Itcl_CanAccessFunc(imPtr, nsPtr)) { char *token = Tcl_GetString(imPtr->namePtr); if ((*token != 'i') || (strcmp(token, "info") != 0)) { /* needed for test protect-2.5 */ ItclMemberFunc *imPtr2 = NULL; Tcl_HashEntry *hPtr; Tcl_ObjectContext context; context = (Tcl_ObjectContext)Itcl_GetCallFrameClientData(interp); if (context != NULL) { hPtr = Tcl_FindHashEntry( &imPtr->iclsPtr->infoPtr->procMethods, (char *)Tcl_ObjectContextMethod(context)); if (hPtr != NULL) { imPtr2 = (ItclMemberFunc *)Tcl_GetHashValue(hPtr); } if ((imPtr->protection & ITCL_PRIVATE) && (imPtr2 != NULL) && (imPtr->iclsPtr->nsPtr != imPtr2->iclsPtr->nsPtr)) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "invalid command name \"", token, |
︙ | ︙ | |||
3135 3136 3137 3138 3139 3140 3141 | Tcl_Obj * objPtr; ItclMemberFunc *imPtr2 = NULL; ItclCmdLookup *clookupPtr; objPtr = Tcl_NewStringObj(token, -1); hPtr = Tcl_FindHashEntry(&iclsPtr->resolveCmds, (char *)objPtr); if (hPtr != NULL) { | | | | 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 | Tcl_Obj * objPtr; ItclMemberFunc *imPtr2 = NULL; ItclCmdLookup *clookupPtr; objPtr = Tcl_NewStringObj(token, -1); hPtr = Tcl_FindHashEntry(&iclsPtr->resolveCmds, (char *)objPtr); if (hPtr != NULL) { clookupPtr = (ItclCmdLookup *)Tcl_GetHashValue(hPtr); imPtr2 = clookupPtr->imPtr; } if ((imPtr->protection & ITCL_PRIVATE) && (imPtr2 != NULL) && (imPtr->iclsPtr->nsPtr == imPtr2->iclsPtr->nsPtr)) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "invalid command name \"", token, "\"", NULL); return TCL_ERROR; } } else { Tcl_AppendResult(interp, "bad option \"", token, "\": should be one of...", NULL); ItclReportObjectUsage(interp, ioPtr, nsPtr, nsPtr); return TCL_ERROR; } } } } |
︙ | ︙ | |||
3481 3482 3483 3484 3485 3486 3487 | search = search2; } else { hPtr2 = Tcl_FindHashEntry(&iclsPtr->options, (char *)idoPtr->namePtr); if (hPtr2 == NULL) { ioptPtr = NULL; } else { | | | 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 | search = search2; } else { hPtr2 = Tcl_FindHashEntry(&iclsPtr->options, (char *)idoPtr->namePtr); if (hPtr2 == NULL) { ioptPtr = NULL; } else { ioptPtr = (ItclOption *)Tcl_GetHashValue(hPtr2); ioptPtr->idoPtr = idoPtr; } idoPtr->ioptPtr = ioptPtr; } } return TCL_OK; } |
︙ | ︙ | |||
3742 3743 3744 3745 3746 3747 3748 | Tcl_HashEntry *hPtr; infoPtr = (ItclObjectInfo *)Tcl_GetAssocData(((Namespace *)nsPtr)->interp, ITCL_INTERP_DATA, NULL); hPtr = Tcl_FindHashEntry(&(infoPtr->namespaceClasses), nsPtr); if (hPtr == NULL) { return NULL; } | | | 3723 3724 3725 3726 3727 3728 3729 3730 3731 | Tcl_HashEntry *hPtr; infoPtr = (ItclObjectInfo *)Tcl_GetAssocData(((Namespace *)nsPtr)->interp, ITCL_INTERP_DATA, NULL); hPtr = Tcl_FindHashEntry(&(infoPtr->namespaceClasses), nsPtr); if (hPtr == NULL) { return NULL; } return (ItclClass *)Tcl_GetHashValue(hPtr); } |
Changes to generic/itclParse.c.
︙ | ︙ | |||
194 195 196 197 198 199 200 | int i; /* * Create the "itcl::parser" namespace used to parse class * definitions. */ parserNs = Tcl_CreateNamespace(interp, "::itcl::parser", | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 | int i; /* * Create the "itcl::parser" namespace used to parse class * definitions. */ parserNs = Tcl_CreateNamespace(interp, "::itcl::parser", infoPtr, Itcl_ReleaseData); if (!parserNs) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), " (cannot initialize itcl parser)", NULL); return TCL_ERROR; } Itcl_PreserveData(infoPtr); /* * Add commands for parsing class definitions. */ Tcl_DStringInit(&buffer); for (i=0 ; parseCmds[i].name ; i++) { Tcl_DStringAppend(&buffer, "::itcl::parser::", 16); Tcl_DStringAppend(&buffer, parseCmds[i].name, -1); Tcl_CreateObjCommand(interp, Tcl_DStringValue(&buffer), parseCmds[i].objProc, infoPtr, NULL); Tcl_DStringFree(&buffer); } for (i=0 ; protectionCmds[i].name ; i++) { Tcl_DStringAppend(&buffer, "::itcl::parser::", 16); Tcl_DStringAppend(&buffer, protectionCmds[i].name, -1); pInfoPtr = (ProtectionCmdInfo*)ckalloc(sizeof(ProtectionCmdInfo)); pInfoPtr->pLevel = protectionCmds[i].protection; pInfoPtr->infoPtr = infoPtr; Tcl_CreateObjCommand(interp, Tcl_DStringValue(&buffer), protectionCmds[i].objProc, pInfoPtr, (Tcl_CmdDeleteProc*) ItclFreeParserCommandData); Tcl_DStringFree(&buffer); } /* * Set the runtime variable resolver for the parser namespace, * to control access to "common" data members while parsing * the class definition. */ if (infoPtr->useOldResolvers) { ItclSetParserResolver(parserNs); } /* * Install the "class" command for defining new classes. */ Tcl_CreateObjCommand(interp, "::itcl::class", Itcl_ClassCmd, infoPtr, Itcl_ReleaseData); Itcl_PreserveData(infoPtr); Tcl_CreateObjCommand(interp, "::itcl::body", Itcl_BodyCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "::itcl::configbody", Itcl_ConfigBodyCmd, NULL, NULL); Itcl_EventuallyFree(infoPtr, (Tcl_FreeProc *) ItclDelObjectInfo); /* * Create the "itcl::find" command for high-level queries. */ if (Itcl_CreateEnsemble(interp, "::itcl::find") != TCL_OK) { return TCL_ERROR; } if (Itcl_AddEnsemblePart(interp, "::itcl::find", "classes", "?pattern?", Itcl_FindClassesCmd, infoPtr, Itcl_ReleaseData) != TCL_OK) { return TCL_ERROR; } Itcl_PreserveData(infoPtr); if (Itcl_AddEnsemblePart(interp, "::itcl::find", "objects", "?-class className? ?-isa className? ?pattern?", Itcl_FindObjectsCmd, infoPtr, Itcl_ReleaseData) != TCL_OK) { return TCL_ERROR; } Itcl_PreserveData(infoPtr); /* * Create the "itcl::delete" command to delete objects * and classes. */ if (Itcl_CreateEnsemble(interp, "::itcl::delete") != TCL_OK) { return TCL_ERROR; } if (Itcl_AddEnsemblePart(interp, "::itcl::delete", "class", "name ?name...?", Itcl_DelClassCmd, infoPtr, Itcl_ReleaseData) != TCL_OK) { return TCL_ERROR; } Itcl_PreserveData(infoPtr); if (Itcl_AddEnsemblePart(interp, "::itcl::delete", "object", "name ?name...?", Itcl_DelObjectCmd, infoPtr, Itcl_ReleaseData) != TCL_OK) { return TCL_ERROR; } Itcl_PreserveData(infoPtr); if (Itcl_AddEnsemblePart(interp, "::itcl::delete", "ensemble", "name ?name...?", Itcl_EnsembleDeleteCmd, infoPtr, Itcl_ReleaseData) != TCL_OK) { return TCL_ERROR; } Itcl_PreserveData(infoPtr); /* * Create the "itcl::is" command to test object * and classes existence. */ if (Itcl_CreateEnsemble(interp, "::itcl::is") != TCL_OK) { return TCL_ERROR; } if (Itcl_AddEnsemblePart(interp, "::itcl::is", "class", "name", Itcl_IsClassCmd, infoPtr, Itcl_ReleaseData) != TCL_OK) { return TCL_ERROR; } Itcl_PreserveData(infoPtr); if (Itcl_AddEnsemblePart(interp, "::itcl::is", "object", "?-class classname? name", Itcl_IsObjectCmd, infoPtr, Itcl_ReleaseData) != TCL_OK) { return TCL_ERROR; } Itcl_PreserveData(infoPtr); /* * Add "code" and "scope" commands for handling scoped values. */ Tcl_CreateObjCommand(interp, "::itcl::code", Itcl_CodeCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "::itcl::scope", Itcl_ScopeCmd, NULL, NULL); /* * Add the "filter" commands (add/delete) */ if (Itcl_CreateEnsemble(interp, "::itcl::filter") != TCL_OK) { return TCL_ERROR; } if (Itcl_AddEnsemblePart(interp, "::itcl::filter", "add", "objectOrClass filter ? ... ?", Itcl_FilterAddCmd, infoPtr, Itcl_ReleaseData) != TCL_OK) { return TCL_ERROR; } Itcl_PreserveData(infoPtr); if (Itcl_AddEnsemblePart(interp, "::itcl::filter", "delete", "objectOrClass filter ? ... ?", Itcl_FilterDeleteCmd, infoPtr, Itcl_ReleaseData) != TCL_OK) { return TCL_ERROR; } Itcl_PreserveData(infoPtr); /* * Add the "forward" commands (add/delete) */ if (Itcl_CreateEnsemble(interp, "::itcl::forward") != TCL_OK) { return TCL_ERROR; } if (Itcl_AddEnsemblePart(interp, "::itcl::forward", "add", "objectOrClass srcCommand targetCommand ? options ... ?", Itcl_ForwardAddCmd, infoPtr, Itcl_ReleaseData) != TCL_OK) { return TCL_ERROR; } Itcl_PreserveData(infoPtr); if (Itcl_AddEnsemblePart(interp, "::itcl::forward", "delete", "objectOrClass targetCommand ? ... ?", Itcl_ForwardDeleteCmd, infoPtr, Itcl_ReleaseData) != TCL_OK) { return TCL_ERROR; } Itcl_PreserveData(infoPtr); /* * Add the "mixin" (add/delete) commands. */ if (Itcl_CreateEnsemble(interp, "::itcl::mixin") != TCL_OK) { return TCL_ERROR; } if (Itcl_AddEnsemblePart(interp, "::itcl::mixin", "add", "objectOrClass class ? class ... ?", Itcl_MixinAddCmd, infoPtr, Itcl_ReleaseData) != TCL_OK) { return TCL_ERROR; } Itcl_PreserveData(infoPtr); if (Itcl_AddEnsemblePart(interp, "::itcl::mixin", "delete", "objectOrClass class ? class ... ?", Itcl_MixinDeleteCmd, infoPtr, Itcl_ReleaseData) != TCL_OK) { return TCL_ERROR; } Itcl_PreserveData(infoPtr); /* * Add commands for handling import stubs at the Tcl level. */ if (Itcl_CreateEnsemble(interp, "::itcl::import::stub") != TCL_OK) { return TCL_ERROR; } if (Itcl_AddEnsemblePart(interp, "::itcl::import::stub", "create", "name", Itcl_StubCreateCmd, NULL, NULL) != TCL_OK) { return TCL_ERROR; } if (Itcl_AddEnsemblePart(interp, "::itcl::import::stub", "exists", "name", Itcl_StubExistsCmd, NULL, NULL) != TCL_OK) { return TCL_ERROR; } Tcl_CreateObjCommand(interp, "::itcl::type", Itcl_TypeClassCmd, infoPtr, Itcl_ReleaseData); Itcl_PreserveData(infoPtr); Tcl_CreateObjCommand(interp, "::itcl::widget", Itcl_WidgetCmd, infoPtr, Itcl_ReleaseData); Itcl_PreserveData(infoPtr); Tcl_CreateObjCommand(interp, "::itcl::widgetadaptor", Itcl_WidgetAdaptorCmd, infoPtr, Itcl_ReleaseData); Itcl_PreserveData(infoPtr); Tcl_CreateObjCommand(interp, "::itcl::nwidget", Itcl_NWidgetCmd, infoPtr, Itcl_ReleaseData); Itcl_PreserveData(infoPtr); Tcl_CreateObjCommand(interp, "::itcl::addoption", Itcl_AddOptionCmd, infoPtr, Itcl_ReleaseData); Itcl_PreserveData(infoPtr); Tcl_CreateObjCommand(interp, "::itcl::addobjectoption", Itcl_AddObjectOptionCmd, infoPtr, Itcl_ReleaseData); Itcl_PreserveData(infoPtr); Tcl_CreateObjCommand(interp, "::itcl::adddelegatedoption", Itcl_AddDelegatedOptionCmd, infoPtr, Itcl_ReleaseData); Itcl_PreserveData(infoPtr); Tcl_CreateObjCommand(interp, "::itcl::adddelegatedmethod", Itcl_AddDelegatedFunctionCmd, infoPtr, Itcl_ReleaseData); Itcl_PreserveData(infoPtr); Tcl_CreateObjCommand(interp, "::itcl::addcomponent", Itcl_AddComponentCmd, infoPtr, Itcl_ReleaseData); Itcl_PreserveData(infoPtr); Tcl_CreateObjCommand(interp, "::itcl::setcomponent", Itcl_SetComponentCmd, infoPtr, Itcl_ReleaseData); Itcl_PreserveData(infoPtr); Tcl_CreateObjCommand(interp, "::itcl::extendedclass", Itcl_ExtendedClassCmd, infoPtr, Itcl_ReleaseData); Itcl_PreserveData(infoPtr); Tcl_CreateObjCommand(interp, ITCL_COMMANDS_NAMESPACE "::genericclass", ItclGenericClassCmd, infoPtr, Itcl_ReleaseData); Itcl_PreserveData(infoPtr); /* * Add the "delegate" (method/option) commands. */ if (Itcl_CreateEnsemble(interp, "::itcl::parser::delegate") != TCL_OK) { return TCL_ERROR; } if (Itcl_AddEnsemblePart(interp, "::itcl::parser::delegate", "method", "name to targetName as scipt using script", Itcl_ClassDelegateMethodCmd, infoPtr, Itcl_ReleaseData) != TCL_OK) { return TCL_ERROR; } Itcl_PreserveData(infoPtr); if (Itcl_AddEnsemblePart(interp, "::itcl::parser::delegate", "typemethod", "name to targetName as scipt using script", Itcl_ClassDelegateTypeMethodCmd, infoPtr, Itcl_ReleaseData) != TCL_OK) { return TCL_ERROR; } Itcl_PreserveData(infoPtr); if (Itcl_AddEnsemblePart(interp, "::itcl::parser::delegate", "option", "option to targetOption as script", Itcl_ClassDelegateOptionCmd, infoPtr, Itcl_ReleaseData) != TCL_OK) { return TCL_ERROR; } Itcl_PreserveData(infoPtr); return TCL_OK; } /* * ------------------------------------------------------------------------ |
︙ | ︙ | |||
635 636 637 638 639 640 641 | static Tcl_MethodCallProc ArgCallProc; static Tcl_CloneProc CloneProc; static const Tcl_MethodType itclObjMethodType = { TCL_OO_METHOD_VERSION_CURRENT, "itcl objv method", ObjCallProc, | | | | | | 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 | static Tcl_MethodCallProc ArgCallProc; static Tcl_CloneProc CloneProc; static const Tcl_MethodType itclObjMethodType = { TCL_OO_METHOD_VERSION_CURRENT, "itcl objv method", ObjCallProc, Itcl_ReleaseData, CloneProc }; static const Tcl_MethodType itclArgMethodType = { TCL_OO_METHOD_VERSION_CURRENT, "itcl argv method", ArgCallProc, Itcl_ReleaseData, CloneProc }; static int CloneProc( Tcl_Interp *interp, ClientData original, ClientData *copyPtr) { Itcl_PreserveData((ItclMemberFunc *)original); *copyPtr = original; return TCL_OK; } static int CallAfterCallMethod( ClientData data[], Tcl_Interp *interp, int result) { ClientData clientData = data[0]; Tcl_ObjectContext context = (Tcl_ObjectContext)data[1]; return ItclAfterCallMethod(clientData, interp, context, NULL, result); } static int ObjCallProc( ClientData clientData, |
︙ | ︙ | |||
748 749 750 751 752 753 754 | noCleanup = 0; /* * Find the namespace to use as a parser for the class definition. * If for some reason it is destroyed, bail out here. */ parserNs = Tcl_FindNamespace(interp, "::itcl::parser", | | | 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 | noCleanup = 0; /* * Find the namespace to use as a parser for the class definition. * If for some reason it is destroyed, bail out here. */ parserNs = Tcl_FindNamespace(interp, "::itcl::parser", NULL, TCL_LEAVE_ERR_MSG); if (parserNs == NULL) { Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( "\n (while parsing class definition for \"%s\")", className)); return TCL_ERROR; } |
︙ | ︙ | |||
795 796 797 798 799 800 801 | } /* * Push this class onto the class definition stack so that it * becomes the current context for all commands in the parser. * Activate the parser and evaluate the class definition. */ | | | 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 | } /* * Push this class onto the class definition stack so that it * becomes the current context for all commands in the parser. * Activate the parser and evaluate the class definition. */ Itcl_PushStack(iclsPtr, &infoPtr->clsStack); result = Itcl_PushCallFrame(interp, &frame, parserNs, /* isProcCallFrame */ 0); Itcl_SetCallFrameResolver(interp, iclsPtr->resolvePtr); if (result == TCL_OK) { result = Tcl_EvalObjEx(interp, objv[2], 0); |
︙ | ︙ | |||
876 877 878 879 880 881 882 | argumentPtr = imPtr->codePtr->argumentPtr; bodyPtr = imPtr->codePtr->bodyPtr; if (imPtr->codePtr->flags & ITCL_IMPLEMENT_OBJCMD) { /* Implementation of this member is coded in C expecting Tcl_Obj */ imPtr->tmPtr = Tcl_NewMethod(interp, iclsPtr->clsPtr, imPtr->namePtr, | | | | | | | | 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 | argumentPtr = imPtr->codePtr->argumentPtr; bodyPtr = imPtr->codePtr->bodyPtr; if (imPtr->codePtr->flags & ITCL_IMPLEMENT_OBJCMD) { /* Implementation of this member is coded in C expecting Tcl_Obj */ imPtr->tmPtr = Tcl_NewMethod(interp, iclsPtr->clsPtr, imPtr->namePtr, 1, &itclObjMethodType, imPtr); Itcl_PreserveData(imPtr); if (iclsPtr->flags & (ITCL_TYPE|ITCL_WIDGET|ITCL_WIDGETADAPTOR)) { imPtr->tmPtr = Tcl_NewInstanceMethod(interp, iclsPtr->oPtr, imPtr->namePtr, 1, &itclObjMethodType, imPtr); Itcl_PreserveData(imPtr); } } else if (imPtr->codePtr->flags & ITCL_IMPLEMENT_ARGCMD) { /* Implementation of this member is coded in C expecting (char *) */ imPtr->tmPtr = Tcl_NewMethod(interp, iclsPtr->clsPtr, imPtr->namePtr, 1, &itclArgMethodType, imPtr); Itcl_PreserveData(imPtr); } else { if (imPtr->codePtr->flags & ITCL_BUILTIN) { int isDone; isDone = 0; |
︙ | ︙ | |||
1053 1054 1055 1056 1057 1058 1059 | } if (!isDone) { Tcl_AppendToObj(bodyPtr, Tcl_GetString(imPtr->codePtr->bodyPtr), -1); } Tcl_AppendToObj(bodyPtr, " {*}$args]", -1); } | | | 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 | } if (!isDone) { Tcl_AppendToObj(bodyPtr, Tcl_GetString(imPtr->codePtr->bodyPtr), -1); } Tcl_AppendToObj(bodyPtr, " {*}$args]", -1); } imPtr->tmPtr = Itcl_NewProcClassMethod(interp, iclsPtr->clsPtr, ItclCheckCallMethod, ItclAfterCallMethod, ItclProcErrorProc, imPtr, imPtr->namePtr, argumentPtr, bodyPtr, &pmPtr); hPtr2 = Tcl_CreateHashEntry(&iclsPtr->infoPtr->procMethods, (char *)imPtr->tmPtr, &isNewEntry); if (isNewEntry) { Tcl_SetHashValue(hPtr2, imPtr); |
︙ | ︙ | |||
1075 1076 1077 1078 1079 1080 1081 | /* * We're overwriting the tmPtr field, so yank out the * entry in the procMethods map based on the old one. */ if (isNewEntry) { Tcl_DeleteHashEntry(hPtr2); } | | | | | | | 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 | /* * We're overwriting the tmPtr field, so yank out the * entry in the procMethods map based on the old one. */ if (isNewEntry) { Tcl_DeleteHashEntry(hPtr2); } imPtr->tmPtr = Itcl_NewProcMethod(interp, iclsPtr->oPtr, ItclCheckCallMethod, ItclAfterCallMethod, ItclProcErrorProc, imPtr, imPtr->namePtr, argumentPtr, bodyPtr, &pmPtr); } } if ((imPtr->flags & ITCL_COMMON) == 0) { imPtr->accessCmd = Tcl_CreateObjCommand(interp, Tcl_GetString(imPtr->fullNamePtr), Itcl_ExecMethod, imPtr, Itcl_ReleaseData); Itcl_PreserveData(imPtr); } else { imPtr->accessCmd = Tcl_CreateObjCommand(interp, Tcl_GetString(imPtr->fullNamePtr), Itcl_ExecProc, imPtr, Itcl_ReleaseData); Itcl_PreserveData(imPtr); } } if (iclsPtr->flags & (ITCL_TYPE|ITCL_WIDGETADAPTOR)) { /* initialize the typecomponents and typevariables */ if (Itcl_PushCallFrame(interp, &frame, iclsPtr->nsPtr, /*isProcCallFrame*/0) != TCL_OK) { result = TCL_ERROR; |
︙ | ︙ | |||
1323 1324 1325 1326 1327 1328 1329 | elem = Itcl_FirstListElem(&iclsPtr->bases); if (elem != NULL) { Tcl_AppendToObj(Tcl_GetObjResult(interp), "inheritance \"", -1); while (elem) { cdPtr = (ItclClass*)Itcl_GetListValue(elem); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), | | | | 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 | elem = Itcl_FirstListElem(&iclsPtr->bases); if (elem != NULL) { Tcl_AppendToObj(Tcl_GetObjResult(interp), "inheritance \"", -1); while (elem) { cdPtr = (ItclClass*)Itcl_GetListValue(elem); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), Tcl_GetString(cdPtr->namePtr), " ", NULL); elem = Itcl_NextListElem(elem); } Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "\" already defined for class \"", Tcl_GetString(iclsPtr->fullNamePtr), "\"", NULL); return TCL_ERROR; } /* * Validate each base class and add it to the "bases" list. */ result = Itcl_PushCallFrame(interp, &frame, iclsPtr->nsPtr->parentPtr, |
︙ | ︙ | |||
1365 1366 1367 1368 1369 1370 1371 | Tcl_IncrRefCount(resultPtr); errmsg = Tcl_GetStringFromObj(resultPtr, &errlen); Tcl_ResetResult(interp); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "cannot inherit from \"", token, "\"", | | | | | | | 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 | Tcl_IncrRefCount(resultPtr); errmsg = Tcl_GetStringFromObj(resultPtr, &errlen); Tcl_ResetResult(interp); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "cannot inherit from \"", token, "\"", NULL); if (errlen > 0) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), " (", errmsg, ")", NULL); } Tcl_DecrRefCount(resultPtr); goto inheritError; } /* * Make sure that the base class is not the same as the * class that is being built. */ if (baseClsPtr == iclsPtr) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "class \"", Tcl_GetString(iclsPtr->namePtr), "\" cannot inherit from itself", NULL); goto inheritError; } Itcl_AppendList(&iclsPtr->bases, baseClsPtr); ItclPreserveClass(baseClsPtr); } /* * Scan through the inheritance list to make sure that no * class appears twice. */ elem = Itcl_FirstListElem(&iclsPtr->bases); while (elem) { elem2 = Itcl_NextListElem(elem); while (elem2) { if (Itcl_GetListValue(elem) == Itcl_GetListValue(elem2)) { cdPtr = (ItclClass*)Itcl_GetListValue(elem); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "class \"", iclsPtr->fullNamePtr, "\" cannot inherit base class \"", cdPtr->fullNamePtr, "\" more than once", NULL); goto inheritError; } elem2 = Itcl_NextListElem(elem2); } elem = Itcl_NextListElem(elem); } |
︙ | ︙ | |||
1445 1446 1447 1448 1449 1450 1451 | Tcl_Obj *resultPtr = Tcl_GetObjResult(interp); badCdPtr = cdPtr; Tcl_AppendStringsToObj(resultPtr, "class \"", Tcl_GetString(iclsPtr->fullNamePtr), "\" inherits base class \"", Tcl_GetString(badCdPtr->fullNamePtr), "\" more than once:", | | | | | | | 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 | Tcl_Obj *resultPtr = Tcl_GetObjResult(interp); badCdPtr = cdPtr; Tcl_AppendStringsToObj(resultPtr, "class \"", Tcl_GetString(iclsPtr->fullNamePtr), "\" inherits base class \"", Tcl_GetString(badCdPtr->fullNamePtr), "\" more than once:", NULL); cdPtr = iclsPtr; Itcl_InitStack(&stack); Itcl_PushStack(cdPtr, &stack); /* * Show paths leading to bad base class */ while (Itcl_GetStackSize(&stack) > 0) { cdPtr = (ItclClass*)Itcl_PopStack(&stack); if (cdPtr == badCdPtr) { Tcl_AppendToObj(resultPtr, "\n ", -1); for (i=0; i < Itcl_GetStackSize(&stack); i++) { if (Itcl_GetStackValue(&stack, i) == NULL) { cdPtr = (ItclClass*)Itcl_GetStackValue(&stack, i-1); Tcl_AppendStringsToObj(resultPtr, Tcl_GetString(cdPtr->namePtr), "->", NULL); } } Tcl_AppendToObj(resultPtr, Tcl_GetString(badCdPtr->namePtr), -1); } else if (!cdPtr) { (void)Itcl_PopStack(&stack); } else { elem = Itcl_LastListElem(&cdPtr->bases); if (elem) { Itcl_PushStack(cdPtr, &stack); Itcl_PushStack(NULL, &stack); while (elem) { Itcl_PushStack(Itcl_GetListValue(elem), &stack); elem = Itcl_PrevListElem(elem); } } } } |
︙ | ︙ | |||
1507 1508 1509 1510 1511 1512 1513 | Tcl_DStringAppend(&buffer, " superclass", -1); while (elem) { baseClsPtr = (ItclClass*)Itcl_GetListValue(elem); haveClasses++; Tcl_DStringAppend(&buffer, " ", -1); Tcl_DStringAppend(&buffer, Tcl_GetString(baseClsPtr->fullNamePtr), -1); | | | 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 | Tcl_DStringAppend(&buffer, " superclass", -1); while (elem) { baseClsPtr = (ItclClass*)Itcl_GetListValue(elem); haveClasses++; Tcl_DStringAppend(&buffer, " ", -1); Tcl_DStringAppend(&buffer, Tcl_GetString(baseClsPtr->fullNamePtr), -1); Itcl_AppendList(&baseClsPtr->derived, iclsPtr); ItclPreserveClass(iclsPtr); elem = Itcl_NextListElem(elem); } Itcl_PopCallFrame(interp); if (haveClasses) { result = Tcl_EvalEx(interp, Tcl_DStringValue(&buffer), -1, 0); |
︙ | ︙ | |||
1671 1672 1673 1674 1675 1676 1677 | return TCL_ERROR; } namePtr = objv[0]; if (Tcl_FindHashEntry(&iclsPtr->functions, (char *)objv[0])) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "\"", Tcl_GetString(namePtr), "\" already defined in class \"", Tcl_GetString(iclsPtr->fullNamePtr), "\"", | | | 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 | return TCL_ERROR; } namePtr = objv[0]; if (Tcl_FindHashEntry(&iclsPtr->functions, (char *)objv[0])) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "\"", Tcl_GetString(namePtr), "\" already defined in class \"", Tcl_GetString(iclsPtr->fullNamePtr), "\"", NULL); return TCL_ERROR; } /* * If there is an object initialization statement, pick this * out and take the last argument as the constructor body. */ |
︙ | ︙ | |||
1738 1739 1740 1741 1742 1743 1744 | namePtr = objv[0]; body = Tcl_GetString(objv[1]); if (Tcl_FindHashEntry(&iclsPtr->functions, (char *)namePtr)) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "\"", Tcl_GetString(namePtr), "\" already defined in class \"", Tcl_GetString(iclsPtr->fullNamePtr), "\"", | | | | 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 | namePtr = objv[0]; body = Tcl_GetString(objv[1]); if (Tcl_FindHashEntry(&iclsPtr->functions, (char *)namePtr)) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "\"", Tcl_GetString(namePtr), "\" already defined in class \"", Tcl_GetString(iclsPtr->fullNamePtr), "\"", NULL); return TCL_ERROR; } if (Itcl_CreateMethod(interp, iclsPtr, namePtr, NULL, body) != TCL_OK) { return TCL_ERROR; } return TCL_OK; } /* |
︙ | ︙ | |||
1954 1955 1956 1957 1958 1959 1960 | iclsPtr->infoPtr->functionFlags = ITCL_TYPE_METHOD; if (Itcl_CreateProc(interp, iclsPtr, namePtr, arglist, body) != TCL_OK) { iclsPtr->infoPtr->functionFlags = 0; return TCL_ERROR; } iclsPtr->infoPtr->functionFlags = 0; hPtr = Tcl_FindHashEntry(&iclsPtr->functions, (char *)namePtr); | | | 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 | iclsPtr->infoPtr->functionFlags = ITCL_TYPE_METHOD; if (Itcl_CreateProc(interp, iclsPtr, namePtr, arglist, body) != TCL_OK) { iclsPtr->infoPtr->functionFlags = 0; return TCL_ERROR; } iclsPtr->infoPtr->functionFlags = 0; hPtr = Tcl_FindHashEntry(&iclsPtr->functions, (char *)namePtr); imPtr = (ItclMemberFunc *)Tcl_GetHashValue(hPtr); imPtr->flags |= ITCL_TYPE_METHOD; return TCL_OK; } /* * ------------------------------------------------------------------------ * Itcl_ClassVariableCmd() |
︙ | ︙ | |||
2042 2043 2044 2045 2046 2047 2048 | * Make sure that the variable name does not contain anything * goofy like a "::" scope qualifier. */ namePtr = objv[1]; if (strstr(Tcl_GetString(namePtr), "::")) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "bad variable name \"", Tcl_GetString(namePtr), "\"", | | | 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 | * Make sure that the variable name does not contain anything * goofy like a "::" scope qualifier. */ namePtr = objv[1]; if (strstr(Tcl_GetString(namePtr), "::")) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "bad variable name \"", Tcl_GetString(namePtr), "\"", NULL); return TCL_ERROR; } init = NULL; config = NULL; if (!haveArrayInit) { if (objc >= 3) { |
︙ | ︙ | |||
2160 2161 2162 2163 2164 2165 2166 | Tcl_DStringValue(&buffer), NULL, initStr, TCL_NAMESPACE_ONLY); if (!val) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "cannot initialize common variable \"", Tcl_GetString(ivPtr->namePtr), "\"", | | | | 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 | Tcl_DStringValue(&buffer), NULL, initStr, TCL_NAMESPACE_ONLY); if (!val) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "cannot initialize common variable \"", Tcl_GetString(ivPtr->namePtr), "\"", NULL); return TCL_ERROR; } } if (ivPtr->arrayInitPtr != NULL) { int i; int argc; const char **argv; const char *val; Tcl_DStringAppend(&buffer, "::", -1); Tcl_DStringAppend(&buffer, Tcl_GetString(ivPtr->namePtr), -1); result = Tcl_SplitList(interp, Tcl_GetString(ivPtr->arrayInitPtr), &argc, &argv); for (i = 0; i < argc; i++) { val = Tcl_SetVar2(interp, Tcl_DStringValue(&buffer), argv[i], argv[i + 1], TCL_NAMESPACE_ONLY); if (!val) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "cannot initialize common variable \"", Tcl_GetString(ivPtr->namePtr), "\"", NULL); return TCL_ERROR; } i++; } ckfree((char *)argv); } Tcl_DStringFree(&buffer); |
︙ | ︙ | |||
2266 2267 2268 2269 2270 2271 2272 | * Make sure that the variable name does not contain anything * goofy like a "::" scope qualifier. */ namePtr = objv[1]; if (strstr(Tcl_GetString(namePtr), "::")) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "bad variable name \"", Tcl_GetString(namePtr), "\"", | | | | 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 | * Make sure that the variable name does not contain anything * goofy like a "::" scope qualifier. */ namePtr = objv[1]; if (strstr(Tcl_GetString(namePtr), "::")) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "bad variable name \"", Tcl_GetString(namePtr), "\"", NULL); return TCL_ERROR; } initStr = NULL; if (!haveArrayInit) { if (objc >= 3) { initStr = Tcl_GetString(objv[2]); } } if (Itcl_CreateVariable(interp, iclsPtr, namePtr, initStr, NULL, &ivPtr) != TCL_OK) { return TCL_ERROR; } if (protection != 0) { ivPtr->protection = protection; } if (haveArrayInit) { |
︙ | ︙ | |||
2414 2415 2416 2417 2418 2419 2420 | hPtr = Tcl_FirstHashEntry(&infoPtr->objects, &place); /*hPtr = Tcl_NextHashEntry(&place);*/ } Tcl_DeleteHashTable(&infoPtr->objects); Tcl_DeleteHashTable(&infoPtr->frameContext); Itcl_DeleteStack(&infoPtr->clsStack); | | | 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 | hPtr = Tcl_FirstHashEntry(&infoPtr->objects, &place); /*hPtr = Tcl_NextHashEntry(&place);*/ } Tcl_DeleteHashTable(&infoPtr->objects); Tcl_DeleteHashTable(&infoPtr->frameContext); Itcl_DeleteStack(&infoPtr->clsStack); Itcl_Free(infoPtr); } /* * ------------------------------------------------------------------------ * Itcl_ClassFilterCmd() * * |
︙ | ︙ | |||
2788 2789 2790 2791 2792 2793 2794 | /* * Make sure that the variable name does not contain anything * goofy like a "::" scope qualifier. */ if (strstr(name, "::")) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "bad option name \"", name, | | | | 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 | /* * Make sure that the variable name does not contain anything * goofy like a "::" scope qualifier. */ if (strstr(name, "::")) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "bad option name \"", name, "\", option names must not contain \"::\"", NULL); result = TCL_ERROR; goto errorOut; } if (strstr(name, " ")) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "bad option name \"", name, "\", option names must not contain \" \"", NULL); result = TCL_ERROR; goto errorOut; } cp = name; while (*cp) { if (isupper(UCHAR(*cp))) { Tcl_AppendResult(interp, "bad option name \"", name, "\" ", |
︙ | ︙ | |||
2827 2828 2829 2830 2831 2832 2833 | } classNamePtr = ItclCapitalize(className); init = defaultValue; if ((newObjc > 1) && (init == NULL)) { init = Tcl_GetString(newObjv[1]); } | | < | 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 | } classNamePtr = ItclCapitalize(className); init = defaultValue; if ((newObjc > 1) && (init == NULL)) { init = Tcl_GetString(newObjv[1]); } ioptPtr = (ItclOption*)Itcl_Alloc(sizeof(ItclOption)); ioptPtr->protection = Itcl_Protection(interp, 0); if (ioptPtr->protection == ITCL_DEFAULT_PROTECT) { ioptPtr->protection = ITCL_PROTECTED; } ioptPtr->namePtr = Tcl_NewStringObj(name, -1); Tcl_IncrRefCount(ioptPtr->namePtr); ioptPtr->resourceNamePtr = Tcl_NewStringObj(resourceName, -1); |
︙ | ︙ | |||
3001 3002 3003 3004 3005 3006 3007 | Tcl_InitObjHashTable(&icPtr->keptOptions); icPtr->namePtr = componentPtr; Tcl_IncrRefCount(icPtr->namePtr); icPtr->ivPtr = ivPtr; Tcl_SetHashValue(hPtr, icPtr); ItclAddClassVariableDictInfo(interp, iclsPtr, ivPtr); } else { | | | 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 | Tcl_InitObjHashTable(&icPtr->keptOptions); icPtr->namePtr = componentPtr; Tcl_IncrRefCount(icPtr->namePtr); icPtr->ivPtr = ivPtr; Tcl_SetHashValue(hPtr, icPtr); ItclAddClassVariableDictInfo(interp, iclsPtr, ivPtr); } else { icPtr = (ItclComponent *)Tcl_GetHashValue(hPtr); } *icPtrPtr = icPtr; return TCL_OK; } /* * ------------------------------------------------------------------------ |
︙ | ︙ | |||
3449 3450 3451 3452 3453 3454 3455 | return TCL_ERROR; } hPtr = Tcl_FindHashEntry(&iclsPtr->components, (char *)componentPtr); } } if (hPtr != NULL) { | | | 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 | return TCL_ERROR; } hPtr = Tcl_FindHashEntry(&iclsPtr->components, (char *)componentPtr); } } if (hPtr != NULL) { icPtr = (ItclComponent *)Tcl_GetHashValue(hPtr); } if (*methodName != '*') { /* FIXME !!! */ /* check for locally defined method */ hPtr = NULL; if (ioPtr != NULL) { } else { |
︙ | ︙ | |||
3621 3622 3623 3624 3625 3626 3627 | /* * Make sure that the variable name does not contain anything * goofy like a "::" scope qualifier. */ if (strstr(option, "::")) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "bad option name \"", option, | | | | 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 | /* * Make sure that the variable name does not contain anything * goofy like a "::" scope qualifier. */ if (strstr(option, "::")) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "bad option name \"", option, "\", option names must not contain \"::\"", NULL); ckfree((char *)argv); return TCL_ERROR; } if (strstr(option, " ")) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "bad option name \"", option, "\", option names must not contain \" \"", NULL); ckfree((char *)argv); return TCL_ERROR; } cp = option; while (*cp) { if (isupper(UCHAR(*cp))) { Tcl_AppendResult(interp, "bad option name \"", option, "\" ", |
︙ | ︙ | |||
3743 3744 3745 3746 3747 3748 3749 | goto errorOut1; } hPtr = Tcl_FindHashEntry(&iclsPtr->components, (char *)componentPtr); } } if (hPtr != NULL) { | | | 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 | goto errorOut1; } hPtr = Tcl_FindHashEntry(&iclsPtr->components, (char *)componentPtr); } } if (hPtr != NULL) { icPtr = (ItclComponent *)Tcl_GetHashValue(hPtr); } if (*option != '*') { /* FIXME !!! */ /* check for valid option name */ if (ioPtr != NULL) { hPtr = Tcl_FindHashEntry(&ioPtr->objectOptions, (char *)optionNamePtr); |
︙ | ︙ | |||
3768 3769 3770 3771 3772 3773 3774 | if (hPtr != NULL) { Tcl_AppendResult(interp, "option \"", option, "\" has been defined locally", NULL); goto errorOut1; return TCL_ERROR; } } | < | | 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 | if (hPtr != NULL) { Tcl_AppendResult(interp, "option \"", option, "\" has been defined locally", NULL); goto errorOut1; return TCL_ERROR; } } idoPtr = (ItclDelegatedOption *)Itcl_Alloc(sizeof(ItclDelegatedOption)); Tcl_InitObjHashTable(&idoPtr->exceptions); if (*option != '*') { if (targetPtr == NULL) { targetPtr = optionNamePtr; } if (resourceNamePtr == NULL) { resourceNamePtr = Tcl_NewStringObj(option+1, -1); |
︙ | ︙ | |||
3793 3794 3795 3796 3797 3798 3799 | Tcl_IncrRefCount(idoPtr->classNamePtr); Tcl_DecrRefCount(classNamePtr); } else { idoPtr->namePtr = optionNamePtr; } Itcl_PreserveData(idoPtr); | | | 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 | Tcl_IncrRefCount(idoPtr->classNamePtr); Tcl_DecrRefCount(classNamePtr); } else { idoPtr->namePtr = optionNamePtr; } Itcl_PreserveData(idoPtr); Itcl_EventuallyFree(idoPtr, (Tcl_FreeProc *) ItclDeleteDelegatedOption); idoPtr->icPtr = icPtr; idoPtr->asPtr = targetPtr; if (idoPtr->asPtr != NULL) { Tcl_IncrRefCount(idoPtr->asPtr); } if (exceptionsPtr != NULL) { ckfree((char *)argv); |
︙ | ︙ | |||
4013 4014 4015 4016 4017 4018 4019 | hPtr = Tcl_FindHashEntry(&iclsPtr->components, (char *)componentPtr); if (hPtr == NULL) { if (ItclCreateComponent(interp, iclsPtr, componentPtr, ITCL_COMMON, &icPtr) != TCL_OK) { return TCL_ERROR; } } else { | | | 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 | hPtr = Tcl_FindHashEntry(&iclsPtr->components, (char *)componentPtr); if (hPtr == NULL) { if (ItclCreateComponent(interp, iclsPtr, componentPtr, ITCL_COMMON, &icPtr) != TCL_OK) { return TCL_ERROR; } } else { icPtr = (ItclComponent *)Tcl_GetHashValue(hPtr); } } else { icPtr = NULL; } idmPtr = (ItclDelegatedFunction *)ckalloc(sizeof(ItclDelegatedFunction)); memset(idmPtr, 0, sizeof(ItclDelegatedFunction)); Tcl_InitObjHashTable(&idmPtr->exceptions); |
︙ | ︙ | |||
4191 4192 4193 4194 4195 4196 4197 | * Make sure that the variable name does not contain anything * goofy like a "::" scope qualifier. */ namePtr = objv[1]; if (strstr(Tcl_GetString(namePtr), "::")) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "bad variable name \"", Tcl_GetString(namePtr), "\"", | | | 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 | * Make sure that the variable name does not contain anything * goofy like a "::" scope qualifier. */ namePtr = objv[1]; if (strstr(Tcl_GetString(namePtr), "::")) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "bad variable name \"", Tcl_GetString(namePtr), "\"", NULL); return TCL_ERROR; } defaultPtr = NULL; callbackPtr = NULL; for (i=2;i<objc;i++) { foundOpt = 0; |
︙ | ︙ | |||
4294 4295 4296 4297 4298 4299 4300 | } namePtr = objv[0]; if (iclsPtr->typeConstructorPtr != NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "\"", Tcl_GetString(namePtr), "\" already defined in class \"", Tcl_GetString(iclsPtr->fullNamePtr), "\"", | | | 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 | } namePtr = objv[0]; if (iclsPtr->typeConstructorPtr != NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "\"", Tcl_GetString(namePtr), "\" already defined in class \"", Tcl_GetString(iclsPtr->fullNamePtr), "\"", NULL); return TCL_ERROR; } iclsPtr->typeConstructorPtr = Tcl_NewStringObj(Tcl_GetString(objv[1]), -1); Tcl_IncrRefCount(iclsPtr->typeConstructorPtr); return TCL_OK; } |
Changes to generic/itclResolve.c.
︙ | ︙ | |||
77 78 79 80 81 82 83 | } infoPtr = (ItclObjectInfo *)Tcl_GetAssocData(interp, ITCL_INTERP_DATA, NULL); hPtr = Tcl_FindHashEntry(&infoPtr->namespaceClasses, (char *)nsPtr); if (hPtr == NULL) { return TCL_CONTINUE; } | | | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | } infoPtr = (ItclObjectInfo *)Tcl_GetAssocData(interp, ITCL_INTERP_DATA, NULL); hPtr = Tcl_FindHashEntry(&infoPtr->namespaceClasses, (char *)nsPtr); if (hPtr == NULL) { return TCL_CONTINUE; } iclsPtr = (ItclClass *)Tcl_GetHashValue(hPtr); /* * If the command is a member function */ imPtr = NULL; objPtr = Tcl_NewStringObj(name, -1); hPtr = Tcl_FindHashEntry(&iclsPtr->resolveCmds, (char *)objPtr); Tcl_DecrRefCount(objPtr); |
︙ | ︙ | |||
200 201 202 203 204 205 206 | if (isCmdDeleted) { imPtr->accessCmd = NULL; if ((flags & TCL_LEAVE_ERR_MSG) != 0) { Tcl_AppendResult(interp, "can't access \"", name, "\": deleted or redefined\n", "(use the \"body\" command to redefine methods/procs)", | | | 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | if (isCmdDeleted) { imPtr->accessCmd = NULL; if ((flags & TCL_LEAVE_ERR_MSG) != 0) { Tcl_AppendResult(interp, "can't access \"", name, "\": deleted or redefined\n", "(use the \"body\" command to redefine methods/procs)", NULL); } return TCL_ERROR; /* disallow access! */ } *rPtr = imPtr->accessCmd; return TCL_OK; } |
︙ | ︙ | |||
267 268 269 270 271 272 273 | infoPtr = (ItclObjectInfo *)Tcl_GetAssocData(interp, ITCL_INTERP_DATA, NULL); hPtr = Tcl_FindHashEntry(&infoPtr->namespaceClasses, (char *)nsPtr); if (hPtr == NULL) { return TCL_CONTINUE; } | | | 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | infoPtr = (ItclObjectInfo *)Tcl_GetAssocData(interp, ITCL_INTERP_DATA, NULL); hPtr = Tcl_FindHashEntry(&infoPtr->namespaceClasses, (char *)nsPtr); if (hPtr == NULL) { return TCL_CONTINUE; } iclsPtr = (ItclClass *)Tcl_GetHashValue(hPtr); /* * See if the variable is a known data member and accessible. */ hPtr = ItclResolveVarEntry(iclsPtr, name); if (hPtr == NULL) { return TCL_CONTINUE; |
︙ | ︙ | |||
290 291 292 293 294 295 296 | * If this is a common data member, then its variable * is easy to find. Return it directly. */ if ((vlookup->ivPtr->flags & ITCL_COMMON) != 0) { hPtr = Tcl_FindHashEntry(&vlookup->ivPtr->iclsPtr->classCommons, (char *)vlookup->ivPtr); if (hPtr != NULL) { | | | 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | * If this is a common data member, then its variable * is easy to find. Return it directly. */ if ((vlookup->ivPtr->flags & ITCL_COMMON) != 0) { hPtr = Tcl_FindHashEntry(&vlookup->ivPtr->iclsPtr->classCommons, (char *)vlookup->ivPtr); if (hPtr != NULL) { *rPtr = (Tcl_Var)Tcl_GetHashValue(hPtr); return TCL_OK; } } /* * If this is an instance variable, then we have to * find the object context, |
︙ | ︙ | |||
380 381 382 383 384 385 386 | Tcl_DStringFree(&buffer); if (varPtr != NULL) { *rPtr = varPtr; return TCL_OK; } } if (hPtr != NULL) { | | | 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 | Tcl_DStringFree(&buffer); if (varPtr != NULL) { *rPtr = varPtr; return TCL_OK; } } if (hPtr != NULL) { *rPtr = (Tcl_Var)Tcl_GetHashValue(hPtr); return TCL_OK; } return TCL_CONTINUE; } /* |
︙ | ︙ | |||
428 429 430 431 432 433 434 | infoPtr = (ItclObjectInfo *)Tcl_GetAssocData(interp, ITCL_INTERP_DATA, NULL); hPtr = Tcl_FindHashEntry(&infoPtr->namespaceClasses, (char *)nsPtr); if (hPtr == NULL) { return TCL_CONTINUE; } | | | 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 | infoPtr = (ItclObjectInfo *)Tcl_GetAssocData(interp, ITCL_INTERP_DATA, NULL); hPtr = Tcl_FindHashEntry(&infoPtr->namespaceClasses, (char *)nsPtr); if (hPtr == NULL) { return TCL_CONTINUE; } iclsPtr = (ItclClass *)Tcl_GetHashValue(hPtr); /* * Copy the name to local storage so we can NULL terminate it. * If the name is long, allocate extra space for it. */ if ((unsigned int)length < sizeof(storage)) { buffer = storage; } else { |
︙ | ︙ | |||
504 505 506 507 508 509 510 | * If this is a common data member, then the associated * variable is known directly. */ if ((vlookup->ivPtr->flags & ITCL_COMMON) != 0) { hPtr = Tcl_FindHashEntry(&vlookup->ivPtr->iclsPtr->classCommons, (char *)vlookup->ivPtr); if (hPtr != NULL) { | | | 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 | * If this is a common data member, then the associated * variable is known directly. */ if ((vlookup->ivPtr->flags & ITCL_COMMON) != 0) { hPtr = Tcl_FindHashEntry(&vlookup->ivPtr->iclsPtr->classCommons, (char *)vlookup->ivPtr); if (hPtr != NULL) { return (Tcl_Var)Tcl_GetHashValue(hPtr); } } /* * Otherwise, get the current object context and find the * variable in its data table. * |
︙ | ︙ | |||
664 665 666 667 668 669 670 | if ((vlookup->ivPtr->flags & ITCL_COMMON) == 0) { return TCL_CONTINUE; } if (!vlookup->accessible) { Tcl_AppendResult(interp, "can't access \"", name, "\": ", Itcl_ProtectionStr(vlookup->ivPtr->protection), | | < | | | | 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 | if ((vlookup->ivPtr->flags & ITCL_COMMON) == 0) { return TCL_CONTINUE; } if (!vlookup->accessible) { Tcl_AppendResult(interp, "can't access \"", name, "\": ", Itcl_ProtectionStr(vlookup->ivPtr->protection), " variable", NULL); return TCL_ERROR; } hPtr = Tcl_FindHashEntry(&vlookup->ivPtr->iclsPtr->classCommons, (char *)vlookup->ivPtr); if (!hPtr) { return TCL_CONTINUE; } *rPtr = (Tcl_Var)Tcl_GetHashValue(hPtr); return TCL_OK; } int ItclSetParserResolver( Tcl_Namespace *nsPtr) { Itcl_SetNamespaceResolvers(nsPtr, NULL, Itcl_ParseVarResolver, NULL); return TCL_OK; } |
Changes to generic/itclStubLib.c.
︙ | ︙ | |||
38 39 40 41 42 43 44 | { const char *packageName = "itcl"; const char *errMsg = NULL; ClientData clientData = NULL; const ItclStubs *stubsPtr; const ItclIntStubs *intStubsPtr; const char *actualVersion; | | | | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | { const char *packageName = "itcl"; const char *errMsg = NULL; ClientData clientData = NULL; const ItclStubs *stubsPtr; const ItclIntStubs *intStubsPtr; const char *actualVersion; actualVersion = Tcl_PkgRequireEx(interp, packageName, version, exact, &clientData); stubsPtr = (const ItclStubs *)clientData; if ((actualVersion == NULL) || (clientData == NULL)) { return NULL; } intStubsPtr = stubsPtr->hooks ? stubsPtr->hooks->itclIntStubs : NULL; if (!stubsPtr || !intStubsPtr) { |
︙ | ︙ |
Changes to generic/itclStubs.c.
︙ | ︙ | |||
81 82 83 84 85 86 87 | /* * Create a stub command with the characteristic ItclDeleteStub * procedure. That way, we can recognize this command later * on as a stub. Save the cmd token as client data, so we can * get the full name of this command later on. */ cmdPtr = Tcl_CreateObjCommand(interp, cmdName, | | | 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | /* * Create a stub command with the characteristic ItclDeleteStub * procedure. That way, we can recognize this command later * on as a stub. Save the cmd token as client data, so we can * get the full name of this command later on. */ cmdPtr = Tcl_CreateObjCommand(interp, cmdName, ItclHandleStubCmd, NULL, (Tcl_CmdDeleteProc*)ItclDeleteStub); Tcl_GetCommandInfoFromToken(cmdPtr, &cmdInfo); cmdInfo.objClientData = cmdPtr; Tcl_SetCommandInfoFromToken(cmdPtr, &cmdInfo); return TCL_OK; |
︙ | ︙ | |||
122 123 124 125 126 127 128 | if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "name"); return TCL_ERROR; } cmdName = Tcl_GetString(objv[1]); | | | 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "name"); return TCL_ERROR; } cmdName = Tcl_GetString(objv[1]); cmdPtr = Tcl_FindCommand(interp, cmdName, NULL, 0); if ((cmdPtr != NULL) && Itcl_IsStub(cmdPtr)) { Tcl_SetWideIntObj(Tcl_GetObjResult(interp), 1); } else { Tcl_SetWideIntObj(Tcl_GetObjResult(interp), 0); } return TCL_OK; |
︙ | ︙ | |||
165 166 167 168 169 170 171 | char *cmdName; int result; int loaded; int cmdlinec; ItclShowArgs(1, "ItclHandleStubCmd", objc, objv); cmdPtr = (Tcl_Command) clientData; | | | | | 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | char *cmdName; int result; int loaded; int cmdlinec; ItclShowArgs(1, "ItclHandleStubCmd", objc, objv); cmdPtr = (Tcl_Command) clientData; cmdNamePtr = Tcl_NewStringObj(NULL, 0); Tcl_IncrRefCount(cmdNamePtr); Tcl_GetCommandFullName(interp, cmdPtr, cmdNamePtr); cmdName = Tcl_GetString(cmdNamePtr); /* * Try to autoload the real command for this stub. */ objAutoLoad[0] = Tcl_NewStringObj("::auto_load", -1); objAutoLoad[1] = cmdNamePtr; result = Tcl_EvalObjv(interp, 2, objAutoLoad, 0); if (result != TCL_OK) { Tcl_DecrRefCount(cmdNamePtr); return TCL_ERROR; } objPtr = Tcl_GetObjResult(interp); result = Tcl_GetIntFromObj(interp, objPtr, &loaded); if ((result != TCL_OK) || !loaded) { Tcl_ResetResult(interp); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "can't autoload \"", cmdName, "\"", NULL); Tcl_DecrRefCount(cmdNamePtr); return TCL_ERROR; } /* * At this point, the real implementation has been loaded. * Invoke the command again with the arguments passed in. */ cmdlinePtr = Itcl_CreateArgs(interp, cmdName, objc - 1, objv + 1); (void) Tcl_ListObjGetElements(NULL, cmdlinePtr, &cmdlinec, &cmdlinev); Tcl_DecrRefCount(cmdNamePtr); Tcl_ResetResult(interp); ItclShowArgs(1, "ItclHandleStubCmd", cmdlinec - 1, cmdlinev + 1); result = Tcl_EvalObjv(interp, cmdlinec - 1, cmdlinev + 1, TCL_EVAL_DIRECT); Tcl_DecrRefCount(cmdlinePtr); |
︙ | ︙ |
Changes to generic/itclTclIntStubsFcn.c.
︙ | ︙ | |||
34 35 36 37 38 39 40 | { int code = TclCreateProc(interp, (Namespace *)nsPtr, procName, argsPtr, bodyPtr, (Proc **)procPtrPtr); (*(Proc **)procPtrPtr)->cmdPtr = NULL; return code; } | | | | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | { int code = TclCreateProc(interp, (Namespace *)nsPtr, procName, argsPtr, bodyPtr, (Proc **)procPtrPtr); (*(Proc **)procPtrPtr)->cmdPtr = NULL; return code; } Tcl_ObjCmdProc * _Tcl_GetObjInterpProc( void) { return (Tcl_ObjCmdProc *)TclGetObjInterpProc(); } void _Tcl_ProcDeleteProc( ClientData clientData) { TclProcDeleteProc(clientData); |
︙ | ︙ |
Changes to generic/itclTclIntStubsFcn.h.
︙ | ︙ | |||
21 22 23 24 25 26 27 | #define Tcl_GetObjInterpProc _Tcl_GetObjInterpProc MODULE_SCOPE Tcl_Command _Tcl_GetOriginalCommand(Tcl_Command command); MODULE_SCOPE int _Tcl_CreateProc(Tcl_Interp *interp, Tcl_Namespace *nsPtr, const char *procName, Tcl_Obj *argsPtr, Tcl_Obj *bodyPtr, Tcl_Proc *procPtrPtr); MODULE_SCOPE void _Tcl_ProcDeleteProc(ClientData clientData); | | | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #define Tcl_GetObjInterpProc _Tcl_GetObjInterpProc MODULE_SCOPE Tcl_Command _Tcl_GetOriginalCommand(Tcl_Command command); MODULE_SCOPE int _Tcl_CreateProc(Tcl_Interp *interp, Tcl_Namespace *nsPtr, const char *procName, Tcl_Obj *argsPtr, Tcl_Obj *bodyPtr, Tcl_Proc *procPtrPtr); MODULE_SCOPE void _Tcl_ProcDeleteProc(ClientData clientData); MODULE_SCOPE Tcl_ObjCmdProc *_Tcl_GetObjInterpProc(void); MODULE_SCOPE int Tcl_RenameCommand(Tcl_Interp *interp, const char *oldName, const char *newName); MODULE_SCOPE Tcl_HashTable *Itcl_GetNamespaceChildTable(Tcl_Namespace *nsPtr); MODULE_SCOPE Tcl_HashTable *Itcl_GetNamespaceCommandTable(Tcl_Namespace *nsPtr); MODULE_SCOPE int Itcl_InitRewriteEnsemble(Tcl_Interp *interp, int numRemoved, int numInserted, int objc, Tcl_Obj *const *objv); MODULE_SCOPE void Itcl_ResetRewriteEnsemble(Tcl_Interp *interp, |
︙ | ︙ |
Changes to generic/itclTestRegisterC.c.
︙ | ︙ | |||
56 57 58 59 60 61 62 | objv[1] = Tcl_NewStringObj(argv[1], -1); /* class name */ objv[2] = Tcl_NewStringObj(argv[2], -1); /* full class name */ objv[3] = Tcl_NewStringObj(argv[3], -1); /* object name */ Tcl_IncrRefCount(objv[0]); Tcl_IncrRefCount(objv[1]); Tcl_IncrRefCount(objv[2]); Tcl_IncrRefCount(objv[3]); | | | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | objv[1] = Tcl_NewStringObj(argv[1], -1); /* class name */ objv[2] = Tcl_NewStringObj(argv[2], -1); /* full class name */ objv[3] = Tcl_NewStringObj(argv[3], -1); /* object name */ Tcl_IncrRefCount(objv[0]); Tcl_IncrRefCount(objv[1]); Tcl_IncrRefCount(objv[2]); Tcl_IncrRefCount(objv[3]); infoPtr = (ItclObjectInfo *)Tcl_GetAssocData(interp, ITCL_INTERP_DATA, NULL); FOREACH_HASH_VALUE(classPtr,&infoPtr->nameClasses) { if (strcmp(Tcl_GetString(objv[1]), Tcl_GetString(classPtr->fullNamePtr)) == 0 || strcmp(Tcl_GetString(objv[2]), Tcl_GetString(classPtr->fullNamePtr)) == 0) { iclsPtr = classPtr; break; } } |
︙ | ︙ | |||
97 98 99 100 101 102 103 | ItclShowArgs(0, "cObjFunc called", objc, objv); fprintf(stderr, "objv: %d %p\n", objc, objv); for(i = 0; i<objc;i++) { fprintf(stderr, "arg:%d:%s:\n", i, Tcl_GetString(objv[i])); } nsPtr = Tcl_GetCurrentNamespace(interp); fprintf(stderr, "IP:%p %p %p !%s!\n",interp, clientData, nsPtr, nsPtr->fullName); | | | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | ItclShowArgs(0, "cObjFunc called", objc, objv); fprintf(stderr, "objv: %d %p\n", objc, objv); for(i = 0; i<objc;i++) { fprintf(stderr, "arg:%d:%s:\n", i, Tcl_GetString(objv[i])); } nsPtr = Tcl_GetCurrentNamespace(interp); fprintf(stderr, "IP:%p %p %p !%s!\n",interp, clientData, nsPtr, nsPtr->fullName); infoPtr = (ItclObjectInfo *)Tcl_GetAssocData(interp, ITCL_INTERP_DATA, NULL); FOREACH_HASH_VALUE(classPtr,&infoPtr->nameClasses) { if (strcmp(Tcl_GetString(objv[1]), Tcl_GetString(classPtr->fullNamePtr)) == 0 || strcmp(Tcl_GetString(objv[2]), Tcl_GetString(classPtr->fullNamePtr)) == 0) { iclsPtr = classPtr; break; } } |
︙ | ︙ |
Changes to generic/itclUtil.c.
︙ | ︙ | |||
25 26 27 28 29 30 31 | * ======================================================================== * Copyright (c) 1993-1998 Lucent Technologies, Inc. * ------------------------------------------------------------------------ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "itclInt.h" | < < | < | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | * ======================================================================== * Copyright (c) 1993-1998 Lucent Technologies, Inc. * ------------------------------------------------------------------------ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "itclInt.h" #include <limits.h> /* * POOL OF LIST ELEMENTS FOR LINKED LIST */ static Itcl_ListElem *listPool = NULL; static int listPoolLen = 0; |
︙ | ︙ | |||
55 56 57 58 59 60 61 | Tcl_Obj *objResult; /* result object */ char *errorInfo; /* contents of errorInfo variable */ char *errorCode; /* contents of errorCode variable */ } InterpState; #define TCL_STATE_VALID 0x01233210 /* magic bit pattern for validation */ | < < < < < | | | | | | | | | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | Tcl_Obj *objResult; /* result object */ char *errorInfo; /* contents of errorInfo variable */ char *errorCode; /* contents of errorCode variable */ } InterpState; #define TCL_STATE_VALID 0x01233210 /* magic bit pattern for validation */ /* * ------------------------------------------------------------------------ * Itcl_Assert() * * Called whenever an assert() test fails. Prints a diagnostic * message and abruptly exits. * ------------------------------------------------------------------------ */ void Itcl_Assert( const char *testExpr, /* string representing test expression */ const char *fileName, /* file name containing this call */ int lineNumber) /* line number containing this call */ { Tcl_Panic("Itcl Assertion failed: \"%s\" (line %d of %s)", testExpr, lineNumber, fileName); } /* * ------------------------------------------------------------------------ * Itcl_InitStack() * * Initializes a stack structure, allocating a certain amount of memory * for the stack and setting the stack length to zero. * ------------------------------------------------------------------------ */ void Itcl_InitStack( Itcl_Stack *stack) /* stack to be initialized */ { stack->values = stack->space; stack->max = sizeof(stack->space)/sizeof(ClientData); stack->len = 0; } /* * ------------------------------------------------------------------------ * Itcl_DeleteStack() * * Destroys a stack structure, freeing any memory that may have been * allocated to represent it. * ------------------------------------------------------------------------ */ void Itcl_DeleteStack( Itcl_Stack *stack) /* stack to be deleted */ { /* * If memory was explicitly allocated (instead of using the * built-in buffer) then free it. */ if (stack->values != stack->space) { ckfree((char*)stack->values); |
︙ | ︙ | |||
131 132 133 134 135 136 137 | * Itcl_PushStack() * * Pushes a piece of client data onto the top of the given stack. * If the stack is not large enough, it is automatically resized. * ------------------------------------------------------------------------ */ void | | | | | 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | * Itcl_PushStack() * * Pushes a piece of client data onto the top of the given stack. * If the stack is not large enough, it is automatically resized. * ------------------------------------------------------------------------ */ void Itcl_PushStack( ClientData cdata, /* data to be pushed onto stack */ Itcl_Stack *stack) /* stack */ { ClientData *newStack; if (stack->len+1 >= stack->max) { stack->max = 2*stack->max; newStack = (ClientData*) ckalloc((unsigned)(stack->max*sizeof(ClientData))); |
︙ | ︙ | |||
162 163 164 165 166 167 168 | * ------------------------------------------------------------------------ * Itcl_PopStack() * * Pops a bit of client data from the top of the given stack. * ------------------------------------------------------------------------ */ ClientData | | | | | | | | | | | | | | | | 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | * ------------------------------------------------------------------------ * Itcl_PopStack() * * Pops a bit of client data from the top of the given stack. * ------------------------------------------------------------------------ */ ClientData Itcl_PopStack( Itcl_Stack *stack) /* stack to be manipulated */ { if (stack->values && (stack->len > 0)) { stack->len--; return stack->values[stack->len]; } return NULL; } /* * ------------------------------------------------------------------------ * Itcl_PeekStack() * * Gets the current value from the top of the given stack. * ------------------------------------------------------------------------ */ ClientData Itcl_PeekStack( Itcl_Stack *stack) /* stack to be examined */ { if (stack->values && (stack->len > 0)) { return stack->values[stack->len-1]; } return NULL; } /* * ------------------------------------------------------------------------ * Itcl_GetStackValue() * * Gets a value at some index within the stack. Index "0" is the * first value pushed onto the stack. * ------------------------------------------------------------------------ */ ClientData Itcl_GetStackValue( Itcl_Stack *stack, /* stack to be examined */ int pos) /* get value at this index */ { if (stack->values && (stack->len > 0)) { assert(pos < stack->len); return stack->values[pos]; } return NULL; } /* * ------------------------------------------------------------------------ * Itcl_InitList() * * Initializes a linked list structure, setting the list to the empty * state. * ------------------------------------------------------------------------ */ void Itcl_InitList( Itcl_List *listPtr) /* list to be initialized */ { listPtr->validate = ITCL_VALID_LIST; listPtr->num = 0; listPtr->head = NULL; listPtr->tail = NULL; } /* * ------------------------------------------------------------------------ * Itcl_DeleteList() * * Destroys a linked list structure, deleting all of its elements and * setting it to an empty state. If the elements have memory associated * with them, this memory must be freed before deleting the list or it * will be lost. * ------------------------------------------------------------------------ */ void Itcl_DeleteList( Itcl_List *listPtr) /* list to be deleted */ { Itcl_ListElem *elemPtr; assert(listPtr->validate == ITCL_VALID_LIST); elemPtr = listPtr->head; while (elemPtr) { |
︙ | ︙ | |||
294 295 296 297 298 299 300 | * * Destroys a single element in a linked list, returning it to a pool of * elements that can be later reused. Returns a pointer to the next * element in the list. * ------------------------------------------------------------------------ */ Itcl_ListElem* | | | | 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | * * Destroys a single element in a linked list, returning it to a pool of * elements that can be later reused. Returns a pointer to the next * element in the list. * ------------------------------------------------------------------------ */ Itcl_ListElem* Itcl_DeleteListElem( Itcl_ListElem *elemPtr) /* list element to be deleted */ { Itcl_List *listPtr; Itcl_ListElem *nextPtr; nextPtr = elemPtr->next; if (elemPtr->prev) { |
︙ | ︙ | |||
338 339 340 341 342 343 344 | * * Creates a new list element containing the given value and returns * a pointer to it. The element is inserted at the beginning of the * specified list. * ------------------------------------------------------------------------ */ Itcl_ListElem* | | | | | 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | * * Creates a new list element containing the given value and returns * a pointer to it. The element is inserted at the beginning of the * specified list. * ------------------------------------------------------------------------ */ Itcl_ListElem* Itcl_InsertList( Itcl_List *listPtr, /* list being modified */ ClientData val) /* value associated with new element */ { Itcl_ListElem *elemPtr; assert(listPtr->validate == ITCL_VALID_LIST); elemPtr = Itcl_CreateListElem(listPtr); elemPtr->value = val; |
︙ | ︙ | |||
372 373 374 375 376 377 378 | * * Creates a new list element containing the given value and returns * a pointer to it. The element is inserted in the list just before * the specified element. * ------------------------------------------------------------------------ */ Itcl_ListElem* | | | | | 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 | * * Creates a new list element containing the given value and returns * a pointer to it. The element is inserted in the list just before * the specified element. * ------------------------------------------------------------------------ */ Itcl_ListElem* Itcl_InsertListElem( Itcl_ListElem *pos, /* insert just before this element */ ClientData val) /* value associated with new element */ { Itcl_List *listPtr; Itcl_ListElem *elemPtr; listPtr = pos->owner; assert(listPtr->validate == ITCL_VALID_LIST); assert(pos != NULL); |
︙ | ︙ | |||
414 415 416 417 418 419 420 | * * Creates a new list element containing the given value and returns * a pointer to it. The element is appended at the end of the * specified list. * ------------------------------------------------------------------------ */ Itcl_ListElem* | | | | | 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | * * Creates a new list element containing the given value and returns * a pointer to it. The element is appended at the end of the * specified list. * ------------------------------------------------------------------------ */ Itcl_ListElem* Itcl_AppendList( Itcl_List *listPtr, /* list being modified */ ClientData val) /* value associated with new element */ { Itcl_ListElem *elemPtr; assert(listPtr->validate == ITCL_VALID_LIST); elemPtr = Itcl_CreateListElem(listPtr); elemPtr->value = val; |
︙ | ︙ | |||
448 449 450 451 452 453 454 | * * Creates a new list element containing the given value and returns * a pointer to it. The element is inserted in the list just after * the specified element. * ------------------------------------------------------------------------ */ Itcl_ListElem* | | | | | 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 | * * Creates a new list element containing the given value and returns * a pointer to it. The element is inserted in the list just after * the specified element. * ------------------------------------------------------------------------ */ Itcl_ListElem* Itcl_AppendListElem( Itcl_ListElem *pos, /* insert just after this element */ ClientData val) /* value associated with new element */ { Itcl_List *listPtr; Itcl_ListElem *elemPtr; listPtr = pos->owner; assert(listPtr->validate == ITCL_VALID_LIST); assert(pos != NULL); |
︙ | ︙ | |||
488 489 490 491 492 493 494 | * ------------------------------------------------------------------------ * Itcl_SetListValue() * * Modifies the value associated with a list element. * ------------------------------------------------------------------------ */ void | | | | | | | | | | > > > > | > > | < < | | | < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | > < < < | > > > > | < | | | < < | < < < | < | | > | > | > | | | > > | < | | | | | < < < | | | | | | | | | 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 | * ------------------------------------------------------------------------ * Itcl_SetListValue() * * Modifies the value associated with a list element. * ------------------------------------------------------------------------ */ void Itcl_SetListValue( Itcl_ListElem *elemPtr, /* list element being modified */ ClientData val) /* new value associated with element */ { assert(elemPtr != NULL); assert(elemPtr->owner->validate == ITCL_VALID_LIST); elemPtr->value = val; } /* * ------------------------------------------------------------------------ * Itcl_FinishList() * * free all memory used in the list pool * ------------------------------------------------------------------------ */ void Itcl_FinishList() { Itcl_ListElem *listPtr; Itcl_ListElem *elemPtr; listPtr = listPool; while (listPtr != NULL) { elemPtr = listPtr; listPtr = elemPtr->next; ckfree((char *)elemPtr); elemPtr = NULL; } listPool = NULL; listPoolLen = 0; } /* * ======================================================================== * REFERENCE-COUNTED DATA * * The following procedures manage generic reference-counted data. * They are similar in spirit to the Tcl_Preserve/Tcl_Release * procedures defined in the Tcl/Tk core. But these procedures attach a * refcount directly to the allocated memory, and then use it to govern * shared access and properly timed release. */ typedef struct PresMemoryPrefix { Tcl_FreeProc *freeProc; /* called by last Itcl_ReleaseData */ size_t refCount; /* refernce (resp preserving) counter */ } PresMemoryPrefix; /* * ------------------------------------------------------------------------ * Itcl_EventuallyFree() * * Asscociates with cdata (allocated by Itcl_Alloc()) a routine to * be called when cdata should be freed. This routine will be called * when the number of Itcl_ReleaseData() calls on cdata matches the * number of Itcl_PreserveData() calls on cdata. * ------------------------------------------------------------------------ */ void Itcl_EventuallyFree( ClientData cdata, /* data to be freed when not in use */ Tcl_FreeProc *fproc) /* procedure called to free data */ { PresMemoryPrefix *blk; if (cdata == NULL) { return; } /* Itcl memory block to ckalloc block */ blk = ((PresMemoryPrefix *)cdata)-1; /* Set new free proc */ blk->freeProc = fproc; } /* * ------------------------------------------------------------------------ * Itcl_PreserveData() * * Increases the usage count for a piece of data that will be freed * later when no longer needed. Each call to Itcl_PreserveData() * puts one claim on a piece of data, and subsequent calls to * Itcl_ReleaseData() remove those claims. When Itcl_EventuallyFree() * is called, and when the usage count reaches zero, the data is * freed. * ------------------------------------------------------------------------ */ void Itcl_PreserveData( ClientData cdata) /* data to be preserved */ { PresMemoryPrefix *blk; if (cdata == NULL) { return; } /* Itcl memory block to ckalloc block */ blk = ((PresMemoryPrefix *)cdata)-1; /* Increment preservation count */ ++blk->refCount; } /* * ------------------------------------------------------------------------ * Itcl_ReleaseData() * * Decreases the usage count for a piece of data that was registered * previously via Itcl_PreserveData(). After Itcl_EventuallyFree() * is called and the usage count reaches zero, the data is * automatically freed. * ------------------------------------------------------------------------ */ void Itcl_ReleaseData( ClientData cdata) /* data to be released */ { PresMemoryPrefix *blk; Tcl_FreeProc *freeProc; if (cdata == NULL) { return; } /* Itcl memory block to ckalloc block */ blk = ((PresMemoryPrefix *)cdata)-1; /* Usage sanity check */ assert(blk->refCount != 0); /* must call Itcl_PreserveData() first */ assert(blk->freeProc); /* must call Itcl_EventuallyFree() first */ /* Decrement preservation count */ if (--blk->refCount) { return; } /* Free cdata now */ freeProc = blk->freeProc; blk->freeProc = NULL; freeProc(cdata); } /* * ------------------------------------------------------------------------ * Itcl_Alloc() * * Allocate preservable memory. In opposite to ckalloc the result can be * supplied to preservation facilities of Itcl (Itcl_PreserveData). * * Results: * Pointer to new allocated memory. * ------------------------------------------------------------------------ */ void * Itcl_Alloc( size_t size) /* Size of memory to allocate */ { size_t numBytes; PresMemoryPrefix *blk; /* The ckalloc() in Tcl 8 can alloc at most UINT_MAX bytes */ assert (size <= UINT_MAX - sizeof(PresMemoryPrefix)); numBytes = size + sizeof(PresMemoryPrefix); /* This will panic on allocation failure. No need to check return value. */ blk = (PresMemoryPrefix *)ckalloc(numBytes); /* Itcl_Alloc defined to zero-init memory it allocates */ memset(blk, 0, numBytes); /* ckalloc block to Itcl memory block */ return blk+1; } /* * ------------------------------------------------------------------------ * ItclFree() * * Release memory allocated by Itcl_Alloc() that was never preserved. * * Results: * None. * * ------------------------------------------------------------------------ */ void Itcl_Free(void *ptr) { PresMemoryPrefix *blk; if (ptr == NULL) { return; } /* Itcl memory block to ckalloc block */ blk = ((PresMemoryPrefix *)ptr)-1; assert(blk->refCount == 0); /* it should be not preserved */ assert(blk->freeProc == NULL); /* it should be released */ ckfree(blk); } /* * ------------------------------------------------------------------------ * Itcl_SaveInterpState() * * Takes a snapshot of the current result state of the interpreter. * The snapshot can be restored at any point by Itcl_RestoreInterpState. * So if you are in the middle of building a return result, you can * snapshot the interpreter, execute a command that might generate an * error, restore the snapshot, and continue building the result string. * * Once a snapshot is saved, it must be restored by calling * Itcl_RestoreInterpState, or discarded by calling * Itcl_DiscardInterpState. Otherwise, memory will be leaked. * * Returns a token representing the state of the interpreter. * ------------------------------------------------------------------------ */ Itcl_InterpState Itcl_SaveInterpState( Tcl_Interp* interp, /* interpreter being modified */ int status) /* integer status code for current operation */ { return (Itcl_InterpState) Tcl_SaveInterpState(interp, status); } /* * ------------------------------------------------------------------------ * Itcl_RestoreInterpState() * * Restores the state of the interpreter to a snapshot taken by * Itcl_SaveInterpState. This affects variables such as "errorInfo" * and "errorCode". After this call, the token for the interpreter * state is no longer valid. * * Returns the status code that was pending at the time the state was * captured. * ------------------------------------------------------------------------ */ int Itcl_RestoreInterpState( Tcl_Interp* interp, /* interpreter being modified */ Itcl_InterpState state) /* token representing interpreter state */ { return Tcl_RestoreInterpState(interp, (Tcl_InterpState)state); } /* * ------------------------------------------------------------------------ * Itcl_DiscardInterpState() * * Frees the memory associated with an interpreter snapshot taken by * Itcl_SaveInterpState. If the snapshot is not restored, this * procedure must be called to discard it, or the memory will be lost. * After this call, the token for the interpreter state is no longer * valid. * ------------------------------------------------------------------------ */ void Itcl_DiscardInterpState( Itcl_InterpState state) /* token representing interpreter state */ { Tcl_DiscardInterpState((Tcl_InterpState)state); return; } /* * ------------------------------------------------------------------------ |
︙ | ︙ | |||
922 923 924 925 926 927 928 | * If the specified level is 0, then this procedure returns the * current value without changing it. Otherwise, it sets the current * value to the specified protection level, and returns the previous * value. * ------------------------------------------------------------------------ */ int | | | | | | 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 | * If the specified level is 0, then this procedure returns the * current value without changing it. Otherwise, it sets the current * value to the specified protection level, and returns the previous * value. * ------------------------------------------------------------------------ */ int Itcl_Protection( Tcl_Interp *interp, /* interpreter being queried */ int newLevel) /* new protection level or 0 */ { int oldVal; ItclObjectInfo *infoPtr; /* * If a new level was specified, then set the protection level. * In any case, return the protection level as it stands right now. */ infoPtr = (ItclObjectInfo*) Tcl_GetAssocData(interp, ITCL_INTERP_DATA, NULL); assert(infoPtr != NULL); oldVal = infoPtr->protection; if (newLevel != 0) { assert(newLevel == ITCL_PUBLIC || newLevel == ITCL_PROTECTED || |
︙ | ︙ | |||
975 976 977 978 979 980 981 | void Itcl_ParseNamespPath( const char *name, /* path name to class member */ Tcl_DString *buffer, /* dynamic string buffer (uninitialized) */ const char **head, /* returns "namesp::namesp::namesp" part */ const char **tail) /* returns "element" part */ { | | | 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 | void Itcl_ParseNamespPath( const char *name, /* path name to class member */ Tcl_DString *buffer, /* dynamic string buffer (uninitialized) */ const char **head, /* returns "namesp::namesp::namesp" part */ const char **tail) /* returns "element" part */ { char *sep, *newname; Tcl_DStringInit(buffer); /* * Copy the name into the buffer and parse it. Look * backward from the end of the string to the first '::' * scope qualifier. |
︙ | ︙ | |||
1071 1072 1073 1074 1075 1076 1077 | if (Itcl_IsClassNamespace(fromNsPtr)) { entry = Tcl_FindHashEntry(&iclsPtr->infoPtr->namespaceClasses, fromNsPtr); if (entry == NULL) { return 0; } | | | 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 | if (Itcl_IsClassNamespace(fromNsPtr)) { entry = Tcl_FindHashEntry(&iclsPtr->infoPtr->namespaceClasses, fromNsPtr); if (entry == NULL) { return 0; } fromIclsPtr = (ItclClass *)Tcl_GetHashValue(entry); entry = Tcl_FindHashEntry(&fromIclsPtr->heritage, (char*)iclsPtr); if (entry) { return 1; } |
︙ | ︙ | |||
1154 1155 1156 1157 1158 1159 1160 | iclsPtr = imPtr->iclsPtr; hPtr = Tcl_FindHashEntry(&iclsPtr->infoPtr->namespaceClasses, (char *)fromNsPtr); if (hPtr == NULL) { return 0; } | | | 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 | iclsPtr = imPtr->iclsPtr; hPtr = Tcl_FindHashEntry(&iclsPtr->infoPtr->namespaceClasses, (char *)fromNsPtr); if (hPtr == NULL) { return 0; } fromIclsPtr = (ItclClass *)Tcl_GetHashValue(hPtr); if (Tcl_FindHashEntry(&iclsPtr->heritage, (char*)fromIclsPtr)) { entry = Tcl_FindHashEntry(&fromIclsPtr->resolveCmds, (char *)imPtr->namePtr); if (entry) { ItclCmdLookup *clookup; |
︙ | ︙ | |||
1206 1207 1208 1209 1210 1211 1212 | Tcl_Namespace *nsPtr; char *cmdName; const char *pos; const char **listv; int listc; int result; int len; | | | | | | < < < < < < < < < < < < < < < < < < < | 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 | Tcl_Namespace *nsPtr; char *cmdName; const char *pos; const char **listv; int listc; int result; int len; nsPtr = NULL; len = strlen(name); cmdName = (char *)ckalloc(strlen(name)+1); strcpy(cmdName, name); if ((*name == 'n') && (len > 17) && (strncmp(name, "namespace", 9) == 0)) { for (pos = (name + 9); (*pos == ' '); pos++) { /* empty body: skip over spaces */ } if ((*pos == 'i') && ((pos + 7) <= (name + len)) && (strncmp(pos, "inscope", 7) == 0)) { result = Tcl_SplitList(interp, (const char *)name, &listc, &listv); if (result == TCL_OK) { if (listc != 4) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "malformed command \"", name, "\": should be \"", "namespace inscope namesp command\"", NULL); result = TCL_ERROR; } else { nsPtr = Tcl_FindNamespace(interp, listv[2], NULL, TCL_LEAVE_ERR_MSG); if (nsPtr == NULL) { result = TCL_ERROR; } else { ckfree(cmdName); cmdName = (char *)ckalloc(strlen(listv[3])+1); strcpy(cmdName, listv[3]); } } } ckfree((char*)listv); if (result != TCL_OK) { Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( "\n (while decoding scoped command \"%s\")", name)); ckfree(cmdName); return TCL_ERROR; } } } *rNsPtr = nsPtr; *rCmdPtr = cmdName; return TCL_OK; } |
Changes to itclConfig.sh.in.
1 | # itclConfig.sh -- | | | 1 2 3 4 5 6 7 8 9 | # itclConfig.sh -- # # This shell script (for sh) is generated automatically by Itcl's # configure script. It will create shell variables for most of # the configuration options discovered by the configure script. # This script is intended to be included by the configure scripts # for Itcl extensions so that they don't have to figure this all # out for themselves. This file does not duplicate information # already provided by tclConfig.sh, so you may need to use that |
︙ | ︙ |
Changes to itclWidget/configure.
︙ | ︙ | |||
636 637 638 639 640 641 642 | SHLIB_LD_LIBS SHLIB_LD STLIB_LD CFLAGS_WARNING CFLAGS_OPTIMIZE CFLAGS_DEBUG RC | < | 636 637 638 639 640 641 642 643 644 645 646 647 648 649 | SHLIB_LD_LIBS SHLIB_LD STLIB_LD CFLAGS_WARNING CFLAGS_OPTIMIZE CFLAGS_DEBUG RC AR STUBS_BUILD SHARED_BUILD TCL_THREADS ITCL_TOP_DIR_NATIVE ITCL_INCLUDES TK_INCLUDES |
︙ | ︙ | |||
767 768 769 770 771 772 773 | with_itclinclude enable_threads enable_shared enable_stubs enable_64bit enable_64bit_vis enable_rpath | < < | 766 767 768 769 770 771 772 773 774 775 776 777 778 779 | with_itclinclude enable_threads enable_shared enable_stubs enable_64bit enable_64bit_vis enable_rpath enable_symbols ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS |
︙ | ︙ | |||
1389 1390 1391 1392 1393 1394 1395 | esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] | | < < | 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 | esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-threads build with threads (default: on) --enable-shared build and link with shared libraries (default: on) --enable-stubs build and link with stub libraries. Always true for shared builds (default: on) --enable-64bit enable 64bit support (default: off) --enable-64bit-vis enable 64bit Sparc VIS support (default: off) --disable-rpath disable rpath support (default: on) --enable-symbols build with debugging symbols (default: off) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-tcl directory containing tcl configuration (tclConfig.sh) --with-tk directory containing tk configuration (tkConfig.sh) --with-itcl directory containing itcl configuration (itclConfig.sh) --with-tclinclude directory containing the public Tcl header files --with-tkinclude directory containing the public Tk header files --with-itclinclude directory containing the public Itcl header files Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a nonstandard directory <lib dir> LIBS libraries to pass to the linker, e.g. -l<library> |
︙ | ︙ | |||
2208 2209 2210 2211 2212 2213 2214 | #-------------------------------------------------------------------- # Call TEA_INIT as the first TEA_ macro to set up initial vars. # This will define a ${TEA_PLATFORM} variable == "unix" or "windows" # as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE. #-------------------------------------------------------------------- | < < | | | < < < < < < < | < | | 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 | #-------------------------------------------------------------------- # Call TEA_INIT as the first TEA_ macro to set up initial vars. # This will define a ${TEA_PLATFORM} variable == "unix" or "windows" # as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE. #-------------------------------------------------------------------- TEA_VERSION="3.13" { $as_echo "$as_me:${as_lineno-$LINENO}: checking TEA configuration" >&5 $as_echo_n "checking TEA configuration... " >&6; } if test x"${PACKAGE_NAME}" = x ; then as_fn_error $? " The PACKAGE_NAME variable must be defined by your TEA configure.ac" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok (TEA ${TEA_VERSION})" >&5 $as_echo "ok (TEA ${TEA_VERSION})" >&6; } # If the user did not set CFLAGS, set it now to keep macros # like AC_PROG_CC and AC_TRY_COMPILE from adding "-g -O2". if test "${CFLAGS+set}" != "set" ; then CFLAGS="" fi case "`uname -s`" in *win32*|*WIN32*|*MINGW32_*|*MINGW64_*|*MSYS_*) # Extract the first word of "cygpath", so it can be a program name with args. set dummy cygpath; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CYGPATH+:} false; then : $as_echo_n "(cached) " >&6 else |
︙ | ︙ | |||
2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 | # on Darwin, check in Framework installation locations if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tclconfig}" = x ; then for i in `ls -d ~/Library/Frameworks 2>/dev/null` \ `ls -d /Library/Frameworks 2>/dev/null` \ `ls -d /Network/Library/Frameworks 2>/dev/null` \ `ls -d /System/Library/Frameworks 2>/dev/null` \ ; do if test -f "$i/Tcl.framework/tclConfig.sh" ; then ac_cv_c_tclconfig="`(cd $i/Tcl.framework; pwd)`" break fi done fi | > > > | 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 | # on Darwin, check in Framework installation locations if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tclconfig}" = x ; then for i in `ls -d ~/Library/Frameworks 2>/dev/null` \ `ls -d /Library/Frameworks 2>/dev/null` \ `ls -d /Network/Library/Frameworks 2>/dev/null` \ `ls -d /System/Library/Frameworks 2>/dev/null` \ `ls -d /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/Library/Frameworks/Tcl.framework 2>/dev/null` \ `ls -d /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/Network/Library/Frameworks/Tcl.framework 2>/dev/null` \ `ls -d /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tcl.framework 2>/dev/null` \ ; do if test -f "$i/Tcl.framework/tclConfig.sh" ; then ac_cv_c_tclconfig="`(cd $i/Tcl.framework; pwd)`" break fi done fi |
︙ | ︙ | |||
2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 | # check in a few common install locations if test x"${ac_cv_c_tclconfig}" = x ; then for i in `ls -d ${libdir} 2>/dev/null` \ `ls -d ${exec_prefix}/lib 2>/dev/null` \ `ls -d ${prefix}/lib 2>/dev/null` \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ `ls -d /usr/lib64 2>/dev/null` \ `ls -d /usr/lib/tcl8.6 2>/dev/null` \ `ls -d /usr/lib/tcl8.5 2>/dev/null` \ ; do if test -f "$i/tclConfig.sh" ; then ac_cv_c_tclconfig="`(cd $i; pwd)`" break fi done fi | > > > > > | 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 | # check in a few common install locations if test x"${ac_cv_c_tclconfig}" = x ; then for i in `ls -d ${libdir} 2>/dev/null` \ `ls -d ${exec_prefix}/lib 2>/dev/null` \ `ls -d ${prefix}/lib 2>/dev/null` \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/pkg/lib 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ `ls -d /usr/lib64 2>/dev/null` \ `ls -d /usr/lib/tcl8.6 2>/dev/null` \ `ls -d /usr/lib/tcl8.5 2>/dev/null` \ `ls -d /usr/local/lib/tcl8.6 2>/dev/null` \ `ls -d /usr/local/lib/tcl8.5 2>/dev/null` \ `ls -d /usr/local/lib/tcl/tcl8.6 2>/dev/null` \ `ls -d /usr/local/lib/tcl/tcl8.5 2>/dev/null` \ ; do if test -f "$i/tclConfig.sh" ; then ac_cv_c_tclconfig="`(cd $i; pwd)`" break fi done fi |
︙ | ︙ | |||
3409 3410 3411 3412 3413 3414 3415 | ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : | > | | 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 | ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # first test we've already retrieved platform (cross-compile), fallback to unix otherwise: TEA_PLATFORM="${TEA_PLATFORM-unix}" CYGPATH=echo else TEA_PLATFORM="windows" # Extract the first word of "cygpath", so it can be a program name with args. set dummy cygpath; ac_word=$2 |
︙ | ︙ | |||
3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 | # on Darwin, check in Framework installation locations if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tkconfig}" = x ; then for i in `ls -d ~/Library/Frameworks 2>/dev/null` \ `ls -d /Library/Frameworks 2>/dev/null` \ `ls -d /Network/Library/Frameworks 2>/dev/null` \ `ls -d /System/Library/Frameworks 2>/dev/null` \ ; do if test -f "$i/Tk.framework/tkConfig.sh" ; then ac_cv_c_tkconfig="`(cd $i/Tk.framework; pwd)`" break fi done fi # check in a few common install locations if test x"${ac_cv_c_tkconfig}" = x ; then for i in `ls -d ${libdir} 2>/dev/null` \ `ls -d ${exec_prefix}/lib 2>/dev/null` \ `ls -d ${prefix}/lib 2>/dev/null` \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ `ls -d /usr/lib64 2>/dev/null` \ ; do if test -f "$i/tkConfig.sh" ; then ac_cv_c_tkconfig="`(cd $i; pwd)`" break fi done fi | > > > > > > > > > > | 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 | # on Darwin, check in Framework installation locations if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tkconfig}" = x ; then for i in `ls -d ~/Library/Frameworks 2>/dev/null` \ `ls -d /Library/Frameworks 2>/dev/null` \ `ls -d /Network/Library/Frameworks 2>/dev/null` \ `ls -d /System/Library/Frameworks 2>/dev/null` \ `ls -d /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/Library/Frameworks/Tcl.framework 2>/dev/null` \ `ls -d /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/Network/Library/Frameworks/Tcl.framework 2>/dev/null` \ `ls -d /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tcl.framework 2>/dev/null` \ ; do if test -f "$i/Tk.framework/tkConfig.sh" ; then ac_cv_c_tkconfig="`(cd $i/Tk.framework; pwd)`" break fi done fi # check in a few common install locations if test x"${ac_cv_c_tkconfig}" = x ; then for i in `ls -d ${libdir} 2>/dev/null` \ `ls -d ${exec_prefix}/lib 2>/dev/null` \ `ls -d ${prefix}/lib 2>/dev/null` \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/pkg/lib 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ `ls -d /usr/lib64 2>/dev/null` \ `ls -d /usr/lib/tk8.6 2>/dev/null` \ `ls -d /usr/lib/tk8.5 2>/dev/null` \ `ls -d /usr/local/lib/tk8.6 2>/dev/null` \ `ls -d /usr/local/lib/tk8.5 2>/dev/null` \ `ls -d /usr/local/lib/tcl/tk8.6 2>/dev/null` \ `ls -d /usr/local/lib/tcl/tk8.5 2>/dev/null` \ ; do if test -f "$i/tkConfig.sh" ; then ac_cv_c_tkconfig="`(cd $i; pwd)`" break fi done fi |
︙ | ︙ | |||
3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 | # check in a few common install locations if test x"${ac_cv_c_itclconfig}" = x ; then for i in `ls -d ${libdir} 2>/dev/null` \ `ls -d ${exec_prefix}/lib 2>/dev/null` \ `ls -d ${prefix}/lib 2>/dev/null` \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ `ls -d /usr/lib64 2>/dev/null` \ ; do if test -f "$i/itclConfig.sh" ; then ac_cv_c_itclconfig=`(cd $i; pwd)` break fi | > | 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 | # check in a few common install locations if test x"${ac_cv_c_itclconfig}" = x ; then for i in `ls -d ${libdir} 2>/dev/null` \ `ls -d ${exec_prefix}/lib 2>/dev/null` \ `ls -d ${prefix}/lib 2>/dev/null` \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/pkg/lib 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ `ls -d /usr/lib64 2>/dev/null` \ ; do if test -f "$i/itclConfig.sh" ; then ac_cv_c_itclconfig=`(cd $i; pwd)` break fi |
︙ | ︙ | |||
5837 5838 5839 5840 5841 5842 5843 | _ACEOF fi done | < < < < | 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 | _ACEOF fi done fi #----------------------------------------------------------------------- # __CHANGE__ # Specify the C source files to compile in TEA_ADD_SOURCES, # public headers that need to be installed in TEA_ADD_HEADERS, |
︙ | ︙ | |||
6727 6728 6729 6730 6731 6732 6733 | Building ${PACKAGE_NAME} without threads enabled, but building against Tcl that IS thread-enabled. It is recommended to use --enable-threads." >&5 $as_echo "$as_me: WARNING: Building ${PACKAGE_NAME} without threads enabled, but building against Tcl that IS thread-enabled. It is recommended to use --enable-threads." >&2;} fi ;; | < < < < < < < < < < < < | 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 | Building ${PACKAGE_NAME} without threads enabled, but building against Tcl that IS thread-enabled. It is recommended to use --enable-threads." >&5 $as_echo "$as_me: WARNING: Building ${PACKAGE_NAME} without threads enabled, but building against Tcl that IS thread-enabled. It is recommended to use --enable-threads." >&2;} fi ;; esac #-------------------------------------------------------------------- # The statement below defines a collection of symbols related to # building as a shared library instead of a static library. |
︙ | ︙ | |||
7010 7011 7012 7013 7014 7015 7016 | else doRpath=yes fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $doRpath" >&5 $as_echo "$doRpath" >&6; } | < < < < < < < < < < < < < < < < < < | 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 | else doRpath=yes fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $doRpath" >&5 $as_echo "$doRpath" >&6; } # Set the variable "system" to hold the name and version number # for the system. { $as_echo "$as_me:${as_lineno-$LINENO}: checking system version" >&5 $as_echo_n "checking system version... " >&6; } if ${tcl_cv_sys_version+:} false; then : |
︙ | ︙ | |||
7229 7230 7231 7232 7233 7234 7235 | else { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using 64-bit $MACHINE mode" >&5 $as_echo " Using 64-bit $MACHINE mode" >&6; } do64bit_ok="yes" fi fi | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 | else { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using 64-bit $MACHINE mode" >&5 $as_echo " Using 64-bit $MACHINE mode" >&6; } do64bit_ok="yes" fi fi if test "$GCC" != "yes" ; then if test "${SHARED_BUILD}" = "0" ; then runtime=-MT else runtime=-MD fi case "x`echo \${VisualStudioVersion}`" in |
︙ | ︙ | |||
7394 7395 7396 7397 7398 7399 7400 | # Convert foo.lib to -lfoo for GCC. No-op if not *.lib i=`echo "$i" | sed -e 's/^\([^-].*\)\.lib$/-l\1/i'` fi PKG_LIBS="$PKG_LIBS $i" done | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 | # Convert foo.lib to -lfoo for GCC. No-op if not *.lib i=`echo "$i" | sed -e 's/^\([^-].*\)\.lib$/-l\1/i'` fi PKG_LIBS="$PKG_LIBS $i" done else RC="rc" lflags="${lflags} -nologo" LINKBIN="link" CFLAGS_DEBUG="-nologo -Z7 -Od -W3 -WX ${runtime}d" CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}" fi |
︙ | ︙ | |||
7604 7605 7606 7607 7608 7609 7610 | # For information on what debugtype is most useful, see: # http://msdn.microsoft.com/library/en-us/dnvc60/html/gendepdebug.asp # and also # http://msdn2.microsoft.com/en-us/library/y0zzbyt4%28VS.80%29.aspx # This essentially turns it all on. LDFLAGS_DEBUG="-debug -debugtype:cv" LDFLAGS_OPTIMIZE="-release" | < < < < | | < | 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 | # For information on what debugtype is most useful, see: # http://msdn.microsoft.com/library/en-us/dnvc60/html/gendepdebug.asp # and also # http://msdn2.microsoft.com/en-us/library/y0zzbyt4%28VS.80%29.aspx # This essentially turns it all on. LDFLAGS_DEBUG="-debug -debugtype:cv" LDFLAGS_OPTIMIZE="-release" LDFLAGS_CONSOLE="-link -subsystem:console ${lflags}" LDFLAGS_WINDOW="-link -subsystem:windows ${lflags}" fi SHLIB_SUFFIX=".dll" SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.dll' TCL_LIB_VERSIONS_OK=nodots ;; |
︙ | ︙ | |||
7768 7769 7770 7771 7772 7773 7774 | CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; Haiku*) LDFLAGS="$LDFLAGS -Wl,--export-dynamic" SHLIB_CFLAGS="-fPIC" SHLIB_SUFFIX=".so" | | | 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 | CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; Haiku*) LDFLAGS="$LDFLAGS -Wl,--export-dynamic" SHLIB_CFLAGS="-fPIC" SHLIB_SUFFIX=".so" SHLIB_LD='${CC} ${CFLAGS} ${LDFLAGS} -shared' { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_ntoa in -lnetwork" >&5 $as_echo_n "checking for inet_ntoa in -lnetwork... " >&6; } if ${ac_cv_lib_network_inet_ntoa+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnetwork $LIBS" |
︙ | ︙ | |||
7995 7996 7997 7998 7999 8000 8001 | SHLIB_CFLAGS="-fPIC" SHLIB_SUFFIX=".so" # TEA specific: CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS | | | 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 | SHLIB_CFLAGS="-fPIC" SHLIB_SUFFIX=".so" # TEA specific: CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS SHLIB_LD='${CC} ${CFLAGS} ${LDFLAGS_DEFAULT} -shared' LDFLAGS="$LDFLAGS -Wl,--export-dynamic" if test $doRpath = yes; then : CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} if test "`uname -m`" = "alpha"; then : |
︙ | ︙ | |||
8071 8072 8073 8074 8075 8076 8077 | CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi ;; OpenBSD-*) arch=`arch -s` case "$arch" in | < < < < < < < | | | | | | | | | | | | | | < < < < < < < | < < | | | 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 | CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi ;; OpenBSD-*) arch=`arch -s` case "$arch" in alpha|sparc64) SHLIB_CFLAGS="-fPIC" ;; *) SHLIB_CFLAGS="-fpic" ;; esac SHLIB_LD='${CC} ${SHLIB_CFLAGS} -shared' SHLIB_SUFFIX=".so" if test $doRpath = yes; then : CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}' LDFLAGS="-Wl,-export-dynamic" CFLAGS_OPTIMIZE="-O2" if test "${TCL_THREADS}" = "1"; then : # On OpenBSD: Compile with -pthread # Don't link with -lpthread LIBS=`echo $LIBS | sed s/-lpthread//` CFLAGS="$CFLAGS -pthread" fi # OpenBSD doesn't do version numbers with dots. UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' TCL_LIB_VERSIONS_OK=nodots ;; NetBSD-*) # NetBSD has ELF and can use 'cc -shared' to build shared libs SHLIB_CFLAGS="-fPIC" SHLIB_LD='${CC} ${SHLIB_CFLAGS} -shared' SHLIB_SUFFIX=".so" LDFLAGS="$LDFLAGS -export-dynamic" if test $doRpath = yes; then : CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} if test "${TCL_THREADS}" = "1"; then : # The -pthread needs to go in the CFLAGS, not LIBS LIBS=`echo $LIBS | sed s/-pthread//` CFLAGS="$CFLAGS -pthread" LDFLAGS="$LDFLAGS -pthread" fi ;; DragonFly-*|FreeBSD-*) # This configuration from FreeBSD Ports. SHLIB_CFLAGS="-fPIC" SHLIB_LD="${CC} -shared" SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,-soname,\$@" SHLIB_SUFFIX=".so" LDFLAGS="" if test $doRpath = yes; then : |
︙ | ︙ | |||
8310 8311 8312 8313 8314 8315 8316 | SHLIB_LD="${SHLIB_LD} -Wl,-single_module" fi # TEA specific: link shlib with current and compatibility version flags vers=`echo ${PACKAGE_VERSION} | sed -e 's/^\([0-9]\{1,5\}\)\(\(\.[0-9]\{1,3\}\)\{0,2\}\).*$/\1\2/p' -e d` SHLIB_LD="${SHLIB_LD} -current_version ${vers:-0} -compatibility_version ${vers:-0}" SHLIB_SUFFIX=".dylib" | < < < < < < | 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 | SHLIB_LD="${SHLIB_LD} -Wl,-single_module" fi # TEA specific: link shlib with current and compatibility version flags vers=`echo ${PACKAGE_VERSION} | sed -e 's/^\([0-9]\{1,5\}\)\(\(\.[0-9]\{1,3\}\)\{0,2\}\).*$/\1\2/p' -e d` SHLIB_LD="${SHLIB_LD} -current_version ${vers:-0} -compatibility_version ${vers:-0}" SHLIB_SUFFIX=".dylib" LDFLAGS="$LDFLAGS -headerpad_max_install_names" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ld accepts -search_paths_first flag" >&5 $as_echo_n "checking if ld accepts -search_paths_first flag... " >&6; } if ${tcl_cv_ld_search_paths_first+:} false; then : $as_echo_n "(cached) " >&6 else |
︙ | ︙ | |||
8770 8771 8772 8773 8774 8775 8776 | # standard manufacturer compiler. if test "$GCC" = yes; then : case $system in AIX-*) ;; BSD/OS*) ;; | | | | 8558 8559 8560 8561 8562 8563 8564 8565 8566 8567 8568 8569 8570 8571 8572 8573 8574 | # standard manufacturer compiler. if test "$GCC" = yes; then : case $system in AIX-*) ;; BSD/OS*) ;; CYGWIN_*|MINGW32_*|MINGW64_*|MSYS_*) ;; IRIX*) ;; NetBSD-*|DragonFly-*|FreeBSD-*|OpenBSD-*) ;; Darwin-*) ;; SCO_SV-3.2*) ;; windows) ;; *) SHLIB_CFLAGS="-fPIC" ;; esac fi |
︙ | ︙ |
Changes to itclWidget/generic/itclWidgetBuiltin.c.
︙ | ︙ | |||
108 109 110 111 112 113 114 | */ Tcl_DStringInit(&buffer); for (i=0; i < BiMethodListLen; i++) { Tcl_DStringSetLength(&buffer, 0); Tcl_DStringAppend(&buffer, "::itcl::builtin::", -1); Tcl_DStringAppend(&buffer, BiMethodList[i].name, -1); Tcl_CreateObjCommand(interp, Tcl_DStringValue(&buffer), | | < | 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | */ Tcl_DStringInit(&buffer); for (i=0; i < BiMethodListLen; i++) { Tcl_DStringSetLength(&buffer, 0); Tcl_DStringAppend(&buffer, "::itcl::builtin::", -1); Tcl_DStringAppend(&buffer, BiMethodList[i].name, -1); Tcl_CreateObjCommand(interp, Tcl_DStringValue(&buffer), BiMethodList[i].proc, (ClientData)infoPtr, NULL); } Tcl_DStringFree(&buffer); return TCL_OK; } /* |
︙ | ︙ | |||
250 251 252 253 254 255 256 | if (Itcl_GetContext(interp, &contextIclsPtr, &contextIoPtr) != TCL_OK) { return TCL_ERROR; } } if (contextIoPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), | | < | | 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | if (Itcl_GetContext(interp, &contextIclsPtr, &contextIoPtr) != TCL_OK) { return TCL_ERROR; } } if (contextIoPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "cannot installhull without an object context", NULL); return TCL_ERROR; } if (objc < 3) { if (objc != 2) { token = Tcl_GetString(objv[0]); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "wrong # args: should be \"", token, "\" name|using <widgetType> ?arg ...?\"", NULL); return TCL_ERROR; } } shortForm = 0; widgetName = Tcl_GetString(contextIoPtr->namePtr); origWidgetName = widgetName; if (objc == 2) { |
︙ | ︙ | |||
358 359 360 361 362 363 364 | if (Tcl_FindCommand(interp, Tcl_DStringValue(&buffer), NULL, 0) == NULL) { break; } } contextIoPtr->hullWindowNamePtr = Tcl_NewStringObj(widgetName, -1); /* | | | 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 | if (Tcl_FindCommand(interp, Tcl_DStringValue(&buffer), NULL, 0) == NULL) { break; } } contextIoPtr->hullWindowNamePtr = Tcl_NewStringObj(widgetName, -1); /* fprintf(stderr, "REN!%s!%s!\n", widgetName, Tcl_DStringValue(&buffer)); */ Itcl_RenameCommand(interp, widgetName, Tcl_DStringValue(&buffer)); result = Tcl_TraceCommand(interp, Tcl_DStringValue(&buffer), TCL_TRACE_RENAME|TCL_TRACE_DELETE, ItclHullContentsDeleted, contextIoPtr); |
︙ | ︙ |
Changes to itclWidget/generic/itclWidgetObject.c.
︙ | ︙ | |||
21 22 23 24 25 26 27 | #include <tk.h> /* * ------------------------------------------------------------------------ * ItclWidgetInitObjectOptions() * | | | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #include <tk.h> /* * ------------------------------------------------------------------------ * ItclWidgetInitObjectOptions() * * Init all instance options * This is usually invoked automatically * by Itcl_CreateObject(), when an object is created. * ------------------------------------------------------------------------ */ int ItclWidgetInitObjectOptions( Tcl_Interp *interp, |
︙ | ︙ |
Changes to itclWidget/license.terms.
︙ | ︙ | |||
23 24 25 26 27 28 29 | FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. GOVERNMENT USE: If you are acquiring this software on behalf of the U.S. government, the Government shall have only "Restricted Rights" | | | | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. GOVERNMENT USE: If you are acquiring this software on behalf of the U.S. government, the Government shall have only "Restricted Rights" in the software and related documentation as defined in the Federal Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you are acquiring the software on behalf of the Department of Defense, the software shall be classified as "Commercial Computer Software" and the Government shall have only "Restricted Rights" as defined in Clause 252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the authors grant the U.S. Government and others acting in its behalf permission to use and distribute the software in accordance with the terms specified in this license. |
Changes to itclWidget/tclconfig/tcl.m4.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # tcl.m4 -- # # This file provides a set of autoconf macros to help TEA-enable # a Tcl extension. # # Copyright (c) 1999-2000 Ajuba Solutions. # Copyright (c) 2002-2005 ActiveState Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. AC_PREREQ(2.57) | < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # tcl.m4 -- # # This file provides a set of autoconf macros to help TEA-enable # a Tcl extension. # # Copyright (c) 1999-2000 Ajuba Solutions. # Copyright (c) 2002-2005 ActiveState Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. AC_PREREQ(2.57) # Possible values for key variables defined: # # TEA_WINDOWINGSYSTEM - win32 aqua x11 (mirrors 'tk windowingsystem') # TEA_PLATFORM - windows unix # TEA_TK_EXTENSION - True if this is a Tk extension # |
︙ | ︙ | |||
105 106 107 108 109 110 111 112 113 114 115 116 117 118 | # on Darwin, check in Framework installation locations if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tclconfig}" = x ; then for i in `ls -d ~/Library/Frameworks 2>/dev/null` \ `ls -d /Library/Frameworks 2>/dev/null` \ `ls -d /Network/Library/Frameworks 2>/dev/null` \ `ls -d /System/Library/Frameworks 2>/dev/null` \ ; do if test -f "$i/Tcl.framework/tclConfig.sh" ; then ac_cv_c_tclconfig="`(cd $i/Tcl.framework; pwd)`" break fi done fi | > > > | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | # on Darwin, check in Framework installation locations if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tclconfig}" = x ; then for i in `ls -d ~/Library/Frameworks 2>/dev/null` \ `ls -d /Library/Frameworks 2>/dev/null` \ `ls -d /Network/Library/Frameworks 2>/dev/null` \ `ls -d /System/Library/Frameworks 2>/dev/null` \ `ls -d /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/Library/Frameworks/Tcl.framework 2>/dev/null` \ `ls -d /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/Network/Library/Frameworks/Tcl.framework 2>/dev/null` \ `ls -d /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tcl.framework 2>/dev/null` \ ; do if test -f "$i/Tcl.framework/tclConfig.sh" ; then ac_cv_c_tclconfig="`(cd $i/Tcl.framework; pwd)`" break fi done fi |
︙ | ︙ | |||
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | # check in a few common install locations if test x"${ac_cv_c_tclconfig}" = x ; then for i in `ls -d ${libdir} 2>/dev/null` \ `ls -d ${exec_prefix}/lib 2>/dev/null` \ `ls -d ${prefix}/lib 2>/dev/null` \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ `ls -d /usr/lib64 2>/dev/null` \ `ls -d /usr/lib/tcl8.6 2>/dev/null` \ `ls -d /usr/lib/tcl8.5 2>/dev/null` \ ; do if test -f "$i/tclConfig.sh" ; then ac_cv_c_tclconfig="`(cd $i; pwd)`" break fi done fi | > > > > > | 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | # check in a few common install locations if test x"${ac_cv_c_tclconfig}" = x ; then for i in `ls -d ${libdir} 2>/dev/null` \ `ls -d ${exec_prefix}/lib 2>/dev/null` \ `ls -d ${prefix}/lib 2>/dev/null` \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/pkg/lib 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ `ls -d /usr/lib64 2>/dev/null` \ `ls -d /usr/lib/tcl8.6 2>/dev/null` \ `ls -d /usr/lib/tcl8.5 2>/dev/null` \ `ls -d /usr/local/lib/tcl8.6 2>/dev/null` \ `ls -d /usr/local/lib/tcl8.5 2>/dev/null` \ `ls -d /usr/local/lib/tcl/tcl8.6 2>/dev/null` \ `ls -d /usr/local/lib/tcl/tcl8.5 2>/dev/null` \ ; do if test -f "$i/tclConfig.sh" ; then ac_cv_c_tclconfig="`(cd $i; pwd)`" break fi done fi |
︙ | ︙ | |||
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | # on Darwin, check in Framework installation locations if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tkconfig}" = x ; then for i in `ls -d ~/Library/Frameworks 2>/dev/null` \ `ls -d /Library/Frameworks 2>/dev/null` \ `ls -d /Network/Library/Frameworks 2>/dev/null` \ `ls -d /System/Library/Frameworks 2>/dev/null` \ ; do if test -f "$i/Tk.framework/tkConfig.sh" ; then ac_cv_c_tkconfig="`(cd $i/Tk.framework; pwd)`" break fi done fi # check in a few common install locations if test x"${ac_cv_c_tkconfig}" = x ; then for i in `ls -d ${libdir} 2>/dev/null` \ `ls -d ${exec_prefix}/lib 2>/dev/null` \ `ls -d ${prefix}/lib 2>/dev/null` \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ `ls -d /usr/lib64 2>/dev/null` \ ; do if test -f "$i/tkConfig.sh" ; then ac_cv_c_tkconfig="`(cd $i; pwd)`" break fi done fi | > > > > > > > > > > | 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | # on Darwin, check in Framework installation locations if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tkconfig}" = x ; then for i in `ls -d ~/Library/Frameworks 2>/dev/null` \ `ls -d /Library/Frameworks 2>/dev/null` \ `ls -d /Network/Library/Frameworks 2>/dev/null` \ `ls -d /System/Library/Frameworks 2>/dev/null` \ `ls -d /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/Library/Frameworks/Tcl.framework 2>/dev/null` \ `ls -d /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/Network/Library/Frameworks/Tcl.framework 2>/dev/null` \ `ls -d /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tcl.framework 2>/dev/null` \ ; do if test -f "$i/Tk.framework/tkConfig.sh" ; then ac_cv_c_tkconfig="`(cd $i/Tk.framework; pwd)`" break fi done fi # check in a few common install locations if test x"${ac_cv_c_tkconfig}" = x ; then for i in `ls -d ${libdir} 2>/dev/null` \ `ls -d ${exec_prefix}/lib 2>/dev/null` \ `ls -d ${prefix}/lib 2>/dev/null` \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/pkg/lib 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ `ls -d /usr/lib64 2>/dev/null` \ `ls -d /usr/lib/tk8.6 2>/dev/null` \ `ls -d /usr/lib/tk8.5 2>/dev/null` \ `ls -d /usr/local/lib/tk8.6 2>/dev/null` \ `ls -d /usr/local/lib/tk8.5 2>/dev/null` \ `ls -d /usr/local/lib/tcl/tk8.6 2>/dev/null` \ `ls -d /usr/local/lib/tcl/tk8.5 2>/dev/null` \ ; do if test -f "$i/tkConfig.sh" ; then ac_cv_c_tkconfig="`(cd $i; pwd)`" break fi done fi |
︙ | ︙ | |||
345 346 347 348 349 350 351 352 353 354 355 356 357 358 | # # Results: # # Substitutes the following vars: # TCL_BIN_DIR # TCL_SRC_DIR # TCL_LIB_FILE #------------------------------------------------------------------------ AC_DEFUN([TEA_LOAD_TCLCONFIG], [ AC_MSG_CHECKING([for existence of ${TCL_BIN_DIR}/tclConfig.sh]) if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then AC_MSG_RESULT([loading]) | > > | 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 | # # Results: # # Substitutes the following vars: # TCL_BIN_DIR # TCL_SRC_DIR # TCL_LIB_FILE # TCL_ZIP_FILE # TCL_ZIPFS_SUPPORT #------------------------------------------------------------------------ AC_DEFUN([TEA_LOAD_TCLCONFIG], [ AC_MSG_CHECKING([for existence of ${TCL_BIN_DIR}/tclConfig.sh]) if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then AC_MSG_RESULT([loading]) |
︙ | ︙ | |||
420 421 422 423 424 425 426 | AC_MSG_CHECKING([platform]) hold_cc=$CC; CC="$TCL_CC" AC_TRY_COMPILE(,[ #ifdef _WIN32 #error win32 #endif ], [ | > | | 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 | AC_MSG_CHECKING([platform]) hold_cc=$CC; CC="$TCL_CC" AC_TRY_COMPILE(,[ #ifdef _WIN32 #error win32 #endif ], [ # first test we've already retrieved platform (cross-compile), fallback to unix otherwise: TEA_PLATFORM="${TEA_PLATFORM-unix}" CYGPATH=echo ], [ TEA_PLATFORM="windows" AC_CHECK_PROG(CYGPATH, cygpath, cygpath -m, echo) ] ) CC=$hold_cc AC_MSG_RESULT($TEA_PLATFORM) |
︙ | ︙ | |||
779 780 781 782 783 784 785 | # _REENTRANT # _THREAD_SAFE #------------------------------------------------------------------------ AC_DEFUN([TEA_ENABLE_THREADS], [ AC_ARG_ENABLE(threads, AC_HELP_STRING([--enable-threads], | | | 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 | # _REENTRANT # _THREAD_SAFE #------------------------------------------------------------------------ AC_DEFUN([TEA_ENABLE_THREADS], [ AC_ARG_ENABLE(threads, AC_HELP_STRING([--enable-threads], [build with threads (default: on)]), [tcl_ok=$enableval], [tcl_ok=yes]) if test "${enable_threads+set}" = set; then enableval="$enable_threads" tcl_ok=$enableval else tcl_ok=yes |
︙ | ︙ | |||
862 863 864 865 866 867 868 | case ${TCL_DEFS} in *THREADS=1*) if test "${TCL_THREADS}" = "0"; then AC_MSG_WARN([ Building ${PACKAGE_NAME} without threads enabled, but building against Tcl that IS thread-enabled. It is recommended to use --enable-threads.]) fi | < < < < < < < < | 879 880 881 882 883 884 885 886 887 888 889 890 891 892 | case ${TCL_DEFS} in *THREADS=1*) if test "${TCL_THREADS}" = "0"; then AC_MSG_WARN([ Building ${PACKAGE_NAME} without threads enabled, but building against Tcl that IS thread-enabled. It is recommended to use --enable-threads.]) fi ;; esac AC_SUBST(TCL_THREADS) ]) #------------------------------------------------------------------------ # TEA_ENABLE_SYMBOLS -- |
︙ | ︙ | |||
1136 1137 1138 1139 1140 1141 1142 | AC_MSG_CHECKING([if rpath support is requested]) AC_ARG_ENABLE(rpath, AC_HELP_STRING([--disable-rpath], [disable rpath support (default: on)]), [doRpath=$enableval], [doRpath=yes]) AC_MSG_RESULT([$doRpath]) | < < < < < < < < < < < | 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 | AC_MSG_CHECKING([if rpath support is requested]) AC_ARG_ENABLE(rpath, AC_HELP_STRING([--disable-rpath], [disable rpath support (default: on)]), [doRpath=$enableval], [doRpath=yes]) AC_MSG_RESULT([$doRpath]) # Set the variable "system" to hold the name and version number # for the system. TEA_CONFIG_SYSTEM # Require ranlib early so we can override it in special cases below. |
︙ | ︙ | |||
1219 1220 1221 1222 1223 1224 1225 | do64bit="no" else AC_MSG_RESULT([ Using 64-bit $MACHINE mode]) do64bit_ok="yes" fi fi | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 | do64bit="no" else AC_MSG_RESULT([ Using 64-bit $MACHINE mode]) do64bit_ok="yes" fi fi if test "$GCC" != "yes" ; then if test "${SHARED_BUILD}" = "0" ; then runtime=-MT else runtime=-MD fi case "x`echo \${VisualStudioVersion}`" in |
︙ | ︙ | |||
1305 1306 1307 1308 1309 1310 1311 | lflags="${lflags} -nologo -MACHINE:${MACHINE} -LIBPATH:\"${MSSDK}/Lib/${MACHINE}\"" LINKBIN="\"${PATH64}/link.exe\"" CFLAGS_DEBUG="-nologo -Zi -Od -W3 ${runtime}d" CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}" # Avoid 'unresolved external symbol __security_cookie' # errors, c.f. http://support.microsoft.com/?id=894573 TEA_ADD_LIBS([bufferoverflowU.lib]) | < < < < < < < < < < < < < < < < < < < < < < < < < < | 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 | lflags="${lflags} -nologo -MACHINE:${MACHINE} -LIBPATH:\"${MSSDK}/Lib/${MACHINE}\"" LINKBIN="\"${PATH64}/link.exe\"" CFLAGS_DEBUG="-nologo -Zi -Od -W3 ${runtime}d" CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}" # Avoid 'unresolved external symbol __security_cookie' # errors, c.f. http://support.microsoft.com/?id=894573 TEA_ADD_LIBS([bufferoverflowU.lib]) else RC="rc" lflags="${lflags} -nologo" LINKBIN="link" CFLAGS_DEBUG="-nologo -Z7 -Od -W3 -WX ${runtime}d" CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}" fi |
︙ | ︙ | |||
1392 1393 1394 1395 1396 1397 1398 | # For information on what debugtype is most useful, see: # http://msdn.microsoft.com/library/en-us/dnvc60/html/gendepdebug.asp # and also # http://msdn2.microsoft.com/en-us/library/y0zzbyt4%28VS.80%29.aspx # This essentially turns it all on. LDFLAGS_DEBUG="-debug -debugtype:cv" LDFLAGS_OPTIMIZE="-release" | < < < < | | < | 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 | # For information on what debugtype is most useful, see: # http://msdn.microsoft.com/library/en-us/dnvc60/html/gendepdebug.asp # and also # http://msdn2.microsoft.com/en-us/library/y0zzbyt4%28VS.80%29.aspx # This essentially turns it all on. LDFLAGS_DEBUG="-debug -debugtype:cv" LDFLAGS_OPTIMIZE="-release" LDFLAGS_CONSOLE="-link -subsystem:console ${lflags}" LDFLAGS_WINDOW="-link -subsystem:windows ${lflags}" fi SHLIB_SUFFIX=".dll" SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.dll' TCL_LIB_VERSIONS_OK=nodots ;; |
︙ | ︙ | |||
1495 1496 1497 1498 1499 1500 1501 | CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; Haiku*) LDFLAGS="$LDFLAGS -Wl,--export-dynamic" SHLIB_CFLAGS="-fPIC" SHLIB_SUFFIX=".so" | | | 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 | CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; Haiku*) LDFLAGS="$LDFLAGS -Wl,--export-dynamic" SHLIB_CFLAGS="-fPIC" SHLIB_SUFFIX=".so" SHLIB_LD='${CC} ${CFLAGS} ${LDFLAGS} -shared' AC_CHECK_LIB(network, inet_ntoa, [LIBS="$LIBS -lnetwork"]) ;; HP-UX-*.11.*) # Use updated header definitions where possible AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, [Do we want to use the XOPEN network library?]) # TEA specific: Needed by Tcl, but not most extensions #AC_DEFINE(_XOPEN_SOURCE, 1, [Do we want to use the XOPEN network library?]) |
︙ | ︙ | |||
1606 1607 1608 1609 1610 1611 1612 | SHLIB_CFLAGS="-fPIC" SHLIB_SUFFIX=".so" # TEA specific: CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS | | | 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 | SHLIB_CFLAGS="-fPIC" SHLIB_SUFFIX=".so" # TEA specific: CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS SHLIB_LD='${CC} ${CFLAGS} ${LDFLAGS_DEFAULT} -shared' LDFLAGS="$LDFLAGS -Wl,--export-dynamic" AS_IF([test $doRpath = yes], [ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}']) LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} AS_IF([test "`uname -m`" = "alpha"], [CFLAGS="$CFLAGS -mieee"]) AS_IF([test $do64bit = yes], [ AC_CACHE_CHECK([if compiler accepts -m64 flag], tcl_cv_cc_m64, [ |
︙ | ︙ | |||
1645 1646 1647 1648 1649 1650 1651 | AS_IF([test $doRpath = yes], [ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}']) ;; OpenBSD-*) arch=`arch -s` case "$arch" in | < < < < < < < | | | | | | | | | | | | | | < < < < < < < | < < | | | 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 | AS_IF([test $doRpath = yes], [ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}']) ;; OpenBSD-*) arch=`arch -s` case "$arch" in alpha|sparc64) SHLIB_CFLAGS="-fPIC" ;; *) SHLIB_CFLAGS="-fpic" ;; esac SHLIB_LD='${CC} ${SHLIB_CFLAGS} -shared' SHLIB_SUFFIX=".so" AS_IF([test $doRpath = yes], [ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}']) LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}' LDFLAGS="-Wl,-export-dynamic" CFLAGS_OPTIMIZE="-O2" AS_IF([test "${TCL_THREADS}" = "1"], [ # On OpenBSD: Compile with -pthread # Don't link with -lpthread LIBS=`echo $LIBS | sed s/-lpthread//` CFLAGS="$CFLAGS -pthread" ]) # OpenBSD doesn't do version numbers with dots. UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' TCL_LIB_VERSIONS_OK=nodots ;; NetBSD-*) # NetBSD has ELF and can use 'cc -shared' to build shared libs SHLIB_CFLAGS="-fPIC" SHLIB_LD='${CC} ${SHLIB_CFLAGS} -shared' SHLIB_SUFFIX=".so" LDFLAGS="$LDFLAGS -export-dynamic" AS_IF([test $doRpath = yes], [ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}']) LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} AS_IF([test "${TCL_THREADS}" = "1"], [ # The -pthread needs to go in the CFLAGS, not LIBS LIBS=`echo $LIBS | sed s/-pthread//` CFLAGS="$CFLAGS -pthread" LDFLAGS="$LDFLAGS -pthread" ]) ;; DragonFly-*|FreeBSD-*) # This configuration from FreeBSD Ports. SHLIB_CFLAGS="-fPIC" SHLIB_LD="${CC} -shared" SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,-soname,\$[@]" SHLIB_SUFFIX=".so" LDFLAGS="" AS_IF([test $doRpath = yes], [ |
︙ | ︙ | |||
1788 1789 1790 1791 1792 1793 1794 | AS_IF([test $tcl_cv_ld_single_module = yes], [ SHLIB_LD="${SHLIB_LD} -Wl,-single_module" ]) # TEA specific: link shlib with current and compatibility version flags vers=`echo ${PACKAGE_VERSION} | sed -e 's/^\([[0-9]]\{1,5\}\)\(\(\.[[0-9]]\{1,3\}\)\{0,2\}\).*$/\1\2/p' -e d` SHLIB_LD="${SHLIB_LD} -current_version ${vers:-0} -compatibility_version ${vers:-0}" SHLIB_SUFFIX=".dylib" | < < < < | 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 | AS_IF([test $tcl_cv_ld_single_module = yes], [ SHLIB_LD="${SHLIB_LD} -Wl,-single_module" ]) # TEA specific: link shlib with current and compatibility version flags vers=`echo ${PACKAGE_VERSION} | sed -e 's/^\([[0-9]]\{1,5\}\)\(\(\.[[0-9]]\{1,3\}\)\{0,2\}\).*$/\1\2/p' -e d` SHLIB_LD="${SHLIB_LD} -current_version ${vers:-0} -compatibility_version ${vers:-0}" SHLIB_SUFFIX=".dylib" LDFLAGS="$LDFLAGS -headerpad_max_install_names" AC_CACHE_CHECK([if ld accepts -search_paths_first flag], tcl_cv_ld_search_paths_first, [ hold_ldflags=$LDFLAGS LDFLAGS="$LDFLAGS -Wl,-search_paths_first" AC_TRY_LINK(, [int i;], tcl_cv_ld_search_paths_first=yes, tcl_cv_ld_search_paths_first=no) |
︙ | ︙ | |||
2062 2063 2064 2065 2066 2067 2068 | # libraries to the right flags for gcc, instead of those for the # standard manufacturer compiler. AS_IF([test "$GCC" = yes], [ case $system in AIX-*) ;; BSD/OS*) ;; | | | | 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 | # libraries to the right flags for gcc, instead of those for the # standard manufacturer compiler. AS_IF([test "$GCC" = yes], [ case $system in AIX-*) ;; BSD/OS*) ;; CYGWIN_*|MINGW32_*|MINGW64_*|MSYS_*) ;; IRIX*) ;; NetBSD-*|DragonFly-*|FreeBSD-*|OpenBSD-*) ;; Darwin-*) ;; SCO_SV-3.2*) ;; windows) ;; *) SHLIB_CFLAGS="-fPIC" ;; esac]) AS_IF([test "$tcl_cv_cc_visibility_hidden" != yes], [ |
︙ | ︙ | |||
2606 2607 2608 2609 2610 2611 2612 | tcl_cv_timezone_time=yes, tcl_cv_timezone_time=no)]) if test $tcl_cv_timezone_time = yes ; then AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?]) fi fi ]) | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 | tcl_cv_timezone_time=yes, tcl_cv_timezone_time=no)]) if test $tcl_cv_timezone_time = yes ; then AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?]) fi fi ]) #-------------------------------------------------------------------- # TEA_TCL_LINK_LIBS # # Search for the libraries needed to link the Tcl shell. # Things like the math library (-lm) and socket stuff (-lsocket vs. # -lnsl) are dealt with here. # |
︙ | ︙ | |||
2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 | # TEA specific: Don't perform the eval of the libraries here because # DL_LIBS won't be set until we call TEA_CONFIG_CFLAGS TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}' AC_SUBST(TCL_LIBS) AC_SUBST(MATH_LIBS) ]) #-------------------------------------------------------------------- # TEA_TCL_EARLY_FLAGS # # Check for what flags are needed to be passed so the correct OS # features are available. # | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 | # TEA specific: Don't perform the eval of the libraries here because # DL_LIBS won't be set until we call TEA_CONFIG_CFLAGS TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}' AC_SUBST(TCL_LIBS) AC_SUBST(MATH_LIBS) ]) #-------------------------------------------------------------------- # TEA_BUGGY_STRTOD # # Under Solaris 2.4, strtod returns the wrong value for the # terminating character under some conditions. Check for this # and if the problem exists use a substitute procedure # "fixstrtod" (provided by Tcl) that corrects the error. # Also, on Compaq's Tru64 Unix 5.0, # strtod(" ") returns 0.0 instead of a failure to convert. # # Arguments: # none # # Results: # # Might defines some of the following vars: # strtod (=fixstrtod) #-------------------------------------------------------------------- AC_DEFUN([TEA_BUGGY_STRTOD], [ AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0) if test "$tcl_strtod" = 1; then AC_CACHE_CHECK([for Solaris2.4/Tru64 strtod bugs], tcl_cv_strtod_buggy,[ AC_TRY_RUN([ extern double strtod(); int main() { char *infString="Inf", *nanString="NaN", *spaceString=" "; char *term; double value; value = strtod(infString, &term); if ((term != infString) && (term[-1] == 0)) { exit(1); } value = strtod(nanString, &term); if ((term != nanString) && (term[-1] == 0)) { exit(1); } value = strtod(spaceString, &term); if (term == (spaceString+1)) { exit(1); } exit(0); }], tcl_cv_strtod_buggy=ok, tcl_cv_strtod_buggy=buggy, tcl_cv_strtod_buggy=buggy)]) if test "$tcl_cv_strtod_buggy" = buggy; then AC_LIBOBJ([fixstrtod]) USE_COMPAT=1 AC_DEFINE(strtod, fixstrtod, [Do we want to use the strtod() in compat?]) fi fi ]) #-------------------------------------------------------------------- # TEA_TCL_EARLY_FLAGS # # Check for what flags are needed to be passed so the correct OS # features are available. # |
︙ | ︙ | |||
2905 2906 2907 2908 2909 2910 2911 | # EXEEXT # Select the executable extension based on the host type. This # is a lightweight replacement for AC_EXEEXT that doesn't require # a compiler. #------------------------------------------------------------------------ AC_DEFUN([TEA_INIT], [ | < < | | < < < < < < | < | | 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 | # EXEEXT # Select the executable extension based on the host type. This # is a lightweight replacement for AC_EXEEXT that doesn't require # a compiler. #------------------------------------------------------------------------ AC_DEFUN([TEA_INIT], [ TEA_VERSION="3.13" AC_MSG_CHECKING([TEA configuration]) if test x"${PACKAGE_NAME}" = x ; then AC_MSG_ERROR([ The PACKAGE_NAME variable must be defined by your TEA configure.ac]) fi AC_MSG_RESULT([ok (TEA ${TEA_VERSION})]) # If the user did not set CFLAGS, set it now to keep macros # like AC_PROG_CC and AC_TRY_COMPILE from adding "-g -O2". if test "${CFLAGS+set}" != "set" ; then CFLAGS="" fi case "`uname -s`" in *win32*|*WIN32*|*MINGW32_*|*MINGW64_*|*MSYS_*) AC_CHECK_PROG(CYGPATH, cygpath, cygpath -m, echo) EXEEXT=".exe" TEA_PLATFORM="windows" ;; *CYGWIN_*) EXEEXT=".exe" # CYGPATH and TEA_PLATFORM are determined later in LOAD_TCLCONFIG |
︙ | ︙ | |||
3349 3350 3351 3352 3353 3354 3355 | # Common compiler flag setup #-------------------------------------------------------------------- AC_C_BIGENDIAN if test "${TEA_PLATFORM}" = "unix" ; then TEA_TCL_LINK_LIBS TEA_MISSING_POSIX_HEADERS | < < < < | 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 | # Common compiler flag setup #-------------------------------------------------------------------- AC_C_BIGENDIAN if test "${TEA_PLATFORM}" = "unix" ; then TEA_TCL_LINK_LIBS TEA_MISSING_POSIX_HEADERS fi ]) #------------------------------------------------------------------------ # TEA_MAKE_LIB -- # # Generate a line that can be used to build a shared/unshared library |
︙ | ︙ | |||
4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 | # check in a few common install locations if test x"${ac_cv_c_$1config}" = x ; then for i in `ls -d ${libdir} 2>/dev/null` \ `ls -d ${exec_prefix}/lib 2>/dev/null` \ `ls -d ${prefix}/lib 2>/dev/null` \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ `ls -d /usr/lib64 2>/dev/null` \ ; do if test -f "$i/$1Config.sh" ; then ac_cv_c_$1config=`(cd $i; pwd)` break fi | > | 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 | # check in a few common install locations if test x"${ac_cv_c_$1config}" = x ; then for i in `ls -d ${libdir} 2>/dev/null` \ `ls -d ${exec_prefix}/lib 2>/dev/null` \ `ls -d ${prefix}/lib 2>/dev/null` \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/pkg/lib 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ `ls -d /usr/lib64 2>/dev/null` \ ; do if test -f "$i/$1Config.sh" ; then ac_cv_c_$1config=`(cd $i; pwd)` break fi |
︙ | ︙ | |||
4337 4338 4339 4340 4341 4342 4343 | AC_SUBST(MAJOR_VERSION) AC_SUBST(MINOR_VERSION) AC_SUBST(PATCHLEVEL) ]) #------------------------------------------------------------------------ | | > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < < < < | < | > > > < | | > > > > | | > > > > > > | < < < < | < > > > > | | | | > > > > > > > | > > > > | | | < < | < > > > > > | > > > > > | > | < < < < < | < > > | > > | < > | < < < < < < < < | | > > > > > > > > > | 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 | AC_SUBST(MAJOR_VERSION) AC_SUBST(MINOR_VERSION) AC_SUBST(PATCHLEVEL) ]) #------------------------------------------------------------------------ # TEA_INSTALLER -- # # Configure the installer. # # Arguments: # none # # Results: # Substitutes the following vars: # INSTALL # INSTALL_DATA_DIR # INSTALL_DATA # INSTALL_PROGRAM # INSTALL_SCRIPT # INSTALL_LIBRARY #------------------------------------------------------------------------ AC_DEFUN([TEA_INSTALLER], [ INSTALL='$(SHELL) $(srcdir)/tclconfig/install-sh -c' INSTALL_DATA_DIR='${INSTALL} -d -m 755' INSTALL_DATA='${INSTALL} -m 644' INSTALL_PROGRAM='${INSTALL} -m 755' INSTALL_SCRIPT='${INSTALL} -m 755' TEA_CONFIG_SYSTEM case $system in HP-UX-*) INSTALL_LIBRARY='${INSTALL} -m 755' ;; *) INSTALL_LIBRARY='${INSTALL} -m 644' ;; esac AC_SUBST(INSTALL) AC_SUBST(INSTALL_DATA_DIR) AC_SUBST(INSTALL_DATA) AC_SUBST(INSTALL_PROGRAM) AC_SUBST(INSTALL_SCRIPT) AC_SUBST(INSTALL_LIBRARY) ]) ### # Tip 430 - ZipFS Modifications ### #------------------------------------------------------------------------ # SC_ZIPFS_SUPPORT # Locate a zip encoder installed on the system path, or none. # # Arguments: # none # # Results: # Substitutes the following vars: # TCL_ZIP_FILE # TCL_ZIPFS_SUPPORT # TCL_ZIPFS_FLAG # ZIP_PROG #------------------------------------------------------------------------ #------------------------------------------------------------------------ # SC_PROG_ZIP # Locate a zip encoder installed on the system path, or none. # # Arguments: # none # # Results: # Substitutes the following vars: # ZIP_PROG # ZIP_PROG_OPTIONS # ZIP_PROG_VFSSEARCH # ZIP_INSTALL_OBJS #------------------------------------------------------------------------ AC_DEFUN([TEA_ZIPFS_SUPPORT], [ AC_MSG_CHECKING([for zipfs support]) ZIP_PROG="" ZIP_PROG_OPTIONS="" ZIP_PROG_VFSSEARCH="" INSTALL_MSGS="" # If our native tclsh processes the "install" command line option # we can use it to mint zip files AS_IF([$TCLSH_PROG install],[ ZIP_PROG=${TCLSH_PROG} ZIP_PROG_OPTIONS="install mkzip" ZIP_PROG_VFSSEARCH="." AC_MSG_RESULT([Can use Native Tclsh for Zip encoding]) ]) if test "x$ZIP_PROG" = "x" ; then AC_CACHE_VAL(ac_cv_path_zip, [ search_path=`echo ${PATH} | sed -e 's/:/ /g'` for dir in $search_path ; do for j in `ls -r $dir/zip 2> /dev/null` \ `ls -r $dir/zip 2> /dev/null` ; do if test x"$ac_cv_path_zip" = x ; then if test -f "$j" ; then ac_cv_path_zip=$j break fi fi done done ]) if test -f "$ac_cv_path_zip" ; then ZIP_PROG="$ac_cv_path_zip " AC_MSG_RESULT([$ZIP_PROG]) ZIP_PROG_OPTIONS="-rq" ZIP_PROG_VFSSEARCH="." AC_MSG_RESULT([Found INFO Zip in environment]) # Use standard arguments for zip fi fi if test "x$ZIP_PROG" = "x" ; then # It is not an error if an installed version of Zip can't be located. ZIP_PROG="" ZIP_PROG_OPTIONS="" ZIP_PROG_VFSSEARCH="" TCL_ZIPFS_SUPPORT=0 TCL_ZIPFS_FLAG= else # ZIPFS Support eval "TCL_ZIP_FILE=\"${TCL_ZIP_FILE}\"" if test ${TCL_ZIP_FILE} = "" ; then TCL_ZIPFS_SUPPORT=0 TCL_ZIPFS_FLAG= INSTALL_LIBRARIES=install-libraries INSTALL_MSGS=install-msgs else if test ${SHARED_BUILD} = 1 ; then TCL_ZIPFS_SUPPORT=1 INSTALL_LIBRARIES=install-libraries-zipfs-shared else TCL_ZIPFS_SUPPORT=2 INSTALL_LIBRARIES=install-libraries-zipfs-static fi TCL_ZIPFS_FLAG=-DTCL_ZIPFS_SUPPORT fi fi AC_SUBST(TCL_ZIP_FILE) AC_SUBST(TCL_ZIPFS_SUPPORT) AC_SUBST(TCL_ZIPFS_FLAG) AC_SUBST(ZIP_PROG) AC_SUBST(ZIP_PROG_OPTIONS) AC_SUBST(ZIP_PROG_VFSSEARCH) AC_SUBST(INSTALL_LIBRARIES) AC_SUBST(INSTALL_MSGS) ]) # Local Variables: # mode: autoconf # End: |
Changes to itclWidget/tests/itclwidget.test.
︙ | ︙ | |||
24 25 26 27 28 29 30 | # met by the active interpreter we forcibly bail out of the # testsuite calling the command. The command has to be called # immediately after loading the utilities. if {[package vsatisfies [package provide Tcl] ${version}-]} return puts " Aborting the tests found in \"[file tail [info script]]\"" | | | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | # met by the active interpreter we forcibly bail out of the # testsuite calling the command. The command has to be called # immediately after loading the utilities. if {[package vsatisfies [package provide Tcl] ${version}-]} return puts " Aborting the tests found in \"[file tail [info script]]\"" puts " Requiring at least Tcl $version, have [package provide Tcl]." # This causes a 'return' in the calling scope. return -code return } # ### ### ### ######### ######### ######### ## Declare the minimum version of Tcltest required to run the |
︙ | ︙ |
Changes to itclWidget/tests/widgetadaptor.test.
︙ | ︙ | |||
25 26 27 28 29 30 31 | # met by the active interpreter we forcibly bail out of the # testsuite calling the command. The command has to be called # immediately after loading the utilities. if {[package vsatisfies [package provide Tcl] ${version}-]} return puts " Aborting the tests found in \"[file tail [info script]]\"" | | | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | # met by the active interpreter we forcibly bail out of the # testsuite calling the command. The command has to be called # immediately after loading the utilities. if {[package vsatisfies [package provide Tcl] ${version}-]} return puts " Aborting the tests found in \"[file tail [info script]]\"" puts " Requiring at least Tcl $version, have [package provide Tcl]." # This causes a 'return' in the calling scope. return -code return } # ### ### ### ######### ######### ######### ## Declare the minimum version of Tcltest required to run the |
︙ | ︙ | |||
510 511 512 513 514 515 516 | error } -cleanup { mylabel destroy } -result {Simulated Error} test install-1.3 {can't install until hull exists} -constraints { | | | 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 | error } -cleanup { mylabel destroy } -result {Simulated Error} test install-1.3 {can't install until hull exists} -constraints { tk } -body { widgetadaptor myframe { # Delegate an option just to make sure the component variable # exists. delegate option -font to text constructor {args} { |
︙ | ︙ |
Changes to itclWidget/tests/widgetclass.test.
︙ | ︙ | |||
25 26 27 28 29 30 31 | # met by the active interpreter we forcibly bail out of the # testsuite calling the command. The command has to be called # immediately after loading the utilities. if {[package vsatisfies [package provide Tcl] ${version}-]} return puts " Aborting the tests found in \"[file tail [info script]]\"" | | | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | # met by the active interpreter we forcibly bail out of the # testsuite calling the command. The command has to be called # immediately after loading the utilities. if {[package vsatisfies [package provide Tcl] ${version}-]} return puts " Aborting the tests found in \"[file tail [info script]]\"" puts " Requiring at least Tcl $version, have [package provide Tcl]." # This causes a 'return' in the calling scope. return -code return } # ### ### ### ######### ######### ######### ## Declare the minimum version of Tcltest required to run the |
︙ | ︙ | |||
211 212 213 214 215 216 217 | delegate option -font to text typeconstructor { option add *Myframe.font Courier } constructor {args} { | | | 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | delegate option -font to text typeconstructor { option add *Myframe.font Courier } constructor {args} { installcomponent text using text $win.text } } myframe .frm set a [.frm cget -font] destroy .frm tkbide |
︙ | ︙ |
Changes to library/itclHullCmds.tcl.
︙ | ︙ | |||
121 122 123 124 125 126 127 | #puts stderr "rename2!rename $widget $widgetName!" set dorename 0 rename $widget $widgetName #puts stderr "rename3!rename ${tmp}_ $tmp![::info command ${tmp}_]!my_this!$my_this!" rename ${tmp}_ ::$tmp set exists [uplevel 1 ::info exists itcl_hull] if {!$exists} { | | | | 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | #puts stderr "rename2!rename $widget $widgetName!" set dorename 0 rename $widget $widgetName #puts stderr "rename3!rename ${tmp}_ $tmp![::info command ${tmp}_]!my_this!$my_this!" rename ${tmp}_ ::$tmp set exists [uplevel 1 ::info exists itcl_hull] if {!$exists} { # that does not yet work, beacause of problems with resolving ::itcl::addcomponent $my_this itcl_hull } upvar itcl_hull itcl_hull ::itcl::setcomponent $my_this itcl_hull $widgetName #puts stderr "IC![::info command $my_win]!" set exists [uplevel 1 ::info exists itcl_interior] if {!$exists} { # that does not yet work, beacause of problems with resolving ::itcl::addcomponent $this itcl_interior } upvar itcl_interior itcl_interior set itcl_interior $my_win #puts stderr "hull end!win!$win!itcl_hull!$itcl_hull!itcl_interior!$itcl_interior!" return $my_win } |
︙ | ︙ | |||
192 193 194 195 196 197 198 | # uplevel 1 [list set itcl_options($opt) [list $val]] if {[catch {uplevel 1 $win configure $opt [list $val]} msg]} { #puts stderr "addToItclOptions ERR!$msg!$my_class!$win!configure!$opt!$val!" } } } } | | | 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | # uplevel 1 [list set itcl_options($opt) [list $val]] if {[catch {uplevel 1 $win configure $opt [list $val]} msg]} { #puts stderr "addToItclOptions ERR!$msg!$my_class!$win!configure!$opt!$val!" } } } } # ======================= setupcomponent =========================== proc setupcomponent {comp using widget_type path args} { upvar this this upvar win win upvar itcl_hull itcl_hull |
︙ | ︙ |
Changes to library/itclWidget.tcl.
︙ | ︙ | |||
15 16 17 18 19 20 21 | package require Tk 8.6 # package require itclwidget [set ::itcl::version] namespace eval ::itcl { proc widget {name args} { set result [uplevel 1 ::itcl::internal::commands::genericclass widget $name $args] | | | | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | package require Tk 8.6 # package require itclwidget [set ::itcl::version] namespace eval ::itcl { proc widget {name args} { set result [uplevel 1 ::itcl::internal::commands::genericclass widget $name $args] # we handle create by owerselfs !! allow classunknown to handle that oo::objdefine $result unexport create return $result } proc widgetadaptor {name args} { set result [uplevel 1 ::itcl::internal::commands::genericclass widgetadaptor $name $args] # we handle create by owerselfs !! allow classunknown to handle that oo::objdefine $result unexport create return $result } } ; # end ::itcl |
︙ | ︙ | |||
330 331 332 333 334 335 336 | namespace eval ::itcl::builtin::Info { proc hulltypes {args} { namespace upvar ::itcl::internal::dicts hullTypes hullTypes set numArgs [llength $args] | | | | 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 | namespace eval ::itcl::builtin::Info { proc hulltypes {args} { namespace upvar ::itcl::internal::dicts hullTypes hullTypes set numArgs [llength $args] if {$numArgs > 1} { error "wrong # args should be: info hulltypes ?<pattern>?" } set pattern "" if {$numArgs > 0} { set pattern [lindex $args 0] } if {$pattern ne ""} { return [lsearch -all -inline -glob $hullTypes $pattern] } return $hullTypes } proc widgetclasses {args} { set numArgs [llength $args] if {$numArgs > 1} { error "wrong # args should be: info widgetclasses ?<pattern>?" } set pattern "" if {$numArgs > 0} { set pattern [lindex $args 0] } set myDict [set ::itcl::internal::dicts::classes] |
︙ | ︙ | |||
378 379 380 381 382 383 384 | } } return $result } proc widgets {args} { set numArgs [llength $args] | | | 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 | } } return $result } proc widgets {args} { set numArgs [llength $args] if {$numArgs > 1} { error "wrong # args should be: info widgets ?<pattern>?" } set pattern "" if {$numArgs > 0} { set pattern [lindex $args 0] } set myDict [set ::itcl::internal::dicts::classes] |
︙ | ︙ | |||
410 411 412 413 414 415 416 | } } return $result } proc widgetadaptors {args} { set numArgs [llength $args] | | | 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 | } } return $result } proc widgetadaptors {args} { set numArgs [llength $args] if {$numArgs > 1} { error "wrong # args should be: info widgetadaptors ?<pattern>?" } set pattern "" if {$numArgs > 0} { set pattern [lindex $args 0] } set myDict [set ::itcl::internal::dicts::classes] |
︙ | ︙ |
Changes to library/test_Itcl_CreateObject.tcl.
1 2 3 | # this is a program for testing the stubs interface ItclCreateObject. # it uses itclTestRegisterC.c with the call C function functionality, # so it also tests that feature. | | | 1 2 3 4 5 6 7 8 9 10 11 | # this is a program for testing the stubs interface ItclCreateObject. # it uses itclTestRegisterC.c with the call C function functionality, # so it also tests that feature. # you need to define in Makefile CFLAGS: -DITCL_DEBUG_C_INTERFACE # for makeing that work. package require itcl ::itcl::class ::c1 { public method c0 {args} @cArgFunc public method m1 { args } { puts "Hello Tcl $args" } } |
︙ | ︙ |
Changes to license.terms.
︙ | ︙ | |||
31 32 33 34 35 36 37 | FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. GOVERNMENT USE: If you are acquiring this software on behalf of the U.S. government, the Government shall have only "Restricted Rights" | | | | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. GOVERNMENT USE: If you are acquiring this software on behalf of the U.S. government, the Government shall have only "Restricted Rights" in the software and related documentation as defined in the Federal Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you are acquiring the software on behalf of the Department of Defense, the software shall be classified as "Commercial Computer Software" and the Government shall have only "Restricted Rights" as defined in Clause 252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the authors grant the U.S. Government and others acting in its behalf permission to use and distribute the software in accordance with the terms specified in this license. |
Changes to tests/all.tcl.
1 2 3 4 5 6 7 8 9 10 11 | # all.tcl -- # # This file contains a top-level script to run all of the Tcl # tests. Execute it by invoking "source all.test" when running tcltest # in this directory. # # Copyright (c) 1998-2000 by Ajuba Solutions # All rights reserved. package prefer latest | > > > > > > > > > > > > > | | < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | # all.tcl -- # # This file contains a top-level script to run all of the Tcl # tests. Execute it by invoking "source all.test" when running tcltest # in this directory. # # Copyright (c) 1998-2000 by Ajuba Solutions # All rights reserved. if {"-testdir" ni $argv} { lappend argv -testdir [file dir [info script]] } if {[namespace which -command memory] ne "" && "-loadfile" ni $argv} { puts "Tests running in sub-interpreters of leaktest circuit" # -loadfile overwrites -load, so save it for helper in ::env(TESTFLAGS): if {![info exists ::env(TESTFLAGS)] && [llength $argv]} { set ::env(TESTFLAGS) $argv } lappend argv -loadfile [file join [file dirname [info script]] helpers.tcl] } package prefer latest package require Tcl 8.6- package require tcltest 2.2 tcltest::configure {*}$argv tcltest::runAllTests return |
Changes to tests/basic.test.
︙ | ︙ | |||
28 29 30 31 32 33 34 35 36 37 38 39 40 41 | variable setup { itcl::class Counter { constructor {args} { incr num eval configure $args } destructor { incr num -1 } method ++ {} { return [incr val $by] } proc num {} { | > > > | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | variable setup { itcl::class Counter { constructor {args} { incr num eval configure $args } destructor { if {![info exists num]} { lappend ::tcltest::itcl_basic_errors "unexpected: common deleted before destructor got called" } incr num -1 } method ++ {} { return [incr val $by] } proc num {} { |
︙ | ︙ | |||
67 68 69 70 71 72 73 74 75 76 77 78 79 80 | } variable setup4 $setup append setup4 { Counter c } test basic-1.1 {define a simple class } -setup $setup -body { } -cleanup $cleanup -result {} test basic-1.2 {class is now defined } -setup $setup -body { | > > > > > | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | } variable setup4 $setup append setup4 { Counter c } proc check_itcl_basic_errors {} { if {[info exists ::tcltest::itcl_basic_errors] && [llength $::tcltest::itcl_basic_errors]} { error "following errors occurs during tests:\n [join $::tcltest::itcl_basic_errors "\n "]" } } test basic-1.1 {define a simple class } -setup $setup -body { } -cleanup $cleanup -result {} test basic-1.2 {class is now defined } -setup $setup -body { |
︙ | ︙ | |||
125 126 127 128 129 130 131 | } -setup $setup2 -body { itcl::delete object x Counter x } -cleanup $cleanup2 -result x test basic-1.10 {objects can be destroyed by deleting their access command } -setup $setup2 -body { | | | 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | } -setup $setup2 -body { itcl::delete object x Counter x } -cleanup $cleanup2 -result x test basic-1.10 {objects can be destroyed by deleting their access command } -setup $setup2 -body { rename ::x {} itcl::find objects x } -cleanup $cleanup2 -result {} test basic-1.11 {find command supports object names starting with - } -setup $setup3 -body { itcl::find objects -class Counter -foo } -cleanup $cleanup -result -foo |
︙ | ︙ | |||
182 183 184 185 186 187 188 | test basic-1.20 { classes can be unicode } -body { \u6210bcd0 foo } -cleanup { ::itcl::delete class \u6210bcd } -result {bar} | < < | 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | test basic-1.20 { classes can be unicode } -body { \u6210bcd0 foo } -cleanup { ::itcl::delete class \u6210bcd } -result {bar} # ---------------------------------------------------------------------- # #auto names # ---------------------------------------------------------------------- test basic-2.1 {create an object with an automatic name } -setup $setup -body { Counter #auto |
︙ | ︙ | |||
340 341 342 343 344 345 346 347 348 349 350 351 352 353 | test basic-4.6 {when a class is destroyed, its objects are deleted } -body { list [lsort [itcl::find objects counter*]] \ [itcl::delete class Counter] \ [lsort [itcl::find objects counter*]] } -result {{counter0 counter1} {} {}} # ---------------------------------------------------------------------- # Namespace variables # ---------------------------------------------------------------------- test basic-5.1 {define a simple class with variables in the namespace } -body { itcl::class test_globals { | > > > > > > > > > > > > > > > > > > > > > > > > > > | 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 | test basic-4.6 {when a class is destroyed, its objects are deleted } -body { list [lsort [itcl::find objects counter*]] \ [itcl::delete class Counter] \ [lsort [itcl::find objects counter*]] } -result {{counter0 counter1} {} {}} check_itcl_basic_errors test basic-4.7 {clean-up of internal facilities } -setup $setup4 -body { # check callbacks are called if class gets removed using all possible ways: # objects are properly destroyed, # callback removing the namespace for the common private and protected variables # (in ITCL_VARIABLES_NAMESPACE) is called, etc set ::tcltest::itcl_basic_errors {} set ivns ::itcl::internal::variables[namespace which Counter] set result {} lappend result [namespace exists $ivns] [expr {[namespace which -command c] ne ""}] eval $cleanup lappend result [namespace exists $ivns] [expr {[namespace which -command c] ne ""}] eval $setup4 lappend result [namespace exists $ivns] [expr {[namespace which -command c] ne ""}] rename Counter {} lappend result [namespace exists $ivns] [expr {[namespace which -command c] ne ""}] eval $setup4 lappend result [namespace exists $ivns] [expr {[namespace which -command c] ne ""}] namespace delete Counter lappend result [namespace exists $ivns] [expr {[namespace which -command c] ne ""}] lappend result {*}$::tcltest::itcl_basic_errors } -cleanup { unset -nocomplain ivns ::tcltest::itcl_basic_errors } -result [lrepeat 3 1 1 0 0] # ---------------------------------------------------------------------- # Namespace variables # ---------------------------------------------------------------------- test basic-5.1 {define a simple class with variables in the namespace } -body { itcl::class test_globals { |
︙ | ︙ | |||
503 504 505 506 507 508 509 | } -result {} test basic-6.8 {common variables can be redefined } -body { test_arrays0 do set undefined "scalar" } -result {scalar} | | | > | 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 | } -result {} test basic-6.8 {common variables can be redefined } -body { test_arrays0 do set undefined "scalar" } -result {scalar} if {[namespace which test_arrays] ne {}} { ::itcl::delete class test_arrays } check_itcl_basic_errors rename check_itcl_basic_errors {} ::tcltest::cleanupTests return |
Changes to tests/body.test.
︙ | ︙ | |||
222 223 224 225 226 227 228 | itcl::class D {inherit B; constructor {} {lappend ::answer A}} } -body { D d1 itcl::body D::constructor {} {lappend ::answer D} D d2 set ::answer } -cleanup { | | | 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | itcl::class D {inherit B; constructor {} {lappend ::answer A}} } -body { D d1 itcl::body D::constructor {} {lappend ::answer D} D d2 set ::answer } -cleanup { itcl::delete class B unset -nocomplain answer } -result {B A B D} test body-6.1 {redefine class proc body} -setup { unset -nocomplain ::answer itcl::class C { proc cheshire {} { |
︙ | ︙ |
Changes to tests/helpers.tcl.
1 2 3 4 5 6 | # helpers.tcl -- # # This file contains helper scripts for all tests, like a mem-leak checker, etc. package require itcl | > > > > > > > > > | | > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | # helpers.tcl -- # # This file contains helper scripts for all tests, like a mem-leak checker, etc. # -loadfile overwrites -load, so restore it from ::env(TESTFLAGS): if {[info exists ::env(TESTFLAGS)]} { array set testargs $::env(TESTFLAGS) if {[info exists ::testargs(-load)]} { eval $::testargs(-load) } unset testargs } package require itcl if {[namespace which -command memory] ne "" && ( ![info exists ::tcl::inl_mem_test] || $::tcl::inl_mem_test ) } { proc getbytes {} {lindex [split [memory info] \n] 3 3} proc leaktest {script {iterations 3}} { set end [getbytes] for {set i 0} {$i < $iterations} {incr i} { uplevel 1 $script set tmp $end set end [getbytes] } return [expr {$end - $tmp}] } proc itcl_leaktest {testfile} { set leak [leaktest [string map [list \ @test@ $testfile \ @testargv@ [if {[info exists ::argv]} {list tcltest::configure {*}$::argv}] ] { interp create i load {} Itcl i i eval {set ::tcl::inl_mem_test 0} i eval {package require tcltest; @testargv@} i eval [list source @test@] interp delete i }]] if {$leak} { puts "LEAKED: $leak bytes" } } itcl_leaktest [info script] return -code return } |
Changes to tests/import.test.
︙ | ︙ | |||
39 40 41 42 43 44 45 46 47 48 49 50 51 52 | test import-1.3 {"stub exists" requires one argument} { list [catch {itcl::import::stub exists} result] $result \ [catch {itcl::import::stub exists x y} result] $result } {1 {wrong # args: should be "itcl::import::stub exists name"} 1 {wrong # args: should be "itcl::import::stub exists name"}} set interp [interp create] $interp eval " [list ::load $::itcllib itcl] [::tcltest::configure -load] proc auto_load {cmd {namespace {}}} { global debug proc \$cmd {args} \[format {return \"%s: \$args\"} \$cmd\] append debug \"(auto_load: \$cmd)\" | > | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | test import-1.3 {"stub exists" requires one argument} { list [catch {itcl::import::stub exists} result] $result \ [catch {itcl::import::stub exists x y} result] $result } {1 {wrong # args: should be "itcl::import::stub exists name"} 1 {wrong # args: should be "itcl::import::stub exists name"}} set interp [interp create] $interp eval {set ::tcl::inl_mem_test 0} $interp eval " [list ::load $::itcllib itcl] [::tcltest::configure -load] proc auto_load {cmd {namespace {}}} { global debug proc \$cmd {args} \[format {return \"%s: \$args\"} \$cmd\] append debug \"(auto_load: \$cmd)\" |
︙ | ︙ | |||
88 89 90 91 92 93 94 95 96 97 98 99 100 101 | catch {interp delete $interp} # ---------------------------------------------------------------------- # Test "itcl::import::stub" command # ---------------------------------------------------------------------- set interp [interp create] $interp eval " [list ::load $::itcllib itcl] [::tcltest::configure -load] proc auto_load {cmd {namespace {}}} { proc \$cmd {args} \[format {return \"%s: \$args\"} \$cmd\] return 1 } | > | 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | catch {interp delete $interp} # ---------------------------------------------------------------------- # Test "itcl::import::stub" command # ---------------------------------------------------------------------- set interp [interp create] $interp eval {set ::tcl::inl_mem_test 0} $interp eval " [list ::load $::itcllib itcl] [::tcltest::configure -load] proc auto_load {cmd {namespace {}}} { proc \$cmd {args} \[format {return \"%s: \$args\"} \$cmd\] return 1 } |
︙ | ︙ |
Changes to tests/namespace.test.
︙ | ︙ | |||
37 38 39 40 41 42 43 | namespace eval test_ns_2 { itcl::class Counter { variable num 0 method ++ {{by 2}} { if {$num == 0} { set num 1 } else { | | | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | namespace eval test_ns_2 { itcl::class Counter { variable num 0 method ++ {{by 2}} { if {$num == 0} { set num 1 } else { set num [expr {$num*$by}] } } method do {args} { return [eval $args] } common tag 2 } |
︙ | ︙ |
Changes to tests/scope.test.
︙ | ︙ | |||
85 86 87 88 89 90 91 | test scope-2.8 {last namespace wins} { itcl::code -namespace test_scope_ns::child -namespace test_scope_ns arg1 } {namespace inscope ::test_scope_ns arg1} test scope-2.9 {"--" terminates switches} { list [catch {itcl::code -namespace test_scope_ns -foo -bar} msg] $msg \ [catch {itcl::code -namespace test_scope_ns -- -foo -bar} msg] $msg | < | 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | test scope-2.8 {last namespace wins} { itcl::code -namespace test_scope_ns::child -namespace test_scope_ns arg1 } {namespace inscope ::test_scope_ns arg1} test scope-2.9 {"--" terminates switches} { list [catch {itcl::code -namespace test_scope_ns -foo -bar} msg] $msg \ [catch {itcl::code -namespace test_scope_ns -- -foo -bar} msg] $msg } {1 {bad option "-foo": should be -namespace or --} 0 {namespace inscope ::test_scope_ns {-foo -bar}}} namespace delete test_scope_ns # ---------------------------------------------------------------------- # Test code/scope commands in a class # ---------------------------------------------------------------------- |
︙ | ︙ |
Changes to tests/sfbugs.test.
︙ | ︙ | |||
442 443 444 445 446 447 448 | lappend ::test_status "proc Hello World" } } set obj1 [::cl1 #auto] ::cl1::p1 $obj1 p1 $obj1 m1 | | | 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 | lappend ::test_status "proc Hello World" } } set obj1 [::cl1 #auto] ::cl1::p1 $obj1 p1 $obj1 m1 catch { $obj1 m1 ::cl1::p1 } msg lappend ::test_status $msg } } -result {{proc Hello World} {proc Hello World} {method Hello World} {invalid command name "cl10"}} \ |
︙ | ︙ |
Changes to tests/widgetadaptor.test.
︙ | ︙ | |||
25 26 27 28 29 30 31 | # met by the active interpreter we forcibly bail out of the # testsuite calling the command. The command has to be called # immediately after loading the utilities. if {[package vsatisfies [package provide Tcl] ${version}-]} return puts " Aborting the tests found in \"[file tail [info script]]\"" | | | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | # met by the active interpreter we forcibly bail out of the # testsuite calling the command. The command has to be called # immediately after loading the utilities. if {[package vsatisfies [package provide Tcl] ${version}-]} return puts " Aborting the tests found in \"[file tail [info script]]\"" puts " Requiring at least Tcl $version, have [package provide Tcl]." # This causes a 'return' in the calling scope. return -code return } # ### ### ### ######### ######### ######### ## Declare the minimum version of Tcltest required to run the |
︙ | ︙ | |||
500 501 502 503 504 505 506 | } -cleanup { mylabel destroy } -result {Simulated Error} test install-1.3 {can't install until hull exists } -constraints { | | | 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 | } -cleanup { mylabel destroy } -result {Simulated Error} test install-1.3 {can't install until hull exists } -constraints { tk } -body { widgetadaptor myframe { # Delegate an option just to make sure the component variable # exists. delegate option -font to text constructor {args} { |
︙ | ︙ |
Changes to tests/widgetclass.test.
︙ | ︙ | |||
25 26 27 28 29 30 31 | # met by the active interpreter we forcibly bail out of the # testsuite calling the command. The command has to be called # immediately after loading the utilities. if {[package vsatisfies [package provide Tcl] ${version}-]} return puts " Aborting the tests found in \"[file tail [info script]]\"" | | | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | # met by the active interpreter we forcibly bail out of the # testsuite calling the command. The command has to be called # immediately after loading the utilities. if {[package vsatisfies [package provide Tcl] ${version}-]} return puts " Aborting the tests found in \"[file tail [info script]]\"" puts " Requiring at least Tcl $version, have [package provide Tcl]." # This causes a 'return' in the calling scope. return -code return } # ### ### ### ######### ######### ######### ## Declare the minimum version of Tcltest required to run the |
︙ | ︙ | |||
217 218 219 220 221 222 223 | delegate option -font to text typeconstructor { option add *Myframe.font Courier } constructor {args} { | | | 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | delegate option -font to text typeconstructor { option add *Myframe.font Courier } constructor {args} { installcomponent text using text $win.text } } myframe .frm set a [.frm cget -font] destroy .frm tkbide |
︙ | ︙ |
Changes to tools/genStubs.tcl.
︙ | ︙ | |||
498 499 500 501 502 503 504 | set pad 28 } append line $next set sep ", " } append line ", ...)" if {[lindex $args end] eq "{const char *} format"} { | | | 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 | set pad 28 } append line $next set sep ", " } append line ", ...)" if {[lindex $args end] eq "{const char *} format"} { append line " TCL_FORMAT_PRINTF(" [expr {[llength $args] - 1}] ", " [llength $args] ")" } } default { set sep "(" foreach arg $args { append line $sep set next {} |
︙ | ︙ | |||
598 599 600 601 602 603 604 | append text " " } append text [lindex $arg 1] [lindex $arg 2] set sep ", " } append text ", ...)" if {[lindex $args end] eq "{const char *} format"} { | | | 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 | append text " " } append text [lindex $arg 1] [lindex $arg 2] set sep ", " } append text ", ...)" if {[lindex $args end] eq "{const char *} format"} { append text " TCL_FORMAT_PRINTF(" [expr {[llength $args] - 1}] ", " [llength $args] ")" } } default { set sep "(" foreach arg $args { append text $sep [lindex $arg 0] if {[string index $text end] ne "*"} { |
︙ | ︙ |
Changes to win/dllEntryPoint.c.
|
| | | 1 2 3 4 5 6 7 8 | /* * dllEntryPoint.c -- * * This file implements the Dll entry point as needed by Windows. */ #define WIN32_LEAN_AND_MEAN #include <windows.h> |
︙ | ︙ |
Changes to win/makefile.vc.
1 2 3 4 5 6 7 8 9 10 11 12 | #------------------------------------------------------------- -*- makefile -*- # # Makefile for ITcl # # Basic build, test and install # nmake /s /nologo /f makefile.vc INSTALLDIR=c:\path\to\installdir TCLDIR=c:\path\to\tcl\source # nmake /s /nologo /f makefile.vc INSTALLDIR=c:\path\to\installdir TCLDIR=c:\path\to\tcl\source test # nmake /s /nologo /f makefile.vc INSTALLDIR=c:\path\to\installdir TCLDIR=c:\path\to\tcl\source install # # For other build options (debug, static etc.) # See TIP 477 (https://core.tcl.tk/tips/doc/trunk/tip/477.md) for # detailed documentation. | | < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | #------------------------------------------------------------- -*- makefile -*- # # Makefile for ITcl # # Basic build, test and install # nmake /s /nologo /f makefile.vc INSTALLDIR=c:\path\to\installdir TCLDIR=c:\path\to\tcl\source # nmake /s /nologo /f makefile.vc INSTALLDIR=c:\path\to\installdir TCLDIR=c:\path\to\tcl\source test # nmake /s /nologo /f makefile.vc INSTALLDIR=c:\path\to\installdir TCLDIR=c:\path\to\tcl\source install # # For other build options (debug, static etc.) # See TIP 477 (https://core.tcl.tk/tips/doc/trunk/tip/477.md) for # detailed documentation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # #------------------------------------------------------------------------------ PROJECT = itcl NEED_TCL_SOURCE = 1 RCFILE = itcl.rc !include "rules-ext.vc" PRJ_OBJS = \ $(TMP_DIR)\itcl2TclOO.obj \ $(TMP_DIR)\itclBase.obj \ $(TMP_DIR)\itclBuiltin.obj \ |
︙ | ︙ | |||
63 64 65 66 67 68 69 | # Define the standard targets except we have a custom test target DISABLE_TARGET_test = 1 !include "$(_RULESDIR)\targets.vc" pkgindex: $(OUT_DIR)\pkgIndex.tcl $(OUT_DIR)\pkgIndex.tcl: @$(COPY) << "$(OUT_DIR)\pkgIndex.tcl" | | | | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | # Define the standard targets except we have a custom test target DISABLE_TARGET_test = 1 !include "$(_RULESDIR)\targets.vc" pkgindex: $(OUT_DIR)\pkgIndex.tcl $(OUT_DIR)\pkgIndex.tcl: @$(COPY) << "$(OUT_DIR)\pkgIndex.tcl" if {[package vsatisfies 8.0 [package provide Tcl]]} { set add 80 } else { set add {t} } if {[::tcl::pkgconfig get debug] && \ [file exists [file join $$dir itcl$(VERSION)$${add}g.dll]]} { package ifneeded Itcl $(DOTVERSION) [list load [file join $$dir itcl$(VERSION)$${add}g.dll] Itcl] } else { package ifneeded Itcl $(DOTVERSION) [list load [file join $$dir itcl$(VERSION)$${add}.dll] Itcl] } unset add << |
︙ | ︙ |
Changes to win/nmakehlp.c.
︙ | ︙ | |||
70 71 72 73 74 75 76 | main( int argc, char *argv[]) { char msg[300]; DWORD dwWritten; int chars; | | | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | main( int argc, char *argv[]) { char msg[300]; DWORD dwWritten; int chars; const char *s; /* * Make sure children (cl.exe and link.exe) are kept quiet. */ SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); |
︙ | ︙ | |||
735 736 737 738 739 740 741 | strncpy(path, dir, dirlen); strncpy(path+dirlen, "\\*", 3); /* Including terminating \0 */ keylen = strlen(keypath); #if 0 /* This function is not available in Visual C++ 6 */ /* * Use numerics 0 -> FindExInfoStandard, | | | | 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 | strncpy(path, dir, dirlen); strncpy(path+dirlen, "\\*", 3); /* Including terminating \0 */ keylen = strlen(keypath); #if 0 /* This function is not available in Visual C++ 6 */ /* * Use numerics 0 -> FindExInfoStandard, * 1 -> FindExSearchLimitToDirectories, * as these are not defined in Visual C++ 6 */ hSearch = FindFirstFileEx(path, 0, &finfo, 1, NULL, 0); #else hSearch = FindFirstFile(path, &finfo); #endif if (hSearch == INVALID_HANDLE_VALUE) return 1; /* Not found */ /* Loop through all subdirs checking if the keypath is under there */ ret = 1; /* Assume not found */ do { int sublen; /* * We need to check it is a directory despite the * FindExSearchLimitToDirectories in the above call. See SDK docs */ if ((finfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) continue; sublen = strlen(finfo.cFileName); if ((dirlen+1+sublen+1+keylen+1) > sizeof(path)) continue; /* Path does not fit, assume not matched */ |
︙ | ︙ | |||
781 782 783 784 785 786 787 | * LocateDependency -- * * Locates a dependency for a package. * keypath - a relative path within the package directory * that is used to confirm it is the correct directory. * The search path for the package directory is currently only * the parent and grandparent of the current working directory. | | | | | 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 | * LocateDependency -- * * Locates a dependency for a package. * keypath - a relative path within the package directory * that is used to confirm it is the correct directory. * The search path for the package directory is currently only * the parent and grandparent of the current working directory. * If found, the command prints * name_DIRPATH=<full path of located directory> * and returns 0. If not found, does not print anything and returns 1. */ static int LocateDependency(const char *keypath) { int i, ret; static const char *paths[] = {"..", "..\\..", "..\\..\\.."}; for (i = 0; i < (sizeof(paths)/sizeof(paths[0])); ++i) { ret = LocateDependencyHelper(paths[i], keypath); if (ret == 0) return ret; } return ret; } |
︙ | ︙ |
Changes to win/rules.vc.
︙ | ︙ | |||
20 21 22 23 24 25 26 | !ifndef _RULES_VC _RULES_VC = 1 # The following macros define the version of the rules.vc nmake build system # For modifications that are not backward-compatible, you *must* change # the major version. RULES_VERSION_MAJOR = 1 | | | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | !ifndef _RULES_VC _RULES_VC = 1 # The following macros define the version of the rules.vc nmake build system # For modifications that are not backward-compatible, you *must* change # the major version. RULES_VERSION_MAJOR = 1 RULES_VERSION_MINOR = 4 # The PROJECT macro must be defined by parent makefile. !if "$(PROJECT)" == "" !error *** Error: Macro PROJECT not defined! Please define it before including rules.vc !endif !if "$(PRJ_PACKAGE_TCLNAME)" == "" |
︙ | ︙ | |||
158 159 160 161 162 163 164 | # some Tcl interfaces that are not publicly exposed. # # The fragment will set the following macros: # ROOT - root of this module sources # COMPATDIR - source directory that holds compatibility sources # DOCDIR - source directory containing documentation files # GENERICDIR - platform-independent source directory | | | 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | # some Tcl interfaces that are not publicly exposed. # # The fragment will set the following macros: # ROOT - root of this module sources # COMPATDIR - source directory that holds compatibility sources # DOCDIR - source directory containing documentation files # GENERICDIR - platform-independent source directory # WIN_DIR - Windows-specific source directory # TESTDIR - directory containing test files # TOOLSDIR - directory containing build tools # _TCLDIR - root of the Tcl installation OR the Tcl sources. Not set # when building Tcl itself. # _INSTALLDIR - native form of the installation path. For Tcl # this will be the root of the Tcl installation. For extensions # this will be the lib directory under the root. |
︙ | ︙ | |||
211 212 213 214 215 216 217 | !ifndef DEMODIR !if exist("$(LIBDIR)\demos") DEMODIR = $(LIBDIR)\demos !else DEMODIR = $(ROOT)\demos !endif !endif # ifndef DEMODIR | | | < < | | | | | 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | !ifndef DEMODIR !if exist("$(LIBDIR)\demos") DEMODIR = $(LIBDIR)\demos !else DEMODIR = $(ROOT)\demos !endif !endif # ifndef DEMODIR # Do NOT use WINDIR because it is Windows internal environment # variable to point to c:\windows! WIN_DIR = $(ROOT)\win !ifndef RCDIR !if exist("$(WIN_DIR)\rc") RCDIR = $(WIN_DIR)\rc !else RCDIR = $(WIN_DIR) !endif !endif RCDIR = $(RCDIR:/=\) # The target directory where the built packages and binaries will be installed. # INSTALLDIR is the (optional) path specified by the user. # _INSTALLDIR is INSTALLDIR using the backslash separator syntax |
︙ | ︙ | |||
389 390 391 392 393 394 395 | *** Warning: This extension requires the source distribution of Tk.^ *** Please set the TKDIR macro to point to the Tk sources. !error $(MSG) !endif !endif | | | | 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | *** Warning: This extension requires the source distribution of Tk.^ *** Please set the TKDIR macro to point to the Tk sources. !error $(MSG) !endif !endif # If INSTALLDIR set to Tcl installation root dir then reset to the # lib dir for installing extensions !if exist("$(_INSTALLDIR)\include\tcl.h") _INSTALLDIR=$(_INSTALLDIR)\lib !endif # END Case 2(c) or (d) - Building an extension !endif # if $(DOING_TCL) |
︙ | ︙ | |||
470 471 472 473 474 475 476 477 478 479 480 481 482 483 | !endif !if "$(MACHINE)" != "$(ARCH)" !error Specified MACHINE macro $(MACHINE) does not match detected target architecture $(ARCH). !endif !else MACHINE=$(ARCH) !endif #------------------------------------------------------------ # Figure out the *host* architecture by reading the registry !if ![reg query HKLM\Hardware\Description\System\CentralProcessor\0 /v Identifier | findstr /i x86] NATIVE_ARCH=IX86 !else | > > > > > > > > > > > > > > > | 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 | !endif !if "$(MACHINE)" != "$(ARCH)" !error Specified MACHINE macro $(MACHINE) does not match detected target architecture $(ARCH). !endif !else MACHINE=$(ARCH) !endif #--------------------------------------------------------------- # The PLATFORM_IDENTIFY macro matches the values returned by # the Tcl platform::identify command !if "$(MACHINE)" == "AMD64" PLATFORM_IDENTIFY = win32-x86_64 !else PLATFORM_IDENTIFY = win32-ix86 !endif # The MULTIPLATFORM macro controls whether binary extensions are installed # in platform-specific directories. Intended to be set/used by extensions. !ifndef MULTIPLATFORM_INSTALL MULTIPLATFORM_INSTALL = 0 !endif #------------------------------------------------------------ # Figure out the *host* architecture by reading the registry !if ![reg query HKLM\Hardware\Description\System\CentralProcessor\0 /v Identifier | findstr /i x86] NATIVE_ARCH=IX86 !else |
︙ | ︙ | |||
542 543 544 545 546 547 548 | # 5. Test for compiler features # Visual C++ compiler options have changed over the years. Check # which options are supported by the compiler in use. # # The following macros are set: # OPTIMIZATIONS - the compiler flags to be used for optimized builds # DEBUGFLAGS - the compiler flags to be used for debug builds | | | 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 | # 5. Test for compiler features # Visual C++ compiler options have changed over the years. Check # which options are supported by the compiler in use. # # The following macros are set: # OPTIMIZATIONS - the compiler flags to be used for optimized builds # DEBUGFLAGS - the compiler flags to be used for debug builds # LINKERFLAGS - Flags passed to the linker # # Note that these are the compiler settings *available*, not those # that will be *used*. The latter depends on the OPTS macro settings # which we have not yet parsed. # # Also note that some of the flags in OPTIMIZATIONS are not really # related to optimization. They are placed there only for legacy reasons |
︙ | ︙ | |||
667 668 669 670 671 672 673 674 675 676 677 678 679 680 | # USE_THREAD_ALLOC - 1 -> Use a shared global free pool for allocation. # 0 -> Use the non-thread allocator. # UNCHECKED - 1 -> when doing a debug build with symbols, use the release # C runtime, 0 -> use the debug C runtime. # USE_STUBS - 1 -> compile to use stubs interfaces, 0 -> direct linking # CONFIG_CHECK - 1 -> check current build configuration against Tcl # configuration (ignored for Tcl itself) # Further, LINKERFLAGS are modified based on above. # Default values for all the above STATIC_BUILD = 0 TCL_THREADS = 1 DEBUG = 0 SYMBOLS = 0 | > > | 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 | # USE_THREAD_ALLOC - 1 -> Use a shared global free pool for allocation. # 0 -> Use the non-thread allocator. # UNCHECKED - 1 -> when doing a debug build with symbols, use the release # C runtime, 0 -> use the debug C runtime. # USE_STUBS - 1 -> compile to use stubs interfaces, 0 -> direct linking # CONFIG_CHECK - 1 -> check current build configuration against Tcl # configuration (ignored for Tcl itself) # _USE_64BIT_TIME_T - forces a build using 64-bit time_t for 32-bit build # (CRT library should support this) # Further, LINKERFLAGS are modified based on above. # Default values for all the above STATIC_BUILD = 0 TCL_THREADS = 1 DEBUG = 0 SYMBOLS = 0 |
︙ | ︙ | |||
728 729 730 731 732 733 734 | TCL_USE_STATIC_PACKAGES = 1 !else TCL_USE_STATIC_PACKAGES = 0 !endif !if [nmakehlp -f $(OPTS) "nothreads"] !message *** Compile explicitly for non-threaded tcl | | > > > > > > > | 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 | TCL_USE_STATIC_PACKAGES = 1 !else TCL_USE_STATIC_PACKAGES = 0 !endif !if [nmakehlp -f $(OPTS) "nothreads"] !message *** Compile explicitly for non-threaded tcl TCL_THREADS = 0 USE_THREAD_ALLOC= 0 !else TCL_THREADS = 1 USE_THREAD_ALLOC= 1 !endif !if [nmakehlp -f $(OPTS) "time64bit"] !message *** Force 64-bit time_t _USE_64BIT_TIME_T = 1 !endif # Yes, it's weird that the "symbols" option controls DEBUG and # the "pdbs" option controls SYMBOLS. That's historical. !if [nmakehlp -f $(OPTS) "symbols"] !message *** Doing symbols DEBUG = 1 !else DEBUG = 0 !endif |
︙ | ︙ | |||
966 967 968 969 970 971 972 | ################################################################ # 10. Construct output directory and file paths # Figure-out how to name our intermediate and output directories. # In order to avoid inadvertent mixing of object files built using # different compilers, build configurations etc., # # Naming convention (suffixes): | | | 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 | ################################################################ # 10. Construct output directory and file paths # Figure-out how to name our intermediate and output directories. # In order to avoid inadvertent mixing of object files built using # different compilers, build configurations etc., # # Naming convention (suffixes): # t = full thread support. (Not used for Tcl >= 8.7) # s = static library (as opposed to an import library) # g = linked to the debug enabled C run-time. # x = special static build when it links to the dynamic C run-time. # # The following macros are set in this section: # SUFX - the suffix to use for binaries based on above naming convention # BUILDDIRTOP - the toplevel default output directory |
︙ | ︙ | |||
1024 1025 1026 1027 1028 1029 1030 | EXT = lib !if !$(MSVCRT) TMP_DIRFULL = $(TMP_DIRFULL:X=) SUFX = $(SUFX:x=) !endif !endif | | | 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 | EXT = lib !if !$(MSVCRT) TMP_DIRFULL = $(TMP_DIRFULL:X=) SUFX = $(SUFX:x=) !endif !endif !if !$(TCL_THREADS) || $(TCL_VERSION) > 86 TMP_DIRFULL = $(TMP_DIRFULL:Threaded=) SUFX = $(SUFX:t=) !endif !ifndef TMP_DIR TMP_DIR = $(TMP_DIRFULL) !ifndef OUT_DIR |
︙ | ︙ | |||
1057 1058 1059 1060 1061 1062 1063 | # The name of the stubs library for the project being built STUBPREFIX = $(PROJECT)stub # Set up paths to various Tcl executables and libraries needed by extensions !if $(DOING_TCL) | | | | < < < | | | | < < < | | | | 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 | # The name of the stubs library for the project being built STUBPREFIX = $(PROJECT)stub # Set up paths to various Tcl executables and libraries needed by extensions !if $(DOING_TCL) TCLSHNAME = $(PROJECT)sh$(VERSION)$(SUFX).exe TCLSH = $(OUT_DIR)\$(TCLSHNAME) TCLIMPLIB = $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib TCLLIBNAME = $(PROJECT)$(VERSION)$(SUFX).$(EXT) TCLLIB = $(OUT_DIR)\$(TCLLIBNAME) TCLSTUBLIBNAME = $(STUBPREFIX)$(VERSION).lib TCLSTUBLIB = $(OUT_DIR)\$(TCLSTUBLIBNAME) TCL_INCLUDES = -I"$(WIN_DIR)" -I"$(GENERICDIR)" !else # ! $(DOING_TCL) !if $(TCLINSTALL) # Building against an installed Tcl # When building extensions, we need to locate tclsh. Depending on version # of Tcl we are building against, this may or may not have a "t" suffix. # Try various possibilities in turn. TCLSH = $(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX:t=).exe !if !exist("$(TCLSH)") TCLSH = $(_TCLDIR)\bin\tclsh$(TCL_VERSION)t$(SUFX:t=).exe !endif TCLSTUBLIB = $(_TCLDIR)\lib\tclstub$(TCL_VERSION).lib TCLIMPLIB = $(_TCLDIR)\lib\tcl$(TCL_VERSION)$(SUFX:t=).lib # When building extensions, may be linking against Tcl that does not add # "t" suffix (e.g. 8.5 or 8.7). If lib not found check for that possibility. !if !exist("$(TCLIMPLIB)") TCLIMPLIB = $(_TCLDIR)\lib\tcl$(TCL_VERSION)t$(SUFX:t=).lib !endif TCL_LIBRARY = $(_TCLDIR)\lib TCLREGLIB = $(_TCLDIR)\lib\tclreg13$(SUFX:t=).lib TCLDDELIB = $(_TCLDIR)\lib\tcldde14$(SUFX:t=).lib TCLTOOLSDIR = \must\have\tcl\sources\to\build\this\target TCL_INCLUDES = -I"$(_TCLDIR)\include" !else # Building against Tcl sources TCLSH = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)$(SUFX:t=).exe !if !exist($(TCLSH)) TCLSH = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)t$(SUFX:t=).exe !endif TCLSTUBLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub$(TCL_VERSION).lib TCLIMPLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX:t=).lib # When building extensions, may be linking against Tcl that does not add # "t" suffix (e.g. 8.5 or 8.7). If lib not found check for that possibility. !if !exist("$(TCLIMPLIB)") TCLIMPLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)t$(SUFX:t=).lib !endif TCL_LIBRARY = $(_TCLDIR)\library TCLREGLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclreg13$(SUFX:t=).lib TCLDDELIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tcldde14$(SUFX:t=).lib TCLTOOLSDIR = $(_TCLDIR)\tools TCL_INCLUDES = -I"$(_TCLDIR)\generic" -I"$(_TCLDIR)\win" |
︙ | ︙ | |||
1146 1147 1148 1149 1150 1151 1152 | TKIMPLIBNAME = tk$(TK_VERSION)$(SUFX).lib !if $(DOING_TK) WISH = $(OUT_DIR)\$(WISHNAME) TKSTUBLIB = $(OUT_DIR)\$(TKSTUBLIBNAME) TKIMPLIB = $(OUT_DIR)\$(TKIMPLIBNAME) TKLIB = $(OUT_DIR)\$(TKLIBNAME) | | | 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 | TKIMPLIBNAME = tk$(TK_VERSION)$(SUFX).lib !if $(DOING_TK) WISH = $(OUT_DIR)\$(WISHNAME) TKSTUBLIB = $(OUT_DIR)\$(TKSTUBLIBNAME) TKIMPLIB = $(OUT_DIR)\$(TKIMPLIBNAME) TKLIB = $(OUT_DIR)\$(TKLIBNAME) TK_INCLUDES = -I"$(WIN_DIR)" -I"$(GENERICDIR)" !else # effectively NEED_TK !if $(TKINSTALL) # Building against installed Tk WISH = $(_TKDIR)\bin\$(WISHNAME) TKSTUBLIB = $(_TKDIR)\lib\$(TKSTUBLIBNAME) TKIMPLIB = $(_TKDIR)\lib\$(TKIMPLIBNAME) |
︙ | ︙ | |||
1205 1206 1207 1208 1209 1210 1211 | # The following macros get defined in this section: # LIB_INSTALL_DIR - where libraries should be installed # BIN_INSTALL_DIR - where the executables should be installed # DOC_INSTALL_DIR - where documentation should be installed # SCRIPT_INSTALL_DIR - where scripts should be installed # INCLUDE_INSTALL_DIR - where C include files should be installed # DEMO_INSTALL_DIR - where demos should be installed | | > > > > > | | 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 | # The following macros get defined in this section: # LIB_INSTALL_DIR - where libraries should be installed # BIN_INSTALL_DIR - where the executables should be installed # DOC_INSTALL_DIR - where documentation should be installed # SCRIPT_INSTALL_DIR - where scripts should be installed # INCLUDE_INSTALL_DIR - where C include files should be installed # DEMO_INSTALL_DIR - where demos should be installed # PRJ_INSTALL_DIR - where package will be installed (not set for Tcl and Tk) !if $(DOING_TCL) || $(DOING_TK) LIB_INSTALL_DIR = $(_INSTALLDIR)\lib BIN_INSTALL_DIR = $(_INSTALLDIR)\bin DOC_INSTALL_DIR = $(_INSTALLDIR)\doc !if $(DOING_TCL) SCRIPT_INSTALL_DIR = $(_INSTALLDIR)\lib\$(PROJECT)$(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION) !else # DOING_TK SCRIPT_INSTALL_DIR = $(_INSTALLDIR)\lib\$(PROJECT)$(TK_MAJOR_VERSION).$(TK_MINOR_VERSION) !endif DEMO_INSTALL_DIR = $(SCRIPT_INSTALL_DIR)\demos INCLUDE_INSTALL_DIR = $(_INSTALLDIR)\include !else # extension other than Tk PRJ_INSTALL_DIR = $(_INSTALLDIR)\$(PROJECT)$(DOTVERSION) !if $(MULTIPLATFORM_INSTALL) LIB_INSTALL_DIR = $(PRJ_INSTALL_DIR)\$(PLATFORM_IDENTIFY) BIN_INSTALL_DIR = $(PRJ_INSTALL_DIR)\$(PLATFORM_IDENTIFY) !else LIB_INSTALL_DIR = $(PRJ_INSTALL_DIR) BIN_INSTALL_DIR = $(PRJ_INSTALL_DIR) !endif DOC_INSTALL_DIR = $(PRJ_INSTALL_DIR) SCRIPT_INSTALL_DIR = $(PRJ_INSTALL_DIR) DEMO_INSTALL_DIR = $(PRJ_INSTALL_DIR)\demos INCLUDE_INSTALL_DIR = $(_INSTALLDIR)\..\include !endif ################################################################### # 12. Set up actual options to be passed to the compiler and linker # Now we have all the information we need, set up the actual flags and # options that we will pass to the compiler and linker. The main |
︙ | ︙ | |||
1260 1261 1262 1263 1264 1265 1266 | !if $(TCL_MEM_DEBUG) OPTDEFINES = $(OPTDEFINES) -DTCL_MEM_DEBUG !endif !if $(TCL_COMPILE_DEBUG) OPTDEFINES = $(OPTDEFINES) -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS !endif | | | | 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 | !if $(TCL_MEM_DEBUG) OPTDEFINES = $(OPTDEFINES) -DTCL_MEM_DEBUG !endif !if $(TCL_COMPILE_DEBUG) OPTDEFINES = $(OPTDEFINES) -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS !endif !if $(TCL_THREADS) && $(TCL_VERSION) < 87 OPTDEFINES = $(OPTDEFINES) -DTCL_THREADS=1 !if $(USE_THREAD_ALLOC) && $(TCL_VERSION) < 87 OPTDEFINES = $(OPTDEFINES) -DUSE_THREAD_ALLOC=1 !endif !endif !if $(STATIC_BUILD) OPTDEFINES = $(OPTDEFINES) -DSTATIC_BUILD !endif !if $(TCL_NO_DEPRECATED) |
︙ | ︙ | |||
1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 | !endif !if "$(MACHINE)" == "AMD64" OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_DO64BIT !endif !if $(VCVERSION) < 1300 OPTDEFINES = $(OPTDEFINES) -DNO_STRTOI64 !endif # _ATL_XP_TARGETING - Newer SDK's need this to build for XP COMPILERFLAGS = /D_ATL_XP_TARGETING | > > > > < < < < < < < < < < < < < < < < < | | 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 | !endif !if "$(MACHINE)" == "AMD64" OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_DO64BIT !endif !if $(VCVERSION) < 1300 OPTDEFINES = $(OPTDEFINES) -DNO_STRTOI64 !endif !if "$(_USE_64BIT_TIME_T)" == "1" OPTDEFINES = $(OPTDEFINES) -D_USE_64BIT_TIME_T !endif # _ATL_XP_TARGETING - Newer SDK's need this to build for XP COMPILERFLAGS = /D_ATL_XP_TARGETING # Like the TEA system only set this non empty for non-Tk extensions # Note: some extensions use PACKAGE_NAME and others use PACKAGE_TCLNAME # so we pass both !if !$(DOING_TCL) && !$(DOING_TK) PKGNAMEFLAGS = -DPACKAGE_NAME="\"$(PRJ_PACKAGE_TCLNAME)\"" \ -DPACKAGE_TCLNAME="\"$(PRJ_PACKAGE_TCLNAME)\"" \ -DPACKAGE_VERSION="\"$(DOTVERSION)\"" \ -DMODULE_SCOPE=extern !endif # crt picks the C run time based on selected OPTS !if $(MSVCRT) !if $(DEBUG) && !$(UNCHECKED) crt = -MDd !else |
︙ | ︙ | |||
1386 1387 1388 1389 1390 1391 1392 | !if $(DEBUG) # Turn warnings into errors cwarn = $(cwarn) -WX !endif INCLUDES = $(TCL_INCLUDES) $(TK_INCLUDES) $(PRJ_INCLUDES) !if !$(DOING_TCL) && !$(DOING_TK) | | < > | | | | 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 | !if $(DEBUG) # Turn warnings into errors cwarn = $(cwarn) -WX !endif INCLUDES = $(TCL_INCLUDES) $(TK_INCLUDES) $(PRJ_INCLUDES) !if !$(DOING_TCL) && !$(DOING_TK) INCLUDES = $(INCLUDES) -I"$(GENERICDIR)" -I"$(WIN_DIR)" -I"$(COMPATDIR)" !endif # These flags are defined roughly in the order of the pre-reform # rules.vc/makefile.vc to help visually compare that the pre- and # post-reform build logs # cflags contains generic flags used for building practically all object files cflags = -nologo -c $(COMPILERFLAGS) $(carch) $(cwarn) -Fp$(TMP_DIR)^\ $(cdebug) # appcflags contains $(cflags) and flags for building the application # object files (e.g. tclsh, or wish) pkgcflags contains $(cflags) plus # flags used for building shared object files The two differ in the # BUILD_$(PROJECT) macro which should be defined only for the shared # library *implementation* and not for its caller interface appcflags_nostubs = $(cflags) $(crt) $(INCLUDES) $(TCL_DEFINES) $(PRJ_DEFINES) $(OPTDEFINES) appcflags = $(appcflags_nostubs) $(USE_STUBS_DEFS) pkgcflags = $(appcflags) $(PKGNAMEFLAGS) -DBUILD_$(PROJECT) pkgcflags_nostubs = $(appcflags_nostubs) $(PKGNAMEFLAGS) -DBUILD_$(PROJECT) # stubscflags contains $(cflags) plus flags used for building a stubs # library for the package. Note: -DSTATIC_BUILD is defined in # $(OPTDEFINES) only if the OPTS configuration indicates a static # library. However the stubs library is ALWAYS static hence included # here irrespective of the OPTS setting. # # TBD - tclvfs has a comment that stubs libs should not be compiled with -GL # without stating why. Tcl itself compiled stubs libs with this flag. # so we do not remove it from cflags. -GL may prevent extensions # compiled with one VC version to fail to link against stubs library # compiled with another VC version. Check for this and fix accordingly. stubscflags = $(cflags) $(PKGNAMEFLAGS) $(PRJ_DEFINES) $(OPTDEFINES) -Zl -DSTATIC_BUILD $(INCLUDES) $(USE_STUBS_DEFS) # Link flags !if $(DEBUG) ldebug = -debug -debugtype:cv !else ldebug = -release -opt:ref -opt:icf,3 !if $(SYMBOLS) ldebug = $(ldebug) -debug -debugtype:cv !endif !endif # Note: Profiling is currently only possible with the Visual Studio Enterprise !if $(PROFILE) ldebug= $(ldebug) -profile !endif ### Declarations common to all linker versions lflags = -nologo -machine:$(MACHINE) $(LINKERFLAGS) $(ldebug) !if $(MSVCRT) && !($(DEBUG) && !$(UNCHECKED)) && $(VCVERSION) >= 1900 lflags = $(lflags) -nodefaultlib:libucrt.lib !endif # Old linkers (Visual C++ 6 in particular) will link for fast loading |
︙ | ︙ | |||
1500 1501 1502 1503 1504 1505 1506 | RESCMD = $(rc32) -fo $@ -r -i "$(GENERICDIR)" -i "$(TMP_DIR)" \ $(TCL_INCLUDES) \ -DDEBUG=$(DEBUG) -d UNCHECKED=$(UNCHECKED) \ -DCOMMAVERSION=$(DOTVERSION:.=,),0 \ -DDOTVERSION=\"$(DOTVERSION)\" \ -DVERSION=\"$(VERSION)\" \ -DSUFX=\"$(SUFX)\" \ | | | > > > > > > | > | > > > > > > > | | | > | > > > > > > > | | | | | | | | | | | | | | | 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 | RESCMD = $(rc32) -fo $@ -r -i "$(GENERICDIR)" -i "$(TMP_DIR)" \ $(TCL_INCLUDES) \ -DDEBUG=$(DEBUG) -d UNCHECKED=$(UNCHECKED) \ -DCOMMAVERSION=$(DOTVERSION:.=,),0 \ -DDOTVERSION=\"$(DOTVERSION)\" \ -DVERSION=\"$(VERSION)\" \ -DSUFX=\"$(SUFX)\" \ -DPROJECT=\"$(PROJECT)\" \ -DPRJLIBNAME=\"$(PRJLIBNAME)\" !ifndef DEFAULT_BUILD_TARGET DEFAULT_BUILD_TARGET = $(PROJECT) !endif default-target: $(DEFAULT_BUILD_TARGET) !if $(MULTIPLATFORM_INSTALL) default-pkgindex: @echo package ifneeded $(PRJ_PACKAGE_TCLNAME) $(DOTVERSION) \ [list load [file join $$dir $(PLATFORM_IDENTIFY) $(PRJLIBNAME)]] > $(OUT_DIR)\pkgIndex.tcl !else default-pkgindex: @echo package ifneeded $(PRJ_PACKAGE_TCLNAME) $(DOTVERSION) \ [list load [file join $$dir $(PRJLIBNAME)]] > $(OUT_DIR)\pkgIndex.tcl !endif default-pkgindex-tea: @if exist $(ROOT)\pkgIndex.tcl.in nmakehlp -s << $(ROOT)\pkgIndex.tcl.in > $(OUT_DIR)\pkgIndex.tcl @PACKAGE_VERSION@ $(DOTVERSION) @PACKAGE_NAME@ $(PRJ_PACKAGE_TCLNAME) @PACKAGE_TCLNAME@ $(PRJ_PACKAGE_TCLNAME) @PKG_LIB_FILE@ $(PRJLIBNAME) << default-install: default-install-binaries default-install-libraries !if $(SYMBOLS) default-install: default-install-pdbs !endif # Again to deal with historical brokenness, there is some confusion # in terminlogy. For extensions, the "install-binaries" was used to # locate target directory for *binary shared libraries* and thus # the appropriate macro is LIB_INSTALL_DIR since BIN_INSTALL_DIR is # for executables (exes). On the other hand the "install-libraries" # target is for *scripts* and should have been called "install-scripts". default-install-binaries: $(PRJLIB) @echo Installing binaries to '$(LIB_INSTALL_DIR)' @if not exist "$(LIB_INSTALL_DIR)" mkdir "$(LIB_INSTALL_DIR)" @$(CPY) $(PRJLIB) "$(LIB_INSTALL_DIR)" >NUL # Alias for default-install-scripts default-install-libraries: default-install-scripts default-install-scripts: $(OUT_DIR)\pkgIndex.tcl @echo Installing libraries to '$(SCRIPT_INSTALL_DIR)' @if exist $(LIBDIR) $(CPY) $(LIBDIR)\*.tcl "$(SCRIPT_INSTALL_DIR)" @echo Installing package index in '$(SCRIPT_INSTALL_DIR)' @$(CPY) $(OUT_DIR)\pkgIndex.tcl $(SCRIPT_INSTALL_DIR) default-install-stubs: @echo Installing stubs library to '$(SCRIPT_INSTALL_DIR)' @if not exist "$(SCRIPT_INSTALL_DIR)" mkdir "$(SCRIPT_INSTALL_DIR)" @$(CPY) $(PRJSTUBLIB) "$(SCRIPT_INSTALL_DIR)" >NUL default-install-pdbs: @echo Installing PDBs to '$(LIB_INSTALL_DIR)' @if not exist "$(LIB_INSTALL_DIR)" mkdir "$(LIB_INSTALL_DIR)" @$(CPY) "$(OUT_DIR)\*.pdb" "$(LIB_INSTALL_DIR)\" default-install-docs-html: @echo Installing documentation files to '$(DOC_INSTALL_DIR)' @if not exist "$(DOC_INSTALL_DIR)" mkdir "$(DOC_INSTALL_DIR)" @if exist $(DOCDIR) for %f in ("$(DOCDIR)\*.html" "$(DOCDIR)\*.css" "$(DOCDIR)\*.png") do @$(COPY) %f "$(DOC_INSTALL_DIR)" default-install-docs-n: @echo Installing documentation files to '$(DOC_INSTALL_DIR)' @if not exist "$(DOC_INSTALL_DIR)" mkdir "$(DOC_INSTALL_DIR)" @if exist $(DOCDIR) for %f in ("$(DOCDIR)\*.n") do @$(COPY) %f "$(DOC_INSTALL_DIR)" default-install-demos: @echo Installing demos to '$(DEMO_INSTALL_DIR)' @if not exist "$(DEMO_INSTALL_DIR)" mkdir "$(DEMO_INSTALL_DIR)" @if exist $(DEMODIR) $(CPYDIR) "$(DEMODIR)" "$(DEMO_INSTALL_DIR)" default-clean: @echo Cleaning $(TMP_DIR)\* ... @if exist $(TMP_DIR)\nul $(RMDIR) $(TMP_DIR) @echo Cleaning $(WIN_DIR)\nmakehlp.obj, nmakehlp.exe ... @if exist $(WIN_DIR)\nmakehlp.obj del $(WIN_DIR)\nmakehlp.obj @if exist $(WIN_DIR)\nmakehlp.exe del $(WIN_DIR)\nmakehlp.exe @if exist $(WIN_DIR)\nmakehlp.out del $(WIN_DIR)\nmakehlp.out @echo Cleaning $(WIN_DIR)\nmhlp-out.txt ... @if exist $(WIN_DIR)\nmhlp-out.txt del $(WIN_DIR)\nmhlp-out.txt @echo Cleaning $(WIN_DIR)\_junk.pch ... @if exist $(WIN_DIR)\_junk.pch del $(WIN_DIR)\_junk.pch @echo Cleaning $(WIN_DIR)\vercl.x, vercl.i ... @if exist $(WIN_DIR)\vercl.x del $(WIN_DIR)\vercl.x @if exist $(WIN_DIR)\vercl.i del $(WIN_DIR)\vercl.i @echo Cleaning $(WIN_DIR)\versions.vc, version.vc ... @if exist $(WIN_DIR)\versions.vc del $(WIN_DIR)\versions.vc @if exist $(WIN_DIR)\version.vc del $(WIN_DIR)\version.vc default-hose: default-clean @echo Hosing $(OUT_DIR)\* ... @if exist $(OUT_DIR)\nul $(RMDIR) $(OUT_DIR) # Only for backward compatibility default-distclean: default-hose |
︙ | ︙ | |||
1598 1599 1600 1601 1602 1603 1604 | cd "$(TESTDIR)" && $(DEBUGGER) $(TCLSH) all.tcl $(TESTFLAGS) default-shell: default-setup $(PROJECT) @set TCLLIBPATH=$(OUT_DIR:\=/) @if exist $(LIBDIR) for %f in ("$(LIBDIR)\*.tcl") do @$(COPY) %f "$(OUT_DIR)" $(DEBUGGER) $(TCLSH) | | | 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 | cd "$(TESTDIR)" && $(DEBUGGER) $(TCLSH) all.tcl $(TESTFLAGS) default-shell: default-setup $(PROJECT) @set TCLLIBPATH=$(OUT_DIR:\=/) @if exist $(LIBDIR) for %f in ("$(LIBDIR)\*.tcl") do @$(COPY) %f "$(OUT_DIR)" $(DEBUGGER) $(TCLSH) # Generation of Windows version resource !ifdef RCFILE # Note: don't use $** in below rule because there may be other dependencies # and only the "master" rc must be passed to the resource compiler $(TMP_DIR)\$(PROJECT).res: $(RCDIR)\$(PROJECT).rc $(RESCMD) $(RCDIR)\$(PROJECT).rc |
︙ | ︙ | |||
1637 1638 1639 1640 1641 1642 1643 | BEGIN BLOCK "040904b0" BEGIN VALUE "FileDescription", "Tcl extension " PROJECT VALUE "OriginalFilename", PRJLIBNAME VALUE "FileVersion", DOTVERSION VALUE "ProductName", "Package " PROJECT " for Tcl" | | | 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 | BEGIN BLOCK "040904b0" BEGIN VALUE "FileDescription", "Tcl extension " PROJECT VALUE "OriginalFilename", PRJLIBNAME VALUE "FileVersion", DOTVERSION VALUE "ProductName", "Package " PROJECT " for Tcl" VALUE "ProductVersion", DOTVERSION END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1200 END END |
︙ | ︙ | |||
1663 1664 1665 1666 1667 1668 1669 | # main application, the master makefile should define explicit rules. {$(ROOT)}.c{$(TMP_DIR)}.obj:: $(CCPKGCMD) @<< $< << | | | | 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 | # main application, the master makefile should define explicit rules. {$(ROOT)}.c{$(TMP_DIR)}.obj:: $(CCPKGCMD) @<< $< << {$(WIN_DIR)}.c{$(TMP_DIR)}.obj:: $(CCPKGCMD) @<< $< << {$(GENERICDIR)}.c{$(TMP_DIR)}.obj:: $(CCPKGCMD) @<< $< << {$(COMPATDIR)}.c{$(TMP_DIR)}.obj:: $(CCPKGCMD) @<< $< << {$(RCDIR)}.rc{$(TMP_DIR)}.res: $(RESCMD) $< {$(WIN_DIR)}.rc{$(TMP_DIR)}.res: $(RESCMD) $< {$(TMP_DIR)}.rc{$(TMP_DIR)}.res: $(RESCMD) $< .SUFFIXES: .SUFFIXES:.c .rc |
︙ | ︙ | |||
1716 1717 1718 1719 1720 1721 1722 | !if $(CONFIG_CHECK) !ifdef TCLNMAKECONFIG !include $(TCLNMAKECONFIG) !if defined(CORE_MACHINE) && "$(CORE_MACHINE)" != "$(MACHINE)" !error ERROR: Build target ($(MACHINE)) does not match the Tcl library architecture ($(CORE_MACHINE)). !endif | | | 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 | !if $(CONFIG_CHECK) !ifdef TCLNMAKECONFIG !include $(TCLNMAKECONFIG) !if defined(CORE_MACHINE) && "$(CORE_MACHINE)" != "$(MACHINE)" !error ERROR: Build target ($(MACHINE)) does not match the Tcl library architecture ($(CORE_MACHINE)). !endif !if $(TCL_VERSION) < 87 && defined(CORE_USE_THREAD_ALLOC) && $(CORE_USE_THREAD_ALLOC) != $(USE_THREAD_ALLOC) !message WARNING: Value of USE_THREAD_ALLOC ($(USE_THREAD_ALLOC)) does not match its Tcl core value ($(CORE_USE_THREAD_ALLOC)). !endif !if defined(CORE_DEBUG) && $(CORE_DEBUG) != $(DEBUG) !message WARNING: Value of DEBUG ($(DEBUG)) does not match its Tcl library configuration ($(DEBUG)). !endif !endif |
︙ | ︙ |