Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 198238 | Differences between
and this patch

Collapse All | Expand All

(-)tetex-src-3.0/texk/dviljk/ChangeLog (-4 / +43 lines)
Lines 1-3 Link Here
1
2007-07-02  Joachim Schrod  <jschrod@acm.org>
2
3
	* dvi2xx.c (DoSpecial): Security issue: usage of tmpnam() caused
4
	tempfile race condition. I use mkdtemp() if it's available and
5
	fall back to tmpnam.
6
7
	Special parsing of include files was inconsistent, unify it. The
8
	current parsing code still allows lots of non-sensical special
9
	commands, but at least it doesn't access unrelated variables any
10
	more.
11
12
2007-06-28  Joachim Schrod  <jschrod@acm.org>
13
14
	* dvi2xx.c: Fixed a whole bunch of buffer overflows: The program
15
	did not check memory bounds for any string operation. All places
16
	where strings are copied with strcpy are replaced by dynamically
17
	allocated strings (with xstrdup from kpathsea) or bounded string
18
	operations. Fixed also manual string copy operations on special
19
	strings. Fixed array buffer overflow in defpoint and fill special
20
	operations.
21
	(DoSpecial): Call of ghostscript for psfile special had also a
22
	potential buffer overflow caused by unchecked usage of sprintf.
23
	Fix core dump: Check if all required parameters of psfile special
24
	are passed.
25
26
	Bumped version number up to 2.6p3.
27
28
	* dvi2xx.h: Some fixed sized string arrays are pointers now, they
29
	get dynamically allocated.
30
	(GetBytes): Another buffer overflow: Check that the buffer size is
31
	sufficient to store the read bytes. That relies on the invariant
32
	that the GetBytes macro is always called with an array as argument
33
	and not with a pointer.
34
35
	* config.h: Throw an error if kpathsea is not used. dvi2xx.c
36
	had previously already kpathsea dependencies without protecting
37
	them with #if KPATHSEA. We go that road further since upstream
38
	does not exist any more.
39
1
Tue Mar  3 10:17:03 1998  Sebastian Rahtz  <s.rahtz@elsevier.co.uk>
40
Tue Mar  3 10:17:03 1998  Sebastian Rahtz  <s.rahtz@elsevier.co.uk>
2
41
3
	* config.h: Markus Gyger <mgyger@osf1.gmu.edu> fix of config
42
	* config.h: Markus Gyger <mgyger@osf1.gmu.edu> fix of config
Lines 12-18 Tue Jan 27 14:32:25 1998 Sebastian Raht Link Here
12
	Olaf Weber
51
	Olaf Weber
13
Sat Jan 17 15:09:59 1998  Sebastian Rahtz  <s.rahtz@elsevier.co.uk>
52
Sat Jan 17 15:09:59 1998  Sebastian Rahtz  <s.rahtz@elsevier.co.uk>
14
53
15
	* assorted patches from Peter Breitenlohner, Olaf Weber, 
54
	* assorted patches from Peter Breitenlohner, Olaf Weber,
16
 	Eli Zaretskii, Fabrice Popineau etc. Hope it all still works.
55
 	Eli Zaretskii, Fabrice Popineau etc. Hope it all still works.
17
56
18
57
Lines 49-55 Sun Jan 5 16:12:06 1997 Karl Berry <k Link Here
49
Mon Dec  9 00:53:30 1996  Ulrik Vieth  <vieth@thphy.uni-duesseldorf.de>
88
Mon Dec  9 00:53:30 1996  Ulrik Vieth  <vieth@thphy.uni-duesseldorf.de>
50
89
51
	* dvihp: Use `basename $0` in usage and version messages for
90
	* dvihp: Use `basename $0` in usage and version messages for
52
 	consistency with other programs and scripts.  
91
 	consistency with other programs and scripts.
53
	Also accept -help, -version in addition to --help, --version.
92
	Also accept -help, -version in addition to --help, --version.
54
93
55
Sat Dec  7 17:15:54 1996  Karl Berry  <karl@cs.umb.edu>
94
Sat Dec  7 17:15:54 1996  Karl Berry  <karl@cs.umb.edu>
Lines 213-219 Sat Dec 31 17:30:58 1994 Karl Berry <k Link Here
213
Fri Dec 30 15:25:54 1994  Karl Berry  <karl@cs.umb.edu>
252
Fri Dec 30 15:25:54 1994  Karl Berry  <karl@cs.umb.edu>
214
253
215
        * Makefile.in (install-exec): Don't depend on default, so dvilj4
254
        * Makefile.in (install-exec): Don't depend on default, so dvilj4
216
        doesn't get made if the user didn't want it. 
255
        doesn't get made if the user didn't want it.
217
        (install-data): mkdirchain on texinputdir and fontdir.
256
        (install-data): mkdirchain on texinputdir and fontdir.
218
        From Joachim.
257
        From Joachim.
219
258
Lines 320-326 Fri Jul 29 13:26:49 1994 Karl Berry (k Link Here
320
        * config.h (RESOLUTION, MFMODE) [LJ4L]: Set to 300/cx for this new
359
        * config.h (RESOLUTION, MFMODE) [LJ4L]: Set to 300/cx for this new
321
        symbol.
360
        symbol.
322
361
323
        * dvi2xx.c (DecodeArgs): Always scale pgsiz_dots. 
362
        * dvi2xx.c (DecodeArgs): Always scale pgsiz_dots.
324
        (main) [LJ4]: Don't hardwire 600dpi.
363
        (main) [LJ4]: Don't hardwire 600dpi.
325
        These fixes from ajp@eng.cam.ac.uk.
364
        These fixes from ajp@eng.cam.ac.uk.
326
365
(-)tetex-src-3.0/texk/dviljk/configure.in (+2 lines)
Lines 14-18 dnl These tests prevent reliable cross-c Link Here
14
AC_C_CHAR_UNSIGNED
14
AC_C_CHAR_UNSIGNED
15
AC_CHECK_SIZEOF(long)
15
AC_CHECK_SIZEOF(long)
16
16
17
AC_CHECK_FUNCS(rmdir unlink mkdtemp)
18
17
KPSE_CONFIG_FILES([Makefile])
19
KPSE_CONFIG_FILES([Makefile])
18
AC_OUTPUT
20
AC_OUTPUT
(-)tetex-src-3.0/texk/dviljk/dvi2xx.c (-420 / +469 lines)
Lines 1-5 Link Here
1
/* $Id: dvi2xx.c,v 2.5 1997/12/08 20:52:20 neumann Exp $ */
1
/* $Id: dvi2xx.c,v 2.5 1997/12/08 20:52:20 neumann Exp $ */
2
#define VERSION "2.6p2 (dviljk)"
2
#define VERSION "dviljk (version 2.6p3)"
3
/*
3
/*
4
#define DEBUGGS 1
4
#define DEBUGGS 1
5
*/
5
*/
Lines 165-171 char *argv[]; Link Here
165
# endif
165
# endif
166
#endif
166
#endif
167
167
168
  /* Initialize pixel_files */   
168
  /* Initialize pixel_files */
169
  for (i = 0; i <= MAXOPEN; i++)
169
  for (i = 0; i <= MAXOPEN; i++)
170
    pixel_files[i].pixel_file_id = FPNULL;
170
    pixel_files[i].pixel_file_id = FPNULL;
171
171
Lines 173-179 char *argv[]; Link Here
173
  y_origin = YDEFAULTOFF; /* y-origin in dots                    */
173
  y_origin = YDEFAULTOFF; /* y-origin in dots                    */
174
174
175
  setbuf(ERR_STREAM, NULL);
175
  setbuf(ERR_STREAM, NULL);
176
  (void) strcpy(G_progname, argv[0]);
176
  G_progname = argv[0];
177
#ifdef KPATHSEA
177
#ifdef KPATHSEA
178
  kpse_set_progname(argv[0]);
178
  kpse_set_progname(argv[0]);
179
  kpse_set_program_enabled (kpse_pk_format, MAKE_TEX_PK_BY_DEFAULT, kpse_src_compile);
179
  kpse_set_program_enabled (kpse_pk_format, MAKE_TEX_PK_BY_DEFAULT, kpse_src_compile);
Lines 275-281 char *argv[]; Link Here
275
  EMIT1("@PJL SET PAGEPROTECT=OFF\012");
275
  EMIT1("@PJL SET PAGEPROTECT=OFF\012");
276
  EMIT1("@PJL ENTER LANGUAGE=PCL\012");
276
  EMIT1("@PJL ENTER LANGUAGE=PCL\012");
277
  if (econoMode && LJ6)
277
  if (econoMode && LJ6)
278
      EMIT1("@PJL SET ECONOMODE=ON\012");  
278
      EMIT1("@PJL SET ECONOMODE=ON\012");
279
  EMIT3("\033&u%dD\033*t%dR",RESOLUTION,RESOLUTION);
279
  EMIT3("\033&u%dD\033*t%dR",RESOLUTION,RESOLUTION);
280
  if (econoMode && !LJ6)
280
  if (econoMode && !LJ6)
281
    EMIT1("\033*v1T");
281
    EMIT1("\033*v1T");
Lines 431-438 char *argv[]; Link Here
431
          /*
431
          /*
432
            fprintf(ERR_STREAM,"FirstPart\n count %d, mod %d, pp %d\n",(int)count[0],(int)count[0]%2,PageParity);
432
            fprintf(ERR_STREAM,"FirstPart\n count %d, mod %d, pp %d\n",(int)count[0],(int)count[0]%2,PageParity);
433
            */
433
            */
434
          SkipMode = 
434
          SkipMode =
435
            (bool)(PageParity != (short)((count[0]<0 ? 
435
            (bool)(PageParity != (short)((count[0]<0 ?
436
                                          labs(count[0])+1 : count[0])%2));
436
                                          labs(count[0])+1 : count[0])%2));
437
          if (count[0] == 0) SkipMode = (bool)!SkipMode;
437
          if (count[0] == 0) SkipMode = (bool)!SkipMode;
438
        }
438
        }
Lines 641-647 char *argv[]; Link Here
641
   is not buffered. */
641
   is not buffered. */
642
642
643
/* read a buffered byte */
643
/* read a buffered byte */
644
char 
644
char
645
#if NeedFunctionPrototypes
645
#if NeedFunctionPrototypes
646
b_read(FILEPTR spfp)
646
b_read(FILEPTR spfp)
647
#else
647
#else
Lines 661-667 FILEPTR spfp; Link Here
661
}
661
}
662
662
663
#ifdef RISC_BUFFER
663
#ifdef RISC_BUFFER
664
void 
664
void
665
#if NeedFunctionPrototypes
665
#if NeedFunctionPrototypes
666
b_write(FILEPTR spfp, char c) /* write a buffered byte */
666
b_write(FILEPTR spfp, char c) /* write a buffered byte */
667
#else
667
#else
Lines 677-683 char c; Link Here
677
  buffout[boact++] = c;
677
  buffout[boact++] = c;
678
}
678
}
679
679
680
void 
680
void
681
#if NeedFunctionPrototypes
681
#if NeedFunctionPrototypes
682
b_wrtmult(FILEPTR spfp, char *buf, int len) /* write a sequence of bytes to the output buffer */
682
b_wrtmult(FILEPTR spfp, char *buf, int len) /* write a sequence of bytes to the output buffer */
683
#else
683
#else
Lines 693-714 int len; Link Here
693
    write_multi(buffout,1,boact,spfp);
693
    write_multi(buffout,1,boact,spfp);
694
    /* Copy only small blocks; large ones are written directly */
694
    /* Copy only small blocks; large ones are written directly */
695
    if (len < (BUFFSIZE/4)) {
695
    if (len < (BUFFSIZE/4)) {
696
      for (i = 0; i<len; i++) 
696
      for (i = 0; i<len; i++)
697
        buffout[i] = buf[i];
697
        buffout[i] = buf[i];
698
      boact = len;
698
      boact = len;
699
    } else {
699
    } else {
700
      write_multi(buf,1,len,spfp); 
700
      write_multi(buf,1,len,spfp);
701
      boact = 0;
701
      boact = 0;
702
    }
702
    }
703
  }
703
  }
704
  else {
704
  else {
705
    for (i = 0; i<len; i++) 
705
    for (i = 0; i<len; i++)
706
      buffout[boact++] = buf[i];
706
      buffout[boact++] = buf[i];
707
  }
707
  }
