LEFT | RIGHT |
1 /* | 1 /* |
2 This file is part of LilyPond, the GNU music typesetter. | 2 This file is part of LilyPond, the GNU music typesetter. |
3 | 3 |
4 Copyright (C) 2000--2012 Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 Copyright (C) 2000--2012 Han-Wen Nienhuys <hanwen@xs4all.nl> |
5 | 5 |
6 LilyPond is free software: you can redistribute it and/or modify | 6 LilyPond is free software: you can redistribute it and/or modify |
7 it under the terms of the GNU General Public License as published by | 7 it under the terms of the GNU General Public License as published by |
8 the Free Software Foundation, either version 3 of the License, or | 8 the Free Software Foundation, either version 3 of the License, or |
9 (at your option) any later version. | 9 (at your option) any later version. |
10 | 10 |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 return get_accepted (SCM_EOL); | 367 return get_accepted (SCM_EOL); |
368 else if (scm_is_eq (ly_symbol2scm ("property-ops"), sym)) | 368 else if (scm_is_eq (ly_symbol2scm ("property-ops"), sym)) |
369 return property_ops_; | 369 return property_ops_; |
370 else if (scm_is_eq (ly_symbol2scm ("context-name"), sym)) | 370 else if (scm_is_eq (ly_symbol2scm ("context-name"), sym)) |
371 return context_name_; | 371 return context_name_; |
372 else if (scm_is_eq (ly_symbol2scm ("group-type"), sym)) | 372 else if (scm_is_eq (ly_symbol2scm ("group-type"), sym)) |
373 return translator_group_type_; | 373 return translator_group_type_; |
374 return SCM_UNDEFINED; | 374 return SCM_UNDEFINED; |
375 } | 375 } |
376 | 376 |
| 377 bool |
| 378 Context_def::is_alias (SCM sym) const |
| 379 { |
| 380 if (scm_is_eq (sym, ly_symbol2scm ("Bottom"))) |
| 381 return !scm_is_pair (get_accepted (SCM_EOL)); |
| 382 |
| 383 if (scm_is_eq (sym, get_context_name ())) |
| 384 return true; |
| 385 |
| 386 return scm_is_true (scm_c_memq (sym, context_aliases_)); |
| 387 } |
| 388 |
377 LY_DEFINE (ly_context_def_lookup, "ly:context-def-lookup", | 389 LY_DEFINE (ly_context_def_lookup, "ly:context-def-lookup", |
378 2, 1, 0, (SCM def, SCM sym, SCM val), | 390 2, 1, 0, (SCM def, SCM sym, SCM val), |
379 "Return the value of @var{sym} in output definition @var{def}" | 391 "Return the value of @var{sym} in output definition @var{def}" |
380 " (e.g., @code{\\paper}). If no value is found, return" | 392 " (e.g., @code{\\paper}). If no value is found, return" |
381 " @var{val} or @code{'()} if @var{val} is undefined.") | 393 " @var{val} or @code{'()} if @var{val} is undefined.") |
382 { | 394 { |
383 LY_ASSERT_SMOB (Context_def, def, 1); | 395 LY_ASSERT_SMOB (Context_def, def, 1); |
384 Context_def *cd = unsmob_context_def (def); | 396 Context_def *cd = unsmob_context_def (def); |
385 LY_ASSERT_TYPE (ly_is_symbol, sym, 2); | 397 LY_ASSERT_TYPE (ly_is_symbol, sym, 2); |
386 | 398 |
(...skipping 20 matching lines...) Expand all Loading... |
407 | 419 |
408 Context_def *cd = unsmob_context_def (def)->clone (); | 420 Context_def *cd = unsmob_context_def (def)->clone (); |
409 | 421 |
410 for (SCM s = unsmob_context_mod (mod)->get_mods (); | 422 for (SCM s = unsmob_context_mod (mod)->get_mods (); |
411 scm_is_pair (s); | 423 scm_is_pair (s); |
412 s = scm_cdr (s)) | 424 s = scm_cdr (s)) |
413 cd->add_context_mod (scm_car (s)); | 425 cd->add_context_mod (scm_car (s)); |
414 | 426 |
415 return cd->unprotect (); | 427 return cd->unprotect (); |
416 } | 428 } |
LEFT | RIGHT |