Plan 9 from Bell Labs’s /usr/web/sources/contrib/nemo/octopus/module/tblks.m

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


Tblks: module {
	PATH:	con "/dis/o/tblks.dis";

	Maxline:	con 250;		# after so many runes, we consider it a text line.

	Str:	adt {
		s: string;
		findr:	fn(s: self ref Str, pos: int, c: int, lim: int): int;
		find:		fn(s: self ref Str, pos: int, c: int, lim: int): int;
	};

	Blks:	adt {
		b:		array of ref Str;
		new:		fn(s: string): ref Blks;
		pack:	fn(blks: self ref Blks): ref Str;
		ins:		fn(blks: self ref Blks, s: string, pos: int);
		del:		fn(blks: self ref Blks, n: int, pos: int): string;
		seek:	fn(blks: self ref Blks, pos: int): (int, int);		# (index in b, off in Str)
		blen:		fn(blks: self ref Blks): int;
		getc:		fn(blks: self ref Blks, pos: int): int;
		gets:		fn(blks: self ref Blks, pos: int, nr: int): string;
		dump:	fn(blks: self ref Blks);
	};

	init:			fn(sysm: Sys, strm: String, e: Error, dbg: int);
	fixpos:		fn(pos: int, n: int): int;
	fixposins:		fn(pos: int, inspos: int, n: int): int;
	fixposdel:		fn(pos: int, delpos: int, n: int): int;
	strstr:		fn(s1, s2: string): int;
	strchr:		fn(s : string, c : int) : int;
	dtxt:			fn(s: string): string;
};

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.