demo of cvs - ignore
[samba.git] / source / script / mkproto.awk
1 # generate prototypes for Samba C code
2 # tridge, June 1996
3
4 BEGIN {
5   inheader=0;
6   print "/* This file is automatically generated with \"make proto\". DO NOT EDIT */"
7   print ""
8 }
9
10 {
11   if (inheader) {
12     if (match($0,"[)][ \t]*$")) {
13       inheader = 0;
14       printf "%s;\n",$0;
15     } else {
16       printf "%s\n",$0;
17     }
18     next;
19   }
20 }
21
22 # we handle the loadparm.c fns separately
23
24 /^FN_LOCAL_BOOL/ {
25   split($0,a,"[,()]")
26   printf "BOOL %s(int );\n", a[2]
27 }
28
29 /^FN_LOCAL_STRING/ {
30   split($0,a,"[,()]")
31   printf "char *%s(int );\n", a[2]
32 }
33
34 /^FN_LOCAL_INT/ {
35   split($0,a,"[,()]")
36   printf "int %s(int );\n", a[2]
37 }
38
39 /^FN_LOCAL_CHAR/ {
40   split($0,a,"[,()]")
41   printf "char %s(int );\n", a[2]
42 }
43
44 /^FN_GLOBAL_BOOL/ {
45   split($0,a,"[,()]")
46   printf "BOOL %s(void);\n", a[2]
47 }
48
49 /^FN_GLOBAL_STRING/ {
50   split($0,a,"[,()]")
51   printf "char *%s(void);\n", a[2]
52 }
53
54 /^FN_GLOBAL_INT/ {
55   split($0,a,"[,()]")
56   printf "int %s(void);\n", a[2]
57 }
58
59 /^static|^extern/ || !/^[a-zA-Z]/ || /[;]/ {
60   next;
61 }
62
63 !/^unsigned|^mode_t|^DIR|^user|^int|^char|^uint|^struct|^BOOL|^void|^time/ {
64   next;
65 }
66
67
68 /[(].*[)][ \t]*$/ {
69     printf "%s;\n",$0;
70     next;
71 }
72
73 /[(]/ {
74   inheader=1;
75   printf "%s\n",$0;
76   next;
77 }
78