From eab0f50d56e9d2b622a5024bb30c706c92860ef3 Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Wed, 9 Nov 2011 12:53:56 +0100 Subject: [PATCH] Remove all traces of ly:export --- Documentation/extending/scheme-tutorial.itely | 7 +- lily/identifier-smob.cc | 64 ------------------- lily/include/identifier-smob.hh | 30 --------- lily/lexer.ll | 7 -- scm/markup-macros.scm | 5 -- scm/markup.scm | 3 +- scm/safe-lily.scm | 1 - 7 files changed, 7 insertions(+), 110 deletions(-) delete mode 100644 lily/identifier-smob.cc delete mode 100644 lily/include/identifier-smob.hh diff --git a/Documentation/extending/scheme-tutorial.itely b/Documentation/extending/scheme-tutorial.itely index b5db818d65..c9893bc45b 100644 --- a/Documentation/extending/scheme-tutorial.itely +++ b/Documentation/extending/scheme-tutorial.itely @@ -754,7 +754,7 @@ above example, the @code{newLa} definition is executed before The above example shows how to @q{export} music expressions from the input to the Scheme interpreter. The opposite is also possible. By -wrapping a Scheme value in the function @code{ly:export}, a Scheme +placing it after @code{$}, a Scheme value is interpreted as if it were entered in LilyPond syntax. Instead of defining @code{\twice}, the example above could also have been written as @@ -764,6 +764,11 @@ been written as @{ $(make-sequential-music (list newLa)) @} @end example +You can use @code{$} with a Scheme expression anywhere you could use +@code{\@var{name}} after assigning the Scheme expression to a variable +@var{name}. This replacement happens in the @q{Lexer}, so Lilypond is +not even aware of the difference. + Scheme code is evaluated as soon as the parser encounters it. To define some Scheme code in a macro (to be called later), use @ref{Void scheme functions}, or diff --git a/lily/identifier-smob.cc b/lily/identifier-smob.cc deleted file mode 100644 index a9b198f6bc..0000000000 --- a/lily/identifier-smob.cc +++ /dev/null @@ -1,64 +0,0 @@ -/* - This file is part of LilyPond, the GNU music typesetter. - - Copyright (C) 2002--2011 Han-Wen Nienhuys - - LilyPond is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - LilyPond is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with LilyPond. If not, see . -*/ - -#include "identifier-smob.hh" - -scm_t_bits package_tag; - -static int -print_box (SCM b, SCM port, scm_print_state *) -{ - SCM value = SCM_CELL_OBJECT_1 (b); - - scm_puts ("#", port); - - /* Non-zero means success. */ - return 1; -} - -/* This defines the primitve `make-box', which returns a new smob of - type `box', initialized to `#f'. */ -LY_DEFINE (ly_export, "ly:export", - 1, 0, 0, (SCM arg), - "Export a Scheme object to the parser" - " so it is treated as an identifier.") -{ - SCM_RETURN_NEWSMOB (package_tag, arg); -} - -SCM -unpack_identifier (SCM box) -{ - if (SCM_IMP (box) || SCM_CELL_TYPE (box) != package_tag) - return SCM_UNDEFINED; - - return SCM_CELL_OBJECT_1 (box); -} - -static void -init_box_type (void) -{ - package_tag = scm_make_smob_type ("box", 0); - scm_set_smob_mark (package_tag, scm_markcdr); - scm_set_smob_print (package_tag, print_box); -} - -ADD_SCM_INIT_FUNC (package, init_box_type); diff --git a/lily/include/identifier-smob.hh b/lily/include/identifier-smob.hh deleted file mode 100644 index 529e7919f2..0000000000 --- a/lily/include/identifier-smob.hh +++ /dev/null @@ -1,30 +0,0 @@ -/* - This file is part of LilyPond, the GNU music typesetter. - - Copyright (C) 2002--2011 Han-Wen Nienhuys - - LilyPond is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - LilyPond is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with LilyPond. If not, see . -*/ - -#ifndef IDENTIFIER_SMOB_HH -#define IDENTIFIER_SMOB_HH - -#include "lily-guile.hh" - -SCM package_identifier (SCM); -bool identifier_smob_p (SCM); -SCM unpack_identifier (SCM); - -#endif /* IDENTIFIER_SMOB_HH */ - diff --git a/lily/lexer.ll b/lily/lexer.ll index 59284d07c3..3367ef6c02 100644 --- a/lily/lexer.ll +++ b/lily/lexer.ll @@ -47,7 +47,6 @@ using namespace std; #include "context-def.hh" #include "duration.hh" -#include "identifier-smob.hh" #include "international.hh" #include "interval.hh" #include "lily-guile.hh" @@ -369,12 +368,6 @@ BOM_UTF8 \357\273\277 } char_count_stack_.back () += n; - if (unpack_identifier (sval) != SCM_UNDEFINED) - { - yylval.scm = unpack_identifier(sval); - return identifier_type (yylval.scm); - } - for (size_t i = 0; i < pending_string_includes_.size (); i++) new_input ("", pending_string_includes_[i], parser_->sources_); diff --git a/scm/markup-macros.scm b/scm/markup-macros.scm index cccfaccfcb..e33327ccaf 100644 --- a/scm/markup-macros.scm +++ b/scm/markup-macros.scm @@ -344,11 +344,6 @@ against SIGNATURE, reporting MAKE-NAME as the user-invoked function. (use-modules (ice-9 receive)) -(defmacro*-public markup* (#:rest body) - "Same as `markup', for use in a \\notes block." - `(ly:export (markup ,@body))) - - (define (compile-all-markup-expressions expr) "Return a list of canonical markups expressions, e.g.: (#:COMMAND1 arg11 arg12 #:COMMAND2 arg21 arg22 arg23) diff --git a/scm/markup.scm b/scm/markup.scm index 47ebe5d2bc..3204b67fb7 100644 --- a/scm/markup.scm +++ b/scm/markup.scm @@ -32,8 +32,7 @@ Example: (markup \"foo\" #:raise 0.2 #:hbracket #:bold \"bar\" #:override '(baseline-skip . 4) - #:bracket #:column (\"baz\" \"bazr\" \"bla\")) -Use `markup*' in a \\notemode context." + #:bracket #:column (\"baz\" \"bazr\" \"bla\"))" (car (compile-all-markup-expressions `(#:line ,body)))) diff --git a/scm/safe-lily.scm b/scm/safe-lily.scm index 52e4bdeeb7..269e99c270 100644 --- a/scm/safe-lily.scm +++ b/scm/safe-lily.scm @@ -44,7 +44,6 @@ ly:duration