Re: perl

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Tue, 21 Feb 2006 16:32:56 +0100 (CET)

On Tue, 21 Feb 2006 abc@ai1.anchorage.mtaonline.net wrote:

> ok - well these should do things smaller, faster,
> and without 13-100MB of perl installation. Thank you :)
> -------------------------------------------------------------------------------
>
> # tested with gawk, mawk, and nawk.
> # drop-in replacement for mk-globals-c.pl.

Almost, but some work remains. There is some stuff in the source header
which should not be in the translated C file...

The header define wrapper:

+
+#ifndef SQUID_GLOBALS_H
+#define SQUID_GLOBALS_H
+

+
+#endif /* SQUID_GLOBALS_H */

Uninitialized arrays:

+char *IcpOpcodeStr[];
(etc.. several of them)

I have attached the output of the perl program for your reference.

> # tested with gawk, mawk, and nawk.
> # drop-in replacement for mk-string-arrays.pl.
> # creates "enum.c" (on stdout) from "enum.h".

Seems to be incomplete (closing brace missing). Also the output has some
issues:

a) The closing brace of the generated arrays missing. Easily fixed by
adding a 'print "};"' in the outer te loop.

b) Output of the elements not correct. Should be
         "SWAP_LOG_NOP",
not
         SWAP_LOG_NOP,

additionally the awk script seems to skip over some enums..

- "ERR_SQUID_SIGNATURE",
- "ERR_FTP_PUT_CREATED",
- "ERR_FTP_PUT_MODIFIED",

- "ERR_ONLY_IF_CACHED_MISS",

looking at the source these have comments..

c) delete array is not posix standard, and will wail on some platforms..
(did on Solaris awk)

d) sub is not supported in Solaris awk (but is defined in POSIX...)

e) !expr not supported in patterns in Solaris awk. Use var != 1 instead.

my attempt in fixing up mk-string-arrays.awk attached. Please verify. Have
tested this version using gawk --posix and Solaris awk and nawk.

Regards
Henrik

Received on Tue Feb 21 2006 - 08:33:00 MST

This archive was generated by hypermail pre-2.1.9 : Tue Feb 28 2006 - 12:00:05 MST