| 1 | |
| 2 | /* $Id: tixItcl.c,v 1.1.1.1 2000/05/17 11:08:42 idiscovery Exp $ */ |
| 3 | |
| 4 | /* |
| 5 | * tixItcl.c -- |
| 6 | * |
| 7 | * Compatibility functions that allow Tix to work under Incr Tcl. |
| 8 | * |
| 9 | * Copyright (c) 1996, Expert Interface Technologies |
| 10 | * |
| 11 | * See the file "license.terms" for information on usage and |
| 12 | * redistribution of this file, and for a DISCLAIMER OF ALL |
| 13 | * WARRANTIES. |
| 14 | * |
| 15 | */ |
| 16 | |
| 17 | /* |
| 18 | * With Tcl 8.0, namespaces moved from Itcl to Tcl, and so |
| 19 | * the Tix hacks have to be used in any verison of 8.0, |
| 20 | * regardless of the presence of Itcl... |
| 21 | */ |
| 22 | #include "Lang.h" |
| 23 | #include "tixInt.h" |
| 24 | #include "tixItcl.h" |
| 25 | |
| 26 | /*---------------------------------------------------------------------- |
| 27 | * TixItclSetGlobalNameSp -- |
| 28 | * |
| 29 | * Set the ITcl scope to the global scope. This way, all the Tix |
| 30 | * commands and variables will be defined in the global scope. This |
| 31 | * is necessary for Tix to function properly under ITcl. |
| 32 | * |
| 33 | *---------------------------------------------------------------------- |
| 34 | */ |
| 35 | int |
| 36 | TixItclSetGlobalNameSp(nameSpPtr, interp) |
| 37 | TixItclNameSp * nameSpPtr; |
| 38 | Tcl_Interp * interp; |
| 39 | { |
| 40 | Interp *p = nameSpPtr->iPtr; |
| 41 | nameSpPtr->savedVarFramePtr = p->varFramePtr; |
| 42 | if ( NULL == p->varFramePtr |
| 43 | || p->varFramePtr->nsPtr == p->globalNsPtr ) { |
| 44 | return 1; |
| 45 | } |
| 46 | p->varFramePtr = NULL; |
| 47 | return 1; |
| 48 | } |
| 49 | |
| 50 | /*---------------------------------------------------------------------- |
| 51 | * TixItclRestoreGlobalNameSp -- |
| 52 | * |
| 53 | * Set the ITcl scope to the scope saved by TixItclSetGlobalNameSp. |
| 54 | * |
| 55 | *---------------------------------------------------------------------- |
| 56 | */ |
| 57 | void |
| 58 | TixItclRestoreGlobalNameSp(nameSpPtr, interp) |
| 59 | TixItclNameSp * nameSpPtr; |
| 60 | Tcl_Interp * interp; |
| 61 | { |
| 62 | nameSpPtr->iPtr->varFramePtr = nameSpPtr->savedVarFramePtr; |
| 63 | } |