W3C home > Mailing lists > Public > www-validator@w3.org > November 1999

[PATCH] Configuration files

From: Terje Bless <link@tss.no>
Date: Thu, 11 Nov 1999 02:52:38 +0100
Message-Id: <199911110225.DAA09135@vals.intramed.rito.no>
To: W3C Validator <www-validator@w3.org>
('binary' encoding is not supported, stored as-is)
Here is a patch ("dbfile.diff") that moves the various giant hashes into
configuration files instead of hard-coding them. There are 3 files created
from the 3 hashes for: FPI -> plaintext version, Error message -> URI
fragment, and HTML Element Name -> URI fragment. I've included these files
("fpis.cfg", "frag.cfg", "eref.cfg") as attachements. They go in the
"htdocs" directory by default, but this is configurable.

The config files are simple TAB delimited files. Multiple TABs are accepted
and empty lines, lines containing only whitespace, and lines containing
only a comment (a "#" optionally preceeded by whitespace). This means keys
and values can contan any character except TAB and "#".

The sub that reads the files is intentionally generic -- so it can be
re-used for future config files -- and is used for all 3 files.

This isn't a major improvement as we use the same amount of memory and we
have to hit the disk to get the data, but it makes the code far less messy
and a lot easier to read. It also lets you update the mapping tables
independantly of the CGI program.

A project for another time is to change the error->URI mapping to point
directly to the error explanations so we can inline it (cf. TODO). This may
require extending the configuration file format, but hopefully in a
backwards compatible way. Probably by adding more fields delimited by TAB
or continuation lines either using backslash at the end of lines or by
starting them with a TAB or other special char.

Received on Wednesday, 10 November 1999 21:26:28 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:58:14 UTC