diff options
author | dgp <dgp@users.sourceforge.net> | 2013-03-05 22:13:30 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2013-03-05 22:13:30 (GMT) |
commit | 69eed829d100f7dcbe449ef6854ae7d24f72179c (patch) | |
tree | 75bdcad5e3dd07490f2ff56d5d37a926d77e61a2 /generic/tclLiteral.c | |
parent | 9e95ecd95bda273bf6f0b4c6b3816c6043b868ae (diff) | |
download | tcl-69eed829d100f7dcbe449ef6854ae7d24f72179c.zip tcl-69eed829d100f7dcbe449ef6854ae7d24f72179c.tar.gz tcl-69eed829d100f7dcbe449ef6854ae7d24f72179c.tar.bz2 |
New internal routine TclFetchLiteral() for better CompileEnv encapsulation.
Diffstat (limited to 'generic/tclLiteral.c')
-rw-r--r-- | generic/tclLiteral.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/generic/tclLiteral.c b/generic/tclLiteral.c index bd5fe73..e2ee9b4 100644 --- a/generic/tclLiteral.c +++ b/generic/tclLiteral.c @@ -305,6 +305,33 @@ TclCreateLiteral( /* *---------------------------------------------------------------------- * + * TclFetchLiteral -- + * + * Fetch from a CompileEnv the literal value identified by an index + * value, as returned by a prior call to TclRegisterLiteral(). + * + * Results: + * The literal value, or NULL if the index is out of range. + * + *---------------------------------------------------------------------- + */ + +Tcl_Obj * +TclFetchLiteral( + CompileEnv *envPtr, /* Points to the CompileEnv from which to + * fetch the registered literal value. */ + unsigned int index) /* Index of the desired literal, as returned + * by prior call to TclRegisterLiteral() */ +{ + if (index >= envPtr->literalArrayNext) { + return NULL; + } + return envPtr->literalArrayPtr[index].objPtr; +} + +/* + *---------------------------------------------------------------------- + * * TclRegisterLiteral -- * * Find, or if necessary create, an object in a CompileEnv literal array |