]>
Commit | Line | Data |
---|---|---|
5b80666b | 1 | #!/usr/bin/env bash |
b2dad0e3 BK |
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 | ||
6ad50467 BK |
7 | SCRIPTDIR=${0%/*} |
8 | ||
9 | if [ ! -d cshadow ]; then | |
10 | echo "Creating cshadow." | |
5b80666b | 11 | mkdir ../cshadow |
6ad50467 BK |
12 | fi |
13 | ||
14 | echo "Creating..." | |
b2dad0e3 BK |
15 | while read header; do |
16 | ||
6ad50467 | 17 | if [ ! -f $SCRIPTDIR/shadow/$header ]; then |
b2dad0e3 BK |
18 | |
19 | # strip off directory names while making | |
20 | # any necessary directories | |
21 | ||
5b80666b | 22 | dir=../cshadow |
b2dad0e3 BK |
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 | |
6ad50467 | 32 | |
5b80666b | 33 | echo " ../cshadow/$header" |
b2dad0e3 | 34 | UPNAME=`echo $header | tr 'a-z./-' 'A-Z___'` |
5b80666b | 35 | cat >"../cshadow/$header" <<EOF |
b2dad0e3 BK |
36 | // -*- C++ -*- header wrapper. |
37 | ||
6ad50467 | 38 | // Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. |
b2dad0e3 BK |
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}_ | |
0517cb99 | 69 | # define _INCLUDED_CPP_${UPNAME}_ |
b2dad0e3 | 70 | |
6dad70df | 71 | # ifdef _IN_C_LEGACY_ /* sub-included by a C header */ |
0517cb99 | 72 | # pragma GCC system_header |
b2dad0e3 BK |
73 | # include_next <${header}> |
74 | # else | |
75 | ||
6dad70df BK |
76 | namespace _C_legacy { namespace _C_shadow { } } |
77 | using namespace ::_C_legacy::_C_shadow; | |
78 | namespace _C_legacy { | |
b2dad0e3 | 79 | extern "C" { |
6dad70df | 80 | # define _IN_C_LEGACY_ |
0517cb99 | 81 | # pragma GCC system_header |
b2dad0e3 BK |
82 | # include_next <${header}> |
83 | } // close extern "C" | |
6dad70df | 84 | } // close namespace _C_legacy:: |
0517cb99 | 85 | # undef _IN_C_LEGACY_ |
b2dad0e3 | 86 | |
6dad70df | 87 | # endif /* _IN_C_LEGACY_ */ |
b2dad0e3 | 88 | #endif /* _INCLUDED_CPP_${UPNAME}_ */ |
b2dad0e3 | 89 | EOF |
6ad50467 | 90 | #################### end #################### |
b2dad0e3 BK |
91 | fi |
92 | done | |
5b80666b BK |
93 | |
94 | ||
95 | ||
96 | ||
97 | ||
98 |