plan9fox/sys/src/cmd/mothra/mothra.h

110 lines
2.2 KiB
C
Raw Normal View History

2011-09-04 17:16:30 +00:00
enum{
NWWW=64, /* # of pages we hold in the log */
NXPROC=5, /* # of parallel procs loading the pix */
NPIXMB=8, /* megabytes of image data to keep arround */
2011-09-04 17:16:30 +00:00
NNAME=512,
NLINE=256,
NAUTH=128,
NTITLE=81, /* length of title (including nul at end) */
NLABEL=50, /* length of option name in forms */
NREDIR=10, /* # of redirections we'll tolerate before declaring a loop */
};
typedef struct Action Action;
typedef struct Url Url;
typedef struct Www Www;
typedef struct Field Field;
struct Action{
char *image;
Field *field;
char *link;
char *name;
int ismap;
int width;
int height;
};
struct Url{
char *basename;
char *reltext;
2011-09-04 17:16:30 +00:00
char fullname[NNAME];
char tag[NNAME];
char contenttype[NNAME];
int map; /* is this an image map? */
2011-09-04 17:16:30 +00:00
};
struct Www{
Url *url;
void *pix;
void *form;
char title[NTITLE];
Rtext *text;
int yoffs;
int gottitle; /* title got drawn */
2011-09-04 17:16:30 +00:00
int changed; /* reader sets this every time it updates page */
int finished; /* reader sets this when done */
int alldone; /* page will not change further -- used to adjust cursor */
};
enum{
PLAIN,
2011-09-04 17:16:30 +00:00
HTML,
GIF,
2011-09-04 17:16:30 +00:00
JPEG,
PNG,
BMP,
ICO,
PAGE,
2011-09-04 17:16:30 +00:00
};
/*
* authentication types
*/
enum{
ANONE,
ABASIC,
};
Image *hrule, *bullet, *linespace;
int chrwidth; /* nominal width of characters in font */
Panel *text; /* Panel displaying the current www page */
int debug; /* command line flag */
/*
* HTTP methods
*/
enum{
GET=1,
POST,
};
void finish(Www *w);
void plrdhtml(char *, int, Www *, int);
2011-09-04 17:16:30 +00:00
void plrdplain(char *, int, Www *);
void htmlerror(char *, int, char *, ...); /* user-supplied routine */
void seturl(Url *, char *, char *);
2015-08-01 11:06:24 +00:00
void freeurl(Url *);
Url *selurl(char *);
2011-09-04 17:16:30 +00:00
void getpix(Rtext *, Www *);
ulong countpix(void *p);
void freepix(void *p);
void dupfds(int fd, ...);
int pipeline(int fd, char *fmt, ...);
2011-09-04 17:16:30 +00:00
void getfonts(void);
void *emalloc(int);
2012-04-03 17:03:44 +00:00
void nstrcpy(char *to, char *from, int len);
void freeform(void *p);
2012-06-18 06:00:36 +00:00
int Ufmt(Fmt *f);
#pragma varargck type "U" char*
2011-09-04 17:16:30 +00:00
void message(char *, ...);
int filetype(int, char *, int);
int mimetotype(char *);
int snooptype(int);
2011-09-04 17:16:30 +00:00
void mkfieldpanel(Rtext *);
void geturl(char *, int, int, int);
2015-08-01 11:06:24 +00:00
char *urlstr(Url *);
int urlpost(Url*, char*);
int urlget(Url*, int);
int urlresolve(Url *);
Mouse mouse;