Milos Komarcevic <[EMAIL PROTECTED]> writes:

> 
> Ruurd, thanks a lot for the updated version!
> 
> I do have some problems with it though, maybe someone on the
> list could confirm them and provide some help.
> 
> > Your mention of the inclusion of a newer version of Sed.exe has also
> > addressed another of my questions.
> > 
> > 
> > > FYI, I did include the new sed.exe and fixed the path thing in 
> > > configure.bat.
> 
> - I couldn't see this new sed version in lyx-1.3.5-win32-nc.exe
> It seems to be the old one, identical to the one packaged with
> 1.3.3, so my LaTeX configuration file is still 0 bytes. Is there
> a newer package? Can someone confirm this?
> 


This bug can be overcomed by modifying the configure the script like this:

$ diff -u configure.orig configure
--- configure.orig   2005-01-03 17:40:28.000000000 +0100
+++ configure        2005-01-04 17:11:16.000000000 +0100
@@ -1241,6 +1241,7 @@
 echo "creating doc/LaTeXConfig.lyx"
 echo "s/@chk_linuxdoc@/$chk_linuxdoc/g" >> chkconfig.sed
 echo "s/@chk_docbook@/$chk_docbook/g" >> chkconfig.sed
+dos2iso chkconfig.sed
 sed -f chkconfig.sed ${srcdir}/doc/LaTeXConfig.lyx.in >doc/LaTeXConfig.lyx

 echo "creating $outfile"

and putting dos2iso.exe in the lyx bin directory. I have included the C source
dos2iso.c at the bottom of this email (compile with WIN32 defined).


> - The convertDefault.sh script doesn't work again, it always fails
> when testing for converted file existance. I had to comment those
> lines out in order to get the figures to display in LyX
> 

This is due to a nasty feature of the shell sh.exe included in the package.
If you installed lyx in C:/Programs/lyx, then any path of the form
C:/Programs/lyx/tmp/anything  gets translated to %TEMP%/anything, where
%TEMP% is the windows temporary files location. To test this, try opening a
dos terminal and launching sh.exe, then try "cd C:/Programs/lyx/tmp" and see
where you end up....

I have also Cygwin installed and noticed that if using cygwin pathnames this
does not occur, i.e., "cd /c/Programs/lyx/tmp" works (I mounted /c on C: under
cygwin). For those with Cygwin, this patch works:

$ diff -u convertDefault.sh.orig convertDefault.sh
--- convertDefault.sh.orig      2005-01-03 17:40:30.000000000 +0100
+++ convertDefault.sh   2005-01-05 19:00:14.000000000 +0100
@@ -28,7 +28,13 @@
 # so use everything from the first ':' to the end of the line.
 FILE=`echo "$2" | cut -d ':' -f 2-`

