9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Plan9 awk vs. GNU awk
@ 2009-10-24  2:20 Dimitry Golubovsky
  2009-10-24  2:45 ` michael block
  0 siblings, 1 reply; 5+ messages in thread
From: Dimitry Golubovsky @ 2009-10-24  2:20 UTC (permalink / raw)
  To: 9fans

Hi,

Working through the autoconf stuff I came across another issue: Plan9
awk does not seem to recognize a regexp that GNU awk does. This
results in config.status not properly creating config.h file based on
the configure's findings. The regexp in the test program was extracted
from config.status. Can anybody see anything wrong with this regexp?

The test program named `rxtest' (long regexp should match a #define or
#undef statement, if matched the whole line is printed):

#!/bin/sh
# (or /bin/rc for Plan9)

awk '

/^[\t ]*#[\t ]*(define|undef)[\t
]+[_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ][_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]*([\t
(]|$)/ {
  line = $ 0
print line }
'
The source file (config.h.in), top portion of it:

/* src/config.h.in.  Generated from configure.ac by autoheader.  */

/* platform-specific defines */
#include "platform.h"

/* Define to 1 if you want to use the primitives which let you examine Hugs
   bytecodes (requires INTERNAL_PRIMS). */
#undef BYTECODE_PRIMS

/* Define to 1 to use a Char encoding determined by the locale. */
#undef CHAR_ENCODING_LOCALE

/* Define to 1 to use the UTF-8 Char encoding. */
#undef CHAR_ENCODING_UTF8

/* Define to 1 if you want to perform runtime tag-checks as an internal
   consistency check. This makes Hugs run very slowly - but is very effective
   at detecting and locating subtle bugs. */
#undef CHECK_TAGS

/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
   systems. This function is required for `alloca.c' support on those systems.
   */
#undef CRAY_STACKSEG_END

/* Define to 1 if using `alloca.c'. */
#undef C_ALLOCA

/* Define to 1 if debugging generated bytecodes or the bytecode interpreter.
   */
#undef DEBUG_CODE

Result under Linux (top portion):

$ cat src/config.h.in | rxtest | head
#undef BYTECODE_PRIMS
#undef CHAR_ENCODING_LOCALE
#undef CHAR_ENCODING_UTF8
#undef CHECK_TAGS
#undef CRAY_STACKSEG_END
#undef C_ALLOCA
#undef DEBUG_CODE

that is, all lines matched.

awk used was:

awk --version
GNU Awk 3.1.6
Copyright (C) 1989, 1991-2007 Free Software Foundation.


Result under Plan9:

term% cat src/config.h.in | rxtest
term%

Nothing: Plan9 awk does not match this regexp and source file's lines.

Not sure which version Plan9 awk is, the binary is dated:

term% ls -l /bin/awk
total 1000
-rwxr-xr-x 1 dima users 327504 Feb  4  2009 /bin/awk

/sys/src/cmd/awk/main.c contains:

char	*version = "version 19990602";

Thanks.

--
Dimitry Golubovsky

Anywhere on the Web



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-10-27 17:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <<3df301650910231945n522c4592ib25cef16e9830202@mail.gmail.com>
2009-10-27 17:42 ` [9fans] Plan9 awk vs. GNU awk erik quanstrom
2009-10-24  2:20 Dimitry Golubovsky
2009-10-24  2:45 ` michael block
2009-10-24 17:32   ` Russ Cox
2009-10-24 18:34     ` Anthony Sorace

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).