708
}
708
}
709
709
710
/* flush the output buffer */
710
/* flush the output buffer */
711
void 
711
void
712
#if NeedFunctionPrototypes
712
#if NeedFunctionPrototypes
713
b_oflush(FILEPTR spfp)
713
b_oflush(FILEPTR spfp)
714
#else
714
#else
Lines 762-770 char *str; Link Here
762
/***************************** CopyHPFile ******************************/
762
/***************************** CopyHPFile ******************************/
763
/*********************************************************************/
763
/*********************************************************************/
764
#if NeedFunctionPrototypes
764
#if NeedFunctionPrototypes
765
int getnum(FILEPTR spfp, char *t, char *numstr) 
765
int getnum(FILEPTR spfp, char *t, char *numstr)
766
#else
766
#else
767
int getnum(spfp, t, numstr) 
767
int getnum(spfp, t, numstr)
768
FILEPTR spfp;
768
FILEPTR spfp;
769
char *t, *numstr;
769
char *t, *numstr;
770
#endif
770
#endif
Lines 777-806 char *t, *numstr; Link Here
777
}
777
}
778
778
779
#if NeedFunctionPrototypes
779
#if NeedFunctionPrototypes
780
void setOffset(char dir, char sign, int pos) 
780
void setOffset(char dir, char sign, int pos)
781
#else
781
#else
782
void setOffset(dir, sign, pos, first) 
782
void setOffset(dir, sign, pos, first)
783
char dir, sign;
783
char dir, sign;
784
int pos;
784
int pos;
785
#endif
785
#endif
786
{
786
{
787
  if ((sign == '+' || sign == '-') && pos > 0 ) {
787
  if ((sign == '+' || sign == '-') && pos > 0 ) {
788
    EMIT4("\033*p%c%d%c",sign,pos,dir);
788
    EMIT4("\033*p%c%d%c",sign,pos,dir);
789
#ifdef DEBUGGS   
789
#ifdef DEBUGGS
790
    fprintf(stderr, "relative: *p%c%d%c\n", sign, pos, dir);
790
    fprintf(stderr, "relative: *p%c%d%c\n", sign, pos, dir);
791
#endif
791
#endif
792
  } else if (pos>0) {
792
  } else if (pos>0) {
793
    EMIT3("\033*p%d%c",pos,dir);
793
    EMIT3("\033*p%d%c",pos,dir);
794
#ifdef DEBUGGS   
794
#ifdef DEBUGGS
795
    fprintf(stderr, "absolute: *p%d%c\n", pos, dir);
795
    fprintf(stderr, "absolute: *p%d%c\n", pos, dir);
796
#endif
796
#endif
797
    if (dir == 'X') 
797
    if (dir == 'X')
798
      last_rx = pos;
798
      last_rx = pos;
799
    else 
799
    else
800
      last_ry = pos;
800
      last_ry = pos;
801
  } else {
801
  } else {
802
    /*EMIT3("\033*p%d%c",pos,dir);*/
802
    /*EMIT3("\033*p%d%c",pos,dir);*/
803
#ifdef DEBUGGS   
803
#ifdef DEBUGGS
804
    fprintf(stderr, "Relative: *p%d%c\n", pos, dir);
804
    fprintf(stderr, "Relative: *p%d%c\n", pos, dir);
805
#endif
805
#endif
806
  }
806
  }
Lines 832-838 char *str; Link Here
832
     unwanted commands from the input file and outputs the rest */
832
     unwanted commands from the input file and outputs the rest */
833
833
834
  /* reset the input buffer */
834
  /* reset the input buffer */
835
  binumber = 0; 
835
  binumber = 0;
836
  biact = 0;
836
  biact = 0;
837
837
838
  qfprintf(ERR_STREAM," [%s", str);
838
  qfprintf(ERR_STREAM," [%s", str);
Lines 853-868 char *str; Link Here
853
          /* of the commands (x first, y first) */
853
          /* of the commands (x first, y first) */
854
854
855
          if (t=='Y' || t=='y') {
855
          if (t=='Y' || t=='y') {
856
            if (numstr[0]!='+' && numstr[0]!='-' && num<miny) 
856
            if (numstr[0]!='+' && numstr[0]!='-' && num<miny)
857
              miny = num;
857
              miny = num;
858
            if (t=='y') {
858
            if (t=='y') {
859
              num = getnum(spfp, &t, numstr);
859
              num = getnum(spfp, &t, numstr);
860
              if (numstr[0]!='+' && numstr[0]!='-' && num<minx) 
860
              if (numstr[0]!='+' && numstr[0]!='-' && num<minx)
861
                minx = num;
861
                minx = num;
862
            }
862
            }
863
          }
863
          }
864
          if (t=='X' || t=='x') {
864
          if (t=='X' || t=='x') {
865
            if (numstr[0]!='+' && numstr[0]!='-' && num<minx) 
865
            if (numstr[0]!='+' && numstr[0]!='-' && num<minx)
866
              minx = num;
866
              minx = num;
867
867
868
            if (t=='x') {
868
            if (t=='x') {
Lines 920-935 char *str; Link Here
920
  }
920
  }
921
  qfprintf(ERR_STREAM," [%s", str);
921
  qfprintf(ERR_STREAM," [%s", str);
922
  /* reset input buffer again */
922
  /* reset input buffer again */
923
  binumber = 0; 
923
  binumber = 0;
924
  biact = 0;
924
  biact = 0;
925
925
926
926
927
  /* Pass through the input file again but this time output the */
927
  /* Pass through the input file again but this time output the */
928
  /* retained PCL commands */
928
  /* retained PCL commands */
929
#ifdef DEBUGGS   
929
#ifdef DEBUGGS
930
  fprintf(stderr,"\nminx=%d, miny=%d, xg=%d, yg=%d\n", 
930
  fprintf(stderr,"\nminx=%d, miny=%d, xg=%d, yg=%d\n",
931
          minx, miny, x_goffset, y_goffset);
931
          minx, miny, x_goffset, y_goffset);
932
#endif  
932
#endif
933
  do {
933
  do {
934
    t = (char)b_read(spfp);
934
    t = (char)b_read(spfp);
935
    if (t==0x1B) {
935
    if (t==0x1B) {
Lines 948-954 char *str; Link Here
948
            } else {
948
            } else {
949
              setOffset('Y',numstr[0], num);
949
              setOffset('Y',numstr[0], num);
950
            }
950
            }
951
            
951
952
            if (t == 'y') {
952
            if (t == 'y') {
953
              num = getnum(spfp, &t,numstr);
953
              num = getnum(spfp, &t,numstr);
954
              if (numstr[0]!='+' && numstr[0]!='-') {
954
              if (numstr[0]!='+' && numstr[0]!='-') {
Lines 960-975 char *str; Link Here
960
              }
960
              }
961
            }
961
            }
962
          }
962
          }
963
            
963
964
          if (t=='X' || t=='x') {
964
          if (t=='X' || t=='x') {
965
            if (numstr[0]!='+' && numstr[0]!='-') {
965
            if (numstr[0]!='+' && numstr[0]!='-') {
966
              /*Add in the correct horizontal offset*/
966
              /*Add in the correct horizontal offset*/
967
              setOffset('X',numstr[0],
967
              setOffset('X',numstr[0],
968
                        num - minx + (int)PIXROUND(h,hconv) + x_goffset);
968
                        num - minx + (int)PIXROUND(h,hconv) + x_goffset);
969
            } else { 
969
            } else {
970
              setOffset('X',numstr[0], num);
970
              setOffset('X',numstr[0], num);
971
            }
971
            }
972
            
972
973
            if (t=='x') {
973
            if (t=='x') {
974
              num = getnum(spfp, &t,numstr);
974
              num = getnum(spfp, &t,numstr);
975
              if (numstr[0]!='+' && numstr[0]!='-') {
975
              if (numstr[0]!='+' && numstr[0]!='-') {
Lines 1027-1033 char *str; Link Here
1027
        case(0x63):
1027
        case(0x63):
1028
          /* Rectangular draw commands */
1028
          /* Rectangular draw commands */
1029
          EMIT1("\033*c");
1029
          EMIT1("\033*c");
1030
          for (t = (char)b_read(spfp); t<0x40 || t>0x60; 
1030
          for (t = (char)b_read(spfp); t<0x40 || t>0x60;
1031
               t = (char)b_read(spfp))
1031
               t = (char)b_read(spfp))
1032
            EMITC(t);
1032
            EMITC(t);
1033
          EMITC(t);
1033
          EMITC(t);
Lines 1110-1116 register int n; /* number of byt Link Here
1110
  long4 x = 0;      /* number being constructed */
1110
  long4 x = 0;      /* number being constructed */
1111
  unsigned char h;
1111
  unsigned char h;
1112
  while (n--) {
1112
  while (n--) {
1113
    x <<= 8; 
1113
    x <<= 8;
1114
    read_byte(fp,h);
1114
    read_byte(fp,h);
1115
    x |= h;
1115
    x |= h;
1116
  }
1116
  }
Lines 1143-1149 register int n; /* number of bytes Link Here
1143
#ifdef SIGN_DEBUG
1143
#ifdef SIGN_DEBUG
1144
  long4    x0;      /* copy of x  */
1144
  long4    x0;      /* copy of x  */
1145
#endif
1145
#endif
1146
  read_byte(fp,h); 
1146
  read_byte(fp,h);
1147
  x = h; /* get first (high-order) byte */
1147
  x = h; /* get first (high-order) byte */
1148
  n1 = n--;
1148
  n1 = n--;
1149
  while (n--) {
1149
  while (n--) {
Lines 1296-1302 FILEPTR f; Link Here
1296
                                        /* ---> result in DX       */
1296
                                        /* ---> result in DX       */
1297
1297
1298
  if (  (regs.h.dl & 0x80)              /* file handle points to a device */
1298
  if (  (regs.h.dl & 0x80)              /* file handle points to a device */
1299
        && !(regs.h.dl & 0x07) ) {      /* neither console i/o or null    */ 
1299
        && !(regs.h.dl & 0x07) ) {      /* neither console i/o or null    */
1300
1300
1301
    regs.h.dl  |= 0x20;                 /* set BINARY bit in device info  */
1301
    regs.h.dl  |= 0x20;                 /* set BINARY bit in device info  */
1302
    regs.h.ah = (unsigned char) 0x44;   /* IOCTL                  */
1302
    regs.h.ah = (unsigned char) 0x44;   /* IOCTL                  */
Lines 1501-1520 printf("Emit character %c(%d) id=%d, yof Link Here
1501
    /* For COMPRESSED CHARS */
1501
    /* For COMPRESSED CHARS */
1502
    if (PrevSize < nbpl) {
1502
    if (PrevSize < nbpl) {
1503
      PrevSize = nbpl;
1503
      PrevSize = nbpl;
1504
      if (PrevLine != NULL) 
1504
      if (PrevLine != NULL)
1505
        free(PrevLine);
1505
        free(PrevLine);
1506
      if ((PrevLine = (unsigned char*)malloc(PrevSize*sizeof(char))) 
1506
      if ((PrevLine = (unsigned char*)malloc(PrevSize*sizeof(char)))
1507
          == NULL) {
1507
          == NULL) {
1508
        PrevSize = 0; 
1508
        PrevSize = 0;
1509
        Fatal("EmitChar: Out of memory error!\n");
1509
        Fatal("EmitChar: Out of memory error!\n");
1510
      }
1510
      }
1511
    }
1511
    }
1512
    /* Clear seed line */
1512
    /* Clear seed line */
1513
    for (i = 0; i<nbpl; i++) 
1513
    for (i = 0; i<nbpl; i++)
1514
      PrevLine[i] = 0;
1514
      PrevLine[i] = 0;
1515
    CChar_Off = 0; 
1515
    CChar_Off = 0;
1516
    CChar_Last = -1;
1516
    CChar_Last = -1;
1517
    
1517
1518
    /* This bit copied from below... */
1518
    /* This bit copied from below... */
1519
#  ifdef USEPXL
1519
#  ifdef USEPXL
1520
    if (fontptr->id == pk89)
1520
    if (fontptr->id == pk89)
Lines 1530-1540 printf("Emit character %c(%d) id=%d, yof Link Here
1530
        CompressedCharLine(ce,nbpl,sl);
1530
        CompressedCharLine(ce,nbpl,sl);
1531
      }
1531
      }
1532
#  else
1532
#  else
1533
    for (i = num_rows; i > 0; i--) 
1533
    for (i = num_rows; i > 0; i--)
1534
      CompressedCharLine(ce,nbpl,(bits + (i-1)*nbpl));
1534
      CompressedCharLine(ce,nbpl,(bits + (i-1)*nbpl));
1535
#  endif /* USEPXL */
1535
#  endif /* USEPXL */
1536
  }
1536
  }
1537
  else 
1537
  else
1538
    CChar_Off = -1;
1538
    CChar_Off = -1;
1539
# endif /* LJ4 */
1539
# endif /* LJ4 */
1540
1540
Lines 1544-1553 printf("Emit character %c(%d) id=%d, yof Link Here
1544
# ifdef LJ4
1544
# ifdef LJ4
1545
  /* printf("raw: %d (%d * %d), comp: %d\n",
1545
  /* printf("raw: %d (%d * %d), comp: %d\n",
1546
     total,ce->width,ce->height,CChar_Off); */
1546
     total,ce->width,ce->height,CChar_Off); */
1547
  /* Characters that don't compress well are usually rather small so 
1547
  /* Characters that don't compress well are usually rather small so
1548
     reading them again and writing them uncompressed won't take 
1548
     reading them again and writing them uncompressed won't take
1549
     much time anyway. */
1549
     much time anyway. */
1550
  if (CChar_Off > total) 
1550
  if (CChar_Off > total)
1551
    CChar_Off = -1;
1551
    CChar_Off = -1;
1552
  if (CChar_Off >= 0) {
1552
  if (CChar_Off >= 0) {
1553
    EMIT4("\033*c%sd%dE\033(s%ldW", cnv_buffer,
1553
    EMIT4("\033*c%sd%dE\033(s%ldW", cnv_buffer,
Lines 1606-1612 printf("Emit character %c(%d) id=%d, yof Link Here
1606
      }
1606
      }
1607
#endif
1607
#endif
1608
    }
1608
    }
1609
    
1609
1610
#ifdef IBM3812
1610
#ifdef IBM3812
1611
#ifdef USEPXL
1611
#ifdef USEPXL
1612
  used_fontstorage += (long4)ce->height * ((ce->width + 15) >> 4) * 2 + 14;
1612
  used_fontstorage += (long4)ce->height * ((ce->width + 15) >> 4) * 2 + 14;
Lines 1652-1658 unsigned char *pkloc; Link Here
1652
int     repeatcount;
1652
int     repeatcount;
1653
1653
1654
void             /* <Read and translate raster description@>*/
1654
void             /* <Read and translate raster description@>*/
1655
#if NeedFunctionPrototypes 
1655
#if NeedFunctionPrototypes
1656
PkRaster(struct char_entry *ce, int raster)
1656
PkRaster(struct char_entry *ce, int raster)
1657
#else
1657
#else
1658
PkRaster(ce, raster)
1658
PkRaster(ce, raster)
Lines 1735-1741 int raster; Link Here
1735
      if (wordweight < 31) {
1735
      if (wordweight < 31) {
1736
#ifdef COMMENT
1736
#ifdef COMMENT
1737
# ifdef DRAWGLYPH
1737
# ifdef DRAWGLYPH
1738
        { 
1738
        {
1739
          int k;
1739
          int k;
1740
          for (k = 15; k>=0; k--) {
1740
          for (k = 15; k>=0; k--) {
1741
            if ((power[k] & word)!=0) printf("Z");
1741
            if ((power[k] & word)!=0) printf("Z");
Lines 1749-1755 int raster; Link Here
1749
        for (j = 3; j >= (wordwidth * 4 - (long4)nbpl); j--) {
1749
        for (j = 3; j >= (wordwidth * 4 - (long4)nbpl); j--) {
1750
          OUTCHAR(((word >> (j << 3)) & 0xff));
1750
          OUTCHAR(((word >> (j << 3)) & 0xff));
1751
#ifdef DRAWGLYPH
1751
#ifdef DRAWGLYPH
1752
          { 
1752
          {
1753
            int k;
1753
            int k;
1754
            for (k = 7; k>=0; k--) {
1754
            for (k = 7; k>=0; k--) {
1755
              if ((power[k] & ((word >> (j << 3)) & 0xff))!=0) printf("M");
1755
              if ((power[k] & ((word >> (j << 3)) & 0xff))!=0) printf("M");
Lines 1760-1768 int raster; Link Here
1760
        }
1760
        }
1761
1761
1762
      }
1762
      }
1763
        
1763
1764
      switch (raster) {
1764
      switch (raster) {
1765
      case 1: 
1765
      case 1:
1766
        RasterLine(ce, nbpl, current_line, raster_line_buf);
1766
        RasterLine(ce, nbpl, current_line, raster_line_buf);
1767
        current_line++;
1767
        current_line++;
1768
        break;
1768
        break;
Lines 1826-1832 int raster; Link Here
1826
            OUTCHAR((tl       & 0xFF));
1826
            OUTCHAR((tl       & 0xFF));
1827
1827
1828
#ifdef DRAWGLYPH
1828
#ifdef DRAWGLYPH
1829
            { 
1829
            {
1830
              int k;
1830
              int k;
1831
              for (k = 31; k>=0; k--) {
1831
              for (k = 31; k>=0; k--) {
1832
                if ((power[k] & row[ii])!=0) printf("M");
1832
                if ((power[k] & row[ii])!=0) printf("M");
Lines 1839-1845 int raster; Link Here
1839
          for (j = 3; j >= (wordwidth *4 - (long4)nbpl); j--) {
1839
          for (j = 3; j >= (wordwidth *4 - (long4)nbpl); j--) {
1840
            OUTCHAR(((tl >> (j << 3)) & 0xff));
1840
            OUTCHAR(((tl >> (j << 3)) & 0xff));
1841
#ifdef DRAWGLYPH
1841
#ifdef DRAWGLYPH
1842
            { 
1842
            {
1843
              int k;
1843
              int k;
1844
              for (k = 7; k>=0; k--) {
1844
              for (k = 7; k>=0; k--) {
1845
                if ((power[k] & ((tl >> (j << 3)) & 0xff))!=0) printf("M");
1845
                if ((power[k] & ((tl >> (j << 3)) & 0xff))!=0) printf("M");
Lines 1850-1856 int raster; Link Here
1850
          }
1850
          }
1851
1851
1852
          switch (raster) {
1852
          switch (raster) {
1853
          case 1: 
1853
          case 1:
1854
            RasterLine(ce, (unsigned int)nbpl, current_line, raster_line_buf);
1854
            RasterLine(ce, (unsigned int)nbpl, current_line, raster_line_buf);
1855
            current_line++;
1855
            current_line++;
1856
            break;
1856
            break;
Lines 1969-1975 int n; Link Here
1969
1969
1970
#ifdef LJ4
1970
#ifdef LJ4
1971
/* Compress a raster line in compression mode 2 */
1971
/* Compress a raster line in compression mode 2 */
1972
int 
1972
int
1973
#if NeedFunctionPrototypes
1973
#if NeedFunctionPrototypes
1974
CompressLine2(unsigned char *buffer, unsigned char *buffout, int emitbytes)
1974
CompressLine2(unsigned char *buffer, unsigned char *buffout, int emitbytes)
1975
#else
1975
#else
Lines 1984-1996 int emitbytes; Link Here
1984
  char last,c;
1984
  char last,c;
1985
1985
1986
  /* trap empty lines (otherwise problems with Packbits) */
1986
  /* trap empty lines (otherwise problems with Packbits) */
1987
  if (emitbytes == 0) 
1987
  if (emitbytes == 0)
1988
    return(0);
1988
    return(0);
1989
  /* Use Packbits compression (mode 2) on raster line */
1989
  /* Use Packbits compression (mode 2) on raster line */
1990
  pos = buffer; 
1990
  pos = buffer;
1991
  litpos = buffer; 
1991
  litpos = buffer;
1992
  pack = 1; 
1992
  pack = 1;
1993
  ppos = buffout; 
1993
  ppos = buffout;
1994
  last = *pos++;
1994
  last = *pos++;
1995
  upper = buffer + emitbytes;
1995
  upper = buffer + emitbytes;
1996
  while (pos < upper) {
1996
  while (pos < upper) {
Lines 2000-2013 int emitbytes; Link Here
2000
      /* At least three equal bytes ==> write out preceding literal sequence */
2000
      /* At least three equal bytes ==> write out preceding literal sequence */
2001
      if ((pack == 3) && ((lit = (int)(pos - litpos - 3)) != 0)) {
2001
      if ((pack == 3) && ((lit = (int)(pos - litpos - 3)) != 0)) {
2002
        while (lit >= 128) {
2002
        while (lit >= 128) {
2003
          *ppos++ = 127; 
2003
          *ppos++ = 127;
2004
          for (i = 1; i<=128; i++) 
2004
          for (i = 1; i<=128; i++)
2005
            *ppos++ = *litpos++;
2005
            *ppos++ = *litpos++;
2006
          lit -= 128;
2006
          lit -= 128;
2007
        }
2007
        }
2008
        if (lit != 0) {
2008
        if (lit != 0) {
2009
          *ppos++ = lit-1; 
2009
          *ppos++ = lit-1;
2010
          while ((lit--) > 0) 
2010
          while ((lit--) > 0)
2011
            *ppos++ = *litpos++;
2011
            *ppos++ = *litpos++;
2012
          /* litpos is now pos-3 (i.e. first of the sequence) */
2012
          /* litpos is now pos-3 (i.e. first of the sequence) */
2013
        }
2013
        }
Lines 2015-2033 int emitbytes; Link Here
2015
    }
2015
    }
2016
    else {
2016
    else {
2017
      while (pack >= 128) {
2017
      while (pack >= 128) {
2018
        *ppos++ = 129; 
2018
        *ppos++ = 129;
2019
        *ppos++ = last; 
2019
        *ppos++ = last;
2020
        litpos += 128; 
2020
        litpos += 128;
2021
        pack -= 128;
2021
        pack -= 128;
2022
      }
2022
      }
2023
      /* At least 3 equal bytes or 2 that don't break a literal sequence
2023
      /* At least 3 equal bytes or 2 that don't break a literal sequence
2024
         ==> write out packed sequence */
2024
         ==> write out packed sequence */
2025
      if ((pack >= 3) || ((pack == 2) && (litpos == pos-3))) {
2025
      if ((pack >= 3) || ((pack == 2) && (litpos == pos-3))) {
2026
        *ppos++ = 257 - pack; 
2026
        *ppos++ = 257 - pack;
2027
        *ppos++ = last; 
2027
        *ppos++ = last;
2028
        litpos += pack;
2028
        litpos += pack;
2029
      }
2029
      }
2030
      pack = 1; 
2030
      pack = 1;
2031
      last = c;
2031
      last = c;
2032
    }
2032
    }
2033
    if (ppos > (buffout + BUFFSIZE/2 - 129)) {
2033
    if (ppos > (buffout + BUFFSIZE/2 - 129)) {
Lines 2036-2063 int emitbytes; Link Here
2036
      return(0);
2036
      return(0);
2037
    }
2037
    }
2038
  }
2038
  }
2039
  
2039
2040
  while (pack >= 128) {
2040
  while (pack >= 128) {
2041
    *ppos++ = 129; 
2041
    *ppos++ = 129;
2042
    *ppos++ = last; 
2042
    *ppos++ = last;
2043
    litpos += 128; 
2043
    litpos += 128;
2044
    pack -= 128;
2044
    pack -= 128;
2045
  }
2045
  }
2046
  if ((pack >= 3) || ((pack == 2) && (litpos == pos-3))) {
2046
  if ((pack >= 3) || ((pack == 2) && (litpos == pos-3))) {
2047
    *ppos++ = 257 - pack; 
2047
    *ppos++ = 257 - pack;
2048
    *ppos++ = last; 
2048
    *ppos++ = last;
2049
    litpos += pack;
2049
    litpos += pack;
2050
  }
2050
  }
2051
  else if ((lit = (int)(pos - litpos)) != 0) {
2051
  else if ((lit = (int)(pos - litpos)) != 0) {
2052
    while (lit >= 128) {
2052
    while (lit >= 128) {
2053
      *ppos++ = 127; 
2053
      *ppos++ = 127;
2054
      for (i = 1; i<=128; i++) 
2054
      for (i = 1; i<=128; i++)
2055
        *ppos++ = *litpos++;
2055
        *ppos++ = *litpos++;
2056
      lit -= 128;
2056
      lit -= 128;
2057
    }
2057
    }
2058
    if (lit != 0) {
2058
    if (lit != 0) {
2059
      *ppos++ = lit-1; 
2059
      *ppos++ = lit-1;
2060
      while ((lit--) > 0) 
2060
      while ((lit--) > 0)
2061
        *ppos++ = *litpos++;
2061
        *ppos++ = *litpos++;
2062
    }
2062
    }
2063
  }
2063
  }
Lines 2079-2102 int emitbytes; Link Here
2079
  int lit,i,pack;
2079
  int lit,i,pack;
2080
2080
2081
  /* Use compression mode 3 */
2081
  /* Use compression mode 3 */
2082
  pos = buffer; 
2082
  pos = buffer;
2083
  ppos = buffout; 
2083
  ppos = buffout;
2084
  upper = buffer + emitbytes; 
2084
  upper = buffer + emitbytes;
2085
  prev = PrevLine;
2085
  prev = PrevLine;
2086
  while(pos < upper) {
2086
  while(pos < upper) {
2087
    litpos = pos;
2087
    litpos = pos;
2088
    while ((*prev == *pos) && (pos < upper)) {
2088
    while ((*prev == *pos) && (pos < upper)) {
2089
      prev++; 
2089
      prev++;
2090
      pos++;
2090
      pos++;
2091
    }
2091
    }
2092
    if (pos < upper) {
2092
    if (pos < upper) {
2093
      pack = (int)(pos - litpos); 
2093
      pack = (int)(pos - litpos);
2094
      litpos = pos;
2094
      litpos = pos;
2095
      i = upper - pos; 
2095
      i = upper - pos;
2096
      if (i > 8) 
2096
      if (i > 8)
2097
        i = 8;
2097
        i = 8;
2098
      while ((*pos != *prev) && (i > 0)) {
2098
      while ((*pos != *prev) && (i > 0)) {
2099
        *prev++ = *pos++; 
2099
        *prev++ = *pos++;
2100
        i--;
2100
        i--;
2101
      }
2101
      }
2102
      i = (int)(pos - litpos - 1);
2102
      i = (int)(pos - litpos - 1);
Lines 2105-2120 int emitbytes; Link Here
2105
        *ppos++ = lit + pack;
2105
        *ppos++ = lit + pack;
2106
      }
2106
      }
2107
      else {
2107
      else {
2108
        *ppos++ = lit + 31; 
2108
        *ppos++ = lit + 31;
2109
        pack -= 31;
2109
        pack -= 31;
2110
        while (pack >= 255) {
2110
        while (pack >= 255) {
2111
          *ppos++ = 255; 
2111
          *ppos++ = 255;
2112
          pack -= 255;
2112
          pack -= 255;
2113
        }
2113
        }
2114
        *ppos++ = pack;
2114
        *ppos++ = pack;
2115
      }
2115
      }
2116
      while (i >= 0) {
2116
      while (i >= 0) {
2117
        *ppos++ = *litpos++; 
2117
        *ppos++ = *litpos++;
2118
        i--;
2118
        i--;
2119
      }
2119
      }
2120
    }
2120
    }
Lines 2134-2140 int emitbytes; Link Here
2134
/**********************************************************************/
2134
/**********************************************************************/
2135
void
2135
void
2136
#if NeedFunctionPrototypes
2136
#if NeedFunctionPrototypes
2137
RasterLine(struct char_entry *ce, unsigned int nbpl, 
2137
RasterLine(struct char_entry *ce, unsigned int nbpl,
2138
           unsigned int current_line, unsigned char *buffer)
2138
           unsigned int current_line, unsigned char *buffer)
2139
#else
2139
#else
2140
RasterLine(ce, nbpl, current_line, buffer)
2140
RasterLine(ce, nbpl, current_line, buffer)
Lines 2208-2228 char *buffer; Link Here
2208
    EMIT2("\033*b%dW", emitbytes);
2208
    EMIT2("\033*b%dW", emitbytes);
2209
    EMITL(emitbytes, buffer);
2209
    EMITL(emitbytes, buffer);
2210
    break;
2210
    break;
2211
 
2211
2212
  case 2:
2212
  case 2:
2213
    i = CompressLine2(buffer,buffin,emitbytes);
2213
    i = CompressLine2(buffer,buffin,emitbytes);
2214
    EMIT2("\033*b%dW", i);
2214
    EMIT2("\033*b%dW", i);
2215
    EMITL(i,buffin);
2215
    EMITL(i,buffin);
2216
    break;
2216
    break;
2217
 
2217
2218
  case 3:
2218
  case 3:
2219
    i = CompressLine3(buffer,buffin + BUFFSIZE/2,(int)nbpl);
2219
    i = CompressLine3(buffer,buffin + BUFFSIZE/2,(int)nbpl);
2220
    EMIT2("\033*b%dW", i);
2220
    EMIT2("\033*b%dW", i);
2221
    EMITL(i,buffin + BUFFSIZE/2);
2221
    EMITL(i,buffin + BUFFSIZE/2);
2222
    break;
2222
    break;
2223
 
2223
2224
  default: 
2224
  default:
2225
    fprintf(ERR_STREAM,"Unsupported compression mode!\n"); 
2225
    fprintf(ERR_STREAM,"Unsupported compression mode!\n");
2226
  }
2226
  }
2227
# else
2227
# else
2228
  EMIT2("\033*b%dW", emitbytes);
2228
  EMIT2("\033*b%dW", emitbytes);
Lines 2280-2289 struct char_entry *ce; Link Here
2280
  if (CompressCharMode == 3) {
2280
  if (CompressCharMode == 3) {
2281
    /* Check if PrevLine big enough; claim more space if not */
2281
    /* Check if PrevLine big enough; claim more space if not */
2282
    if (((int)nbpl) > PrevSize) {
2282
    if (((int)nbpl) > PrevSize) {
2283
      if (PrevLine != NULL) 
2283
      if (PrevLine != NULL)
2284
        free(PrevLine);
2284
        free(PrevLine);
2285
      if ((PrevLine = (unsigned char *)malloc(nbpl*sizeof(char))) == NULL) {
2285
      if ((PrevLine = (unsigned char *)malloc(nbpl*sizeof(char))) == NULL) {
2286
        PrevSize = 0; 
2286
        PrevSize = 0;
2287
        Fatal("RasterChar: out of memory!\n");
2287
        Fatal("RasterChar: out of memory!\n");
2288
      }
2288
      }
2289
      PrevSize = (int)nbpl;
2289
      PrevSize = (int)nbpl;
Lines 2419-2425 register struct char_entry *ptr; Link Here
2419
  if (bytes > 0) {
2419
  if (bytes > 0) {
2420
    /* do NOT load Huge characters */
2420
    /* do NOT load Huge characters */
2421
    if ((bytes > HUGE_CHAR_PATTERN) && (fontptr->id != pk89)) {
2421
    if ((bytes > HUGE_CHAR_PATTERN) && (fontptr->id != pk89)) {
2422
      qfprintf(ERR_STREAM,"Huge Character <%c> (%ld Bytes)\n", 
2422
      qfprintf(ERR_STREAM,"Huge Character <%c> (%ld Bytes)\n",
2423
               (char)c, bytes);
2423
               (char)c, bytes);
2424
      ptr->charsize = HUGE_SIZE;
2424
      ptr->charsize = HUGE_SIZE;
2425
      ptr->where.isloaded = _FALSE;
2425
      ptr->where.isloaded = _FALSE;
Lines 2505-2511 bool do_posn,in_string; Link Here
2505
    SetPosn(h, v);
2505
    SetPosn(h, v);
2506
  }
2506
  }
2507
2507
2508
  /*  
2508
  /*
2509
    fprintf(ERR_STREAM,
2509
    fprintf(ERR_STREAM,
2510
            "(%d) hh=%ld (+%ld/+%ld), h=%ld, xh=%ld,xhh=%ld, [%ld|%ld] ->%d\n",
2510
            "(%d) hh=%ld (+%ld/+%ld), h=%ld, xh=%ld,xhh=%ld, [%ld|%ld] ->%d\n",
2511
            (int)do_posn,hh,(long4)ptr->cw,(long4)ptr->cw*(long4)hconv,h,
2511
            (int)do_posn,hh,(long4)ptr->cw,(long4)ptr->cw*(long4)hconv,h,
Lines 2553-2559 bool do_posn,in_string; Link Here
2553
      int     tmp;
2553
      int     tmp;
2554
      char    sign;
2554
      char    sign;
2555
2555
2556
      if (!do_posn) 
2556
      if (!do_posn)
2557
        SetPosn(h, v);
2557
        SetPosn(h, v);
2558
2558
2559
#ifdef USEPXL
2559
#ifdef USEPXL
Lines 2563-2569 bool do_posn,in_string; Link Here
2563
#endif
2563
#endif
2564
      if (tmp != 0) {
2564
      if (tmp != 0) {
2565
        if (tmp < 0) {
2565
        if (tmp < 0) {
2566
          sign = '-'; 
2566
          sign = '-';
2567
          tmp = -tmp;
2567
          tmp = -tmp;
2568
        } else
2568
        } else
2569
          sign = '+';
2569
          sign = '+';
Lines 2576-2582 bool do_posn,in_string; Link Here
2576
#endif
2576
#endif
2577
      if (tmp != 0) {
2577
      if (tmp != 0) {
2578
        if (tmp < 0) {
2578
        if (tmp < 0) {
2579
          sign = '-'; 
2579
          sign = '-';
2580
          tmp = -tmp;
2580
          tmp = -tmp;
2581
        } else
2581
        } else
2582
          sign = '+';
2582
          sign = '+';
Lines 2644-2650 bool do_posn,in_string; Link Here
2644
    fprintf(stderr,"--> hh(%ld) += cw(%ld) * hconv(%ld)",
2644
    fprintf(stderr,"--> hh(%ld) += cw(%ld) * hconv(%ld)",
2645
            (long)hh, (long)ptr->cw, (long) hconv);
2645
            (long)hh, (long)ptr->cw, (long) hconv);
2646
            */
2646
            */
2647
#ifdef LJ    
2647
#ifdef LJ
2648
    /* the guessed position must be a multiple of pixels */
2648
    /* the guessed position must be a multiple of pixels */
2649
    if (RESOLUTION == 300)
2649
    if (RESOLUTION == 300)
2650
      hh += (long4) ((ptr->cw)/4)*4*hconv;
2650
      hh += (long4) ((ptr->cw)/4)*4*hconv;
Lines 2661-2667 bool do_posn,in_string; Link Here
2661
  if (command <= SET4)
2661
  if (command <= SET4)
2662
    h += ptr->tfmw;
2662
    h += ptr->tfmw;
2663
2663
2664
  if (pos_after) 
2664
  if (pos_after)
2665
    SetPosn(h, v);
2665
    SetPosn(h, v);
2666
  else
2666
  else
2667
    last_rx = (int)PIXROUND(h, hconv) + x_goffset;
2667
    last_rx = (int)PIXROUND(h, hconv) + x_goffset;
Lines 2682-2688 void DoBop() Link Here
2682
  }
2682
  }
2683
  fonts_used_on_this_page = 0;
2683
  fonts_used_on_this_page = 0;
2684
#endif
2684
#endif
2685
  for (p = hfontptr; p; p = p->next) 
2685
  for (p = hfontptr; p; p = p->next)
2686
    p->used_on_this_page = _FALSE;
2686
    p->used_on_this_page = _FALSE;
2687
}
2687
}
2688
2688
Lines 2740-2746 long4 x, y; Link Here
2740
  rx = (int)PIXROUND(x, hconv) + x_goffset;
2740
  rx = (int)PIXROUND(x, hconv) + x_goffset;
2741
  ry = (int)PIXROUND(y, vconv) + y_goffset;
2741
  ry = (int)PIXROUND(y, vconv) + y_goffset;
2742
2742
2743
  /*  
2743
  /*
2744
  fprintf(ERR_STREAM,
2744
  fprintf(ERR_STREAM,
2745
	  "setposn to %ld/%ld, %d/%d, last: %d/%d\n",
2745
	  "setposn to %ld/%ld, %d/%d, last: %d/%d\n",
2746
	  (long)x,(long)y,
2746
	  (long)x,(long)y,
Lines 2804-2816 long4 x, y; Link Here
2804
   offset in the buffer, CChar_Last is the first byte of the last
2804
   offset in the buffer, CChar_Last is the first byte of the last
2805
   compacted row (line repeat count).  Updates the previous line
2805
   compacted row (line repeat count).  Updates the previous line
2806
   (PrevLine) if necessary. */
2806
   (PrevLine) if necessary. */
2807
void 
2807
void
2808
#if NeedFunctionPrototypes
2808
#if NeedFunctionPrototypes
2809
CompressedCharLine(struct char_entry *ce, int nbpl, unsigned char *buffer)
2809
CompressedCharLine(struct char_entry *ce, int nbpl, unsigned char *buffer)
2810
#else
2810
#else
2811
CompressedCharLine(ce, nbpl, buffer)
2811
CompressedCharLine(ce, nbpl, buffer)
2812
struct char_entry *ce;
2812
struct char_entry *ce;
2813
int nbpl; 
2813
int nbpl;
2814
unsigned char *buffer;
2814
unsigned char *buffer;
2815
#endif
2815
#endif
2816
{
2816
{
Lines 2821-2851 unsigned char *buffer; Link Here
2821
    int t,mode,max;
2821
    int t,mode,max;
2822
    register int x,y,i;
2822
    register int x,y,i;
2823
2823
2824
    prev = PrevLine; 
2824
    prev = PrevLine;
2825
    obuf = buffer; 
2825
    obuf = buffer;
2826
    end = buffer + nbpl; 
2826
    end = buffer + nbpl;
2827
    x = 0;
2827
    x = 0;
2828
    while (obuf < end) {
2828
    while (obuf < end) {
2829
      if (*obuf != *prev) {
2829
      if (*obuf != *prev) {
2830
        *prev = *obuf; 
2830
        *prev = *obuf;
2831
        x = 1;
2831
        x = 1;
2832
      }
2832
      }
2833
      obuf++; 
2833
      obuf++;
2834
      prev++;
2834
      prev++;
2835
    }
2835
    }
2836
    if (x == 0 && CChar_Last >= 0) {
2836
    if (x == 0 && CChar_Last >= 0) {
2837
      (buffin[CChar_Last])++; 
2837
      (buffin[CChar_Last])++;
2838
      return; /* line repeat count +1 */
2838
      return; /* line repeat count +1 */
2839
    }
2839
    }
2840
2840
2841
    end = buffin + BUFFSIZE - 16; 
2841
    end = buffin + BUFFSIZE - 16;
2842
    obuf = buffin + CChar_Off; 
2842
    obuf = buffin + CChar_Off;
2843
    buff = buffer;
2843
    buff = buffer;
2844
    *obuf++ = 0; /* Line repeat count = 0 */
2844
    *obuf++ = 0; /* Line repeat count = 0 */
2845
    t = 0;
2845
    t = 0;
2846
    CChar_Last = CChar_Off; /* Next line */
2846
    CChar_Last = CChar_Off; /* Next line */
2847
    mode = 0; 
2847
    mode = 0;
2848
    y = *buff++; 
2848
    y = *buff++;
2849
    i = 7; /* i = current bit */
2849
    i = 7; /* i = current bit */
2850
    while ((t < ce->width) && (obuf < end)) {
2850
    while ((t < ce->width) && (obuf < end)) {
2851
      max = ce->width - t; /* maximum pixels left to do */
2851
      max = ce->width - t; /* maximum pixels left to do */
Lines 2853-2865 unsigned char *buffer; Link Here
2853
      if (mode == 0) {
2853
      if (mode == 0) {
2854
        /* white run */
2854
        /* white run */
2855
        while ((y & (1<<i)) == 0 && x < max) {
2855
        while ((y & (1<<i)) == 0 && x < max) {
2856
          x++; 
2856
          x++;
2857
          i--; 
2857
          i--;
2858
          if (i < 0) {
2858
          if (i < 0) {
2859
            i = 7; 
2859
            i = 7;
2860
            y = *buff++; 
2860
            y = *buff++;
2861
            while (y == 0 && x < max) {
2861
            while (y == 0 && x < max) {
2862
              x += 8; 
2862
              x += 8;
2863
              y = *buff++;
2863
              y = *buff++;
2864
            }
2864
            }
2865
          }
2865
          }
Lines 2869-2894 unsigned char *buffer; Link Here
2869
      else {
2869
      else {
2870
        /* black run */
2870
        /* black run */
2871
        while ((y & (1<<i)) != 0 && x < max) {
2871
        while ((y & (1<<i)) != 0 && x < max) {
2872
          x++; 
2872
          x++;
2873
          i--; 
2873
          i--;
2874
          if (i < 0) {
2874
          if (i < 0) {
2875
            i = 7; 
2875
            i = 7;
2876
            y = *buff++; 
2876
            y = *buff++;
2877
            while (y == 0xff && x < max) {
2877
            while (y == 0xff && x < max) {
2878
              x += 8; 
2878
              x += 8;
2879
              y = *buff++;
2879
              y = *buff++;
2880
            }
2880
            }
2881
          }
2881
          }
2882
        }
2882
        }
2883
        mode = 0;
2883
        mode = 0;
2884
      }
2884
      }
2885
      if (x > max) 
2885
      if (x > max)
2886
        x = max;
2886
        x = max;
2887
      t += x;
2887
      t += x;
2888
      /* make precautions for very long runs */
2888
      /* make precautions for very long runs */
2889
      while (x > 0xff) {
2889
      while (x > 0xff) {
2890
        *obuf++ = 0xff; 
2890
        *obuf++ = 0xff;
2891
        *obuf++ = 0; 
2891
        *obuf++ = 0;
2892
        x -= 0xff;
2892
        x -= 0xff;
2893
      }
2893
      }
2894
      *obuf++ = x;
2894
      *obuf++ = x;
Lines 2968-2975 char *argv[]; Link Here
2968
#endif
2968
#endif
2969
{
2969
{
2970
  int     argind;            /* argument index for flags      */
2970
  int     argind;            /* argument index for flags      */
2971
  char    curarea[STRSIZE];  /* current file area             */
2971
  char    *curarea;	     /* current file area             */
2972
  char    curname[STRSIZE];  /* current file name             */
2972
  char    *curname;   	     /* current file name             */
2973
  char    *tcp, *tcp1;       /* temporary character pointers  */
2973
  char    *tcp, *tcp1;       /* temporary character pointers  */
2974
  char    *this_arg;
2974
  char    *this_arg;
2975
  double  x_offset = 0.0, y_offset = 0.0;
2975
  double  x_offset = 0.0, y_offset = 0.0;
Lines 2988-2996 char *argv[]; Link Here
2988
#endif
2988
#endif
2989
#endif
2989
#endif
2990
2990
2991
  if (argc == 2 && (strcmp (argv[1], "--version") == 0)) {
2991
  if (argc == 2 && EQ(argv[1], "--version")) {
2992
    extern KPSEDLL char *kpathsea_version_string;
2992
    extern KPSEDLL char *kpathsea_version_string;
2993
    puts ("dvilj(k) 2.6");
2993
    puts (VERSION);
2994
    puts (kpathsea_version_string);
2994
    puts (kpathsea_version_string);
2995
    puts ("Copyright (C) 1997 Gustaf Neumann.\n\
2995
    puts ("Copyright (C) 1997 Gustaf Neumann.\n\
2996
There is NO warranty.  You may redistribute this software\n\
2996
There is NO warranty.  You may redistribute this software\n\
Lines 2998-3004 under the terms of the GNU General Publi Link Here
2998
For more information about these matters, see the files\n\
2998
For more information about these matters, see the files\n\
2999
named COPYING and dvi2xx.c.\n\
2999
named COPYING and dvi2xx.c.\n\
3000
Primary author of Dvi2xx: Gustaf Neumann; -k maintainer: K. Berry.");
3000
Primary author of Dvi2xx: Gustaf Neumann; -k maintainer: K. Berry.");
3001
    exit (0); 
3001
    exit (0);
3002
  }
3002
  }
3003
3003
3004
#ifdef LJ4
3004
#ifdef LJ4
Lines 3048-3056 Primary author of Dvi2xx: Gustaf Neumann Link Here
3048
#ifdef LJ2P
3048
#ifdef LJ2P
3049
      case 'd':       /* d selects DUPLEX mode  */
3049
      case 'd':       /* d selects DUPLEX mode  */
3050
        tcp++;
3050
        tcp++;
3051
        if (*tcp == '1' ) 
3051
        if (*tcp == '1' )
3052
          DuplexMode = 1;
3052
          DuplexMode = 1;
3053
        else if (*tcp == '2') 
3053
        else if (*tcp == '2')
3054
          DuplexMode = 2;
3054
          DuplexMode = 2;
3055
        else {
3055
        else {
3056
          Warning("Invalid DUPLEX mode, assuming DUPLEX=1, Long-Edge Binding");
3056
          Warning("Invalid DUPLEX mode, assuming DUPLEX=1, Long-Edge Binding");
Lines 3062-3074 Primary author of Dvi2xx: Gustaf Neumann Link Here
3062
        DoublePage = _TRUE;
3062
        DoublePage = _TRUE;
3063
        tcp++;
3063
        tcp++;
3064
        if (*tcp == '1' || *tcp == '2') {
3064
        if (*tcp == '1' || *tcp == '2') {
3065
          if (*tcp == '2') 
3065
          if (*tcp == '2')
3066
            PrintFirstPart = _FALSE;
3066
            PrintFirstPart = _FALSE;
3067
          else             
3067
          else
3068
            PrintSecondPart = _FALSE;
3068
            PrintSecondPart = _FALSE;
3069
          tcp++;
3069
          tcp++;
3070
        }
3070
        }
3071
        if (*tcp == '-') 
3071
        if (*tcp == '-')
3072
          PrintEmptyPages = _FALSE;
3072
          PrintEmptyPages = _FALSE;
3073
        break;
3073
        break;
3074
#ifdef LJ4
3074
#ifdef LJ4
Lines 3256-3269 Primary author of Dvi2xx: Gustaf Neumann Link Here
3256
#ifdef LJ
3256
#ifdef LJ
3257
      case 'V':   /* bugfixes for various vendor's PCL emulations */
3257
      case 'V':   /* bugfixes for various vendor's PCL emulations */
3258
        tcp++;
3258
        tcp++;
3259
        if (*tcp == 'K' || *tcp == 'k') 
3259
        if (*tcp == 'K' || *tcp == 'k')
3260
          kyocera_mode = _TRUE;
3260
          kyocera_mode = _TRUE;
3261
        else
3261
        else
3262
          if (*tcp == 'B' || *tcp == 'b') 
3262
          if (*tcp == 'B' || *tcp == 'b')
3263
            brother_mode = _TRUE;
3263
            brother_mode = _TRUE;
3264
# ifdef LJ4
3264
# ifdef LJ4
3265
	else
3265
	else
3266
        if (*tcp == '6' || *tcp == '6') 
3266
        if (*tcp == '6' || *tcp == '6')
3267
	    LJ6 = _TRUE;
3267
	    LJ6 = _TRUE;
3268
# endif
3268
# endif
3269
        break;
3269
        break;
Lines 3306-3312 Primary author of Dvi2xx: Gustaf Neumann Link Here
3306
#endif
3306
#endif
3307
#ifdef __riscos
3307
#ifdef __riscos
3308
      case 'i': /* name of directory to store diagrams in */
3308
      case 'i': /* name of directory to store diagrams in */
3309
        tcp++; 
3309
        tcp++;
3310
        ddi = 0;
3310
        ddi = 0;
3311
        while (*tcp != ' ' && *tcp != '\0' && ddi < DIAGDIRSIZE-1) {
3311
        while (*tcp != ' ' && *tcp != '\0' && ddi < DIAGDIRSIZE-1) {
3312
          diagdir[ddi++] = *tcp++;
3312
          diagdir[ddi++] = *tcp++;
Lines 3328-3335 Primary author of Dvi2xx: Gustaf Neumann Link Here
3328
      }
3328
      }
3329
    } else {
3329
    } else {
3330
3330
3331
      (void) strcpy(filename, tcp);
3331
      filename = tcp;
3332
      if (!strcmp(filename, "-")) {
3332
      if (EQ(filename, "-")) {
3333
        EmitFileName = "-";
3333
        EmitFileName = "-";
3334
#ifdef RISC_USE_OSL
3334
#ifdef RISC_USE_OSL
3335
        dvifp = BINOPEN("Kbd:");
3335
        dvifp = BINOPEN("Kbd:");
Lines 3339-3395 Primary author of Dvi2xx: Gustaf Neumann Link Here
3339
	  AssureBinary(fileno(dvifp));
3339
	  AssureBinary(fileno(dvifp));
3340
#endif
3340
#endif
3341
      } else {
3341
      } else {
3342
	/* Since this code is used only once during startup, we don't care
3343
	   about free()ing the allocated strings that represent filenames.
3344
	   It will be more work to realize proper deallocation handling than
3345
	   it's worth in terms of saving a few bytes. We consider these
3346
	   bytes actually static memory where we don't know the size in
3347
	   advance and don't add them to the allocated_storage count.
3348
	   [27 Jun 07 -js] */
3342
#ifdef KPATHSEA
3349
#ifdef KPATHSEA
3343
        /* split into directory + file name */
3350
        /* split into directory + file name */
3344
	int tcplen, argvlen;
3351
	int tcplen, argvlen;
3345
	tcp = (char *)xbasename(argv[argind]);/* this knows about any kind of slashes */
3352
	tcp = (char *)xbasename(argv[argind]);/* this knows about any kind of slashes */
3346
	tcplen = strlen(tcp);
3353
	tcplen = strlen(tcp);
3354
	if ( tcplen == 0 ) {
3355
	  /* This happens when the DVI file name has a trailing slash; this
3356
	     is not a valid name. Then we terminate the argument parsing
3357
	     loop, a usage message will be output below. */
3358
	  break;
3359
	}
3347
	argvlen = strlen(argv[argind]);
3360
	argvlen = strlen(argv[argind]);
3348
	if (tcplen == argvlen)
3361
	if (tcplen == argvlen)
3349
	  curarea[0] = '\0';
3362
	  curarea = "";
3350
	else {
3363
	else {
3351
	  (void) strcpy(curarea, argv[argind]);
3364
	  curarea = xstrdup(argv[argind]);
3352
	  curarea[argvlen-tcplen] = '\0';
3365
	  curarea[argvlen-tcplen] = '\0';
3353
	}
3366
	}
3354
#else
3367
#else
3355
        tcp = strrchr(argv[argind], '/');
3368
        tcp = strrchr(argv[argind], '/');
3356
        /* split into directory + file name */
3369
        /* split into directory + file name */
3357
        if (tcp == NULL) {
3370
        if (tcp == NULL) {
3358
          curarea[0] = '\0';
3371
          curarea[0] = "";
3359
          tcp = argv[argind];
3372
          tcp = argv[argind];
3360
        } else {
3373
        } else {
3361
          (void) strcpy(curarea, argv[argind]);
3374
	  curarea = xstrdup(argv[argind]);
3362
          curarea[tcp-argv[argind]+1] = '\0';
3375
          curarea[tcp-argv[argind]+1] = '\0';
3363
          tcp += 1;
3376
          tcp += 1;
3364
        }
3377
        }
3365
#endif
3378
#endif
3366
3379
3367
        (void) strcpy(curname, tcp);
3380
        curname = (char *) xmalloc(strlen(tcp)+5);  /* + space for ".dvi" */
3381
	(void) strcpy(curname, tcp);
3368
        /* split into file name + extension */
3382
        /* split into file name + extension */
3369
        tcp1 = strrchr(tcp, '.');
3383
        tcp1 = strrchr(curname, '.');
3370
        if (tcp1 == NULL) {
3384
        if (tcp1 == NULL) {
3371
          (void) strcpy(rootname, curname);
3385
          rootname = xstrdup(curname);
3372
          strcat(curname, ".dvi");
3386
          strcat(curname, ".dvi");
3373
        } else {
3387
        } else {
3374
          *tcp1 = '\0';
3388
          *tcp1 = '\0';
3375
          (void) strcpy(rootname, curname);
3389
          rootname = xstrdup(curname);
3376
          *tcp1 = '.';
3390
          *tcp1 = '.';
3377
        }
3391
        }
3378
3392
3393
	filename = (char *) xmalloc(strlen(curarea)+strlen(curname)+1);
3379
        (void) strcpy(filename, curarea);
3394
        (void) strcpy(filename, curarea);
3380
        (void) strcat(filename, curname);
3395
        (void) strcat(filename, curname);
3381
3396
3382
        if ((dvifp = BINOPEN(filename)) == FPNULL) {
3397
        if ((dvifp = BINOPEN(filename)) == FPNULL) {
3383
          /* do not insist on .dvi */
3398
          /* do not insist on .dvi */
3384
          if (tcp1 == NULL) {
3399
          if (tcp1 == NULL) {
3385
            int l = strlen(curname);
3400
	    filename[strlen(filename) - 4] = '\0';
3386
            if (l > 4)
3401
	    dvifp = BINOPEN(filename);
3387
              curname[l - 4] = '\0';
3388
            l = strlen(filename);
3389
            if (l > 4)
3390
              filename[l - 4] = '\0';
3391
          }
3402
          }
3392
          if (tcp1 != NULL || (dvifp = BINOPEN(filename)) == FPNULL) {
3403
          if (dvifp == FPNULL) {
3393
#ifdef MSC5
3404
#ifdef MSC5
3394
            Fatal("%s: can't find DVI file \"%s\"\n\n",
3405
            Fatal("%s: can't find DVI file \"%s\"\n\n",
3395
                  G_progname, filename);
3406
                  G_progname, filename);
Lines 3411-3417 Primary author of Dvi2xx: Gustaf Neumann Link Here
3411
  y_goffset = (short) MM_TO_PXL(y_offset) + y_origin;
3422
  y_goffset = (short) MM_TO_PXL(y_offset) + y_origin;
3412
3423
3413
  if (dvifp == FPNULL) {
3424
  if (dvifp == FPNULL) {
3414
    fprintf(ERR_STREAM,"\nThis is the DVI to %s converter version %s",
3425
    fprintf(ERR_STREAM,"\nThis is the DVI to %s converter %s",
3415
            PRINTER, VERSION);
3426
            PRINTER, VERSION);
3416
#ifdef SEVENBIT
3427
#ifdef SEVENBIT
3417
    fprintf(ERR_STREAM,", 7bit");
3428
    fprintf(ERR_STREAM,", 7bit");
Lines 3507-3519 Primary author of Dvi2xx: Gustaf Neumann Link Here
3507
    exit(1);
3518
    exit(1);
3508
  }
3519
  }
3509
  if (EQ(EmitFileName, "")) {
3520
  if (EQ(EmitFileName, "")) {
3510
    if ((EmitFileName = (char *)malloc( STRSIZE )) != NULL)
3521
    EmitFileName = (char *) xmalloc(strlen(rootname)+sizeof(EMITFILE_EXTENSION));
3511
      allocated_storage += STRSIZE;
3522
    (void) strcpy(EmitFileName, rootname);
3512
    else
3513
      Fatal("Can't allocate storage of %d bytes\n",STRSIZE);
3514
    (void) strcpy(EmitFileName, curname);
3515
    if ((tcp1 = strrchr(EmitFileName, '.')))
3516
      *tcp1 = '\0';
3517
    strcat(EmitFileName, EMITFILE_EXTENSION);
3523
    strcat(EmitFileName, EMITFILE_EXTENSION);
3518
  }
3524
  }
3519
  if (G_quiet)
3525
  if (G_quiet)
Lines 3668-3674 bool PFlag; Link Here
3668
  if (PrintTestPage) EMIT1("\033z");
3674
  if (PrintTestPage) EMIT1("\033z");
3669
#ifdef vms
3675
#ifdef vms
3670
  /* last record is not flushed to file, unless it is completely filled */
3676
  /* last record is not flushed to file, unless it is completely filled */
3671
  for (kk = (int)((*outfp)->_cnt); kk > 0; --kk) 
3677
  for (kk = (int)((*outfp)->_cnt); kk > 0; --kk)
3672
    putc('\0',outfp);
3678
    putc('\0',outfp);
3673
  fflush(outfp);
3679
  fflush(outfp);
3674
#endif
3680
#endif
Lines 3698-3703 bool PFlag; Link Here
3698
#endif
3704
#endif
3699
  }
3705
  }
3700
  CloseFiles();
3706
  CloseFiles();
3707
  if ( tmp_dir[0] != '\0' )
3708
    rmdir (tmp_dir);			/* ignore errors */
3701
  exit(G_errenc);
3709
  exit(G_errenc);
3702
}
3710
}
3703
3711
Lines 3764-3778 char **end; Link Here
3764
#endif
3772
#endif
3765
{
3773
{
3766
  char *a,*b;
3774
  char *a,*b;
3767
  
3775
3768
  a = s1; 
3776
  a = s1;
3769
  b = s2;
3777
  b = s2;
3770
  while (*a != '\0') {
3778
  while (*a != '\0') {
3771
    if (tolower(*a) != tolower(*b)) return(_FALSE);
3779
    if (tolower(*a) != tolower(*b)) return(_FALSE);
3772
    a++; 
3780
    a++;
3773
    b++;
3781
    b++;
3774
  }
3782
  }
3775
  *end = b; 
3783
  *end = b;
3776
  return(_TRUE);
3784
  return(_TRUE);
3777
}
3785
}
3778
3786
Lines 3791-3808 char **end; Link Here
3791
{
3799
{
3792
  char *s;
3800
  char *s;
3793
  int count = 0;
3801
  int count = 0;
3794
  
3802
3795
  s = str;
3803
  s = str;
3796
  while ((*s != '\0') && (count < number)) {
3804
  while ((*s != '\0') && (count < number)) {
3797
    while ((*s == ' ') || (*s == ',') || (*s == '=')) 
3805
    while ((*s == ' ') || (*s == ',') || (*s == '='))
3798
      s++;
3806
      s++;
3799
    if (*s != '\0') {
3807
    if (*s != '\0') {
3800
      result[count++] = strtod(s,&s);
3808
      result[count++] = strtod(s,&s);
3801
    }
3809
    }
3802
  }
3810
  }
3803
  while ((*s == ' ') || (*s == ',') || (*s == '=')) 
3811
  while ((*s == ' ') || (*s == ',') || (*s == '='))
3804
    s++;
3812
    s++;
3805
  *end = s; 
3813
  *end = s;
3806
  return(count);
3814
  return(count);
3807
}
3815
}
3808
3816
Lines 3822-3843 char *str; Link Here
3822
  int results[4],no;
3830
  int results[4],no;
3823
3831
3824
  s = str;
3832
  s = str;
3825
  while (*s == ' ') 
3833
  while (*s == ' ')
3826
    s++;
3834
    s++;
3827
  if ((StrCompare("drawfile",s,&s)) || (StrCompare("DVIview_diagram",s,&s))) {
3835
  if ((StrCompare("drawfile",s,&s)) || (StrCompare("DVIview_diagram",s,&s))) {
3828
3836
3829
    if (printdiag == _FALSE) 
3837
    if (printdiag == _FALSE)
3830
      return(_TRUE); /* it's a diagram, but don't print */
3838
      return(_TRUE); /* it's a diagram, but don't print */
3831
3839
3832
    while ((*s == ' ') || (*s == '=')) 
3840
    while ((*s == ' ') || (*s == '='))
3833
      s++; /* space or '=' separates keyword/keyval */
3841
      s++; /* space or '=' separates keyword/keyval */
3834
3842
3835
    if (*s == '\0') {
3843
    if (*s == '\0') {
3836
      fprintf(ERR_STREAM,"No filename given for \\special-diagram!\n"); 
3844
      fprintf(ERR_STREAM,"No filename given for \\special-diagram!\n");
3837
      return(_TRUE);
3845
      return(_TRUE);
3838
    }
3846
    }
3839
    sh = diagname;
3847
    sh = diagname;
3840
    while ((*s != ' ') && (*s != ',') && (*s != '\0')) 
3848
    while ((*s != ' ') && (*s != ',') && (*s != '\0'))
3841
      *sh++ = *s++;
3849
      *sh++ = *s++;
3842
    *sh = '\0';
3850
    *sh = '\0';
3843
3851
Lines 3845-3851 char *str; Link Here
3845
    dt.scalex = dt.scaley = 100;
3853
    dt.scalex = dt.scaley = 100;
3846
    dt.cropl = dt.cropb = dt.cropr = dt.cropt = 0;
3854
    dt.cropl = dt.cropb = dt.cropr = dt.cropt = 0;
3847
    while (*s != '\0') {
3855
    while (*s != '\0') {
3848
      while ((*s == ' ') || (*s == ',')) 
3856
      while ((*s == ' ') || (*s == ','))
3849
        s++;
3857
        s++;
3850
      if (*s != '\0') {
3858
      if (*s != '\0') {
3851
        if (StrCompare("scale",s,&s)) {
3859
        if (StrCompare("scale",s,&s)) {
Lines 3853-3859 char *str; Link Here
3853
            fprintf(ERR_STREAM,
3861
            fprintf(ERR_STREAM,
3854
                   "Too few arguments (%d) given for <scale> - ignored.\n",no);
3862
                   "Too few arguments (%d) given for <scale> - ignored.\n",no);
3855
          }
3863
          }
3856
          dt.scalex = results[0]; 
3864
          dt.scalex = results[0];
3857
          dt.scaley = results[1];
3865
          dt.scaley = results[1];
3858
        }
3866
        }
3859
        else if (StrCompare("crop",s,&s)) {
3867
        else if (StrCompare("crop",s,&s)) {
Lines 3861-3875 char *str; Link Here
3861
            fprintf(ERR_STREAM,
3869
            fprintf(ERR_STREAM,
3862
                   "Too few arguments (%d) given for <crop> - ignored.\n",no);
3870
                   "Too few arguments (%d) given for <crop> - ignored.\n",no);
3863
          }
3871
          }
3864
          dt.cropl = results[0]; 
3872
          dt.cropl = results[0];
3865
          dt.cropr = results[1];
3873
          dt.cropr = results[1];
3866
          dt.cropt = results[2]; 
3874
          dt.cropt = results[2];
3867
          dt.cropb = results[3];
3875
          dt.cropb = results[3];
3868
        }
3876
        }
3869
        else {
3877
        else {
3870
          fprintf(ERR_STREAM,"Bad \\special keyword - <%s> ignored\n",s);
3878
          fprintf(ERR_STREAM,"Bad \\special keyword - <%s> ignored\n",s);
3871
          /* skip over this word */
3879
          /* skip over this word */
3872
          while ((*s != ' ') && (*s != ',') && (*s != '=') && (*s != '\0')) 
3880
          while ((*s != ' ') && (*s != ',') && (*s != '=') && (*s != '\0'))
3873
            s++;
3881
            s++;
3874
        }
3882
        }
3875
      }
3883
      }
Lines 3879-3885 char *str; Link Here
3879
    diagram(diagname,&dt);
3887
    diagram(diagname,&dt);
3880
    return(_TRUE);
3888
    return(_TRUE);
3881
  }
3889
  }
3882
  else 
3890
  else
3883
    return(_FALSE);
3891
    return(_FALSE);
3884
}
3892
}
3885
# endif /* LJ */
3893
# endif /* LJ */
Lines 3895-3964 char *str; Link Here
3895
int  n;
3903
int  n;
3896
#endif
3904
#endif
3897
{
3905
{
3898
  char    spbuf[STRSIZE], xs[STRSIZE], ys[STRSIZE];
3906
  char    xs[STRSIZE], ys[STRSIZE];
3899
  char    *sf = NULL, *psfile = NULL;
3907
  char    *include_file = NULL;
3908
  enum    { VerbFile, HPFile, PSFile } file_type;
3900
  float   x,y;
3909
  float   x,y;
3901
  long4   x_pos, y_pos;
3910
  long4   x_pos, y_pos;
3902
  KeyWord k;
3911
  KeyWord k;
3903
  int     i, j, j1;
3912
  int     i, j, j1;
3904
  static  int   GrayScale = 10, Pattern = 1;
3913
  static  int   GrayScale = 10, Pattern = 1;
3905
  static  bool  GrayFill = _TRUE;
3914
  static  bool  GrayFill = _TRUE;
3906
  static  long4 p_x[80], p_y[80];
3915
  static  long4 p_x[MAX_SPECIAL_DEFPOINTS], p_y[MAX_SPECIAL_DEFPOINTS];
3907
  int llx=0, lly=0, urx=0, ury=0, rwi=0, rhi=0;
3916
  int llx=0, lly=0, urx=0, ury=0, rwi=0;
3908
#ifdef WIN32
3909
  char    *gs_path;
3910
#endif
3911
3917
3912
  str[n] = '\0';
3918
  str[n] = '\0';
3913
  spbuf[0] = '\0';
3919
  for ( i=0 ; i<MAX_SPECIAL_DEFPOINTS ; i++ )
3920
    p_x[i] = p_y[i] = -1;
3914
3921
3915
  SetPosn(h, v);
3922
  SetPosn(h, v);
3916
#ifdef __riscos
3923
#ifdef __riscos
3917
#ifdef LJ
3924
#ifdef LJ
3918
  if (ParseDiagram(str)) 
3925
  if (ParseDiagram(str))
3919
    return;
3926
    return;
3920
#endif
3927
#endif
3921
#endif
3928
#endif
3922
 
3929
3923
  while ( (str = GetKeyStr(str, &k)) != NULL ) {
3930
  while ( (str = GetKeyStr(str, &k)) != NULL ) {
3924
    /* get all keyword-value pairs */
3931
    /* get all keyword-value pairs */
3925
    /* for compatibility, single words are taken as file names */
3932
    /* for compatibility, single words are taken as file names */
3926
    if ( k.vt == None && access(k.Key, 0) == 0) {
3933
    if ( k.vt == None && access(k.Key, 0) == 0) {
3927
      if ( sf
3934
      if ( include_file && !kpse_tex_hush ("special") ) {
3928
#ifdef KPATHSEA
3935
        Warning("More than one \\special file name given. %s ignored", include_file);
3929
           && !kpse_tex_hush ("special")
3936
	free (include_file);
3930
#endif
3937
      }
3931
         )
3938
      include_file = xstrdup(k.Key);
3932
        Warning("More than one \\special file name given. %s ignored", sf);
3939
      file_type = VerbFile;
3933
      (void) strcpy(spbuf, k.Key);
3940
    } else if ( GetKeyVal( &k, KeyTab, NKEYS, &i ) && i != -1 ) {
3934
      sf = spbuf;
3935
      /*
3936
        for (j = 1; ((sf[j]=='/' ? sf[j]='\\':sf[j]) != '\0'); j++);
3937
        */
3938
    } else if ( GetKeyVal( &k, KeyTab, NKEYS, &i ) && i != -1 )
3939
      switch (i) {
3941
      switch (i) {
3940
      case PSFILE:
3942
      case PSFILE:
3941
        if (sf
3943
        if ( include_file ) {
3942
#ifdef KPATHSEA
3944
	  Warning("More than one \\special file name given. %s ignored", include_file);
3943
            && !kpse_tex_hush ("special")
3945
	  free(include_file);
3944
#endif
3946
	}
3945
            )
3947
        include_file = xstrdup(k.Val);
3946
            Warning("More than one \\special file name given. %s ignored", sf);
3948
	file_type = PSFile;
3947
        (void) strcpy(spbuf, k.Val);
3948
        psfile = spbuf;
3949
        /*
3950
          for (j=1; ((sf[j]=='/' ? sf[j]='\\':sf[j]) != '\0'); j++);
3951
          */
3952
        break;
3949
        break;
3953
        
3950
3954
      case HPFILE:
3951
      case HPFILE:
3955
        if (sf)
3952
        if ( include_file && !kpse_tex_hush ("special") ) {
3956
            Warning("More than one \\special file name given. %s ignored", sf);
3953
	  Warning("More than one \\special file name given. %s ignored", include_file);
3957
        (void) strcpy(spbuf, k.Val);
3954
	  free(include_file);
3958
        sf = spbuf;
3955
	}
3959
        /*
3956
        include_file = xstrdup(k.Val);
3960
          for (j=1; ((sf[j]=='/' ? sf[j]='\\':sf[j]) != '\0'); j++);
3957
	file_type = HPFile;
3961
          */
3962
        break;
3958
        break;
3963
3959
3964
      case ORIENTATION:
3960
      case ORIENTATION:
Lines 3977-4000 int n; Link Here
3977
          EMIT2("\033&l%dO\033*rF", (unsigned char)k.v.i);
3973
          EMIT2("\033&l%dO\033*rF", (unsigned char)k.v.i);
3978
        }
3974
        }
3979
#endif
3975
#endif
3980
        else
3976
        else {
3981
#ifdef KPATHSEA
3977
	  Warning( "Invalid orientation (%d) given; ignored.", k.v.i);
3982
           if (!kpse_tex_hush ("special"))
3978
	}
3983
#endif
3984
          Warning( "Invalid orientation (%d)given; ignored.", k.v.i);
3985
        break;
3979
        break;
3986
3980
3987
      case RESETPOINTS:
3981
      case RESETPOINTS:
3988
        (void) strcpy(spbuf, k.Val);
3982
	for ( i=0 ; i<MAX_SPECIAL_DEFPOINTS ; i++ )
3989
3983
	  p_x[i] = p_y[i] = -1;
3990
        sf = NULL;
3991
        break;
3984
        break;
3992
3985
3993
      case DEFPOINT:
3986
      case DEFPOINT:
3994
        (void) strcpy(spbuf, k.Val);
3987
	/* 254 is STRSIZE-1. cpp should be used to construct that number. */
3995
        i = sscanf(spbuf,"%d(%[^,],%s)",&j,xs,ys);
3988
        i = sscanf(k.Val,"%d(%254[^,],%254s)",&j,xs,ys);
3996
        if (i>0) {
3989
        if (i>0) {
3997
          x_pos = h; 
3990
	  if ( j < 0  ||  j >= MAX_SPECIAL_DEFPOINTS ) {
3991
	    Warning ("defpoint %d ignored, must be between 0 and %d",
3992
		     j, MAX_SPECIAL_DEFPOINTS);
3993
	    break;
3994
	  }
3995
          x_pos = h;
3998
          y_pos = v;
3996
          y_pos = v;
3999
          if (i>1) {
3997
          if (i>1) {
4000
            if (sscanf(xs,"%fpt",&x)>0) {
3998
            if (sscanf(xs,"%fpt",&x)>0) {
Lines 4010-4029 int n; Link Here
4010
          }
4008
          }
4011
          p_x[j]=x_pos;
4009
          p_x[j]=x_pos;
4012
          p_y[j]=y_pos;
4010
          p_y[j]=y_pos;
4013
        } else
4011
        } else {
4014
#ifdef KPATHSEA
4012
	  Warning("invalid point definition");
4015
              if (!kpse_tex_hush ("special"))
4013
	}
4016
#endif
4017
          Warning("invalid point definition\n");
4018
4019
        sf = NULL;
4020
        break;
4014
        break;
4021
4015
4022
      case FILL:
4016
      case FILL:
4023
        (void) strcpy(spbuf, k.Val);
4017
	/* 254 is STRSIZE-1. cpp should be used to construct that number. */
4024
        i = sscanf(spbuf,"%d/%d %s",&j,&j1,xs);
4018
        i = sscanf(k.Val,"%d/%d %254s",&j,&j1,xs);
4025
        if (i>1) {
4019
        if (i>1) {
4026
#ifdef LJ
4020
#ifdef LJ
4021
	  if ( j < 0 || j >= MAX_SPECIAL_DEFPOINTS ) {
4022
	    Warning ("fill ignored, point %d must be between 0 and %d",
4023
		     j, MAX_SPECIAL_DEFPOINTS);
4024
	    break;
4025
	  }
4026
	  if ( p_x[j] == -1 ) {
4027
	    Warning ("fill ignored, point %d is undefined\n", j);
4028
	    break;
4029
	  }
4030
	  if ( j1 < 0 || j1 >= MAX_SPECIAL_DEFPOINTS ) {
4031
	    Warning ("fill ignored, point %d must be between 0 and %d",
4032
		     j1, MAX_SPECIAL_DEFPOINTS);
4033
	    break;
4034
	  }
4035
	  if ( p_x[j1] == -1 ) {
4036
	    Warning ("fill ignored, point %d is undefined\n", j1);
4037
	    break;
4038
	  }
4027
          SetPosn(p_x[j], p_y[j]);
4039
          SetPosn(p_x[j], p_y[j]);
4028
          x_pos = (long4)PIXROUND(p_x[j1]-p_x[j], hconv);
4040
          x_pos = (long4)PIXROUND(p_x[j1]-p_x[j], hconv);
4029
          y_pos = (long4)PIXROUND(p_y[j1]-p_y[j], vconv);
4041
          y_pos = (long4)PIXROUND(p_y[j1]-p_y[j], vconv);
Lines 4043-4064 int n; Link Here
4043
        if ((k.v.i >= 0) && (k.v.i < 101)) {
4055
        if ((k.v.i >= 0) && (k.v.i < 101)) {
4044
          GrayScale = k.v.i;
4056
          GrayScale = k.v.i;
4045
          GrayFill = _TRUE;
4057
          GrayFill = _TRUE;
4046
        } else
4058
        } else {
4047
#ifdef KPATHSEA
4048
           if (!kpse_tex_hush ("special"))
4049
#endif
4050
          Warning( "Invalid gray scale (%d) given; ignored.", k.v.i);
4059
          Warning( "Invalid gray scale (%d) given; ignored.", k.v.i);
4060
	}
4051
        break;
4061
        break;
4052
4062
4053
      case PATTERN:
4063
      case PATTERN:
4054
        if ((k.v.i >= 0) && (k.v.i < 7)) {
4064
        if ((k.v.i >= 0) && (k.v.i < 7)) {
4055
          Pattern = k.v.i;
4065
          Pattern = k.v.i;
4056
          GrayFill = _FALSE;
4066
          GrayFill = _FALSE;
4057
        } else
4067
        } else {
4058
#ifdef KPATHSEA
4059
           if (!kpse_tex_hush ("special"))
4060
#endif
4061
          Warning( "Invalid pattern (%d) given; ignored.", k.v.i);
4068
          Warning( "Invalid pattern (%d) given; ignored.", k.v.i);
4069
	}
4062
        break;
4070
        break;
4063
4071
4064
      case LLX: llx = k.v.i; break;
4072
      case LLX: llx = k.v.i; break;
Lines 4066-4168 int n; Link Here
4066
      case URX: urx = k.v.i; break;
4074
      case URX: urx = k.v.i; break;
4067
      case URY: ury = k.v.i; break;
4075
      case URY: ury = k.v.i; break;
4068
      case RWI: rwi = k.v.i; break;
4076
      case RWI: rwi = k.v.i; break;
4069
      case RHI: rhi = k.v.i; break;
4077
      case RHI:
4078
	if (!kpse_tex_hush ("special"))
4079
	  Warning("Whatever rhi was good for once, it is ignored now.");
4080
	break;
4070
4081
4071
      default:
4082
      default:
4072
#ifdef KPATHSEA
4083
	if ( !kpse_tex_hush ("special") )
4073
           if (!kpse_tex_hush ("special"))
4084
	  Warning("Can't handle %s=%s command; ignored.", k.Key, k.Val);
4074
#endif
4075
        Warning("Can't handle %s=%s command; ignored.", k.Key, k.Val);
4076
        break;
4085
        break;
4077
      }
4086
      }
4078
      
4087
4079
    else
4088
    } else if (!kpse_tex_hush ("special")) {
4080
#ifdef KPATHSEA
4081
           if (!kpse_tex_hush ("special"))
4082
#endif
4083
      Warning("Invalid keyword or value in \\special - <%s> ignored", k.Key);
4089
      Warning("Invalid keyword or value in \\special - <%s> ignored", k.Key);
4090
    }
4091
4092
    free (k.Key);
4093
    if ( k.Val != NULL )  free(k.Val);
4084
  }
4094
  }
4085
4095
4086
  if ( sf || psfile ) {
4096
  if ( include_file ) {
4087
    last_rx = last_ry = UNKNOWN;
4097
    last_rx = last_ry = UNKNOWN;
4088
#ifdef IBM3812
4098
#ifdef IBM3812
4089
    PMPflush;
4099
    PMPflush;
4090
#endif
4100
#endif
4091
    if (sf) {
4101
4092
      if (i == HPFILE) 
4093
        CopyHPFile( sf );
4094
      else 
4095
        CopyFile( sf );
4096
    }
4097
    else
4098
#ifdef LJ
4102
#ifdef LJ
4099
      if (psfile) {
4103
    if ( file_type == PSFile) {
4100
        /* int height = rwi * (urx - llx) / (ury - lly);*/
4104
      /* int height = rwi * (urx - llx) / (ury - lly);*/
4101
        int width  = urx - llx;
4105
      int width  = urx - llx;
4102
        int height = ury - lly;
4106
      int height = ury - lly;
4103
        char cmd[255];
4107
      char cmd[255];
4104
        int scale_factor    = 3000 * width / rwi;
4108
      char *cmd_format = "%s -q -dSIMPLE -dSAFER -dNOPAUSE -sDEVICE=%s -sOutputFile=%s %s %s showpage.ps -c quit";
4105
        int adjusted_height = height * 300/scale_factor;
4109
      char *gs_cmd;
4106
        int adjusted_llx    = llx    * 300/scale_factor;
4110
      int scale_factor, adjusted_height, adjusted_llx;
4107
        char *printer = "ljetplus"; /* use the most stupid one */
4111
      char *printer = "ljetplus"; /* use the most stupid one */
4108
4112
4109
4113
      char pcl_file[STRSIZE];
4110
        char scale_file_name[255];
4114
      char scale_file[STRSIZE];
4111
        char *scale_file = tmpnam(scale_file_name);
4115
      FILEPTR scalef;
4112
        char *pcl_file = tmpnam(NULL);  
4116
4113
        FILEPTR scalef;
4117
      if ( urx == 0 || ury == 0 || rwi == 0 ) {
4114
4118
	/* Since dvips' psfile special has a different syntax, this might
4115
        if ( (scalef = BOUTOPEN(scale_file)) == FPNULL ) {
4119
	   well be one of those specials, i.e., a non-dviljk special. Then
4116
          Warning("Unable to open file %s for writing", scale_file );
4120
	   the Warning should be suppressable. */
4117
          return;
4121
	if ( !kpse_tex_hush ("special") )
4118
        }
4122
	  Warning ("Ignoring psfile special without urx, ury and rwi attributes");
4119
        fprintf(scalef, "%.2f %.2f scale\n%d %d translate\n",  
4123
	free (include_file);
4120
                300.0/scale_factor, 300.0/scale_factor,
4124
	return;
4121
                0, adjusted_height == height ? 0 : ury);
4125
      }
4122
        BCLOSE( scalef );
4126
      scale_factor    = 3000 * width / rwi;
4127
      adjusted_height = height * 300/scale_factor;
4128
      adjusted_llx    = llx    * 300/scale_factor;
4129
4130
      /* We cannot use mkstemp, as we cannot pass two open file descriptors
4131
	 portably to Ghostscript. We don't want to use tmpnam() or tempnam()
4132
	 either, as they have tempfile creation race conditions. Instead we
4133
	 create a temporary directory with mkdtemp() -- if that's available.
4134
	 If not, we are thrown back to tempnam(), to get our functionality
4135
	 at all. We need to create the temporary directory only once per
4136
	 run; it will be deleted in AllDone(). */
4137
      if ( tmp_dir[0] == '\0' ) {
4138
	char * base_dir;
4139
	if ( (base_dir = getenv("TMPDIR")) == NULL ) {
4140
	  base_dir = "/tmp";
4141
	} else if ( strlen(base_dir) > STRSIZE - sizeof("/dviljkXXXXXX/include.pcl") ) {
4142
	  Warning ("TMPDIR %s is too long, using /tmp instead", base_dir);
4143
	  base_dir = "/tmp";
4144
	}
4145
	if ( base_dir[0] == '/'  && base_dir[1] == '\0' ) {
4146
	  Warning ("Feeling naughty, do we? / is no temporary directory, dude");
4147
	  base_dir = "/tmp";
4148
	}
4149
	strcpy (tmp_dir, base_dir);
4150
	strcat (tmp_dir, "/dviljkXXXXXX");
4151
	if ( mkdtemp(tmp_dir) == NULL ) {
4152
	  Warning ("Could not create temporary directory %s, errno = %d; ignoring include file special",
4153
		   tmp_dir, errno);
4154
	  return;
4155
	}
4156
      }
4157
      strcpy(pcl_file, tmp_dir);
4158
      strcat(pcl_file, "/include.pcl");
4159
      strcpy(scale_file, tmp_dir);
4160
      strcat(scale_file, "/scale.ps");
4161
4162
      if ( (scalef = BOUTOPEN(scale_file)) == FPNULL ) {
4163
	Warning("Unable to open file %s for writing", scale_file );
4164
	free (include_file);
4165
	unlink(scale_file);		/* ignore error */
4166
	return;
4167
      }
4168
      fprintf(scalef, "%.2f %.2f scale\n%d %d translate\n",
4169
	      300.0/scale_factor, 300.0/scale_factor,
4170
	      0, adjusted_height == height ? 0 : ury);
4171
      BCLOSE( scalef );
4123
4172
4124
#ifdef WIN32
4173
#ifdef WIN32
4125
	gs_path = getenv("GS_PATH");
4174
      if ( (gs_cmd = getenv("GS_PATH")) == NULL )
4126
	if (!gs_path)
4175
	gs_cmd = "gswin32c.exe";
4127
	  gs_path = "gswin32c.exe";
4176
#else
4128
        sprintf(cmd,"%s -q -dSIMPLE -dSAFER -dNOPAUSE -sDEVICE=%s -sOutputFile=%s %s %s showpage.ps -c quit",
4177
      gs_cmd = "gs";
4129
		gs_path, printer, pcl_file, scale_file, psfile);
4130
#else
4131
        sprintf(cmd,"gs -q -dSIMPLE -dSAFER -dNOPAUSE -sDEVICE=%s -sOutputFile=%s %s %s showpage.ps -c quit",
4132
                printer, pcl_file, scale_file, psfile);
4133
#endif
4134
#ifdef DEBUGGS   
4135
        fprintf(stderr,
4136
          "PS-file '%s' w=%d, h=%d, urx=%d, ury=%d, llx=%d, lly=%d, rwi=%d\n",
4137
                psfile, urx - llx, height, urx,ury,llx,lly, rwi);
4138
        fprintf(stderr,"%s\n",cmd);
4139
#endif
4178
#endif
4140
        if (system(cmd)) {
4179
      if ( strlen(cmd_format)-10 + strlen(gs_cmd) + strlen(printer) +
4141
          Warning("execution of '%s' returned an error", cmd);
4180
	       strlen(pcl_file) + strlen(scale_file) + strlen(include_file) +1 >
4142
        } else {
4181
	   sizeof(cmd) ) {
4143
#ifdef DEBUGGS   
4182
	Warning ("Ghostscript command for %s would be too long, skipping special", include_file);
4144
          fprintf(stderr, "o=%d, h=%d, so=%d, sh=%d\n", 
4183
	free (include_file);
4145
                  llx, height, adjusted_llx, adjusted_height);
4184
	unlink(scale_file);		/* ignore errors */
4146
          
4185
	unlink(pcl_file);
4147
          fprintf(stderr, "OLD x=%d, y=%d\n", 
4186
	return;
4148
                  (int)PIXROUND(h, hconv) + x_goffset,
4187
      }
4149
                  (int)PIXROUND(v, vconv) + y_goffset);
4188
      sprintf(cmd, cmd_format,
4150
#endif  
4189
	      gs_cmd, printer, pcl_file, scale_file, include_file);
4151
          v -= 65536l*adjusted_height; /**300/scale_factor;*/
4190
#ifdef DEBUGGS
4152
          h -= 65536l*adjusted_llx; /* *300/scale_factor;*/
4191
      fprintf(stderr,
4153
          SetPosn(h, v);
4192
	"PS-file '%s' w=%d, h=%d, urx=%d, ury=%d, llx=%d, lly=%d, rwi=%d\n",
4154
#ifdef DEBUGGS   
4193
	      include_file, urx - llx, height, urx,ury,llx,lly, rwi);
4155
          fprintf(stderr, "NEW x=%d, y=%d\n", 
4194
      fprintf(stderr,"%s\n",cmd);
4156
                  (int)PIXROUND(h, hconv) + x_goffset,
4195
#endif
4157
                  (int)PIXROUND(v, vconv) + y_goffset);
4196
      if (system(cmd)) {
4158
#endif
4197
	Warning("execution of '%s' returned an error", cmd);
4159
4198
      } else {
4160
          CopyHPFile( pcl_file );
4199
#ifdef DEBUGGS
4161
          /* unlink(pcl_file); */
4200
	fprintf(stderr, "o=%d, h=%d, so=%d, sh=%d\n",
4162
          /* unlink(scale_file); */
4201
		llx, height, adjusted_llx, adjusted_height);
4163
        }
4202
4203
	fprintf(stderr, "OLD x=%d, y=%d\n",
4204
		(int)PIXROUND(h, hconv) + x_goffset,
4205
		(int)PIXROUND(v, vconv) + y_goffset);
4206
#endif
4207
	v -= 65536l*adjusted_height; /**300/scale_factor;*/
4208
	h -= 65536l*adjusted_llx; /* *300/scale_factor;*/
4209
	SetPosn(h, v);
4210
#ifdef DEBUGGS
4211
	fprintf(stderr, "NEW x=%d, y=%d\n",
4212
		(int)PIXROUND(h, hconv) + x_goffset,
4213
		(int)PIXROUND(v, vconv) + y_goffset);
4214
#endif
4215
4216
	CopyHPFile( pcl_file );
4164
      }
4217
      }
4218
      unlink(scale_file);		/* ignore errors */
4219
      unlink(pcl_file);
4220
    }
4221
    else
4165
#endif /* LJ */
4222
#endif /* LJ */
4223
4224
    if ( file_type == HPFile )
4225
      CopyHPFile( include_file );
4226
    else if ( file_type == VerbFile )
4227
      CopyFile( include_file );
4228
    else
4229
      Warning ("This can't happen: unknown file_type value %d", file_type);
4230
4231
    if ( include_file != NULL )  free(include_file);
4166
  }
4232
  }
4167
}
4233
}
4168
4234
Lines 4173-4184 int n; Link Here
4173
/**********************************************************************/
4239
/**********************************************************************/
4174
/*****************************  GetKeyStr  ****************************/
4240
/*****************************  GetKeyStr  ****************************/
4175
/**********************************************************************/
4241
/**********************************************************************/
4176
/* extract first keyword-value pair from string (value part may be null)
4242
/* Extract first keyword-value pair from string (value part may be null),
4177
 * return pointer to remainder of string
4243
 * keyword and value are allocated and must be free by caller.
4178
 * return NULL if none found
4244
 * Return pointer to remainder of string,
4245
 * return NULL if none found.
4179
 */
4246
 */
4180
char    KeyStr[STRSIZE];
4181
char    ValStr[STRSIZE];
4182
#if NeedFunctionPrototypes
4247
#if NeedFunctionPrototypes
4183
char *GetKeyStr(char *str, KeyWord *kw )
4248
char *GetKeyStr(char *str, KeyWord *kw )
4184
#else
4249
#else
Lines 4187-4225 char *str; Link Here
4187
KeyWord *kw;
4252
KeyWord *kw;
4188
#endif
4253
#endif
4189
{
4254
{
4190
  char    *s, *k, *v, t;
4255
  char *s, *start;
4256
  char save_char, quote_char;
4191
  if ( !str )
4257
  if ( !str )
4192
    return( NULL );
4258
    return( NULL );
4193
  for (s = str; *s == ' '; s++)
4259
  for (s = str; *s == ' '; s++)
4194
    ;          /* skip over blanks */
4260
    ;          /* skip over blanks */
4195
  if (*s == '\0')
4261
  if (*s == '\0')
4196
    return( NULL );
4262
    return( NULL );
4197
  for (k = KeyStr; /* extract keyword portion */
4263
  start = s++;				/* start of keyword */
4198
       *s != ' ' && *s != '\0' && *s != '=';
4264
  while ( *s != ' ' && *s != '\0' && *s != '=' )  /* locate end */
4199
       *k++ = *s++)
4265
    s++;
4200
    ;
4266
  save_char = *s;
4201
  *k = '\0';
4267
  *s = '\0';
4202
  kw->Key = KeyStr;
4268
  kw->Key = xstrdup(start);
4203
  kw->Val = v = NULL;
4269
  kw->Val = NULL;
4204
  kw->vt = None;
4270
  kw->vt = None;
4205
  for ( ; *s == ' '; s++)
4271
  if ( save_char == '\0' )		/* shortcut when we're at the end */
4206
    ;            /* skip over blanks */
4272
    return (s);
4207
  if ( *s != '=' )         /* look for "=" */
4273
  *s = save_char;			/* restore keyword end char */
4274
  while ( *s == ' ' ) s++ ;		/* skip over blanks */
4275
  if ( *s != '=' )			/* no "=" means no value */
4208
    return( s );
4276
    return( s );
4209
  for (s++; *s == ' '; s++);      /* skip over blanks */
4277
  for (s++; *s == ' '; s++)
4210
  if ( *s == '\'' || *s == '\"' )  /* get string delimiter */
4278
    ;					/* skip over blanks */
4211
    t = *s++;
4279
  if ( *s == '\'' || *s == '\"' )	/* get string delimiter */
4280
    quote_char = *s++;
4212
  else
4281
  else
4213
    t = ' ';
4282
    quote_char = ' ';
4214
  for (v = ValStr; /* copy value portion up to delim */
4283
  start = s;				/* no increment, might be "" as value */
4215
       *s != t && *s != '\0';
4284
  while ( *s != quote_char && *s != '\0' )
4216
       *v++ = *s++)
4285
    s++;			  /* locate end of value portion */
4217
    ;
4286
  save_char = *s;
4218
  if ( t != ' ' && *s == t )
4287
  *s = '\0';
4219
    s++;
4288
  kw->Val = xstrdup(start);
4220
  *v = '\0';
4221
  kw->Val = ValStr;
4222
  kw->vt = String;
4289
  kw->vt = String;
4290
  if ( save_char != '\0' ) {		/* save_char is now quote_char */
4291
    *s = save_char;
4292
    if ( quote_char != ' ' )		/* we had real quote chars */
4293
      s++;
4294
  }
4223
  return( s );
4295
  return( s );
4224
}
4296
}
4225
4297
Lines 4281-4287 char *a, *b; Link Here
4281
#endif
4353
#endif
4282
{
4354
{
4283
  char *x, *y;
4355
  char *x, *y;
4284
  
4356
4285
  for (x = a, y = b; *a; a++, b++)
4357
  for (x = a, y = b; *a; a++, b++)
4286
    if ( tolower(*a) != tolower(*b) )
4358
    if ( tolower(*a) != tolower(*b) )
4287
      return( _FALSE );
4359
      return( _FALSE );
Lines 4469-4478 int Set; Link Here
4469
       *   process for simplicity always horizontally
4541
       *   process for simplicity always horizontally
4470
       */
4542
       */
4471
4543
4472
      /* 
4544
      /*
4473
         fprintf(ERR_STREAM,"large box: w=%d,x=%d,y=%d\n",(int)yy,(int)xx,0);
4545
         fprintf(ERR_STREAM,"large box: w=%d,x=%d,y=%d\n",(int)yy,(int)xx,0);
4474
         */
4546
         */
4475
      
4547
4476
      hor_offset  = HOR_HALF(30);
4548
      hor_offset  = HOR_HALF(30);
4477
      MoveHor(hor_offset);
4549
      MoveHor(hor_offset);
4478
      vert_offset = VERT_HALF(30);
4550
      vert_offset = VERT_HALF(30);
Lines 4547-4553 int Set; Link Here
4547
      yy += (long4)pgsiz_dots - (long4)last_ry;
4619
      yy += (long4)pgsiz_dots - (long4)last_ry;
4548
4620
4549
    if ((yy>0) && (xx>0))
4621
    if ((yy>0) && (xx>0))
4550
      EMIT4("\033*p-%ldY\033*c%lda%ldbP", 
4622
      EMIT4("\033*p-%ldY\033*c%lda%ldbP",
4551
            (long)yy - 1, (long)xx, (long)yy);
4623
            (long)yy - 1, (long)xx, (long)yy);
4552
#endif
4624
#endif
4553
    last_rx = last_ry = UNKNOWN;       /* next time full positioning */
4625
    last_rx = last_ry = UNKNOWN;       /* next time full positioning */
Lines 4708-4714 void OpenFontFile() Link Here
4708
      if ((fid = pixel_files[least_used].pixel_file_id) != NO_FILE) {
4780
      if ((fid = pixel_files[least_used].pixel_file_id) != NO_FILE) {
4709
        /* mark file as being closed in the entry */
4781
        /* mark file as being closed in the entry */
4710
        fp = hfontptr;
4782
        fp = hfontptr;
4711
        while (fp != NULL && fp->font_file_id != fid) 
4783
        while (fp != NULL && fp->font_file_id != fid)
4712
          fp = fp->next;
4784
          fp = fp->next;
4713
        if (fp == NULL)
4785
        if (fp == NULL)
4714
          Fatal("Open file %x not found in font entry list.\n", fid);
4786
          Fatal("Open file %x not found in font entry list.\n", fid);
Lines 4763-4771 void OpenFontFile() Link Here
4763
      while ((fp != NULL) && (fp->font_file_id != f))
4835
      while ((fp != NULL) && (fp->font_file_id != f))
4764
        fp = fp->next;
4836
        fp = fp->next;
4765
4837
4766
      if (fp == NULL) 
4838
      if (fp == NULL)
4767
        Fatal("Open file %x not found in font entry list.\n",f);
4839
        Fatal("Open file %x not found in font entry list.\n",f);
4768
      else 
4840
      else
4769
        fp->font_file_id = FPNULL;
4841
        fp->font_file_id = FPNULL;
4770
    }
4842
    }
4771
    BCLOSE(f);
4843
    BCLOSE(f);
Lines 4819-4831 struct font_entry *fontptr; Link Here
4819
     the resident fonts.  */
4891
     the resident fonts.  */
4820
  if (tfm_read_info(fontptr->n, &tfm_info)
4892
  if (tfm_read_info(fontptr->n, &tfm_info)
4821
      && tfm_info.family[0]
4893
      && tfm_info.family[0]
4822
      && strcmp((char *)tfm_info.family, "HPAUTOTFM") == 0) {
4894
      && EQ((char *)tfm_info.family, "HPAUTOTFM")) {
4823
    unsigned i;
4895
    unsigned i;
4824
    double factor = fontptr->s / (double)0x100000;
4896
    double factor = fontptr->s / (double)0x100000;
4825
4897
4826
    resident_count++;
4898
    resident_count++;
4827
    fontptr->resident_p = _TRUE;
4899
    fontptr->resident_p = _TRUE;
4828
    strcpy(fontptr->symbol_set, (char *)tfm_info.coding_scheme);
4900
    strncpy(fontptr->symbol_set, (char *)tfm_info.coding_scheme, 39);
4901
    fontptr->symbol_set[39] = '\0';
4829
    fontptr->resid = tfm_info.typeface_id;
4902
    fontptr->resid = tfm_info.typeface_id;
4830
    fontptr->spacing = tfm_info.spacing;
4903
    fontptr->spacing = tfm_info.spacing;
4831
    fontptr->style = tfm_info.style;
4904
    fontptr->style = tfm_info.style;
Lines 4878-4884 struct font_entry *fontptr; Link Here
4878
    fontptr->resident_p = _FALSE;
4951
    fontptr->resident_p = _FALSE;
4879
4952
4880
    if (tfm_info.family[0]
4953
    if (tfm_info.family[0]
4881
        && strcmp((char *)tfm_info.family, "UNSPECIFIED") == 0) {
4954
        && EQ((char *)tfm_info.family, "UNSPECIFIED")) {
4882
      Warning("font family for %s is UNSPECIFIED; need to run dvicopy?",
4955
      Warning("font family for %s is UNSPECIFIED; need to run dvicopy?",
4883
              fontptr->n);
4956
              fontptr->n);
4884
      fontptr->font_file_id = NO_FILE;
4957
      fontptr->font_file_id = NO_FILE;
Lines 5005-5011 long4 k; Link Here
5005
  GetBytes(dvifp, tfontptr->n, tfontptr->a + tfontptr->l);
5078
  GetBytes(dvifp, tfontptr->n, tfontptr->a + tfontptr->l);
5006
  tfontptr->n[tfontptr->a+tfontptr->l] = '\0';
5079
  tfontptr->n[tfontptr->a+tfontptr->l] = '\0';
5007
5080
5008
  tfontptr->font_mag = 
5081
  tfontptr->font_mag =
5009
    (long4)((ActualFactor((long4)(1000.0*tfontptr->s/(double)tfontptr->d+0.5))
5082
    (long4)((ActualFactor((long4)(1000.0*tfontptr->s/(double)tfontptr->d+0.5))
5010
             * ActualFactor(mag)
5083
             * ActualFactor(mag)
5011
#ifdef USEPXL
5084
#ifdef USEPXL
Lines 5031-5040 printf("[%ld]=%lf * %lf * %lf + 0.5 = %l Link Here
5031
  if (tfontptr->resident_p)
5104
  if (tfontptr->resident_p)
5032
    return;
5105
    return;
5033
5106
5034
  if (!(resident_font_located)) {
5107
  if (!(resident_font_located))
5035
#endif
5108
#endif
5036
5109
5037
#ifdef KPATHSEA
5038
    {
5110
    {
5039
      kpse_glyph_file_type font_ret;
5111
      kpse_glyph_file_type font_ret;
5040
      char *name;
5112
      char *name;
Lines 5042-5055 printf("[%ld]=%lf * %lf * %lf + 0.5 = %l Link Here
5042
        = kpse_magstep_fix ((unsigned) (tfontptr->font_mag / 5.0 + .5),
5114
        = kpse_magstep_fix ((unsigned) (tfontptr->font_mag / 5.0 + .5),
5043
                            RESOLUTION, NULL);
5115
                            RESOLUTION, NULL);
5044
      tfontptr->font_mag = dpi * 5; /* save correct dpi */
5116
      tfontptr->font_mag = dpi * 5; /* save correct dpi */
5045
      
5117
5046
      name = kpse_find_pk (tfontptr->n, dpi, &font_ret);
5118
      name = kpse_find_pk (tfontptr->n, dpi, &font_ret);
5047
      if (name)
5119
      if (name)
5048
        {
5120
        {
5049
          font_found = _TRUE;
5121
          font_found = _TRUE;
5050
          strcpy (tfontptr->name, name);
5122
          tfontptr->name = name;
5051
          free (name);
5123
          allocated_storage += strlen(name)+1;
5052
          
5124
5053
          if (!FILESTRCASEEQ (tfontptr->n, font_ret.name)) {
5125
          if (!FILESTRCASEEQ (tfontptr->n, font_ret.name)) {
5054
              fprintf (stderr,
5126
              fprintf (stderr,
5055
                       "dvilj: Font %s not found, using %s at %d instead.\n",
5127
                       "dvilj: Font %s not found, using %s at %d instead.\n",
Lines 5071-5099 printf("[%ld]=%lf * %lf * %lf + 0.5 = %l Link Here
5071
            tfontptr->n, dpi);
5143
            tfontptr->n, dpi);
5072
        }
5144
        }
5073
    }
5145
    }
5074
#else /* not KPATHSEA */
5075
    if (!(findfile(PXLpath,
5076
                   tfontptr->n,
5077
                   tfontptr->font_mag,
5078
                   tfontptr->name,
5079
                   _FALSE,
5080
                   0))) {
5081
      Warning(tfontptr->name); /* contains error messsage */
5082
      tfontptr->font_file_id = NO_FILE;
5083
#ifdef __riscos
5084
      MakeMetafontFile(PXLpath, tfontptr->n, tfontptr->font_mag);
5085
#endif
5086
    }
5087
    else {
5088
      font_found = _TRUE;
5089
      if (G_verbose)
5090
        fprintf(ERR_STREAM,"%d: using font <%s>\n", plusid, tfontptr->name);
5091
    }
5092
#endif /* not KPATHSEA */
5093
5094
#ifdef LJ_RESIDENT_FONTS
5095
  }
5096
#endif
5097
5146
5098
  tfontptr->plusid = plusid;
5147
  tfontptr->plusid = plusid;
5099
  plusid++;
5148
  plusid++;
Lines 5107-5113 printf("[%ld]=%lf * %lf * %lf + 0.5 = %l Link Here
5107
          HANDLE_MAX_FONTS);
5156
          HANDLE_MAX_FONTS);
5108
#endif
5157
#endif
5109
  if (tfontptr != pfontptr) {
5158
  if (tfontptr != pfontptr) {
5110
    if (font_found) 
5159
    if (font_found)
5111
      OpenFontFile();
5160
      OpenFontFile();
5112
    else
5161
    else
5113
      pxlfp = NO_FILE;
5162
      pxlfp = NO_FILE;
Lines 5146-5152 printf("[%ld]=%lf * %lf * %lf + 0.5 = %l Link Here
5146
    if (t == PK_PRE) {
5195
    if (t == PK_PRE) {
5147
      unsigned char   temp_byte;
5196
      unsigned char   temp_byte;
5148
      temp_byte = (unsigned char) NoSignExtend(pxlfp, 1);
5197
      temp_byte = (unsigned char) NoSignExtend(pxlfp, 1);
5149
      if (temp_byte != PK_ID) 
5198
      if (temp_byte != PK_ID)
5150
        Fatal( "Wrong Version of pk file!  (%d should be 89)\n",
5199
        Fatal( "Wrong Version of pk file!  (%d should be 89)\n",
5151
               (int)temp_byte);
5200
               (int)temp_byte);
5152
      else
5201
      else
Lines 5163-5169 printf("[%ld]=%lf * %lf * %lf + 0.5 = %l Link Here
5163
5212
5164
    tfontptr->magnification = NoSignExtend(pxlfp, 4);
5213
    tfontptr->magnification = NoSignExtend(pxlfp, 4);
5165
    tfontptr->designsize    = NoSignExtend(pxlfp, 4);
5214
    tfontptr->designsize    = NoSignExtend(pxlfp, 4);
5166
        
5215
5167
    if (tfontptr->id == id1001)
5216
    if (tfontptr->id == id1001)
5168
      FSEEK(pxlfp, (long)(NoSignExtend(pxlfp, 4) * 4), SEEK_SET);
5217
      FSEEK(pxlfp, (long)(NoSignExtend(pxlfp, 4) * 4), SEEK_SET);
5169
    else
5218
    else
Lines 5232-5238 printf("[%ld]=%lf * %lf * %lf + 0.5 = %l Link Here
5232
    hppp = NoSignExtend(pxlfp, 4);
5281
    hppp = NoSignExtend(pxlfp, 4);
5233
    vppp = NoSignExtend(pxlfp, 4);
5282
    vppp = NoSignExtend(pxlfp, 4);
5234
    if (hppp != vppp)
5283
    if (hppp != vppp)
5235
      Warning("aspect ratio is %ld:%ld (should be 1:1)!", 
5284
      Warning("aspect ratio is %ld:%ld (should be 1:1)!",
5236
              (long)hppp, (long)vppp);
5285
              (long)hppp, (long)vppp);
5237
    tfontptr->magnification = (long4)(hppp * 72.27 * 5 / 65536l + 0.5);
5286
    tfontptr->magnification = (long4)(hppp * 72.27 * 5 / 65536l + 0.5);
5238
5287
Lines 5515-5521 void SkipFontDef() Link Here
5515
{
5564
{
5516
  int     a, l;
5565
  int     a, l;
5517
  char    n[STRSIZE];
5566
  char    n[STRSIZE];
5518
  
5567
5519
  (void) NoSignExtend(dvifp, 4);
5568
  (void) NoSignExtend(dvifp, 4);
5520
  (void) NoSignExtend(dvifp, 4);
5569
  (void) NoSignExtend(dvifp, 4);
5521
  (void) NoSignExtend(dvifp, 4);
5570
  (void) NoSignExtend(dvifp, 4);
Lines 5524-5530 void SkipFontDef() Link Here
5524
  GetBytes(dvifp, n, a + l);
5573
  GetBytes(dvifp, n, a + l);
5525
}
5574
}
5526
5575
5527
    
5576
5528
5577
5529
/*------------------------ end dvifont.c -------------------------------*/
5578
/*------------------------ end dvifont.c -------------------------------*/
5530
5579
Lines 5598-5604 Warning(va_alist) Link Here
5598
#endif
5647
#endif
5599
  if ( G_nowarn || G_quiet )
5648
  if ( G_nowarn || G_quiet )
5600
    return;
5649
    return;
5601
  
5650
5602
  fprintf(ERR_STREAM, "%s: warning: ", G_progname);
5651
  fprintf(ERR_STREAM, "%s: warning: ", G_progname);
5603
  vfprintf(ERR_STREAM, fmt, args);
5652
  vfprintf(ERR_STREAM, fmt, args);
5604
  fprintf(ERR_STREAM, "\n");
5653
  fprintf(ERR_STREAM, "\n");
(-)tetex-src-3.0/texk/dviljk/dvi2xx.h (-11 / +19 lines)
Lines 10-17 Link Here
10
10
11
#ifdef KPATHSEA
11
#ifdef KPATHSEA
12
#include <kpathsea/config.h>
12
#include <kpathsea/config.h>
13
#include <kpathsea/c-std.h>
13
#include <kpathsea/c-limits.h>
14
#include <kpathsea/c-limits.h>
14
#include <kpathsea/c-memstr.h>
15
#include <kpathsea/magstep.h>
15
#include <kpathsea/magstep.h>
16
#include <kpathsea/proginit.h>
16
#include <kpathsea/proginit.h>
17
#include <kpathsea/progname.h>
17
#include <kpathsea/progname.h>
Lines 24-29 Link Here
24
#include <string.h>
24
#include <string.h>
25
#include <stdio.h>
25
#include <stdio.h>
26
#include <stdlib.h>
26
#include <stdlib.h>
27
#include <unistd.h>
27
#ifdef  unix
28
#ifdef  unix
28
#include <limits.h>
29
#include <limits.h>
29
#endif
30
#endif
Lines 41-49 Link Here
41
#ifdef MSC5
42
#ifdef MSC5
42
#include <dos.h>     /* only for binaryopen on device  */
43
#include <dos.h>     /* only for binaryopen on device  */
43
#endif
44
#endif
44
#if defined (unix) && !defined (KPATHSEA)
45
#include <limits.h>
46
#endif
47
45
48
46
49
#include "config.h"
47
#include "config.h"
Lines 116-121 Link Here
116
#define  HUGE_SIZE  (unsigned char) 2
114
#define  HUGE_SIZE  (unsigned char) 2
117
#define  HUGE_CHAR_PATTERN 32767l
115
#define  HUGE_CHAR_PATTERN 32767l
118
#define  BYTES_PER_PIXEL_LINE 500    /* max number of bytes per pixel line */
116
#define  BYTES_PER_PIXEL_LINE 500    /* max number of bytes per pixel line */
117
#define  MAX_SPECIAL_DEFPOINTS 80    /* max number of defpoint specials */
119
118
120
119
121
#define PK_POST 245
120
#define PK_POST 245
Lines 281-287 char *MFMODE = MFMODE600; Link Here
281
#define VisChar(c) (unsigned char)(c)
280
#define VisChar(c) (unsigned char)(c)
282
#endif
281
#endif
283
282
284
#define GetBytes(fp,buf,n) read_multi(buf,1,n,fp) /* used to be a function */
283
/* Used to be a function. buf is always an array, never a pointer.
284
   Without that invariant, we would have to introduce full dynamic
285
   memory management in this driver -- probably it would be easier to
286
   write a new one. [27 Jun 07 -js] */
287
#define GetBytes(fp,buf,n) \
288
    ( sizeof(buf) != sizeof(void *) && sizeof(buf) > n ? \
289
        read_multi(buf, 1, n, fp) \
290
      : Fatal("Try to read %d bytes in an array of size %d", n, sizeof(buf)) )
285
291
286
292
287
/**********************************************************************/
293
/**********************************************************************/
Lines 307-312 int printf(); Link Here
307
int     sscanf();
313
int     sscanf();
308
int     strcmp();
314
int     strcmp();
309
char   *strcpy();
315
char   *strcpy();
316
char   *strncpy();
310
#   ifdef MSC5
317
#   ifdef MSC5
311
unsigned int strlen();
318
unsigned int strlen();
312
#   endif
319
#   endif
Lines 393-399 struct font_entry { /* font entry */ Link Here
393
    char n[STRSIZE];          /* FNT_DEF command parameters                */
400
    char n[STRSIZE];          /* FNT_DEF command parameters                */
394
    long4    font_mag;         /* computed from FNT_DEF s and d parameters  */
401
    long4    font_mag;         /* computed from FNT_DEF s and d parameters  */
395
    /*char psname[STRSIZE];*/ /* PostScript name of the font               */
402
    /*char psname[STRSIZE];*/ /* PostScript name of the font               */
396
    char    name[STRSIZE];    /* full name of PXL file                     */
403
    char    *name;	       /* full name of PXL file                     */
397
    FILEPTR font_file_id;      /* file identifier (NO_FILE if none)         */
404
    FILEPTR font_file_id;      /* file identifier (NO_FILE if none)         */
398
#ifdef USEPXL
405
#ifdef USEPXL
399
    long4    magnification;    /* magnification read from PXL file          */
406
    long4    magnification;    /* magnification read from PXL file          */
Lines 487-494 void LoadAChar DVIPROTO((long4, regis Link Here
487
long4   NoSignExtend DVIPROTO((FILEPTR, int));
494
long4   NoSignExtend DVIPROTO((FILEPTR, int));
488
void    OpenFontFile DVIPROTO((void));
495
void    OpenFontFile DVIPROTO((void));
489
long4   PixRound DVIPROTO((long4, long4));
496
long4   PixRound DVIPROTO((long4, long4));
490
void    PkRaster DVIPROTO((struct char_entry *, int)); 
497
void    PkRaster DVIPROTO((struct char_entry *, int));
491
void    RasterLine DVIPROTO((struct char_entry *, unsigned int, 
498
void    RasterLine DVIPROTO((struct char_entry *, unsigned int,
492
			     unsigned int, unsigned char *));
499
			     unsigned int, unsigned char *));
493
void    RasterChar DVIPROTO((struct char_entry *));
500
void    RasterChar DVIPROTO((struct char_entry *));
494
void    ReadFontDef DVIPROTO((long4));
501
void    ReadFontDef DVIPROTO((long4));
Lines 534-544 bool LastPageSpecified = _FALSE; Link Here
534
#ifndef KPATHSEA
541
#ifndef KPATHSEA
535
char   *PXLpath = FONTAREA;
542
char   *PXLpath = FONTAREA;
536
#endif
543
#endif
537
char    G_progname[STRSIZE];     /* program name                        */
544
char   *G_progname;		 /* program name                        */
538
char    filename[STRSIZE];       /* DVI file name                       */
545
char   *filename;	         /* DVI file name                       */
539
char    rootname[STRSIZE];       /* DVI filename without extension      */
546
char   *rootname;		 /* DVI filename without extension      */
540
char   *HeaderFileName = "";     /* file name & path of Headerfile      */
547
char   *HeaderFileName = "";     /* file name & path of Headerfile      */
541
char   *EmitFileName = "";       /* file name & path for output         */
548
char   *EmitFileName = "";       /* file name & path for output         */
549
char    tmp_dir[STRSIZE] = "";	 /* temporary directory for auxilliary files */
542
#ifdef IBM3812
550
#ifdef IBM3812
543
bool    FirstAlternate = _FALSE; /* first page from alternate casette ?   */
551
bool    FirstAlternate = _FALSE; /* first page from alternate casette ?   */
544
#endif
552
#endif

Return to bug 198238