diff options
| author | Jérémy Zurcher <jeremy@asynk.ch> | 2011-05-11 09:24:45 +0200 | 
|---|---|---|
| committer | Jérémy Zurcher <jeremy@asynk.ch> | 2011-05-11 09:24:45 +0200 | 
| commit | 0c30e8a8efcc32de3216a8f49b84793e51ff31cc (patch) | |
| tree | 86e1f7ed44472730364a586bca82a884c8d376f0 /tools | |
| parent | 2c794ec852823d6601f6f360962691b56d8c7fbb (diff) | |
| download | ffi-efl-0c30e8a8efcc32de3216a8f49b84793e51ff31cc.zip ffi-efl-0c30e8a8efcc32de3216a8f49b84793e51ff31cc.tar.gz | |
take care of EAPI extern with FFI#attach_variable
Diffstat (limited to 'tools')
| -rwxr-xr-x | tools/extract-api.sh | 2 | ||||
| -rwxr-xr-x | tools/genruby.rb | 23 | ||||
| -rw-r--r-- | tools/sed-functions | 2 | 
3 files changed, 24 insertions, 3 deletions
| diff --git a/tools/extract-api.sh b/tools/extract-api.sh index a681465..27a32bc 100755 --- a/tools/extract-api.sh +++ b/tools/extract-api.sh @@ -46,7 +46,7 @@ for header in \      DIR=$(dirname $header)      FILE=$(basename $header)      # -    for what in functions enums types callbacks; do +    for what in functions enums types callbacks variables; do          F=$FILE-$what          cat $header | sed -r -n -f $P/sed-$what > $CURRENT/$F          if [ -f $PREV/$F ]; then diff --git a/tools/genruby.rb b/tools/genruby.rb index c7d1115..5065a7d 100755 --- a/tools/genruby.rb +++ b/tools/genruby.rb @@ -225,6 +225,22 @@ def gen_callbacks path, indent      r  end  # +def gen_variables path, indent +    r = [] +    open(path+'-variables','r').readlines.each do |l| +        l.strip! +        if not l=~ /EAPI\s+extern\s+(\w+\s+\*?)(\w+)/ +            r << indent+"# #{l}\n#{indent}# FIXME" +            next +        end +        var = $2 +        t = $1 +        r << indent+"# #{l}" +        r << wrap_text(indent+"attach_variable :#{var}, #{get_type t}", indent+' '*4) +    end +    r +end +#  def gen_functions path, indent      r = []      r << indent+"fcts = [" @@ -258,10 +274,12 @@ libraries.collect do |header,module_name,fct_prefix,lib, output|      r << gen_typedefs(base, INDENT)      print "callbacks, "      r << gen_callbacks(base, INDENT) +    print "variables, " +    r << gen_variables(base, INDENT)      puts "functions."      r << gen_functions(base, INDENT)      r -end.each do |lib, output, module_name, fct_prefix, enums, typedefs, callbacks, functions| +end.each do |lib, output, module_name, fct_prefix, enums, typedefs, callbacks, variables, functions|      printf "%-60s", "generate #{output}"      open(output,'w:utf-8') do |f|          f << HEADER.gsub(/MNAME/,module_name).sub(/FCT_PREFIX/,fct_prefix) @@ -275,6 +293,9 @@ end.each do |lib, output, module_name, fct_prefix, enums, typedefs, callbacks, f          f << "\n#{INDENT}#\n#{INDENT}# CALLBACKS"          print "callbacks, "          f << "\n"+callbacks.join("\n") unless callbacks.empty? +        f << "\n#{INDENT}#\n#{INDENT}# VARIABLES" +        print "variables, " +        f << "\n"+variables.join("\n") unless variables.empty?          f << "\n#{INDENT}#\n#{INDENT}# FUNCTIONS"          puts "functions."          f << "\n"+functions.join("\n") unless functions.empty? diff --git a/tools/sed-functions b/tools/sed-functions index faf8bc7..296cab1 100644 --- a/tools/sed-functions +++ b/tools/sed-functions @@ -1,4 +1,4 @@ - +/EAPI extern/ b  # if return type on single line, append next line  /EAPI.*[^;]\s*$/ { N; s/\n/ / }  # while unfinished argument list, append next line | 
