g-wrap-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Use `static const' where possible


From: Ludovic Courtès
Subject: Re: [PATCH] Use `static const' where possible
Date: Tue, 03 Jul 2007 20:22:27 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

Hi,

address@hidden (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 <address@hidden>
# 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:address@hidden
... pel
# revision id: address@hidden
# sha1: 76e1aca4ec12fe38ab2b8aa3e5cea8ba6cb71a94
# inventory sha1: 63aef0cbdc45f9af7c821efa55939f26e8485a99
# parent ids:
#   address@hidden
# base id: address@hidden
# properties:
#   branch-nick: g-wrap


reply via email to

[Prev in Thread] Current Thread [Next in Thread]