stencil expression. Junk define-origin.
* scm/lily.scm (collect-scores-for-book): new function.
* ly/init.ly: print collected scores/musics.
2004-06-20 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ * lily/stencil.cc (interpret_stencil_expression): add grob-cause
+ stencil expression. Junk define-origin.
+
* lily/my-lily-parser.cc (parse_string): init parser variable when
lexer_ is set, ie. in parse_string and parse_file.
mol = Stencil (m->extent_box (), SCM_EOL).smobbed_copy ();
else
{
- SCM origin = ly_symbol2scm ("no-origin");
-
- if (store_locations_global_b)
- {
- SCM cause = get_property ("cause");
- if (Music*m = unsmob_music (cause))
- {
- SCM music_origin = m->get_property ("origin");
- if (unsmob_input (music_origin))
- origin = music_origin;
- }
- }
-
- // ugr.
- mol = Stencil (m->extent_box (),
- scm_list_n (origin, m->expr (), SCM_UNDEFINED)
- ). smobbed_copy ();
+ SCM expr = scm_list_3 (ly_symbol2scm ("grob-cause"), self_scm(), m->expr ());
+ mol = Stencil (m->extent_box (),expr). smobbed_copy ();
}
}
if (!ly_c_pair_p (expr))
return;
- SCM head =ly_car (expr);
- if (unsmob_input (head))
- {
- Input *ip = unsmob_input (head);
- (*func) (func_arg,
- scm_list_4 (ly_symbol2scm ("define-origin"),
- scm_makfrom0str (ip->file_string ()
- .to_str0 ()),
- scm_int2num (ip->line_number ()),
- scm_int2num (ip->column_number ())));
- expr = ly_cadr (expr);
- }
- else if (head == ly_symbol2scm ("no-origin"))
- {
- (*func) (func_arg, scm_list_1 (head));
- expr = ly_cadr (expr);
- }
- else if (head == ly_symbol2scm ("translate-stencil"))
+ SCM head = ly_car (expr);
+
+ if (head == ly_symbol2scm ("translate-stencil"))
{
o += ly_scm2offset (ly_cadr (expr));
expr = ly_caddr (expr);
interpret_stencil_expression (ly_car (x), func, func_arg, o);
return;
}
+ else if (head == ly_symbol2scm ("grob-cause"))
+ {
+ SCM grob = ly_cadr (expr);
+
+ (*func) (func_arg, scm_list_2 (head, grob));
+ interpret_stencil_expression (ly_caddr (expr), func, func_arg, o);
+ (*func) (func_arg, scm_list_1 (ly_symbol2scm ("no-origin")));
+ }
else
{
(*func) (func_arg,
#(ly:set-option 'new-relative)
#(ly:set-point-and-click #f)
#(define toplevel-scores '())
+#(define $globalheader #f)
\maininput
% there is a problem at the end of the input file
(debug-enable 'backtrace)
(read-enable 'positions)))
-(define-public (line-column-location line col file)
+(define-public (line-column-location file line col)
"Print an input location, including column number ."
(string-append (number->string line) ":"
(number->string col) " " file))
-(define-public (line-location line col file)
+(define-public (line-location file line col)
"Print an input location, without column number ."
(string-append (number->string line) " " file))
))
(define-public (collect-music-for-book parser music)
- (collect-scores-for-book parser (score (ly:music-scorify music))))
+ (collect-scores-for-book parser (ly:music-scorify music)))
;;;;;;;;;;;;;;;;
; alist
-(define (define-origin file line col) "")
-
(define (dot x y radius)
(string-append
" "
(string-append "/" key " {" val "} bind def\n")
(string-append "/" key " (" val ") def\n"))))
-(define (no-origin) "")
-
-
(define (placebox x y s)
(string-append
(ly:number->string dx) " "
(ly:number->string dy)
" draw_zigzag_line"))
+
+
+(define (grob-cause grob)
+ "")
draw-line
define-origin
no-origin
+ grob-cause
))
(use-modules (ice-9 regex)
(embedded-ps (list 'draw-line thick fx fy tx ty)))
(define (define-origin file line col)
- (if (procedure? point-and-click)
- (string-append "\\special{src:" ;;; \\string ?
- (point-and-click line col file)
- "}" )
- ""))
+ "")
;; no-origin not yet supported by Xdvi
(define (no-origin) "")
+
+(define (grob-cause grob)
+ (if (procedure? point-and-click)
+
+ (let*
+ ((cause (ly:grob-property grob 'cause))
+ (music-origin (if (ly:music? cause)
+ (ly:music-property cause 'origin)
+ #f))
+ (location (if (ly:input-location? music-origin)
+ (ly:input-location music-origin)
+ #f)))
+
+ (if (pair? location)
+ (string-append "\\special{src:" ;;; \\string ?
+ (apply point-and-click location) "}")
+ ""))
+ ""))