ref: 3c27f041321b91dbf2bfd0ab9e4865e03854cd68
dir: /pdf.h/
enum { Obool, /* 7.3.2 */ Onum, /* 7.3.3 */ Ostr, /* 7.3.4 */ Oname, /* 7.3.5 */ Oarray, /* 7.3.6 */ Odict, /* 7.3.7 */ Ostream, /* 7.3.8 */ Onull, /* 7.3.9 */ Oindir, /* 7.3.10 */ }; typedef struct KeyValue KeyValue; typedef struct Object Object; typedef struct Pdf Pdf; typedef struct Xref Xref; struct Object { int type; union { int bool; double num; char *str; char *name; struct { int id; int gen; }indir; struct { KeyValue *kv; int nkv; }dict; struct { Object **e; int ne; }array; }; }; struct KeyValue { char *key; Object *value; }; struct Pdf { void *bio; Xref *xref; int nxref; /* 7.5.4 xref subsection number of objects */ Object *root; /* 7.5.5 root object */ Object *info; /* 7.5.5 info dictionary */ }; struct Xref { u32int id; u32int off; }; Pdf *pdfopen(int fd); void pdfclose(Pdf *pdf); Object *pdfobject(char *p, char **e, int len); void freeobject(Object *o); /* * 7.3.4 String Objects * * Rewrites the string in place with null termination and returns the * length in bytes, without the null terminator. * Returns < 0 if parsing failed. * (*e) is advanced to the position after the string pointed by (p). */ int pdfstring(char *p, char **e, int len); /* * 7.3.5 Name Objects * * Works the same way as pdfstring, but for name objects. */ int pdfname(char *p, char **e, int len); /* * 7.3.6 Array Objects */ Object *pdfarray(char *p, char **e, int len); /* * 7.3.7 Dictionary Objects */ Object *pdfdict(char *p, char **e, int len); int isws(char c); int isdelim(char c);