Browse Source

+ introduced unit UnixKvmBase, which is going to contain miscellaneous routines,
commonly used by the unix keyboard, video and mouse units. Currently, it only
contains the UTF8Enabled function, which was moved away from the video unit
and which will also be used by the keyboard unit in the future, as soon as
that unit also gets UTF-8 input support.

git-svn-id: branches/unicodekvm@41357 -

nickysn 6 years ago
parent
commit
4ea55963ef

+ 1 - 0
.gitattributes

@@ -7443,6 +7443,7 @@ packages/rtl-console/src/unix/crt.pp svneol=native#text/plain
 packages/rtl-console/src/unix/keyboard.pp svneol=native#text/plain
 packages/rtl-console/src/unix/mouse.pp svneol=native#text/plain
 packages/rtl-console/src/unix/terminfo.pp svneol=native#text/plain
+packages/rtl-console/src/unix/unixkvmbase.pp svneol=native#text/plain
 packages/rtl-console/src/unix/video.pp svneol=native#text/plain
 packages/rtl-console/src/watcom/crt.pp svneol=native#text/plain
 packages/rtl-console/src/win/crt.pp svneol=native#text/plain

+ 3 - 0
packages/rtl-console/fpmake.pp

@@ -100,6 +100,7 @@ begin
        AddInclude('convert.inc',AllUnixOSes);
        AddInclude('nwsys.inc',[netware]);
        AddUnit   ('mouse',[go32v2,msdos]);
+       AddUnit   ('unixkvmbase',AllUnixOSes);
      end;
 
     T:=P.Targets.AddUnit('crt.pp',CrtOSes);
@@ -118,6 +119,8 @@ begin
        AddUnit('video');
        AddUnit('mouse');
      end;
+
+    T:=P.Targets.AddUnit('unixkvmbase.pp',AllUnixOSes);
   end
 end;
 

+ 44 - 0
packages/rtl-console/src/unix/unixkvmbase.pp

@@ -0,0 +1,44 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 1999-2000 by Florian Klaempfl
+    member of the Free Pascal development team
+
+    Miscellaneous routines used by the Keyboard, Mouse and
+    Video units on Unix-like operating systems.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+unit UnixKvmBase;
+
+{*****************************************************************************}
+                                   interface
+{*****************************************************************************}
+
+function UTF8Enabled: Boolean;
+
+{*****************************************************************************}
+                                implementation
+{*****************************************************************************}
+
+uses
+  baseunix;
+
+function UTF8Enabled: Boolean;
+var
+  lang:string;
+begin
+  {$ifdef BEOS}
+  UTF8Enabled := true;
+  exit;
+  {$endif}
+  lang:=upcase(fpgetenv('LANG'));
+  UTF8Enabled := (Pos('.UTF-8', lang) > 0) or (Pos('.UTF8', lang) > 0);
+end;
+
+end.

+ 1 - 13
packages/rtl-console/src/unix/video.pp

@@ -58,7 +58,7 @@ var internal_codepage,external_codepage:Tencoding;
                                 implementation
 {*****************************************************************************}
 
-uses  baseunix,termio,strings
+uses  baseunix,termio,strings,unixkvmbase
      {$ifdef linux},linuxvcs{$endif};
 
 {$i video.inc}
@@ -958,18 +958,6 @@ begin
   TCSetAttr(1,TCSANOW,tio);
 end;
 
-function UTF8Enabled: Boolean;
-var
-  lang:string;
-begin
-  {$ifdef BEOS}
-  UTF8Enabled := true;
-  exit;
-  {$endif}
-  lang:=upcase(fpgetenv('LANG'));
-  UTF8Enabled := (Pos('.UTF-8', lang) > 0) or (Pos('.UTF8', lang) > 0);
-end;
-
 procedure decide_codepages;
 
 var s:string;