From: Vin Shelton <acs@alumni.princeton.edu>
To: Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
Cc: zsh-workers@sunsite.dk (Zsh hackers list)
Subject: Re: PATCH: zsh/system library
Date: Mon, 01 Sep 2003 20:52:11 -0400 [thread overview]
Message-ID: <m3oey4rozo.fsf@zion.rcn.com> (raw)
In-Reply-To: <20030830180351.40D13850C@pwstephenson.fsnet.co.uk> (Peter Stephenson's message of "Sat, 30 Aug 2003 19:03:49 +0100")
Peter,
Peter Stephenson <pws@pwstephenson.fsnet.co.uk> writes:
> An interface to system errors is also provided. The $errnos array
> contains error macro names (EINTR, etc.) and is as I originally proposed
> for zsh/params but by popular vote (1 to 0) it has been moved here.
> There is also an interface to output (or write to an array) the full
> error message. This is the command syserror; there are several reasons
> this is a command rather than another array (1) the messages are much
> longer than the names and so waste space in the shell (2) they can
> change dynamically due to internationalization support (3) the standard
> C interface is a function (4) unlike the ENAMES, you are unlikely to
> need them internally in the code.
> Index: zshconfig.ac
> ===================================================================
> RCS file: /cvsroot/zsh/zsh/zshconfig.ac,v
> retrieving revision 1.37
> diff -u -r1.37 zshconfig.ac
> --- zshconfig.ac 25 Apr 2003 11:18:51 -0000 1.37
> +++ zshconfig.ac 30 Aug 2003 17:43:10 -0000
> @@ -1117,6 +1117,39 @@
> SIGNAL_H=$zsh_cv_path_signal_h
> AC_SUBST(SIGNAL_H)dnl
>
> +dnl Where are error names located? Needed as input for errnames1.awk
> +AC_CACHE_CHECK(where error names are located, zsh_cv_path_errno_h,
> +[dnl Look at the output from the preprocessor.
> +dnl We should get lines of the form `# 1 "/usr/include/errno.h"'
> +dnl The following assumes the real definitions are in a file which
> +dnl contains the name `err'; we could relax this if necessary,
> +dnl but then you can get a rather long list of files to test.
> +dnl The backslash substitution is to persuade cygwin to cough up
> +dnl slashes rather than doubled backslashes in the path.
> +echo "#include <errno.h>" > nametmp.c
> +errfile_list="`$CPP nametmp.c |
> +sed -n 's/^#[ ].*\"\(.*\)\"/\1/p' |
> +sed 's/\\\\\\\\/\//g' |
> +$AWK '{ if (\$1 ~ \"err\") files[[\$1]] = \$1 }
> + END { for (var in files) print var }'`"
> +rm -f nametmp.c
> +for ERRNO_H in $errfile_list /dev/null
> +do
> + dnl Try to make sure it doesn't get confused by files that don't
> + dnl have real error definitions in. Count definitions to make sure.
> + nerrs=`test -f $ERRNO_H && \
> + grep '#[ ]*define[ ][ ]*E[0-9A-Z]*[ ]*[0-9][0-9]*' $ERRNO_H | \
> + wc -l | sed 's/[ ]//g'`
> + test "x$nerrs" != x && test "$nerrs" -ge 7 && break
> +done
> +if test $ERRNO_H = "/dev/null"; then
> + AC_MSG_ERROR(ERROR MACROS NOT FOUND: please report to developers)
> +fi
> +zsh_cv_path_errno_h=$ERRNO_H
> +])
> +ERRNO_H=$zsh_cv_path_errno_h
> +AC_SUBST(ERRNO_H)dnl
> +
> dnl -----------------------------------------------------
> dnl Look for the file containing the RLIMIT_* definitions
> dnl -----------------------------------------------------
Unfortunately, your CPP hackery does not work on the output of the
Intel C Compiler. icc generates output like the following from
nametmp.c:
#line 1 "nametmp.c"
#line 1 "/usr/include/errno.h"
#line 1 "/usr/include/features.h"
#line 105 "/usr/include/features.h"
....
It's the rather "line" that gets in the way. Here's the regexp that
works for both icc and gcc on my Linux system at home. When I get to
work tomorrow, I will test this against the Solaris C compiler.
--- zshconfig.ac~ 2003-09-01 00:03:24.000000000 -0400
+++ zshconfig.ac 2003-09-01 20:43:21.000000000 -0400
@@ -1128,7 +1128,7 @@
dnl slashes rather than doubled backslashes in the path.
echo "#include <errno.h>" > nametmp.c
errfile_list="`$CPP nametmp.c |
-sed -n 's/^#[ ].*\"\(.*\)\"/\1/p' |
+sed -n 's/^#\(line\)\?[ ].*\"\(.*\)\"/\2/p' |
sed 's/\\\\\\\\/\//g' |
$AWK '{ if (\$1 ~ \"err\") files[[\$1]] = \$1 }
END { for (var in files) print var }'`"
HTH,
Vin
next prev parent reply other threads:[~2003-09-02 0:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-30 18:03 Peter Stephenson
2003-09-02 0:52 ` Vin Shelton [this message]
2003-09-02 8:04 ` Zefram
2003-09-02 9:56 ` Peter Stephenson
2003-09-02 15:18 ` Bart Schaefer
2003-09-07 4:03 ` Vin Shelton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3oey4rozo.fsf@zion.rcn.com \
--to=acs@alumni.princeton.edu \
--cc=pws@pwstephenson.fsnet.co.uk \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
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).