diff options
author | Miguel Sofer <miguel.sofer@gmail.com> | 2004-12-24 18:06:53 (GMT) |
---|---|---|
committer | Miguel Sofer <miguel.sofer@gmail.com> | 2004-12-24 18:06:53 (GMT) |
commit | 3c1e7bd70247b897a1e6f47d8fcb6d50de880aea (patch) | |
tree | 3c5ff4f02494bc5285f2fcf529ccf0a76dd8885c /generic/tclCompile.h | |
parent | 3f7f31fb81efcc04c41dcc79f2417a766353ad66 (diff) | |
download | tcl-3c1e7bd70247b897a1e6f47d8fcb6d50de880aea.zip tcl-3c1e7bd70247b897a1e6f47d8fcb6d50de880aea.tar.gz tcl-3c1e7bd70247b897a1e6f47d8fcb6d50de880aea.tar.bz2 |
Avoid sharing cmdName literals accross namespaces, and generalise usage of
the TclRegisterNewLiteral macro [Patch 1090905]
Diffstat (limited to 'generic/tclCompile.h')
-rw-r--r-- | generic/tclCompile.h | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/generic/tclCompile.h b/generic/tclCompile.h index a50409b..ae4c39c 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCompile.h,v 1.52 2004/12/10 13:09:14 msofer Exp $ + * RCS: @(#) $Id: tclCompile.h,v 1.53 2004/12/24 18:06:58 msofer Exp $ */ #ifndef _TCLCOMPILATION @@ -842,7 +842,7 @@ MODULE_SCOPE void TclPrintSource _ANSI_ARGS_((FILE *outFile, CONST char *string, int maxChars)); MODULE_SCOPE void TclRegisterAuxDataType _ANSI_ARGS_((AuxDataType *typePtr)); MODULE_SCOPE int TclRegisterLiteral _ANSI_ARGS_((CompileEnv *envPtr, - char *bytes, int length, int onHeap)); + char *bytes, int length, int flags)); MODULE_SCOPE void TclReleaseLiteral _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *objPtr)); MODULE_SCOPE void TclSetCmdNameObj _ANSI_ARGS_((Tcl_Interp *interp, @@ -860,11 +860,13 @@ MODULE_SCOPE int TclWordKnownAtCompileTime _ANSI_ARGS_(( /* *---------------------------------------------------------------- - * Macros used by Tcl bytecode compilation and execution modules - * inside the Tcl core but not used outside. + * Macros and flag values used by Tcl bytecode compilation and execution + * modules inside the Tcl core but not used outside. *---------------------------------------------------------------- */ +#define LITERAL_ON_HEAP 0x01 +#define LITERAL_NS_SCOPE 0x02 /* * Form of TclRegisterLiteral with onHeap == 0. * In that case, it is safe to cast away CONSTness, and it @@ -872,7 +874,19 @@ MODULE_SCOPE int TclWordKnownAtCompileTime _ANSI_ARGS_(( */ #define TclRegisterNewLiteral(envPtr, bytes, length) \ - TclRegisterLiteral(envPtr, (char *)(bytes), length, /*onHeap*/ 0) + TclRegisterLiteral(envPtr, (char *)(bytes), length, \ + /*flags*/ 0) + +/* + * Form of TclRegisterNSLiteral with onHeap == 0. + * In that case, it is safe to cast away CONSTness, and it + * is cleanest to do that here, all in one place. + */ + +#define TclRegisterNewNSLiteral(envPtr, bytes, length) \ + TclRegisterLiteral(envPtr, (char *)(bytes), length, \ + /*flags*/ LITERAL_NS_SCOPE) + /* * Macro used to manually adjust the stack requirements; used |