This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project. See the Cygwin home page for more information.
Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

running GS5.50 : problem solved !


Hello everyone,
First of all many thanks to all the people who
answered me and suggested me some hints.

I recall what is the problem : when 'gs' (nickname
for 'GhostScript') is used to convert a picture in
PostScript format into a picture in BitMap format
(say PCX), then the picture produced is corrupted
if the disk is mounted in 'text!=binary'. The
produced picture is correct if at first
'CYGWIN=binmode' or if 'text=binary'. All in all,
it is a matter of '\n' transformed into '\r\n'
during output.

My first guess was to use the patch I found in
Sergey Okhapkin's site concerning GS5.10's
distribution. The main modification was in the
file 'gp_unifn.c', and concerned input/output
modes :
l29 : const char gp_fmode_binary_suffix[] =
"b";    /* was "" */
l32 : const char gp_fmode_rb[] = "rb";    /* was
"r" */
l33 : const char gp_fmode_wb[] = "wb";    /* was
"w" */

It didn't work. So I posted my problems to this
mailing list asking for advices. Earnie Boyd
suggested me to upgrade the 'cygwin1.dll'. I did
it, but it still didn't work. Then Pierre Humblet
pointed me (among other things) if I was sure I
added "rb" and "wb" where necessary. Well, he was
right. There is one more place where the binary
output mode is needed...

Indeed, outputing any BitMap format is understood
by GhostScript as outputing a file to a printer
(strange but true). So, I looked for the
corresponding function in the sources, and found
it in 'gp_unix.c'. The original code (l.149-158)
is :
    FILE *
    gp_open_printer(char
fname[gp_file_name_sizeof], int binary_mode)
    {
        return
     (strlen(fname) == 0 ?

gp_open_scratch_file(gp_scratch_file_name_prefix,
fname, "w") :
      fname[0] == '|' ?
      popen(fname + 1, "w") :
      fopen(fname, "w"));
    }
I have done the following modification :
    FILE *
    gp_open_printer(char
fname[gp_file_name_sizeof], int binary_mode)
    {
        return
     (strlen(fname) == 0 ?

gp_open_scratch_file(gp_scratch_file_name_prefix,
fname, "wb") :
      fname[0] == '|' ?
      popen(fname + 1, (binary_mode ? "wb" : "w"))
:
      fopen(fname, (binary_mode ? "wb" : "w")));
    }

Please note this time the use of the variable
'binary_mode' in the calls to the open functions.
This time it worked ! Actually, it was not
difficult : the similar files (gp_dvx.c,
gp_ntfs.c, gp_dos.c gp_mswin.c, gp_os2.c, ...) do
all of them the same test :
    (binary_mode ? "wb" : "w")
but not the file 'gp_unix.c'.

Well, I think someone will have to prepare a new
patch for GS5.50 including these features.
Bye,
--
Dr.-Ing. Sami Alex ZAIMI
IAMP - Tohoku University - Sendai (Japan)



--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com