Just added output templates to 2.3.0 -- which means that
the output generated by sitescooper is now sedded into a
template, rather than gradually built up with static strings
and a stackload of conditionals inside the code.
This is a bit nicer and should help with i18n'ing the output
for non-english speakers.
volsung: my personal preference
for open()/close()-style APIs is as follows:
1. define a struct containing the state info for the API
(let's call it API_t). You could even keep the function
table and the state included in that struct, for a real
C++-like feeling ;)
2. provide a API_new(API_t *) function that initialises it
into a sane, unopened state
3. provide API_open(API_t *, ...) function that opens it
4. provide API_close(API_t *) to close it
5. provide API_free(API_t *) to free any dynamic stuff after
use.
This is very C++-like in usage, and works pretty well IMHO.
The problem with using a plain int as a return type in the
open() style is that you then get stuck with handling a
lookup table of that-int-to-state-struct mappings. yuck, and
AFAICS not really necessary or elegant for user-mode library
code...
What do you think?