lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

preprocessing an included file with system command


From: Michael Ellis
Subject: preprocessing an included file with system command
Date: Sat, 24 Sep 2011 13:30:55 -0400

If I define a music function to apply an arbitrary system command to a
file thusly,

sysinc =
#(define-music-function (p l cmd fname) (string? string?)
   "Run system command, cmd, and redirect output to fname.
    then include fname in input."
    (system (string-concatenate (list cmd " > " fname)))
    #{ \include $fname #})

and use it to preprocess an input file ,

\sysinc "cat junk.txt | sed 's/4/8/g'"  "junk.inc"

it works as expected, BUT, I have to run LilyPond twice for changes in
the original file to show up in the lilypond output.  Is there anyway
around this limitation?

Note: what I'm actually trying to do with the preprocessing, as
opposed to the trivial example above,  is something that cannot be
done easily with a music function.  I know about the --evaluate
command line option but that's also not practical for what I'm trying
to do.

Thanks,
Mike



reply via email to

[Prev in Thread] Current Thread [Next in Thread]