shithub: pdffs

ref: 73b21f1bdadc28eddee84ae0a4c70f7ec3bd29ed
dir: /pdf.h/

View raw version
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 Object Object;

struct Object {
	int type;
	union {
		int bool;
		double num;
		char *str;
		struct {
			int id;
			int gen;
		}indir;
	};
};

/*
 * 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);