lib/childprocess/tools/generator.rb in childprocess-0.2.8 vs lib/childprocess/tools/generator.rb in childprocess-0.2.9
- old
+ new
@@ -44,10 +44,11 @@
puts "wrote #{@out}"
end
def fetch_size(type_name, opts = {})
+ print "sizeof(#{type_name}): "
src = <<-EOF
int main() {
printf("%d", (unsigned int)sizeof(#{type_name}));
return 0;
}
@@ -57,27 +58,33 @@
if output.to_i < 1
raise "sizeof(#{type_name}) == #{output.to_i} (output=#{output})"
end
- @sizeof[type_name] = output.to_i
+ size = output.to_i
+ @sizeof[type_name] = size
+
+ puts size
end
def fetch_constant(name, opts)
+ print "#{name}: "
src = <<-EOF
int main() {
printf("%d", (unsigned int)#{name});
return 0;
}
EOF
output = execute(src, opts)
- @constants[name] = Integer(output)
+ value = Integer(output)
+ @constants[name] = value
+
+ puts value
end
def execute(src, opts)
-
program = Array(opts[:define]).map do |key, value|
<<-SRC
#ifndef #{key}
#define #{key} #{value}
#endif
\ No newline at end of file