r20438 - gnucash/trunk/src/app-utils - [PATCH 4/4] Bug #615168: N_ in the root module

Geert Janssens gjanssens at code.gnucash.org
Mon Mar 21 11:10:12 EDT 2011


Author: gjanssens
Date: 2011-03-21 11:10:12 -0400 (Mon, 21 Mar 2011)
New Revision: 20438
Trac: http://svn.gnucash.org/trac/changeset/20438

Modified:
   gnucash/trunk/src/app-utils/app-utils.scm
   gnucash/trunk/src/app-utils/c-interface.scm
Log:
[PATCH 4/4] Bug #615168: N_ in the root module

* src/app-utils/app-utils.scm:
* src/app-utils/c-interface.scm: Make N_ available to all of Gnucash. A
  hack, but a correct hack that permits the Scheme code to be compiled.

Patch by Andy Wingo.

Modified: gnucash/trunk/src/app-utils/app-utils.scm
===================================================================
--- gnucash/trunk/src/app-utils/app-utils.scm	2011-03-21 15:10:03 UTC (rev 20437)
+++ gnucash/trunk/src/app-utils/app-utils.scm	2011-03-21 15:10:12 UTC (rev 20438)
@@ -273,6 +273,22 @@
 (define gnc:*kvp-option-path* (list KVP-OPTION-PATH))
 (export gnc:*kvp-option-path*)
 
+;; gettext functions
+(define gnc:gettext gnc-gettext-helper)
+(define gnc:_ gnc:gettext)
+(define _ gnc:gettext)
+(define-syntax N_
+  (syntax-rules ()
+    ((_ x) x)))
+
+;; A lot of Gnucash's code uses procedural interfaces to load modules.
+;; This normally works, for procedures -- but for values that need to be
+;; known at expand time, like macros, it doesn't work (in Guile 2.0 at
+;; least). So instead of auditing all the code, since N_ is really the
+;; only Gnucash-defined macro in use, the surgical solution is just to
+;; make N_ available everywhere.
+(module-define! the-root-module 'N_ (module-ref (current-module) 'N_))
+
 (load-from-path "c-interface.scm")
 (load-from-path "config-var.scm")
 (load-from-path "options.scm")

Modified: gnucash/trunk/src/app-utils/c-interface.scm
===================================================================
--- gnucash/trunk/src/app-utils/c-interface.scm	2011-03-21 15:10:03 UTC (rev 20437)
+++ gnucash/trunk/src/app-utils/c-interface.scm	2011-03-21 15:10:12 UTC (rev 20438)
@@ -37,15 +37,6 @@
    (call-with-output-string write-error)))
 
 
-;; gettext functions
-(define gnc:gettext gnc-gettext-helper)
-(define gnc:_ gnc:gettext)
-(define _ gnc:gettext)
-(define-syntax N_
-  (syntax-rules ()
-    ((_ x) x)))
-
-
 ;; This database can be used to store and retrieve translatable
 ;; strings. Strings that are returned by the lookup function are
 ;; translated with gettext.



More information about the gnucash-changes mailing list