plan9port

[fork] Plan 9 from user space
git clone git://src.adamsgaard.dk/plan9port # fast
git clone https://src.adamsgaard.dk/plan9port.git # slow
Log | Files | Refs | README | LICENSE Back to index

page.h (2984B)


      1 #undef pipe
      2 
      3 typedef struct Document Document;
      4 
      5 struct Document {
      6 	char *docname;
      7 	int npage;
      8 	int fwdonly;
      9 	char* (*pagename)(Document*, int);
     10 	Image* (*drawpage)(Document*, int);
     11 	int	(*addpage)(Document*, char*);
     12 	int	(*rmpage)(Document*, int);
     13 	Biobuf *b;
     14 	void *extra;
     15 	int type;
     16 };
     17 
     18 typedef struct Graphic	Graphic;
     19 
     20 struct Graphic {
     21 	int type;
     22 	int fd;
     23 	char *name;
     24 };
     25 
     26 enum {
     27 	Ipic,
     28 	Itiff,
     29 	Ijpeg,
     30 	Igif,
     31 	Iinferno,
     32 	Ifax,
     33 	Icvt2pic,
     34 	Iplan9bm,
     35 	Ippm,
     36 	Ipng,
     37 	Iyuv,
     38 	Ibmp,
     39 };
     40 
     41 enum {
     42 	Tgfx,
     43 	Tpdf,
     44 	Tps,
     45 }
     46 ;
     47 
     48 void *emalloc(int);
     49 void *erealloc(void*, int);
     50 char *estrdup(char*);
     51 int spawncmd(char*, char **, int, int, int);
     52 
     53 int spooltodisk(uchar*, int, char**);
     54 int stdinpipe(uchar*, int);
     55 Document *initps(Biobuf*, int, char**, uchar*, int);
     56 Document *initpdf(Biobuf*, int, char**, uchar*, int);
     57 Document *initgfx(Biobuf*, int, char**, uchar*, int);
     58 Document *inittroff(Biobuf*, int, char**, uchar*, int);
     59 Document *initdvi(Biobuf*, int, char**, uchar*, int);
     60 Document *initmsdoc(Biobuf*, int, char**, uchar*, int);
     61 
     62 void viewer(Document*);
     63 extern Cursor reading;
     64 extern int chatty;
     65 extern int goodps;
     66 extern int textbits, gfxbits;
     67 extern int reverse;
     68 extern int clean;
     69 extern int ppi;
     70 extern int teegs;
     71 extern int truetoboundingbox;
     72 extern int wctlfd;
     73 extern int resizing;
     74 extern int mknewwindow;
     75 extern int fitwin;
     76 
     77 void rot180(Image*);
     78 Image *rot90(Image*);
     79 Image *rot270(Image*);
     80 Image *resample(Image*, Image*);
     81 
     82 /* ghostscript interface shared by ps, pdf */
     83 typedef struct GSInfo	GSInfo;
     84 typedef struct PDFInfo	PDFInfo;
     85 typedef struct Page	Page;
     86 typedef struct PSInfo	PSInfo;
     87 struct GSInfo {
     88 	Graphic g;
     89 	int gsfd;
     90 	Biobuf gsrd;
     91 	int gspid;
     92 	int ppi;
     93 };
     94 struct PDFInfo {
     95 	GSInfo gs;
     96 	Rectangle *pagebbox;
     97 };
     98 struct Page {
     99 	char *name;
    100 	int offset;			/* offset of page beginning within file */
    101 };
    102 struct PSInfo {
    103 	GSInfo gs;
    104 	Rectangle bbox;	/* default bounding box */
    105 	Page *page;
    106 	int npage;
    107 	int clueless;	/* don't know where page boundaries are */
    108 	long psoff;	/* location of %! in file */
    109 	char ctm[256];
    110 };
    111 
    112 void	waitgs(GSInfo*);
    113 int	gscmd(GSInfo*, char*, ...);
    114 int	spawngs(GSInfo*, char*);
    115 void	setdim(GSInfo*, Rectangle, int, int);
    116 int	spawnwriter(GSInfo*, Biobuf*);
    117 Rectangle	screenrect(void);
    118 void	newwin(void);
    119 void	zerox(void);
    120 Rectangle winrect(void);
    121 void	resize(int, int);
    122 int	max(int, int);
    123 int	min(int, int);
    124 void	wexits(char*);
    125 Image*	xallocimage(Display*, Rectangle, ulong, int, ulong);
    126 int	bell(void*, char*);
    127 Image*	convert(Graphic *g);
    128 Image*	cachedpage(Document*, int, int);
    129 void	cacheflush(void);
    130 void   fit(void);
    131 
    132 extern char tempfile[40];
    133 
    134 extern int stdinfd;
    135 extern int truecolor;
    136 
    137 
    138 /* BUG BUG BUG BUG BUG: cannot use new draw operations in drawterm,
    139  * or in vncs, and there is a bug in the kernel for copying images
    140  * from cpu memory -> video memory (memmove is not being used).
    141  * until all that is settled, ignore the draw operators.
    142  */
    143 #define drawop(a,b,c,d,e,f) draw(a,b,c,d,e)
    144 #define gendrawop(a,b,c,d,e,f,g) gendraw(a,b,c,d,e,f)