]> git.donarmstrong.com Git - lilypond.git/commitdiff
Merge remote branch 'origin/master' into release/unstable release/2.17.3-1
authorPhil Holmes <mail@philholmes.net>
Sun, 23 Sep 2012 09:47:52 +0000 (10:47 +0100)
committerPhil Holmes <mail@philholmes.net>
Sun, 23 Sep 2012 09:47:52 +0000 (10:47 +0100)
flower/include/guile-compatibility.hh
lily/include/lily-lexer.hh
lily/module-scheme.cc
lily/parser.yy

index 7c249afe893103760a3bdb68445d5fc70506823a..3ef0413772f1dd0c03fee0a7d8f0922310ae00f2 100644 (file)
    Add any compatibility definitions here for Guile V2.n
 */
 #endif // SCM_MAJOR_VERSION == 1
+#if defined (SCM_MAJOR_VERSION) && (SCM_MAJOR_VERSION > 1)
+#define GUILEV2 1
+#endif
+// TODO - remove GUILE1 definition when support for Guile 1 is dropped.
+#if defined (SCM_MAJOR_VERSION) && (SCM_MAJOR_VERSION < 2)
+#define GUILEV1 1
+#define GUILEV2 0
+#endif
 #endif /* GUILE_COMPATIBILITY_HH */
index d27b0d3a50f01484770ca2eb6579b86c9a5afef6..4c5f9268c249b60dd7d1ca97f837ee4ab08a2e3a 100644 (file)
@@ -54,7 +54,7 @@ private:
 public:
   SCM eval_scm_token (SCM sval) { return eval_scm (sval, '#'); }
   SCM extra_tokens_;
-  YYSTYPE *lexval_;
+  SCM *lexval_;
   Input *lexloc_;
   bool is_main_input_;
 
index 4fc43ca32b8c8f846d5373673615ae23a7a9eca8..0da0445c9cd49ae514780795b10d718288d9e386 100644 (file)
@@ -17,8 +17,7 @@
   along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include "ly-module.hh"
-
+#include "ly-module.hh" // pulls in lily-guile.hh and guile-compatibility.hh
 #include "warn.hh"
 #include "main.hh"
 #include "std-string.hh"
@@ -52,14 +51,31 @@ LY_DEFINE (ly_module_copy, "ly:module-copy",
   return SCM_UNSPECIFIED;
 }
 
-/* Lookup SYM, but don't give error when it is not defined.  */
+
+
+/* Lookup SYM, but don't give error when it is not defined.
+   N.B. this is only needed when running with Guile versions
+   prior to V2.0.3, when calls to ly_module_lookup can be replaced
+   with direct calls to the Guile API scm_module_variable in the
+   LilyPond codebase.
+*/
 SCM
 ly_module_lookup (SCM module, SCM sym)
 {
 #define FUNC_NAME __FUNCTION__
   SCM_VALIDATE_MODULE (1, module);
-
+/*
+  Issue 2758:
+    Guile V2 onward has a scm_module_variable API module.
+    Guile V1.8.7 only has a (module-variable) REPL function, however
+    using ly_lily_module_constant ("module-variable") and calling
+    the memoized result is slow.
+ */
+#if GUILEV1
   return scm_sym2var (sym, scm_module_lookup_closure (module), SCM_BOOL_F);
+#else
+  return scm_module_variable (module, sym);
+#endif
 #undef FUNC_NAME
 }
 
index 981cf40bab5a40570601b3a2b517714b5755c88d..079573648e3c93d251e64760706e137d4819dd45 100644 (file)
@@ -27,7 +27,7 @@
  * inconsistent state of indentation.
  */
 
-%code requires {
+%{
 
 #define yyerror Lily_parser::parser_error
 
@@ -49,7 +49,7 @@
                 free (p);                                               \
         } while (0)
 
-}
+%}
 
 %parse-param {Lily_parser *parser}
 %parse-param {SCM *retval}