ref: 34238e0feb181a0c120561486d4c86b054d112bc
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 { u32int id; u16int 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; u16int gen; }; Pdf *pdfopen(int fd); void pdfclose(Pdf *pdf); /* * General function to parse an object of any type. */ 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); /* * If the object is indirect, resolve it. Operation is not recursive, ie * values of a dictionary won't be resolved automatically. */ int pdfeval(Pdf *pdf, Object *o); int isws(char c); int isdelim(char c);