home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / rsync221.zip / mkproto.awk < prev    next >
Text File  |  1999-03-04  |  1KB  |  77 lines

  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. /^FN_LOCAL_BOOL/ {
  23.   split($0,a,"[,()]")
  24.   printf "BOOL %s(int );\n", a[2]
  25. }
  26.  
  27. /^FN_LOCAL_STRING/ {
  28.   split($0,a,"[,()]")
  29.   printf "char *%s(int );\n", a[2]
  30. }
  31.  
  32. /^FN_LOCAL_INT/ {
  33.   split($0,a,"[,()]")
  34.   printf "int %s(int );\n", a[2]
  35. }
  36.  
  37. /^FN_LOCAL_CHAR/ {
  38.   split($0,a,"[,()]")
  39.   printf "char %s(int );\n", a[2]
  40. }
  41.  
  42. /^FN_GLOBAL_BOOL/ {
  43.   split($0,a,"[,()]")
  44.   printf "BOOL %s(void);\n", a[2]
  45. }
  46.  
  47. /^FN_GLOBAL_STRING/ {
  48.   split($0,a,"[,()]")
  49.   printf "char *%s(void);\n", a[2]
  50. }
  51.  
  52. /^FN_GLOBAL_INT/ {
  53.   split($0,a,"[,()]")
  54.   printf "int %s(void);\n", a[2]
  55. }
  56.  
  57. /^static|^extern/ || !/^[a-zA-Z]/ || /[;]/ {
  58.   next;
  59. }
  60.  
  61. !/^OFF_T|^size_t|^off_t|^pid_t|^unsigned|^mode_t|^DIR|^user|^int|^char|^uint|^struct|^BOOL|^void|^time/ {
  62.   next;
  63. }
  64.  
  65.  
  66. /[(].*[)][ \t]*$/ {
  67.     printf "%s;\n",$0;
  68.     next;
  69. }
  70.  
  71. /[(]/ {
  72.   inheader=1;
  73.   printf "%s\n",$0;
  74.   next;
  75. }
  76.  
  77.