Hi,

The attached patch ensures that "(use-modules (oop goops))" is only
generated when needed.

However, G-Wrap's runtime relies on GOOPS anyway, so this change
currently has no impact.

Do you think the GOOPS stuff that occurs in `gw_guile_runtime_init ()'
could be somehow deferred?  WCTs, for instance, do not require GOOPS,
unlike what the `if' statement seems to imply.  Perhaps there could be a
`gw_guile_runtime_init_with_goops ()' function that would only be
invoked by modules that need it?

Thanks,
Ludovic.

# Bazaar revision bundle v0.9
#
# message:
#   Don't use GOOPS in generated modules unless they really need it.
#   
#   * guile/g-wrap/guile.scm (generate-wrapset-scm): Only produce "(use-modules (oop goops))"
#     if the module has generics.
#   
# committer: Ludovic Courtes <[EMAIL PROTECTED]>
# date: Wed 2007-08-08 18:16:26.059000015 +0200

=== modified file guile/g-wrap/guile.scm
--- guile/g-wrap/guile.scm
+++ guile/g-wrap/guile.scm
@@ -867,7 +867,6 @@
       ";; Generated by G-Wrap-TNG: an experimental Guile C API-wrapper engine.\n"
       "\n"
       (format #f "(define-module ~S\n" guile-module)
-      (format #f "  #:use-module (oop goops)\n")
       (format #f "  #:use-module (g-wrap config)\n")
       ")\n"
       "\n"
@@ -884,7 +883,8 @@
 ;;      "(module-use! (module-public-interface (current-module)) (current-module))\n"
       )
      port)
-    (let ((gf-hash (make-hash-table 67)))
+    (let ((gf-hash       (make-hash-table 67))
+          (has-generics? #f))
       (fold-functions
        (lambda (func rest)
 	 (let ((gf-name (generic-name func)))
@@ -894,8 +894,17 @@
 		    (not (uses-rti-for-function? wrapset func)))
 	       (let ((handle
 		      (hashq-create-handle! gf-hash gf-name '())))
+                 (set! has-generics? #t)
 		 (set-cdr! handle (cons func (cdr handle)))))))
        #f wrapset)
+
+      (if has-generics?
+          (begin
+            ;; The generated module requires GOOPS.
+            (newline port)
+            (write '(use-modules (oop goops)) port)
+            (newline port)))
+
       (hash-fold
        (lambda (gf funcs rest)
          (for-each

=== modified directory  // last-changed:[EMAIL PROTECTED]
... eqf
# revision id: [EMAIL PROTECTED]
# sha1: adad7522395f871f2ea1739a4f61ece6a1d27bba
# inventory sha1: 4c0192f0e32d5f0a7026572a03523773b7480961
# parent ids:
#   [EMAIL PROTECTED]
# base id: [EMAIL PROTECTED]
# properties:
#   branch-nick: g-wrap

_______________________________________________
g-wrap-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/g-wrap-dev

Reply via email to