Papierkorb / bindgen

Binding and wrapper generator for C/C++ libraries
GNU General Public License v3.0
179 stars 18 forks source link

Pull zawertun changes #29

Closed kalinon closed 4 years ago

kalinon commented 4 years ago

Pulling fork from @ZaWertun. Changes to clang/find_clang.cr were dropped for now.

Needs #25 first

docelic commented 4 years ago

From what I can see the changes look good in general. There are just two things I'll change after merge, one is to keep the check for Time.local vs Time.now, and the other is to remove/leave out the explicit check for Qt::Key in ZaWertun's sources. This was already submitted as a PR and not accepted by Stefan because he wants to keep bindgen sources clean of any specific Qt customizations.

ZaWertun commented 4 years ago

From what I can see the changes look good in general. There are just two things I'll change after merge, one is to keep the check for Time.local vs Time.now, and the other is to remove/leave out the explicit check for Qt::Key in ZaWertun's sources. This was already submitted as a PR and not accepted by Stefan because he wants to keep bindgen sources clean of any specific Qt customizations.

This change has been made configurable and not hard coded long time ago, see: https://github.com/ZaWertun/bindgen/commit/8d2da829517ded275ae5d531206f05b366c8bed2 + https://github.com/ZaWertun/qt5.cr/commit/b3bce17c13d9579c04923814408d2cb4ed572120.

docelic commented 4 years ago

Yes, yes, but somehow the old code ended up in the proposed PR:

diff --git a/src/bindgen/generator/crystal.cr b/src/bindgen/generator/crystal.cr
index 69ea7a8..fc4a164 100644
--- a/src/bindgen/generator/crystal.cr
+++ b/src/bindgen/generator/crystal.cr
@@ -75,10 +75,7 @@ module Bindgen
         puts "@[Flags]" if enumeration.origin.flags?
         code_block "enum", enumeration.name, ":", type_name do
           enumeration.origin.values.each do |name, value|
-            puts "#{name.camelcase} = #{value}"
+            unless enumeration.path_name == "Qt::Key"
+              name = name.camelcase
+            end
+            puts "#{name} = #{value}"
           end
         end
       end

This is the old code that should not be in, right?

ZaWertun commented 4 years ago

Damn, just forgot to revert it. It must work without that hack now.