]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
Some lua typemap cleanups
authorMichael Schroeder <mls@suse.de>
Wed, 27 Mar 2024 12:24:25 +0000 (13:24 +0100)
committerMichael Schroeder <mls@suse.de>
Wed, 27 Mar 2024 12:24:25 +0000 (13:24 +0100)
bindings/solv.i

index 68002101c2770244d10883cf8b67a8b82b8f8112..a2b1cd52a795bc9e816c31b855411173f7a21ac8 100644 (file)
@@ -878,39 +878,43 @@ SWIG_AsValDepId(void *obj, int *val) {
 
 
 /**
- ** misc stuff
+ ** meta method renaming
  **/
-
-%include "typemaps.i"
+#if defined(SWIGPERL)
+%rename("str") *::__str__;
+#endif
+#if defined(SWIGRUBY)
+%rename("to_s") *::__str__;
+#endif
+#if defined(SWIGTCL)
+%rename("str") *::__str__;
+%rename("==") *::__eq__;
+%rename("!=") *::__ne__;
+#endif
 #if defined(SWIGLUA)
-%runtime "swigerrors.swg";
-%include "typemaps/swigmacros.swg"
-%include "typemaps/valtypes.swg"
-%include "typemaps/inoutlist.swg"
-
 %rename(__call) *::__next__;
 %rename(__tostring) *::__str__;
 %rename(__index) *::__getitem__;
 %rename(__eq) *::__eq__;
 %rename(__ne) *::__ne__;
-
-%typemap(in) void *ign1 {};
-%typemap(in) void *ign2 {};
-%typemap(in,checkfn="lua_isfunction") int lua_function_idx { $1 = $input; };
-#endif
-
-#if defined(SWIGTCL)
-%rename("==") *::__eq__;
-%rename("!=") *::__ne__;
 #endif
 #if defined(SWIGPERL) || defined(SWIGTCL) || defined(SWIGLUA)
 %rename("repr") *::__repr__;
 #endif
-#if defined(SWIGRUBY)
-%rename("to_s") *::__str__;
-#endif
-#if defined(SWIGPERL) || defined(SWIGTCL)
-%rename("str") __str__;
+
+
+/**
+ ** misc stuff
+ **/
+
+%include "typemaps.i"
+#if defined(SWIGLUA)
+%runtime "swigerrors.swg";
+%include "typemaps/swigmacros.swg"
+
+%typemap(in) void *ign1 {};
+%typemap(in) void *ign2 {};
+%typemap(in,checkfn="lua_isfunction") int lua_function_idx { $1 = $input; };
 #endif
 
 %typemap(in,numinputs=0,noblock=1) XRule **OUTPUT ($*1_ltype temp) {
@@ -927,25 +931,19 @@ SWIG_AsValDepId(void *obj, int *val) {
 #endif
 
 #if defined(SWIGLUA)
-%typemap(in,noblock=1,fragment="SWIG_AsValSolvFpPtr") FILE * {
-    {
-      FILE *val;
-      int ecode = SWIG_AsValSolvFpPtr(L, $input, &val);
-      if (!SWIG_IsOK(ecode)) SWIG_fail;
-      $1 = val;
-    }
+%typemap(in,noblock=1,fragment="SWIG_AsValSolvFpPtr") FILE * (FILE *val, int ecode) {
+  ecode = SWIG_AsValSolvFpPtr(L, $input, &val);
+  if (!SWIG_IsOK(ecode)) SWIG_fail_arg("$symname", $argnum, "FILE *");
+  $1 = val;
 }
 %typemap(typecheck,precedence=%checkcode(POINTER),fragment="SWIG_AsValSolvFpPtr") FILE * {
   int res = SWIG_AsValSolvFpPtr(L, $input, NULL);
   $1 = SWIG_CheckState(res);
 }
-%typemap(in,noblock=1,fragment="SWIG_AsValDepId") DepId {
-    {
-      int val;
-      int ecode = SWIG_AsValDepId(L, $input, &val);
-      if (!SWIG_IsOK(ecode)) SWIG_fail;
-      $1 = val;
-    }
+%typemap(in,noblock=1,fragment="SWIG_AsValDepId") DepId (int val, int ecode) {
+  ecode = SWIG_AsValDepId(L, $input, &val);
+  if (!SWIG_IsOK(ecode)) SWIG_fail_arg("$symname", $argnum, "DepId")
+  $1 = val;
 }
 %typemap(typecheck,precedence=%checkcode(INT32),fragment="SWIG_AsValDepId") DepId {
   int res = SWIG_AsValDepId(L, $input, NULL);