Hi again,

Attached is an updated patch against the wget svn trunk to make html- parse compile independently of the rest of wget.

Changes are:

* Separate out all macros from wget.h to a new wget-macros.h
* Included stdbool.h in html-parse.c, since the 'bool' type is used. I think you get this header automatically from config.h or somesuch usually, but we need to explicitly include it since config.h isn't included in standalone-mode.

/Håkan

Attachment: html_parser_separation.diff
Description: Binary data


19 jul 2007 kl. 22.08 skrev Micah Cowan:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Håkan Waara wrote:
Hello all,

I was looking for a small/fast HTML parser and came across wget's.

Since I prefer to not include all of wget's headers just for this, I
patched it to build 100% standalone. All that was needed was to
redefined some macros (that are in wget.h) when compiled as standalone.

This makes it possible to compile the parser, without the need for any
other files than html-parse.c and html-parse.h as simple as this:

gcc -DSTANDALONE html-parse.c -o html-parse

Cool! Thanks.

Looking at the patches, I don't think I want to maintain separate copies
of the same macro definitions, some that are in wget.h, and some that
are in html-parse.h for when STANDALONE is defined. Better to split them
out to another #include file (whose appropriate name I'm not sure of),
so we can maintain these macros in one place, and still allow for
standalone compilation.

Glad you found wget's parser useful! :)

I also didn't see the point of the PARAMS macro (probably I'm missing
something). If needed, that could be redefined as well, of course.

I believe those are there to allow for K&R C support.

- --
Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer...
http://micah.cowan.name/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGn8Su7M8hyUobTrERCDRQAJ9mXc11DC5KlSQS1qzMkVKaqZGF1ACfbv/y
ZaSTXOW11MK/1g7ZM4NGPDo=
=ibrO
-----END PGP SIGNATURE-----

Reply via email to