This is the mail archive of the
insight@sources.redhat.com
mailing list for the Insight project.
Re: [RFC] setting proper result codes
- To: "Martin M. Hunt" <hunt at redhat dot com>
- Subject: Re: [RFC] setting proper result codes
- From: Keith Seitz <keiths at cygnus dot com>
- Date: Fri, 26 Oct 2001 09:05:23 -0700 (PDT)
- cc: Insight Mailing List <insight at sources dot redhat dot com>
On Thu, 25 Oct 2001, Martin M. Hunt wrote:
> void
> set_result (Tcl_Interp *interp, const char *fmt,...)
> {
> va_list args;
> char *buf;
>
> va_start (args, fmt);
> xvasprintf (&buf, fmt, args);
> va_end (args);
> Tcl_SetObjResult (interp, Tcl_NewStringObj (buf, -1));
> free(buf);
> }
Yes, I think this is pretty obviously needed, too. Developers simply need
to remember that tcl commands in the interpreter are tcl commands: if they
return TCL_ERROR, they should leave an error message in the interpreter,
not in result_ptr. (Thanks to Tom Tromey for clarifying this some time
ago.)
Other than using "free" (should be "xfree"), I don't see a problem with
the code, and I think it would be a good addition.
Now let's talk about the name... :-)
I have been sporadically attempting to define interfaces into our C code
that others can tap. The most immediate group of developers that come to
mind: plugin writers. Ok, there aren't any, but there could be one day
before this project dies.
Unfortunately, I've only started down this road, and haven't made a whole
lot of headroom... But, gdbtk-cmds.h does exist and contain some useful
functions, although they all suffer from severe namespace problems.
What I think I would like to do is have all the really external functions
(like our call wrapper) begin with "insight_". Right now, nothing does
that, but your result-setting thingy could be the first! (Anyone have a
problem with this?)
Keith