File: h2cpp.awk

package info (click to toggle)
ibutils 1.2-OFED-1.4.2-1.3
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 23,616 kB
  • sloc: cpp: 153,349; ansic: 77,237; tcl: 13,447; sh: 11,852; makefile: 494; yacc: 333; lex: 169; awk: 53
file content (56 lines) | stat: -rw-r--r-- 721 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/awk -f
{
  if (h == 0) {
    print;
  }
}
/[\#]--/{
  h = 1;
  print "*/";
}
/^class/{
  if (h) {
    print "\n\n\n";
    print "//////////////////////////////////////////////////////////////";
    print "//";
    print "// CLASS ", $2;
    print "//";

    if (comment != "") {
      print comment;
    }
    c = $2;
    p = 0;
  }
}
/[^\}];/{
  if (p && h) {
    if (comment != "") {
      print comment;
    }

    for (f = 1; f <= NF; f++) {
      if (f == 2) {
        printf("%s::%s ",c,$f);
      } else {
        printf("%s ",$f);
      }
    }
    print " ";
  }
}
/\/[\*]/{
  m = 1;
  comment = "";
}
{
  if (m && p && h) {
    comment = comment "\n" $0;
  }
}
/[\*]\// {
  m = 0;
}
/public/{
  p = 1;
}