pspp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: msg classes


From: Ben Pfaff
Subject: Re: msg classes
Date: Fri, 23 Dec 2005 19:40:06 -0800
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux)

John Darrington <address@hidden> writes:

> On Fri, Dec 23, 2005 at 10:44:03AM -0800, Ben Pfaff wrote:
>      John Darrington <address@hidden> writes:
>      
>      > I've just added a dialog box implementation of msg (from error.c).
>      >
>      > However it seems that many of the calls to msg have an inappropriate
>      > class argument --- at least something that doesn't agree with the
>      > comments in error.h
>      
>      Can you give an example?
>
> Example 1:
> In sfm-read.c:614, 
>  if (strncmp ("$FL2", hdr.rec_type, 4) != 0)
>     lose ((ME, _("%s: Bad magic.  Proper system files begin with "
>                  "the four characters `$FL2'. This file will not be read."),
>            handle_get_filename (r->fh)));
>
> Shouldn't this be DE ?

None of the system file stuff is DE or DW because those display a
line number.  System files don't have line numbers.

> Example 2:
> In vars-atr.c there are a lot of msg calls with class SE, in
> var_is_valid_name.  This function might be called from many places
> --- not just a script, so the SE class is inappropriate.  In fact, in
> this case it might be an idea to replace the bool issue_error arg with
> the class of the error, since the error could have different
> significance depending upon where it was called.

I'll agree with this one.  It's historical, as I think you'll
understand.

Your suggested fix sounds fine.  In the long term perhaps the
error message should be returned to the caller so that the caller
can decide what to do with it, but I don't know whether we'll
ever care enough to do that.

> Similarly, Example 3:
>
> dictionary.c:703
>
>  if ( w == 0.0 && *warn_on_invalid ) {
>           *warn_on_invalid = 0;
>           msg (SW, _("At least one case in the data file had a weight value "
>                      "that was user-missing, system-missing, zero, or "
>                      "negative.  These case(s) were ignored."));
>
>
> Might not arise as a result of parsing a script.  So DW is probably
> more appropriate. Or use the warn_on_invalid arg per above suggestion.

No objection here either.

In general, the PSPP code hasn't always been well separated into
code for parsing input and code for doing computation.  Code for
doing computation probably shouldn't assume that we're reading a
script.  Fine with me if you want to fix those up.

Some restructuring may be due.  Perhaps we should pass around a
"context" instead of relying on a global notion of the "current
source line" and whether we're in a script or not.

(Also, I dropped the usage of "script" from the documentation
some time ago because SPSS doesn't use it.  At some point we
should probably change the source code, too, to use the term
"command file" instead.)
-- 
Ben Pfaff 
email: address@hidden
web: http://benpfaff.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]