First, the files need to be splitted to many smaller ones, handling specific
things.  Like select.c handling <select> stuff and menus (lying here already,
but I wasn't yet brave enough to commit it), forms stuff, frames stuff etc.

Then, the code needs also to be cleaned up massively, so it'll be clear to
mere mortal how it works and what it does actually :).

And then, it needs to be rewritten ;). I'm still not happy with the performance
(altough http://netrik.sourceforge.net/state.html#benchmark says we're the
best, maybe they're just trying to fool us ;]] and I clearly see that we can do
even better), but for doing something with that, we need to completely rewrite
the parser and _design_ it - from scratch.

The problem is, that now it's all very messy and chaotic. We randomly jump
around over the document source, skipping various parts and interpreting
others, etc etc.  This is ugly. We should ONCE pass thru the whole file and
parse it (and don't mix parser and renderer in one file), store the syntactic
tree and then walk thru it. Sure that it'll be a bit more tricky as we won't
know the whole document source at once frequently, but this is doable.

I imagine something like:

struct element_attr {
  char *name;
  char *value; /* will be converted to other types when needed */
  struct element_attr *next;
}

struct element {
  enum element_type type;
  struct element_attr *attr;

  struct element *parent;
  struct element *child;
  struct element *next;
}

Then thing like:

<html>
  <head>
    <title>foo</title>
  </head>
  <body>
    <h1>hey</h1>
    <p>hello <b>developer</b> of elinks, how would you like:
      <ul>
        <li> rewritten html parser
        <li> pasky dead
        <li> some pizza
      </ul>
      Please tell me at <a>pasky@ji.cz</a>.
    </p>
  </body>
</html>

would be stored as:

   parent     child
NULL -> <html> --> <head> --> <title> -> TEXT ---> NULL
         |          |          |          |
         |   next   |          |         NULL
         |          |          NULL
         |         <body> --> <h1> ----> TEXT ---> NULL
         |          |          |          |
         |          |          |         NULL
         |          |          |
         |          |         <p> -----> TEXT ---> NULL
         |          |          |          |
         |          |          |         <b> ----> TEXT
         |          |          |          |         |
         |          |          |          |        NULL
         |          |          |          |
         |          |          |         TEXT ---> NULL
         |          |          |          |
         |          |          |         <ul> ---> <li> ---> TEXT
         |          |          |          |         |         |
         |          |          |          |         |        NULL
         |          |          |          |         |
         |          |          |          |        <li> ---> TEXT
         |          |          |          |         |         |
         |          |          |          |         |        NULL
         |          |          |          |         |
         |          |          |          |        <li> ---> TEXT
         |          |          |          |         |         |
         |          |          |          |         |        NULL
         |          |          |          |         |
         |          |          |          |        NULL
         |          |          |          |
         |          |          |         TEXT ---> NULL
         |          |          |          |
         |          |          |         <a> ----> TEXT ---> NULL
         |          |          |          |         |
         |          |          |          |        NULL
         |          |          |          |
         |          |          |         TEXT ---> NULL
         |          |          |          |
         |          |          |         NULL
         |          |         NULL
         |         NULL
        NULL

Cute, isn't it? :)
