Subversion Repositories wimsdev

Rev

Rev 8185 | 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 "../Lib/libwims.h"
  32.  
  33. /*#define MAX_LINELEN           16383 */
  34. #define FILE_LENGTH_LIMIT       (1*1024*1024)
  35. #define DVI_STACK_LIMIT         1024
  36. #define FONT_NUMBER_LIMIT       1024
  37. #define CHAR_NUMBER_LIMIT       256
  38. #define IMAGE_SIZE_LIMIT        (4*1024*1024)
  39. #define MAX_FONT_X              1024
  40. #define MAX_FONT_Y              1024
  41. #define MAX_PAGES               4096
  42.  
  43. typedef struct {
  44.     short int xstart, xmax, ystart, ymax;
  45.     long int w, start;
  46. } FONTHEADER;
  47.  
  48. typedef struct {
  49.     int checksum,designsize,bc,ec,cnt,num;
  50.     FONTHEADER *fh;
  51.     char *data;
  52.     char *cache;
  53. } FONT;
  54. /* from texgif.c */
  55. extern char *progname,*tmpdir,*fontdir,*headerfile,*texstyle,*outfile, cwd[1024];
  56. extern double blacker;
  57. extern int basedensity, density, compressratio, wrapexec, currentcolor, fontcnt;
  58. extern FONT wfont[FONT_NUMBER_LIMIT];
  59. /* from basic.c */
  60. void texgif_error(char *s);
  61. int call_sh(char *s,...);
  62. int getfile(char *fname, unsigned char **buf);
  63. unsigned long int texint(void *bp, int l);
  64. long int texintsigned(void *bp, int l);
  65. int execredirected(char *cmdf, char *inf, char *outf, char *errf, char *arg[]);
  66.  
  67. /* from colors.c */
  68. extern struct colors{
  69.         char *name;
  70.         int r,g,b;
  71. } colors[];
  72. extern int colorno;
  73.  
  74. /* from tfm.c */
  75. extern struct tfm {
  76.     int bc, ec;
  77.     int checksum, designsize;
  78.     struct f {
  79.         int32_t w,h,d;
  80.     } f[256];
  81. } tfm;
  82.  
  83. extern short int tfmhd[12];
  84. void loadtfm(char *fname);
  85.  
  86. /* from gf.c */
  87. void loadgf(char *fname, int density);
  88. void makegf(char *fontname, int density);
  89. void gf2font(char *fontname,int density);
  90.  
  91. /* from font.c */
  92. FONT *loadfont(char *fname, int checksum, int density, FONT *ft);
  93.  
  94. /* from image.c */
  95. void createimage(int xsize, int ysize);
  96. void saveimage();
  97. void makecolor(char *p);
  98. int paintfont(FONT *f, int ch, int x, int y, int color);
  99. extern gdImagePtr image;
  100. extern int color_white, color_black, color_bounder;
  101.  
  102. /* from dvi.c */
  103. void dvi(void);
  104.