- add sources.
[platform/framework/web/crosswalk.git] / src / third_party / talloc / script / mksyms.awk
1 #
2 # mksyms.awk
3 #
4 # Extract symbols to export from C-header files.
5 # output in version-script format for linking shared libraries.
6 #
7 # Copyright (C) 2008 Micheal Adam <obnox@samba.org>
8 #
9 BEGIN {
10         inheader=0;
11 }
12
13 END {
14 }
15
16 {
17         if (inheader) {
18                 if (match($0,"[)][^()]*[;][ \t]*$")) {
19                         inheader = 0;
20                 }
21                 next;
22         }
23 }
24
25 /^static/ || /^[ \t]*typedef/ || !/^[a-zA-Z\_]/ {
26         next;
27 }
28
29 /^extern[ \t]+[^()]+[;][ \t]*$/ {
30         gsub(/[^ \t]+[ \t]+/, "");
31         sub(/[;][ \t]*$/, "");
32         printf "           %s;\n", $0;
33         next;
34 }
35
36 # look for function headers:
37 {
38         gotstart = 0;
39         if ($0 ~ /^[A-Za-z_][A-Za-z0-9_]+/) {
40         gotstart = 1;
41         }
42         if(!gotstart) {
43                 next;
44         }
45 }
46
47 /[_A-Za-z0-9]+[ \t]*[(].*[)][^()]*;[ \t]*$/ {
48         sub(/[(].*$/, "");
49         gsub(/[^ \t]+[ \t]+/, "");
50         gsub(/^[*]+/, "");
51         printf "           %s;\n",$0;
52         next;
53 }
54
55 /[_A-Za-z0-9]+[ \t]*[(]/ {
56         inheader=1;
57         sub(/[(].*$/, "");
58         gsub(/[^ \t]+[ \t]+/, "");
59         gsub(/^[*]/, "");
60         printf "           %s;\n",$0;
61         next;
62 }
63