Mercurial > hg > octave-kai
changeset 5494:73a87a677257
[project @ 2005-10-14 07:29:20 by jwe]
author | jwe |
---|---|
date | Fri, 14 Oct 2005 07:29:20 +0000 |
parents | b2e882e8b68b |
children | 71c9d4a6a843 |
files | src/ChangeLog src/Makefile.in src/mk-errno-list src/oct-errno.cc.in |
diffstat | 4 files changed, 43 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2005-10-14 John W. Eaton <jwe@octave.org> + + * mk-errno-list: New script. + * Makefile.in (oct-errno.cc): Use it. + 2005-10-13 John W. Eaton <jwe@octave.org> * DLD-FUNCTIONS/gplot.l (F__gnuplot_raw__):
--- a/src/Makefile.in +++ b/src/Makefile.in @@ -548,7 +548,9 @@ oct-errno.cc: oct-errno.cc.in ../Makeconf Makefile @echo "making $@ from $<" @if test -n "$(PERL)"; then \ - $(PERL) -e 'foreach $$key (keys(%!)) { $$x .= "#if defined ($$key)\n { \"$$key\", $$key, },\n#endif\n"; }; while (<>) { s/^ *\@SYSDEP_ERRNO_LIST\@/$$x/; print; }' $< > $@.t; \ + $(srcdir)/mk-errno-list --perl "$(PERL)" < $< > $@.t; + elif test -n "$(PYTHON)"; then \ + $(srcdir)/mk-errno-list --python "$(PYTHON)" < $< > $@.t; else \ $(SED) '/@SYSDEP_ERRNO_LIST@/D' $< > $@.t; \ fi
new file mode 100755 --- /dev/null +++ b/src/mk-errno-list @@ -0,0 +1,34 @@ +#! /bin/sh + +if [ $# -ne 2 ]; then + echo "usage: get-errno-list [--perl PERL|--python PYTHON]" 1>&2 + exit 1 +fi + +if [ $1 = "--perl" ]; then + PERL="$2"; + $PERL -e 'foreach $key (keys(%!)) { + $x .= "#if defined ($key)\n { \"$key\", $key, },\n#endif\n"; + } + while (<>) { + s/^ *\@SYSDEP_ERRNO_LIST\@/$ x/; + print; + }' + +elif [ $1 = "--python" ]; then + PYTHON="$2"; + $PYTHON -c ' +from errno import errorcode +from sys import stdin + +t = "#if defined (%s)\n { \"%s\", %s, },\n#endif\n" +errstr = "" +for k in errorcode.keys(): + errstr += t % tuple(3*[errorcode[k]]) + +for l in stdin: + print l.replace("@SYSDEP_ERRNO_LIST@", errstr), +' +fi + +exit $?