<> <> <> <> <> DIRECTORY PrincOps, PrincOpsUtils, Rope, RopeEditingBLT; RopeEditingBLTImpl: CEDAR PROGRAM IMPORTS PrincOpsUtils EXPORTS RopeEditingBLT = BEGIN OPEN RopeEditingBLT; ArrayToArrayBlt: PUBLIC PROC [ from: REF READONLY CharsArray, fromLoc: NAT, to: REF CharsArray, toLoc: NAT, nChars: NAT] = { nLeft: NAT; IF nChars=0 THEN RETURN; nLeft _ nChars-1; to[toLoc+nLeft] _ from[fromLoc+nLeft]; -- bounds check MyByteBlt[to:[to,toLoc], from:[from,fromLoc], nBytes:nLeft]; }; ArrayToTextBlt: PUBLIC PROC [ from: REF READONLY CharsArray, fromLoc: NAT, to: Text, toLoc: NAT, nChars: NAT] = { nLeft: NAT; IF nChars=0 THEN RETURN; nLeft _ nChars-1; to[toLoc+nLeft] _ from[fromLoc+nLeft]; -- bounds check MyByteBlt[to:[to,toLoc+TextCharOffset], from:[from,fromLoc], nBytes:nLeft]; }; ArrayToStringBlt: PUBLIC PROC [ from: REF READONLY CharsArray, fromLoc: NAT, to: String, toLoc: NAT, nChars: NAT] = { nLeft: NAT; IF nChars=0 THEN RETURN; nLeft _ nChars-1; to[toLoc+nLeft] _ from[fromLoc+nLeft]; -- bounds check MyByteBlt[to:[to,toLoc+StringCharOffset], from:[from,fromLoc], nBytes:nLeft]; }; TextToArrayBlt: PUBLIC PROC [ from: Text, fromLoc: NAT, to: REF CharsArray, toLoc: NAT, nChars: NAT] = { nLeft: NAT; IF nChars=0 THEN RETURN; nLeft _ nChars-1; to[toLoc+nLeft] _ from[fromLoc+nLeft]; -- bounds check MyByteBlt[to:[to,toLoc], from:[from,fromLoc+TextCharOffset], nBytes:nLeft]; }; StringToArrayBlt: PUBLIC PROC [ from: REF READONLY TEXT, fromLoc: NAT, to: REF CharsArray, toLoc: NAT, nChars: NAT] = { nLeft: NAT; IF nChars=0 THEN RETURN; nLeft _ nChars-1; to[toLoc+nLeft] _ from[fromLoc+nLeft]; -- bounds check MyByteBlt[to:[to,toLoc], from:[from,fromLoc+StringCharOffset], nBytes:nLeft]; }; TextToTextBlt: PUBLIC PROC [ from: Text, fromLoc: NAT, to: Text, toLoc: NAT, nChars: NAT] = { nLeft: NAT; IF nChars=0 THEN RETURN; nLeft _ nChars-1; to[toLoc+nLeft] _ from[fromLoc+nLeft]; -- bounds check MyByteBlt[to:[to,toLoc+TextCharOffset], from:[from,fromLoc+TextCharOffset], nBytes:nLeft]; }; TextToStringBlt: PUBLIC PROC [ from: Text, fromLoc: NAT, to: String, toLoc: NAT, nChars: NAT] = { nLeft: NAT; IF nChars=0 THEN RETURN; nLeft _ nChars-1; to[toLoc+nLeft] _ from[fromLoc+nLeft]; -- bounds check MyByteBlt[to:[to,toLoc+StringCharOffset], from:[from,fromLoc+TextCharOffset], nBytes:nLeft]; }; StringToStringBlt: PUBLIC PROC [ from: REF READONLY TEXT, fromLoc: NAT, to: String, toLoc: NAT, nChars: NAT] = { nLeft: NAT; IF nChars=0 THEN RETURN; nLeft _ nChars-1; to[toLoc+nLeft] _ from[fromLoc+nLeft]; -- bounds check MyByteBlt[to:[to,toLoc+StringCharOffset], from:[from,fromLoc+StringCharOffset], nBytes:nLeft]; }; ByteBlock: TYPE = RECORD [block: REF ANY, startIndex: NAT]; ROByteBlock: TYPE = RECORD [block: REF READONLY ANY, startIndex: NAT]; StringCharOffset: NAT = SIZE[TEXT[0]]*2; TextCharOffset: NAT = SIZE[Rope.TextRep[0]]*2; MyByteBlt: PROC [to: ByteBlock, from: ROByteBlock, nBytes: NAT] = TRUSTED INLINE { eTo, eFrom: PrincOps.ByteBltBlock; IF nBytes=0 THEN RETURN; eTo.blockPointer _ LOOPHOLE[to.block]; eFrom.blockPointer _ LOOPHOLE[from.block]; eTo.startIndex _ to.startIndex; eFrom.startIndex _ from.startIndex; eTo.stopIndexPlusOne _ to.startIndex+nBytes; eFrom.stopIndexPlusOne _ from.startIndex+nBytes; [] _ PrincOpsUtils.ByteBlt[eTo,eFrom]; }; <<-- ***** Initialization>> Start: PUBLIC PROC = { }; END.