Tundo: module {
PATH: con "/dis/o/tundo.dis";
Edit: adt {
synced: int;
pos: int; # where to insert/delete
pick {
Ins =>
s: string; # text inserted
Del =>
s: string; # text removed
}
};
Edits: adt {
e: array of ref Edit; # edit operations
pos: int; # where to put next (ongoing) edit in e
cpos: int; # postition in e for a clean edit (current on disk)
new: fn(): ref Edits;
ins: fn(edits: self ref Edits, s: string, pos: int): int;
del: fn(edits: self ref Edits, s: string, pos: int): int;
sync: fn(edits: self ref Edits): list of ref Edit;
undo: fn(edits: self ref Edits): ref Edit;
redo: fn(edits: self ref Edits): ref Edit;
mkpos: fn(edits: self ref Edits): int;
dump: fn(edits: self ref Edits);
};
init: fn(sysm: Sys, e: Error, dbg: int);
dtxt: fn(s: string): string;
};
|