|
Packit |
fc043f |
# mkerrcodes.awk
|
|
Packit |
fc043f |
# Copyright (C) 2004, 2005, 2006 g10 Code GmbH
|
|
Packit |
fc043f |
#
|
|
Packit |
fc043f |
# This program is free software; you can redistribute it and/or
|
|
Packit |
fc043f |
# modify it under the terms of the GNU General Public License as
|
|
Packit |
fc043f |
# published by the Free Software Foundation; either version 2 of
|
|
Packit |
fc043f |
# the License, or (at your option) any later version.
|
|
Packit |
fc043f |
#
|
|
Packit |
fc043f |
# This program is distributed in the hope that it will be useful,
|
|
Packit |
fc043f |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
fc043f |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
fc043f |
# General Public License for more details.
|
|
Packit |
fc043f |
#
|
|
Packit |
fc043f |
# You should have received a copy of the GNU General Public License
|
|
Packit |
fc043f |
# along with this program; if not, write to the Free Software
|
|
Packit |
fc043f |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
|
Packit |
fc043f |
#
|
|
Packit |
fc043f |
# As a special exception, g10 Code GmbH gives unlimited permission to
|
|
Packit |
fc043f |
# copy, distribute and modify the lisp source files that are the output
|
|
Packit |
fc043f |
# of mkerrcodes.awk. You need not follow the terms of the GNU General
|
|
Packit |
fc043f |
# Public License when using or distributing such scripts, even though
|
|
Packit |
fc043f |
# portions of the text of mkerrcodes.awk appear in them. The GNU
|
|
Packit |
fc043f |
# General Public License (GPL) does govern all other use of the material
|
|
Packit |
fc043f |
# that constitutes the mkerrcodes.awk program.
|
|
Packit |
fc043f |
#
|
|
Packit |
fc043f |
# Certain portions of the mkerrcodes.awk source text are designed to be
|
|
Packit |
fc043f |
# copied (in certain cases, depending on the input) into the output of
|
|
Packit |
fc043f |
# mkerrcodes.awk. We call these the "data" portions. The rest of the
|
|
Packit |
fc043f |
# mkerrcodes.awk source text consists of comments plus executable code
|
|
Packit |
fc043f |
# that decides which of the data portions to output in any given case.
|
|
Packit |
fc043f |
# We call these comments and executable code the "non-data" portions.
|
|
Packit |
fc043f |
# mkerrcodes.awk never copies any of the non-data portions into its output.
|
|
Packit |
fc043f |
#
|
|
Packit |
fc043f |
# This special exception to the GPL applies to versions of mkerrcodes.awk
|
|
Packit |
fc043f |
# released by g10 Code GmbH. When you make and distribute a modified version
|
|
Packit |
fc043f |
# of mkerrcodes.awk, you may extend this special exception to the GPL to
|
|
Packit |
fc043f |
# apply to your modified version as well, *unless* your modified version
|
|
Packit |
fc043f |
# has the potential to copy into its output some of the text that was the
|
|
Packit |
fc043f |
# non-data portion of the version that you started with. (In other words,
|
|
Packit |
fc043f |
# unless your change moves or copies text from the non-data portions to the
|
|
Packit |
fc043f |
# data portions.) If your modification has such potential, you must delete
|
|
Packit |
fc043f |
# any notice of this special exception to the GPL from your modified version.
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
# The input file is in the following format:
|
|
Packit |
fc043f |
# [CODE SYMBOL...]
|
|
Packit |
fc043f |
# @errnos@
|
|
Packit |
fc043f |
# [CODE SYMBOL...]
|
|
Packit |
fc043f |
#
|
|
Packit |
fc043f |
# The difference between the sections is how symbol is transformed.
|
|
Packit |
fc043f |
# The second section gets GPG_ERR_ prepended before processing.
|
|
Packit |
fc043f |
#
|
|
Packit |
fc043f |
# Comments (starting with # and ending at the end of the line) are removed,
|
|
Packit |
fc043f |
# as is trailing whitespace.
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
BEGIN {
|
|
Packit |
fc043f |
FS="[ \t]+";
|
|
Packit |
fc043f |
print ";;;; Output of mkerrcodes.awk. DO NOT EDIT.";
|
|
Packit |
fc043f |
print "";
|
|
Packit |
fc043f |
print ";;; Copyright (C) 2006 g10 Code GmbH";
|
|
Packit |
fc043f |
print ";;;";
|
|
Packit |
fc043f |
print ";;; This file is part of libgpg-error.";
|
|
Packit |
fc043f |
print ";;;";
|
|
Packit |
fc043f |
print ";;; libgpg-error is free software; you can redistribute it and/or";
|
|
Packit |
fc043f |
print ";;; modify it under the terms of the GNU Lesser General Public License";
|
|
Packit |
fc043f |
print ";;; as published by the Free Software Foundation; either version 2.1 of";
|
|
Packit |
fc043f |
print ";;; the License, or (at your option) any later version.";
|
|
Packit |
fc043f |
print ";;;";
|
|
Packit |
fc043f |
print ";;; libgpg-error is distributed in the hope that it will be useful, but";
|
|
Packit |
fc043f |
print ";;; WITHOUT ANY WARRANTY; without even the implied warranty of";
|
|
Packit |
fc043f |
print ";;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU";
|
|
Packit |
fc043f |
print ";;; Lesser General Public License for more details.";
|
|
Packit |
fc043f |
print ";;;";
|
|
Packit |
fc043f |
print ";;; You should have received a copy of the GNU Lesser General Public";
|
|
Packit |
fc043f |
print ";;; License along with libgpg-error; if not, write to the Free";
|
|
Packit |
fc043f |
print ";;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA";
|
|
Packit |
fc043f |
print ";;; 02111-1307, USA.";
|
|
Packit |
fc043f |
print "";
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
header = 1;
|
|
Packit |
fc043f |
errnos = 0;
|
|
Packit |
fc043f |
}
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
/^#/ { next; }
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
header {
|
|
Packit |
fc043f |
if (errnos)
|
|
Packit |
fc043f |
{
|
|
Packit |
fc043f |
if ($1 ~ /^[0123456789]+$/)
|
|
Packit |
fc043f |
{
|
|
Packit |
fc043f |
header = 0;
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
print "";
|
|
Packit |
fc043f |
print " ;; The following error codes map system errors.";
|
|
Packit |
fc043f |
}
|
|
Packit |
fc043f |
}
|
|
Packit |
fc043f |
else
|
|
Packit |
fc043f |
{
|
|
Packit |
fc043f |
if ($1 ~ /^[0123456789]+$/)
|
|
Packit |
fc043f |
{
|
|
Packit |
fc043f |
header = 0;
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
print "(in-package :gpg-error)";
|
|
Packit |
fc043f |
print "";
|
|
Packit |
fc043f |
print ";;; The error code type gpg-err-code-t.";
|
|
Packit |
fc043f |
print "";
|
|
Packit |
fc043f |
print ";;; This is used for system error codes.";
|
|
Packit |
fc043f |
print "(defconstant +gpg-err-system-error+ (ash 1 15))";
|
|
Packit |
fc043f |
print "";
|
|
Packit |
fc043f |
print ";;; This is one more than the largest allowed entry.";
|
|
Packit |
fc043f |
print "(defconstant +gpg-err-code-dim+ 65536)";
|
|
Packit |
fc043f |
print "";
|
|
Packit |
fc043f |
print ";;; A helper macro to have the keyword values evaluated.";
|
|
Packit |
fc043f |
print "(defmacro defcenum-eval (type doc &rest vals)";
|
|
Packit |
fc043f |
print " `(defcenum ,type ,doc";
|
|
Packit |
fc043f |
print " ,@(loop for v in vals";
|
|
Packit |
fc043f |
print " collect `(,(first v) ,(eval (second v))))))";
|
|
Packit |
fc043f |
print "";
|
|
Packit |
fc043f |
print "(defcenum-eval gpg-err-code-t";
|
|
Packit |
fc043f |
print " \"The GPG error code type.\"";
|
|
Packit |
fc043f |
}
|
|
Packit |
fc043f |
}
|
|
Packit |
fc043f |
}
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
!header {
|
|
Packit |
fc043f |
sub (/\#.+/, "");
|
|
Packit |
fc043f |
sub (/[ ]+$/, ""); # Strip trailing space and tab characters.
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
if (/^$/)
|
|
Packit |
fc043f |
next;
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
# The following can happen for GPG_ERR_CODE_DIM.
|
|
Packit |
fc043f |
if ($1 == "")
|
|
Packit |
fc043f |
next;
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
if (/^@errnos@$/)
|
|
Packit |
fc043f |
{
|
|
Packit |
fc043f |
header = 1;
|
|
Packit |
fc043f |
errnos = 1;
|
|
Packit |
fc043f |
next;
|
|
Packit |
fc043f |
}
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
$2 = tolower($2);
|
|
Packit |
fc043f |
gsub ("_", "-", $2);
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
if (errnos)
|
|
Packit |
fc043f |
print " (:gpg-err-" $2 " (logior +gpg-err-system-error+ " $1 "))";
|
|
Packit |
fc043f |
else
|
|
Packit |
fc043f |
print " (:" $2 " " $1 ")";
|
|
Packit |
fc043f |
}
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
END {
|
|
Packit |
fc043f |
# I am very sorry to break lisp coding style here.
|
|
Packit |
fc043f |
print ")";
|
|
Packit |
fc043f |
}
|