MODULE HostClipboard;
IMPORT
Texts;
CONST
Ok* = 0;
ClipboardNotAvailable* = 1;
TYPE
ClipboardHandler = PROCEDURE {DELEGATE} (text : Texts.Text);
VAR
getFromClipboard, putToClipboard : ClipboardHandler;
PROCEDURE Get*(text : Texts.Text; VAR res : LONGINT);
BEGIN {EXCLUSIVE}
ASSERT((text # NIL) & (text.HasWriteLock()));
IF (getFromClipboard # NIL) THEN
getFromClipboard(text);
res := Ok;
ELSE
res := ClipboardNotAvailable;
END;
END Get;
PROCEDURE Put*(text : Texts.Text; VAR res : LONGINT);
BEGIN {EXCLUSIVE}
ASSERT((text # NIL) & (text.HasReadLock()));
IF (putToClipboard # NIL) THEN
putToClipboard(text);
res := Ok;
ELSE
res := ClipboardNotAvailable;
END;
END Put;
PROCEDURE SetHandlers*(get, put : ClipboardHandler);
BEGIN {EXCLUSIVE}
getFromClipboard := get; putToClipboard := put;
END SetHandlers;
END HostClipboard.