----- Original Message -----
From: Don Simons <[EMAIL PROTECTED]>
To: TeX-Music <[EMAIL PROTECTED]>
Sent: Thursday, June 28, 2001 10:45 PM
Subject: [TeX-music] Re: Compiling PMX under DOS or Win32


> He used the DOS/Win version of GNU FORTRAN g77.  I downloaded and
> installed it, and verified that there is a problem in the MIDI file
> produced.  I've isolated the problem down to one particular byte but I
> don't know how to fix it. On the off chance that there's someone out
> there who might delurk from the shadow world of FORTRAN long enough to
> help me out, I want to pose this to the list.
>
> In writing bytes to the midi file, I ended up using the following syntax
> whenever there was not an ascii character to get the bytes I needed:
>
> write(51,'(a,$)') char(10)
>
> (The "$" suppresses an end-of-record character after the write). I
> arrived at this method after lots of hand-wringing (which I do remember)
> and trying lots of other ways (which I don't remember most of). This
> should write one byte to the binary file, hex "0A".  And it does that
> just fine with the compiler I normally use in DOS/Win, and also with the
> linux version of g77. But when DOS/Win g77 comes to this statement, it
> converts char(10) to the 2-byte sequence "0D 0A" .  This clearly has
> something to do with how it's trying to deal with the difference in
> line-ending conventions between DOS and *nix, but for our purpose it
> screws up everything.
>
> Does anyone know a different way in FORTRAN to write the byte "0A" to
> the midi file?

Well, I don't know enough about Fortran (as a matter of fact, the first
program written in fortran I saw was Don's PMX source...), but looking at
the C libraries that come with the C version (the one made with f2c),
changing the writing format to binary all the time fixes the problem. In
libI77.c you have to change the lines which state:
char *f__w_mode[4] = {"wb", "w", "r+b", "r+"};
with
char *f__w_mode[4] = {"wb", "wb", "rb+", "rb+"};

This has the side-effect that the generated .tex file has inappropriate end
of line characters, but this has no effect on TeX.

I'm sure there is a cleaner way, but for now it works.

Cheers,

    Sebastian



_______________________________________________
TeX-music mailing list
[EMAIL PROTECTED]
http://sunsite.dk/mailman/listinfo/tex-music

Reply via email to