-test -f "$FILE" || {
+# The shell sh.exe distributed with LyX behaves strangely:
+# The references to $INSTDIR/tmp get translated to $TEMP if $INSTDIR is of
+# the type "C:/xyz", but not translated if it is a cygwin path like "/c/xyz".
+# Hence, $FILE would not be found because it is searched in the wrong place!
+CYGFILE=`cygpath $FILE`
+
+test -f "$CYGFILE" || {
        echo "$0 ERROR"
        echo "Unable to find file \"${FILE}\""
        exit 1


This "feature" of sh.exe was also responsible for the failure of the old
script lyxpreview2bitmap.sh, used for instant preview.


> - The display of fonts in math mode with Qt 3.2.1 non-commerical
> is much worse than with 2.3.0, but I guess someone already mentioned
> this. I hope it can be fixed somehow because it's very annoying.
> 

Indeed. For this reason I am still using 1.3.3 with instant preview, as in
1.3.5 the script for the pixmaps generation cannot be launched due to a
"Exec format error" ???

> Regards,
> Milos
> 
> 

Regards,
Enrico

$ cat dos2iso.c
/*
 *  A utility to convert text files from/to MSDOS
 *
 *  If named dos2iso will convert from MSDOS char set to iso8859-1 char set
 *  If named iso2dos will convert from iso8859-1 char set to MSDOS char set
 *
 *  $Revision: 1.2 $
 *
 *  $Log: dos2iso.c,v $
 * Revision 1.2  2004/03/16  23:59:19  enrico
 * If output filename missing, convert in place.
 *
 * Revision 1.1  1996/11/03  22:29:19  enrico
 * Now converts between MSDOS and ISO Latin 1 char sets.
 *
 * Revision 1.0  1996/11/03  19:14:46  enrico
 * Initial revision
 *
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

unsigned char dos2iso[] =
{   0,  1,  2,  3,  4,  5,  6,  7,  8,  9,    /*   0 */
   10, 11, 12, 13, 14, 15, 16, 17, 18, 19,    /*  10 */
   20,167, 22, 23, 24, 25, 26, 27, 28, 29,    /*  20 */
   30, 31, 32, 33, 34, 35, 36, 37, 38, 39,    /*  30 */
   40, 41, 42, 43, 44, 45, 46, 47, 48, 49,    /*  40 */
   50, 51, 52, 53, 54, 55, 56, 57, 58, 59,    /*  50 */
   60, 61, 62, 63, 64, 65, 66, 67, 68, 69,    /*  60 */
   70, 71, 72, 73, 74, 75, 76, 77, 78, 79,    /*  70 */
   80, 81, 82, 83, 84, 85, 86, 87, 88, 89,    /*  80 */
   90, 91, 92, 93, 94, 95, 96, 97, 98, 99,    /*  90 */
  100,101,102,103,104,105,106,107,108,109,    /* 100 */
  110,111,112,113,114,115,116,117,118,119,    /* 110 */
  120,121,122,123,124,125,126,127,199,252,    /* 120 */
  233,226,228,224,229,231,234,235,232,239,    /* 130 */
  238,236,196,197,200,230,198,244,246,242,    /* 140 */
  251,249,255,214,220,162,163,165,223,102,    /* 150 */
  225,237,243,218,241,209,170,186,191,225,    /* 160 */
  172,189,188,161,171,187, 35, 35, 35,124,    /* 170 */
   43, 43, 43, 43, 43, 43,124, 43, 43, 43,    /* 180 */
   43, 43, 43, 43, 43, 43,196, 43, 43, 43,    /* 190 */
   43, 43, 43, 43, 43,173, 43, 43, 43, 43,    /* 200 */
   43, 43, 43, 43,214, 43, 43, 43, 43, 35,    /* 210 */
  220, 35, 35,223, 97,223, 71,182,228,115,    /* 220 */
  181,116, 70,216, 79,240, 56,248,101,110,    /* 230 */
   61,177, 62, 60, 83,228,246, 61,176,183,    /* 240 */
  183, 86,252,178, 35, 32                     /* 250 */
};

unsigned char iso2dos[] =
{   0,  1,  2,  3,  4,  5,  6,  7,  8,  9,    /*   0 */
   10, 11, 12, 13, 14, 15, 16, 17, 18, 19,    /*  10 */
   20, 21, 22, 23, 24, 25, 26, 27, 28, 29,    /*  20 */
   30, 31, 32, 33, 34, 35, 36, 37, 38, 39,    /*  30 */
   40, 41, 42, 43, 44, 45, 46, 47, 48, 49,    /*  40 */
   50, 51, 52, 53, 54, 55, 56, 57, 58, 59,    /*  50 */
   60, 61, 62, 63, 64, 65, 66, 67, 68, 69,    /*  60 */
   70, 71, 72, 73, 74, 75, 76, 77, 78, 79,    /*  70 */
   80, 81, 82, 83, 84, 85, 86, 87, 88, 89,    /*  80 */
   90, 91, 92, 93, 94, 95, 96, 97, 98, 99,    /*  90 */
  100,101,102,103,104,105,106,107,108,109,    /* 100 */
  110,111,112,113,114,115,116,117,118,119,    /* 110 */
  120,121,122,123,124,125,126,127,128,129,    /* 120 */
  130,131,132,133,134,135,136,137,138,139,    /* 130 */
  140,141,142,143,144,145,146,147,148,149,    /* 140 */
  150,151,152,153,154,155,156,157,158,159,    /* 150 */
  160,173,155,156,248,157,124, 21, 34, 99,    /* 160 */
  166,174,170, 45, 82,126,248,241,253, 51,    /* 170 */
   96,230,227,249, 44, 49,167,175,172,171,    /* 180 */
  190,168, 65, 65, 65, 65,142,143,146,128,    /* 190 */
  144,144,144, 73, 73, 73, 73, 73, 68,165,    /* 200 */
   79, 79, 79, 79,153,120,233,163,163,150,    /* 210 */
  154, 89, 98,225,133,160,131,160,132,134,    /* 220 */
  145,135,138,130,136,137,141,161,140,139,    /* 230 */
  235,164,149,162,149,149,148,246,237,151,    /* 240 */
  163,150,129,121, 98,152                     /* 250 */
};

#define MAXLEN 256

FILE *infile;
FILE *outfile;
#ifndef WIN32
char *progname;
#else
char progname[MAXLEN] = { 0 };
#endif
char buf[MAXLEN] = { 0 };

void Fputc(int, FILE *);
void Fputs(char *, FILE *);
void toDOS(void);
void toUnix(void);

int main(int ac, char *av[])
{
    char *s, *outname;
#ifdef WIN32
    for (s = av[0]+strlen(av[0]); s >= av[0] && *s != '\\' && *s != ':'; --s);

    strncpy(progname, ++s, MAXLEN-1);
    if ((s = strstr(progname, ".exe")) != NULL) {
       *s = 0;
    }
#else
    for (s = av[0]+strlen(av[0]); s >= av[0] && *s != '/' && *s != ':'; --s);

    ++s;
    progname = s;
#endif

    if (ac == 2) {
       strncpy(buf, av[1], MAXLEN-5);
       strcat(buf, ".tmp");
       outname = buf;
    } else if (ac == 3) {
       outname = av[2];
    } else {
       fprintf(stderr, "Usage: %s infile [outfile]\n", progname);
       exit(EXIT_FAILURE);
    }

    if (NULL == (infile = fopen(av[1], "rb"))) {
       fprintf(stderr, "%s: can't open input file %s\n", progname, av[1]);
       return EXIT_FAILURE;
    }

    if (NULL == (outfile = fopen(outname, "wb"))) {
       fprintf(stderr, "%s: can't open output file %s\n", progname, outname);
       return EXIT_FAILURE;
    }

    if (strcmp(progname, "dos2iso") == 0)
       toUnix();
    else
       toDOS();

    fclose(infile);
    fclose(outfile);

    if (ac == 2) {
       if (remove(av[1]) != 0) {
          sprintf(buf, "%s: Cannot remove `%s'", progname, av[1]);
          perror(buf);
          return EXIT_FAILURE;
       }
       if (rename(outname, av[1]) != 0) {
          sprintf(buf, "%s: Cannot rename `%s'", progname, av[1]);
          perror(buf);
          return EXIT_FAILURE;
       }
    }

    return EXIT_SUCCESS;
}

void Fputc(int ch, FILE *outfile)
{
    if (EOF == fputc(ch, outfile)) {
        perror(progname);
        exit(EXIT_FAILURE);
    }
}

void Fputs(char *str, FILE *outfile)
{
    if (EOF == fputs(str, outfile)) {
        perror(progname);
        exit(EXIT_FAILURE);
    }
}

void toDOS(void)
{
    int ch, lastch = 0;

    while (EOF != (ch = fgetc(infile))) {
       if ('\n' == ch && '\r' != lastch)
           Fputc('\r', outfile);
       lastch = ch;
    while (EOF != (ch = fgetc(infile))) {
       if ('\n' == ch && '\r' != lastch)
           Fputc('\r', outfile);
       lastch = ch;
       Fputc(iso2dos[ch], outfile);
    }
    if ('\n' != lastch)
       Fputs("\r\n", outfile);
}

void toUnix(void)
{
    int ch, lastch = 0;

    while (EOF != (ch = fgetc(infile)) && '\x1a' != ch) {
       if ('\r' != ch) {
           lastch = ch;
           Fputc(dos2iso[ch], outfile);
       }
    }
    if ('\n' != lastch)
       Fputc('\n', outfile);
}




Reply via email to