gnu-music-discuss
[Top][All Lists]
Advanced

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

Re: merging lily .ps files


From: Timothy S. Nelson
Subject: Re: merging lily .ps files
Date: Mon, 21 May 2001 12:59:01 +1000 (EST)

On 19 May 2001, Laura Conrad wrote:

> I just attempted to merge several files created by ly2dvi and dvips
> using psmerge from the psutils package.  It didn't work; gv says:
>
> Error: /dictstackunderflow in --end--
> Operand stack:
>
> Execution stack:
>    %interp_exit   .runexec2   --nostringval--   --nostringval--   
> --nostringval--   2   %stopped_push   --nostringval--   2   3   %oparray_pop  
>  --nostringval--   --nostringval--   false   1   %stopped_push   1   3   
> %oparray_pop   1   3   %oparray_pop   .runexec2   --nostringval--   
> --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   
> --nostringval--   --nostringval--
> Dictionary stack:
>    --dict:915/941(G)--   --dict:0/20(G)--   --dict:193/2
>
> Does anyone know enough postscript to explain why this is happening?
>
> The psmerge man page says:
>
>        Psmerge merges PostScript documents into  a  single  docuĀ­
>        ment.  It  only  works  in the specific case the the files
>        were created using the same  application,  with  the  same
>        device  setup  and  resources  (fonts, procsets, patterns,
>        files, etc) loaded.
>
> I would have expected this to be true of these postscript files.
>
> Alternatively, has anyone worked out another automated procedure for
> concatenating lilypond output?

        Well, there's this think called lilypond-book, see... :).  I think you
could set something up where you set Lilypond-book up, and then, instead of
doing \begin{lilypond} \include foo.ly \end{lilypond}, you do \input temp.tex,
and then generate temp.tex with something like:

-----------------------
#!/usr/bin/perl

$directory = "/some/directory";
opendir(DIR, $directory);
@files = grep { s/^/$directory\//; /\.ly$/ } readdir(DIR);
closedir(DIR);

open(TEMPFILE, ">/another/directory/temp.tex");
foreach $file (@files) {
        open(LYFILE, $file);
        # Lame parsing procedure which assumes among other things that title
        # contains no quotes, and that all {} in the header section match.
        foreach(<LYFILE>) {
                if(/\\header\s+\{/i) {
                        $parcount++;
                }
                if($parcount > 0) {
                        # These below are based on the part after the && being
                        # evaluated only if the first part is true.
                        # ie. a switch or case statement.
                        /title\s+\=\s+\"(.*?)\"/i && do {
                                $title = $1
                        };
                        /\{/ && do { $parcount++; };
                        /\}/ && do { $parcount--; };
                        ($parcount < 1) && do {
                                $last;
                        };
                }
        }

        print TEMPFILE <<EOL;
{\bigfont{$title}}
\begin{lilypond}
\include $file.ly
\end{lilypond}

EOL
}
close(FILE);
-----------------------
        (untested, but you get the idea, I hope).

        Anyway, if you do that, you can use your LY files with ly2dvi, or
mudela-book, whichever tickles your fancy.

        :)


---------------------------------------------------------------------
| Name: Tim Nelson                 | Because the Creator is,        |
| E-mail: address@hidden | I am                           |
---------------------------------------------------------------------

----BEGIN GEEK CODE BLOCK----
Version 3.1
GCS d? s: a-- C++>++++$ US+ P++ L++ E- W+++ N+ w+> M-- V- Y+>++ 
PGP->++ R(+) !tv B++ DI++++ D+ G e>++ h!/* y-
-----END GEEK CODE BLOCK-----





reply via email to

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