Check-in modifications made by HGM so far
[capablanca.git] / lasker-2.2.3 / src / mkproto.awk
1 BEGIN {
2   inheader=0;
3   current_file="";
4   if (headername=="") {
5     headername="_PROTO_H_";
6   }
7
8   print "#ifndef",headername
9   print "#define",headername
10   print ""
11   print "/* This file is automatically generated with \"make proto\". DO NOT EDIT */"
12   print ""
13 }
14
15 END {
16   print ""
17   print "#endif /* ",headername," */"
18 }
19
20 {
21   if (FILENAME!=current_file) {
22     print ""
23     print "/* The following definitions come from",FILENAME," */"
24     print ""
25     current_file=FILENAME
26   }
27   if (inheader) {
28     if (match($0,"[)][ \t]*$")) {
29       inheader = 0;
30       printf "%s;\n",$0;
31     } else {
32       printf "%s\n",$0;
33     }
34     next;
35   }
36 }
37
38 /^static|^extern/ || !/^[a-zA-Z]/ || /[;]/ {
39   next;
40 }
41
42 #
43 # We have to split up the start
44 # matching as we now have so many start
45 # types that it can cause some versions
46 # of nawk/awk to choke and fail on
47 # the full match. JRA.
48 #
49
50 {
51   gotstart = 0;
52   if( $0 ~ /^const|^connection_struct|^pipes_struct|^smb_np_struct|^file_fd_struct|^files_struct|^connection_struct|^uid_t|^gid_t|^unsigned|^mode_t|^DIR|^user|^int|^pid_t|^ino_t|^off_t|^double/ ) {
53     gotstart = 1;
54   }
55
56   if( $0 ~ /^vuser_key|^UNISTR2|^LOCAL_GRP|^DOMAIN_GRP|^SMB_STRUCT_DIRENT|^SEC_ACL|^SEC_DESC|^SEC_DESC_BUF|^DOM_SID|^RPC_HND_NODE|^BYTE/ ) {
57     gotstart = 1;
58   }
59
60   if( $0 ~ /^ADS_STRUCT|^ADS_STATUS|^DATA_BLOB|^ASN1_DATA|^TDB_CONTEXT|^TDB_DATA|^smb_ucs2_t|^TALLOC_CTX|^hash_element|^NT_DEVICEMODE|^enum.*\(|^NT_USER_TOKEN|^SAM_ACCOUNT/ ) {
61     gotstart = 1;
62   }
63
64   if( $0 ~ /^smb_iconv_t|^long|^char|^uint|^NTSTATUS|^WERROR|^CLI_POLICY_HND|^struct|^BOOL|^void|^time|^smb_shm_offset_t|^shm_offset_t|^FILE|^XFILE|^SMB_OFF_T|^size_t|^ssize_t|^SMB_BIG_UINT/ ) {
65     gotstart = 1;
66   }
67
68   if( $0 ~ /^SAM_ACCT_INFO_NODE|^SMB_ACL_T|^ADS_MODLIST|^PyObject/ ) {
69     gotstart = 1;
70   }
71
72   if(!gotstart) {
73     next;
74   }
75 }
76
77
78 /[(].*[)][ \t]*$/ {
79     printf "%s;\n",$0;
80     next;
81 }
82
83 /[(]/ {
84   inheader=1;
85   printf "%s\n",$0;
86   next;
87 }
88