pspp-dev
[Top][All Lists]
Advanced

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

Re: [patch #5524] Error file command line option


From: John Darrington
Subject: Re: [patch #5524] Error file command line option
Date: Wed, 8 Nov 2006 10:50:20 +0800
User-agent: Mutt/1.5.9i

On Tue, Nov 07, 2006 at 07:05:35AM -0800, Ben Pfaff wrote:
     John Darrington <address@hidden> writes:
     
     > I think that main.c is in need of a major overhaul, but I don't have
     > the inclination to do that right now.
     
     What do you think needs to be done?

1.  parse_command_line should be closer to the start of main.  It's
    where it is now, because it actually does more than parsing.  It
    also performs actions on the data it parses.  Some of these
    actions depend upon things being initialised, whereas others
    cannot be initialised until the data has been parsed.  Hence we
    have some of the _init functions called before parse_command_line,
    and some in the body of the if {}.

    I suggest that parse_command_line is changed to do just parsing,
    and return the data it parses.  

2.  If terminate() is necessary, then for consistency there should
    also be initiate().

3.  This code:

    static bool terminating = false;
    if (!terminating) 
    {
      terminating = true;

    is racy.     Get rid of it, and use sigvec instead of signal, to
    prevent re-entrancy.


4.  Probably a side issue:  I want to encapsulate the lexer, so that 
    lex_init() and lex_done() are replaced by struct lexer
    *create_lexer(void) and void destroy_lexer(struct lexer *)
    respectively.  main would have to do something with the returned
    lexer (I haven't thought what yet).


5.  Probably the same should also be done for outp_init/outp_done

6.  Ditto for getl_initialise. getl_initialise (from
    src/language/linebuffer.c) needs to be rewritten.  Get rid of the
    union and the enum type, and replace with an abstract definition.
    This way we can have line buffers for say a gtk_entry widget or
    some other thing that we haven't yet thought of.

7.  Where static data  is necessary, let's identify those which
    are effectively const --- ie are set at startup, and remain with
    these values until the program terminates.  Eg: config_path,
    allow_internal_sort, program_name  etc.  There are ways of
    enforcing this, but they're a bit cumbersome.


J'

-- 
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://pgp.mit.edu or any PGP keyserver for public key.


Attachment: signature.asc
Description: Digital signature


reply via email to

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