xref: /inferno-os/module/xml.m (revision 6e425a9de8c003b5a733621a6b6730ec3cc902b8)
146439007SCharles.ForsythXml: module {
246439007SCharles.Forsyth	PATH: con "/dis/lib/xml.dis";
346439007SCharles.Forsyth	Item: adt {
446439007SCharles.Forsyth		fileoffset:	int;
546439007SCharles.Forsyth		pick {
646439007SCharles.Forsyth		Tag =>
746439007SCharles.Forsyth			name:	string;
846439007SCharles.Forsyth			attrs:		Attributes;
946439007SCharles.Forsyth		Text =>
1046439007SCharles.Forsyth			ch:		string;
1146439007SCharles.Forsyth			ws1, ws2: int;
1246439007SCharles.Forsyth		Process =>
1346439007SCharles.Forsyth			target:	string;
1446439007SCharles.Forsyth			data:		string;
1546439007SCharles.Forsyth		Doctype =>
1646439007SCharles.Forsyth			name:	string;
1746439007SCharles.Forsyth			public:	int;
1846439007SCharles.Forsyth			params:	list of string;
1946439007SCharles.Forsyth		Stylesheet =>
2046439007SCharles.Forsyth			attrs:		Attributes;
2146439007SCharles.Forsyth		Error =>
2246439007SCharles.Forsyth			loc:		Locator;
2346439007SCharles.Forsyth			msg:		string;
2446439007SCharles.Forsyth		}
2546439007SCharles.Forsyth	};
2646439007SCharles.Forsyth
2746439007SCharles.Forsyth	Locator: adt {
2846439007SCharles.Forsyth		line:				int;
2946439007SCharles.Forsyth		systemid:			string;
3046439007SCharles.Forsyth		publicid:			string;
3146439007SCharles.Forsyth	};
3246439007SCharles.Forsyth
3346439007SCharles.Forsyth	Attribute: adt {
3446439007SCharles.Forsyth		name:			string;
3546439007SCharles.Forsyth		value:			string;
3646439007SCharles.Forsyth	};
3746439007SCharles.Forsyth
3846439007SCharles.Forsyth	Attributes: adt {
3946439007SCharles.Forsyth		attrs:			list of Attribute;
4046439007SCharles.Forsyth
4146439007SCharles.Forsyth		all:			fn(a: self Attributes): list of Attribute;
4246439007SCharles.Forsyth		get:			fn(a: self Attributes, name: string): string;
4346439007SCharles.Forsyth	};
4446439007SCharles.Forsyth
4546439007SCharles.Forsyth	Mark: adt {
4646439007SCharles.Forsyth		estack:	list of string;
4746439007SCharles.Forsyth		line:		int;
4846439007SCharles.Forsyth		offset:	int;
4946439007SCharles.Forsyth		readdepth:	int;
5046439007SCharles.Forsyth
5146439007SCharles.Forsyth		str:		fn(m: self ref Mark): string;
5246439007SCharles.Forsyth	};
5346439007SCharles.Forsyth
5446439007SCharles.Forsyth	Parser: adt {
5546439007SCharles.Forsyth		in:		ref Bufio->Iobuf;
5646439007SCharles.Forsyth		eof:		int;
5746439007SCharles.Forsyth		lastnl:	int;
5846439007SCharles.Forsyth		estack:	list of string;
5946439007SCharles.Forsyth		loc:		Locator;
6046439007SCharles.Forsyth		warning:	chan of (Locator, string);
6146439007SCharles.Forsyth		errormsg:	string;
6246439007SCharles.Forsyth		actdepth:	int;
6346439007SCharles.Forsyth		readdepth:	int;
6446439007SCharles.Forsyth		fileoffset:	int;
6546439007SCharles.Forsyth		preelem:	string;
6646439007SCharles.Forsyth		ispre:	int;
6746439007SCharles.Forsyth
6846439007SCharles.Forsyth		next:		fn(p: self ref Parser): ref Item;
6946439007SCharles.Forsyth		up:		fn(p: self ref Parser);
7046439007SCharles.Forsyth		down:	fn(p: self ref Parser);
7146439007SCharles.Forsyth		mark:	fn(p: self ref Parser): ref Mark;
7246439007SCharles.Forsyth		atmark:	fn(p: self ref Parser, m: ref Mark): int;
7346439007SCharles.Forsyth		goto:	fn(p: self ref Parser, m: ref Mark);
7446439007SCharles.Forsyth		str2mark:	fn(p: self ref Parser, s: string): ref Mark;
7546439007SCharles.Forsyth	};
7646439007SCharles.Forsyth	init:	fn(): string;
7746439007SCharles.Forsyth	open: fn(f: string, warning: chan of (Locator, string), preelem: string): (ref Parser, string);
78*6e425a9dSCharles.Forsyth	fopen:	fn(f: ref Bufio->Iobuf, srcname: string, warning: chan of (Locator, string), preelem: string): (ref Parser, string);
7946439007SCharles.Forsyth};
80