Overview
| Artifact ID: | dcd561e16b2e6ff378808ef4b65526d5e53292ff |
|---|---|
| Ticket: | 218674ffffffffffffffffffffffffffffffffff
regexp deficiencies |
| User & Date: | nobody on 2000-10-26 01:04:00 |
Changes
- assignee changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed to:
OriginalBugID: 1704 RFE Version: 8.1b2 SubmitDate: '1999-04-05' LastModified: '1999-07-02' Severity: CRIT Status: Released Submitter: pat ChangedBy: stanton OS: Other OSVersion: all versions of UNIX Machine: NA FixedDate: '1999-07-02' FixedInVersion: 8.2 ClosedDate: '2000-10-25' Name: Don Libes Extensions: Expect Comments: These are necessary in order to get Expect to compile with Tcl 8.1. DesiredBehavior: 1) I'm reading RegExp.3. It talks about Tcl_RegExpCompile. However in the code for that, it says: This procedure is DEPRECATED in favor of the object version of the command. I looked further and found TclRegCompObj which I assume is what is meant as the object version. However, it appears to be for internal use only. Please fix or explain. 2) The man page for Tcl_RegExpCompile says: compiles a regular expression string into the internal form used for efficient pattern matching. The return value is a token for this compiled form, which can be used in subsequent calls to Tcl_RegExpExec or Tcl_RegExpRange. The regexp man page goes on to say: Note: the return value from Tcl_RegExpCompile is only valid up to the next call to Tcl_RegExpCompile; it is not safe to retain these values for long periods of time. We cannot save compiled regexps? This is very bad for things like Expect which sit in a loop doing repeated regexec's with a potential large number of regexps. Please let me call CompileRegexp directly. 2.5) I also want to be able to call Henry's regexp functions directly (just the way Tcl does). I've got code that knows nothing about Tcl but that uses regexps and I need to use Henry's code. I can't change this code to go through Tcl so the way it is now, I would need to download (or ship) my own copy of Henry's code and .h files. Please just make sure that the Henry's public interfaces remain public. I'm not asking to expose Henry's private interfaces. I just want access to the public ones. I think you can accomodate this merely by installing the appropriate .h files from his library. It does not appear that you do this now. 3) I see that TclRegCompObj doesn't cache regexps and allows the user to explicitly keep the regexp. It appears that the Tcl core uses TclRegCompObj despite the lack of caching. This can't be right, right? One way to unify things is to add an "enableCache" flag (to both Tcl_RegExpCompile and TclRegCompObj). If enableCache == 0, then the cache is neither checked nor updated. This is a reasonably simple fix as it won't affect any existing behavior and only requires changes to the few places where Tcl internally currently compiles regexps. This is not only useful to extensions but it's useful to the Tcl core as there are places in the core where caching is appropriate and where it's useless. 4) The statement "it is not safe to retain these values for long periods of time" is rather silly. No one can possibly understand it without looking at the source. And when you do understand it, it contradicts the previous statement. Please rewrite both statements to be explicit about what's really going on. 5) 5 is a really small cache. Any possibility of raising this or putting it under user control? 6) The documentation for Tcl_RegExpExec says: returns 1 if string contains a range of charac- ters that match regexp, 0 if no match is found, and -1 if an error occurs. I see no way for Tcl_RegExpExec to indicate "could match" meaning "could match if more characters arrive that were suitable for a match". This is required for a class of applications involving matching on a stream required by Expect's interact command. Henry assured me that this facility would be in the engine (I'm not the only one that needs it). Note that it is not sufficient to add one more return value to Tcl_RegExpExec (i.e., 2) because one needs to know both if something matches now and can match later. I recommend another argument (canMatch *int) be added to Tcl_RegExpExec. 7) The regexp man page says: If an error occurs while compiling the regular expression then Tcl_RegExpCompile returns NULL and leaves an error message in interp->result. I suggest you replace "interp->result" with more suitable words. Hmm, I see that Tcl_SetObjResult.3 says interp->result is "strongly deprecated". Yet, interp->result appears 591 times in the man pages including Tcl_Interp.3 which defines interp->result with no mention of an alternative. (In case you're wondering why my code is still littered with interp->result, hopefully this explains it.) 05/12/1999 18:41 - stanton - Tcl_GetRegExpFromObj is now public. 07/02/1999 10:48 - stanton - all of the regexp issues related to expect have been resolved. - foundin changed to: "obsolete: 8.1b2"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "nobody"
- subsystem changed to: "43. Regexp"
- title changed to: "regexp deficiencies"
- type changed to: "Bug"