Less branching in _thread_io_loop()
Add support for sequences in template

This adds supports for any kind of sequences, that might be generated by using standard
I/O routines or database access, for example. For example, to create a file list, one could
define the structure like so:

  sturct foo {
	char *path;
        struct {
                lwan_tpl_list_generator_t generator;
		char *name;
        } file_list;
  };

Then write a generator function like so:

  int dir_list_generator(coro_t *coro)
  {
      DIR *dir;
      struct dirent *ent;
      struct foo *foo = coro_get_data(coro);

      dir = opendir(foo->path);
      if (!dir)
        return 0;

      while ((ent = readdir(dir))) {
        foo->file_list.name = ent->d_name;
        coro_yield(coro, 1);   /* 1 means "generator not finished yet" */
      }

      closedir(dir);
      return 0; /* returning 0 means "we're done with this generator" */
  }

Notice that readdir_r() should be used for reentrancy support, but that there's no need to
copy the entry name; just a pointer will work, since the generator stack is kept around when
coro_yield() is called.

To define the descriptor, it is as simple as defining the descriptor for the file list:

  static lwan_var_descriptor_t file_list_descriptor[] = {
      TPL_VAR_STR(struct foo, file_list.name),
      TPL_VAR_SENTINEL
  };

And the main descriptor:

  static lwan_var_descriptor_t main_desc[] = {
      TPL_VAR_STR(struct foo, path),
      TPL_VAR_SEQUENCE(struct foo, file_list, dir_list_generator, file_list_descriptor),
      TPL_VAR_SENTINEL
  };

The template might be something like:

  <html>
  <head>
    <title>Index of {{path}}</title>
  </head>
  <body>
    <h1>Index of {{path}}</h1>
    <ul>
    {{#file_list}}
      <li>{{file_list.name}}</li>
    {{/file_list}}
    </ul>
  </body>
  </html>