diff options
Diffstat (limited to 'tools/include/xen-external/bsd-sys-queue-h-seddery')
-rwxr-xr-x | tools/include/xen-external/bsd-sys-queue-h-seddery | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/tools/include/xen-external/bsd-sys-queue-h-seddery b/tools/include/xen-external/bsd-sys-queue-h-seddery new file mode 100755 index 0000000000..7a957e3a10 --- /dev/null +++ b/tools/include/xen-external/bsd-sys-queue-h-seddery @@ -0,0 +1,72 @@ +#!/usr/bin/perl -p +# +# This script is part of the Xen build system. It has a very +# permissive licence to avoid complicating the licence of the +# generated header file and to allow this seddery to be reused by +# other projects. +# +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this individual file (the "Software"), to deal +# in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, +# sublicense, and/or sell copies of the Software, and to permit +# persons to whom the Software is furnished to do so, subject to the +# following conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# +# Copyright (C) 2011 Citrix Ltd + +our $namespace, $ucnamespace; + +BEGIN { + die unless @ARGV; + $namespace = pop @ARGV; + $namespace =~ s/^--prefix=// or die; + $ucnamespace = uc $namespace; + + print <<END or die $!; +/* + * DO NOT EDIT THIS FILE + * + * Generated automatically by bsd-sys-queue-h-seddery to + * - introduce ${ucnamespace}_ and ${namespace}_ namespace prefixes + * - turn "struct type" into "type" so that type arguments + * to the macros are type names not struct tags + * - remove the reference to sys/cdefs.h, which is not needed + * + * The purpose of this seddery is to allow the resulting file to be + * freely included by software which might also want to include other + * list macros; to make it usable when struct tags are not being used + * or not known; to make it more portable. + */ +END +} + +s/\b( _SYS_QUEUE | + SLIST | LIST | STAILQ | TAILQ | QUEUE + )/${ucnamespace}_$1/xg; + +s/\b( TRACEBUF | TRASHIT | + QMD_ + )/${ucnamespace}__$1/xg; + +s/\b( + qm_ + )/${namespace}__$1/xg; + +s/\b struct \s+ type \b/type/xg; + +s,^\#include.*sys/cdefs.*,/* $& */,xg; + +s/\b( NULL )/0/xg; |