Re: TestBed extensions

From: Alex Rousskov <rousskov_at_measurement-factory.com>
Date: Sun, 09 Nov 2008 11:24:25 -0700

On Fri, 2008-11-07 at 13:55 +1300, Amos Jeffries wrote:

> > I will dig out a script that fixes file preamble for all source files.
> > We can apply that once the layout has been fixed.
>
> Ah excellent. I was contemplating a long manual sweep. But scripts may be
> better. If you can send it my way I'll see about integrating it after the
> next SourceFormat. If its a clean conversion I don't think it matters when
> its run.

The Perl script is attached. It works well for several Factory projects.
I am sure manual labor will be required to standardize all Squid
sources. It gets much easier after the first round though.

The script takes three parameters: the name of the package (e.g.,
"Squid"), the name of the "prefix file" that contains the boilerplate,
and the source file name. The script tries to find the right place to
insert header guards, calculates the right guards in calcGuard(), and
replaces the current file prefix with a standard boilerplate.

IIRC, the logic for prefix identification is to skip all lines until a
#ifndef guard or #pragma. The script also checks that all header guards
are unique. You will need to adjust calcGuard() to match your rules.

Feel free to modify and add to Squid distribution tools, of course.

I do not want to fight over the boilerplate, but I would love to see the
current inconsistent and long text in every source file to be replaced
with something exact and concise like

/* This file is a part of Squid Caching Proxy software :: www.squid-cache.org */

or

/* This file is a part of Squid Caching Proxy software, licensed under the
 * terms of The GNU General Public License :: http://www.squid-cache.org/ */

The debugging section that appears in many sources should probably be
moved from informal comments into something like

/* default debugging section for this source file */
static const int dbgSection = 53;

HTH,

Alex.

Received on Sun Nov 09 2008 - 18:25:03 MST

This archive was generated by hypermail 2.2.0 : Mon Nov 10 2008 - 12:00:04 MST