~ubuntu-branches/ubuntu/hardy/ruby1.8/hardy-updates

« back to all changes in this revision

Viewing changes to sample/mkproto.rb

  • Committer: Bazaar Package Importer
  • Author(s): akira yamada
  • Date: 2007-03-13 22:11:58 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20070313221158-h3oql37brlaf2go2
Tags: 1.8.6-1
* new upstream version, 1.8.6.
* libruby1.8 conflicts with libopenssl-ruby1.8 (< 1.8.6) (closes: #410018)
* changed packaging style to cdbs from dbs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
$/ = nil
 
2
while line = gets()
 
3
  if /^((void|VALUE|int|char *\*|ID|struct [\w_]+ *\*|st_table *\*) *)?\n([\w\d_]+)\(.*\)\n\s*((.+;\n)*)\{/ =~ line
 
4
    line = $'
 
5
    printf "%s %s(", $2, $3
 
6
    args = []
 
7
    for arg in $4.split(/;\n\s*/)
 
8
      arg.gsub!(/ +/, ' ')
 
9
      if arg =~ /,/
 
10
        if arg =~ /(([^*]+) *\** *[\w\d_]+),/
 
11
          type = $2.strip
 
12
          args.push $1.strip
 
13
          arg = $'
 
14
        else
 
15
          type = ""
 
16
        end
 
17
        while arg.sub!(/(\** *[\w\d_]+)(,|$)/, "") && $~
 
18
          args.push type + " " + $1.strip
 
19
        end
 
20
      else
 
21
        args.push arg.strip
 
22
      end
 
23
    end
 
24
    printf "%s);\n", args.join(', ')
 
25
    redo
 
26
  end
 
27
end