~ubuntu-branches/ubuntu/raring/ibutils/raring-proposed

« back to all changes in this revision

Viewing changes to ibmgtsim/utils/h2cpp.awk

  • Committer: Bazaar Package Importer
  • Author(s): Benoit Mortier
  • Date: 2010-01-11 22:22:00 UTC
  • Revision ID: james.westby@ubuntu.com-20100111222200-53kum2et5nh13rv3
Tags: upstream-1.2-OFED-1.4.2
ImportĀ upstreamĀ versionĀ 1.2-OFED-1.4.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/awk -f
 
2
{
 
3
  if (h == 0) {
 
4
    print;
 
5
  }
 
6
}
 
7
/[\#]--/{
 
8
  h = 1;
 
9
  print "*/";
 
10
}
 
11
/^class/{
 
12
  if (h) {
 
13
    print "\n\n\n";
 
14
    print "//////////////////////////////////////////////////////////////";
 
15
    print "//";
 
16
    print "// CLASS ", $2;
 
17
    print "//";
 
18
 
 
19
    if (comment != "") {
 
20
      print comment;
 
21
    }
 
22
    c = $2;
 
23
    p = 0;
 
24
  }
 
25
}
 
26
/[^\}];/{
 
27
  if (p && h) {
 
28
    if (comment != "") {
 
29
      print comment;
 
30
    }
 
31
 
 
32
    for (f = 1; f <= NF; f++) {
 
33
      if (f == 2) {
 
34
        printf("%s::%s ",c,$f);
 
35
      } else {
 
36
        printf("%s ",$f);
 
37
      }
 
38
    }
 
39
    print " ";
 
40
  }
 
41
}
 
42
/\/[\*]/{
 
43
  m = 1;
 
44
  comment = "";
 
45
}
 
46
{
 
47
  if (m && p && h) {
 
48
    comment = comment "\n" $0;
 
49
  }
 
50
}
 
51
/[\*]\// {
 
52
  m = 0;
 
53
}
 
54
/public/{
 
55
  p = 1;
 
56
}