Sha256: 2cf13d37d3238a3397c16f1d445b1bca75b7a8025f332f937f4f8b3403bb30a0

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

#!/usr/bin/ruby
require 'fileutils'
file="pre_taglib"
out="taglib.cxx"
fo=File.open(out,"wb")
swig_p={}
File.open(file,"r") {|f| f.each_line {|l|
        l.gsub!("SWIGINTERN VALUE","VALUE")
        if(l=~/SWIG_TypeClientData\((.+),\s*\(void \*\) &(.+)\);/)
            swig_p[$1]=$2
        end
        if(l=~/\s+(.+) = rb_define_class_under\(mTagLib, "(.+)",\s*(.+swig_class.+ (.+?)\->.+|\s+rb_cObject\));/)
            clase=$1
            final=$3
            clase_padre=$4
            ruta=$2.split("_")
            if(ruta.size>1)
            mod="mTagLib"+ruta[0,ruta.size-1].join 
            clas=ruta[ruta.size-1]
            if clase_padre.nil?
                linea=sprintf("%s = rb_define_class_under(%s, \"%s\", rb_cObject);",clase,mod,clas)
            else
                linea=<<HERE
#{clase} = rb_define_class_under(#{mod}, "#{clas}", ((swig_class *) #{clase_padre}->clientdata)->klass);
HERE

            end
            #p linea
            fo.puts(linea)
            else
                fo.puts l
            end
        else
            fo.puts l
        end
    }
}
fo.close

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rtaglib-0.2.1 swig/process_cxx.rb