lib/ffidb/exporters/lisp.rb in ffidb-0.12.0 vs lib/ffidb/exporters/lisp.rb in ffidb-0.13.0

- old
+ new

@@ -6,36 +6,31 @@ ## # Code generator for the Common Lisp programming language (using CFFI). # # @see https://common-lisp.net/project/cffi/ class Lisp < FFIDB::Exporter - TYPE_MAP = ::YAML.load(File.read(File.expand_path("../../../etc/mappings/lisp.yaml", __dir__))) - .transform_values(&:to_sym) - .freeze + TYPE_MAP = 'lisp.yaml' def finish puts self.render_template('lisp.erb') end protected ## # @param [FFIDB::Type] c_type - # @return [#inspect] + # @return [String] def struct_type(c_type) case - when c_type.array? then [c_type.array_type.to_s.to_sym, :count, c_type.array_size] - else [self.param_type(c_type)] + when c_type.array? then [c_type.array_type.to_s.to_sym, :count, c_type.array_size].map(&:inspect).join(' ') + else self.param_type(c_type) end end ## # @param [FFIDB::Type] c_type - # @return [#inspect] + # @return [String] def param_type(c_type) - case - when c_type.enum? then :int - else TYPE_MAP[c_type.to_s] || TYPE_MAP['void *'] - end + ':' << super(c_type) end end # Lisp end # FFIDB::Exporters