shithub: rtmp

ref: 7d4898f6656fd7c060bb27c0b10d6735a1f76337
dir: /amf0.h/

View raw version
enum {
	Tnull,
	Tstr,
	Tnum,
	Tbool,
	Tarr,
	Tobj,
};

typedef struct A₀ A₀;

struct A₀ {
	int type;
	union {
		char *str;
		double num;
		u8int bool;
		struct {
			A₀ **v;
			int n;
		}arr;
		struct {
			char **k;
			A₀ **v;
			int n;
		}obj;
	};
};

u8int *a₀null(u8int *p, u8int *e);
u8int *a₀i16(u8int *p, u8int *e, s16int i);
u8int *a₀bool(u8int *p, u8int *e, int v);
u8int *a₀byte(u8int *p, u8int *e, u8int byte);
u8int *a₀i24(u8int *p, u8int *e, s32int i);
u8int *a₀i32(u8int *p, u8int *e, s32int i);
u8int *a₀i32le(u8int *p, u8int *e, s32int i);
u8int *a₀num(u8int *p, u8int *e, double v);
u8int *a₀str(u8int *p, u8int *e, char *s);
u8int *a₀arr(u8int *p, u8int *e);
u8int *a₀obj(u8int *p, u8int *e);
u8int *a₀end(u8int *p, u8int *e);
u8int *a₀kvnum(u8int *p, u8int *e, char *name, double v);
u8int *a₀kvstr(u8int *p, u8int *e, char *name, char *v);
u8int *a₀kvbool(u8int *p, u8int *e, char *name, int v);
u8int *a₀data(u8int *p, u8int *e, u8int *d, int sz);

u8int *a₀byteget(u8int *p, u8int *e, u8int *byte);
u8int *a₀i16get(u8int *p, u8int *e, s16int *i);
u8int *a₀i24get(u8int *p, u8int *e, s32int *i);
u8int *a₀i32get(u8int *p, u8int *e, s32int *i);
u8int *a₀i32leget(u8int *p, u8int *e, s32int *i);

u8int *a₀parse(A₀ **a, u8int *p, u8int *e);
void a₀free(A₀ *a);

#pragma varargck type "A" A₀*
int a₀fmt(Fmt *f);