talloc: Change the way mksysms work
[Samba.git] / lib / talloc / script / mksyms.awk
blob8775faff3feea63784e541ea4128e05fcf7e3866
2 # mksyms.awk
4 # Extract symbols to export from C-header files.
5 # output in version-script format for linking shared libraries.
7 # Copyright (C) 2008 Micheal Adam <obnox@samba.org>
9 BEGIN {
10 inheader=0;
13 END {
17 if (inheader) {
18 if (match($0,"[)][^()]*[;][ \t]*$")) {
19 inheader = 0;
21 next;
25 /^static/ || /^[ \t]*typedef/ || !/^[a-zA-Z\_]/ {
26 next;
29 /^extern[ \t]+[^()]+[;][ \t]*$/ {
30 gsub(/[^ \t]+[ \t]+/, "");
31 sub(/[;][ \t]*$/, "");
32 printf " %s;\n", $0;
33 next;
36 # look for function headers:
38 gotstart = 0;
39 if ($0 ~ /^[A-Za-z_][A-Za-z0-9_]+/) {
40 gotstart = 1;
42 if(!gotstart) {
43 next;
47 /[_A-Za-z0-9]+[ \t]*[(].*[)][^()]*;[ \t]*$/ {
48 sub(/[(].*$/, "");
49 gsub(/[^ \t]+[ \t]+/, "");
50 gsub(/^[*]+/, "");
51 printf " %s;\n",$0;
52 next;
55 /[_A-Za-z0-9]+[ \t]*[(]/ {
56 inheader=1;
57 sub(/[(].*$/, "");
58 gsub(/[^ \t]+[ \t]+/, "");
59 gsub(/^[*]/, "");
60 printf " %s;\n",$0;
61 next;