XlCutBuffersImpl.mesa
Copyright Ó 1991 by Xerox Corporation. All rights reserved.
Christian Jacobi, March 21, 1991 10:07 am PST
Christian Jacobi, March 21, 1991 11:33 am PST
DIRECTORY
Atom, Rope, Xl, XlCutBuffers, XlCutBuffersBackdoor, XlConventions;
XlCutBuffersImpl: CEDAR MONITOR
IMPORTS Atom, XlConventions
EXPORTS XlCutBuffers, XlCutBuffersBackdoor
~ BEGIN OPEN Atom, Xl, XlCutBuffers, XlCutBuffersBackdoor;
puts, gets: Atom.PropList ¬ NIL;
RegisterGetProc: PUBLIC PROC [convention: ATOM, get: GetProc] = {
IF get#NIL THEN
gets ¬ Atom.PutPropOnList[gets, convention, NEW[GetProc ¬ get]];
};
RegisterPutProc: PUBLIC PROC [convention: ATOM, put: PutProc] = {
IF put#NIL THEN
puts ¬ Atom.PutPropOnList[puts, convention, NEW[PutProc ¬ put]];
};
Get: PUBLIC PROC [c: Connection, convention: ATOM ¬ NIL] RETURNS [ROPE¬NIL] = {
GetGet: PROC [convention: ATOM] RETURNS [GetProc ¬ NIL] = {
WITH Atom.GetPropFromList[gets, convention] SELECT FROM
refGet: REF GetProc => RETURN [refGet­];
ENDCASE => {}
};
get: GetProc ¬ GetGet[convention];
IF get=NIL THEN get ¬ GetGet[NIL];
IF get#NIL THEN RETURN [get[c, convention]];
};
Put: PUBLIC PROC [c: Connection, data: ROPE, convention: ATOM ¬ NIL] = {
GetPut: PROC [convention: ATOM] RETURNS [PutProc ¬ NIL] = {
WITH Atom.GetPropFromList[puts, convention] SELECT FROM
refPut: REF PutProc => RETURN [refPut­];
ENDCASE => {}
};
put: PutProc ¬ GetPut[convention];
IF put=NIL THEN put ¬ GetPut[NIL];
IF put#NIL THEN put[c, data, convention];
};
OldCutBufferPut: PutProc = {
XlConventions.CutBufferPush[c, data];
};
OldCutBufferGet: GetProc = {
RETURN [XlConventions.CutBufferGet[c]];
};
Init: PROC [] = {
RegisterPutProc[NIL, OldCutBufferPut];
RegisterPutProc[$CutBuffer0, OldCutBufferPut];
RegisterGetProc[NIL, OldCutBufferGet];
RegisterGetProc[$CutBuffer0, OldCutBufferGet];
};
Init[];
END.