Browse Source

+ unicode version of MoveBuf

git-svn-id: branches/unicodekvm@48555 -
nickysn 4 years ago
parent
commit
6fa787674f
1 changed files with 14 additions and 0 deletions
  1. 14 0
      packages/fv/src/drivers.inc

+ 14 - 0
packages/fv/src/drivers.inc

@@ -1039,6 +1039,19 @@ END;
 {---------------------------------------------------------------------------}
 {---------------------------------------------------------------------------}
 {  MoveBuf -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 10Jul99 LdB           }
 {  MoveBuf -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 10Jul99 LdB           }
 {---------------------------------------------------------------------------}
 {---------------------------------------------------------------------------}
+{$ifdef FV_UNICODE}
+PROCEDURE MoveBuf (Var Dest, Source; Attr: Byte; Count: Sw_Word);
+VAR I: Word; P: PEnhancedVideoCell;
+BEGIN
+   { todo: split string into extended grapheme clusters properly, handle non-BMP characters,
+     handle wide (CJK) characters, etc. }
+   For I := 1 To Count Do Begin
+     P := @(PEnhancedVideoCell(@Dest)[I-1]);          { Pointer to TEnhancedVideoCell }
+     If (Attr <> 0) Then P^.Attribute := Attr;        { Copy attribute }
+     P^.ExtendedGraphemeCluster := WideChar(TWordArray(Source)[I-1]); { Copy source data }
+   End;
+END;
+{$else FV_UNICODE}
 PROCEDURE MoveBuf (Var Dest, Source; Attr: Byte; Count: Sw_Word);
 PROCEDURE MoveBuf (Var Dest, Source; Attr: Byte; Count: Sw_Word);
 VAR I: Word; P: PWord;
 VAR I: Word; P: PWord;
 BEGIN
 BEGIN
@@ -1048,6 +1061,7 @@ BEGIN
      WordRec(P^).Lo := TByteArray(Source)[I-1];       { Copy source data }
      WordRec(P^).Lo := TByteArray(Source)[I-1];       { Copy source data }
    End;
    End;
 END;
 END;
+{$endif FV_UNICODE}
 
 
 {---------------------------------------------------------------------------}
 {---------------------------------------------------------------------------}
 {  MoveChar -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 10Jul99 LdB          }
 {  MoveChar -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 10Jul99 LdB          }