mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
We would like some linked list macros which are (a) well known to be sane and (b) typesafe. BSD's queue.h meets these criteria. We also provide some simple perlery to arrange to add the libxl_ namespace prefix to the macros. This will allow us to #include _libxl_list.h in our public header file without clashing with anyone else who is also using another version of queue.h. (A note on copyright: The FreeBSD files we are adding have an [L]GPL-compatible licence, so there is no need to change our COPYING. Although FreeBSD's queue.3 still contains the advertising clause, this has been withdrawn by UCB as recorded in the FreeBSD COPYRIGHT file, which is included in tools/libxl/external/ for reference.) Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <Ian.campbell@citrix.com> Tested-by: Roger Pau Monne <roger.pau@entel.upc.edu> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
71 lines
2.3 KiB
Perl
Executable File
71 lines
2.3 KiB
Perl
Executable File
#!/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;
|