| Ticket UUID: | 1091046 | ||
| Title: | Accessor functions for iPtr->scriptFile | ||
| Type: | RFE | Created on: | 2004-12-25 09:10:19 |
| Submitter: | davidw | Assigned to: | dgp |
| Subsystem: | 38. Init - Library - Autoload | Severity: | |
| Priority: | 5 Medium | Last modified: | 2026-11-13 11:18:43 |
| Status: | Closed | Closed by: | serhiy.storchaka |
| Resolution: | Wont Fix | Closed on: | 2026-11-13 11:18:43 |
| Version: | None | ||
| Description: | ||||
Hi,
In Apache Rivet, we would like to be able to do the
equivalent of
info script foobar
to set the name of the rivet file being parsed and
evaluated. I measured a significant, if not huge
speedup when I set things directly:
Interp *iPtr = (Interp *) interp;
if (iPtr->scriptFile != NULL) {
Tcl_DecrRefCount(iPtr->scriptFile);
}
iPtr->scriptFile = Tcl_NewStringObj(r->filename, -1);
Tcl_IncrRefCount(iPtr->scriptFile);
Instead of building up and evaluating an "info script
...." command.
However, we have to use the internal API to do the
above... providing a pair of get/set accessor functions
would be appreciated.
Should I write a TIP for this?
Thanks,
Dave
| ||||
| User Comments: | ||||
hobbs added on 2004-12-28 00:52:36:
Logged In: YES user_id=72656 I have a hard time thinking of why C code would be setting the script file, considering this is something meant while sourcing Tcl files ... are you sure you will be handling it correctly? davidw added on 2004-12-28 01:22:02:
Logged In: YES user_id=240 Well... here's how it's used: There is a file like /var/www/tcl/hello.rvt that gets accessed like http://foo.bar.com/tcl/hello.rvt hello.rvt is a template file that is part HTML, part Tcl, so it doesn't get sourced directly. We would like it to "know its name", so to speak. If there's a better way, we're open to suggestions. Thanks hobbs added on 2004-12-28 01:28:45:
Logged In: YES user_id=72656 That depends on how you set that all up. Tcl_EvalFile itself does set the scriptFile, but I imagine that you separate out pieces of the code and eval them separately? With so many Tcl_Eval's, it would seem that one more for 'info script' isn't a big deal. You can speed it up by doing Tcl_EvalObjv, but I don't see a big deal in making a C API for this kind of case. serhiy.storchaka added on 2026-11-13 11:18:43:
Closing per hobbs' comments: no C accessor for the script file was added, evaluating info script through Tcl_EvalObjv remains the way to set it. | ||||
