Plan 9 from Bell Labs’s /usr/web/sources/contrib/nemo/octopus/port/mero/mpanel.m

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


# o/mero definitions.

Panels: module {

	PATH: con "/dis/o/mpanel.dis";

	Tappl, Trepl: con iota;	# Application and viewer trees

	# Common panel attributes. Individual panels may add more.
	Atag,	# show its tag
	Ashow,	# shown in viewer (not hidden)
	Aappl,	# created by application [id [pid]]
	Amax: con iota;

	# One per actual panel.
	# while the panel should be kept alive.
	Panel: adt {
		id:		int;		# unique panel identifier
		aid:		int;		# id supplied by user to appl
		pid:		int;		# process id, when supplied by appl.
		name:	string;
		impl:		Pimpl;	# implementor
		container:	int;		# true for container

		data:		array of byte;
		vers:		int;		# qid.vers for data
		image:	array of byte;
		repl:		array of ref Repl;
		nrepl:	int;

		ok:		fn(p: self ref Panel);
		text:		fn(p: self ref Panel) : string;

		new:		fn(name: string): ref Panel;
		lookup:	fn(id: int, rid: int): (ref Panel, ref Repl);
		newrepl:	fn(p: self ref Panel, path: string, t: int): ref Repl;
		close:	fn(p: self ref Panel);
		closerepl:	fn(p: self ref Panel, r: ref Repl);
		vpost:	fn(p: self ref Panel, excl: ref Repl, ev: string);		# changes to viewer
		post:		fn(p: self ref Panel, ev: string);					# event to appl.
		put:		fn(p: self ref Panel, data: array of byte, off: big): (int, string);
		putimage:	fn(p: self ref Panel, data: array of byte, off: big): (int, string);
		newdata:	fn(p: self ref Panel): string;
		ctl:		fn(r: self ref Panel, r: ref Repl, attr: string): (int, string); # (update, err)
		ctlstr:	fn(r: self ref Panel, r: ref Repl): string;

	};

	# One per replica, including the original application panel.
	# Referenced from files referring to the replica.
	# Released when the first file drops its reference to it.
	Repl: adt {
		id:		int;			# position in p.repl array
		pos:		int;			# position in parent container
		vers:		int;			# qid.vers for panel ctl
		tree:		int;			# Tappl or Trepl
		path:		string;
		dirq:		big;
		dirvers:	int;			# qid.vers for panel directory
		attrs:		array of string;

		post:		fn(r: self ref Repl, pid: int, ev: string);	# event to viewer
	};

	init:		fn(dat: Dat, dir: string);
	dump:	fn();

	mkqid:	fn(id, rid, t: int): big;
	qid2ids:	fn(q: big): (int, int, int);
};

# Panel implementation. Provided by panel modules loaded just
# to check out that updates made by the user are correct and
# to learn of new panel types.
Pimpl: module {
	init:		fn(d: Dat): list of string;
	pinit:		fn(p: ref Panels->Panel);
	rinit:		fn(p: ref Panels->Panel, r: ref Panels->Repl);
	newdata:	fn(p: ref Panels->Panel): string;
	ctl:		fn(p: ref Panels->Panel, r: ref Panels->Repl, ctl: list of string): (int, string); #upd., err
};


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].