]> git.saurik.com Git - apple/xnu.git/blame_incremental - bsd/miscfs/devfs/reproto.sh
xnu-4903.241.1.tar.gz
[apple/xnu.git] / bsd / miscfs / devfs / reproto.sh
... / ...
CommitLineData
1#!/bin/sh
2#
3# This used to be a shell script, but had to become more sophisticated
4# to allow for KNF function definitions. So rewrote in perl, but wrapped
5# as a shell script.
6#
7exec /usr/bin/perl << *EOF*
8open(PROTO, ">devfs_proto.h") || die "Cannot open devfs_proto.h\n";
9
10print PROTO "" .
11"/*\n" .
12" * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.\n" .
13" *\n" .
14" * \@APPLE_OSREFERENCE_LICENSE_HEADER_START\@\n" .
15" *\n" .
16" * The contents of this file constitute Original Code as defined in and\n" .
17" * are subject to the Apple Public Source License Version 1.1 (the\n" .
18" * \"License\"). You may not use this file except in compliance with the\n" .
19" * License. Please obtain a copy of the License at\n" .
20" * http://www.apple.com/publicsource and read it before using this file.\n" .
21" *\n" .
22" * This Original Code and all software distributed under the License are\n" .
23" * distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY KIND, EITHER\n" .
24" * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,\n" .
25" * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,\n" .
26" * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the\n" .
27" * License for the specific language governing rights and limitations\n" .
28" * under the License.\n" .
29" *\n" .
30" * \@APPLE_OSREFERENCE_LICENSE_HEADER_END\@\n" .
31" */\n";
32
33print PROTO "/* THIS FILE HAS BEEN PRODUCED AUTOMATICALLY */\n";
34
35print PROTO "#ifndef __DEVFS_DEVFS_PROTO_H__\n";
36print PROTO "#define __DEVFS_DEVFS_PROTO_H__\n";
37print PROTO "\n#include <sys/appleapiopts.h>\n";
38print PROTO "\n#ifdef __APPLE_API_PRIVATE\n";
39
40while (\$file = <*.c>) {
41 if(open(F, \$file) == 0) {
42 warn "Cannot open \$file.\n";
43 next;
44 }
45
46 while(<F>) {
47 chop;
48 if (m|/\*proto\*/|) {
49 \$collecting = 1;
50 \$idx = 0;
51 } elsif (\$collecting) {
52 if (/^{/) {
53 \$text[\$idx - 1] .= ';';
54 for (\$i = 0; \$i < \$idx; \$i++) {
55 print PROTO "\$text[\$i]";
56 print PROTO \$i == 0? "\t": "\n";
57 }
58 \$collecting = 0;
59 next;
60 }
61 \$text[\$idx++] = \$_;
62 }
63 }
64 close F;
65}
66
67print PROTO "\n#endif /* __APPLE_API_PRIVATE */\n";
68print PROTO "#endif /* __DEVFS_DEVFS_PROTO_H__ */\n";
69
70print PROTO "/* THIS FILE PRODUCED AUTOMATICALLY */\n" .
71 "/* DO NOT EDIT (see reproto.sh) */\n";
72
73*EOF*