[Top][All Lists]

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

Re: lynx-dev cleaning up lynx

From: T.E.Dickey
Subject: Re: lynx-dev cleaning up lynx
Date: Mon, 27 Apr 1998 05:24:26 -0400 (EDT)

> I took a look at several of the lynx source files tonight hoping to 
> find something that could be cleaned up with not too much effort.  In 
> particular, I was hoping to break up some of those several thousand 
> line functions into manageable chunks.  In the end, I decided that I 
> am not even going to attempt this unless the global variables are 
> renamed in such a way that it is immediately obvious what is global 
> (declared outside a function) and what is local.  For example, it 
> appears that `more' is a global variable but `show_help' is local.  Is 
> there any interest in renaming all global variables in such a way that 
> they may be immediately distinguished from local variables?  For 
> example, `more' would become `Lynx_More' or something like that. 
> Unless this first step is taken, I just cannot imagine how one would 
> ever untangle some of these functions. 
I just use tags & grep (works for me, and doesn't mean that I have to
change all of the names).
> While I am at it, I would recommend that if any new feature or code 
> enhancement gets implemented and if that feature requires over 5 lines 
> of code, then it be placed in a separate function.  There is no excuse 
> for a 4000 line function. 
I already noted that some months ago - and am proceeding (one thing at a
time) to fix what I can.  (At least one function is >5000 lines).  It's
not the only ugly program with a too-long case.  But the goto statements
are the real problem in untangling it.  I would proceed by splitting out
one case at a time into local functions all of the logic in the long
switch statments to determine what values from the long function are needed
as parameters, then unravel the goto's (get rid of them), and finally
revise the switch statement into a lookup table.
But at the moment, my focus was on the CTRACE code (needs another pass to
separate it entirely from stderr), and tempname (more of a concern to people
who use Lynx than anything else).

Thomas E. Dickey

reply via email to

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