2004-07-10 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ * lily/lily-guile.cc (LY_DEFINE): use format on ly:warn arguments.
+
+ * lily/repeat-acknowledge-engraver.cc (process_music): look at
+ main timing, not grace timing. Fixes volta-repeat-grace.
+
+
+ * lily/kpath.cc (LY_DEFINE): ly:kpathsea-expand-path, new function
+ remove ly:kpathsea-gulp-file.
+
* scm/translation-functions.scm (format-metronome-markup): make
note smaller, align to bottom.
return string;
}
-LY_DEFINE (ly_kpathsea_gulp_file, "ly:kpathsea-gulp-file",
+
+
+LY_DEFINE (ly_kpathsea_expand_path, "ly:kpathsea-expand-path",
1, 0, 0, (SCM name),
- "Read the file @var{name}, and return its contents in a string. "
- "The file is looked up using the search path and kpathsea.")
+ "Read the file @var{name}, and return its expanded path, or "
+ "@code{#f} if not found.")
{
SCM_ASSERT_TYPE (ly_c_string_p (name), name, SCM_ARG1, __FUNCTION__, "string");
- return scm_makfrom0str
- (kpathsea_gulp_file_to_string (ly_scm2string (name)).to_str0 ());
+
+ String nm = ly_scm2string (name);
+ String filename = global_path.find (nm);
+ if (filename.is_empty ())
+ {
+ char *p = kpse_find_file (nm.to_str0 (), kpathsea_find_format (nm),
+ true);
+ if (p)
+ return scm_makfrom0str (p);
+ else
+ return SCM_BOOL_F;
+ }
+ return scm_makfrom0str (filename.to_str0 ());
}
+
void
initialize_kpathsea (char *av0)
{
}
LY_DEFINE (ly_warn, "ly:warn",
- 1, 0, 0, (SCM str),
- "Scheme callable function to issue the warning @code{msg}.")
+ 1, 0, 1, (SCM str, SCM rest),
+ "Scheme callable function to issue the warning @code{msg}. "
+ "The message is formatted with @code{format} and @code{rest}.")
{
SCM_ASSERT_TYPE (ly_c_string_p (str), str, SCM_ARG1, __FUNCTION__, "string");
progress_indication ("\n");
+
+ str = scm_simple_format (SCM_BOOL_F, str, rest);
warning ("lily-guile: " + ly_scm2string (str));
- return SCM_BOOL_T;
+ return SCM_UNSPECIFIED;
}
LY_DEFINE (ly_dir_p, "ly:dir?",
class Repeat_acknowledge_engraver : public Engraver
{
public:
+
TRANSLATOR_DECLARATIONS (Repeat_acknowledge_engraver);
-
+protected:
virtual void start_translation_timestep ();
virtual void process_music ();
virtual void initialize ();
/*
At the start of a piece, we don't print any repeat bars.
*/
- if (now_mom () == Moment (0))
+ if (!now_mom ().main_part_)
return ;
SCM cs = get_property ("repeatCommands");
(before-line-breaking-callback . ,Paper_column::before_line_breaking)
(X-extent-callback . ,Axis_group_interface::group_extent_callback)
-;ppp (print-function . ,Paper_column::print) (font-name . "cmr8") (Y-extent-callback . #f)
+; (print-function . ,Paper_column::print) (font-name . "ecrm8") (Y-extent-callback . #f)
(meta . ((interfaces . (paper-column-interface axis-group-interface spaceable-grob-interface item-interface ))))
))
(before-line-breaking-callback . ,Paper_column::before_line_breaking)
(breakable . #t)
;; debugging stuff: print column number.
-; (print-function . ,Paper_column::print) (font-name . "cmr8") (Y-extent-callback . #f)
+; (print-function . ,Paper_column::print) (font-name . "ecrm8") (Y-extent-callback . #f)
(meta . ((interfaces . (paper-column-interface axis-group-interface spaceable-grob-interface item-interface ))))
(define-public (read-encoding-file filename)
"Read .enc file, return (COMMAND-NAME . VECTOR-OF-SYMBOLS)."
- (let* ((raw (ly:kpathsea-gulp-file filename))
+ (let* ((raw (ly:gulp-file (ly:kpathsea-expand-path filename)))
(string (regexp-substitute/global #f "%[^\n]*" raw 'pre "" 'post))
(command (match:substring
(string-match "/([^ \t\n\r]*)[ \t\n\r]+[[]" string) 1))
(font-names (uniq-list (sort (map ly:font-filename fonts) string<?)))
(pfas (map
(lambda (x)
- (ly:kpathsea-gulp-file (string-append x ".pfa")))
+
+ (let*
+ ((aname (string-append x ".pfa"))
+ (apath (ly:kpathsea-expand-path aname))
+
+; (bpath (if (not apath)
+; (ly:kpathsea-expand-path (string-append x ".pfb"))
+; #f)))
+
+ )
+
+ (cond
+ (apath (ly:gulp-file apath))
+
+ ; oops , can't plonk PFB in, must convert to ASCII.
+ ;(bpath (ly:gulp-file bpath))
+ (else
+ (ly:warn "Can't find PFA font ~S" x)
+ ""))))
(filter string? font-names))))
+
(string-join pfas "\n")))
(define (define-fonts bookpaper)
(define (font-load-encoding encoding)
(let ((filename (get-coding-filename encoding)))
- (ly:kpathsea-gulp-file filename)))
+ (ly:gulp-file (ly:kpathsea-expand-path filename))))
(let* ((encoding-list (map (lambda (x)
(assoc-get 'input-name