Hi,

[EMAIL PROTECTED] (Ludovic Courtès) writes:

> #   Slight C code generation improvements.
> #   
> #   * guile/g-wrap/guile.scm (function-wrapper-cg): Use `static const' storage
> #     for `typespecs'.  Don't use `scm_values ()' when all out parameters are
> #     invisible.

This should have been two patches, especially since the second part in
this patch was broken.  Please apply the attached patch right after the
previous one.

Sorry for the mess!

Thanks,
Ludovic.

# Bazaar revision bundle v0.9
#
# message:
#   Fixed handling of `out' and return values.
#   
#   * guile/g-wrap/guile.scm (function-wrapper-cg): Fixed handling of `out' and return
#     values.  This optimizes the "one out param, no return value" case.
#   
# committer: Ludovic Courtes <[EMAIL PROTECTED]>
# date: Tue 2007-07-03 20:05:53.405999899 +0200

=== modified file guile/g-wrap/guile.scm
--- guile/g-wrap/guile.scm
+++ guile/g-wrap/guile.scm
@@ -485,17 +485,21 @@
       "    gw_handle_wrapper_error(NULL, &gw__error,\n"
       "                             " fn-c-string ",\n"
       "                             gw__arg_pos);\n"
-      (if (null? (filter visible? out-params))
-	  "  return gw__scm_result;\n"
-	  (list
-	   "  return scm_values (scm_list_n ("
-	   (if (needs-result-var? return-type)
-	       "gw__scm_result, "
-	       '())
-	   (map (lambda (n)
-		  (string-append (out-param-name n) ", "))
-		(iota (length out-params)))
-	   "SCM_UNDEFINED));\n"))
+      (cond ((null? out-params)
+             "  return gw__scm_result;\n")
+            ((and (not (needs-result-var? return-type))
+                  (null? (cdr out-params)))
+             (list "  return (" (out-param-name 0) ");\n"))
+            (else
+             (list
+              "  return scm_values (scm_list_n ("
+              (if (needs-result-var? return-type)
+                  "gw__scm_result, "
+                  '())
+              (map (lambda (n)
+                     (string-append (out-param-name n) ", "))
+                   (iota (length out-params)))
+              "SCM_UNDEFINED));\n")))
       "}\n")))
 
 ;; RTI functions override this method

=== modified directory  // last-changed:[EMAIL PROTECTED]
... pel
# revision id: [EMAIL PROTECTED]
# sha1: 76e1aca4ec12fe38ab2b8aa3e5cea8ba6cb71a94
# inventory sha1: 63aef0cbdc45f9af7c821efa55939f26e8485a99
# parent ids:
#   [EMAIL PROTECTED]
# base id: [EMAIL PROTECTED]
# properties:
#   branch-nick: g-wrap

_______________________________________________
g-wrap-dev mailing list
g-wrap-dev@nongnu.org
http://lists.nongnu.org/mailman/listinfo/g-wrap-dev

Reply via email to