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