| 1 | #!/usr/bin/env bash
|
|---|
| 2 |
|
|---|
| 3 | # mkcshadow: reads header names (like "features.h" or "sys/types.h")
|
|---|
| 4 | # from stdin, and creates shadow headers under cshadow/, except where
|
|---|
| 5 | # a header of the same name is already in shadow/.
|
|---|
| 6 |
|
|---|
| 7 | SCRIPTDIR=${0%/*}
|
|---|
| 8 |
|
|---|
| 9 | if [ ! -d cshadow ]; then
|
|---|
| 10 | echo "Creating cshadow."
|
|---|
| 11 | mkdir ../cshadow
|
|---|
| 12 | fi
|
|---|
| 13 |
|
|---|
| 14 | echo "Creating..."
|
|---|
| 15 | while read header; do
|
|---|
| 16 |
|
|---|
| 17 | if [ ! -f $SCRIPTDIR/shadow/$header ]; then
|
|---|
| 18 |
|
|---|
| 19 | # strip off directory names while making
|
|---|
| 20 | # any necessary directories
|
|---|
| 21 |
|
|---|
| 22 | dir=../cshadow
|
|---|
| 23 | case "$header" in */*)
|
|---|
| 24 | right="$header"
|
|---|
| 25 | while [ "$right" != "${right##*/}" ] ; do
|
|---|
| 26 | dir="$dir/${right%%/*}"
|
|---|
| 27 | if [ ! -d "$dir" ]; then mkdir "$dir"; fi
|
|---|
| 28 | right="${right#*/}"
|
|---|
| 29 | done
|
|---|
| 30 | ;;
|
|---|
| 31 | esac
|
|---|
| 32 |
|
|---|
| 33 | echo " ../cshadow/$header"
|
|---|
| 34 | UPNAME=`echo $header | tr 'a-z./-' 'A-Z___'`
|
|---|
| 35 | cat >"../cshadow/$header" <<EOF
|
|---|
| 36 | // -*- C++ -*- header wrapper.
|
|---|
| 37 |
|
|---|
| 38 | // Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
|
|---|
| 39 | //
|
|---|
| 40 | // This file is part of the GNU ISO C++ Library. This library is free
|
|---|
| 41 | // software; you can redistribute it and/or modify it under the
|
|---|
| 42 | // terms of the GNU General Public License as published by the
|
|---|
| 43 | // Free Software Foundation; either version 2, or (at your option)
|
|---|
| 44 | // any later version.
|
|---|
| 45 |
|
|---|
| 46 | // This library is distributed in the hope that it will be useful,
|
|---|
| 47 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 48 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 49 | // GNU General Public License for more details.
|
|---|
| 50 |
|
|---|
| 51 | // You should have received a copy of the GNU General Public License along
|
|---|
| 52 | // with this library; see the file COPYING. If not, write to the Free
|
|---|
| 53 | // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
|---|
| 54 | // USA.
|
|---|
| 55 |
|
|---|
| 56 | // As a special exception, you may use this file as part of a free software
|
|---|
| 57 | // library without restriction. Specifically, if other files instantiate
|
|---|
| 58 | // templates or use macros or inline functions from this file, or you compile
|
|---|
| 59 | // this file and link it with other files to produce an executable, this
|
|---|
| 60 | // file does not by itself cause the resulting executable to be covered by
|
|---|
| 61 | // the GNU General Public License. This exception does not however
|
|---|
| 62 | // invalidate any other reasons why the executable file might be covered by
|
|---|
| 63 | // the GNU General Public License.
|
|---|
| 64 |
|
|---|
| 65 | // Note: this file was automatically generated by the "mkcshadow"
|
|---|
| 66 | // script. RTFM!
|
|---|
| 67 |
|
|---|
| 68 | #ifndef _INCLUDED_CPP_${UPNAME}_
|
|---|
| 69 | # define _INCLUDED_CPP_${UPNAME}_
|
|---|
| 70 |
|
|---|
| 71 | # ifdef _IN_C_LEGACY_ /* sub-included by a C header */
|
|---|
| 72 | # pragma GCC system_header
|
|---|
| 73 | # include_next <${header}>
|
|---|
| 74 | # else
|
|---|
| 75 |
|
|---|
| 76 | namespace _C_legacy { namespace _C_shadow { } }
|
|---|
| 77 | using namespace ::_C_legacy::_C_shadow;
|
|---|
| 78 | namespace _C_legacy {
|
|---|
| 79 | extern "C" {
|
|---|
| 80 | # define _IN_C_LEGACY_
|
|---|
| 81 | # pragma GCC system_header
|
|---|
| 82 | # include_next <${header}>
|
|---|
| 83 | } // close extern "C"
|
|---|
| 84 | } // close namespace _C_legacy::
|
|---|
| 85 | # undef _IN_C_LEGACY_
|
|---|
| 86 |
|
|---|
| 87 | # endif /* _IN_C_LEGACY_ */
|
|---|
| 88 | #endif /* _INCLUDED_CPP_${UPNAME}_ */
|
|---|
| 89 | EOF
|
|---|
| 90 | #################### end ####################
|
|---|
| 91 | fi
|
|---|
| 92 | done
|
|---|
| 93 |
|
|---|
| 94 |
|
|---|
| 95 |
|
|---|
| 96 |
|
|---|
| 97 |
|
|---|
| 98 |
|
|---|