Subversion Repositories wimsdev

Rev

Rev 8103 | Rev 8185 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. /*    Copyright (C) 2002-2003 XIAO, Gang of Universite de Nice - Sophia Antipolis
  2.  *
  3.  *  This program is free software; you can redistribute it and/or modify
  4.  *  it under the terms of the GNU General Public License as published by
  5.  *  the Free Software Foundation; either version 2 of the License, or
  6.  *  (at your option) any later version.
  7.  *
  8.  *  This program is distributed in the hope that it will be useful,
  9.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11.  *  GNU General Public License for more details.
  12.  *
  13.  *  You should have received a copy of the GNU General Public License
  14.  *  along with this program; if not, write to the Free Software
  15.  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16.  */
  17.  
  18. /* dvi 2 gif driver, header file */
  19.  
  20. #include <stdio.h>
  21. #include <stdlib.h>
  22. #include <stdarg.h>
  23. #include <string.h>
  24. #include <math.h>
  25. #include <unistd.h>
  26. #include <sys/types.h>
  27. #include <sys/stat.h>
  28. #include <sys/wait.h>
  29. #include <ctype.h>
  30. #include <gd.h>
  31. #include "config.h"
  32. #include "../Lib/libwims.h"
  33.  
  34. /*#define MAX_LINELEN           16383 */
  35. #define FILE_LENGTH_LIMIT       (1*1024*1024)
  36. #define DVI_STACK_LIMIT         1024
  37. #define FONT_NUMBER_LIMIT       1024
  38. #define CHAR_NUMBER_LIMIT       256
  39. #define IMAGE_SIZE_LIMIT        (4*1024*1024)
  40. #define MAX_FONT_X              1024
  41. #define MAX_FONT_Y              1024
  42. #define MAX_PAGES               4096
  43.  
  44. typedef struct {
  45.     short int xstart, xmax, ystart, ymax;
  46.     long int w, start;
  47. } FONTHEADER;
  48.  
  49. typedef struct {
  50.     int checksum,designsize,bc,ec,cnt,num;
  51.     FONTHEADER *fh;
  52.     char *data;
  53.     char *cache;
  54. } FONT;
  55. /* from texgif.c */
  56. extern char *progname,*tmpdir,*fontdir,*headerfile,*texstyle,*outfile, cwd[1024];
  57. extern double blacker;
  58. extern int basedensity, density, compressratio, wrapexec, currentcolor, fontcnt;
  59. extern FONT wfont[FONT_NUMBER_LIMIT];
  60. /* from basic.c */
  61. void error(char *s);
  62. int call_sh(char *s,...);
  63. int getfile(char *fname, unsigned char **buf);
  64. unsigned long int texint(void *bp, int l);
  65. long int texintsigned(void *bp, int l);
  66. int execredirected(char *cmdf, char *inf, char *outf, char *errf, char *arg[]);
  67.  
  68. /* from colors.c */
  69. extern struct colors{
  70.         char *name;
  71.         int r,g,b;
  72. } colors[];
  73. extern int colorno;
  74.  
  75. /* from tfm.c */
  76. extern struct tfm {
  77.     int bc, ec;
  78.     int checksum, designsize;
  79.     struct f {
  80.         int32_t w,h,d;
  81.     } f[256];
  82. } tfm;
  83.  
  84. extern short int tfmhd[12];
  85. void loadtfm(char *fname);
  86.  
  87. /* from gf.c */
  88. void loadgf(char *fname, int density);
  89. void makegf(char *fontname, int density);
  90. void gf2font(char *fontname,int density);
  91.  
  92. /* from font.c */
  93. FONT *loadfont(char *fname, int checksum, int density, FONT *ft);
  94.  
  95. /* from image.c */
  96. void createimage(int xsize, int ysize);
  97. void saveimage();
  98. void makecolor(char *p);
  99. int paintfont(FONT *f, int ch, int x, int y, int color);
  100. extern gdImagePtr image;
  101. extern int color_white, color_black, color_bounder;
  102.  
  103. /* from dvi.c */
  104. void dvi(void);
  105.